Changeset 108320 in vbox
- Timestamp:
- Feb 20, 2025 8:25:23 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167664
- Location:
- trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new/xpidl.c
r108284 r108320 45 45 static ModeData modes[] = { 46 46 {"header", "Generate C++ header", "h", xpidl_header_dispatch}, 47 /* {"typelib", "Generate XPConnect typelib", "xpt", xpidl_typelib_dispatch},*/ 47 {"typelib", "Generate XPConnect typelib", "xpt", xpidl_typelib_dispatch}, 48 48 {0, 0, 0, 0} 49 49 }; -
trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new/xpidl.h
r108319 r108320 184 184 /** The input stream this node was generated from (via #include's). */ 185 185 PCXPIDLINPUT pInput; 186 /** The type this node references (for identifiers only). */186 /** The type this node references (for identifiers and the inheritance for interfaces only). */ 187 187 PCXPIDLNODE pNdTypeRef; 188 188 /** The node type. */ -
trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new/xpidl_idl.c
r108319 r108320 1049 1049 XPIDL_PARSE_IDENTIFIER_EXT(pszIfInherit); 1050 1050 XPIDL_PARSE_PUNCTUATOR('{'); 1051 1052 PCXPIDLNODE pNdTypeRef = NULL; 1053 if (pszIfInherit) 1054 { 1055 pNdTypeRef = xpidlParseFindType(pThis, pszIfInherit); 1056 if (!pNdTypeRef) 1057 return xpidlParseError(pThis, pInput, NULL, VERR_NOT_FOUND, "Unknown referenced type '%s'\n", pszName); 1058 } 1059 1051 1060 /* Now for the fun part, parsing the body of the interface. */ 1052 1061 PXPIDLNODE pNode = xpidlNodeCreateWithAttrs(pThis, pParent, pInput, kXpidlNdType_Interface_Def, … … 1056 1065 pThis->cAttrs = 0; 1057 1066 1067 pNode->pNdTypeRef = pNdTypeRef; 1058 1068 pNode->u.If.pszIfName = pszName; 1059 1069 pNode->u.If.pszIfInherit = pszIfInherit; -
trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new/xpidl_typelib.c
r104485 r108320 40 40 * http://www.mozilla.org/scriptable/typelib_file.html 41 41 */ 42 #include <iprt/assert.h> 43 #include <iprt/string.h> 42 44 43 45 #include "xpidl.h" … … 46 48 #include <time.h> /* XXX XP? */ 47 49 48 struct priv_data{50 typedef struct XPIDLTYPELIBSTATE { 49 51 XPTHeader *header; 50 52 uint16 ifaces; 51 GHashTable *interface_map;53 RTLISTANCHOR LstInterfaces; 52 54 XPTInterfaceDescriptor *current; 53 55 XPTArena *arena; … … 55 57 uint16 next_const; 56 58 uint16 next_type; /* used for 'additional_types' for idl arrays */ 57 }; 58 59 #define HEADER(state) (((struct priv_data *)state->priv)->header) 60 #define IFACES(state) (((struct priv_data *)state->priv)->ifaces) 61 #define IFACE_MAP(state) (((struct priv_data *)state->priv)->interface_map) 62 #define CURRENT(state) (((struct priv_data *)state->priv)->current) 63 #define ARENA(state) (((struct priv_data *)state->priv)->arena) 64 #define NEXT_METH(state) (((struct priv_data *)state->priv)->next_method) 65 #define NEXT_CONST(state) (((struct priv_data *)state->priv)->next_const) 66 #define NEXT_TYPE(state) (((struct priv_data *)state->priv)->next_type) 59 } XPIDLTYPELIBSTATE; 60 typedef XPIDLTYPELIBSTATE *PXPIDLTYPELIBSTATE; 61 62 #define HEADER(state) (state->header) 63 #define IFACES(state) (state->ifaces) 64 #define IFACE_MAP(state) (state->LstInterfaces) 65 #define CURRENT(state) (state->current) 66 #define ARENA(state) (state->arena) 67 #define NEXT_METH(state) (state->next_method) 68 #define NEXT_CONST(state) (state->next_const) 69 #define NEXT_TYPE(state) (state->next_type) 67 70 68 71 #ifdef DEBUG_shaver … … 71 74 72 75 typedef struct { 76 RTLISTNODE NdInterfaces; 73 77 char *full_name; 74 78 char *name; 75 79 char *name_space; 76 80 char *iid; 77 gbooleanis_forward_dcl;81 bool is_forward_dcl; 78 82 } NewInterfaceHolder; 79 83 80 84 static NewInterfaceHolder* 81 CreateNewInterfaceHolder(c har *name, char *name_space, char *iid,82 gbooleanis_forward_dcl)85 CreateNewInterfaceHolder(const char *name, char *name_space, char *iid, 86 bool is_forward_dcl) 83 87 { 84 88 NewInterfaceHolder *holder = calloc(1, sizeof(NewInterfaceHolder)); … … 126 130 * interface map yet, add one. 127 131 */ 128 static gboolean 129 add_interface_maybe(IDL_tree_func_data *tfd, gpointer user_data) 130 { 131 TreeState *state = user_data; 132 if (IDL_NODE_TYPE(tfd->tree) == IDLN_IDENT) { 133 IDL_tree_type node_type = IDL_NODE_TYPE(IDL_NODE_UP(tfd->tree)); 134 if (node_type == IDLN_INTERFACE || node_type == IDLN_FORWARD_DCL) { 135 136 /* We only want to add a new entry if there is no entry by this 137 * name or if the previously found entry was just a forward 138 * declaration and the new entry is not. 139 */ 140 141 char *iface = IDL_IDENT(tfd->tree).str; 142 NewInterfaceHolder *old_holder = (NewInterfaceHolder *) 143 g_hash_table_lookup(IFACE_MAP(state), iface); 144 if (old_holder && old_holder->is_forward_dcl && 145 node_type != IDLN_FORWARD_DCL) 132 static bool add_interface_maybe(PXPIDLTYPELIBSTATE pThis, PCXPIDLNODE pNd) 133 { 134 if (pNd->enmType == kXpidlNdType_Identifier) 135 { 136 pNd = pNd->pNdTypeRef; 137 AssertPtr(pNd); 138 } 139 140 if ( pNd->enmType == kXpidlNdType_Interface_Forward_Decl 141 || pNd->enmType == kXpidlNdType_Interface_Def) 142 { 143 144 /* We only want to add a new entry if there is no entry by this 145 * name or if the previously found entry was just a forward 146 * declaration and the new entry is not. 147 */ 148 149 const char *pszIfName = pNd->enmType == kXpidlNdType_Interface_Forward_Decl 150 ? pNd->u.pszIfFwdName 151 : pNd->u.If.pszIfName; 152 NewInterfaceHolder *old_holder = NULL; 153 154 NewInterfaceHolder *pIt; 155 RTListForEach(&IFACE_MAP(pThis), pIt, NewInterfaceHolder, NdInterfaces) 156 { 157 if (!strcmp(pIt->name, pszIfName)) 146 158 { 147 g_hash_table_remove(IFACE_MAP(state), iface); 148 DeleteNewInterfaceHolder(old_holder); 149 old_holder = NULL; 159 old_holder = pIt; 160 break; 150 161 } 151 if (!old_holder) { 152 /* XXX should we parse here and store a struct nsID *? */ 153 char *iid = (char *)IDL_tree_property_get(tfd->tree, "uuid"); 154 char *name_space = (char *) 155 IDL_tree_property_get(tfd->tree, "namespace"); 156 NewInterfaceHolder *holder = 157 CreateNewInterfaceHolder(iface, name_space, iid, 158 (gboolean) node_type == IDLN_FORWARD_DCL); 159 if (!holder) 160 return FALSE; 161 g_hash_table_insert(IFACE_MAP(state), 162 holder->full_name, holder); 163 IFACES(state)++; 162 } 163 164 if ( old_holder 165 && old_holder->is_forward_dcl 166 && pNd->enmType != kXpidlNdType_Interface_Forward_Decl) 167 { 168 RTListNodeRemove(&old_holder->NdInterfaces); 169 DeleteNewInterfaceHolder(old_holder); 170 old_holder = NULL; 171 } 172 173 if (!old_holder) 174 { 175 /* XXX should we parse here and store a struct nsID *? */ 176 char *iid = (char *)xpidlNodeAttrFind(pNd, "uuid"); 177 char *name_space = (char *)xpidlNodeAttrFind(pNd, "namespace"); 178 NewInterfaceHolder *holder = CreateNewInterfaceHolder(pszIfName, name_space, iid, pNd->enmType == kXpidlNdType_Interface_Forward_Decl); 179 if (!holder) 180 return false; 181 RTListAppend(&pThis->LstInterfaces, &holder->NdInterfaces); 182 183 IFACES(pThis)++; 164 184 #ifdef DEBUG_shaver_ifaces 165 fprintf(stderr, "adding interface #%d: %s/%s\n", IFACES(state), 166 iface, iid[0] ? iid : "<unresolved>"); 167 #endif 185 fprintf(stderr, "adding interface #%d: %s/%s\n", IFACES(pThis), 186 pszIfName, iid[0] ? iid : "<unresolved>"); 187 #endif 188 } 189 } 190 191 return true; 192 } 193 194 /* Find all the interfaces referenced in the tree (uses add_interface_maybe) */ 195 static bool find_interfaces(PXPIDLTYPELIBSTATE pThis, PCXPIDLINPUT pInput, PCRTLISTANCHOR pLstNodes) 196 { 197 PCXPIDLNODE pIt; 198 RTListForEach(pLstNodes, pIt, XPIDLNODE, NdLst) 199 { 200 switch (pIt->enmType) 201 { 202 case kXpidlNdType_Identifier: 203 { 204 if (pIt->u.Attribute.pNdTypeSpec) 205 add_interface_maybe(pThis, pIt->u.Attribute.pNdTypeSpec); 206 break; 168 207 } 169 } 170 } 171 172 return TRUE; 173 } 174 175 /* Find all the interfaces referenced in the tree (uses add_interface_maybe) */ 176 static gboolean 177 find_interfaces(IDL_tree_func_data *tfd, gpointer user_data) 178 { 179 IDL_tree node = NULL; 180 181 switch (IDL_NODE_TYPE(tfd->tree)) { 182 case IDLN_ATTR_DCL: 183 node = IDL_ATTR_DCL(tfd->tree).param_type_spec; 184 break; 185 case IDLN_OP_DCL: 186 IDL_tree_walk_in_order(IDL_OP_DCL(tfd->tree).parameter_dcls, find_interfaces, 187 user_data); 188 node = IDL_OP_DCL(tfd->tree).op_type_spec; 189 break; 190 case IDLN_PARAM_DCL: 191 node = IDL_PARAM_DCL(tfd->tree).param_type_spec; 192 break; 193 case IDLN_INTERFACE: 194 node = IDL_INTERFACE(tfd->tree).inheritance_spec; 195 if (node) 196 xpidl_list_foreach(node, add_interface_maybe, user_data); 197 node = IDL_INTERFACE(tfd->tree).ident; 198 break; 199 case IDLN_FORWARD_DCL: 200 node = IDL_FORWARD_DCL(tfd->tree).ident; 201 break; 202 default: 203 node = NULL; 204 } 205 206 if (node && IDL_NODE_TYPE(node) == IDLN_IDENT) { 207 IDL_tree_func_data new_tfd; 208 new_tfd.tree = node; 209 add_interface_maybe(&new_tfd, user_data); 210 } 211 212 return TRUE; 208 case kXpidlNdType_Interface_Forward_Decl: 209 add_interface_maybe(pThis, pIt); 210 break; 211 case kXpidlNdType_Interface_Def: 212 if (pIt->u.Attribute.pNdTypeSpec) 213 add_interface_maybe(pThis, pIt->u.Attribute.pNdTypeSpec); 214 add_interface_maybe(pThis, pIt); 215 if (!find_interfaces(pThis, pInput, &pIt->u.If.LstBody)) 216 return false; 217 break; 218 case kXpidlNdType_Attribute: 219 add_interface_maybe(pThis, pIt->u.Attribute.pNdTypeSpec); 220 break; 221 case kXpidlNdType_Method: 222 add_interface_maybe(pThis, pIt->u.Method.pNdTypeSpecRet); 223 if (!find_interfaces(pThis, pInput, &pIt->u.Method.LstParams)) 224 return false; 225 case kXpidlNdType_Parameter: 226 add_interface_maybe(pThis, pIt->u.Param.pNdTypeSpec); 227 break; 228 default: 229 break; 230 } 231 } 232 233 return true; 213 234 } 214 235 … … 226 247 227 248 /* fill the interface_directory IDE table from the interface_map */ 228 static gboolean229 fill_ide_table(gpointer key, gpointer value, gpointer user_data) 230 { 231 TreeState *state = user_data;232 NewInterfaceHolder *holder = (NewInterfaceHolder *) value;233 struct nsID id;234 XPTInterfaceDirectoryEntry *ide;235 236 XPT_ASSERT(holder);249 static bool fill_ide_table(PXPIDLTYPELIBSTATE pThis) 250 { 251 NewInterfaceHolder *pIt, *pItNext; 252 RTListForEachSafe(&pThis->LstInterfaces, pIt, pItNext, NewInterfaceHolder, NdInterfaces) 253 { 254 struct nsID id; 255 XPTInterfaceDirectoryEntry *ide; 256 257 XPT_ASSERT(pIt); 237 258 238 259 #ifdef DEBUG_shaver_ifaces 239 fprintf(stderr, "filling %s\n", holder->full_name); 240 #endif 241 242 if (holder->iid) { 243 if (strlen(holder->iid) != 36) { 244 IDL_tree_error(state->tree, "IID %s is the wrong length\n", 245 holder->iid); 246 return FALSE; 247 } 248 if (!xpidl_parse_iid(&id, holder->iid)) { 249 IDL_tree_error(state->tree, "cannot parse IID %s\n", holder->iid); 250 return FALSE; 251 } 252 } else { 253 memset(&id, 0, sizeof(id)); 254 } 255 256 ide = &(HEADER(state)->interface_directory[IFACES(state)]); 257 if (!XPT_FillInterfaceDirectoryEntry(ARENA(state), ide, &id, holder->name, 258 holder->name_space, NULL)) { 259 IDL_tree_error(state->tree, "INTERNAL: XPT_FillIDE failed for %s\n", 260 holder->full_name); 261 return FALSE; 262 } 263 264 IFACES(state)++; 265 DeleteNewInterfaceHolder(holder); 266 return TRUE; 260 fprintf(stderr, "filling %s\n", pIt->full_name); 261 #endif 262 263 if (pIt->iid) { 264 if (strlen(pIt->iid) != 36) { 265 //IDL_tree_error(state->tree, "IID %s is the wrong length\n", 266 // pIt->iid); 267 return false; 268 } 269 if (!xpidl_parse_iid(&id, pIt->iid)) { 270 //IDL_tree_error(state->tree, "cannot parse IID %s\n", holder->iid); 271 return false; 272 } 273 } else { 274 memset(&id, 0, sizeof(id)); 275 } 276 277 ide = &(HEADER(pThis)->interface_directory[IFACES(pThis)]); 278 if (!XPT_FillInterfaceDirectoryEntry(ARENA(pThis), ide, &id, pIt->name, 279 pIt->name_space, NULL)) { 280 //IDL_tree_error(state->tree, "INTERNAL: XPT_FillIDE failed for %s\n", 281 // holder->full_name); 282 return false; 283 } 284 285 IFACES(pThis)++; 286 RTListNodeRemove(&pIt->NdInterfaces); 287 DeleteNewInterfaceHolder(pIt); 288 } 289 return true; 267 290 } 268 291 … … 300 323 /* sort the IDE block as per the typelib spec: IID order, unresolved first */ 301 324 static void 302 sort_ide_block( TreeState *state)325 sort_ide_block(PXPIDLTYPELIBSTATE pThis) 303 326 { 304 327 XPTInterfaceDirectoryEntry *ide; … … 308 331 #ifdef DEBUG_shaver_sort 309 332 fputs("before sort:\n", stderr); 310 for (i = 0; i < IFACES( state); i++) {333 for (i = 0; i < IFACES(pThis); i++) { 311 334 fputs(" ", stderr); 312 print_IID(&HEADER( state)->interface_directory[i].iid, stderr);335 print_IID(&HEADER(pThis)->interface_directory[i].iid, stderr); 313 336 fputc('\n', stderr); 314 337 } 315 338 #endif 316 qsort(HEADER( state)->interface_directory, IFACES(state),339 qsort(HEADER(pThis)->interface_directory, IFACES(pThis), 317 340 sizeof(*ide), compare_IDEs); 318 341 #ifdef DEBUG_shaver_sort 319 342 fputs("after sort:\n", stderr); 320 for (i = 0; i < IFACES( state); i++) {343 for (i = 0; i < IFACES(pThis); i++) { 321 344 fputs(" ", stderr); 322 print_IID(&HEADER( state)->interface_directory[i].iid, stderr);345 print_IID(&HEADER(pThis)->interface_directory[i].iid, stderr); 323 346 fputc('\n', stderr); 324 347 } 325 348 #endif 326 349 327 for (i = 0; i < IFACES(state); i++) { 328 ide = HEADER(state)->interface_directory + i; 329 g_hash_table_insert(IFACE_MAP(state), ide->name, (void *)(i + 1)); 330 } 331 332 return; 333 } 334 350 #if 0 351 for (i = 0; i < IFACES(pThis); i++) { 352 ide = HEADER(pThis)->interface_directory + i; 353 g_hash_table_insert(IFACE_MAP(pThis), ide->name, (void *)(i + 1)); 354 } 355 #endif 356 } 357 358 #if 0 335 359 static gboolean 336 360 typelib_list(TreeState *state) … … 344 368 return TRUE; 345 369 } 346 347 static gboolean 348 typelib_prolog(TreeState *state) 349 { 350 state->priv = calloc(1, sizeof(struct priv_data)); 351 if (!state->priv) 352 return FALSE; 353 IFACES(state) = 0; 354 IFACE_MAP(state) = g_hash_table_new(g_str_hash, g_str_equal); 355 if (!IFACE_MAP(state)) { 356 /* XXX report error */ 357 free(state->priv); 358 return FALSE; 359 } 370 #endif 371 372 static int typelib_prolog(PXPIDLTYPELIBSTATE pThis, PCXPIDLINPUT pInput, PCXPIDLPARSE pParse) 373 { 374 IFACES(pThis) = 0; 375 RTListInit(&IFACE_MAP(pThis)); 376 360 377 /* find all interfaces, top-level and referenced by others */ 361 IDL_tree_walk_in_order(state->tree, find_interfaces, state); 362 ARENA(state) = XPT_NewArena(1024, sizeof(double), "main xpidl arena"); 363 HEADER(state) = XPT_NewHeader(ARENA(state), IFACES(state), 378 if (!find_interfaces(pThis, pInput, &pParse->LstNodes)) 379 return VERR_BUFFER_OVERFLOW; 380 381 ARENA(pThis) = XPT_NewArena(1024, sizeof(double), "main xpidl arena"); 382 HEADER(pThis) = XPT_NewHeader(ARENA(pThis), IFACES(pThis), 364 383 major_version, minor_version); 365 384 366 385 /* fill IDEs from hash table */ 367 IFACES(state) = 0; 368 g_hash_table_foreach_remove(IFACE_MAP(state), fill_ide_table, state); 386 IFACES(pThis) = 0; 387 if (!fill_ide_table(pThis)) 388 return VERR_NO_MEMORY; 369 389 370 390 /* if any are left then we must have failed in fill_ide_table */ 371 if ( g_hash_table_size(IFACE_MAP(state)))372 return FALSE;391 if (!RTListIsEmpty(&IFACE_MAP(pThis))) 392 return VERR_BUFFER_OVERFLOW; 373 393 374 394 /* sort the IDEs by IID order and store indices in the interface map */ 375 sort_ide_block(state); 376 377 return TRUE; 378 } 379 380 static gboolean 381 typelib_epilog(TreeState *state) 395 sort_ide_block(pThis); 396 397 return VINF_SUCCESS; 398 } 399 400 static int typelib_epilog(PXPIDLTYPELIBSTATE pThis, FILE *pFile, PCXPIDLINPUT pInput) 382 401 { 383 402 XPTState *xstate = XPT_NewXDRState(XPT_ENCODE, NULL, 0); … … 404 423 405 424 /* How large should the annotation string be? */ 406 annotation_len = strlen(annotation_format) + strlen( state->basename) +425 annotation_len = strlen(annotation_format) + strlen(pInput->pszBasename) + 407 426 strlen(timestr); 408 427 #ifdef VBOX … … 411 430 * bytes minus one byte (for the terminating '\0') more than necessary. */ 412 431 #endif 413 for (i = 0; i < HEADER( state)->num_interfaces; i++) {432 for (i = 0; i < HEADER(pThis)->num_interfaces; i++) { 414 433 XPTInterfaceDirectoryEntry *ide; 415 ide = &HEADER( state)->interface_directory[i];434 ide = &HEADER(pThis)->interface_directory[i]; 416 435 if (ide->interface_descriptor) { 417 436 annotation_len += strlen(ide->name) + 1; … … 421 440 annotate_val = (char *) malloc(annotation_len); 422 441 written_so_far = sprintf(annotate_val, annotation_format, 423 state->basename, timestr);442 pInput->pszBasename, timestr); 424 443 425 for (i = 0; i < HEADER( state)->num_interfaces; i++) {444 for (i = 0; i < HEADER(pThis)->num_interfaces; i++) { 426 445 XPTInterfaceDirectoryEntry *ide; 427 ide = &HEADER( state)->interface_directory[i];446 ide = &HEADER(pThis)->interface_directory[i]; 428 447 if (ide->interface_descriptor) { 429 448 written_so_far += sprintf(annotate_val + written_so_far, " %s", … … 432 451 } 433 452 434 HEADER( state)->annotations =435 XPT_NewAnnotation(ARENA( state),453 HEADER(pThis)->annotations = 454 XPT_NewAnnotation(ARENA(pThis), 436 455 XPT_ANN_LAST | XPT_ANN_PRIVATE, 437 XPT_NewStringZ(ARENA( state), "xpidl 0.99.9"),438 XPT_NewStringZ(ARENA( state), annotate_val));456 XPT_NewStringZ(ARENA(pThis), "xpidl 0.99.9"), 457 XPT_NewStringZ(ARENA(pThis), annotate_val)); 439 458 free(annotate_val); 440 459 } else { 441 HEADER( state)->annotations =442 XPT_NewAnnotation(ARENA( state), XPT_ANN_LAST, NULL, NULL);443 } 444 445 if (!HEADER( state)->annotations) {460 HEADER(pThis)->annotations = 461 XPT_NewAnnotation(ARENA(pThis), XPT_ANN_LAST, NULL, NULL); 462 } 463 464 if (!HEADER(pThis)->annotations) { 446 465 /* XXX report out of memory error */ 447 return FALSE;466 return false; 448 467 } 449 468 450 469 /* Write the typelib */ 451 header_sz = XPT_SizeOfHeaderBlock(HEADER( state));470 header_sz = XPT_SizeOfHeaderBlock(HEADER(pThis)); 452 471 453 472 if (!xstate || … … 455 474 goto destroy_header; 456 475 oldOffset = cursor->offset; 457 if (!XPT_DoHeader(ARENA( state), cursor, &HEADER(state)))476 if (!XPT_DoHeader(ARENA(pThis), cursor, &HEADER(pThis))) 458 477 goto destroy; 459 478 newOffset = cursor->offset; 460 479 XPT_GetXDRDataLength(xstate, XPT_HEADER, &len); 461 HEADER( state)->file_length = len;480 HEADER(pThis)->file_length = len; 462 481 XPT_GetXDRDataLength(xstate, XPT_DATA, &len); 463 HEADER( state)->file_length += len;482 HEADER(pThis)->file_length += len; 464 483 XPT_SeekTo(cursor, oldOffset); 465 if (!XPT_DoHeaderPrologue(ARENA( state), cursor, &HEADER(state), NULL))484 if (!XPT_DoHeaderPrologue(ARENA(pThis), cursor, &HEADER(pThis), NULL)) 466 485 goto destroy; 467 486 XPT_SeekTo(cursor, newOffset); 468 487 XPT_GetXDRData(xstate, XPT_HEADER, &data, &len); 469 fwrite(data, len, 1, state->file);488 fwrite(data, len, 1, pFile); 470 489 XPT_GetXDRData(xstate, XPT_DATA, &data, &len); 471 fwrite(data, len, 1, state->file);490 fwrite(data, len, 1, pFile); 472 491 473 492 destroy: 474 493 XPT_DestroyXDRState(xstate); 475 494 destroy_header: 476 /* XXX XPT_DestroyHeader(HEADER(state)) */ 477 478 XPT_FreeHeader(ARENA(state), HEADER(state)); 479 XPT_DestroyArena(ARENA(state)); 480 481 /* XXX should destroy priv_data here */ 482 483 return TRUE; 484 } 485 495 /* XXX XPT_DestroyHeader(HEADER(pThis)) */ 496 497 XPT_FreeHeader(ARENA(pThis), HEADER(pThis)); 498 XPT_DestroyArena(ARENA(pThis)); 499 return VINF_SUCCESS; 500 } 501 502 #if 0 486 503 static XPTInterfaceDirectoryEntry * 487 504 FindInterfaceByName(XPTInterfaceDirectoryEntry *ides, uint16 num_interfaces, … … 1194 1211 return TRUE; 1195 1212 } 1196 1197 backend * 1198 xpidl_typelib_dispatch(void) 1199 { 1200 static backend result; 1201 static nodeHandler table[IDLN_LAST]; 1202 static gboolean initialized = FALSE; 1203 1204 result.emit_prolog = typelib_prolog; 1205 result.emit_epilog = typelib_epilog; 1206 1207 if (!initialized) { 1208 /* Initialize non-NULL elements */ 1209 table[IDLN_LIST] = typelib_list; 1210 table[IDLN_ATTR_DCL] = typelib_attr_dcl; 1211 table[IDLN_OP_DCL] = typelib_op_dcl; 1212 table[IDLN_INTERFACE] = typelib_interface; 1213 table[IDLN_CONST_DCL] = typelib_const_dcl; 1214 table[IDLN_TYPE_ENUM] = typelib_enum; 1215 table[IDLN_NATIVE] = check_native; 1216 initialized = TRUE; 1217 } 1218 1219 result.dispatch_table = table; 1220 return &result; 1221 } 1222 1223 1224 1213 #endif 1214 1215 DECL_HIDDEN_CALLBACK(int) xpidl_typelib_dispatch(FILE *pFile, PCXPIDLINPUT pInput, PCXPIDLPARSE pParse) 1216 { 1217 XPIDLTYPELIBSTATE This; RT_ZERO(This); 1218 int rc = typelib_prolog(&This, pInput, pParse); 1219 if (RT_SUCCESS(rc)) 1220 { 1221 /** @todo */ 1222 rc = typelib_epilog(&This, pFile, pInput); 1223 } 1224 1225 return rc; 1226 } 1227 1228 1229 -
trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl-new/xpidl_util.c
r108305 r108320 73 73 } 74 74 75 #if 076 void77 xpidl_write_comment(TreeState *state, int indent)78 {79 fprintf(state->file, "%*s/* ", indent, "");80 IDL_tree_to_IDL(state->tree, state->ns, state->file,81 IDLF_OUTPUT_NO_NEWLINES |82 IDLF_OUTPUT_NO_QUALIFY_IDENTS |83 IDLF_OUTPUT_PROPERTIES);84 fputs(" */\n", state->file);85 }86 #endif87 75 88 76 /*
Note:
See TracChangeset
for help on using the changeset viewer.