Dan Karron@UCBVAX.BERKELEY.EDU (02/13/91)
The next version of Symboltin, v 1.01 is on my anon ftp on karron.med.nyu.edu. This is a suite of subroutines and a main driver that will read and manipulate values in itself or a target program much like dbx/edge via the symbol table and the /debug/ entries. I have put in a subroutine that will printout the value of a structure in c recompilable form. Here is some example code and the output it produces. This code writes a c subroutine as part of a larger code generator: /*********************************************************************/ #define P(q) fprintf(dumpfile,"%s\n",q) void WriteCPanel(Panel *p) { P(stars); fprintf(dumpfile,"void def_panel%d() \n",PanelNumber++); P("{"); P("Panel *p;"); P("Actuator *a;"); P(""); P("p=pnl_mkpanel();"); PrintStruct(dumpfile,p,"Panel","p"); P("\n"); } /**********************************************************************/ Here is the output from PrintStruct(); You can control how much and what parts of a struct are dumped by putting a dummy member in that will not print, but will keep the Symboltin program from running down the rest of the struct. Usually a struct has a number of memory pointers that you don't want to print out. Group those after the stop_struct_print marker. Also, a flag is kept internally to not printout pointers that can not be resolved to symbols, so you don't get output like this: rb2->al=(void *)0x1000abcde; This value is worthless in saving the external state of the struct. /***************************************************************/ void def_panel0() { Panel *p; Actuator *a; p=pnl_mkpanel(); p->x = 314; p->y = 724; p->w = 91; p->h = 91; p->minx = 0.800000; p->maxx = 2.600000; p->miny = 0.800000; p->maxy = 2.600000; p->cw = 0.000000; p->ch = 0.000000; p->ppu = 50.555550; p->label = "panel three"; p->icon_label = NULL; p->ExternName = NULL; p->DoNotDumpMe = 0; rb1=pnl_mkact(pnl_radio_button); rb1->x = 1.000000; rb1->y = 1.000000; rb1->w = 0.400000; rb1->h = 0.400000; rb1->lx = 0.500000; rb1->ly = 0.050000; rb1->lw = 0.720000; rb1->lh = 0.300000; rb1->ld = 0.040000; rb1->val = 0.000000; rb1->extval = 0.000000; rb1->initval = 0.000000; rb1->maxval = 1.000000; rb1->minval = 0.000000; rb1->scalefactor = 1.000000; rb1->key = 0; rb1->labeltype = 0; rb1->initfunc = pnl_radio_button; rb1->DansId = 0; rb1->label = "cyan"; rb1->label_down = NULL; rb1->label_up = NULL; rb1->label_target = NULL; rb1->label_min = NULL; rb1->label_max = NULL; rb1->scale_incriment = 0.000000; rb1->scale_subdivision = 10.000000; rb1->Volatile = 0; rb1->ExternName = "rb1"; rb1->AttachName = NULL; rb1->automatic = 0; rb1->selectable = 1; rb1->visible = 1; rb1->beveled = 1; pnl_addact(rb1 , p); .... and so on, ad nausium. You can edit these values, compile and redump. This is much easier than making a special format file to save the values in all the struct fields. As you change values,struct members, your code will evolve through each dump/recompile/redump cycle. Please let me know if you need any help using this: It is on my anon ftp at karron.med.nyu.edu. My email to you answering your questions will be the documentation I will distribute with the source code. Enjoy! Dan. +-----------------------------------------------------------------------------+ | karron@nyu.edu (E-mail alias that will always find me) | | Fax: 212 263 7190 * Dan Karron, Research Associate | | . . . . . . . . . . . . . . * New York University Medical Center | | 560 First Avenue \*\ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> <your-number-here> | | (212) 263 5210 \***\_________________________________________ | | Main machine: karron.med.nyu.edu (128.122.135.3) IRIS 85GT | +-----------------------------------------------------------------------------+ NOTE PHONE NUMBER CHANGE: The Med Ctr has changed from 340 to 263 exchange.