Annotation of parser3/src/include/pa_common.h, revision 1.20

1.15      paf         1: /** @file
1.16      paf         2:        Parser: commonly used functions.
                      3: 
1.4       paf         4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.16      paf         5: 
1.5       paf         6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.4       paf         7: 
1.20    ! paf         8:        $Id: pa_common.h,v 1.19.2.2 2001/03/21 13:57:26 paf Exp $
1.1       paf         9: */
                     10: 
                     11: #ifndef PA_COMMON_H
                     12: #define PA_COMMON_H
                     13: 
1.14      paf        14: #ifdef HAVE_CONFIG_H
                     15: #      include "pa_config.h"
                     16: #endif
1.11      paf        17: 
1.17      paf        18: #include <stdio.h>
1.1       paf        19: #include <stdarg.h>
1.2       paf        20: #include "pa_pool.h"
1.1       paf        21: 
1.14      paf        22: class String;
                     23: class Value;
1.11      paf        24: 
1.1       paf        25: #ifdef WIN32
1.12      paf        26: 
1.20    ! paf        27: #ifndef open
        !            28: #      define open _open
        !            29: #endif
        !            30: #ifndef close
        !            31: #      define close _close
        !            32: #endif
        !            33: #ifndef read
        !            34: #      define read _read
        !            35: #endif
        !            36: #ifndef stat
        !            37: #      define stat _stat
        !            38: #endif
1.1       paf        39: 
1.20    ! paf        40: #ifndef vsnprintf
        !            41: #      define vsnprintf __vsnprintf 
1.1       paf        42: int __vsnprintf(char *, size_t, const char *, va_list);
1.20    ! paf        43: #endif
        !            44: #ifndef snprintf
        !            45: #      define snprintf __snprintf
1.1       paf        46: int __snprintf(char *, size_t, const char *, ...);
1.20    ! paf        47: #endif
1.17      paf        48: 
                     49: //access
                     50: #define F_OK 0
                     51: #define X_OK 1
                     52: #define W_OK 2
                     53: #define R_OK 4
                     54: 
1.20    ! paf        55: #ifndef strcasecmp
        !            56: #      define strcasecmp _stricmp
        !            57: #endif
        !            58: #ifndef strncasecmp
        !            59: #      define strncasecmp _strnicmp
        !            60: #endif
        !            61: #ifndef mkdir
        !            62: #      define mkdir(path, mode) _mkdir(path)
        !            63: #endif
1.17      paf        64: 
1.20    ! paf        65: #ifndef putenv
        !            66: #      define putenv _putenv
1.1       paf        67: #endif
1.2       paf        68: 
1.17      paf        69: #endif
                     70: 
1.15      paf        71: /**
1.19      paf        72:        read specified text file using pool, 
1.15      paf        73:        if fail_on_read_problem is true[default] throws an exception
                     74: */
1.19      paf        75: char *file_read_text(Pool& pool, 
                     76:                                         const char *fname, 
                     77:                                         bool fail_on_read_problem=true);
1.17      paf        78: 
                     79: /**
                     80:        write data to specified file using pool, 
                     81:        throws an exception in case of problems
                     82: */
                     83: void file_write(Pool& pool, 
                     84:                                const char *fname,
                     85:                                const char *data, size_t size, 
1.20    ! paf        86:                                bool as_text/*,
        !            87:                                bool exclusive=false*/);
1.15      paf        88: 
                     89: /**
1.18      paf        90:        scans for @a delim[default \n] in @a *row_ref, 
                     91:        @return piece of line before it or end of string, if no @a delim found
                     92:        assigns @a *row_ref to point right after delimiter if there were one
                     93:        or to zero if no @a delim were found.
1.15      paf        94: */
1.7       paf        95: char *getrow(char **row_ref,char delim='\n');
                     96: //char *lsplit(char *,char);
                     97: char *lsplit(char **string_ref,char delim);
1.8       paf        98: char *rsplit(char *string, char delim);
1.9       paf        99: char *format(Pool& pool, double value, char *fmt);
1.10      paf       100: 
                    101: #ifndef max
                    102: inline int max(int a,int b) { return a>b?a:b; }
                    103: inline int min(int a,int b){ return a<b?a:b; }
                    104: #endif
                    105: 
1.13      paf       106: size_t stdout_write(const char *buf, size_t size);
1.14      paf       107: 
                    108: const char *unescape_chars(Pool& pool, const char *cp, int len);
                    109: 
1.20    ! paf       110: const String& attributed_meaning_to_string(Value& meaning);
1.1       paf       111: 
                    112: #endif

E-mail: