Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2165 lines
56 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation, 1997-1998. All rights reserved. */
  3. #include "precomp.h"
  4. #include "error.h"
  5. /* allocate a new value of type _T, copy *_src and return this duplicate */
  6. #define RETDUP(_T, _src) _T *ret; ret = (_T *)malloc(sizeof(_T)); *ret = *(_src); return ret
  7. /* constructor of Assignment_t */
  8. Assignment_t *
  9. NewAssignment(Assignment_e type)
  10. {
  11. Assignment_t *ret;
  12. ret = (Assignment_t *)malloc(sizeof(Assignment_t));
  13. if (! ret)
  14. return NULL;
  15. memset(ret, 0, sizeof(Assignment_t));
  16. // ret->Next = NULL;
  17. // ret->Identifier = NULL;
  18. // ret->Module = NULL;
  19. // ret->Flags = 0;
  20. // ret->fImportedLocalDuplicate = 0;
  21. // ret->fGhost = 0;
  22. ret->eDefTagType = eTagType_Unknown;
  23. ret->Type = type;
  24. switch (type) {
  25. case eAssignment_Undefined:
  26. break;
  27. case eAssignment_ModuleIdentifier:
  28. break;
  29. case eAssignment_Type:
  30. // ret->U.Type.Type = NULL;
  31. break;
  32. case eAssignment_Value:
  33. // ret->U.Value.Value = NULL;
  34. break;
  35. case eAssignment_ObjectClass:
  36. // ret->U.ObjectClass.ObjectClass = NULL;
  37. break;
  38. case eAssignment_Object:
  39. // ret->U.Object.Object = NULL;
  40. break;
  41. case eAssignment_ObjectSet:
  42. // ret->U.ObjectSet.ObjectSet = NULL;
  43. break;
  44. case eAssignment_Reference:
  45. // ret->U.Reference.Identifier = NULL;
  46. // ret->U.Reference.Module = NULL;
  47. break;
  48. }
  49. return ret;
  50. }
  51. /* copy constructor of Assignment_t */
  52. Assignment_t *
  53. DupAssignment(Assignment_t *src)
  54. {
  55. RETDUP(Assignment_t, src);
  56. }
  57. /* find an assignment by name+moduleidentifier in an assignment list */
  58. Assignment_t *
  59. FindAssignment(AssignmentList_t ass, Assignment_e type, char *identifier, ModuleIdentifier_t *module)
  60. {
  61. Assignment_t *a;
  62. Assignment_e at;
  63. for (a = ass; a; a = a->Next) {
  64. if (a->Type == eAssignment_NextPass)
  65. continue;
  66. if (type == eAssignment_Undefined) {
  67. at = eAssignment_Undefined;
  68. } else {
  69. at = GetAssignmentType(ass, a);
  70. }
  71. if (at == type &&
  72. !strcmp(a->Identifier, identifier) &&
  73. !CmpModuleIdentifier(ass, a->Module, module))
  74. return a;
  75. }
  76. return NULL;
  77. }
  78. /* find an exported assignment by name+moduleidentifier in an assignment list */
  79. Assignment_t *
  80. FindExportedAssignment(AssignmentList_t ass, Assignment_e type, char *identifier, ModuleIdentifier_t *module)
  81. {
  82. Assignment_t *a;
  83. Assignment_e at;
  84. for (a = ass; a; a = a->Next) {
  85. if (a->Type == eAssignment_NextPass ||
  86. !(a->Flags & eAssignmentFlags_Exported))
  87. continue;
  88. if (type == eAssignment_Undefined) {
  89. at = eAssignment_Undefined;
  90. } else {
  91. at = GetAssignmentType(ass, a);
  92. }
  93. if (at == type &&
  94. !strcmp(a->Identifier, identifier) &&
  95. !CmpModuleIdentifier(ass, a->Module, module))
  96. return a;
  97. }
  98. return NULL;
  99. }
  100. /* find an assignment by name+moduleidentifier in an assignment list */
  101. /* do not use assignments of previous parsing passes */
  102. Assignment_t *
  103. FindAssignmentInCurrentPass(AssignmentList_t ass, char *identifier, ModuleIdentifier_t *module)
  104. {
  105. for (; ass; ass = ass->Next) {
  106. if (ass->Type == eAssignment_NextPass)
  107. return NULL;
  108. if (!strcmp(ass->Identifier, identifier) &&
  109. !CmpModuleIdentifier(ass, ass->Module, module))
  110. return ass;
  111. }
  112. return NULL;
  113. }
  114. /* resolve assignment references */
  115. Assignment_t *
  116. GetAssignment(AssignmentList_t ass, Assignment_t *a)
  117. {
  118. while (a && a->Type == eAssignment_Reference) {
  119. a = FindAssignment(ass, eAssignment_Undefined,
  120. a->U.Reference.Identifier, a->U.Reference.Module);
  121. }
  122. return a;
  123. }
  124. /* get type of an assignment */
  125. Assignment_e
  126. GetAssignmentType(AssignmentList_t ass, Assignment_t *a)
  127. {
  128. a = GetAssignment(ass, a);
  129. return a ? a->Type : eAssignment_Undefined;
  130. }
  131. /* assign a type */
  132. /* lhs must be an type reference */
  133. /* returns 0 if type is already defined in current parser pass */
  134. int
  135. AssignType(AssignmentList_t *ass, Type_t *lhs, Type_t *rhs)
  136. {
  137. Assignment_t *a;
  138. if (lhs->Type != eType_Reference)
  139. MyAbort();
  140. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  141. if (a->Type == eAssignment_Type &&
  142. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  143. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  144. return 0;
  145. }
  146. // propagate the directives from rhs to lhs
  147. PropagatePrivateDirectives(lhs, &(rhs->PrivateDirectives));
  148. // create new assignment
  149. a = NewAssignment(eAssignment_Type);
  150. a->Identifier = lhs->U.Reference.Identifier;
  151. a->Module = lhs->U.Reference.Module;
  152. a->U.Type.Type = rhs;
  153. a->Next = *ass;
  154. *ass = a;
  155. return 1;
  156. }
  157. /* assign a value */
  158. /* lhs must be an value reference */
  159. /* returns 0 if value is already defined in current parser pass */
  160. int
  161. AssignValue(AssignmentList_t *ass, Value_t *lhs, Value_t *rhs)
  162. {
  163. Assignment_t *a;
  164. if (lhs->Type)
  165. MyAbort();
  166. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  167. if (a->Type == eAssignment_Value &&
  168. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  169. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  170. return 0;
  171. }
  172. a = NewAssignment(eAssignment_Value);
  173. a->Identifier = lhs->U.Reference.Identifier;
  174. a->Module = lhs->U.Reference.Module;
  175. a->U.Value.Value = rhs;
  176. ASSERT(rhs);
  177. if (rhs->Type && rhs->Type->Type == eType_ObjectIdentifier)
  178. {
  179. AddDefinedOID(a->Identifier, rhs);
  180. }
  181. a->Next = *ass;
  182. *ass = a;
  183. return 1;
  184. }
  185. /* assign a object class */
  186. /* lhs must be an object class reference */
  187. /* returns 0 if object class is already defined in current parser pass */
  188. int
  189. AssignObjectClass(AssignmentList_t *ass, ObjectClass_t *lhs, ObjectClass_t *rhs)
  190. {
  191. Assignment_t *a;
  192. if (lhs->Type != eObjectClass_Reference)
  193. MyAbort();
  194. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  195. if (a->Type == eAssignment_ObjectClass &&
  196. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  197. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  198. return 0;
  199. }
  200. a = NewAssignment(eAssignment_ObjectClass);
  201. a->Identifier = lhs->U.Reference.Identifier;
  202. a->Module = lhs->U.Reference.Module;
  203. a->U.ObjectClass.ObjectClass = rhs;
  204. a->Next = *ass;
  205. *ass = a;
  206. return 1;
  207. }
  208. /* assign a object */
  209. /* lhs must be an object reference */
  210. /* returns 0 if object is already defined in current parser pass */
  211. int
  212. AssignObject(AssignmentList_t *ass, Object_t *lhs, Object_t *rhs)
  213. {
  214. Assignment_t *a;
  215. if (lhs->Type != eObject_Reference)
  216. MyAbort();
  217. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  218. if (a->Type == eAssignment_Object &&
  219. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  220. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  221. return 0;
  222. }
  223. a = NewAssignment(eAssignment_Object);
  224. a->Identifier = lhs->U.Reference.Identifier;
  225. a->Module = lhs->U.Reference.Module;
  226. a->U.Object.Object = rhs;
  227. a->Next = *ass;
  228. *ass = a;
  229. return 1;
  230. }
  231. /* assign a object set */
  232. /* lhs must be an object set reference */
  233. /* returns 0 if type is already defined in current parser pass */
  234. int
  235. AssignObjectSet(AssignmentList_t *ass, ObjectSet_t *lhs, ObjectSet_t *rhs)
  236. {
  237. Assignment_t *a;
  238. if (lhs->Type != eObjectSet_Reference)
  239. MyAbort();
  240. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  241. if (a->Type == eAssignment_ObjectSet &&
  242. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  243. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  244. return 0;
  245. }
  246. a = NewAssignment(eAssignment_ObjectSet);
  247. a->Identifier = lhs->U.Reference.Identifier;
  248. a->Module = lhs->U.Reference.Module;
  249. a->U.ObjectSet.ObjectSet = rhs;
  250. a->Next = *ass;
  251. *ass = a;
  252. return 1;
  253. }
  254. /* assign a macro */
  255. /* lhs must be an macro reference */
  256. /* returns 0 if macro is already defined in current parser pass */
  257. int
  258. AssignMacro(AssignmentList_t *ass, Macro_t *lhs, Macro_t *rhs)
  259. {
  260. Assignment_t *a;
  261. if (lhs->Type != eMacro_Reference)
  262. MyAbort();
  263. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  264. if (a->Type == eAssignment_Macro &&
  265. !strcmp(a->Identifier, lhs->U.Reference.Identifier) &&
  266. !CmpModuleIdentifier(*ass, a->Module, lhs->U.Reference.Module))
  267. return 0;
  268. }
  269. a = NewAssignment(eAssignment_Macro);
  270. a->Identifier = lhs->U.Reference.Identifier;
  271. a->Module = lhs->U.Reference.Module;
  272. a->U.Macro.Macro = rhs;
  273. a->Next = *ass;
  274. *ass = a;
  275. return 1;
  276. }
  277. /* define a module identifier */
  278. /* returns 0 if module identifier is already defined in current parser pass */
  279. int
  280. AssignModuleIdentifier(AssignmentList_t *ass, ModuleIdentifier_t *module)
  281. {
  282. Assignment_t *a;
  283. for (a = *ass; a && a->Type != eAssignment_NextPass; a = a->Next) {
  284. if (a->Type == eAssignment_ModuleIdentifier &&
  285. !CmpModuleIdentifier(*ass, a->Module, module))
  286. return 0;
  287. }
  288. a = NewAssignment(eAssignment_ModuleIdentifier);
  289. a->Identifier = "<module>";
  290. a->Module = module;
  291. a->Next = *ass;
  292. *ass = a;
  293. return 1;
  294. }
  295. /* constructor of UndefinedSymbol_t */
  296. UndefinedSymbol_t *
  297. NewUndefinedSymbol(UndefinedSymbol_e type, Assignment_e reftype)
  298. {
  299. UndefinedSymbol_t *ret;
  300. ret = (UndefinedSymbol_t *)malloc(sizeof(UndefinedSymbol_t));
  301. if (! ret)
  302. return NULL;
  303. memset(ret, 0, sizeof(UndefinedSymbol_t));
  304. ret->Type = type;
  305. ret->U.Symbol.ReferenceType = reftype;
  306. // ret->U.Symbol.Identifier = NULL;
  307. // ret->U.Symbol.Module = NULL;
  308. // ret->Next = NULL;
  309. return ret;
  310. }
  311. /* constructor of UndefinedSymbol_t */
  312. UndefinedSymbol_t *
  313. NewUndefinedField(UndefinedSymbol_e type, ObjectClass_t *oc, Settings_e reffieldtype)
  314. {
  315. UndefinedSymbol_t *ret;
  316. if (oc->Type != eObjectClass_Reference)
  317. MyAbort();
  318. ret = (UndefinedSymbol_t *)malloc(sizeof(UndefinedSymbol_t));
  319. if (! ret)
  320. return NULL;
  321. memset(ret, 0, sizeof(UndefinedSymbol_t));
  322. ret->Type = type;
  323. ret->U.Field.ReferenceFieldType = reffieldtype;
  324. // ret->U.Field.Identifier = NULL;
  325. // ret->U.Field.Module = NULL;
  326. ret->U.Field.ObjectClass = oc;
  327. // ret->Next = NULL;
  328. return ret;
  329. }
  330. /* find an undefined symbol by type/name/moduleidentifier in a list of */
  331. /* undefined symbols */
  332. UndefinedSymbol_t *
  333. FindUndefinedSymbol(AssignmentList_t ass, UndefinedSymbolList_t u, Assignment_e type, char *ide, ModuleIdentifier_t *mod)
  334. {
  335. for (; u; u = u->Next) {
  336. if (u->Type != eUndefinedSymbol_SymbolNotDefined &&
  337. u->Type != eUndefinedSymbol_SymbolNotExported)
  338. continue;
  339. if ((type == eAssignment_Undefined ||
  340. u->U.Symbol.ReferenceType == eAssignment_Undefined ||
  341. u->U.Symbol.ReferenceType == type) &&
  342. !strcmp(u->U.Symbol.Identifier, ide) &&
  343. !CmpModuleIdentifier(ass, u->U.Field.Module, mod))
  344. return u;
  345. }
  346. return NULL;
  347. }
  348. /* find an undefined field by type/objectclass/name/moduleidentifier in a */
  349. /* list of undefined symbols */
  350. UndefinedSymbol_t *
  351. FindUndefinedField(AssignmentList_t ass, UndefinedSymbolList_t u, Settings_e fieldtype, ObjectClass_t *oc, char *ide, ModuleIdentifier_t *mod)
  352. {
  353. for (; u; u = u->Next) {
  354. if (u->Type != eUndefinedSymbol_FieldNotDefined &&
  355. u->Type != eUndefinedSymbol_FieldNotExported)
  356. continue;
  357. if ((fieldtype == eSetting_Undefined ||
  358. u->U.Field.ReferenceFieldType == eSetting_Undefined ||
  359. u->U.Field.ReferenceFieldType == fieldtype) &&
  360. !strcmp(u->U.Field.Identifier, ide) &&
  361. GetObjectClass(ass, oc) ==
  362. GetObjectClass(ass, u->U.Field.ObjectClass) &&
  363. !CmpModuleIdentifier(ass, u->U.Field.Module, mod))
  364. return u;
  365. }
  366. return NULL;
  367. }
  368. /* constructor of Type_t */
  369. Type_t *
  370. NewType(Type_e type)
  371. {
  372. Type_t *ret;
  373. ret = (Type_t *)malloc(sizeof(Type_t));
  374. if (! ret)
  375. return NULL;
  376. memset(ret, 0, sizeof(Type_t));
  377. ret->Type = type;
  378. // ret->Tags = NULL;
  379. // ret->AllTags = NULL;
  380. // ret->FirstTags = NULL;
  381. // ret->Constraints = NULL;
  382. // ret->Directives = NULL;
  383. // ret->Flags = 0;
  384. ret->Rules = eTypeRules_Normal;
  385. ret->TagDefault = eTagType_Unknown;
  386. ret->ExtensionDefault = eExtensionType_None;
  387. ret->PERConstraints.Value.Type = eExtension_Unconstrained;
  388. // ret->PERConstraints.Value.Root = NULL;
  389. // ret->PERConstraints.Value.Additional = NULL;
  390. ret->PERConstraints.Size.Type = eExtension_Unconstrained;
  391. // ret->PERConstraints.Size.Root = NULL;
  392. // ret->PERConstraints.Size.Additional = NULL;
  393. ret->PERConstraints.PermittedAlphabet.Type = eExtension_Unconstrained;
  394. // ret->PERConstraints.PermittedAlphabet.Root = NULL;
  395. // ret->PERConstraints.PermittedAlphabet.Additional = NULL;
  396. // ret->PrivateDirectives = { 0 };
  397. switch (type) {
  398. case eType_Boolean:
  399. break;
  400. case eType_Integer:
  401. case eType_Enumerated:
  402. case eType_BitString:
  403. // ret->U.IEB.NamedNumbers = NULL;
  404. break;
  405. case eType_OctetString:
  406. case eType_UTF8String:
  407. break;
  408. case eType_Null:
  409. break;
  410. case eType_Sequence:
  411. case eType_Set:
  412. case eType_Choice:
  413. case eType_Real:
  414. case eType_EmbeddedPdv:
  415. case eType_External:
  416. case eType_CharacterString:
  417. case eType_InstanceOf:
  418. // ret->U.SSC.Components = NULL;
  419. // ret->U.SSC.Optionals = 0;
  420. // ret->U.SSC.Alternatives = 0;
  421. // ret->U.SSC.Extensions = 0;
  422. // ret->U.SSC.Autotag[0] = 0;
  423. // ret->U.SSC.Autotag[1] = 0;
  424. break;
  425. case eType_SequenceOf:
  426. case eType_SetOf:
  427. // ret->U.SS.Type = NULL;
  428. // ret->U.SS.Directives = NULL;
  429. break;
  430. case eType_Selection:
  431. // ret->U.Selection.Identifier = NULL;
  432. // ret->U.Selection.Type = NULL;
  433. break;
  434. case eType_ObjectIdentifier:
  435. break;
  436. case eType_BMPString:
  437. break;
  438. case eType_GeneralString:
  439. break;
  440. case eType_GraphicString:
  441. break;
  442. case eType_IA5String:
  443. break;
  444. case eType_ISO646String:
  445. break;
  446. case eType_NumericString:
  447. break;
  448. case eType_PrintableString:
  449. break;
  450. case eType_TeletexString:
  451. break;
  452. case eType_T61String:
  453. break;
  454. case eType_UniversalString:
  455. break;
  456. case eType_VideotexString:
  457. break;
  458. case eType_VisibleString:
  459. break;
  460. case eType_GeneralizedTime:
  461. break;
  462. case eType_UTCTime:
  463. break;
  464. case eType_ObjectDescriptor:
  465. break;
  466. case eType_Undefined:
  467. break;
  468. case eType_RestrictedString:
  469. break;
  470. case eType_Reference:
  471. // ret->U.Reference.Identifier = NULL;
  472. // ret->U.Reference.Module = NULL;
  473. break;
  474. case eType_FieldReference:
  475. // ret->U.FieldReference.ObjectClass = NULL;
  476. // ret->U.FieldReference.Identifier = NULL;
  477. break;
  478. case eType_Macro:
  479. // ret->U.Macro.Macro = NULL;
  480. // ret->U.Macro.LocalAssignments = NULL;
  481. break;
  482. }
  483. return ret;
  484. }
  485. /* copy constructor of Type_t */
  486. Type_t *
  487. DupType(Type_t *src)
  488. {
  489. RETDUP(Type_t, src);
  490. }
  491. /* resolve field reference */
  492. FieldSpec_t *
  493. GetReferencedFieldSpec(AssignmentList_t ass, Type_t *type, ObjectClass_t **objectclass)
  494. {
  495. FieldSpec_t *fs;
  496. ObjectClass_t *oc;
  497. if (type->Type != eType_FieldReference)
  498. MyAbort();
  499. oc = type->U.FieldReference.ObjectClass;
  500. oc = GetObjectClass(ass, oc);
  501. if (!oc)
  502. return NULL;
  503. fs = GetFieldSpec(ass, FindFieldSpec(oc->U.ObjectClass.FieldSpec,
  504. type->U.FieldReference.Identifier));
  505. if (!fs)
  506. return NULL;
  507. if (fs->Type == eFieldSpec_Object)
  508. oc = fs->U.Object.ObjectClass;
  509. else if (fs->Type == eFieldSpec_ObjectSet)
  510. oc = fs->U.ObjectSet.ObjectClass;
  511. else
  512. return NULL;
  513. if (objectclass)
  514. *objectclass = oc;
  515. return GetFieldSpec(ass, fs);
  516. }
  517. /* resolve type reference */
  518. Type_t *
  519. GetReferencedType(AssignmentList_t ass, Type_t *type)
  520. {
  521. Assignment_t *a;
  522. FieldSpec_t *fs;
  523. switch (type->Type) {
  524. case eType_Reference:
  525. a = FindAssignment(ass, eAssignment_Type, type->U.Reference.Identifier,
  526. type->U.Reference.Module);
  527. a = GetAssignment(ass, a);
  528. if (!a)
  529. return NULL;
  530. return a->U.Type.Type;
  531. case eType_FieldReference:
  532. fs = GetReferencedFieldSpec(ass, type, NULL);
  533. if (!fs)
  534. return NULL;
  535. switch (fs->Type) {
  536. case eFieldSpec_FixedTypeValue:
  537. return fs->U.FixedTypeValue.Type;
  538. case eFieldSpec_FixedTypeValueSet:
  539. return fs->U.FixedTypeValueSet.Type;
  540. case eFieldSpec_Type:
  541. case eFieldSpec_VariableTypeValue:
  542. case eFieldSpec_VariableTypeValueSet:
  543. return Builtin_Type_Open;
  544. default:
  545. return NULL;
  546. }
  547. /*NOTREACHED*/
  548. default:
  549. MyAbort();
  550. /*NOTREACHED*/
  551. }
  552. return NULL;
  553. }
  554. /* constructor of Component_t */
  555. Component_t *
  556. NewComponent(Components_e type)
  557. {
  558. Component_t *ret;
  559. ret = (Component_t *)malloc(sizeof(Component_t));
  560. if (! ret)
  561. return NULL;
  562. memset(ret, 0, sizeof(Component_t));
  563. ret->Type = type;
  564. // ret->Next = NULL;
  565. switch (type) {
  566. case eComponent_Normal:
  567. // ret->U.Normal.NamedType = NULL;
  568. break;
  569. case eComponent_Optional:
  570. // ret->U.Optional.NamedType = NULL;
  571. break;
  572. case eComponent_Default:
  573. // ret->U.Default.NamedType = NULL;
  574. // ret->U.Default.Value = NULL;
  575. break;
  576. case eComponent_ComponentsOf:
  577. // ret->U.ComponentsOf.Type = NULL;
  578. break;
  579. case eComponent_ExtensionMarker:
  580. /*ret->U.ExtensionMarker.ExceptionSpec = NULL;*/
  581. break;
  582. }
  583. return ret;
  584. }
  585. /* copy constructor of Component_t */
  586. Component_t *
  587. DupComponent(Component_t *src)
  588. {
  589. RETDUP(Component_t, src);
  590. }
  591. /* find a component by name in a list of components */
  592. Component_t *
  593. FindComponent(AssignmentList_t ass, ComponentList_t components, char *identifier)
  594. {
  595. Component_t *c;
  596. NamedType_t *namedType;
  597. while (components) {
  598. switch (components->Type) {
  599. case eComponent_Normal:
  600. case eComponent_Optional:
  601. case eComponent_Default:
  602. namedType = components->U.NOD.NamedType;
  603. if (namedType && !strcmp(namedType->Identifier, identifier))
  604. return components;
  605. break;
  606. case eComponent_ComponentsOf:
  607. switch (GetTypeType(ass, components->U.ComponentsOf.Type)) {
  608. case eType_Sequence:
  609. case eType_Set:
  610. case eType_Choice:
  611. case eType_External:
  612. case eType_EmbeddedPdv:
  613. case eType_CharacterString:
  614. case eType_Real:
  615. case eType_InstanceOf:
  616. c = FindComponent(ass,
  617. GetType(ass, components->U.ComponentsOf.Type)->
  618. U.SSC.Components, identifier);
  619. if (c)
  620. return c;
  621. break;
  622. default:
  623. break;
  624. }
  625. break;
  626. }
  627. components = components->Next;
  628. }
  629. return NULL;
  630. }
  631. /* constructor of NamedType_t */
  632. NamedType_t *
  633. NewNamedType(char *identifier, Type_t *type)
  634. {
  635. NamedType_t *ret;
  636. ret = (NamedType_t *)malloc(sizeof(NamedType_t));
  637. if (! ret)
  638. return NULL;
  639. ret->Type = type;
  640. ret->Identifier = identifier;
  641. return ret;
  642. }
  643. /* constructor of NamedValue_t */
  644. NamedValue_t *
  645. NewNamedValue(char *identifier, Value_t *value)
  646. {
  647. NamedValue_t *ret;
  648. ret = (NamedValue_t *)malloc(sizeof(NamedValue_t));
  649. if (! ret)
  650. return NULL;
  651. ret->Next = NULL;
  652. ret->Value = value;
  653. ret->Identifier = identifier;
  654. return ret;
  655. }
  656. /* copy constructor of NamedValue_t */
  657. NamedValue_t *
  658. DupNamedValue(NamedValue_t *src)
  659. {
  660. RETDUP(NamedValue_t, src);
  661. }
  662. /* find a named value by name in a list of named values */
  663. NamedValue_t *
  664. FindNamedValue(NamedValueList_t namedValues, char *identifier)
  665. {
  666. for (; namedValues; namedValues = namedValues->Next) {
  667. if (!strcmp(namedValues->Identifier, identifier))
  668. return namedValues;
  669. }
  670. return NULL;
  671. }
  672. /* constructor of NamedNumber_t */
  673. NamedNumber_t *
  674. NewNamedNumber(NamedNumbers_e type)
  675. {
  676. NamedNumber_t *ret;
  677. ret = (NamedNumber_t *)malloc(sizeof(NamedNumber_t));
  678. if (! ret)
  679. return NULL;
  680. memset(ret, 0, sizeof(NamedNumber_t));
  681. // ret->Next = NULL;
  682. ret->Type = type;
  683. switch (type) {
  684. case eNamedNumber_Normal:
  685. // ret->U.Normal.Identifier = NULL;
  686. // ret->U.Normal.Value = NULL;
  687. break;
  688. case eNamedNumber_ExtensionMarker:
  689. /*XXX*/
  690. break;
  691. }
  692. return ret;
  693. }
  694. /* copy constructor of NamedNumber_t */
  695. NamedNumber_t *
  696. DupNamedNumber(NamedNumber_t *src)
  697. {
  698. RETDUP(NamedNumber_t, src);
  699. }
  700. /* find a named number by name in a list of named numbers */
  701. NamedNumber_t *
  702. FindNamedNumber(NamedNumberList_t namedNumbers, char *identifier)
  703. {
  704. for (; namedNumbers; namedNumbers = namedNumbers->Next) {
  705. switch (namedNumbers->Type) {
  706. case eNamedNumber_Normal:
  707. if (!strcmp(namedNumbers->U.Normal.Identifier, identifier))
  708. return namedNumbers;
  709. break;
  710. case eNamedNumber_ExtensionMarker:
  711. break;
  712. }
  713. }
  714. return NULL;
  715. }
  716. /* constructor of Value_t */
  717. Value_t *
  718. NewValue(AssignmentList_t ass, Type_t *type)
  719. {
  720. Value_t *ret;
  721. ret = (Value_t *)malloc(sizeof(Value_t));
  722. if (! ret)
  723. return NULL;
  724. memset(ret, 0, sizeof(Value_t));
  725. // ret->Next = NULL;
  726. ret->Type = type;
  727. if (type) {
  728. // ret->Flags = 0;
  729. switch (GetTypeType(ass, type)) {
  730. case eType_Boolean:
  731. // ret->U.Boolean.Value = 0;
  732. break;
  733. case eType_Integer:
  734. ret->U.Integer.Value.length = 1;
  735. ret->U.Integer.Value.value = (octet_t *)malloc(1);
  736. // ret->U.Integer.Value.value[0] = 0;
  737. break;
  738. case eType_Enumerated:
  739. // ret->U.Enumerated.Value = 0;
  740. break;
  741. case eType_Real:
  742. ret->U.Real.Value.type = eReal_Normal;
  743. intx_setuint32(&ret->U.Real.Value.mantissa, 0);
  744. intx_setuint32(&ret->U.Real.Value.exponent, 0);
  745. ret->U.Real.Value.base = 2;
  746. break;
  747. case eType_BitString:
  748. // ret->U.BitString.Value.length = 0;
  749. // ret->U.BitString.Value.value = NULL;
  750. break;
  751. case eType_OctetString:
  752. case eType_UTF8String:
  753. // ret->U.OctetString.Value.length = 0;
  754. // ret->U.OctetString.Value.value = NULL;
  755. break;
  756. case eType_Null:
  757. break;
  758. case eType_SequenceOf:
  759. case eType_SetOf:
  760. // ret->U.SS.Values = NULL;
  761. break;
  762. case eType_Sequence:
  763. case eType_Set:
  764. case eType_Choice:
  765. case eType_EmbeddedPdv:
  766. case eType_External:
  767. case eType_CharacterString:
  768. case eType_InstanceOf:
  769. // ret->U.SSC.NamedValues = NULL;
  770. break;
  771. case eType_Selection:
  772. break;
  773. case eType_ObjectIdentifier:
  774. break;
  775. case eType_BMPString:
  776. break;
  777. case eType_GeneralString:
  778. break;
  779. case eType_GraphicString:
  780. break;
  781. case eType_IA5String:
  782. break;
  783. case eType_ISO646String:
  784. break;
  785. case eType_NumericString:
  786. break;
  787. case eType_PrintableString:
  788. break;
  789. case eType_TeletexString:
  790. break;
  791. case eType_T61String:
  792. break;
  793. case eType_UniversalString:
  794. break;
  795. case eType_VideotexString:
  796. break;
  797. case eType_VisibleString:
  798. break;
  799. case eType_GeneralizedTime:
  800. break;
  801. case eType_UTCTime:
  802. break;
  803. case eType_ObjectDescriptor:
  804. break;
  805. case eType_Undefined:
  806. break;
  807. }
  808. } else {
  809. // ret->U.Reference.Identifier = NULL;
  810. // ret->U.Reference.Module = NULL;
  811. }
  812. return ret;
  813. }
  814. /* copy constructor of Value_t */
  815. Value_t *
  816. DupValue(Value_t *src)
  817. {
  818. RETDUP(Value_t, src);
  819. }
  820. /* constructor of ValueSet_t */
  821. ValueSet_t *
  822. NewValueSet()
  823. {
  824. ValueSet_t *ret;
  825. ret = (ValueSet_t *)malloc(sizeof(ValueSet_t));
  826. if (! ret)
  827. return NULL;
  828. memset(ret, 0, sizeof(ValueSet_t));
  829. // ret->Elements = NULL;
  830. return ret;
  831. }
  832. /* copy constructor of ValueSet_t */
  833. ValueSet_t *
  834. DupValueSet(ValueSet_t *src)
  835. {
  836. RETDUP(ValueSet_t, src);
  837. }
  838. /* constructor of Macro_t */
  839. Macro_t *
  840. NewMacro(Macro_e type)
  841. {
  842. Macro_t *ret;
  843. ret = (Macro_t *)malloc(sizeof(Macro_t));
  844. if (! ret)
  845. return NULL;
  846. ret->Type = type;
  847. return ret;
  848. }
  849. /* copy constructor of Macro_t */
  850. Macro_t *
  851. DupMacro(Macro_t *src)
  852. {
  853. RETDUP(Macro_t, src);
  854. }
  855. /* constructor of MacroProduction_t */
  856. MacroProduction_t *
  857. NewMacroProduction(MacroProduction_e type)
  858. {
  859. MacroProduction_t *ret;
  860. ret = (MacroProduction_t *)malloc(sizeof(MacroProduction_t));
  861. if (! ret)
  862. return NULL;
  863. memset(ret, 0, sizeof(MacroProduction_t));
  864. ret->Type = type;
  865. switch (type) {
  866. case eMacroProduction_Alternative:
  867. // ret->U.Alternative.Production1 = NULL;
  868. // ret->U.Alternative.Production2 = NULL;
  869. break;
  870. case eMacroProduction_Sequence:
  871. // ret->U.Sequence.Production1 = NULL;
  872. // ret->U.Sequence.Production2 = NULL;
  873. break;
  874. case eMacroProduction_AString:
  875. // ret->U.AString.String = NULL;
  876. break;
  877. case eMacroProduction_ProductionReference:
  878. // ret->U.ProductionReference.Reference = NULL;
  879. break;
  880. case eMacroProduction_String:
  881. case eMacroProduction_Identifier:
  882. case eMacroProduction_Number:
  883. case eMacroProduction_Empty:
  884. break;
  885. case eMacroProduction_Type:
  886. // ret->U.Type.LocalTypeReference = NULL;
  887. break;
  888. case eMacroProduction_Value:
  889. // ret->U.Value.LocalTypeReference = NULL;
  890. // ret->U.Value.LocalValueReference = NULL;
  891. // ret->U.Value.Type = NULL;
  892. break;
  893. case eMacroProduction_LocalTypeAssignment:
  894. // ret->U.LocalTypeAssignment.LocalTypeReference = NULL;
  895. // ret->U.LocalTypeAssignment.Type = NULL;
  896. break;
  897. case eMacroProduction_LocalValueAssignment:
  898. // ret->U.LocalValueAssignment.LocalValueReference = NULL;
  899. // ret->U.LocalValueAssignment.Value = NULL;
  900. break;
  901. }
  902. return ret;
  903. }
  904. /* copy constructor of MacroProduction_t */
  905. MacroProduction_t *
  906. DupMacroProduction(MacroProduction_t *src)
  907. {
  908. RETDUP(MacroProduction_t, src);
  909. }
  910. /* constructor of NamedMacroProduction_t */
  911. NamedMacroProduction_t *
  912. NewNamedMacroProduction()
  913. {
  914. NamedMacroProduction_t *ret;
  915. ret = (NamedMacroProduction_t *)malloc(sizeof(NamedMacroProduction_t));
  916. if (! ret)
  917. return NULL;
  918. memset(ret, 0, sizeof(NamedMacroProduction_t));
  919. // ret->Next = NULL;
  920. // ret->Identifier = NULL;
  921. // ret->Production = NULL;
  922. return ret;
  923. }
  924. /* copy constructor of NamedMacroProduction */
  925. NamedMacroProduction_t *
  926. DupNamedMacroProduction(NamedMacroProduction_t *src)
  927. {
  928. RETDUP(NamedMacroProduction_t, src);
  929. }
  930. /* constructor of MacroLocalAssignment_t */
  931. MacroLocalAssignment_t *
  932. NewMacroLocalAssignment(MacroLocalAssignment_e type)
  933. {
  934. MacroLocalAssignment_t *ret;
  935. ret = (MacroLocalAssignment_t *)malloc(sizeof(MacroLocalAssignment_t));
  936. if (! ret)
  937. return NULL;
  938. memset(ret, 0, sizeof(MacroLocalAssignment_t));
  939. // ret->Next = NULL;
  940. ret->Type = type;
  941. // ret->Identifier = NULL;
  942. switch (type) {
  943. case eMacroLocalAssignment_Type:
  944. // ret->U.Type = NULL;
  945. break;
  946. case eMacroLocalAssignment_Value:
  947. // ret->U.Value = NULL;
  948. break;
  949. }
  950. return ret;
  951. }
  952. /* copy constructor of MacroLocalAssignment_t */
  953. MacroLocalAssignment_t *
  954. DupMacroLocalAssignment(MacroLocalAssignment_t *src)
  955. {
  956. RETDUP(MacroLocalAssignment_t, src);
  957. }
  958. /* find a macrolocalassignment by name in a list of macrolocalassignments */
  959. MacroLocalAssignment_t *
  960. FindMacroLocalAssignment(MacroLocalAssignmentList_t la, char *ide)
  961. {
  962. for (; la; la = la->Next) {
  963. if (!strcmp(la->Identifier, ide))
  964. break;
  965. }
  966. return la;
  967. }
  968. /* constructor of EndPoint_t */
  969. EndPoint_t *
  970. NewEndPoint()
  971. {
  972. EndPoint_t *ret;
  973. ret = (EndPoint_t *)malloc(sizeof(EndPoint_t));
  974. if (! ret)
  975. return NULL;
  976. memset(ret, 0, sizeof(EndPoint_t));
  977. // ret->Flags = 0;
  978. // ret->Value = NULL;
  979. return ret;
  980. }
  981. /* constructor of Constraint_t */
  982. Constraint_t *
  983. NewConstraint()
  984. {
  985. Constraint_t *ret;
  986. ret = (Constraint_t *)malloc(sizeof(Constraint_t));
  987. if (! ret)
  988. return NULL;
  989. memset(ret, 0, sizeof(Constraint_t));
  990. ret->Type = eExtension_Unextended;
  991. // ret->Root = NULL;
  992. // ret->Additional = NULL;
  993. return ret;
  994. }
  995. /* copy constructor of Constraint_t */
  996. Constraint_t *DupConstraint(Constraint_t *src)
  997. {
  998. RETDUP(Constraint_t, src);
  999. }
  1000. /* constructor of ElementSetSpec_t */
  1001. ElementSetSpec_t *
  1002. NewElementSetSpec(ElementSetSpec_e type)
  1003. {
  1004. ElementSetSpec_t *ret;
  1005. ret = (ElementSetSpec_t *)malloc(sizeof(ElementSetSpec_t));
  1006. if (! ret)
  1007. return NULL;
  1008. memset(ret, 0, sizeof(ElementSetSpec_t));
  1009. ret->Type = type;
  1010. switch (type) {
  1011. case eElementSetSpec_AllExcept:
  1012. // ret->U.AllExcept.Elements = NULL;
  1013. break;
  1014. case eElementSetSpec_Union:
  1015. // ret->U.Union.Elements1 = NULL;
  1016. // ret->U.Union.Elements2 = NULL;
  1017. break;
  1018. case eElementSetSpec_Intersection:
  1019. // ret->U.Intersection.Elements1 = NULL;
  1020. // ret->U.Intersection.Elements2 = NULL;
  1021. break;
  1022. case eElementSetSpec_Exclusion:
  1023. // ret->U.Exclusion.Elements1 = NULL;
  1024. // ret->U.Exclusion.Elements2 = NULL;
  1025. break;
  1026. case eElementSetSpec_SubtypeElement:
  1027. // ret->U.SubtypeElement.SubtypeElement = NULL;
  1028. break;
  1029. case eElementSetSpec_ObjectSetElement:
  1030. // ret->U.ObjectSetElement.ObjectSetElement = NULL;
  1031. break;
  1032. default:
  1033. MyAbort();
  1034. }
  1035. return ret;
  1036. }
  1037. /* constructor of SubtypeElement_t */
  1038. SubtypeElement_t *
  1039. NewSubtypeElement(SubtypeElement_e type)
  1040. {
  1041. SubtypeElement_t *ret;
  1042. ret = (SubtypeElement_t *)malloc(sizeof(SubtypeElement_t));
  1043. if (! ret)
  1044. return NULL;
  1045. memset(ret, 0, sizeof(SubtypeElement_t));
  1046. ret->Type = type;
  1047. switch (type) {
  1048. case eSubtypeElement_ValueRange:
  1049. ret->U.ValueRange.Lower.Flags = eEndPoint_Min;
  1050. // ret->U.ValueRange.Lower.Value = NULL;
  1051. ret->U.ValueRange.Upper.Flags = eEndPoint_Max;
  1052. // ret->U.ValueRange.Upper.Value = NULL;
  1053. break;
  1054. case eSubtypeElement_Size:
  1055. // ret->U.Size.Constraints = NULL;
  1056. break;
  1057. case eSubtypeElement_SingleValue:
  1058. // ret->U.SingleValue.Value = NULL;
  1059. break;
  1060. case eSubtypeElement_PermittedAlphabet:
  1061. // ret->U.PermittedAlphabet.Constraints = NULL;
  1062. break;
  1063. case eSubtypeElement_ContainedSubtype:
  1064. // ret->U.ContainedSubtype.Type = NULL;
  1065. break;
  1066. case eSubtypeElement_Type:
  1067. // ret->U.Type.Type = NULL;
  1068. break;
  1069. case eSubtypeElement_SingleType:
  1070. // ret->U.SingleType.Constraints = NULL;
  1071. break;
  1072. case eSubtypeElement_FullSpecification:
  1073. // ret->U.FullSpecification.NamedConstraints = NULL;
  1074. break;
  1075. case eSubtypeElement_PartialSpecification:
  1076. // ret->U.PartialSpecification.NamedConstraints = NULL;
  1077. break;
  1078. case eSubtypeElement_ElementSetSpec:
  1079. // ret->U.ElementSetSpec.ElementSetSpec = NULL;
  1080. break;
  1081. }
  1082. return ret;
  1083. }
  1084. /* constructor of ObjectSetElement_t */
  1085. ObjectSetElement_t *NewObjectSetElement(ObjectSetElement_e type)
  1086. {
  1087. ObjectSetElement_t *ret;
  1088. ret = (ObjectSetElement_t *)malloc(sizeof(ObjectSetElement_t));
  1089. if (! ret)
  1090. return NULL;
  1091. memset(ret, 0, sizeof(ObjectSetElement_t));
  1092. ret->Type = type;
  1093. switch (type) {
  1094. case eObjectSetElement_Object:
  1095. // ret->U.Object.Object = NULL;
  1096. break;
  1097. case eObjectSetElement_ObjectSet:
  1098. // ret->U.ObjectSet.ObjectSet = NULL;
  1099. break;
  1100. case eObjectSetElement_ElementSetSpec:
  1101. // ret->U.ElementSetSpec.ElementSetSpec = NULL;
  1102. break;
  1103. }
  1104. return ret;
  1105. }
  1106. /* constructor of ValueConstraint_t */
  1107. ValueConstraint_t *
  1108. NewValueConstraint()
  1109. {
  1110. ValueConstraint_t *ret;
  1111. ret = (ValueConstraint_t *)malloc(sizeof(ValueConstraint_t));
  1112. if (! ret)
  1113. return NULL;
  1114. memset(ret, 0, sizeof(ValueConstraint_t));
  1115. // ret->Next = NULL;
  1116. // ret->Lower.Flags = ret->Upper.Flags = 0;
  1117. // ret->Lower.Value = ret->Upper.Value = NULL;
  1118. return ret;
  1119. }
  1120. /* constructor of NamedConstraint_t */
  1121. NamedConstraint_t *
  1122. NewNamedConstraint()
  1123. {
  1124. NamedConstraint_t *ret;
  1125. ret = (NamedConstraint_t *)malloc(sizeof(NamedConstraint_t));
  1126. if (! ret)
  1127. return NULL;
  1128. memset(ret, 0, sizeof(NamedConstraint_t));
  1129. // ret->Next = NULL;
  1130. // ret->Identifier = NULL;
  1131. // ret->Constraint = NULL;
  1132. ret->Presence = ePresence_Normal;
  1133. return ret;
  1134. }
  1135. /* constructor of Tag_t */
  1136. Tag_t *
  1137. NewTag(TagType_e type)
  1138. {
  1139. Tag_t *tag;
  1140. tag = (Tag_t *)malloc(sizeof(Tag_t));
  1141. if (! tag)
  1142. return NULL;
  1143. memset(tag, 0, sizeof(Tag_t));
  1144. tag->Type = type;
  1145. tag->Class = eTagClass_Unknown;
  1146. // tag->Tag = NULL;
  1147. // tag->Next = NULL;
  1148. return tag;
  1149. }
  1150. /* copy constructor of Tag_t */
  1151. Tag_t *
  1152. DupTag(Tag_t *src)
  1153. {
  1154. RETDUP(Tag_t, src);
  1155. }
  1156. /* constructor of Directive_t */
  1157. Directive_t *
  1158. NewDirective(Directives_e type)
  1159. {
  1160. Directive_t *ret;
  1161. ret = (Directive_t *)malloc(sizeof(Directive_t));
  1162. if (! ret)
  1163. return NULL;
  1164. memset(ret, 0, sizeof(Directive_t));
  1165. ret->Type = type;
  1166. // ret->Next = NULL;
  1167. return ret;
  1168. }
  1169. /* copy constructor of Directive_t */
  1170. Directive_t *
  1171. DupDirective(Directive_t *src)
  1172. {
  1173. RETDUP(Directive_t, src);
  1174. }
  1175. /* constructor of ModuleIdentifier_t */
  1176. ModuleIdentifier_t *
  1177. NewModuleIdentifier()
  1178. {
  1179. ModuleIdentifier_t *ret;
  1180. ret = (ModuleIdentifier_t *)malloc(sizeof(ModuleIdentifier_t));
  1181. if (! ret)
  1182. return NULL;
  1183. memset(ret, 0, sizeof(ModuleIdentifier_t));
  1184. // ret->Identifier = NULL;
  1185. // ret->ObjectIdentifier = NULL;
  1186. return ret;
  1187. }
  1188. /* constructor of ObjectClass_t */
  1189. ObjectClass_t *
  1190. NewObjectClass(ObjectClass_e type)
  1191. {
  1192. ObjectClass_t *ret;
  1193. ret = (ObjectClass_t *)malloc(sizeof(ObjectClass_t));
  1194. if (! ret)
  1195. return NULL;
  1196. memset(ret, 0, sizeof(ObjectClass_t));
  1197. ret->Type = type;
  1198. switch (type) {
  1199. case eObjectClass_ObjectClass:
  1200. // ret->U.ObjectClass.FieldSpec = NULL;
  1201. // ret->U.ObjectClass.SyntaxSpec = NULL;
  1202. break;
  1203. case eObjectClass_Reference:
  1204. // ret->U.Reference.Identifier = NULL;
  1205. // ret->U.Reference.Module = NULL;
  1206. break;
  1207. }
  1208. return ret;
  1209. }
  1210. /* constructor of Object_t */
  1211. Object_t *
  1212. NewObject(Object_e type)
  1213. {
  1214. Object_t *ret;
  1215. ret = (Object_t *)malloc(sizeof(Object_t));
  1216. if (! ret)
  1217. return NULL;
  1218. memset(ret, 0, sizeof(Object_t));
  1219. ret->Type = type;
  1220. switch (type) {
  1221. case eObject_Object:
  1222. // ret->U.Object.ObjectClass = NULL;
  1223. // ret->U.Object.Settings = NULL;
  1224. break;
  1225. case eObject_Reference:
  1226. // ret->U.Reference.Identifier = NULL;
  1227. // ret->U.Reference.Module = NULL;
  1228. break;
  1229. }
  1230. return ret;
  1231. }
  1232. /* constructor of ObjectSet_t */
  1233. ObjectSet_t *
  1234. NewObjectSet(ObjectSet_e type)
  1235. {
  1236. ObjectSet_t *ret;
  1237. ret = (ObjectSet_t *)malloc(sizeof(ObjectSet_t));
  1238. if (! ret)
  1239. return NULL;
  1240. memset(ret, 0, sizeof(ObjectSet_t));
  1241. ret->Type = type;
  1242. switch (type) {
  1243. case eObjectSet_ObjectSet:
  1244. // ret->U.ObjectSet.ObjectClass = NULL;
  1245. // ret->U.ObjectSet.Elements = NULL;
  1246. break;
  1247. case eObjectSet_Reference:
  1248. // ret->U.Reference.Identifier = NULL;
  1249. // ret->U.Reference.Module = NULL;
  1250. break;
  1251. case eObjectSet_ExtensionMarker:
  1252. // ret->U.ExtensionMarker.ObjectClass = NULL;
  1253. // ret->U.ExtensionMarker.Elements = NULL;
  1254. break;
  1255. }
  1256. return ret;
  1257. }
  1258. /* constructor of Setting_t */
  1259. Setting_t *
  1260. NewSetting(Settings_e type)
  1261. {
  1262. Setting_t *ret;
  1263. ret = (Setting_t *)malloc(sizeof(Setting_t));
  1264. if (! ret)
  1265. return NULL;
  1266. memset(ret, 0, sizeof(Setting_t));
  1267. ret->Type = type;
  1268. // ret->Identifier = NULL;
  1269. // ret->Next = NULL;
  1270. switch (type) {
  1271. case eSetting_Type:
  1272. // ret->U.Type.Type = NULL;
  1273. break;
  1274. case eSetting_Value:
  1275. // ret->U.Value.Value = NULL;
  1276. break;
  1277. case eSetting_ValueSet:
  1278. // ret->U.ValueSet.ValueSet = NULL;
  1279. break;
  1280. case eSetting_Object:
  1281. // ret->U.Object.Object = NULL;
  1282. break;
  1283. case eSetting_ObjectSet:
  1284. // ret->U.ObjectSet.ObjectSet = NULL;
  1285. break;
  1286. }
  1287. return ret;
  1288. }
  1289. /* copy constructor of Setting_t */
  1290. Setting_t *
  1291. DupSetting(Setting_t *src)
  1292. {
  1293. RETDUP(Setting_t, src);
  1294. }
  1295. /* get the type of a setting */
  1296. Settings_e
  1297. GetSettingType(Setting_t *se)
  1298. {
  1299. return se ? se->Type : eSetting_Undefined;
  1300. }
  1301. /* find a setting by name in a list of settings */
  1302. Setting_t *
  1303. FindSetting(SettingList_t se, char *identifier)
  1304. {
  1305. for (; se; se = se->Next) {
  1306. if (!strcmp(se->Identifier, identifier))
  1307. return se;
  1308. }
  1309. return NULL;
  1310. }
  1311. /* constructor of FieldSpec_t */
  1312. FieldSpec_t *
  1313. NewFieldSpec(FieldSpecs_e type)
  1314. {
  1315. FieldSpec_t *ret;
  1316. ret = (FieldSpec_t *)malloc(sizeof(FieldSpec_t));
  1317. if (! ret)
  1318. return NULL;
  1319. memset(ret, 0, sizeof(FieldSpec_t));
  1320. ret->Type = type;
  1321. // ret->Identifier = NULL;
  1322. // ret->Next = NULL;
  1323. switch (type) {
  1324. case eFieldSpec_Type:
  1325. // ret->U.Type.Optionality = NULL;
  1326. break;
  1327. case eFieldSpec_FixedTypeValue:
  1328. // ret->U.FixedTypeValue.Type = NULL;
  1329. // ret->U.FixedTypeValue.Unique = 0;
  1330. // ret->U.FixedTypeValue.Optionality = NULL;
  1331. break;
  1332. case eFieldSpec_VariableTypeValue:
  1333. // ret->U.VariableTypeValue.Fields = NULL;
  1334. // ret->U.VariableTypeValue.Optionality = NULL;
  1335. break;
  1336. case eFieldSpec_FixedTypeValueSet:
  1337. // ret->U.FixedTypeValueSet.Type = NULL;
  1338. // ret->U.FixedTypeValueSet.Optionality = NULL;
  1339. break;
  1340. case eFieldSpec_VariableTypeValueSet:
  1341. // ret->U.VariableTypeValueSet.Fields = NULL;
  1342. // ret->U.VariableTypeValueSet.Optionality = NULL;
  1343. break;
  1344. case eFieldSpec_Object:
  1345. // ret->U.Object.ObjectClass = NULL;
  1346. // ret->U.Object.Optionality = NULL;
  1347. break;
  1348. case eFieldSpec_ObjectSet:
  1349. // ret->U.ObjectSet.ObjectClass = NULL;
  1350. // ret->U.ObjectSet.Optionality = NULL;
  1351. break;
  1352. default:
  1353. MyAbort();
  1354. }
  1355. return ret;
  1356. }
  1357. /* copy constructor of FieldSpec_t */
  1358. FieldSpec_t *
  1359. DupFieldSpec(FieldSpec_t *src)
  1360. {
  1361. RETDUP(FieldSpec_t, src);
  1362. }
  1363. /* find a fieldspec by name in a list of fieldspecs */
  1364. FieldSpec_t *
  1365. FindFieldSpec(FieldSpecList_t fs, char *identifier)
  1366. {
  1367. if (!identifier)
  1368. return NULL;
  1369. for (; fs; fs = fs->Next) {
  1370. if (!strcmp(fs->Identifier, identifier))
  1371. return fs;
  1372. }
  1373. return NULL;
  1374. }
  1375. /* constructor of Optionality_t */
  1376. Optionality_t *
  1377. NewOptionality(Optionality_e type)
  1378. {
  1379. Optionality_t *ret;
  1380. ret = (Optionality_t *)malloc(sizeof(Optionality_t));
  1381. if (! ret)
  1382. return NULL;
  1383. memset(ret, 0, sizeof(Optionality_t));
  1384. ret->Type = type;
  1385. switch (type) {
  1386. case eOptionality_Normal:
  1387. break;
  1388. case eOptionality_Optional:
  1389. break;
  1390. case eOptionality_Default_Type:
  1391. // ret->U.Type = NULL;
  1392. break;
  1393. case eOptionality_Default_Value:
  1394. // ret->U.Value = NULL;
  1395. break;
  1396. case eOptionality_Default_ValueSet:
  1397. // ret->U.ValueSet = NULL;
  1398. break;
  1399. case eOptionality_Default_Object:
  1400. // ret->U.Object = NULL;
  1401. break;
  1402. case eOptionality_Default_ObjectSet:
  1403. // ret->U.ObjectSet = NULL;
  1404. break;
  1405. }
  1406. return ret;
  1407. }
  1408. /* constructor of String_t */
  1409. String_t *
  1410. NewString()
  1411. {
  1412. String_t *ret;
  1413. ret = (String_t *)malloc(sizeof(String_t));
  1414. if (! ret)
  1415. return NULL;
  1416. memset(ret, 0, sizeof(String_t));
  1417. // ret->String = NULL;
  1418. // ret->Next = NULL;
  1419. return ret;
  1420. }
  1421. /* copy constructor of String_t */
  1422. String_t *
  1423. DupString(String_t *src)
  1424. {
  1425. RETDUP(String_t, src);
  1426. }
  1427. /* find a string by name in a string list */
  1428. String_t *
  1429. FindString(StringList_t list, char *string)
  1430. {
  1431. for (; list; list = list->Next) {
  1432. if (!strcmp(list->String, string))
  1433. return list;
  1434. }
  1435. return NULL;
  1436. }
  1437. /* constructor of StringModule_t */
  1438. StringModule_t *
  1439. NewStringModule()
  1440. {
  1441. StringModule_t *ret;
  1442. ret = (StringModule_t *)malloc(sizeof(StringModule_t));
  1443. if (! ret)
  1444. return NULL;
  1445. memset(ret, 0, sizeof(StringModule_t));
  1446. // ret->String = NULL;
  1447. // ret->Module = NULL;
  1448. // ret->Next = NULL;
  1449. return ret;
  1450. }
  1451. /* copy constructor of StringModule_t */
  1452. StringModule_t *
  1453. DupStringModule(StringModule_t *src)
  1454. {
  1455. RETDUP(StringModule_t, src);
  1456. }
  1457. /* find a stringmodule by name/module in a list of stringmodules */
  1458. StringModule_t *
  1459. FindStringModule(AssignmentList_t ass, StringModuleList_t list, char *string, ModuleIdentifier_t *module)
  1460. {
  1461. for (; list; list = list->Next) {
  1462. if (!strcmp(list->String, string) &&
  1463. !CmpModuleIdentifier(ass, list->Module, module))
  1464. return list;
  1465. }
  1466. return NULL;
  1467. }
  1468. /* constructor of SyntaxSpec_t */
  1469. SyntaxSpec_t *
  1470. NewSyntaxSpec(SyntaxSpecs_e type)
  1471. {
  1472. SyntaxSpec_t *ret;
  1473. ret = (SyntaxSpec_t *)malloc(sizeof(SyntaxSpec_t));
  1474. if (! ret)
  1475. return NULL;
  1476. memset(ret, 0, sizeof(SyntaxSpec_t));
  1477. // ret->Next = NULL;
  1478. ret->Type = type;
  1479. switch (type) {
  1480. case eSyntaxSpec_Literal:
  1481. // ret->U.Literal.Literal = NULL;
  1482. break;
  1483. case eSyntaxSpec_Field:
  1484. // ret->U.Field.Field = NULL;
  1485. break;
  1486. case eSyntaxSpec_Optional:
  1487. // ret->U.Optional.SyntaxSpec = NULL;
  1488. break;
  1489. }
  1490. return ret;
  1491. }
  1492. /* copy constructor of SyntaxSpec_t */
  1493. SyntaxSpec_t *
  1494. DupSyntaxSpec(SyntaxSpec_t *src)
  1495. {
  1496. RETDUP(SyntaxSpec_t, src);
  1497. }
  1498. /* check if a type depends on other types which would be declared later */
  1499. /* returns 1 if the type depends on a type of the unknown list and */
  1500. /* therefore has to be defined later */
  1501. /* returns 0 if the type can be defined now */
  1502. int
  1503. Depends(AssignmentList_t known, AssignmentList_t unknown, Type_t *type, Type_t *parent)
  1504. {
  1505. Type_t *reftype;
  1506. int isunknown = 0;
  1507. /* no dependency if no type is referenced */
  1508. if (type->Type != eType_Reference && type->Type != eType_FieldReference)
  1509. return 0;
  1510. /* get the directly referenced type */
  1511. reftype = GetReferencedType(known, type);
  1512. if (!reftype) {
  1513. reftype = GetReferencedType(unknown, type);
  1514. isunknown = 1;
  1515. }
  1516. if (!reftype)
  1517. MyAbort();
  1518. // fix intermediate pdu
  1519. if (IsStructuredType(reftype) || IsSequenceType(reftype) || IsReferenceType(reftype))
  1520. {
  1521. reftype->Flags |= eTypeFlags_MiddlePDU;
  1522. }
  1523. /* no dependency if a structured type is referenced by use of pointer */
  1524. /* because a 'struct XXX_s *' can be used */
  1525. if (IsStructuredType(reftype) && (type->Rules & eTypeRules_IndirectMask))
  1526. return 0;
  1527. /* no dependency if a structured type is referenced in an length-pointer */
  1528. /* type, because a 'struct XXX_s *values' can be used */
  1529. if (IsStructuredType(reftype) && (parent->Rules & eTypeRules_LengthPointer))
  1530. return 0;
  1531. // special case for pointer related components
  1532. if (! isunknown && IsStructuredType(reftype) &&
  1533. (parent->Rules & eTypeRules_LinkedListMask))
  1534. return 0;
  1535. // special case for SequenceOf and SetOf because they are using Pxxx.
  1536. if ((reftype->Type == eType_SequenceOf || reftype->Type == eType_SetOf) &&
  1537. (reftype->Rules & (eTypeRules_LinkedListMask | eTypeRules_PointerToElement)))
  1538. // && (type->Rules & eTypeRules_IndirectMask))
  1539. return 0;
  1540. /* return true if referenced type is unknown up to now */
  1541. return isunknown;
  1542. }
  1543. /* sort the assignments */
  1544. /* obtain an order usable by C type definitions */
  1545. void
  1546. SortAssignedTypes(AssignmentList_t *a)
  1547. {
  1548. Assignment_t *list, *curr, *next, **prev, **last;
  1549. int depends;
  1550. Component_t *components;
  1551. Type_t *type;
  1552. int flag;
  1553. int structured;
  1554. /* list will contain the unordered assignments */
  1555. list = *a;
  1556. /* *a is the ordered list of assignments */
  1557. *a = NULL;
  1558. /* last will be used for appending to the list of ordered assignments */
  1559. last = a;
  1560. /* at first try to dump all non-structured types */
  1561. structured = 0;
  1562. /* we have to move all elements of the unordered assignment list into */
  1563. /* the list of the ordered assignments */
  1564. while (list) {
  1565. /* flag if any assignment has been moved */
  1566. flag = 0;
  1567. /* examine every element in the unordered list */
  1568. for (prev = &list, curr = list; curr; ) {
  1569. /* flag if the current type depends on another type and */
  1570. /* therefore cannot be moved now */
  1571. depends = 0;
  1572. /* only types will need dependencies */
  1573. if (curr->Type == eAssignment_Type) {
  1574. /* examine the current type */
  1575. switch (curr->U.Type.Type->Type) {
  1576. case eType_Sequence:
  1577. case eType_Set:
  1578. case eType_Choice:
  1579. case eType_External:
  1580. case eType_EmbeddedPdv:
  1581. case eType_CharacterString:
  1582. case eType_Real:
  1583. case eType_InstanceOf:
  1584. /* structured types shall not be moved in the first pass */
  1585. if (!structured) {
  1586. depends = 1;
  1587. break;
  1588. }
  1589. /* examine all components of the current type */
  1590. for (components = curr->U.Type.Type->U.SSC.Components;
  1591. components && !depends; components = components->Next) {
  1592. switch (components->Type) {
  1593. case eComponent_Normal:
  1594. case eComponent_Optional:
  1595. case eComponent_Default:
  1596. /* check if the type of the component depends */
  1597. /* on an undefined type */
  1598. type = components->U.NOD.NamedType->Type;
  1599. depends |= Depends(*a, list, type,
  1600. curr->U.Type.Type);
  1601. break;
  1602. case eComponent_ComponentsOf:
  1603. /* components of should have been already */
  1604. /* resolved */
  1605. MyAbort();
  1606. /*NOTREACHED*/
  1607. case eComponent_ExtensionMarker:
  1608. break;
  1609. }
  1610. }
  1611. break;
  1612. case eType_SequenceOf:
  1613. case eType_SetOf:
  1614. /* structured types shall not be moved in the first pass */
  1615. if (!structured) {
  1616. depends = 1;
  1617. break;
  1618. }
  1619. /* check if the type of the elements depends on an */
  1620. /* undefined type */
  1621. type = curr->U.Type.Type->U.SS.Type;
  1622. depends |= Depends(*a, list, type, curr->U.Type.Type);
  1623. break;
  1624. case eType_Reference:
  1625. /* check if the referenced type depends on an */
  1626. /* undefined type */
  1627. type = curr->U.Type.Type;
  1628. depends |= Depends(*a, list, type, curr->U.Type.Type);
  1629. break;
  1630. }
  1631. }
  1632. /* move assignment into ordered assignment list if there's no */
  1633. /* unresolved dependency */
  1634. if (!depends) {
  1635. next = curr->Next;
  1636. *last = curr;
  1637. curr->Next = NULL;
  1638. last = &curr->Next;
  1639. curr = next;
  1640. *prev = curr;
  1641. flag = 1;
  1642. } else {
  1643. prev = &curr->Next;
  1644. curr = curr->Next;
  1645. }
  1646. }
  1647. /* if no types have been moved, allow examination of structured types */
  1648. /* if already allowed structured types, MyAbort because of cyclic */
  1649. /* type definitions */
  1650. if (!flag) {
  1651. if (!structured) {
  1652. structured = 1;
  1653. } else {
  1654. if (! curr || ! curr->Next)
  1655. {
  1656. error(E_recursive_type_definition, NULL);
  1657. }
  1658. }
  1659. }
  1660. }
  1661. }
  1662. // --- The following is added by Microsoft ---
  1663. static const char *c_aReservedWords[] =
  1664. {
  1665. // special for C language
  1666. "__asm",
  1667. "__based",
  1668. "__cdecl",
  1669. "__declspec",
  1670. "__except",
  1671. "__fastcall",
  1672. "__finally",
  1673. "__inline",
  1674. "__int16",
  1675. "__int32",
  1676. "__int64",
  1677. "__int8",
  1678. "__leave",
  1679. "__multiple_inheritance",
  1680. "__single_inheritance",
  1681. "__stdcall",
  1682. "__try",
  1683. "__uuidof",
  1684. "__virtual_inheritance",
  1685. "auto",
  1686. "bool",
  1687. "break",
  1688. "case",
  1689. "catch",
  1690. "char",
  1691. "class",
  1692. "const",
  1693. "const_cast",
  1694. "continue",
  1695. "default",
  1696. "delete",
  1697. "dllexport",
  1698. "dllimport",
  1699. "do",
  1700. "double",
  1701. "dynamic_cast",
  1702. "else",
  1703. "enum",
  1704. "explicit",
  1705. "extern",
  1706. "false",
  1707. "float",
  1708. "for",
  1709. "friend",
  1710. "goto",
  1711. "if",
  1712. "inline",
  1713. "int",
  1714. "long",
  1715. "main",
  1716. "mutable",
  1717. "naked",
  1718. "namespace",
  1719. "new",
  1720. "operator",
  1721. "private",
  1722. "protected",
  1723. "public",
  1724. "register",
  1725. "reinterpret_cast",
  1726. "return",
  1727. "short",
  1728. "signed",
  1729. "sizeof",
  1730. "static",
  1731. "static_cast",
  1732. "struct",
  1733. "switch",
  1734. "template",
  1735. "this",
  1736. "thread",
  1737. "throw",
  1738. "true",
  1739. "try",
  1740. "typedef",
  1741. "typeid",
  1742. "typename",
  1743. "union",
  1744. "unsigned",
  1745. "using",
  1746. "uuid",
  1747. "virtual",
  1748. "void",
  1749. "volatile",
  1750. "while",
  1751. "wmain",
  1752. "xalloc"
  1753. };
  1754. int IsReservedWord ( char *psz )
  1755. {
  1756. int cWords = sizeof(c_aReservedWords) / sizeof(c_aReservedWords[0]);
  1757. const char **ppszWord;
  1758. for (ppszWord = &c_aReservedWords[0]; cWords--; ppszWord++)
  1759. {
  1760. if (strcmp(psz, *ppszWord) == 0)
  1761. return 1;
  1762. }
  1763. return 0;
  1764. }
  1765. typedef struct ConflictNameList_s
  1766. {
  1767. struct ConflictNameList_s *next;
  1768. char *pszName;
  1769. unsigned int cInstances;
  1770. } ConflictNameList_t;
  1771. static ConflictNameList_t *g_pEnumNameList = NULL; // ENUMERATED
  1772. static ConflictNameList_t *g_pOptNameList = NULL; // OPTIONAL
  1773. static ConflictNameList_t *g_pChoiceNameList = NULL; // CHOICE
  1774. void KeepConflictNames ( ConflictNameList_t **ppListHead, char *pszName )
  1775. {
  1776. ConflictNameList_t *p;
  1777. char *psz;
  1778. char szName[256];
  1779. strcpy(&szName[0], pszName);
  1780. for (psz = &szName[0]; *psz; psz++)
  1781. {
  1782. if (*psz == '-')
  1783. *psz = '_';
  1784. }
  1785. for (p = *ppListHead; p; p = p->next)
  1786. {
  1787. if (strcmp(p->pszName, &szName[0]) == 0)
  1788. {
  1789. p->cInstances++;
  1790. return;
  1791. }
  1792. }
  1793. p = (ConflictNameList_t *) malloc(sizeof(ConflictNameList_t));
  1794. if (p)
  1795. {
  1796. memset(p, 0, sizeof(ConflictNameList_t));
  1797. p->next = *ppListHead;
  1798. *ppListHead = p;
  1799. p->cInstances = 1;
  1800. p->pszName = strdup(&szName[0]);
  1801. }
  1802. }
  1803. void KeepEnumNames ( char *pszEnumName )
  1804. {
  1805. KeepConflictNames(&g_pEnumNameList, pszEnumName);
  1806. }
  1807. void KeepOptNames ( char *pszOptName )
  1808. {
  1809. KeepConflictNames(&g_pOptNameList, pszOptName);
  1810. }
  1811. void KeepChoiceNames ( char *pszChoiceName )
  1812. {
  1813. KeepConflictNames(&g_pChoiceNameList, pszChoiceName);
  1814. }
  1815. unsigned int GetConflictNameInstanceCount ( ConflictNameList_t *pListHead, char *pszName )
  1816. {
  1817. ConflictNameList_t *p;
  1818. for (p = pListHead; p; p = p->next)
  1819. {
  1820. if (strcmp(p->pszName, pszName) == 0)
  1821. {
  1822. return p->cInstances;
  1823. }
  1824. }
  1825. return 0;
  1826. }
  1827. int DoesEnumNameConflict ( char *pszEnumName )
  1828. {
  1829. return (GetConflictNameInstanceCount(g_pEnumNameList, pszEnumName) > 2); // counted twice
  1830. }
  1831. int DoesOptNameConflict ( char *pszOptName )
  1832. {
  1833. return (GetConflictNameInstanceCount(g_pOptNameList, pszOptName) > 2); // counted twice
  1834. }
  1835. int DoesChoiceNameConflict ( char *pszChoiceName )
  1836. {
  1837. return (GetConflictNameInstanceCount(g_pChoiceNameList, pszChoiceName) > 2); // counted twice
  1838. }
  1839. int IsImportedLocalDuplicate(AssignmentList_t ass, ModuleIdentifier_t *pMainModule, Assignment_t *curr)
  1840. {
  1841. if (0 == CmpModuleIdentifier(ass, curr->Module, pMainModule))
  1842. {
  1843. Assignment_t *a;
  1844. for (a = ass; a; a = a->Next)
  1845. {
  1846. if (a->Flags & eAssignmentFlags_LongName)
  1847. {
  1848. if (0 == strcmp(a->Identifier, curr->Identifier))
  1849. {
  1850. if (0 != CmpModuleIdentifier(ass, a->Module, curr->Module))
  1851. {
  1852. return 1;
  1853. }
  1854. }
  1855. }
  1856. }
  1857. }
  1858. return 0;
  1859. }
  1860. DefinedObjectID_t *g_pDefinedObjectIDs = NULL;
  1861. Value_t *GetDefinedOIDValue ( char *pszName )
  1862. {
  1863. if (pszName)
  1864. {
  1865. DefinedObjectID_t *p;
  1866. for (p = g_pDefinedObjectIDs; p; p = p->next)
  1867. {
  1868. if (strcmp(pszName, p->pszName) == 0)
  1869. {
  1870. return p->pValue;
  1871. }
  1872. }
  1873. }
  1874. return NULL;
  1875. }
  1876. void AddDefinedOID ( char *pszName, Value_t *pValue )
  1877. {
  1878. // add it only when it does not exist
  1879. if (! GetDefinedOIDValue(pszName))
  1880. {
  1881. DefinedObjectID_t *p;
  1882. p = (DefinedObjectID_t *) malloc(sizeof(DefinedObjectID_t));
  1883. if (p)
  1884. {
  1885. p->next = g_pDefinedObjectIDs;
  1886. p->pszName = pszName;
  1887. p->pValue = pValue;
  1888. g_pDefinedObjectIDs = p;
  1889. }
  1890. }
  1891. }
  1892. void PropagatePrivateDirectives ( Type_t *pDst, PrivateDirectives_t *pSrc )
  1893. {
  1894. if (pSrc && pDst)
  1895. {
  1896. if (! pDst->PrivateDirectives.pszTypeName)
  1897. {
  1898. pDst->PrivateDirectives.pszTypeName = pSrc->pszTypeName;
  1899. }
  1900. if (! pDst->PrivateDirectives.pszFieldName)
  1901. {
  1902. pDst->PrivateDirectives.pszFieldName = pSrc->pszFieldName;
  1903. }
  1904. if (! pDst->PrivateDirectives.pszValueName)
  1905. {
  1906. pDst->PrivateDirectives.pszValueName = pSrc->pszValueName;
  1907. }
  1908. pDst->PrivateDirectives.fPublic |= pSrc->fPublic;
  1909. pDst->PrivateDirectives.fIntx |= pSrc->fIntx;
  1910. pDst->PrivateDirectives.fLenPtr |= pSrc->fLenPtr;
  1911. pDst->PrivateDirectives.fPointer |= pSrc->fPointer;
  1912. pDst->PrivateDirectives.fArray |= pSrc->fArray;
  1913. pDst->PrivateDirectives.fNoCode |= pSrc->fNoCode;
  1914. pDst->PrivateDirectives.fNoMemCopy |= pSrc->fNoMemCopy;
  1915. pDst->PrivateDirectives.fOidPacked |= pSrc->fOidPacked;
  1916. pDst->PrivateDirectives.fOidArray |= pSrc->fOidArray;
  1917. pDst->PrivateDirectives.fSLinked |= pSrc->fSLinked;
  1918. pDst->PrivateDirectives.fDLinked |= pSrc->fDLinked;
  1919. }
  1920. }
  1921. void PropagateReferenceTypePrivateDirectives ( Type_t *pDst, PrivateDirectives_t *pSrc )
  1922. {
  1923. if (pSrc && pDst)
  1924. {
  1925. pDst->PrivateDirectives.fPublic |= pSrc->fPublic;
  1926. pDst->PrivateDirectives.fIntx |= pSrc->fIntx;
  1927. pDst->PrivateDirectives.fLenPtr |= pSrc->fLenPtr;
  1928. pDst->PrivateDirectives.fPointer |= pSrc->fPointer;
  1929. pDst->PrivateDirectives.fArray |= pSrc->fArray;
  1930. pDst->PrivateDirectives.fNoCode |= pSrc->fNoCode;
  1931. pDst->PrivateDirectives.fNoMemCopy |= pSrc->fNoMemCopy;
  1932. pDst->PrivateDirectives.fOidPacked |= pSrc->fOidPacked;
  1933. pDst->PrivateDirectives.fOidArray |= pSrc->fOidArray;
  1934. pDst->PrivateDirectives.fSLinked |= pSrc->fSLinked;
  1935. pDst->PrivateDirectives.fDLinked |= pSrc->fDLinked;
  1936. }
  1937. }
  1938. char *GetPrivateValueName(PrivateDirectives_t *pPrivateDirectives, char *pszDefValueName)
  1939. {
  1940. return pPrivateDirectives->pszValueName ? pPrivateDirectives->pszValueName : pszDefValueName;
  1941. }