Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef INSTALL_DS_H |
michael@0 | 6 | #define INSTALL_DS_H |
michael@0 | 7 | |
michael@0 | 8 | #include <stdio.h> |
michael@0 | 9 | #include <prio.h> |
michael@0 | 10 | #include <prmem.h> |
michael@0 | 11 | |
michael@0 | 12 | extern PRFileDesc *Pk11Install_FD; |
michael@0 | 13 | extern int Pk11Install_yylex(); |
michael@0 | 14 | extern int Pk11Install_yylinenum; |
michael@0 | 15 | extern char *Pk11Install_yyerrstr; |
michael@0 | 16 | |
michael@0 | 17 | typedef enum { STRING_VALUE, PAIR_VALUE } ValueType; |
michael@0 | 18 | |
michael@0 | 19 | typedef struct Pk11Install_Pair_str Pk11Install_Pair; |
michael@0 | 20 | typedef union Pk11Install_Pointer_str Pk11Install_Pointer; |
michael@0 | 21 | typedef struct Pk11Install_Value_str Pk11Install_Value; |
michael@0 | 22 | typedef struct Pk11Install_ValueList_str Pk11Install_ValueList; |
michael@0 | 23 | typedef struct Pk11Install_ListIter_str Pk11Install_ListIter; |
michael@0 | 24 | typedef struct Pk11Install_File_str Pk11Install_File; |
michael@0 | 25 | typedef struct Pk11Install_PlatformName_str Pk11Install_PlatformName; |
michael@0 | 26 | typedef struct Pk11Install_Platform_str Pk11Install_Platform; |
michael@0 | 27 | typedef struct Pk11Install_Info_str Pk11Install_Info; |
michael@0 | 28 | |
michael@0 | 29 | extern Pk11Install_Pointer Pk11Install_yylval; |
michael@0 | 30 | extern Pk11Install_ValueList* Pk11Install_valueList; |
michael@0 | 31 | |
michael@0 | 32 | /* |
michael@0 | 33 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 34 | // Pk11Install_Pair |
michael@0 | 35 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 36 | */ |
michael@0 | 37 | |
michael@0 | 38 | struct Pk11Install_Pair_str { |
michael@0 | 39 | char * key; |
michael@0 | 40 | Pk11Install_ValueList *list; |
michael@0 | 41 | |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | Pk11Install_Pair* |
michael@0 | 45 | Pk11Install_Pair_new_default(); |
michael@0 | 46 | Pk11Install_Pair* |
michael@0 | 47 | Pk11Install_Pair_new( char* _key, Pk11Install_ValueList* _list); |
michael@0 | 48 | void |
michael@0 | 49 | Pk11Install_Pair_delete(Pk11Install_Pair* _this); |
michael@0 | 50 | void |
michael@0 | 51 | Pk11Install_Pair_Print(Pk11Install_Pair* _this, int pad); |
michael@0 | 52 | |
michael@0 | 53 | /* |
michael@0 | 54 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 55 | // Pk11Install_Pointer |
michael@0 | 56 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 57 | */ |
michael@0 | 58 | union Pk11Install_Pointer_str { |
michael@0 | 59 | Pk11Install_ValueList *list; |
michael@0 | 60 | Pk11Install_Value *value; |
michael@0 | 61 | Pk11Install_Pair *pair; |
michael@0 | 62 | char *string; |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | /* |
michael@0 | 66 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 67 | // Pk11Install_Value |
michael@0 | 68 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 69 | */ |
michael@0 | 70 | struct Pk11Install_Value_str { |
michael@0 | 71 | |
michael@0 | 72 | ValueType type; |
michael@0 | 73 | char *string; |
michael@0 | 74 | Pk11Install_Pair *pair; |
michael@0 | 75 | struct Pk11Install_Value_str *next; |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | Pk11Install_Value* |
michael@0 | 79 | Pk11Install_Value_new_default(); |
michael@0 | 80 | Pk11Install_Value* |
michael@0 | 81 | Pk11Install_Value_new(ValueType _type, Pk11Install_Pointer ptr); |
michael@0 | 82 | void |
michael@0 | 83 | Pk11Install_Value_delete(Pk11Install_Value* _this); |
michael@0 | 84 | void |
michael@0 | 85 | Pk11Install_Value_Print(Pk11Install_Value* _this, int pad); |
michael@0 | 86 | |
michael@0 | 87 | /* |
michael@0 | 88 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 89 | // Pk11Install_ValueList |
michael@0 | 90 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 91 | */ |
michael@0 | 92 | struct Pk11Install_ValueList_str { |
michael@0 | 93 | int numItems; |
michael@0 | 94 | int numPairs; |
michael@0 | 95 | int numStrings; |
michael@0 | 96 | Pk11Install_Value *head; |
michael@0 | 97 | }; |
michael@0 | 98 | |
michael@0 | 99 | Pk11Install_ValueList* |
michael@0 | 100 | Pk11Install_ValueList_new(); |
michael@0 | 101 | void |
michael@0 | 102 | Pk11Install_ValueList_delete(Pk11Install_ValueList* _this); |
michael@0 | 103 | void |
michael@0 | 104 | Pk11Install_ValueList_AddItem(Pk11Install_ValueList* _this, |
michael@0 | 105 | Pk11Install_Value* item); |
michael@0 | 106 | void |
michael@0 | 107 | Pk11Install_ValueList_Print(Pk11Install_ValueList* _this, int pad); |
michael@0 | 108 | |
michael@0 | 109 | |
michael@0 | 110 | /* |
michael@0 | 111 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 112 | // Pk11Install_ListIter |
michael@0 | 113 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 114 | */ |
michael@0 | 115 | struct Pk11Install_ListIter_str { |
michael@0 | 116 | const Pk11Install_ValueList *list; |
michael@0 | 117 | Pk11Install_Value *current; |
michael@0 | 118 | }; |
michael@0 | 119 | |
michael@0 | 120 | Pk11Install_ListIter* |
michael@0 | 121 | Pk11Install_ListIter_new_default(); |
michael@0 | 122 | void |
michael@0 | 123 | Pk11Install_ListIter_init(Pk11Install_ListIter* _this); |
michael@0 | 124 | Pk11Install_ListIter* |
michael@0 | 125 | Pk11Install_ListIter_new(const Pk11Install_ValueList* _list); |
michael@0 | 126 | void |
michael@0 | 127 | Pk11Install_ListIter_delete(Pk11Install_ListIter* _this); |
michael@0 | 128 | void |
michael@0 | 129 | Pk11Install_ListIter_reset(Pk11Install_ListIter* _this); |
michael@0 | 130 | Pk11Install_Value* |
michael@0 | 131 | Pk11Install_ListIter_nextItem(Pk11Install_ListIter* _this); |
michael@0 | 132 | |
michael@0 | 133 | /************************************************************************ |
michael@0 | 134 | * |
michael@0 | 135 | * Pk11Install_File |
michael@0 | 136 | */ |
michael@0 | 137 | struct Pk11Install_File_str { |
michael@0 | 138 | char *jarPath; |
michael@0 | 139 | char *relativePath; |
michael@0 | 140 | char *absolutePath; |
michael@0 | 141 | PRBool executable; |
michael@0 | 142 | int permissions; |
michael@0 | 143 | }; |
michael@0 | 144 | |
michael@0 | 145 | Pk11Install_File* |
michael@0 | 146 | Pk11Install_File_new(); |
michael@0 | 147 | void |
michael@0 | 148 | Pk11Install_File_init(Pk11Install_File* _this); |
michael@0 | 149 | void |
michael@0 | 150 | Pk11Install_file_delete(Pk11Install_File* _this); |
michael@0 | 151 | /*// Parses a syntax tree to obtain all attributes. |
michael@0 | 152 | // Returns NULL for success, error message if parse error.*/ |
michael@0 | 153 | char* |
michael@0 | 154 | Pk11Install_File_Generate(Pk11Install_File* _this, |
michael@0 | 155 | const Pk11Install_Pair* pair); |
michael@0 | 156 | void |
michael@0 | 157 | Pk11Install_File_Print(Pk11Install_File* _this, int pad); |
michael@0 | 158 | void |
michael@0 | 159 | Pk11Install_File_Cleanup(Pk11Install_File* _this); |
michael@0 | 160 | |
michael@0 | 161 | /************************************************************************ |
michael@0 | 162 | * |
michael@0 | 163 | * Pk11Install_PlatformName |
michael@0 | 164 | */ |
michael@0 | 165 | struct Pk11Install_PlatformName_str { |
michael@0 | 166 | char *OS; |
michael@0 | 167 | char **verString; |
michael@0 | 168 | int numDigits; |
michael@0 | 169 | char *arch; |
michael@0 | 170 | }; |
michael@0 | 171 | |
michael@0 | 172 | Pk11Install_PlatformName* |
michael@0 | 173 | Pk11Install_PlatformName_new(); |
michael@0 | 174 | void |
michael@0 | 175 | Pk11Install_PlatformName_init(Pk11Install_PlatformName* _this); |
michael@0 | 176 | void |
michael@0 | 177 | Pk11Install_PlatformName_delete(Pk11Install_PlatformName* _this); |
michael@0 | 178 | char* |
michael@0 | 179 | Pk11Install_PlatformName_Generate(Pk11Install_PlatformName* _this, |
michael@0 | 180 | const char* str); |
michael@0 | 181 | char* |
michael@0 | 182 | Pk11Install_PlatformName_GetString(Pk11Install_PlatformName* _this); |
michael@0 | 183 | char* |
michael@0 | 184 | Pk11Install_PlatformName_GetVerString(Pk11Install_PlatformName* _this); |
michael@0 | 185 | void |
michael@0 | 186 | Pk11Install_PlatformName_Print(Pk11Install_PlatformName* _this, int pad); |
michael@0 | 187 | void |
michael@0 | 188 | Pk11Install_PlatformName_Cleanup(Pk11Install_PlatformName* _this); |
michael@0 | 189 | PRBool |
michael@0 | 190 | Pk11Install_PlatformName_equal(Pk11Install_PlatformName* _this, |
michael@0 | 191 | Pk11Install_PlatformName* cmp); |
michael@0 | 192 | PRBool |
michael@0 | 193 | Pk11Install_PlatformName_lteq(Pk11Install_PlatformName* _this, |
michael@0 | 194 | Pk11Install_PlatformName* cmp); |
michael@0 | 195 | PRBool |
michael@0 | 196 | Pk11Install_PlatformName_lt(Pk11Install_PlatformName* _this, |
michael@0 | 197 | Pk11Install_PlatformName* cmp); |
michael@0 | 198 | |
michael@0 | 199 | /************************************************************************ |
michael@0 | 200 | * |
michael@0 | 201 | * Pk11Install_Platform |
michael@0 | 202 | */ |
michael@0 | 203 | struct Pk11Install_Platform_str { |
michael@0 | 204 | Pk11Install_PlatformName name; |
michael@0 | 205 | Pk11Install_PlatformName equivName; |
michael@0 | 206 | struct Pk11Install_Platform_str *equiv; |
michael@0 | 207 | PRBool usesEquiv; |
michael@0 | 208 | char *moduleFile; |
michael@0 | 209 | char *moduleName; |
michael@0 | 210 | int modFile; |
michael@0 | 211 | unsigned long mechFlags; |
michael@0 | 212 | unsigned long cipherFlags; |
michael@0 | 213 | Pk11Install_File *files; |
michael@0 | 214 | int numFiles; |
michael@0 | 215 | }; |
michael@0 | 216 | |
michael@0 | 217 | Pk11Install_Platform* |
michael@0 | 218 | Pk11Install_Platform_new(); |
michael@0 | 219 | void |
michael@0 | 220 | Pk11Install_Platform_init(Pk11Install_Platform* _this); |
michael@0 | 221 | void |
michael@0 | 222 | Pk11Install_Platform_delete(Pk11Install_Platform* _this); |
michael@0 | 223 | /*// Returns NULL for success, error message if parse error.*/ |
michael@0 | 224 | char* |
michael@0 | 225 | Pk11Install_Platform_Generate(Pk11Install_Platform* _this, |
michael@0 | 226 | const Pk11Install_Pair *pair); |
michael@0 | 227 | void |
michael@0 | 228 | Pk11Install_Platform_Print(Pk11Install_Platform* _this, int pad); |
michael@0 | 229 | void |
michael@0 | 230 | Pk11Install_Platform_Cleanup(Pk11Install_Platform* _this); |
michael@0 | 231 | |
michael@0 | 232 | /************************************************************************ |
michael@0 | 233 | * |
michael@0 | 234 | * Pk11Install_Info |
michael@0 | 235 | */ |
michael@0 | 236 | struct Pk11Install_Info_str { |
michael@0 | 237 | Pk11Install_Platform *platforms; |
michael@0 | 238 | int numPlatforms; |
michael@0 | 239 | Pk11Install_PlatformName *forwardCompatible; |
michael@0 | 240 | int numForwardCompatible; |
michael@0 | 241 | }; |
michael@0 | 242 | |
michael@0 | 243 | Pk11Install_Info* |
michael@0 | 244 | Pk11Install_Info_new(); |
michael@0 | 245 | void |
michael@0 | 246 | Pk11Install_Info_init(); |
michael@0 | 247 | void |
michael@0 | 248 | Pk11Install_Info_delete(Pk11Install_Info* _this); |
michael@0 | 249 | /*// Returns NULL for success, error message if parse error.*/ |
michael@0 | 250 | char* |
michael@0 | 251 | Pk11Install_Info_Generate(Pk11Install_Info* _this, |
michael@0 | 252 | const Pk11Install_ValueList *list); |
michael@0 | 253 | /*// Returns NULL if there is no matching platform*/ |
michael@0 | 254 | Pk11Install_Platform* |
michael@0 | 255 | Pk11Install_Info_GetBestPlatform(Pk11Install_Info* _this, char* myPlatform); |
michael@0 | 256 | void |
michael@0 | 257 | Pk11Install_Info_Print(Pk11Install_Info* _this, int pad); |
michael@0 | 258 | void |
michael@0 | 259 | Pk11Install_Info_Cleanup(Pk11Install_Info* _this); |
michael@0 | 260 | |
michael@0 | 261 | #endif /* INSTALL_DS_H */ |