don@zardoz.coral.COM (Don Dewar) (06/07/90)
I want to store some string array data in a uil file that I use to
build a screen, but it is not directly related to uil. So I stored it
as an asciz_table. When I fetch the data, however, there is some
unknown (to me) data at the beginning of the structure followed by the
list of strings I am interested in. Here is an excerpt from the uil
file, followed by an excerpt from the c-code, followed by what gdb
tells me is there. Then, I ask some questions.
The UIL file
ColumnList : exported asciz_string_table ('objectid',
'model',
'contact');
The C-code
char *pcollist;
if (!(MrmFetchLiteral(mrmid, "ColumnList", UNULL, &pcollist, type)))
{
return;
}
GDB
(gdb) print (char [39])*pcollist
$5 ={"\000$\006P\000$\006Y\000$\006_\000\000\000\000objectid\000model\000contact\000"}
I have guessed that the \006 is the data type (RGMrTypeCStringVector of
each element in the table. I can't figure out what the P, Y, and _
are except that they are the same number apart in the ascii table
as each value in the string table is apart (ie. Y is 9 from P and
contact starts 9 from the start of model). And I assumed the $ is
just some separator character.
Questions:
Is this the output I should get?
Where is the structure for this table defined?
Are there convenience functions for gettting the nth element out of
the table?
Is what I am doing ok or is it frowned upon?
Is there a better way to do this in uil?
Miscellaneous Information
I am running motif (of course) with X11 rev 4 on a sparcstation
(sun4) under SunOs 4.03.
Any help would be appreciated. +---------+
| Coral |
|@@@@@*@**|
|@@*@@**@@| Don Dewar
|*@@**@@@@| Coral Network Corporation, Marlborough, MA
|@***@@@@@| Internet: don@coral.com
|@@**@@@@@| Phone: (508) 460-6010
|*********| Fax: (508) 481-6258
|Networks |
+---------+marbru@auto-trol.UUCP (Martin Brunecky) (06/07/90)
In article <9006061717.AA06178@zardoz.coral.com> don@zardoz.coral.COM (Don Dewar) writes: > >I want to store some string array data in a uil file that I use to >build a screen, but it is not directly related to uil. So I stored it >as an asciz_table... What about saving yourself troubles with UIL and storing it in the app-defaults resource file ? You can retrieve your string(s) with XtGetApplicationResources, and you can either use some separator to delimit individual strings, or have a resource for each item, such as: foo.foo.str1: xxxx foo.foo.str2: yyyy Note, XtGetApplicationResources is optimized for retrieving multiple resources at a time (the code used at widget creation time, even if you use UIL ...). Also, you can "attach" your resources to any widget in your tree. Also note, that Motif likes to twist and tweak your widget tree by "confusion routines" which insert hidden shells, parent widget off a different widget than you specified ... just beware. -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky marbru@auto-trol.COM (303) 252-2499 {...}ncar!ico!auto-trol!marbru Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404