00001 /* subText.h - perform text substitutions. 00002 * 00003 * This file is copyright 2002 Jim Kent, but license is hereby 00004 * granted for all use - public, private or commercial. */ 00005 00006 #ifndef SUBTEXT_H 00007 #define SUBTEXT_H 00008 00009 struct subText 00010 /* Structure that holds data for a single substitution to be made. 00011 * The subText routines work mostly on lists of these. */ 00012 { 00013 struct subText *next; /* pointer to next substitution */ 00014 char *in; /* source side of substitution */ 00015 char *out; /* dest side of substitution */ 00016 int inSize; /* length of in string */ 00017 int outSize; /* length of out string */ 00018 }; 00019 00020 struct subText *subTextNew(char *in, char *out); 00021 /* Make new substitution structure. */ 00022 00023 void subTextFree(struct subText **pSub); 00024 /* Free a subText. */ 00025 00026 void subTextFreeList(struct subText **pList); 00027 /* Free a list of dynamically allocated subText's */ 00028 00029 int subTextSizeAfter(struct subText *subList, char *in); 00030 /* Return size string will be after substitutions. */ 00031 00032 void subTextStatic(struct subText *subList, char *in, char *out, int outMaxSize); 00033 /* Do substition to output buffer of given size. Complain 00034 * and die if not big enough. */ 00035 00036 char *subTextString(struct subText *subList, char *in); 00037 /* Return string with substitutions in list performed. freeMem 00038 * this string when done. */ 00039 00040 #endif /* SUBTEXT_H */ 00041
1.5.2