UilSarMod.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these librararies and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * @OSF_COPYRIGHT@
  25. * COPYRIGHT NOTICE
  26. * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  27. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  28. * the full copyright text.
  29. */
  30. /*
  31. * HISTORY
  32. */
  33. #ifdef REV_INFO
  34. #ifndef lint
  35. static char rcsid[] = "$TOG: UilSarMod.c /main/13 1997/03/12 15:21:36 dbl $"
  36. #endif
  37. #endif
  38. /*
  39. * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  40. /*
  41. **++
  42. ** FACILITY:
  43. **
  44. ** User Interface Language Compiler (UIL)
  45. **
  46. ** ABSTRACT:
  47. **
  48. ** This module contain the routines for processing the module construct.
  49. **
  50. **--
  51. **/
  52. /*
  53. **
  54. ** INCLUDE FILES
  55. **
  56. **/
  57. #include "UilDefI.h"
  58. /*
  59. **
  60. ** TABLE OF CONTENTS
  61. **
  62. */
  63. /*
  64. **
  65. ** DEFINE and MACRO DEFINITIONS
  66. **
  67. **/
  68. /*
  69. **
  70. ** EXTERNAL VARIABLE DECLARATIONS
  71. **
  72. **/
  73. extern yystype yylval;
  74. /*
  75. **
  76. ** GLOBAL VARIABLE DECLARATIONS
  77. **
  78. **/
  79. externaldef(uil_comp_glbl) src_source_record_type
  80. *src_az_module_source_record;
  81. externaldef(uil_comp_glbl) unsigned short int
  82. *uil_urm_variant = NULL;
  83. externaldef(uil_comp_glbl) unsigned short int
  84. *uil_arg_compr = NULL;
  85. externaldef(uil_comp_glbl) unsigned short int
  86. *uil_reas_compr = NULL;
  87. externaldef(uil_comp_glbl) unsigned short int
  88. *uil_widget_compr = NULL;
  89. externaldef(uil_comp_glbl) unsigned short int
  90. *uil_child_compr = NULL;
  91. /*
  92. **
  93. ** OWN VARIABLE DECLARATIONS
  94. **
  95. **/
  96. unsigned int module_clauses;
  97. #define m_version_clause (1<<0)
  98. #define m_names_clause (1<<1)
  99. #define m_charset_clause (1<<2)
  100. #define m_objects_clause (1<<3)
  101. #define m_after_names (m_charset_clause)
  102. /*
  103. **++
  104. ** FUNCTIONAL DESCRIPTION:
  105. **
  106. ** This function initializes all static data structure for the semantic
  107. ** action routines.
  108. **
  109. ** FORMAL PARAMETERS:
  110. **
  111. ** none
  112. **
  113. ** IMPLICIT INPUTS:
  114. **
  115. ** none
  116. **
  117. ** IMPLICIT OUTPUTS:
  118. **
  119. ** uil_urm_variant
  120. **
  121. ** FUNCTION VALUE:
  122. **
  123. ** void
  124. **
  125. ** SIDE EFFECTS:
  126. **
  127. ** global variables are initialized
  128. **
  129. **--
  130. **/
  131. void sar_initialize ()
  132. {
  133. int i; /* loop index */
  134. /* BEGIN OSF Fix CR 5443 */
  135. /* Initialize uil_sym_default_charset based on XmFALLBACK_CHARSET */
  136. if (strcmp(XmFALLBACK_CHARSET, "ISO8859-1") != 0) /* Most common case. */
  137. for (i = 0; i < (int)charset_lang_table_max; i++)
  138. if (strcmp(XmFALLBACK_CHARSET, charset_lang_names_table[i]) == 0)
  139. {
  140. uil_sym_default_charset = charset_lang_codes_table[i];
  141. break;
  142. }
  143. /* END OSF Fix CR 5443 */
  144. /*
  145. * Allocate vectors for the variant and usage vectors if they are NULL,
  146. */
  147. if ( uil_urm_variant == NULL )
  148. uil_urm_variant = (unsigned short int *)
  149. XtMalloc(sizeof(unsigned short int)*(uil_max_object+1));
  150. if ( uil_arg_compr == NULL )
  151. uil_arg_compr = (unsigned short int *)
  152. XtMalloc(sizeof(unsigned short int)*(uil_max_arg+1));
  153. if ( uil_reas_compr == NULL )
  154. uil_reas_compr = (unsigned short int *)
  155. XtMalloc(sizeof(unsigned short int)*(uil_max_reason+1));
  156. if ( uil_widget_compr == NULL )
  157. uil_widget_compr = (unsigned short int *)
  158. XtMalloc(sizeof(unsigned short int)*(uil_max_object+1));
  159. if ( uil_child_compr == NULL )
  160. uil_child_compr = (unsigned short int *)
  161. XtMalloc(sizeof(unsigned short int)*(uil_max_child+1));
  162. /*
  163. ** Loop throught the array of object variants and set them all to NULL.
  164. */
  165. for (i = 0; i<uil_max_object+1; i++)
  166. uil_urm_variant[i] = 0;
  167. /*
  168. ** Initialize all compression vectors
  169. */
  170. for ( i=0 ; i<uil_max_arg+1 ; i++ )
  171. uil_arg_compr[i] = 0;
  172. for ( i=0 ; i<uil_max_reason+1 ; i++ )
  173. uil_reas_compr[i] = 0;
  174. for ( i=0 ; i<uil_max_object+1 ; i++ )
  175. uil_widget_compr[i] = 0;
  176. for ( i=0 ; i<uil_max_child+1 ; i++ )
  177. uil_child_compr[i] = 0;
  178. }
  179. /*
  180. **++
  181. ** FUNCTIONAL DESCRIPTION:
  182. **
  183. ** This function creates the root entry node for the compilation.
  184. ** The "root" entry is the root node of the symbol tree and is
  185. ** what's passed back to the caller of the compiler.
  186. **
  187. ** FORMAL PARAMETERS:
  188. **
  189. ** root_frame ptr to root frame that will remain on the stack
  190. ** throughout the compilation
  191. **
  192. ** IMPLICIT INPUTS:
  193. **
  194. ** none
  195. **
  196. ** IMPLICIT OUTPUTS:
  197. **
  198. ** sym_az_root_entry global pointer used thoughout the compilation
  199. ** sym_az_curent_section_entry global pointer used thoughout the compilation
  200. ** src_az_first_source_record global pointer to the source record list
  201. **
  202. ** FUNCTION VALUE:
  203. **
  204. ** void
  205. **
  206. ** SIDE EFFECTS:
  207. **
  208. ** none
  209. **
  210. **--
  211. **/
  212. void sar_create_root (root_frame)
  213. yystype *root_frame;
  214. {
  215. /*
  216. ** Allocate the symbol nodes
  217. */
  218. sym_az_root_entry = (sym_root_entry_type *)
  219. sem_allocate_node (sym_k_root_entry, sym_k_root_entry_size);
  220. /*
  221. ** Create a place holder entry (tail) and change the "current" section list to it.
  222. */
  223. sym_az_current_section_entry = (sym_section_entry_type *) sem_allocate_node
  224. ( sym_k_section_entry, sym_k_section_entry_size );
  225. sym_az_current_section_entry->header.b_type = sym_k_section_tail;
  226. sym_az_root_entry->sections = sym_az_current_section_entry;
  227. sym_az_root_entry->src_record_list = src_az_first_source_record;
  228. /*
  229. ** Save the file name and the expanded version of it.
  230. */
  231. strcpy (sym_az_root_entry->file_name, Uil_cmd_z_command.ac_source_file);
  232. strcpy (sym_az_root_entry->full_file_name, src_az_source_file_table[0]->expanded_name);
  233. /*
  234. ** Save the symbol node in the root frame.
  235. */
  236. root_frame->b_tag = sar_k_root_frame;
  237. root_frame->b_type = sym_k_root_entry;
  238. root_frame->value.az_symbol_entry = (sym_entry_type *)sym_az_root_entry;
  239. }
  240. /*
  241. **++
  242. ** FUNCTIONAL DESCRIPTION:
  243. **
  244. ** This function create the module entry symbol node for the compilation.
  245. **
  246. ** FORMAL PARAMETERS:
  247. **
  248. ** target_frame ptr to module frame that will remain on the stack
  249. ** throughout the compilation
  250. ** id_frame ptr to token frame for the module name
  251. **
  252. ** IMPLICIT INPUTS:
  253. **
  254. ** sym_az_root_entry global that points to the root entry
  255. **
  256. ** IMPLICIT OUTPUTS:
  257. **
  258. ** sym_az_module_entry global that points to module entry
  259. **
  260. ** FUNCTION VALUE:
  261. **
  262. ** void
  263. **
  264. ** SIDE EFFECTS:
  265. **
  266. ** set second line of the listing title
  267. **
  268. **--
  269. **/
  270. void sar_create_module(target_frame, id_frame, module_frame)
  271. yystype *target_frame;
  272. yystype *id_frame;
  273. yystype *module_frame;
  274. {
  275. sym_name_entry_type *name_entry;
  276. /*
  277. ** Call standard routine to check name entry for id_frame.
  278. ** This routine handles font name, color names, etc used as ids
  279. */
  280. name_entry = (sym_name_entry_type *) sem_dcl_name( id_frame );
  281. /*
  282. ** Allocate the module entry and fill it in
  283. */
  284. sym_az_module_entry = (sym_module_entry_type *)
  285. sem_allocate_node (sym_k_module_entry, sym_k_module_entry_size);
  286. sym_az_module_entry->obj_header.az_name = name_entry;
  287. _sar_save_source_pos (&sym_az_module_entry->header, module_frame);
  288. /* preserve module header comments */
  289. sar_assoc_comment ((sym_obj_entry_type *)sym_az_module_entry);
  290. /*
  291. ** Hang the module entry off the root entry
  292. */
  293. sym_az_root_entry->module_hdr = sym_az_module_entry;
  294. /*
  295. ** Have name entry point to the module entry too. This stops the
  296. ** name from being reused to name another construct.
  297. */
  298. name_entry->az_object = (sym_entry_type *) sym_az_module_entry;
  299. /*
  300. ** Save the source information about module name identifier
  301. */
  302. _sar_save_source_info ( &name_entry->header , module_frame , id_frame );
  303. /*
  304. ** Set up target frame
  305. */
  306. target_frame->b_tag = sar_k_module_frame;
  307. /*
  308. ** Set up listing title
  309. */
  310. if (Uil_cmd_z_command.v_listing_file)
  311. sprintf(Uil_lst_c_title2,
  312. "Module: %s",
  313. name_entry->c_text );
  314. /*
  315. ** Set mask to no clauses seen
  316. */
  317. module_clauses = 0;
  318. }
  319. /*
  320. **++
  321. ** FUNCTIONAL DESCRIPTION:
  322. **
  323. ** This function sets a version string for the module.
  324. **
  325. ** FORMAL PARAMETERS:
  326. **
  327. ** value_frame ptr to value frame for version string
  328. **
  329. ** IMPLICIT INPUTS:
  330. **
  331. ** none
  332. **
  333. ** IMPLICIT OUTPUTS:
  334. **
  335. ** sym_az_module_entry global that point to module entry
  336. **
  337. ** FUNCTION VALUE:
  338. **
  339. ** void
  340. **
  341. ** SIDE EFFECTS:
  342. **
  343. ** set up second line of the listing title
  344. **
  345. **--
  346. **/
  347. void sar_process_module_version (value_frame, start_frame)
  348. yystype *value_frame;
  349. yystype *start_frame;
  350. {
  351. sym_value_entry_type *value_entry;
  352. _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing" );
  353. if ((module_clauses & m_version_clause) != 0)
  354. diag_issue_diagnostic
  355. ( d_single_occur,
  356. _sar_source_position( value_frame ),
  357. "UIL", "module", "version", "clause"
  358. );
  359. /*
  360. ** FORWARD REFERENCING OF VERSION NO LONGER ALLOWED
  361. ** If it's not a forward reference, verify its length and stick a pointer
  362. ** to the value node of the version in the module entry.
  363. */
  364. if ((value_frame->b_flags & sym_m_forward_ref) != 0)
  365. diag_issue_diagnostic(d_illegal_forward_ref,
  366. _sar_source_position(value_frame),
  367. "Module Version"
  368. );
  369. else
  370. {
  371. value_entry = (sym_value_entry_type *)
  372. value_frame->value.az_symbol_entry;
  373. if (value_entry->w_length > 31)
  374. {
  375. diag_issue_diagnostic
  376. ( d_out_range,
  377. _sar_source_position( value_frame ),
  378. "version string",
  379. "0..31 characters"
  380. );
  381. value_entry->w_length = 31;
  382. }
  383. sym_az_module_entry->az_version = value_entry;
  384. }
  385. /*
  386. ** Save source info
  387. */
  388. _sar_save_source_info ( &sym_az_module_entry->az_version->header , start_frame , value_frame);
  389. /*
  390. ** Set up listing title
  391. */
  392. if (Uil_cmd_z_command.v_listing_file)
  393. sprintf(Uil_lst_c_title2,
  394. "Module: %s \t Version: %s",
  395. sym_az_module_entry->obj_header.az_name->c_text,
  396. value_entry->value.c_value );
  397. module_clauses |= m_version_clause;
  398. }
  399. /*
  400. **++
  401. ** FUNCTIONAL DESCRIPTION:
  402. **
  403. ** This function sets the case sensitivity of names for the module.
  404. **
  405. ** FORMAL PARAMETERS:
  406. **
  407. ** token_frame ptr to token frame for keyword sensitive or insensitive
  408. **
  409. ** IMPLICIT INPUTS:
  410. **
  411. ** sym_az_module_entry global which points to module entry
  412. **
  413. ** IMPLICIT OUTPUTS:
  414. **
  415. ** uil_v_case_sensitive global which control case sensitivity of names
  416. **
  417. ** FUNCTION VALUE:
  418. **
  419. ** void
  420. **
  421. ** SIDE EFFECTS:
  422. **
  423. ** none
  424. **
  425. **--
  426. **/
  427. void sar_process_module_sensitivity (token_frame, start_frame)
  428. yystype *token_frame;
  429. yystype *start_frame;
  430. {
  431. _assert( token_frame->b_tag == sar_k_token_frame, "token frame missing" );
  432. if ((module_clauses & m_names_clause) != 0)
  433. diag_issue_diagnostic
  434. ( d_single_occur,
  435. _sar_source_position( token_frame ),
  436. "UIL", "module", "names", "clause"
  437. );
  438. if ((module_clauses & m_after_names) != 0)
  439. diag_issue_diagnostic
  440. ( d_names,
  441. _sar_source_position( token_frame )
  442. );
  443. uil_v_case_sensitive = (token_frame->b_type == CASE_SENSITIVE);
  444. sym_az_module_entry->az_case_sense = (sym_value_entry_type *)
  445. sem_allocate_node (sym_k_value_entry, sym_k_value_entry_size);
  446. sym_az_module_entry->az_case_sense->header.b_type = uil_v_case_sensitive;
  447. /*
  448. ** Save source info
  449. */
  450. _sar_save_source_info ( &sym_az_module_entry->az_case_sense->header , start_frame , token_frame);
  451. /* let the keyword table know of the sensitivity change */
  452. key_initialize();
  453. /*
  454. ** The default for name sensitivity is SENSITIVE.
  455. ** At the point that this semantic routine is called, the only valid
  456. ** name seen so far is the module name.
  457. */
  458. module_clauses |= m_names_clause;
  459. }
  460. /*
  461. **++
  462. ** FUNCTIONAL DESCRIPTION:
  463. **
  464. ** This function sets the default charset for the module.
  465. **
  466. ** FORMAL PARAMETERS:
  467. **
  468. ** token_frame ptr to token frame for charset
  469. **
  470. ** IMPLICIT INPUTS:
  471. **
  472. ** sym_az_module_entry global pointer to the module entry
  473. **
  474. ** IMPLICIT OUTPUTS:
  475. **
  476. ** Uil_lex_l_user_default_charset
  477. ** Uil_lex_az_charset_entry
  478. **
  479. ** FUNCTION VALUE:
  480. **
  481. ** void
  482. **
  483. ** SIDE EFFECTS:
  484. **
  485. ** none
  486. **
  487. **--
  488. **/
  489. void sar_process_module_charset(token_frame , start_frame)
  490. yystype *token_frame;
  491. yystype *start_frame;
  492. {
  493. sym_value_entry_type *value_entry;
  494. _assert( (token_frame->b_tag == sar_k_token_frame) ||
  495. (token_frame->b_tag == sar_k_value_frame), "token or value frame missing" );
  496. if ((module_clauses & m_charset_clause) != 0)
  497. diag_issue_diagnostic
  498. ( d_single_occur,
  499. _sar_source_position( token_frame ),
  500. "UIL", "module", "character_set", "clause"
  501. );
  502. /*
  503. ** There are two different ways that the charset info may be specified.
  504. ** If the charset_frame is a token frame, then we can just grab the
  505. ** token class and map it into a charset value. If it is a value frame
  506. ** the it is the result of the CHARACTER_SET function and is a string
  507. ** value representing the character set.
  508. */
  509. switch (token_frame->b_tag)
  510. {
  511. case sar_k_token_frame:
  512. {
  513. key_keytable_entry_type *az_keyword_entry;
  514. az_keyword_entry = token_frame->value.az_keyword_entry;
  515. Uil_lex_l_user_default_charset = az_keyword_entry->b_subclass;
  516. value_entry = sem_create_value_entry (
  517. token_frame->value.az_keyword_entry->at_name,
  518. token_frame->value.az_keyword_entry->b_length, sym_k_char_8_value );
  519. break;
  520. }
  521. case sar_k_value_frame:
  522. {
  523. Uil_lex_l_user_default_charset = lex_k_userdefined_charset;
  524. Uil_lex_az_charset_entry = (sym_value_entry_type *)token_frame->value.az_symbol_entry;
  525. value_entry = (sym_value_entry_type *)token_frame->value.az_symbol_entry;
  526. break;
  527. }
  528. }
  529. /* If charset specified for module, then localized strings not allowed */
  530. Uil_lex_l_localized = FALSE;
  531. module_clauses |= m_charset_clause;
  532. sym_az_module_entry->az_character_set = value_entry;
  533. /*
  534. ** Save source info
  535. */
  536. _sar_save_source_info ( &value_entry->header , start_frame , token_frame);
  537. }
  538. /*
  539. **++
  540. ** FUNCTIONAL DESCRIPTION:
  541. **
  542. ** This function saves the source record for the module header
  543. ** for possible later use in the machine code listing.
  544. **
  545. ** FORMAL PARAMETERS:
  546. **
  547. ** none
  548. **
  549. ** IMPLICIT INPUTS:
  550. **
  551. ** yylval Current token information from the lexical analyzer
  552. **
  553. ** IMPLICIT OUTPUTS:
  554. **
  555. ** src_az_module_source_record source record for the module header
  556. **
  557. ** FUNCTION VALUE:
  558. **
  559. ** void
  560. **
  561. ** SIDE EFFECTS:
  562. **
  563. ** none
  564. **
  565. **--
  566. **/
  567. void sar_save_module_source ()
  568. {
  569. src_az_module_source_record = yylval.az_source_record;
  570. }
  571. /*
  572. **++
  573. ** FUNCTIONAL DESCRIPTION:
  574. **
  575. ** This routine creates and saves a default object specification
  576. ** for the module entry itself.
  577. **
  578. ** FORMAL PARAMETERS:
  579. **
  580. ** object_frame ptr to token frame for "OBJECT"
  581. **
  582. ** IMPLICIT INPUTS:
  583. **
  584. ** none
  585. **
  586. ** IMPLICIT OUTPUTS:
  587. **
  588. ** sym_az_module_entry global pointer to the module entry
  589. **
  590. ** FUNCTION VALUE:
  591. **
  592. ** void
  593. **
  594. ** SIDE EFFECTS:
  595. **
  596. ** none
  597. **
  598. **--
  599. **/
  600. void sar_make_def_obj (object_frame)
  601. yystype *object_frame;
  602. {
  603. sym_def_obj_entry_type *def_obj_entry;
  604. /*
  605. * Make def_obj entry and link into the chain headed in the module
  606. */
  607. def_obj_entry = (sym_def_obj_entry_type *) sem_allocate_node
  608. (sym_k_def_obj_entry, sym_k_def_obj_entry_size);
  609. _sar_save_source_pos (&def_obj_entry->header, object_frame);
  610. def_obj_entry->next = sym_az_module_entry->az_def_obj;
  611. sym_az_module_entry->az_def_obj = def_obj_entry;
  612. }
  613. /*
  614. **++
  615. ** FUNCTIONAL DESCRIPTION:
  616. **
  617. ** This function sets the default variants for objects which
  618. ** are defined in the module.
  619. **
  620. ** FORMAL PARAMETERS:
  621. **
  622. ** type_frame ptr to token frame for object type
  623. ** variant_frame ptr to token frame for variant
  624. **
  625. ** IMPLICIT INPUTS:
  626. **
  627. ** uil_gadget_variants table to see if the gadget variant is supported
  628. ** uil_urm_variant table to see if the object type has been
  629. ** specified previously
  630. ** sym_az_module_entry global pointing to the module entry
  631. **
  632. ** IMPLICIT OUTPUTS:
  633. **
  634. ** uil_urm_variant table to contain the default variant for this
  635. ** object type.
  636. **
  637. ** FUNCTION VALUE:
  638. **
  639. ** void
  640. **
  641. ** SIDE EFFECTS:
  642. **
  643. ** none
  644. **
  645. **--
  646. **/
  647. void sar_process_module_variant (obj_type_frame, variant_frame)
  648. yystype *obj_type_frame;
  649. yystype *variant_frame;
  650. {
  651. unsigned int obj_type, obj_variant;
  652. yystype *source_frame;
  653. sym_def_obj_entry_type *def_obj_entry;
  654. source_frame = & yylval;
  655. obj_type = obj_type_frame->value.az_keyword_entry->b_subclass;
  656. obj_variant = variant_frame->b_type;
  657. /* See if this object type has been specified before. */
  658. if ( uil_urm_variant[obj_type] != 0 )
  659. {
  660. diag_issue_diagnostic
  661. (d_supersede,
  662. _sar_source_position ( source_frame ),
  663. diag_object_text (obj_type),
  664. diag_tag_text (obj_variant),
  665. diag_tag_text (sym_k_module_entry),
  666. "" );
  667. }
  668. /* See if this object type supports gadgets. */
  669. if ( obj_variant == sym_k_gadget_entry )
  670. {
  671. if ( uil_gadget_variants[obj_type] == 0 )
  672. {
  673. diag_issue_diagnostic
  674. (d_gadget_not_sup,
  675. _sar_source_position ( source_frame ),
  676. diag_object_text (obj_type),
  677. diag_object_text (obj_type) );
  678. obj_variant = sym_k_widget_entry;
  679. }
  680. }
  681. /* Save the default variant information */
  682. uil_urm_variant[obj_type] = obj_variant;
  683. /*
  684. ** get the latest def_obj entry and fill in
  685. */
  686. def_obj_entry = sym_az_module_entry->az_def_obj->next;
  687. def_obj_entry->b_object_info = obj_type;
  688. def_obj_entry->b_variant_info = obj_variant;
  689. }
  690. /*
  691. **++
  692. ** FUNCTIONAL DESCRIPTION:
  693. **
  694. ** This procedure saves source info for the various sections declaration
  695. ** lists in the Uil file (i.e. value, identifier, procedure, object, and
  696. ** list).
  697. **
  698. ** FORMAL PARAMETERS:
  699. **
  700. ** header_frame ptr to token frame for the section declaration
  701. ** section_type integer describing what section this is
  702. **
  703. ** IMPLICIT INPUTS:
  704. **
  705. ** none
  706. **
  707. ** IMPLICIT OUTPUTS:
  708. **
  709. ** sym_az_root_entry global pointer to the root entry
  710. **
  711. ** FUNCTION VALUE:
  712. **
  713. ** void
  714. **
  715. ** SIDE EFFECTS:
  716. **
  717. ** none
  718. **
  719. **--
  720. */
  721. void sar_save_section_source (header_frame, section_type)
  722. yystype *header_frame;
  723. int section_type;
  724. {
  725. sym_section_entry_type *section_entry;
  726. section_entry = (sym_section_entry_type *) sem_allocate_node
  727. ( sym_k_section_entry, sym_k_section_entry_size );
  728. section_entry->header.b_type = section_type;
  729. /*
  730. ** Save source info
  731. */
  732. _sar_save_source_info ( &section_entry->header , header_frame, header_frame);
  733. /*
  734. ** Link this section into the current section list.
  735. */
  736. section_entry->next = (sym_entry_type *) sym_az_current_section_entry;
  737. section_entry->prev_section = sym_az_current_section_entry->prev_section;
  738. sym_az_current_section_entry = section_entry;
  739. }