gct_util.h

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

SourceForge.net Logo
Project space on SourceForge.net