cfg_util.h

Go to the documentation of this file.
00001 /*** MODULE CFG_UTIL ***/
00002 /******************************************************************************/
00022 /******************************************************************************/
00023 /*
00024 * Author: Fred Kleinsorge (gct_util)
00025 *         Burns Fisher (makeover into cfg_util)
00026 *
00027 *   Modified by:
00028 *
00029 *       X-1     Burns Fisher                                28-Jul-1999
00030 *               Initial checkin
00031 */
00032 #ifndef _CFG_UTIL_H_
00033 #define _CFG_UTIL_H_
00034 
00035 #include <ints.h>
00036 #include <cfgdef.h>
00037 
00038 #define CFG_UTIL$_SUCCESS    1
00039 #define CFG_UTIL$_STRING_MAX 512
00040 
00041 /*
00042  * Flags for gcon_edit_string 
00043  */
00044 #define CFG_UTIL$_UPCASE                 0x01
00045 #define CFG_UTIL$_STRIP_LEAD_WHITESPACE  0x02
00046 #define CFG_UTIL$_STRIP_TRAIL_SPACES     0x04
00047 #define CFG_UTIL$_STRIP_QUOTES           0x08
00048 #define CFG_UTIL$_COMPRESS_SPACES        0x10
00049 #define CFG_UTIL$_COMPRESS_TABS          0x20
00050 #define CFG_UTIL$_STRIP_COMMENTS         0x40
00051 #define CFG_UTIL$_STRIP_SEMI_COMMENTS    0x80
00052 
00053 #define CFG_UTIL$_xTAB                   0x09
00054 #define CFG_UTIL$_xDELETE                0x7F
00055 
00056 /*
00057  * Flags for gcon_tokenize_input
00058  */
00059 #define CFG_UTIL$_NO_FLAGS         0
00060 #define CFG_UTIL$_RETURN_SEPERATORS 1
00061 
00062 /*
00063  *  TOUPPER and TOLOWER
00064  */
00065 #define _UPCASE(c)      (((c) >= 'a' && (c) <= 'z') \
00066                                     ? (c) & 0xDF : (c))
00067 
00068 #define _LOWERCASE(c)   (((c) >= 'A' && (c) <= 'Z') \
00069                                     ? (c) | 0x20 : (c))
00070 
00071 /*
00072  *  Utility routines
00073  */
00074 extern int   cfg_util$edit_string(char *new_string, char *old_string, int max_destination, int flags);
00075 extern int   cfg_util$tokenize_input(char *input_string, char **tokens, int max_tokens, int *seperators, int flags);
00076 extern int   cfg_util$compare_case_blind( char *str1, char *str2, int max);
00077 extern int   cfg_util$append_decimal_string(char *outstr, int bin);
00078 extern int   cfg_util$append_hex_string(char *outstr, int bin, int min, char pad, int upper);
00079 extern void  cfg_util$out_asciz_string(char *string);
00080 extern void  cfg_util$print_unknown_string(char *message, int length);
00081 
00082 #ifdef VMS$GLX
00083 
00084 /*
00085  *   STRING routines that mimic standard UNIX routines
00086  */
00087 extern int    cfg_util$string_length(char *str1);
00088 extern char  *cfg_util$string_copy(char *str1, char *str2);
00089 extern char  *cfg_util$string_append(char *str1, char *str2);
00090 extern int    cfg_util$string_compare( char *str1, char *str2, int max);
00091 extern uint64 cfg_util$strtouq (char *nptr, char **endptr, int base);
00092 
00093 
00094 /*
00095  *   STDIO routines that mimic printf/sprintf/fprintf
00096  */
00097 extern int   cfg_util$printf(char *msg, ...);
00098 extern int   cfg_util$fprintf(CFG_FILE *stream, char *msg, ...);
00099 extern int   cfg_util$sprintf(char *outs, char *msg, ...);
00100 
00101 /*
00102  *   Aliases for standard UNIX routined
00103  */
00104 #define strlen  cfg_util$string_length
00105 #define strcpy  cfg_util$string_copy
00106 #define strcat  cfg_util$string_append
00107 #define strncmp cfg_util$string_compare
00108 
00109 #ifdef strtouq
00110 #undef strtouq
00111 #endif
00112 #define strtouq cfg_util$strtouq
00113 
00114 #define printf  cfg_util$printf
00115 #define sprintf cfg_util$sprintf
00116 #define fprintf cfg_util$fprintf
00117 
00118 #else
00119 
00120 /*
00121  *  Define the normal string and IO functions
00122  */
00123 #include <stdio.h>
00124 #include <string.h>
00125 
00126 #endif /* VMS$GLX */
00127 
00128 #endif /* _CFG_UTIL_H_ */
00129 

SourceForge.net Logo
Project space on SourceForge.net