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

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.19.2.1! paf         8:        $Id: pa_common.h,v 1.19 2001/03/20 07:34:31 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: 
                     27: #define open _open
                     28: #define close _close
                     29: #define read _read
                     30: #define stat _stat
                     31: 
1.1       paf        32: #define vsnprintf __vsnprintf 
                     33: #define snprintf __snprintf
                     34: 
                     35: int __vsnprintf(char *, size_t, const char *, va_list);
                     36: int __snprintf(char *, size_t, const char *, ...);
1.11      paf        37: 
1.17      paf        38: //access
                     39: #define F_OK 0
                     40: #define X_OK 1
                     41: #define W_OK 2
                     42: #define R_OK 4
                     43: 
                     44: #define strcasecmp _stricmp
                     45: #define strncasecmp _strnicmp
                     46: #define mkdir(path, mode) _mkdir(path)
                     47: 
                     48: #define putenv _putenv
                     49: 
1.1       paf        50: #endif
1.2       paf        51: 
1.15      paf        52: /**
1.19      paf        53:        read specified text file using pool, 
1.15      paf        54:        if fail_on_read_problem is true[default] throws an exception
                     55: */
1.19      paf        56: char *file_read_text(Pool& pool, 
                     57:                                         const char *fname, 
                     58:                                         bool fail_on_read_problem=true);
1.17      paf        59: 
                     60: /**
                     61:        write data to specified file using pool, 
                     62:        throws an exception in case of problems
                     63: */
                     64: void file_write(Pool& pool, 
                     65:                                const char *fname,
                     66:                                const char *data, size_t size, 
1.19.2.1! paf        67:                                bool as_text/*,
        !            68:                                bool exclusive=false*/);
1.15      paf        69: 
                     70: /**
1.18      paf        71:        scans for @a delim[default \n] in @a *row_ref, 
                     72:        @return piece of line before it or end of string, if no @a delim found
                     73:        assigns @a *row_ref to point right after delimiter if there were one
                     74:        or to zero if no @a delim were found.
1.15      paf        75: */
1.7       paf        76: char *getrow(char **row_ref,char delim='\n');
                     77: //char *lsplit(char *,char);
                     78: char *lsplit(char **string_ref,char delim);
1.8       paf        79: char *rsplit(char *string, char delim);
1.9       paf        80: char *format(Pool& pool, double value, char *fmt);
1.10      paf        81: 
                     82: #ifndef max
                     83: inline int max(int a,int b) { return a>b?a:b; }
                     84: inline int min(int a,int b){ return a<b?a:b; }
                     85: #endif
                     86: 
1.13      paf        87: size_t stdout_write(const char *buf, size_t size);
1.14      paf        88: 
                     89: const char *unescape_chars(Pool& pool, const char *cp, int len);
                     90: 
                     91: const String& attributed_meaning_string(Value *meaning);
1.1       paf        92: 
                     93: #endif

E-mail: