UilSarObj.c 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423
  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[] = "$XConsortium: UilSarObj.c /main/14 1995/07/14 09:37:30 drk $"
  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 contains the semantic action routines for
  49. ** object definitions in the UIL.
  50. **
  51. **--
  52. **/
  53. /*
  54. **
  55. ** INCLUDE FILES
  56. **
  57. **/
  58. #include "UilDefI.h"
  59. /*
  60. **
  61. ** DEFINE and MACRO DEFINITIONS
  62. **
  63. **/
  64. /*
  65. ** This is a fast algorithm for mapping an integer (_size) to
  66. ** 0 _size <= 8
  67. ** 1 8 < _size <= 16
  68. ** 2 16 < _size <= 32
  69. ** 3 32 < _size <= 64
  70. ** 4 64 < _size
  71. ** The algorithm is based on the notion that the floating pt representation
  72. ** of an integer has an exponent that is the log_base2( int ).
  73. **
  74. ** This algorithm is specific to the VAX. An alternate layout of the
  75. ** internal represention of a floating pt number could be supplied for
  76. ** other architectures.
  77. */
  78. #define _compute_node_index( _size, _index ) \
  79. { unsigned short j, k; \
  80. j = (_size); \
  81. if (j <= 8) k = 0; \
  82. else if (j <= 16) k = 1; \
  83. else if (j <= 32) k = 2; \
  84. else if (j <= 64) k = 3; \
  85. else k = 4; \
  86. (_index) = k; \
  87. }
  88. /*
  89. **
  90. ** EXTERNAL VARIABLE DECLARATIONS
  91. **
  92. **/
  93. extern yystype gz_yynullval;
  94. extern yystype yylval;
  95. /*
  96. **
  97. ** GLOBAL VARIABLE DECLARATIONS
  98. **
  99. **/
  100. /*
  101. **
  102. ** OWN VARIABLE DECLARATIONS
  103. **
  104. **/
  105. /*
  106. **++
  107. ** FUNCTIONAL DESCRIPTION:
  108. **
  109. ** This routine associates the latest comment block
  110. ** with the current object frame. RAP
  111. **
  112. ** FORMAL PARAMETERS:
  113. **
  114. ** object_frame address of the parse stack frame for this
  115. ** object.
  116. **
  117. **
  118. **
  119. ** IMPLICIT INPUTS:
  120. **
  121. ** none
  122. **
  123. ** IMPLICIT OUTPUTS:
  124. **
  125. ** none
  126. **
  127. ** FUNCTION VALUE:
  128. **
  129. ** void
  130. **
  131. ** SIDE EFFECTS:
  132. **
  133. ** the object frame contains the comment for this object.
  134. **
  135. **--
  136. **/
  137. void sar_assoc_comment( object )
  138. sym_obj_entry_type *object;
  139. {
  140. object->obj_header.az_comment = (char *)_get_memory(strlen(comment_text)+1);
  141. strcpy(object->obj_header.az_comment, comment_text);
  142. comment_text[0] = '\0';
  143. }
  144. /*
  145. **++
  146. ** FUNCTIONAL DESCRIPTION:
  147. **
  148. ** This routine creates the symbol node for the object, and
  149. ** saves it in the object frame on the parse stack.
  150. **
  151. ** FORMAL PARAMETERS:
  152. **
  153. ** object_frame address of the parse stack frame for this
  154. ** object.
  155. **
  156. ** object_type type literal for this object.
  157. **
  158. ** IMPLICIT INPUTS:
  159. **
  160. ** none
  161. **
  162. ** IMPLICIT OUTPUTS:
  163. **
  164. ** none
  165. **
  166. ** FUNCTION VALUE:
  167. **
  168. ** void
  169. **
  170. ** SIDE EFFECTS:
  171. **
  172. ** the object frame contains the symbol node for this object.
  173. **
  174. **--
  175. **/
  176. void sar_create_object
  177. ( yystype *object_frame, unsigned char object_type )
  178. {
  179. sym_name_entry_type * name_entry;
  180. sym_obj_entry_type * obj_entry;
  181. int node_size;
  182. yystype * source_frame;
  183. source_frame = & yylval;
  184. if (object_frame->b_tag != sar_k_null_frame)
  185. {
  186. /*
  187. ** First we check on the name to see if it has been previously used.
  188. ** This function returns NULL if name cannot be used.
  189. */
  190. name_entry = (sym_name_entry_type *) sem_dcl_name (object_frame);
  191. }
  192. else
  193. {
  194. name_entry = NULL;
  195. }
  196. /* Determine the size of the symbol node to allocate. */
  197. switch (object_type)
  198. {
  199. case sym_k_gadget_entry:
  200. case sym_k_widget_entry:
  201. node_size = sym_k_widget_entry_size;
  202. break;
  203. case sym_k_list_entry:
  204. node_size = sym_k_list_entry_size;
  205. break;
  206. default:
  207. _assert (FALSE, "unexpected object type");
  208. break;
  209. }
  210. /*
  211. * Allocate the symbol node, connect it to its name, and save source info
  212. */
  213. obj_entry = (sym_obj_entry_type *)
  214. sem_allocate_node (object_type, node_size);
  215. if (name_entry != NULL)
  216. {
  217. name_entry->az_object = (sym_entry_type *)obj_entry;
  218. obj_entry->obj_header.az_name = (sym_name_entry_type *)name_entry;
  219. }
  220. _sar_save_source_pos (&obj_entry->header, source_frame );
  221. sar_assoc_comment(obj_entry); /* preserve comments */
  222. /*
  223. * Set the definition in progress bit.
  224. */
  225. obj_entry->obj_header.b_flags |= sym_m_def_in_progress;
  226. /*
  227. * Save the symbol node in the object frame.
  228. */
  229. object_frame->b_tag = sar_k_object_frame;
  230. object_frame->b_type = object_type;
  231. object_frame->value.az_symbol_entry = (sym_entry_type *)obj_entry;
  232. }
  233. /*
  234. **++
  235. ** FUNCTIONAL DESCRIPTION:
  236. **
  237. ** This routine creates the symbol node for the child, and
  238. ** saves it in the object frame on the parse stack.
  239. **
  240. ** FORMAL PARAMETERS:
  241. **
  242. ** object_frame address of the parse stack frame for this
  243. ** object.
  244. **
  245. ** IMPLICIT INPUTS:
  246. **
  247. ** none
  248. **
  249. ** IMPLICIT OUTPUTS:
  250. **
  251. ** none
  252. **
  253. ** FUNCTION VALUE:
  254. **
  255. ** void
  256. **
  257. ** SIDE EFFECTS:
  258. **
  259. ** the object frame contains the symbol node for this child.
  260. **
  261. **--
  262. **/
  263. void sar_create_child
  264. ( yystype *object_frame )
  265. {
  266. sym_obj_entry_type * obj_entry;
  267. yystype * source_frame;
  268. source_frame = & yylval;
  269. /*
  270. * Allocate the symbol node, set its type, and save source info
  271. */
  272. obj_entry = (sym_obj_entry_type *)
  273. sem_allocate_node (sym_k_child_entry, sym_k_widget_entry_size);
  274. obj_entry->header.b_type =
  275. object_frame->value.az_keyword_entry->b_subclass;
  276. _sar_save_source_pos (&obj_entry->header, source_frame );
  277. sar_assoc_comment(obj_entry); /* preserve comments */
  278. /*
  279. * Indicate in compress table that this child type is used.
  280. */
  281. uil_child_compr[obj_entry->header.b_type] = 1;
  282. /*
  283. * Set the definition in progress bit.
  284. */
  285. obj_entry->obj_header.b_flags |= sym_m_def_in_progress;
  286. /*
  287. * Save the symbol node in the object frame.
  288. */
  289. object_frame->b_tag = sar_k_object_frame;
  290. object_frame->b_type = sym_k_child_entry;
  291. object_frame->value.az_symbol_entry = (sym_entry_type *)obj_entry;
  292. }
  293. /*
  294. **++
  295. ** FUNCTIONAL DESCRIPTION:
  296. **
  297. ** This routine creates and links a section node into the symbol table
  298. **
  299. ** FORMAL PARAMETERS:
  300. **
  301. ** id_frame the token frame with the id for this entry.
  302. **
  303. ** IMPLICIT INPUTS:
  304. **
  305. ** sym_az_current_section_entry global pointer to the "current" section
  306. **
  307. ** IMPLICIT OUTPUTS:
  308. **
  309. ** none
  310. **
  311. ** FUNCTION VALUE:
  312. **
  313. ** void
  314. **
  315. ** SIDE EFFECTS:
  316. **
  317. **--
  318. **/
  319. void sar_link_section ( id_frame )
  320. yystype * id_frame;
  321. {
  322. sym_section_entry_type * section_entry;
  323. /*
  324. * Allocate a section entry. Link this entry of of the current section list
  325. */
  326. section_entry = (sym_section_entry_type *) sem_allocate_node
  327. (sym_k_section_entry, sym_k_section_entry_size);
  328. section_entry->next = (sym_entry_type *)
  329. sym_az_current_section_entry->entries;
  330. sym_az_current_section_entry->entries = (sym_entry_type *) section_entry;
  331. section_entry->entries = id_frame->value.az_symbol_entry;
  332. }
  333. /*
  334. **++
  335. ** FUNCTIONAL DESCRIPTION:
  336. **
  337. ** This routine saves the source information about where this
  338. ** semi-colon entry ends.
  339. **
  340. ** FORMAL PARAMETERS:
  341. **
  342. ** semi_frame the token frame for the terminating semi-colon
  343. ** for this entry.
  344. **
  345. ** IMPLICIT INPUTS:
  346. **
  347. ** sym_az_current_section_entry global pointer to the
  348. ** "current" section list
  349. **
  350. ** IMPLICIT OUTPUTS:
  351. **
  352. ** none
  353. **
  354. ** FUNCTION VALUE:
  355. **
  356. ** void
  357. **
  358. ** SIDE EFFECTS:
  359. **
  360. ** none
  361. **
  362. **--
  363. **/
  364. void sar_save_src_semicolon_pos (semi_frame)
  365. yystype * semi_frame;
  366. {
  367. sym_section_entry_type * section_entry;
  368. section_entry = (sym_section_entry_type *)
  369. sym_az_current_section_entry->entries;
  370. _sar_save_source_pos (&section_entry->entries->header, semi_frame);
  371. }
  372. /*
  373. **++
  374. ** FUNCTIONAL DESCRIPTION:
  375. **
  376. ** This function saves the title end source for lists (i.e. "ARGUMENTS",
  377. ** "CALLBACKS", "PROCEDURES", and "CONTROLS"). The source saved here
  378. ** should be "}" or posibly an id_ref.
  379. **
  380. ** PARAMETERS:
  381. **
  382. ** close_frame ptr to token frame for the closing source
  383. **
  384. ** IMPLICIT INPUTS:
  385. **
  386. ** the "current" list on the frame stack as returned by sem_find_object
  387. **
  388. ** IMPLICIT OUTPUTS:
  389. **
  390. ** none
  391. **
  392. ** FUNCTION VALUE:
  393. **
  394. ** void
  395. **
  396. ** SIDE EFFECTS:
  397. **
  398. ** none
  399. **--
  400. **/
  401. void sar_save_list_end (close_frame)
  402. yystype *close_frame;
  403. {
  404. sym_list_entry_type * list_entry;
  405. yystype * list_frame;
  406. /*
  407. ** Search the syntax stack for the object frame.
  408. */
  409. list_frame = sem_find_object (close_frame - 1);
  410. list_entry = (sym_list_entry_type *) list_frame->value.az_symbol_entry;
  411. _sar_save_source_pos ( &list_entry->header , close_frame );
  412. }
  413. /*
  414. **++
  415. ** FUNCTIONAL DESCRIPTION:
  416. **
  417. ** This function saves the end source for just about any type
  418. ** of entry.
  419. **
  420. ** PARAMETERS:
  421. **
  422. ** close_frame ptr to token frame for the closing source (probably
  423. ** a semi-colon).
  424. **
  425. ** IMPLICIT INPUTS:
  426. **
  427. ** the "current" list on the frame stack as returned by sem_find_object
  428. **
  429. ** IMPLICIT OUTPUTS:
  430. **
  431. ** none
  432. **
  433. ** FUNCTION VALUE:
  434. **
  435. ** void
  436. **
  437. ** SIDE EFFECTS:
  438. **
  439. ** none
  440. **--
  441. **/
  442. void sar_save_src_entry_end (close_frame, entry_frame)
  443. yystype *close_frame;
  444. yystype *entry_frame;
  445. {
  446. sym_entry_type * entry;
  447. /*
  448. ** Extract the entry from the frame.
  449. */
  450. entry = (sym_entry_type *) entry_frame->value.az_symbol_entry;
  451. /*
  452. ** Case on the type of entry (source gets put in a different spot for
  453. ** control entries).
  454. */
  455. if (entry->header.b_tag == sym_k_control_entry)
  456. {
  457. sym_control_entry_type *control_entry = (sym_control_entry_type *)entry;
  458. _sar_save_source_pos (&control_entry->az_con_obj->header, close_frame);
  459. }
  460. /*
  461. ** Save the source info in the default place
  462. */
  463. _sar_save_source_pos ( &entry->header , close_frame );
  464. }
  465. /*
  466. **++
  467. ** FUNCTIONAL DESCRIPTION:
  468. **
  469. ** This routine sets flags in the stack entry for the object.
  470. **
  471. ** FORMAL PARAMETERS:
  472. **
  473. ** current_frame address of the current syntax stack frame
  474. **
  475. ** mask mask of flags to be set.
  476. **
  477. ** IMPLICIT INPUTS:
  478. **
  479. ** none
  480. **
  481. ** IMPLICIT OUTPUTS:
  482. **
  483. ** none
  484. **
  485. ** FUNCTION VALUE:
  486. **
  487. ** void
  488. **
  489. ** SIDE EFFECTS:
  490. **
  491. ** none
  492. **
  493. **--
  494. **/
  495. void sar_set_object_flags
  496. (yystype *current_frame, unsigned char mask )
  497. {
  498. sym_obj_entry_type * obj_entry;
  499. yystype * object_frame;
  500. /* Search the syntax stack for the object frame. */
  501. object_frame = sem_find_object (current_frame - 1);
  502. obj_entry = (sym_obj_entry_type *) object_frame->value.az_symbol_entry;
  503. /* Set the flags for the object entry. */
  504. obj_entry->obj_header.b_flags |= mask;
  505. /* If this is an exported or private object and it has a name,
  506. ** make an external entry for it.
  507. */
  508. if ((mask & (sym_m_exported | sym_m_private)) &&
  509. (obj_entry->obj_header.az_name != NULL))
  510. {
  511. sym_make_external_def (obj_entry->obj_header.az_name);
  512. }
  513. }
  514. /*
  515. **++
  516. ** FUNCTIONAL DESCRIPTION:
  517. **
  518. ** This routine unsets flags in the stack entry for the object.
  519. **
  520. ** FORMAL PARAMETERS:
  521. **
  522. ** current_frame address of the current syntax stack frame
  523. **
  524. ** mask mask of flags to be unset.
  525. **
  526. ** IMPLICIT INPUTS:
  527. **
  528. ** none
  529. **
  530. ** IMPLICIT OUTPUTS:
  531. **
  532. ** none
  533. **
  534. ** FUNCTION VALUE:
  535. **
  536. ** void
  537. **
  538. ** SIDE EFFECTS:
  539. **
  540. ** none
  541. **
  542. **--
  543. **/
  544. void sar_unset_object_flags
  545. (yystype *current_frame, unsigned char mask )
  546. {
  547. yystype * object_frame;
  548. /* Search the syntax stack for the object frame. */
  549. object_frame = sem_find_object (current_frame - 1);
  550. /* Unset the flags for the object entry. */
  551. object_frame->b_flags &= ~mask;
  552. }
  553. /*
  554. **++
  555. ** FUNCTIONAL DESCRIPTION:
  556. **
  557. ** This routine sets the type in the stack entry for the (list) object.
  558. **
  559. ** FORMAL PARAMETERS:
  560. **
  561. ** current_frame address of the current syntax stack frame
  562. **
  563. ** IMPLICIT INPUTS:
  564. **
  565. ** none
  566. **
  567. ** IMPLICIT OUTPUTS:
  568. **
  569. ** none
  570. **
  571. ** FUNCTION VALUE:
  572. **
  573. ** void
  574. **
  575. ** SIDE EFFECTS:
  576. **
  577. ** none
  578. **
  579. **--
  580. **/
  581. void sar_set_list_type
  582. ( current_frame )
  583. yystype * current_frame;
  584. {
  585. sym_obj_entry_type * obj_entry;
  586. yystype * list_frame;
  587. /* Search the syntax stack for the list frame. */
  588. list_frame = sem_find_object (current_frame-1);
  589. obj_entry = (sym_obj_entry_type *) list_frame->value.az_symbol_entry;
  590. /* Set the type for the list entry. */
  591. obj_entry->header.b_type = current_frame->b_type;
  592. }
  593. /*
  594. **++
  595. ** FUNCTIONAL DESCRIPTION:
  596. **
  597. ** This routine sets the type in the stack entry for the (widget) object.
  598. **
  599. ** FORMAL PARAMETERS:
  600. **
  601. ** current_frame address of the current syntax stack frame
  602. **
  603. ** IMPLICIT INPUTS:
  604. **
  605. ** none
  606. **
  607. ** IMPLICIT OUTPUTS:
  608. **
  609. ** none
  610. **
  611. ** FUNCTION VALUE:
  612. **
  613. ** void
  614. **
  615. ** SIDE EFFECTS:
  616. **
  617. ** none
  618. **
  619. **--
  620. **/
  621. void sar_set_object_class
  622. ( current_frame )
  623. yystype * current_frame;
  624. {
  625. sym_obj_entry_type * obj_entry;
  626. yystype * object_frame;
  627. /* Search the syntax stack for the object frame. */
  628. object_frame = sem_find_object (current_frame-1);
  629. obj_entry = (sym_obj_entry_type *) object_frame->value.az_symbol_entry;
  630. /* Set the type for the object entry. */
  631. obj_entry->header.b_type =
  632. current_frame->value.az_keyword_entry->b_subclass;
  633. /*
  634. ** Indicate in compression table that this object type is used.
  635. ** Note that user defined widgets don't get compression code entires.
  636. ** We always identify user defined widgets as MrmwcUnknown.
  637. */
  638. if ( obj_entry->header.b_type != uil_sym_user_defined_object )
  639. uil_widget_compr[obj_entry->header.b_type] = 1;
  640. }
  641. /*
  642. **++
  643. ** FUNCTIONAL DESCRIPTION:
  644. **
  645. ** This routine sets the variant in the stack entry for the object.
  646. **
  647. ** FORMAL PARAMETERS:
  648. **
  649. ** current_frame address of the current syntax stack frame
  650. **
  651. ** IMPLICIT INPUTS:
  652. **
  653. ** none
  654. **
  655. ** IMPLICIT OUTPUTS:
  656. **
  657. ** none
  658. **
  659. ** FUNCTION VALUE:
  660. **
  661. ** void
  662. **
  663. ** SIDE EFFECTS:
  664. **
  665. ** none
  666. **
  667. **--
  668. **/
  669. void sar_set_object_variant
  670. ( current_frame )
  671. yystype * current_frame;
  672. {
  673. sym_obj_entry_type * obj_entry;
  674. yystype * object_frame;
  675. /* Search the syntax stack for the object frame. */
  676. object_frame = sem_find_object (current_frame - 1);
  677. obj_entry = (sym_obj_entry_type *) object_frame->value.az_symbol_entry;
  678. /* Set the variant for the object entry. */
  679. switch (current_frame->b_type)
  680. {
  681. /* Use the module default for this object type. */
  682. case 0:
  683. {
  684. unsigned int obj_type;
  685. /*
  686. * Pick up gadget variant (or widget variant) as specified
  687. * by the module tables and the gadget variants
  688. */
  689. obj_type = obj_entry->header.b_type;
  690. if (uil_urm_variant[obj_type] == sym_k_gadget_entry)
  691. {
  692. obj_entry->obj_header.b_flags |= sym_m_obj_is_gadget;
  693. obj_entry->header.b_type = uil_gadget_variants [obj_type];
  694. }
  695. break;
  696. }
  697. case sym_k_widget_entry:
  698. break;
  699. case sym_k_gadget_entry:
  700. {
  701. unsigned int obj_type;
  702. /*
  703. * Check if gadgets are supported for this object type.
  704. * If so, change the object type to the matching code for
  705. * the widget class which is the gadget.
  706. */
  707. obj_type = obj_entry->header.b_type;
  708. if (uil_gadget_variants[obj_type] == 0)
  709. {
  710. yystype * source_frame;
  711. source_frame = & yylval;
  712. diag_issue_diagnostic
  713. (d_gadget_not_sup,
  714. _sar_source_position (source_frame ),
  715. diag_object_text(obj_type),
  716. diag_object_text(obj_type) );
  717. }
  718. else
  719. {
  720. obj_entry->obj_header.b_flags |= sym_m_obj_is_gadget;
  721. obj_entry->header.b_type = uil_gadget_variants [obj_type];
  722. }
  723. break;
  724. }
  725. default:
  726. _assert (FALSE, "unexpected variant type");
  727. break;
  728. }
  729. /*
  730. ** If this object is a gadget, mark that gadgets of this type have been
  731. ** used so we can later assign it a compression code. This is a safety
  732. ** set against the actual widget class.
  733. */
  734. if ((obj_entry->obj_header.b_flags & sym_m_obj_is_gadget) != 0)
  735. uil_widget_compr[obj_entry->header.b_type] = 1;
  736. }
  737. /*
  738. **++
  739. ** FUNCTIONAL DESCRIPTION:
  740. **
  741. ** This routine finds the object frame on the parse stack.
  742. **
  743. ** FORMAL PARAMETERS:
  744. **
  745. ** current_frame address of the current parse stack frame.
  746. **
  747. ** IMPLICIT INPUTS:
  748. **
  749. ** none
  750. **
  751. ** IMPLICIT OUTPUTS:
  752. **
  753. ** none
  754. **
  755. ** FUNCTION VALUE:
  756. **
  757. ** address of the parse stack frame for this object.
  758. **
  759. ** SIDE EFFECTS:
  760. **
  761. ** none
  762. **
  763. **--
  764. **/
  765. yystype * sem_find_object ( current_frame )
  766. yystype * current_frame;
  767. {
  768. yystype * object_frame;
  769. object_frame = current_frame;
  770. /* Search the syntax stack for the object frame. */
  771. while ( (object_frame->b_tag != sar_k_object_frame) &&
  772. (object_frame->b_tag != sar_k_module_frame) )
  773. object_frame--;
  774. if (object_frame->b_tag != sar_k_object_frame)
  775. _assert (FALSE, "missing object frame on the parser stack");
  776. return (object_frame);
  777. }
  778. /*
  779. **++
  780. ** FUNCTIONAL DESCRIPTION:
  781. **
  782. ** This routine processes a reference to an object in the
  783. ** UIL. The reference may be a forward reference.
  784. **
  785. ** FORMAL PARAMETERS:
  786. **
  787. ** ref_frame address of the parse stack frame for
  788. ** the object reference.
  789. **
  790. ** IMPLICIT INPUTS:
  791. **
  792. ** none
  793. **
  794. ** IMPLICIT OUTPUTS:
  795. **
  796. ** none
  797. **
  798. ** FUNCTION VALUE:
  799. **
  800. ** none
  801. **
  802. ** SIDE EFFECTS:
  803. **
  804. ** none
  805. **
  806. **--
  807. **/
  808. void sar_object_reference ( ref_frame )
  809. yystype * ref_frame;
  810. {
  811. yystype * obj_frame;
  812. sym_obj_entry_type * obj_entry;
  813. sym_name_entry_type * ref_name;
  814. sym_obj_entry_type * ref_entry;
  815. sym_value_entry_type * ref_value;
  816. boolean invalid_ref;
  817. yystype * source_frame;
  818. source_frame = & yylval;
  819. /* Search the syntax stack for the object frame. */
  820. obj_frame = sem_find_object (ref_frame - 1);
  821. obj_entry = (sym_obj_entry_type *) obj_frame->value.az_symbol_entry;
  822. ref_name = (sym_name_entry_type *) ref_frame->value.az_symbol_entry;
  823. ref_value = (sym_value_entry_type *) ref_name->az_object;
  824. ref_entry = (sym_obj_entry_type *) ref_name->az_object;
  825. /* Check if this name was previously defined for a different usage. */
  826. if (ref_entry != NULL)
  827. {
  828. if ( ref_entry->header.b_tag==sym_k_widget_entry ||
  829. ref_entry->header.b_tag==sym_k_gadget_entry ||
  830. ref_entry->header.b_tag==sym_k_child_entry )
  831. invalid_ref =
  832. (ref_entry->header.b_tag!=obj_entry->header.b_tag) ||
  833. ((ref_entry->header.b_type!=obj_entry->header.b_type) &&
  834. (uil_gadget_variants[ref_entry->header.b_type]!=
  835. obj_entry->header.b_type) &&
  836. (uil_gadget_variants[obj_entry->header.b_type]!=
  837. ref_entry->header.b_type));
  838. else
  839. invalid_ref =
  840. (ref_entry->header.b_tag!=obj_entry->header.b_tag) ||
  841. (ref_entry->header.b_type!=obj_entry->header.b_type);
  842. if ( invalid_ref )
  843. {
  844. char * expected_type, * found_type;
  845. if (ref_entry->header.b_tag == sym_k_list_entry)
  846. found_type = diag_tag_text (ref_entry->header.b_type);
  847. else if (ref_entry->header.b_tag == sym_k_widget_entry)
  848. found_type = diag_object_text (ref_entry->header.b_type);
  849. else if (ref_entry->header.b_tag == sym_k_gadget_entry)
  850. found_type = diag_object_text (ref_entry->header.b_type);
  851. else if (ref_entry->header.b_tag == sym_k_value_entry)
  852. found_type = diag_value_text
  853. (((sym_value_entry_type *) ref_entry)->b_type);
  854. else
  855. found_type = "";
  856. if (obj_entry->header.b_tag == sym_k_list_entry)
  857. expected_type =
  858. diag_tag_text (obj_entry->header.b_type);
  859. else
  860. expected_type =
  861. diag_object_text (obj_entry->header.b_type);
  862. diag_issue_diagnostic
  863. ( d_obj_type,
  864. _sar_source_position ( source_frame ),
  865. found_type,
  866. diag_tag_text (ref_entry->header.b_tag),
  867. expected_type,
  868. diag_tag_text (obj_entry->header.b_tag) );
  869. obj_entry->header.b_tag = sym_k_error_entry;
  870. return;
  871. }
  872. }
  873. switch (obj_entry->header.b_tag)
  874. {
  875. case sym_k_list_entry:
  876. {
  877. /* Add this entry to the list. A copy of the list will be made. */
  878. if ((ref_value != 0) &&
  879. ((ref_value->obj_header.b_flags & sym_m_forward_ref) == 0))
  880. {
  881. ref_frame->value.az_symbol_entry = (sym_entry_type *)ref_entry;
  882. sar_add_list_entry (ref_frame);
  883. }
  884. else
  885. sar_add_forward_list_entry (ref_frame);
  886. break;
  887. }
  888. case sym_k_gadget_entry:
  889. case sym_k_widget_entry:
  890. {
  891. int make_fwd_ref;
  892. /* Mark the widget as referenced. */
  893. ref_name->b_flags |= sym_m_referenced;
  894. /* Mark the referencing object */
  895. obj_entry->obj_header.b_flags |= sym_m_obj_is_reference;
  896. /* Forward references are allowed for widgets or gadgets. */
  897. if (ref_entry == NULL)
  898. make_fwd_ref = TRUE;
  899. else
  900. {
  901. /* A widget can reference itself; treat it as a forward reference. */
  902. if (ref_entry->obj_header.b_flags & sym_m_def_in_progress)
  903. make_fwd_ref = TRUE;
  904. else
  905. make_fwd_ref = FALSE;
  906. }
  907. if (make_fwd_ref)
  908. {
  909. /* Add forward reference entry for this widget. */
  910. sym_make_forward_ref
  911. (ref_frame,
  912. obj_entry->header.b_type,
  913. (char*)& obj_entry->obj_header.az_reference );
  914. }
  915. else
  916. {
  917. /* Save this reference in the widget. */
  918. obj_entry->obj_header.az_reference = (sym_entry_type *)ref_entry;
  919. }
  920. break;
  921. }
  922. default:
  923. {
  924. _assert (FALSE, "unexpected object reference type");
  925. break;
  926. }
  927. }
  928. }
  929. /*
  930. **++
  931. ** FUNCTIONAL DESCRIPTION:
  932. **
  933. ** This routine updates the parent list of every object in the controls
  934. ** list(s) for this object. Parent lists are required in order to check
  935. ** constraint arguments.
  936. **
  937. ** FORMAL PARAMETERS:
  938. **
  939. ** control_list_frame address of the parse stack frame for
  940. ** the control list.
  941. **
  942. ** IMPLICIT INPUTS:
  943. **
  944. ** none
  945. **
  946. ** IMPLICIT OUTPUTS:
  947. **
  948. ** none
  949. **
  950. ** FUNCTION VALUE:
  951. **
  952. ** none
  953. **
  954. ** SIDE EFFECTS:
  955. **
  956. ** none
  957. **
  958. **--
  959. **/
  960. void sar_update_parent_list
  961. ( control_list_frame )
  962. yystype * control_list_frame;
  963. {
  964. yystype * widget_frame;
  965. sym_widget_entry_type * widget_entry;
  966. sym_list_entry_type * control_list_entry;
  967. /* Search the syntax stack for the widget frame. */
  968. widget_frame = sem_find_object (control_list_frame - 1);
  969. widget_entry = (sym_widget_entry_type *)
  970. widget_frame->value.az_symbol_entry;
  971. _assert (widget_entry->header.b_tag == sym_k_widget_entry ||
  972. widget_entry->header.b_tag == sym_k_gadget_entry ||
  973. widget_entry->header.b_tag == sym_k_child_entry,
  974. "widget missing from the stack");
  975. /* Get the control_list entry from the widget */
  976. control_list_entry = (sym_list_entry_type *)
  977. control_list_frame->value.az_symbol_entry;
  978. _assert ((control_list_entry->header.b_tag == sym_k_list_entry ||
  979. control_list_entry->header.b_tag == sym_k_error_entry),
  980. "list entry missing");
  981. /* The control list contains control list entries as well as nested lists,
  982. ** which in turn contain list entries and nested lists.
  983. ** We need to call a recursive routine to traverse all the entries.
  984. */
  985. parent_list_traverse(widget_entry, control_list_entry);
  986. }
  987. /*
  988. **++
  989. ** FUNCTIONAL DESCRIPTION:
  990. **
  991. ** This routine recursively traverses a control_list. Control lists
  992. ** may contain control list entries as well as nested control lists.
  993. **
  994. ** This routine also updates the parent list of every object in the
  995. ** controls list(s) for this object. Parent lists are required in order
  996. ** to check constraint arguments.
  997. **
  998. ** FORMAL PARAMETERS:
  999. **
  1000. ** widget_entry the widget to be entered in lists
  1001. ** control_list_entry A control_list or nested control list
  1002. **
  1003. **
  1004. ** IMPLICIT INPUTS:
  1005. **
  1006. ** none
  1007. **
  1008. ** IMPLICIT OUTPUTS:
  1009. **
  1010. ** none
  1011. **
  1012. ** FUNCTION VALUE:
  1013. **
  1014. ** none
  1015. **
  1016. ** SIDE EFFECTS:
  1017. **
  1018. ** none
  1019. **
  1020. **--
  1021. **/
  1022. void parent_list_traverse (widget_entry, control_list_entry)
  1023. sym_widget_entry_type *widget_entry;
  1024. sym_list_entry_type *control_list_entry;
  1025. {
  1026. sym_obj_entry_type *control_list_member;
  1027. sym_control_entry_type *control_entry;
  1028. sym_nested_list_entry_type *nested_control_list_entry;
  1029. sym_widget_entry_type *control_widget;
  1030. int found;
  1031. sym_forward_ref_entry_type *fwd_ref_entry;
  1032. sym_parent_list_type *parent_node;
  1033. sym_parent_list_type *parent_ptr;
  1034. for (control_list_member = (sym_obj_entry_type *)control_list_entry ->
  1035. obj_header.az_next;
  1036. control_list_member != NULL;
  1037. control_list_member = (sym_obj_entry_type *)control_list_member ->
  1038. obj_header.az_next)
  1039. {
  1040. switch (control_list_member->header.b_tag)
  1041. {
  1042. case sym_k_nested_list_entry:
  1043. nested_control_list_entry = (sym_nested_list_entry_type *)
  1044. control_list_member;
  1045. /* Begin fixing DTS 9497 */
  1046. if(nested_control_list_entry->az_list)
  1047. parent_list_traverse (widget_entry,
  1048. nested_control_list_entry->az_list);
  1049. /* End fixing DTS 9497 */
  1050. break;
  1051. case sym_k_control_entry:
  1052. control_entry = (sym_control_entry_type *) control_list_member;
  1053. /* Get a pointer to one of the actual widgets in the control list */
  1054. control_widget = control_entry->az_con_obj;
  1055. /*
  1056. ** If it's a widget reference, go find it. If you can't find it, it must
  1057. ** be a forward reference. If so, find the forward reference entry for it
  1058. ** and update it with a pointer to its parent.
  1059. */
  1060. if ( control_widget->
  1061. obj_header.b_flags & sym_m_obj_is_reference)
  1062. if ( control_widget->obj_header.az_reference == NULL )
  1063. {
  1064. /* Forward reference. Update forward reference entry. */
  1065. found = FALSE;
  1066. for (fwd_ref_entry = sym_az_forward_ref_chain;
  1067. ((fwd_ref_entry != NULL) && (found == FALSE));
  1068. fwd_ref_entry = fwd_ref_entry->az_next_ref)
  1069. {
  1070. if (fwd_ref_entry->a_update_location ==
  1071. (char *) & control_widget->
  1072. obj_header.az_reference)
  1073. {
  1074. found = TRUE;
  1075. fwd_ref_entry->parent = widget_entry;
  1076. }
  1077. }
  1078. }
  1079. else
  1080. {
  1081. /* A widget reference, but already defined. Go update its entry. */
  1082. control_widget = (sym_widget_entry_type *)
  1083. control_widget->obj_header.az_reference;
  1084. found = FALSE;
  1085. for (parent_ptr = control_widget->parent_list;
  1086. ((parent_ptr != NULL) && (found == FALSE));
  1087. parent_ptr = parent_ptr->next)
  1088. {
  1089. if (parent_ptr->parent == widget_entry)
  1090. found = TRUE;
  1091. }
  1092. if (found == FALSE)
  1093. {
  1094. parent_node = (sym_parent_list_type *)
  1095. sem_allocate_node (sym_k_parent_list_entry,
  1096. sym_k_parent_list_size);
  1097. parent_node->next = control_widget->parent_list;
  1098. control_widget->parent_list = parent_node;
  1099. parent_node->parent = widget_entry;
  1100. }
  1101. }
  1102. else
  1103. {
  1104. /* An inline widget definition. Go update its entry. */
  1105. found = FALSE;
  1106. for (parent_ptr = control_widget->parent_list;
  1107. ((parent_ptr != NULL) && (found == FALSE));
  1108. parent_ptr = parent_ptr->next)
  1109. {
  1110. if (parent_ptr->parent == widget_entry)
  1111. found = TRUE;
  1112. }
  1113. if (found == FALSE)
  1114. {
  1115. parent_node = (sym_parent_list_type *)
  1116. sem_allocate_node (sym_k_parent_list_entry,
  1117. sym_k_parent_list_size);
  1118. parent_node->next = control_widget->parent_list;
  1119. control_widget->parent_list = parent_node;
  1120. parent_node->parent = widget_entry;
  1121. }
  1122. }
  1123. }
  1124. }
  1125. }
  1126. /*
  1127. **++
  1128. ** FUNCTIONAL DESCRIPTION:
  1129. **
  1130. ** This routine saves a widget feature in the widget symbol node.
  1131. **
  1132. ** FORMAL PARAMETERS:
  1133. **
  1134. ** feature_frame address of the parse stack frame for
  1135. ** the widget feature.
  1136. **
  1137. ** IMPLICIT INPUTS:
  1138. **
  1139. ** none
  1140. **
  1141. ** IMPLICIT OUTPUTS:
  1142. **
  1143. ** none
  1144. **
  1145. ** FUNCTION VALUE:
  1146. **
  1147. ** none
  1148. **
  1149. ** SIDE EFFECTS:
  1150. **
  1151. ** none
  1152. **
  1153. **--
  1154. **/
  1155. void sar_save_feature
  1156. ( feature_frame )
  1157. yystype * feature_frame;
  1158. {
  1159. yystype * widget_frame;
  1160. sym_widget_entry_type * widget_entry;
  1161. sym_entry_type * feature_entry;
  1162. sym_entry_type * * ptr;
  1163. yystype * source_frame;
  1164. source_frame = & yylval;
  1165. /* Search the syntax stack for the widget frame. */
  1166. widget_frame = sem_find_object (feature_frame - 1);
  1167. widget_entry = (sym_widget_entry_type *)
  1168. widget_frame->value.az_symbol_entry;
  1169. _assert (widget_entry->header.b_tag == sym_k_widget_entry ||
  1170. widget_entry->header.b_tag == sym_k_gadget_entry ||
  1171. widget_entry->header.b_tag == sym_k_child_entry,
  1172. "widget missing from the stack");
  1173. feature_entry = feature_frame->value.az_symbol_entry;
  1174. _assert ((feature_entry->header.b_tag == sym_k_list_entry ||
  1175. feature_entry->header.b_tag == sym_k_error_entry),
  1176. "list entry missing");
  1177. switch (feature_entry->header.b_type)
  1178. {
  1179. case sym_k_argument_entry:
  1180. ptr = (sym_entry_type * *) & widget_entry->az_arguments;
  1181. break;
  1182. case sym_k_control_entry:
  1183. ptr = (sym_entry_type * *) & widget_entry->az_controls;
  1184. break;
  1185. case sym_k_callback_entry:
  1186. ptr = (sym_entry_type * *) & widget_entry->az_callbacks;
  1187. break;
  1188. case sym_k_error_entry:
  1189. return;
  1190. default:
  1191. _assert (FALSE, "unexpected widget feature");
  1192. break;
  1193. }
  1194. /* Check for duplicate features. */
  1195. if (* ptr != NULL)
  1196. {
  1197. diag_issue_diagnostic
  1198. ( d_dup_list,
  1199. _sar_source_position ( source_frame ),
  1200. diag_tag_text (feature_entry->header.b_type),
  1201. diag_tag_text (feature_entry->header.b_tag),
  1202. diag_object_text (widget_entry->header.b_type),
  1203. diag_tag_text (widget_entry->header.b_tag) );
  1204. return;
  1205. }
  1206. /* Save the feature in the widget. */
  1207. (* ptr) = feature_entry;
  1208. /* Clear the feature frame from the stack. */
  1209. feature_frame->b_tag = sar_k_null_frame;
  1210. }
  1211. /*
  1212. **++
  1213. ** FUNCTIONAL DESCRIPTION:
  1214. **
  1215. ** This routine processes an argument pair for an object.
  1216. **
  1217. ** FORMAL PARAMETERS:
  1218. **
  1219. ** argument_frame address of the parse stack frame for
  1220. ** the argument reference.
  1221. **
  1222. ** value_frame address of the parse stack frame for
  1223. ** the argument value.
  1224. **
  1225. ** equals_frame address of the parse stack frame for the
  1226. ** equals sign.
  1227. **
  1228. ** IMPLICIT INPUTS:
  1229. **
  1230. ** none
  1231. **
  1232. ** IMPLICIT OUTPUTS:
  1233. **
  1234. ** none
  1235. **
  1236. ** FUNCTION VALUE:
  1237. **
  1238. ** none
  1239. **
  1240. ** SIDE EFFECTS:
  1241. **
  1242. ** none
  1243. **
  1244. **--
  1245. **/
  1246. void sar_save_argument_pair
  1247. ( argument_frame, value_frame, equals_frame)
  1248. yystype * argument_frame;
  1249. yystype * value_frame;
  1250. yystype * equals_frame;
  1251. {
  1252. yystype * object_frame;
  1253. sym_argument_entry_type * arg_entry;
  1254. sym_list_entry_type * list_entry;
  1255. sym_value_entry_type * val_value_entry;
  1256. sym_value_entry_type * arg_value_entry;
  1257. unsigned char actual_tag;
  1258. yystype * source_frame;
  1259. source_frame = & yylval;
  1260. /* Search the syntax stack for the object frame. */
  1261. object_frame = sem_find_object (argument_frame - 1);
  1262. list_entry = (sym_list_entry_type *)
  1263. object_frame->value.az_symbol_entry;
  1264. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1265. "list entry missing");
  1266. arg_value_entry =
  1267. (sym_value_entry_type *) argument_frame->value.az_symbol_entry;
  1268. _assert (arg_value_entry->header.b_tag == sym_k_value_entry,
  1269. "argument value entry missing");
  1270. /*
  1271. ** Save the source information (?)
  1272. */
  1273. _sar_save_source_info ( &arg_value_entry->header , argument_frame ,
  1274. argument_frame );
  1275. val_value_entry = (sym_value_entry_type *) value_frame->value.az_symbol_entry;
  1276. actual_tag = val_value_entry->header.b_tag;
  1277. /* Create and fill in the argument node. */
  1278. arg_entry = (sym_argument_entry_type *) sem_allocate_node (
  1279. sym_k_argument_entry, sym_k_argument_entry_size);
  1280. /*
  1281. ** If the argument is a forward reference, we'll patch in the
  1282. ** address of the the referenced arg between passes. Otherwise,
  1283. ** just point to the referenced arg node.
  1284. */
  1285. if ((argument_frame->b_flags & sym_m_forward_ref) != 0)
  1286. sym_make_value_forward_ref (argument_frame,
  1287. (char*)&(arg_entry->az_arg_name), sym_k_patch_add);
  1288. else
  1289. arg_entry->az_arg_name =
  1290. (sym_value_entry_type *) argument_frame->value.az_symbol_entry;
  1291. /*
  1292. ** If the argument value is a forward reference, we'll patch in the
  1293. ** address of the the referenced arg value between passes. Otherwise,
  1294. ** just point to the referenced arg value node.
  1295. */
  1296. if ((value_frame->b_flags & sym_m_forward_ref) != 0)
  1297. sym_make_value_forward_ref (value_frame,
  1298. (char*)&(arg_entry->az_arg_value), sym_k_patch_add);
  1299. else
  1300. arg_entry->az_arg_value = val_value_entry;
  1301. argument_frame->b_tag = sar_k_null_frame;
  1302. argument_frame->value.az_symbol_entry = (sym_entry_type *) arg_entry;
  1303. }
  1304. /*
  1305. **++
  1306. ** FUNCTIONAL DESCRIPTION:
  1307. **
  1308. ** This routine processes a reason to procedure or procedure list binding
  1309. ** for a callback object in UIL.
  1310. **
  1311. ** FORMAL PARAMETERS:
  1312. **
  1313. ** reason_frame address of the parse stack frame for
  1314. ** the reason reference.
  1315. **
  1316. ** proc_ref_frame address of the parse stack frame for
  1317. ** the procedure reference.
  1318. **
  1319. ** equals_frame address if the parse stack frame for
  1320. ** the equals sign.
  1321. **
  1322. ** IMPLICIT INPUTS:
  1323. **
  1324. ** none
  1325. **
  1326. ** IMPLICIT OUTPUTS:
  1327. **
  1328. ** none
  1329. **
  1330. ** FUNCTION VALUE:
  1331. **
  1332. ** none
  1333. **
  1334. ** SIDE EFFECTS:
  1335. **
  1336. ** none
  1337. **
  1338. **--
  1339. **/
  1340. void sar_save_reason_binding
  1341. ( reason_frame, proc_ref_frame, equals_frame )
  1342. yystype * reason_frame;
  1343. yystype * proc_ref_frame;
  1344. yystype * equals_frame;
  1345. {
  1346. yystype * object_frame;
  1347. sym_callback_entry_type * callback_entry;
  1348. sym_list_entry_type * list_entry;
  1349. yystype * source_frame;
  1350. source_frame = & yylval;
  1351. /* Search the syntax stack for the object frame. */
  1352. object_frame = sem_find_object (reason_frame - 1);
  1353. list_entry = (sym_list_entry_type *) object_frame->value.az_symbol_entry;
  1354. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1355. "list entry missing");
  1356. /*
  1357. ** Create and fill in the callback node.
  1358. */
  1359. callback_entry = (sym_callback_entry_type *) sem_allocate_node (
  1360. sym_k_callback_entry, sym_k_callback_entry_size);
  1361. /*
  1362. ** If the reason is a forward reference, we'll patch in the
  1363. ** address of the the referenced reason between passes. Otherwise,
  1364. ** just point to the referenced reason node.
  1365. */
  1366. if ((reason_frame->b_flags & sym_m_forward_ref) != 0)
  1367. sym_make_value_forward_ref (reason_frame,
  1368. (char*)&(callback_entry->az_call_reason_name), sym_k_patch_add);
  1369. else
  1370. callback_entry->az_call_reason_name =
  1371. (sym_value_entry_type *) reason_frame->value.az_symbol_entry;
  1372. /*
  1373. ** Save source information
  1374. */
  1375. /* _sar_save_source_info ( &reason_value_entry->header , reason_frame ,
  1376. ** reason_frame );
  1377. */
  1378. /*
  1379. ** Note that proc_ref_frame may point to either a procedure reference
  1380. ** or to a list of procedure reference nodes
  1381. */
  1382. if ( proc_ref_frame->b_type == sym_k_list_entry)
  1383. callback_entry->az_call_proc_ref_list =
  1384. (sym_list_entry_type *) proc_ref_frame->value.az_symbol_entry;
  1385. else
  1386. callback_entry->az_call_proc_ref =
  1387. (sym_proc_ref_entry_type *) proc_ref_frame->value.az_symbol_entry;
  1388. reason_frame->b_tag = sar_k_null_frame;
  1389. reason_frame->value.az_symbol_entry = (sym_entry_type *) callback_entry;
  1390. }
  1391. /*
  1392. **++
  1393. ** FUNCTIONAL DESCRIPTION:
  1394. **
  1395. ** This routine processes a control clause.
  1396. **
  1397. ** FORMAL PARAMETERS:
  1398. **
  1399. ** managed_frame address of the parse stack frame for
  1400. ** the managed flag for this control.
  1401. **
  1402. ** item_frame address of the parse stack frame for
  1403. ** the control item object.
  1404. **
  1405. ** IMPLICIT INPUTS:
  1406. **
  1407. ** none
  1408. **
  1409. ** IMPLICIT OUTPUTS:
  1410. **
  1411. ** none
  1412. **
  1413. ** FUNCTION VALUE:
  1414. **
  1415. ** none
  1416. **
  1417. ** SIDE EFFECTS:
  1418. **
  1419. ** none
  1420. **
  1421. **--
  1422. **/
  1423. void sar_save_control_item
  1424. ( managed_frame, item_frame )
  1425. yystype * managed_frame;
  1426. yystype * item_frame;
  1427. {
  1428. yystype * object_frame;
  1429. sym_control_entry_type * control_entry;
  1430. sym_list_entry_type * list_entry;
  1431. yystype * source_frame;
  1432. source_frame = & yylval;
  1433. /* Search the syntax stack for the object frame. */
  1434. object_frame = sem_find_object (managed_frame - 1);
  1435. list_entry =
  1436. (sym_list_entry_type *) object_frame->value.az_symbol_entry;
  1437. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1438. "list entry missing");
  1439. /* Verify that this type of item is allowed on this list. */
  1440. if (list_entry->header.b_type != sym_k_control_entry)
  1441. {
  1442. diag_issue_diagnostic
  1443. ( d_list_item,
  1444. _sar_source_position ( source_frame ),
  1445. diag_tag_text (sym_k_control_entry),
  1446. diag_tag_text (list_entry->header.b_type),
  1447. diag_tag_text (list_entry->header.b_tag) );
  1448. return;
  1449. }
  1450. /* Create and fill in the control node. */
  1451. control_entry = (sym_control_entry_type *) sem_allocate_node (
  1452. sym_k_control_entry, sym_k_control_entry_size);
  1453. control_entry->az_con_obj =
  1454. (sym_widget_entry_type *) item_frame->value.az_symbol_entry;
  1455. control_entry->obj_header.b_flags = ( item_frame->b_flags |
  1456. managed_frame->b_flags );
  1457. managed_frame->b_tag =
  1458. item_frame->b_tag = sar_k_null_frame;
  1459. managed_frame->value.az_symbol_entry = (sym_entry_type *) control_entry;
  1460. }
  1461. /*
  1462. **++
  1463. ** FUNCTIONAL DESCRIPTION:
  1464. **
  1465. ** This routine processes a control clause when an id is created in that
  1466. ** clause.
  1467. **
  1468. ** FORMAL PARAMETERS:
  1469. **
  1470. ** control_frame address of the parse stack frame for
  1471. ** the control list.
  1472. **
  1473. ** item_frame address of the parse stack frame for
  1474. ** the control item id.
  1475. **
  1476. ** IMPLICIT INPUTS:
  1477. **
  1478. ** none
  1479. **
  1480. ** IMPLICIT OUTPUTS:
  1481. **
  1482. ** none
  1483. **
  1484. ** FUNCTION VALUE:
  1485. **
  1486. ** none
  1487. **
  1488. ** SIDE EFFECTS:
  1489. **
  1490. ** none
  1491. **
  1492. **--
  1493. **/
  1494. void sar_save_control_widget
  1495. ( control_frame, item_frame )
  1496. yystype * control_frame;
  1497. yystype * item_frame;
  1498. {
  1499. yystype * object_frame;
  1500. sym_control_entry_type * control_entry;
  1501. sym_list_entry_type * list_entry;
  1502. yystype * source_frame;
  1503. yystype temp_frame;
  1504. /*
  1505. ** move the item_frame to the control_frame and
  1506. ** the control_frame to the null_frame. This is done
  1507. ** because the item_frame needs to be second in the list
  1508. */
  1509. temp_frame = *item_frame;
  1510. *item_frame = *control_frame;
  1511. *control_frame = temp_frame;
  1512. source_frame = & yylval;
  1513. /* Search the syntax stack for the object frame. */
  1514. object_frame = sem_find_object (control_frame - 1);
  1515. list_entry =
  1516. (sym_list_entry_type *) object_frame->value.az_symbol_entry;
  1517. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1518. "list entry missing");
  1519. /* Verify that this type of item is allowed on this list. */
  1520. if (list_entry->header.b_type != sym_k_control_entry)
  1521. {
  1522. diag_issue_diagnostic
  1523. ( d_list_item,
  1524. _sar_source_position ( source_frame ),
  1525. diag_tag_text (sym_k_control_entry),
  1526. diag_tag_text (list_entry->header.b_type),
  1527. diag_tag_text (list_entry->header.b_tag) );
  1528. return;
  1529. }
  1530. /* Create and fill in the control node. */
  1531. control_entry = (sym_control_entry_type *) sem_allocate_node
  1532. (sym_k_control_entry, sym_k_control_entry_size);
  1533. control_entry->az_con_obj =
  1534. (sym_widget_entry_type *) item_frame->value.az_symbol_entry;
  1535. control_entry->obj_header.b_flags = item_frame->b_flags;
  1536. control_frame->b_tag =
  1537. item_frame->b_tag = sar_k_null_frame;
  1538. control_frame->value.az_symbol_entry = (sym_entry_type *) control_entry;
  1539. }
  1540. /*
  1541. **++
  1542. ** FUNCTIONAL DESCRIPTION:
  1543. **
  1544. ** This routine saves the source for a user defined create procedure
  1545. **
  1546. ** FORMAL PARAMETERS:
  1547. **
  1548. ** procedure_frame address of the parse stack frame for
  1549. ** the text "PROCEDURE".
  1550. **
  1551. ** proc_id_frame address of the parse stack frame for
  1552. ** the procedure reference.
  1553. **
  1554. ** proc_arg_frame address of the parse stack frame for
  1555. ** the procedure argument value.
  1556. **
  1557. ** IMPLICIT INPUTS:
  1558. **
  1559. ** none
  1560. **
  1561. ** IMPLICIT OUTPUTS:
  1562. **
  1563. ** none
  1564. **
  1565. ** FUNCTION VALUE:
  1566. **
  1567. ** none
  1568. **
  1569. ** SIDE EFFECTS:
  1570. **
  1571. ** none
  1572. **
  1573. **--
  1574. **/
  1575. void sar_save_user_proc_ref_src
  1576. ( procedure_frame, proc_id_frame, proc_arg_frame)
  1577. yystype * procedure_frame;
  1578. yystype * proc_id_frame;
  1579. yystype * proc_arg_frame;
  1580. {
  1581. sym_proc_ref_entry_type * proc_ref_entry;
  1582. proc_ref_entry = (sym_proc_ref_entry_type *)proc_id_frame->value.az_symbol_entry;
  1583. /*
  1584. ** If the parameter arg clause was ommitted the source info should be null.
  1585. ** We want to save the source for the "args" if it is there.
  1586. */
  1587. _sar_save_source_info (& proc_ref_entry->header, procedure_frame, proc_arg_frame );
  1588. }
  1589. /*
  1590. **++
  1591. ** FUNCTIONAL DESCRIPTION:
  1592. **
  1593. ** This routine processes a procedure reference.
  1594. **
  1595. ** FORMAL PARAMETERS:
  1596. **
  1597. ** proc_id_frame address of the parse stack frame for
  1598. ** the procedure reference.
  1599. **
  1600. ** proc_arg_frame address of the parse stack frame for
  1601. ** the procedure argument value.
  1602. **
  1603. ** context indicates whether this is a callback
  1604. ** or a user-defined procedure reference.
  1605. **
  1606. ** IMPLICIT INPUTS:
  1607. **
  1608. ** none
  1609. **
  1610. ** IMPLICIT OUTPUTS:
  1611. **
  1612. ** none
  1613. **
  1614. ** FUNCTION VALUE:
  1615. **
  1616. ** none
  1617. **
  1618. ** SIDE EFFECTS:
  1619. **
  1620. ** none
  1621. **
  1622. **--
  1623. **/
  1624. void sar_process_proc_ref
  1625. ( proc_id_frame, proc_arg_frame, context )
  1626. yystype * proc_id_frame;
  1627. yystype * proc_arg_frame;
  1628. int context;
  1629. {
  1630. /* Call the common routine to get the procedure reference node, and
  1631. return it in the stack frame. */
  1632. proc_id_frame->value.az_symbol_entry = (sym_entry_type *)
  1633. sem_reference_procedure (
  1634. proc_id_frame, proc_arg_frame,
  1635. context );
  1636. /* If this is the create proc for a user_defined widget, save it
  1637. in the object node. */
  1638. if (context == sym_k_object_proc)
  1639. {
  1640. yystype * widget_frame;
  1641. sym_widget_entry_type * widget_entry;
  1642. /* Search the syntax stack for the widget frame. NOTE: gadgets can
  1643. not have creation procedures; the grammar enforces this. */
  1644. widget_frame = sem_find_object (proc_id_frame - 1);
  1645. widget_entry =
  1646. (sym_widget_entry_type *) widget_frame->value.az_symbol_entry;
  1647. _assert (widget_entry->header.b_tag == sym_k_widget_entry,
  1648. "widget missing from the stack");
  1649. if (widget_entry->header.b_type != uil_sym_user_defined_object)
  1650. {
  1651. yystype * source_frame;
  1652. source_frame = & yylval;
  1653. diag_issue_diagnostic
  1654. (d_create_proc,
  1655. _sar_source_position ( source_frame ),
  1656. diag_object_text (widget_entry->header.b_type) );
  1657. return;
  1658. }
  1659. else
  1660. {
  1661. widget_entry->az_create_proc =
  1662. (sym_proc_ref_entry_type *) proc_id_frame->value.az_symbol_entry;
  1663. }
  1664. }
  1665. return;
  1666. }
  1667. /*
  1668. **++
  1669. ** FUNCTIONAL DESCRIPTION:
  1670. **
  1671. ** This routine adds an entry to a list.
  1672. **
  1673. ** FORMAL PARAMETERS:
  1674. **
  1675. ** entry_frame address of the parse stack frame for
  1676. ** the entry to be added to the list.
  1677. **
  1678. ** IMPLICIT INPUTS:
  1679. **
  1680. ** none
  1681. **
  1682. ** IMPLICIT OUTPUTS:
  1683. **
  1684. ** none
  1685. **
  1686. ** FUNCTION VALUE:
  1687. **
  1688. ** none
  1689. **
  1690. ** SIDE EFFECTS:
  1691. **
  1692. ** none
  1693. **
  1694. **--
  1695. **/
  1696. void sar_add_list_entry
  1697. ( entry_frame )
  1698. yystype * entry_frame;
  1699. {
  1700. yystype * list_frame;
  1701. sym_list_entry_type * list_entry;
  1702. sym_obj_entry_type * entry_entry;
  1703. yystype * source_frame;
  1704. source_frame = & yylval;
  1705. /* Search the syntax stack for the list frame. */
  1706. list_frame = sem_find_object (entry_frame - 1);
  1707. list_entry = (sym_list_entry_type *) list_frame->value.az_symbol_entry;
  1708. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1709. "list entry missing");
  1710. entry_entry = (sym_obj_entry_type *) entry_frame->value.az_symbol_entry;
  1711. /*
  1712. ** If we are including a list within a list, put a nested list entry
  1713. ** in the list, and point it to the actual list.
  1714. */
  1715. if (entry_entry->header.b_tag == sym_k_list_entry)
  1716. {
  1717. sym_nested_list_entry_type *nested_entry;
  1718. /*
  1719. ** If this list is a reference to a previously defined list,
  1720. ** then use the previously defined list.
  1721. */
  1722. if (entry_entry->obj_header.az_reference != NULL)
  1723. {
  1724. entry_entry = (sym_obj_entry_type *)
  1725. entry_entry->obj_header.az_reference;
  1726. _assert (entry_entry->header.b_tag == sym_k_list_entry,
  1727. "entry list entry missing");
  1728. }
  1729. /*
  1730. ** Create a nested list entry to reference the nested list. This
  1731. ** becomes the entry which will be added to the current list.
  1732. */
  1733. nested_entry = (sym_nested_list_entry_type *)
  1734. sem_allocate_node (sym_k_nested_list_entry,
  1735. sym_k_nested_list_entry_size);
  1736. nested_entry->header.b_type = entry_entry->header.b_type;
  1737. nested_entry->az_list = (sym_list_entry_type *) entry_entry;
  1738. entry_entry = (sym_obj_entry_type *) nested_entry;
  1739. }
  1740. else
  1741. if (entry_entry->header.b_tag == sym_k_name_entry)
  1742. {
  1743. sym_nested_list_entry_type *nested_entry;
  1744. /*
  1745. ** This is a forward reference to a named, nested list.
  1746. */
  1747. nested_entry = (sym_nested_list_entry_type *)
  1748. sem_allocate_node (sym_k_nested_list_entry,
  1749. sym_k_nested_list_entry_size);
  1750. sym_make_value_forward_ref (entry_frame,
  1751. (char*)&(nested_entry->az_list),
  1752. sym_k_patch_list_add);
  1753. entry_entry = (sym_obj_entry_type *) nested_entry;
  1754. }
  1755. /*
  1756. ** Add the entry to front of the list
  1757. ** The nested entry created above is included in this processing.
  1758. */
  1759. entry_entry->obj_header.az_next =
  1760. (sym_entry_type *) list_entry->obj_header.az_next;
  1761. list_entry->obj_header.az_next =
  1762. (sym_entry_type *) entry_entry;
  1763. list_entry->w_count++;
  1764. entry_frame->b_tag = sar_k_null_frame;
  1765. }
  1766. /*
  1767. **++
  1768. ** FUNCTIONAL DESCRIPTION:
  1769. **
  1770. ** This routine adds a forward referenced list entry to a list.
  1771. **
  1772. **
  1773. ** FORMAL PARAMETERS:
  1774. **
  1775. ** entry_frame address of the parse stack frame for
  1776. ** the entry to be added to the list.
  1777. **
  1778. ** IMPLICIT INPUTS:
  1779. **
  1780. ** none
  1781. **
  1782. ** IMPLICIT OUTPUTS:
  1783. **
  1784. ** none
  1785. **
  1786. ** FUNCTION VALUE:
  1787. **
  1788. ** none
  1789. **
  1790. ** SIDE EFFECTS:
  1791. **
  1792. ** none
  1793. **
  1794. **--
  1795. **/
  1796. void sar_add_forward_list_entry
  1797. ( entry_frame )
  1798. yystype * entry_frame;
  1799. {
  1800. yystype * list_frame;
  1801. sym_list_entry_type * list_entry;
  1802. sym_obj_entry_type * entry_entry;
  1803. sym_name_entry_type * name_entry;
  1804. yystype * source_frame;
  1805. sym_nested_list_entry_type *nested_entry;
  1806. source_frame = & yylval;
  1807. /* Search the syntax stack for the list frame. */
  1808. list_frame = sem_find_object (entry_frame - 1);
  1809. list_entry = (sym_list_entry_type *) list_frame->value.az_symbol_entry;
  1810. _assert (list_entry->header.b_tag == sym_k_list_entry,
  1811. "list entry missing");
  1812. name_entry = (sym_name_entry_type *) entry_frame->value.az_symbol_entry;
  1813. nested_entry = (sym_nested_list_entry_type *)
  1814. sem_allocate_node (sym_k_nested_list_entry,
  1815. sym_k_nested_list_entry_size);
  1816. sym_make_value_forward_ref (entry_frame,
  1817. (char*)&(nested_entry->az_list),
  1818. sym_k_patch_list_add);
  1819. entry_entry = (sym_obj_entry_type *) nested_entry;
  1820. /*
  1821. ** Add the entry to front of the list
  1822. ** The nested entry created above is included in this processing.
  1823. */
  1824. entry_entry->obj_header.az_next =
  1825. (sym_entry_type *) list_entry->obj_header.az_next;
  1826. list_entry->obj_header.az_next =
  1827. (sym_entry_type *) entry_entry;
  1828. list_entry->w_count++;
  1829. entry_frame->b_tag = sar_k_null_frame;
  1830. }
  1831. /*
  1832. **++
  1833. ** FUNCTIONAL DESCRIPTION:
  1834. **
  1835. ** This routine verifies that the list or widget has been defined
  1836. ** correctly. Virtually all such validation is actually done in pass 2.
  1837. **
  1838. ** FORMAL PARAMETERS:
  1839. **
  1840. ** current_frame address of the current syntax stack frame
  1841. **
  1842. ** IMPLICIT INPUTS:
  1843. **
  1844. ** none
  1845. **
  1846. ** IMPLICIT OUTPUTS:
  1847. **
  1848. ** none
  1849. **
  1850. ** FUNCTION VALUE:
  1851. **
  1852. ** void
  1853. **
  1854. ** SIDE EFFECTS:
  1855. **
  1856. ** none
  1857. **
  1858. **--
  1859. **/
  1860. void sar_verify_object ( current_frame )
  1861. yystype * current_frame;
  1862. {
  1863. yystype * obj_frame;
  1864. sym_widget_entry_type * widget_entry;
  1865. unsigned int widget_type;
  1866. sym_obj_entry_type * obj_entry;
  1867. yystype * source_frame;
  1868. /*
  1869. * Search the syntax stack for the object frame.
  1870. */
  1871. source_frame = & yylval;
  1872. obj_frame = sem_find_object (current_frame - 1);
  1873. obj_entry = (sym_obj_entry_type *) obj_frame->value.az_symbol_entry;
  1874. switch (obj_entry->header.b_tag)
  1875. {
  1876. case sym_k_gadget_entry:
  1877. case sym_k_widget_entry:
  1878. /*
  1879. * Clear the definition in progress bit.
  1880. */
  1881. _assert (obj_entry->obj_header.b_flags & sym_m_def_in_progress,
  1882. "widget definition not in progress");
  1883. obj_entry->obj_header.b_flags &= (~ sym_m_def_in_progress);
  1884. break;
  1885. case sym_k_list_entry:
  1886. /*
  1887. * Clear the definition in progress bit and return.
  1888. */
  1889. _assert (obj_entry->obj_header.b_flags & sym_m_def_in_progress,
  1890. "list definition not in progress");
  1891. obj_entry->obj_header.b_flags &= (~ sym_m_def_in_progress);
  1892. return;
  1893. case sym_k_error_entry:
  1894. return;
  1895. default:
  1896. _assert (FALSE, "list or widget missing from the stack");
  1897. break;
  1898. }
  1899. /*
  1900. * If this is a user_defined widget, be sure the create proc was
  1901. * specified if this is a declaration, and not specified if it
  1902. * is a reference.
  1903. */
  1904. widget_entry = (sym_widget_entry_type *) obj_entry;
  1905. widget_type = widget_entry->header.b_type;
  1906. if (widget_type == uil_sym_user_defined_object)
  1907. {
  1908. if ((widget_entry->obj_header.b_flags & sym_m_obj_is_reference) != 0)
  1909. {
  1910. if (widget_entry->az_create_proc != NULL)
  1911. {
  1912. diag_issue_diagnostic
  1913. (d_create_proc_inv,
  1914. _sar_source_pos2(widget_entry),
  1915. diag_object_text (widget_type) );
  1916. widget_entry->header.b_type = sym_k_error_object;
  1917. }
  1918. }
  1919. else
  1920. {
  1921. if (widget_entry->az_create_proc == NULL)
  1922. {
  1923. diag_issue_diagnostic
  1924. (d_create_proc_req,
  1925. _sar_source_pos2(widget_entry),
  1926. diag_object_text (widget_type) );
  1927. widget_entry->header.b_type = sym_k_error_object;
  1928. }
  1929. }
  1930. }
  1931. }
  1932. /*
  1933. **++
  1934. ** FUNCTIONAL DESCRIPTION:
  1935. **
  1936. ** This routine allocates a symbol node of the specified size
  1937. ** and type.
  1938. **
  1939. ** FORMAL PARAMETERS:
  1940. **
  1941. ** node_tag tag of node to allocate
  1942. ** node_size size of node to allocate
  1943. **
  1944. ** IMPLICIT INPUTS:
  1945. **
  1946. **
  1947. ** IMPLICIT OUTPUTS:
  1948. **
  1949. **
  1950. ** FUNCTION VALUE:
  1951. **
  1952. ** the address of the allocated node
  1953. **
  1954. ** SIDE EFFECTS:
  1955. **
  1956. ** The node is saved in the allocated node list
  1957. **
  1958. **--
  1959. **/
  1960. sym_entry_type * sem_allocate_node
  1961. (unsigned char node_tag, unsigned short node_size )
  1962. {
  1963. sym_entry_type * node_ptr;
  1964. node_ptr = (sym_entry_type *) XtCalloc (1, node_size);
  1965. node_ptr->header.w_node_size = node_size;
  1966. node_ptr->header.b_tag = node_tag;
  1967. UrmPlistAppendPointer (sym_az_allocated_nodes, (XtPointer)node_ptr);
  1968. return node_ptr;
  1969. }
  1970. /*
  1971. **++
  1972. ** FUNCTIONAL DESCRIPTION:
  1973. **
  1974. ** This routine puts a symbol node on the free node list.
  1975. **
  1976. ** FORMAL PARAMETERS:
  1977. **
  1978. ** node_ptr address of node to put on the free list
  1979. **
  1980. ** IMPLICIT INPUTS:
  1981. **
  1982. **
  1983. ** IMPLICIT OUTPUTS:
  1984. **
  1985. **
  1986. ** FUNCTION VALUE:
  1987. **
  1988. ** void
  1989. **
  1990. ** SIDE EFFECTS:
  1991. **
  1992. **--
  1993. **/
  1994. void sem_free_node ( node_ptr )
  1995. sym_entry_type * node_ptr;
  1996. {
  1997. UrmPlistAppendPointer (sym_az_freed_nodes, (XtPointer)node_ptr);
  1998. }