UilLstMac.c 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753
  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: UilLstMac.c /main/15 1997/03/12 15:21:48 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 creating the machine listing.
  49. **
  50. **--
  51. **/
  52. /*
  53. **
  54. ** INCLUDE FILES
  55. **
  56. **/
  57. #include <Mrm/MrmAppl.h>
  58. #include <X11/Xmd.h> /* For 64-bit architecture dependencies */
  59. #ifdef DXM_V11
  60. #include <DXm/DXmHelpB.h>
  61. #endif
  62. #include "UilDefI.h"
  63. /*
  64. **
  65. ** DEFINE and MACRO DEFINITIONS
  66. **
  67. **/
  68. /* Holds offset info for machine code listing. */
  69. typedef struct _off_info {
  70. unsigned short int w_off_type;
  71. unsigned short int w_off_offset;
  72. } off_info_type;
  73. #define k_name_off 0
  74. #define k_class_off 1
  75. #define k_arglist_off 2
  76. #define k_children_off 3
  77. #define k_comment_off 4
  78. #define k_creation_off 5
  79. #define k_callback_off 6
  80. #define k_resource_off 7
  81. #define k_float_off 8
  82. #define k_unknown_off 9
  83. #define k_resource_id_off 10
  84. #define k_child_off 11
  85. #define k_text_entry_off 12
  86. #define k_null_text_entry_off 13
  87. #define k_single_float_off 14 /* single float data type RAP */
  88. #define k_off_stack_size 300
  89. static off_info_type off_info_stack [k_off_stack_size];
  90. static int off_info_cnt = 0;
  91. #define off_stack_empty (off_info_cnt == 0)
  92. #define _Offset(type,base,field) \
  93. ((unsigned int)(base + XtOffsetOf(type, field)))
  94. #if defined(__STDC__)
  95. #define _OffsetArray(type,base,field) \
  96. ((unsigned int)(base + XtOffsetOf(type, field)))
  97. #else
  98. #define _OffsetArray(type,base,field) \
  99. ((unsigned int)(base + XtOffsetOf(type, field[0])))
  100. #endif
  101. #define _Pointer(base,offset) ((char *)(base)+(offset))
  102. #define ASNHEADERLEN 3
  103. #define CSLONGBIT (unsigned char)(0x80)
  104. #define ASNstrlen(a) (ASNHEADERLEN+ \
  105. (((unsigned char)(a)[ASNHEADERLEN]&CSLONGBIT)? \
  106. (((unsigned short)((a)[ASNHEADERLEN+1])<<8) | \
  107. (unsigned short)((a)[ASNHEADERLEN+2]))+3 : \
  108. ((unsigned short)((a)[ASNHEADERLEN]))+1))
  109. /*
  110. **
  111. ** EXTERNAL VARIABLE DECLARATIONS
  112. **
  113. **/
  114. /*
  115. **
  116. ** GLOBAL VARIABLE DECLARATIONS
  117. **
  118. **/
  119. /*
  120. **
  121. ** OWN VARIABLE DECLARATIONS
  122. **
  123. **/
  124. /*
  125. **++
  126. ** FUNCTIONAL DESCRIPTION:
  127. **
  128. ** This function saves the machine code listing information for widgets.
  129. **
  130. ** FORMAL PARAMETERS:
  131. **
  132. ** widget_entry Symbol node for this widget
  133. ** az_context context containing the URM output information.
  134. **
  135. ** IMPLICIT INPUTS:
  136. **
  137. ** none
  138. **
  139. ** IMPLICIT OUTPUTS:
  140. **
  141. ** none
  142. **
  143. ** FUNCTION VALUE:
  144. **
  145. ** void
  146. **
  147. ** SIDE EFFECTS:
  148. **
  149. ** the machine code is saved in the source record structure for
  150. ** the widget.
  151. **
  152. **--
  153. **/
  154. void save_widget_machine_code ( widget_entry, az_context )
  155. sym_widget_entry_type * widget_entry;
  156. URMResourceContext * az_context;
  157. {
  158. RGMWidgetRecordPtr w_rec;
  159. char buffer [132];
  160. unsigned short int w_rec_size;
  161. src_source_record_type * az_src_rec;
  162. #define _WRPointer(w_rec,offset) ((char *)(w_rec)+(offset))
  163. #define _WROffset(field) (_Offset(RGMWidgetRecord,0,field))
  164. az_src_rec = widget_entry->header.az_src_rec;
  165. if (widget_entry->resource_id != 0 ) {
  166. sprintf (buffer, "Resource ID: %08X", widget_entry->resource_id);
  167. src_append_machine_code (
  168. az_src_rec,
  169. 0,
  170. 0, 0,
  171. buffer );
  172. } else if (widget_entry->obj_header.az_name != NULL) {
  173. sprintf (buffer, "Resource index: %s",
  174. widget_entry->obj_header.az_name->c_text);
  175. src_append_machine_code (
  176. az_src_rec,
  177. 0,
  178. 0, 0,
  179. buffer );
  180. }
  181. w_rec = (RGMWidgetRecordPtr) UrmRCBuffer (az_context);
  182. src_append_machine_code (
  183. az_src_rec,
  184. _WROffset (validation),
  185. sizeof (w_rec->validation), (char*)& w_rec->validation,
  186. "widget record" );
  187. sprintf (buffer, "size: %d", w_rec->size);
  188. src_append_machine_code (
  189. az_src_rec,
  190. _WROffset (size),
  191. sizeof (w_rec->size), (char*)& w_rec->size,
  192. buffer );
  193. w_rec_size = w_rec->size;
  194. sprintf (buffer, "access: %s",
  195. access_from_code (w_rec->access) );
  196. src_append_machine_code (
  197. az_src_rec,
  198. _WROffset (access),
  199. sizeof (w_rec->access), (char*)& w_rec->access,
  200. buffer );
  201. sprintf (buffer, "locked: ");
  202. if (w_rec->lock) {
  203. strcat (buffer, "true");
  204. } else {
  205. strcat (buffer, "false");
  206. }
  207. src_append_machine_code (
  208. az_src_rec,
  209. _WROffset (lock),
  210. sizeof (w_rec->lock), (char*)& w_rec->lock,
  211. buffer );
  212. sprintf (buffer, "type: ");
  213. strcat (buffer, class_name_from_code (w_rec->type));
  214. src_append_machine_code (
  215. az_src_rec,
  216. _WROffset (type),
  217. sizeof (w_rec->type), (char*)& w_rec->type,
  218. buffer );
  219. if (w_rec->name_offs == (MrmOffset) 0) {
  220. sprintf (buffer, "no name specified");
  221. } else {
  222. sprintf (buffer, "name: offset %X (hex)",
  223. w_rec->name_offs);
  224. off_put (k_name_off, w_rec->name_offs);
  225. }
  226. src_append_machine_code (
  227. az_src_rec,
  228. _WROffset (name_offs),
  229. sizeof (w_rec->name_offs),
  230. (char*)& w_rec->name_offs,
  231. buffer );
  232. if (w_rec->class_offs == (MrmOffset) 0) {
  233. sprintf (buffer, "class: builtin");
  234. } else {
  235. sprintf (buffer, "class: offset %X (hex)",
  236. w_rec->class_offs);
  237. off_put (k_class_off, w_rec->class_offs);
  238. }
  239. src_append_machine_code (
  240. az_src_rec,
  241. _WROffset (class_offs),
  242. sizeof (w_rec->class_offs),
  243. (char*)& w_rec->class_offs,
  244. buffer );
  245. if (w_rec->arglist_offs == (MrmOffset) 0) {
  246. sprintf (buffer, "no argument list");
  247. } else {
  248. sprintf (buffer, "argument list offset: %X (hex)", w_rec->arglist_offs);
  249. off_put (k_arglist_off, w_rec->arglist_offs);
  250. }
  251. src_append_machine_code (
  252. az_src_rec,
  253. _WROffset (arglist_offs),
  254. sizeof (w_rec->arglist_offs),
  255. (char*)& w_rec->arglist_offs,
  256. buffer );
  257. if (w_rec->children_offs == (MrmOffset) 0) {
  258. sprintf (buffer, "no children");
  259. } else {
  260. sprintf (buffer, "children list offset: %X (hex)",
  261. w_rec->children_offs);
  262. off_put (k_children_off, w_rec->children_offs);
  263. }
  264. src_append_machine_code (
  265. az_src_rec,
  266. _WROffset (children_offs),
  267. sizeof (w_rec->children_offs),
  268. (char*)& w_rec->children_offs,
  269. buffer );
  270. if (w_rec->comment_offs == (MrmOffset) 0) {
  271. sprintf (buffer, "no comment specified");
  272. } else {
  273. sprintf (buffer, "comment: offset %X (hex)",
  274. w_rec->comment_offs);
  275. off_put (k_comment_off, w_rec->comment_offs);
  276. }
  277. src_append_machine_code (
  278. az_src_rec,
  279. _WROffset (comment_offs),
  280. sizeof (w_rec->comment_offs),
  281. (char*)& w_rec->comment_offs,
  282. buffer );
  283. if (w_rec->creation_offs == (MrmOffset) 0) {
  284. sprintf (buffer, "no creation callback");
  285. } else {
  286. sprintf (buffer, "creation callback offset: %X (hex)",
  287. w_rec->creation_offs);
  288. off_put (k_creation_off, w_rec->creation_offs);
  289. }
  290. src_append_machine_code (
  291. az_src_rec,
  292. _WROffset (creation_offs),
  293. sizeof (w_rec->creation_offs),
  294. (char*)& w_rec->creation_offs,
  295. buffer );
  296. unload_stack(( char *) w_rec, w_rec_size, az_src_rec );
  297. }
  298. /*
  299. **++
  300. ** FUNCTIONAL DESCRIPTION:
  301. **
  302. ** This function unloads entries placed on a stack and outputs them
  303. ** into the listing. The routine is used by both widgets and gadgets
  304. ** to output their argument, control, and callback lists.
  305. **
  306. ** FORMAL PARAMETERS:
  307. **
  308. ** rec base of the record being annotated
  309. ** rec_sizr size of the record being annotated
  310. ** az_src_rec address of the source for record being annotated
  311. **
  312. ** IMPLICIT INPUTS:
  313. **
  314. **
  315. ** IMPLICIT OUTPUTS:
  316. **
  317. **
  318. ** SIDE EFFECTS:
  319. **
  320. **
  321. **--
  322. **/
  323. void unload_stack( rec, rec_size, az_src_rec )
  324. char *rec;
  325. int rec_size;
  326. src_source_record_type *az_src_rec;
  327. {
  328. char buffer [132], * ptr;
  329. int child_index;
  330. while ( ! off_stack_empty ) {
  331. unsigned short off_type, off_offset;
  332. off_get (& off_type, & off_offset);
  333. switch (off_type) {
  334. case k_name_off :
  335. case k_class_off :
  336. case k_comment_off : {
  337. ptr = (char *) _Pointer(rec, off_offset);
  338. src_append_machine_code (
  339. az_src_rec, off_offset,
  340. strlen (ptr) + 1, ptr, NULL );
  341. break;
  342. }
  343. case k_unknown_off : {
  344. unsigned short int len;
  345. /* Write out everything up to the next offset or the end of the
  346. record. */
  347. if ( ! off_stack_empty ) {
  348. unsigned short int next_type, next_offset;
  349. off_get (& next_type, & next_offset);
  350. off_put (next_type, next_offset);
  351. len = next_offset - off_offset;
  352. } else {
  353. len = rec_size - off_offset;
  354. }
  355. ptr = (char *) _Pointer(rec, off_offset);
  356. src_append_machine_code (
  357. az_src_rec, off_offset,
  358. len, ptr, NULL );
  359. break;
  360. }
  361. case k_arglist_off : {
  362. RGMArgListDescPtr argdesc;
  363. RGMArgumentPtr arg_ptr;
  364. int j;
  365. argdesc = (RGMArgListDescPtr) _Pointer(rec, off_offset);
  366. sprintf (buffer, "argument count: %d", argdesc->count);
  367. src_append_machine_code (
  368. az_src_rec,
  369. _Offset (RGMArgListDesc, off_offset, count),
  370. sizeof (argdesc->count),
  371. (char*)& argdesc->count,
  372. buffer );
  373. sprintf (buffer, "related argument count: %d", argdesc->extra);
  374. src_append_machine_code (
  375. az_src_rec,
  376. _Offset (RGMArgListDesc, off_offset, extra),
  377. sizeof (argdesc->extra),
  378. (char*)& argdesc->extra,
  379. buffer );
  380. off_offset = _OffsetArray (RGMArgListDesc, off_offset, args);
  381. for (j = 0, arg_ptr = argdesc->args;
  382. j < argdesc->count;
  383. j++, arg_ptr++, off_offset += sizeof (RGMArgument)) {
  384. if (arg_ptr->tag_code != UilMrmUnknownCode )
  385. {
  386. sprintf (buffer,
  387. "(%d) arg type: %s",
  388. j,
  389. resource_name_from_code(arg_ptr->tag_code));
  390. }
  391. else
  392. {
  393. ptr = (char *)
  394. _Pointer(rec,arg_ptr->stg_or_relcode.tag_offs);
  395. sprintf (buffer,
  396. "(%d) arg type: %s (user defined)",
  397. j,
  398. ptr);
  399. }
  400. src_append_machine_code (
  401. az_src_rec,
  402. _Offset (RGMArgument, off_offset, tag_code),
  403. sizeof (arg_ptr->tag_code),
  404. (char*)& arg_ptr->tag_code,
  405. buffer );
  406. if (arg_ptr->stg_or_relcode.tag_offs == (MrmOffset) 0) {
  407. sprintf (buffer, "(%d) no tag offset", j);
  408. } else {
  409. sprintf (buffer, "(%d) tag offset: %X (hex)",
  410. j, arg_ptr->stg_or_relcode.tag_offs);
  411. off_put (k_name_off, arg_ptr->stg_or_relcode.tag_offs);
  412. }
  413. src_append_machine_code (
  414. az_src_rec,
  415. _Offset (RGMArgument, off_offset, stg_or_relcode.tag_offs),
  416. sizeof (arg_ptr->stg_or_relcode.tag_offs),
  417. (char*)& arg_ptr->stg_or_relcode.tag_offs,
  418. buffer );
  419. sprintf (buffer, "(%d) type: %s",
  420. j, type_from_code (arg_ptr->arg_val.rep_type) );
  421. src_append_machine_code (
  422. az_src_rec,
  423. _Offset (RGMArgument, off_offset,
  424. arg_val.rep_type),
  425. sizeof (arg_ptr->arg_val.rep_type),
  426. (char*)& arg_ptr->arg_val.rep_type,
  427. buffer );
  428. sprintf (buffer, "(%d) ", j);
  429. format_arg_value (& arg_ptr->arg_val,
  430. & buffer [strlen (buffer)]);
  431. src_append_machine_code (
  432. az_src_rec,
  433. _Offset (RGMArgument, off_offset,
  434. arg_val.datum),
  435. sizeof (arg_ptr->arg_val.datum),
  436. (char*)& arg_ptr->arg_val.datum,
  437. buffer );
  438. }
  439. break;
  440. }
  441. case k_float_off : {
  442. double * dptr;
  443. dptr = (double *) _Pointer (rec, off_offset);
  444. sprintf (buffer, "floating point value: %g", (* dptr));
  445. src_append_machine_code (
  446. az_src_rec,
  447. off_offset,
  448. sizeof (double), (char*)dptr, buffer );
  449. break;
  450. }
  451. /* single float data type RAP */
  452. case k_single_float_off :
  453. {
  454. float *fptr;
  455. fptr = (float *) _Pointer(rec, off_offset);
  456. sprintf(buffer, "Single float value: %g", (* fptr));
  457. src_append_machine_code (
  458. az_src_rec,
  459. off_offset,
  460. sizeof (float), (char*)fptr, buffer);
  461. break;
  462. }
  463. case k_creation_off :
  464. case k_callback_off : {
  465. RGMCallbackDescPtr cb_desc_ptr;
  466. RGMCallbackItemPtr cb_item_ptr;
  467. int j;
  468. cb_desc_ptr =
  469. (RGMCallbackDescPtr) _Pointer (rec, off_offset);
  470. src_append_machine_code (
  471. az_src_rec,
  472. _Offset (RGMCallbackDesc, off_offset, validation),
  473. sizeof (cb_desc_ptr->validation),
  474. (char*)& cb_desc_ptr->validation,
  475. "callback descriptor" );
  476. sprintf (buffer, "callback count: %d", cb_desc_ptr->count);
  477. src_append_machine_code (
  478. az_src_rec,
  479. _Offset (RGMCallbackDesc, off_offset, count),
  480. sizeof (cb_desc_ptr->count),
  481. (char*)& cb_desc_ptr->count,
  482. buffer );
  483. off_offset =
  484. _OffsetArray (RGMCallbackDesc, off_offset, item);
  485. for (j = 0, cb_item_ptr = cb_desc_ptr->item;
  486. j < cb_desc_ptr->count;
  487. j++, cb_item_ptr++,
  488. off_offset += sizeof (RGMCallbackItem)) {
  489. sprintf (buffer,
  490. "(%d) routine name offset: %X (hex)",
  491. j, cb_item_ptr->cb_item.routine);
  492. src_append_machine_code (
  493. az_src_rec,
  494. _Offset (RGMCallbackItem, off_offset,
  495. cb_item.routine),
  496. #ifndef WORD64
  497. sizeof (cb_item_ptr->cb_item.routine),
  498. (char*)& cb_item_ptr->cb_item.routine,
  499. #else /* 64-bit architecture */
  500. 4,
  501. (char*)& cb_item_ptr->cb_item,
  502. #endif /* WORD64 */
  503. buffer );
  504. off_put (k_name_off, cb_item_ptr->cb_item.routine);
  505. sprintf (buffer, "(%d) routine tag type: %s",
  506. j, type_from_code (
  507. cb_item_ptr->cb_item.rep_type) );
  508. src_append_machine_code
  509. (az_src_rec,
  510. _Offset (RGMCallbackItem, off_offset,
  511. cb_item.rep_type),
  512. #ifndef WORD64
  513. sizeof (cb_item_ptr->cb_item.rep_type),
  514. (char*)& cb_item_ptr->cb_item.rep_type,
  515. #else /* 64-bit architecture */
  516. 4,
  517. (char*)& cb_item_ptr->cb_item + 4,
  518. #endif /* WORD64 */
  519. buffer );
  520. sprintf (buffer, "(%d) value: ", j);
  521. src_append_machine_code
  522. (az_src_rec,
  523. _Offset (RGMCallbackItem, off_offset,
  524. cb_item.datum),
  525. sizeof (cb_item_ptr->cb_item.datum),
  526. (char*)& cb_item_ptr->cb_item.datum,
  527. buffer );
  528. } /* for */
  529. break;
  530. }
  531. case k_resource_off : {
  532. RGMResourceDescPtr r_desc_ptr;
  533. r_desc_ptr =
  534. (RGMResourceDescPtr) _Pointer (rec, off_offset);
  535. sprintf (buffer, "resource descriptor, size: %d",
  536. r_desc_ptr->size);
  537. src_append_machine_code (
  538. az_src_rec,
  539. _Offset (RGMResourceDesc, off_offset, size),
  540. sizeof (r_desc_ptr->size),
  541. (char*)& r_desc_ptr->size,
  542. buffer );
  543. sprintf (buffer, "access: %s",
  544. access_from_code (r_desc_ptr->access) );
  545. src_append_machine_code (
  546. az_src_rec,
  547. _Offset (RGMResourceDesc, off_offset, access),
  548. sizeof (r_desc_ptr->access),
  549. (char*)& r_desc_ptr->access,
  550. buffer );
  551. switch (r_desc_ptr->type) {
  552. case URMrIndex:
  553. sprintf (buffer, "index, offset: %X (hex)",
  554. _Offset (RGMResourceDesc, off_offset, key) );
  555. off_put (k_name_off,
  556. _Offset (RGMResourceDesc, off_offset, key) );
  557. break;
  558. case URMrRID:
  559. sprintf (buffer, "resource ID, offset: %X (hex)",
  560. _Offset (RGMResourceDesc, off_offset, key) );
  561. off_put (k_resource_id_off,
  562. _Offset (RGMResourceDesc, off_offset, key) );
  563. break;
  564. default:
  565. sprintf (buffer, "unknown resource type");
  566. break;
  567. }
  568. src_append_machine_code (
  569. az_src_rec,
  570. _Offset (RGMResourceDesc, off_offset, type),
  571. sizeof (r_desc_ptr->type),
  572. (char*)& r_desc_ptr->type,
  573. buffer );
  574. sprintf (buffer, "resource group: %s",
  575. group_from_code (r_desc_ptr->res_group) );
  576. src_append_machine_code (
  577. az_src_rec,
  578. _Offset (RGMResourceDesc, off_offset, res_group),
  579. sizeof (r_desc_ptr->res_group),
  580. (char*)& r_desc_ptr->res_group,
  581. buffer );
  582. sprintf (buffer, "resource type: %s",
  583. (r_desc_ptr->res_group == URMgLiteral) ?
  584. type_from_code (r_desc_ptr->cvt_type) :
  585. class_name_from_code (r_desc_ptr->cvt_type) );
  586. src_append_machine_code (
  587. az_src_rec,
  588. _Offset (RGMResourceDesc, off_offset, cvt_type),
  589. sizeof (r_desc_ptr->cvt_type),
  590. (char*)& r_desc_ptr->cvt_type,
  591. buffer );
  592. break;
  593. }
  594. case k_resource_id_off : {
  595. sprintf (buffer, "resource id");
  596. src_append_machine_code (
  597. az_src_rec,
  598. off_offset,
  599. sizeof (MrmResource_id),
  600. (char *) _Pointer (rec, off_offset),
  601. buffer );
  602. break;
  603. }
  604. case k_children_off : {
  605. RGMChildrenDescPtr c_desc_ptr;
  606. int j;
  607. c_desc_ptr = (RGMChildrenDescPtr) _Pointer(rec, off_offset);
  608. sprintf (buffer, "Children count: %d",
  609. c_desc_ptr->count);
  610. src_append_machine_code (
  611. az_src_rec,
  612. _Offset (RGMChildrenDesc, off_offset, count),
  613. sizeof (c_desc_ptr->count),
  614. (char*)& c_desc_ptr->count,
  615. buffer );
  616. off_offset =
  617. _OffsetArray (RGMChildrenDesc, off_offset, child);
  618. for (j = 0; j < c_desc_ptr->count;
  619. j++, off_offset += sizeof (RGMChildDesc)) {
  620. off_put (k_child_off, off_offset);
  621. } /* for */
  622. child_index = 0;
  623. break;
  624. }
  625. case k_child_off : {
  626. RGMChildDescPtr c_ptr;
  627. int j;
  628. c_ptr = (RGMChildDescPtr) _Pointer(rec, off_offset);
  629. j = child_index;
  630. child_index++;
  631. if (c_ptr->manage) {
  632. sprintf (buffer, "(%d) managed", j);
  633. } else {
  634. sprintf (buffer, "(%d) unmanaged", j);
  635. }
  636. src_append_machine_code (
  637. az_src_rec,
  638. _Offset (RGMChildDesc, off_offset, manage),
  639. sizeof (c_ptr->manage),
  640. (char*)& c_ptr->manage,
  641. buffer );
  642. sprintf (buffer, "(%d) access: %s", j,
  643. access_from_code (c_ptr->access) );
  644. src_append_machine_code (
  645. az_src_rec,
  646. _Offset (RGMChildDesc, off_offset, access),
  647. sizeof (c_ptr->access),
  648. (char*)& c_ptr->access,
  649. buffer );
  650. switch (c_ptr->type) {
  651. case URMrIndex:
  652. sprintf (buffer, "(%d) index, offset: %X (hex)",
  653. j, c_ptr->key.index_offs);
  654. src_append_machine_code (
  655. az_src_rec,
  656. _Offset (RGMChildDesc, off_offset, type),
  657. sizeof (c_ptr->type) + sizeof (c_ptr->key),
  658. (char*)& c_ptr->type,
  659. buffer );
  660. off_put (k_name_off, c_ptr->key.index_offs);
  661. break;
  662. case URMrRID:
  663. sprintf (buffer,
  664. "(%d) resource ID, offset: %X (hex)",
  665. j, _Offset (RGMChildDesc, off_offset, key) );
  666. src_append_machine_code (
  667. az_src_rec,
  668. _Offset (RGMChildDesc, off_offset, type),
  669. sizeof (c_ptr->type),
  670. (char*)& c_ptr->type,
  671. buffer );
  672. off_put (k_resource_id_off,
  673. _Offset (RGMChildDesc, off_offset, key) );
  674. break;
  675. default:
  676. sprintf (buffer, "(%d) unknown class", j);
  677. src_append_machine_code (
  678. az_src_rec,
  679. _Offset (RGMChildDesc, off_offset, type),
  680. sizeof (c_ptr->type),
  681. (char*)& c_ptr->type,
  682. buffer );
  683. break;
  684. }
  685. break;
  686. }
  687. default : {
  688. break;
  689. }
  690. } /* switch */
  691. } /* for */
  692. src_append_machine_code ( az_src_rec, 0, 0, 0, 0 );
  693. }
  694. /*
  695. **++
  696. ** FUNCTIONAL DESCRIPTION:
  697. **
  698. ** This function saves the machine code listing information for values.
  699. **
  700. ** FORMAL PARAMETERS:
  701. **
  702. ** value_entry Symbol node for this value
  703. ** az_context context containing the URM output information.
  704. **
  705. ** IMPLICIT INPUTS:
  706. **
  707. ** none
  708. **
  709. ** IMPLICIT OUTPUTS:
  710. **
  711. ** none
  712. **
  713. ** FUNCTION VALUE:
  714. **
  715. ** void
  716. **
  717. ** SIDE EFFECTS:
  718. **
  719. ** the machine code is saved in the source record structure for this
  720. ** value.
  721. **
  722. **--
  723. **/
  724. void save_value_machine_code ( value_entry, az_context )
  725. sym_value_entry_type * value_entry;
  726. URMResourceContext * az_context;
  727. {
  728. src_source_record_type * az_src_rec;
  729. char buffer [132], * rc_buffer;
  730. unsigned short int rc_size;
  731. az_src_rec = value_entry->header.az_src_rec;
  732. if (value_entry->resource_id != 0) {
  733. sprintf (buffer, "Resource ID: %08X", value_entry->resource_id);
  734. src_append_machine_code (
  735. az_src_rec,
  736. 0,
  737. 0, 0,
  738. buffer );
  739. } else if (value_entry->obj_header.az_name != NULL) {
  740. sprintf (buffer, "Resource index: %s",
  741. value_entry->obj_header.az_name->c_text);
  742. src_append_machine_code
  743. (az_src_rec,
  744. 0,
  745. 0, 0,
  746. buffer);
  747. }
  748. sprintf (buffer, "size: %d, group: %s",
  749. UrmRCSize (az_context),
  750. group_from_code (UrmRCGroup (az_context)) );
  751. src_append_machine_code ( az_src_rec, 0, 0, 0, buffer );
  752. sprintf (buffer, "type: %s, access: %s, locked: ",
  753. type_from_code (UrmRCType (az_context)),
  754. access_from_code (UrmRCAccess (az_context)) );
  755. if (UrmRCLock (az_context)) {
  756. strcat (buffer, "true");
  757. } else {
  758. strcat (buffer, "false");
  759. }
  760. src_append_machine_code ( az_src_rec, 0, 0, 0, buffer );
  761. rc_buffer = UrmRCBuffer (az_context);
  762. rc_size = UrmRCSize (az_context);
  763. /*
  764. ** Case on the type of literal.
  765. */
  766. switch (value_entry->b_type)
  767. {
  768. case sym_k_bool_value:
  769. if ( * (unsigned long *) rc_buffer )
  770. sprintf (buffer, "value: true");
  771. else
  772. sprintf (buffer, "value: false");
  773. src_append_machine_code (
  774. az_src_rec, 0, rc_size, rc_buffer, buffer );
  775. break;
  776. case sym_k_integer_value:
  777. case sym_k_horizontal_integer_value:
  778. case sym_k_vertical_integer_value:
  779. sprintf (buffer, "value: %d",
  780. (* (unsigned long *) rc_buffer) );
  781. src_append_machine_code (
  782. az_src_rec, 0, rc_size, rc_buffer, buffer );
  783. break;
  784. case sym_k_integer_table_value:
  785. case sym_k_rgb_value: /* rgb data type RAP */
  786. {
  787. int index = 0;
  788. int offset = 0;
  789. for (offset = 0; offset < (int)rc_size; offset += sizeof(int), index++)
  790. {
  791. sprintf (buffer, "value[%d]: %d",
  792. index, ((unsigned long *) rc_buffer)[index] );
  793. src_append_machine_code
  794. (az_src_rec, 0, sizeof(int),
  795. (char*)&(((unsigned long *)rc_buffer)[index]), buffer );
  796. }
  797. break;
  798. }
  799. case sym_k_float_value:
  800. case sym_k_horizontal_float_value:
  801. case sym_k_vertical_float_value:
  802. sprintf (buffer, "value: %g",
  803. (* (double *) rc_buffer) );
  804. src_append_machine_code (
  805. az_src_rec, 0, rc_size, rc_buffer, buffer );
  806. break;
  807. case sym_k_single_float_value:
  808. sprintf (buffer, "value: %g",
  809. (* (float *) rc_buffer));
  810. src_append_machine_code
  811. (az_src_rec, 0, rc_size, rc_buffer, buffer );
  812. break;
  813. case sym_k_char_8_value:
  814. case sym_k_color_value:
  815. case sym_k_color_table_value:
  816. case sym_k_icon_value:
  817. case sym_k_font_value:
  818. case sym_k_fontset_value:
  819. case sym_k_font_table_value:
  820. case sym_k_reason_value:
  821. case sym_k_argument_value:
  822. case sym_k_identifier_value:
  823. case sym_k_compound_string_value:
  824. case sym_k_xbitmapfile_value:
  825. case sym_k_keysym_value:
  826. src_append_machine_code (
  827. az_src_rec,
  828. 0,
  829. rc_size, rc_buffer, 0 );
  830. break;
  831. case sym_k_asciz_table_value:
  832. case sym_k_string_table_value: {
  833. RGMTextVectorPtr tv_ptr;
  834. unsigned short off_type, off_offset, off_cnt;
  835. int i;
  836. off_offset = 0;
  837. tv_ptr = (RGMTextVectorPtr) rc_buffer;
  838. src_append_machine_code (
  839. az_src_rec,
  840. _Offset (RGMTextVector, off_offset, validation),
  841. sizeof (tv_ptr->validation),
  842. (char*)& tv_ptr->validation,
  843. "text vector" );
  844. sprintf (buffer, "count: %d", tv_ptr->count);
  845. src_append_machine_code (
  846. az_src_rec,
  847. _Offset (RGMTextVector, off_offset, count),
  848. sizeof (tv_ptr->count), (char*)& tv_ptr->count,
  849. buffer );
  850. off_offset = _OffsetArray (RGMTextVector, off_offset, item);
  851. for (i = 0; i < tv_ptr->count;
  852. i++, off_offset += sizeof (RGMTextEntry)) {
  853. off_put (k_text_entry_off, off_offset);
  854. }
  855. off_put (k_null_text_entry_off, off_offset);
  856. off_cnt = 0;
  857. while ( ! off_stack_empty ) {
  858. RGMTextEntryPtr te_ptr;
  859. off_get (& off_type, & off_offset);
  860. switch (off_type) {
  861. case k_name_off :
  862. {
  863. char *stringPtr = (char *) _Pointer (rc_buffer,off_offset);
  864. src_append_machine_code (az_src_rec, off_offset,
  865. ASNstrlen( stringPtr ),
  866. stringPtr, NULL );
  867. }
  868. break;
  869. case k_null_text_entry_off :
  870. src_append_machine_code (
  871. az_src_rec, off_offset,
  872. sizeof (RGMTextEntry),
  873. (char*)_Pointer (rc_buffer, off_offset),
  874. "end of text vector" );
  875. break;
  876. case k_text_entry_off :
  877. te_ptr = (RGMTextEntryPtr)
  878. _Pointer (rc_buffer, off_offset);
  879. sprintf (buffer, "(%d) type: %s, offset: %X (hex)",
  880. off_cnt,
  881. type_from_code (te_ptr->text_item.rep_type),
  882. te_ptr->text_item.offset );
  883. src_append_machine_code (
  884. az_src_rec,
  885. _Offset (RGMTextEntry, off_offset,
  886. text_item),
  887. sizeof (te_ptr->text_item),
  888. (char*)& te_ptr->text_item,
  889. buffer );
  890. off_cnt++;
  891. off_put (k_name_off, te_ptr->text_item.offset);
  892. break;
  893. default:
  894. sprintf (buffer, "(%d) unknown text entry", i);
  895. src_append_machine_code (
  896. az_src_rec,
  897. off_offset,
  898. 0, 0, buffer );
  899. break;
  900. }
  901. }
  902. break;
  903. }
  904. case sym_k_trans_table_value:
  905. src_append_machine_code (
  906. az_src_rec, 0, rc_size, rc_buffer, NULL );
  907. break;
  908. default: {
  909. sprintf (buffer, "unknown value");
  910. src_append_machine_code (
  911. az_src_rec,
  912. 0,
  913. 0, 0, buffer );
  914. break;
  915. }
  916. }
  917. src_append_machine_code ( az_src_rec, 0, 0, 0, 0 );
  918. }
  919. /*
  920. **++
  921. ** FUNCTIONAL DESCRIPTION:
  922. **
  923. ** This function saves the machine code listing information for modules.
  924. **
  925. ** FORMAL PARAMETERS:
  926. **
  927. ** az_src_rec Source record for this machine code info.
  928. ** az_context context containing the URM output information.
  929. **
  930. ** IMPLICIT INPUTS:
  931. **
  932. ** none
  933. **
  934. ** IMPLICIT OUTPUTS:
  935. **
  936. ** none
  937. **
  938. ** FUNCTION VALUE:
  939. **
  940. ** void
  941. **
  942. ** SIDE EFFECTS:
  943. **
  944. ** the machine code is saved in the source record structure
  945. **
  946. **--
  947. **/
  948. void save_module_machine_code ( az_src_rec, az_context )
  949. src_source_record_type * az_src_rec;
  950. URMResourceContext * az_context;
  951. {
  952. RGMModuleDescPtr m_rec;
  953. RGMTopmostDescPtr t_rec;
  954. char buffer [132];
  955. unsigned short off_offset;
  956. int i;
  957. off_offset = 0;
  958. m_rec = (RGMModuleDescPtr) UrmRCBuffer (az_context);
  959. src_append_machine_code (
  960. az_src_rec,
  961. _Offset (RGMModuleDesc, off_offset, validation),
  962. sizeof (m_rec->validation), (char*)& m_rec->validation,
  963. "module record" );
  964. sprintf (buffer, "topmost count: %d", m_rec->count);
  965. src_append_machine_code (
  966. az_src_rec,
  967. _Offset (RGMModuleDesc, off_offset, count),
  968. sizeof (m_rec->count), (char*)& m_rec->count,
  969. buffer );
  970. off_offset = _OffsetArray (RGMModuleDesc, off_offset, topmost);
  971. for (i = 0, t_rec = m_rec->topmost;
  972. i < m_rec->count;
  973. i++, t_rec++, off_offset += sizeof (RGMTopmostDesc)) {
  974. sprintf (buffer, "(%d) %s", i, t_rec->index);
  975. src_append_machine_code (
  976. az_src_rec,
  977. _OffsetArray (RGMTopmostDesc, off_offset, index),
  978. strlen(t_rec->index), t_rec->index,
  979. buffer );
  980. } /* for */
  981. src_append_machine_code ( az_src_rec, 0, 0, 0, 0 );
  982. }
  983. /*
  984. **++
  985. ** FUNCTIONAL DESCRIPTION:
  986. **
  987. ** This function adds an offset entry to the offset stack for
  988. ** machine code. The entry is inserted in the proper place in
  989. ** the stack depending on the offset value.
  990. **
  991. ** FORMAL PARAMETERS:
  992. **
  993. ** off_type type of offset entry
  994. ** off_offset offset value for this offset entry
  995. **
  996. ** IMPLICIT INPUTS:
  997. **
  998. ** off_info_cnt number of offset stack entries
  999. ** off_info_stack stack containing offset entries
  1000. **
  1001. ** IMPLICIT OUTPUTS:
  1002. **
  1003. ** off_info_cnt number of offset stack entries
  1004. ** off_info_stack stack containing offset entries
  1005. **
  1006. ** FUNCTION VALUE:
  1007. **
  1008. ** void
  1009. **
  1010. ** SIDE EFFECTS:
  1011. **
  1012. ** the offset info is saved in the offset stack
  1013. **
  1014. **--
  1015. **/
  1016. void off_put
  1017. (unsigned short off_type, unsigned short off_offset)
  1018. {
  1019. off_info_type off_info, * off_info_ptr;
  1020. int i;
  1021. if (off_info_cnt >= k_off_stack_size) {
  1022. diag_issue_internal_error ("stack overflow in machine listing");
  1023. }
  1024. off_info.w_off_type = off_type;
  1025. off_info.w_off_offset = off_offset;
  1026. /* Insert on the stack before the first entry with a lower offset
  1027. value */
  1028. for (i = 0, off_info_ptr = off_info_stack;
  1029. i < off_info_cnt; i++, off_info_ptr++) {
  1030. if (off_info.w_off_offset > off_info_ptr->w_off_offset) {
  1031. break;
  1032. }
  1033. }
  1034. _move ( & off_info_ptr [1], off_info_ptr,
  1035. (off_info_cnt - i) * sizeof (off_info_type) );
  1036. (* off_info_ptr) = off_info;
  1037. off_info_cnt++;
  1038. }
  1039. /*
  1040. **++
  1041. ** FUNCTIONAL DESCRIPTION:
  1042. **
  1043. ** This function removes an offset entry to the offset stack for
  1044. ** machine code.
  1045. **
  1046. ** FORMAL PARAMETERS:
  1047. **
  1048. ** off_type address to receive the type of offset entry
  1049. ** off_offset address to receive the offset value for this
  1050. ** offset entry
  1051. **
  1052. ** IMPLICIT INPUTS:
  1053. **
  1054. ** off_info_cnt number of offset stack entries
  1055. ** off_info_stack stack containing offset entries
  1056. **
  1057. ** IMPLICIT OUTPUTS:
  1058. **
  1059. ** off_info_cnt number of offset stack entries
  1060. ** off_info_stack stack containing offset entries
  1061. **
  1062. ** FUNCTION VALUE:
  1063. **
  1064. ** void
  1065. **
  1066. ** SIDE EFFECTS:
  1067. **
  1068. ** the offset info is retrieved from the offset stack
  1069. **
  1070. **--
  1071. **/
  1072. void off_get (off_type, off_offset)
  1073. unsigned short * off_type;
  1074. unsigned short * off_offset;
  1075. {
  1076. off_info_type * off_info_ptr;
  1077. if (off_info_cnt <= 0) {
  1078. diag_issue_internal_error ("stack underflow in machine listing");
  1079. }
  1080. /* Remove from the stack the entry with the lowest offset value */
  1081. off_info_ptr = & off_info_stack [off_info_cnt - 1];
  1082. (* off_type) = off_info_ptr->w_off_type;
  1083. (* off_offset) = off_info_ptr->w_off_offset;
  1084. off_info_cnt--;
  1085. }
  1086. char * type_from_code
  1087. (MrmType type_code)
  1088. /*
  1089. *++
  1090. *
  1091. * PROCEDURE DESCRIPTION:
  1092. *
  1093. * This procedure returns the string corresponding to a URM type code
  1094. *
  1095. * FORMAL PARAMETERS:
  1096. *
  1097. * type type code from RGMrType...
  1098. *
  1099. * IMPLICIT INPUTS:
  1100. *
  1101. * none
  1102. *
  1103. * IMPLICIT OUTPUTS:
  1104. *
  1105. * none
  1106. *
  1107. * FUNCTION VALUE:
  1108. *
  1109. * The string corresponding to the type code
  1110. *
  1111. * SIDE EFFECTS:
  1112. *
  1113. * none
  1114. *
  1115. *--
  1116. */
  1117. {
  1118. switch (type_code)
  1119. {
  1120. case MrmRtypeInteger:
  1121. return uil_datatype_names[sym_k_integer_value];
  1122. case MrmRtypeHorizontalInteger:
  1123. return uil_datatype_names[sym_k_horizontal_integer_value];
  1124. case MrmRtypeVerticalInteger:
  1125. return uil_datatype_names[sym_k_vertical_integer_value];
  1126. case MrmRtypeBoolean:
  1127. return uil_datatype_names[sym_k_bool_value];
  1128. case MrmRtypeChar8:
  1129. return uil_datatype_names[sym_k_char_8_value];
  1130. case MrmRtypeChar8Vector:
  1131. return uil_datatype_names[sym_k_asciz_table_value];
  1132. case MrmRtypeCString:
  1133. return uil_datatype_names[sym_k_compound_string_value];
  1134. case MrmRtypeCStringVector:
  1135. return uil_datatype_names[sym_k_string_table_value];
  1136. case MrmRtypeFloat:
  1137. return uil_datatype_names[sym_k_float_value];
  1138. case MrmRtypeHorizontalFloat:
  1139. return uil_datatype_names[sym_k_horizontal_float_value];
  1140. case MrmRtypeVerticalFloat:
  1141. return uil_datatype_names[sym_k_vertical_float_value];
  1142. case MrmRtypeSingleFloat: /* single float data type RAP */
  1143. return uil_datatype_names[sym_k_single_float_value];
  1144. case MrmRtypeCallback:
  1145. return "callback";
  1146. case MrmRtypePixmapImage:
  1147. return "pixmap image";
  1148. case MrmRtypePixmapDDIF:
  1149. return "pixmap DDIF";
  1150. case MrmRtypeResource:
  1151. return "resource";
  1152. case MrmRtypeAddrName:
  1153. return "addr name";
  1154. case MrmRtypeIconImage:
  1155. return uil_datatype_names[sym_k_icon_value];
  1156. case MrmRtypeFont:
  1157. return uil_datatype_names[sym_k_font_value];
  1158. case MrmRtypeFontSet:
  1159. return uil_datatype_names[sym_k_fontset_value];
  1160. case MrmRtypeFontList:
  1161. return uil_datatype_names[sym_k_font_table_value];
  1162. case MrmRtypeColor:
  1163. return uil_datatype_names[sym_k_color_value];
  1164. case MrmRtypeColorTable:
  1165. return uil_datatype_names[sym_k_color_table_value];
  1166. case MrmRtypeAny:
  1167. return uil_datatype_names[sym_k_any_value];
  1168. case MrmRtypeTransTable:
  1169. return uil_datatype_names[sym_k_trans_table_value];
  1170. case MrmRtypeClassRecName:
  1171. return uil_datatype_names[sym_k_class_rec_name_value];
  1172. case MrmRtypeIntegerVector:
  1173. return uil_datatype_names[sym_k_integer_table_value];
  1174. case MrmRtypeXBitmapFile:
  1175. return uil_datatype_names[sym_k_xbitmapfile_value];
  1176. case MrmRtypeKeysym:
  1177. return uil_datatype_names[sym_k_keysym_value];
  1178. default:
  1179. return "unknown";
  1180. }
  1181. }
  1182. char * access_from_code
  1183. (MrmFlag access_code)
  1184. /*
  1185. *++
  1186. *
  1187. * PROCEDURE DESCRIPTION:
  1188. *
  1189. * This procedure returns the string corresponding to a URM access code
  1190. *
  1191. * FORMAL PARAMETERS:
  1192. *
  1193. * access_code access code
  1194. *
  1195. * IMPLICIT INPUTS:
  1196. *
  1197. * none
  1198. *
  1199. * IMPLICIT OUTPUTS:
  1200. *
  1201. * none
  1202. *
  1203. * FUNCTION VALUE:
  1204. *
  1205. * The string corresponding to the access code
  1206. *
  1207. * SIDE EFFECTS:
  1208. *
  1209. * none
  1210. *
  1211. *--
  1212. */
  1213. {
  1214. switch (access_code) {
  1215. case URMaPublic: return "public";
  1216. case URMaPrivate: return "private";
  1217. default: return "unknown";
  1218. }
  1219. }
  1220. char * group_from_code
  1221. (MrmGroup group_code)
  1222. /*
  1223. *++
  1224. *
  1225. * PROCEDURE DESCRIPTION:
  1226. *
  1227. * This procedure returns the string corresponding to a URM group code
  1228. *
  1229. * FORMAL PARAMETERS:
  1230. *
  1231. * group_code group code
  1232. *
  1233. * IMPLICIT INPUTS:
  1234. *
  1235. * none
  1236. *
  1237. * IMPLICIT OUTPUTS:
  1238. *
  1239. * none
  1240. *
  1241. * FUNCTION VALUE:
  1242. *
  1243. * The string corresponding to the group code
  1244. *
  1245. * SIDE EFFECTS:
  1246. *
  1247. * none
  1248. *
  1249. *--
  1250. */
  1251. {
  1252. switch (group_code) {
  1253. case URMgWidget: return "widget";
  1254. case URMgLiteral: return "literal";
  1255. case URMgResourceSet: return "resource set";
  1256. default: return "unknown";
  1257. }
  1258. }
  1259. void format_arg_value (argval_ptr, buffer)
  1260. RGMArgValuePtr argval_ptr;
  1261. char * buffer;
  1262. /*
  1263. *++
  1264. *
  1265. * FUNCTION PROTOTYPE
  1266. *
  1267. * PROCEDURE DESCRIPTION:
  1268. *
  1269. * This routine formats a value descriptor into the buffer.
  1270. *
  1271. * FORMAL PARAMETERS:
  1272. *
  1273. * argval_ptr pointer to the argument value descriptor
  1274. * buffer buffer to receive the formatted value
  1275. *
  1276. * IMPLICIT INPUTS:
  1277. *
  1278. *
  1279. * IMPLICIT OUTPUTS:
  1280. *
  1281. *
  1282. * FUNCTION VALUE:
  1283. *
  1284. * SIDE EFFECTS:
  1285. *
  1286. *
  1287. *--
  1288. */
  1289. {
  1290. switch ( argval_ptr->rep_type ) {
  1291. case MrmRtypeInteger:
  1292. case MrmRtypeHorizontalInteger:
  1293. case MrmRtypeVerticalInteger:
  1294. sprintf (buffer, "value: %d", argval_ptr->datum.ival);
  1295. break;
  1296. case MrmRtypeBoolean:
  1297. if (argval_ptr->datum.ival) {
  1298. sprintf (buffer, "value: true");
  1299. } else {
  1300. sprintf (buffer, "value: false");
  1301. }
  1302. break;
  1303. case MrmRtypeChar8:
  1304. case MrmRtypeCStringVector:
  1305. case MrmRtypePixmapImage:
  1306. case MrmRtypePixmapDDIF:
  1307. case MrmRtypeCString:
  1308. case MrmRtypeAddrName:
  1309. case MrmRtypeKeysym:
  1310. sprintf (buffer, "offset: %X (hex)", argval_ptr->datum.offset);
  1311. off_put (k_unknown_off, argval_ptr->datum.offset);
  1312. break;
  1313. case MrmRtypeFloat:
  1314. case MrmRtypeHorizontalFloat:
  1315. case MrmRtypeVerticalFloat:
  1316. sprintf (buffer, "offset: %X (hex)", argval_ptr->datum.offset);
  1317. off_put (k_float_off, argval_ptr->datum.offset);
  1318. break;
  1319. case MrmRtypeSingleFloat: /* single float data type RAP */
  1320. sprintf (buffer, "offset: %X (hex)", argval_ptr->datum.offset);
  1321. off_put (k_single_float_off, argval_ptr->datum.offset);
  1322. break;
  1323. case MrmRtypeCallback:
  1324. sprintf (buffer, "offset: %X (hex)", argval_ptr->datum.offset);
  1325. off_put (k_callback_off, argval_ptr->datum.offset);
  1326. break;
  1327. case MrmRtypeResource:
  1328. sprintf (buffer, "offset: %X (hex)", argval_ptr->datum.offset);
  1329. off_put (k_resource_off, argval_ptr->datum.offset);
  1330. break;
  1331. default:
  1332. sprintf (buffer, "value unknown");
  1333. break;
  1334. }
  1335. }
  1336. char * class_name_from_code
  1337. (MrmCode class)
  1338. /*
  1339. *++
  1340. *
  1341. * PROCEDURE DESCRIPTION:
  1342. *
  1343. * This procedure returns the string corresponding to a URM class code
  1344. *
  1345. * FORMAL PARAMETERS:
  1346. *
  1347. * class class code from URMwc...
  1348. *
  1349. * IMPLICIT INPUTS:
  1350. *
  1351. * none
  1352. *
  1353. * IMPLICIT OUTPUTS:
  1354. *
  1355. * none
  1356. *
  1357. * FUNCTION VALUE:
  1358. *
  1359. * The string corresponding to the class code
  1360. *
  1361. * SIDE EFFECTS:
  1362. *
  1363. * none
  1364. *
  1365. *--
  1366. */
  1367. {
  1368. int sym_code;
  1369. /*
  1370. * Find the sym_k code for the class, then return its name
  1371. */
  1372. for ( sym_code=sym_k_error_object+1;
  1373. sym_code<=uil_max_object;
  1374. sym_code++ )
  1375. if ( uil_widget_compr[sym_code] == class )
  1376. return uil_widget_names[sym_code];
  1377. return "unknown";
  1378. }
  1379. char * resource_name_from_code
  1380. (MrmCode resource)
  1381. /*
  1382. *++
  1383. *
  1384. * PROCEDURE DESCRIPTION:
  1385. *
  1386. * This procedure returns the string corresponding to a compression code
  1387. *
  1388. * FORMAL PARAMETERS:
  1389. *
  1390. * resource compression code for argument or reason
  1391. *
  1392. * IMPLICIT INPUTS:
  1393. *
  1394. * none
  1395. *
  1396. * IMPLICIT OUTPUTS:
  1397. *
  1398. * none
  1399. *
  1400. * FUNCTION VALUE:
  1401. *
  1402. * The string corresponding to the resource code
  1403. *
  1404. * SIDE EFFECTS:
  1405. *
  1406. * none
  1407. *
  1408. *--
  1409. */
  1410. {
  1411. int sym_code;
  1412. /*
  1413. * Find the sym_k code for the resource, then return its name
  1414. */
  1415. for ( sym_code=0 ; sym_code<=uil_max_arg ; sym_code++ )
  1416. if ( uil_arg_compr[sym_code] == resource )
  1417. return uil_argument_names[sym_code];
  1418. for ( sym_code=0 ; sym_code<=uil_max_reason ; sym_code++ )
  1419. if ( uil_reas_compr[sym_code] == resource )
  1420. return uil_reason_names[sym_code];
  1421. for ( sym_code=0 ; sym_code<=uil_max_child ; sym_code++ )
  1422. if ( uil_child_compr[sym_code] == resource )
  1423. return uil_child_names[sym_code];
  1424. return "unknown";
  1425. }