1 #include <errno.h> 2 #include <time.h> 3 #include <stdio.h> 4 #include <string.h> 5 #include <ctype.h> 6 #include <signal.h> 7 #include <stdlib.h> 8 #include <sys/types.h> 9 #include <sys/stat.h> 10 #include "data.h" 11 #include "config.h" 12 13 /****************************************************** 14 * Globale Variablen und #define's * 15 ******************************************************/ 16 17 #if defined(WIN32) || defined(WINDOWS) || defined(DOS) 18 19 /* needed for compatiblity */ 20 21 #define strcasecmp stricmp 22 #define NullDevice "nul" 23 24 #else 25 26 #define NullDevice "/dev/null" 27 28 #endif 29 30 31 #define DepthIndent 4 32 extern int memblocks; 33 extern FILE *mylog, *myout; 34 extern char WarnProperties; 35 extern char myinputfile[100]; 36 37 #define false 0 38 #define true !false 39 40 #define IsSpace(Str) (strcspn(Str," \t\n\r")==0) 41 #define malloctype(t) (t *)malloc(sizeof(t)) 42 43 #define NullString(str) ((&*str)?str:"") 44 45 extern char debmodeorig; 46 47 /****************************************************** 48 * Struktur- und Typdefinitionen * 49 ******************************************************/ 50 51 /* 52 53 Referenzen der Tags: 54 55 Parent<---------. 56 | 57 ,---,---� 58 | S |<--- Parent-referenzen von SubTags 59 `---� 60 ,-� || 61 | |`--->SubTags 62 .|, `---->LastSubTag 63 Next 64 65 ,---. 66 | 1 |<---------. 67 `---� | 68 LS ,---,P-�| 69 |`--->| 2 | | 70 | `---� | 71 | ,N� | 72 | | | 73 | | ,---,P--� 74 | `->| 3 | 75 |`--->`---� 76 | ,-� 77 ... 78 79 S SubTags 80 L LastSubTag 81 P Parent 82 N Next 83 84 InsertAsSubTag 85 ,---. 86 | 1 |<---------. <- Referenz 87 `---� | 88 || ,---,---� 89 |`--->| i |<---------. 90 `---->`---� | 91 || ,---,--�| 92 |`--->| 2 | | 93 | `---� | 94 | ,-� | 95 | | ,---,---� 96 | `->| 3 | 97 `---->`---� 98 99 InsertIncTag 100 ,---. 101 | 1 |<---------. 102 `---� | 103 || ,---,--�| 104 |`--->| 2 | | <- Referenz 105 | `---� | 106 | ,-� | 107 | | | 108 | | ,---,---� 109 | `->| i |<---------. 110 | `---� | 111 | ,-� || ,---,---� 112 ... |`--->| 3 | 113 `---->`---� 114 115 AddSubTagFirst 116 ,---. 117 | 1 |<---------. <- Referenz 118 `---� | 119 || ,---,--�| 120 |`--->| i | | 121 | `---� | 122 | ,-� | 123 | | ,---,--�| 124 | `->| 2 | | 125 | `---� | 126 | ,-� | 127 | | ,---,---� 128 | `->| 3 | 129 `---->`---� 130 131 AddTagAfter 132 ,---. 133 | 1 |<---------. 134 `---� | 135 || ,---,--�| 136 |`--->| 2 | | <- Referenz 137 | `---� | 138 | ,-� | 139 | | ,---,--�| 140 | `->| i | | 141 | `---� | 142 | ,-� | 143 | | ,---,---� 144 | `->| 3 | 145 `---->`---� 146 147 AddTagAfterIncRest 148 ,---. 149 | 1 |<---------. 150 `---� | 151 || ,---,--�| 152 |`--->| 2 | | <- Referenz 153 | `---� | 154 | ,-� | 155 | | ,---,--� 156 | `->| i |<--------. 157 `---->`---� | 158 || | 159 || ,---,--� 160 |`--->| 3 | 161 `---->`---� 162 163 AddSubTagLast 164 ,---. 165 | 1 |<---------. <- Referenz 166 `---� | 167 || ,---,--�| 168 |`--->| 2 | | 169 | `---� | 170 | ,-� | 171 | | ,---,--�| 172 | `->| 3 | | 173 | `---� | 174 | ,-� | 175 | | ,---,---� 176 | `->| i | 177 `---->`---� 178 */ 179 180 181 182 /* ***** Functions ***** */ 183 184 185 long a2l(tPChar Value, long StdValue); 186 double a2f(tPChar Value, double StdValue); 187 double ap2f(tPChar Value, double StdValue, double percentbase); 188 int strmulticmp(tPChar find, tPChar multi); 189 int isspacestr(char *s); 190 191 tPPropertyType SearchPropertyType(tPChar PropertyName, tPTagType pTagType); 192 tPProperty SearchProperty(tPTag pTag, tPChar Name); 193 tPTagType SearchTagType(tPTag pParentTag, tPChar TagName); 194 void ParseProperty(tPProperty * ppProp, tPChar Name, tPChar Value, 195 tPTagType pTagType); 196 197 char InitROOT(); 198 199 tPTag InsertAsSubTag(tPTag pTag, tPChar TagName); 200 tPTag InsertToSubTag(tPTag pTag, tPChar TagName); 201 tPTag AddSubTagFirstIncludeText(tPTag pTag, tPChar TagName); 202 tPTag AddSubTagFirst(tPTag pTag, tPChar TagName); 203 tPTag AddTagBefore(tPTag pTag, tPChar TagName); 204 tPTag AddTagAfter(tPTag pTag, tPChar TagName); 205 tPTag AddTagAfterIncRest(tPTag pTag, tPChar TagName); 206 tPTag AddSubTagLast(tPTag pTag, tPChar TagName); 207 208 tPProperty RemoveProperty(tPTag pTag, tPProperty pProp); 209 tPProperty AddProperty(tPTag pTag, tPChar PropertyName); 210 tPProperty AddPropertyValue(tPTag pTag, tPChar PropertyName, 211 tPChar PropertyValue); 212 void AddTreePropertyValue(tPTag pTag, tPChar PropertyName, 213 tPChar PropertyValue, char ProcessSubAfterHit, 214 char ProcessNext); 215 tPProperty AddPropertySeparator(tPTag pTag); 216 217 void FreeTag(tPPTag ppTag); 218 219 char IsTrivialTree(int depth, tPTag pt); 220 tPTag GetPrevTag(tPTag pt); 221 tPChar getIndent(tPTag pTag); 222 void printTagFilePos(FILE * f, tPTag pt); 223 tPProperty GetConfig(tPTag pt, tPChar config); 224 225