56
56
/* External Variable definitions */
57
57
/*------------------------------------------------------------------------*/
60
extern Tcl_Interp *xcinterp;
59
63
extern char _STR2[250], _STR[150];
60
64
extern Globaldata xobjs;
61
65
extern Clientdata areastruct;
157
160
if (mode != SAVE) {
158
161
for (genobj = localdata->plist; genobj < localdata->plist
159
162
+ localdata->parts; genobj++)
160
/* (*genobj == NULL) only if this is a library page */
161
/* and the "special instances" have been deleted */
162
/* just before calling reset(). */
164
/* (*genobj == NULL) only on library pages */
165
/* where the instances are kept in the library */
166
/* definition, and are only referenced on the page. */
163
168
if (*genobj != NULL)
164
169
free_single(genobj);
175
180
/*---------------------------------------------------------*/
182
void pagereset(short rpage)
181
184
/* free alloc'd filename */
183
if (xobjs.pagelist[areastruct.page]->filename != NULL)
184
free(xobjs.pagelist[areastruct.page]->filename);
186
if (xobjs.pagelist[areastruct.page]->background.name != NULL)
187
free(xobjs.pagelist[areastruct.page]->background.name);
189
rpage = areastruct.page;
191
if (areastruct.selects > 0) {
192
free(areastruct.selectlist);
193
areastruct.selects = 0;
186
if (xobjs.pagelist[rpage]->filename != NULL)
187
free(xobjs.pagelist[rpage]->filename);
189
if (xobjs.pagelist[rpage]->background.name != NULL)
190
free(xobjs.pagelist[rpage]->background.name);
196
194
/* New pages pick up their properties from page 0, which can be changed */
197
195
/* from the .xcircuitrc file on startup (or loaded from a script). */
204
202
xobjs.pagelist[rpage]->pmode = xobjs.pagelist[0]->pmode;
205
203
xobjs.pagelist[rpage]->outscale = xobjs.pagelist[0]->outscale;
206
204
xobjs.pagelist[rpage]->filename = (char *)malloc
207
((1 + strlen(xobjs.pagelist[rpage]->pageobj->name)) * sizeof(char));
205
((1 + strlen(xobjs.pagelist[rpage]->pageinst->thisobject->name))
208
207
xobjs.pagelist[rpage]->background.name = (char *)NULL;
210
strcpy(xobjs.pagelist[rpage]->filename, xobjs.pagelist[rpage]->pageobj->name);
209
strcpy(xobjs.pagelist[rpage]->filename,
210
xobjs.pagelist[rpage]->pageinst->thisobject->name);
211
211
xobjs.pagelist[rpage]->drawingscale.x = xobjs.pagelist[0]->drawingscale.x;
212
212
xobjs.pagelist[rpage]->drawingscale.y = xobjs.pagelist[0]->drawingscale.y;
213
213
xobjs.pagelist[rpage]->gridspace = xobjs.pagelist[0]->gridspace;
239
239
localdata->viewscale = 0.5;
240
240
localdata->pcorner.x = -areastruct.width;
241
241
localdata->pcorner.y = -areastruct.height;
242
localdata->width = 0;
243
localdata->height = 0;
244
localdata->lowerleft.x = 0;
245
localdata->lowerleft.y = 0;
242
localdata->bbox.width = 0;
243
localdata->bbox.height = 0;
244
localdata->bbox.lowerleft.x = 0;
245
localdata->bbox.lowerleft.y = 0;
248
localdata->highlight.netid = 0;
249
localdata->highlight.thisinst = NULL;
248
250
localdata->schemtype = SCHEMATIC;
249
251
localdata->symschem = NULL;
250
252
localdata->netlist = NULL;
556
553
/* Load a PostScript or Python (interpreter script) file */
557
554
/*-------------------------------------------------------*/
559
void getfile(Widget button, void *mode, caddr_t nulldata)
556
void getfile(xcWidget button, pointertype mode, caddr_t nulldata)
561
558
buttonsave *savebutton;
562
559
static void ((*runprog[LOAD_MODES])()) =
565
562
{"load", "import", "render", "execute", "recover"};
566
563
char *promptstr = NULL;
568
if (is_page(objectdata) == -1) {
565
if (is_page(topobject) == -1) {
569
566
Wprintf("Can only read file into top-level page!");
576
573
savebutton = (buttonsave *)malloc(sizeof(buttonsave));
577
getgeneric(savebutton, button, getfile, mode);
574
getgeneric(savebutton, button, getfile, (void *)mode);
578
575
if ((int)mode == RECOVER) {
579
576
char *cfile = getcrashfilename();
580
577
promptstr = (char *)malloc(18 + ((cfile == NULL) ? 9 : strlen(cfile)));
601
598
/* Tilde ('~') expansion in file name (stored in _STR) */
602
599
/*--------------------------------------------------------------*/
604
Boolean tilde_expand(char *filename)
601
Boolean xc_tilde_expand(char *filename)
606
603
struct passwd *passwd;
607
604
char *username = NULL, *expanded, *sptr;
672
669
ilib = createlibrary();
673
670
loadlibrary(ilib);
674
if (ilib == tlib) zoomview(NULL, NULL, NULL);
671
/* if (ilib == tlib) zoomview(NULL, NULL, NULL); */
679
676
ilib = createlibrary();
680
677
loadlibrary(ilib);
681
if (ilib == tlib) zoomview(NULL, NULL, NULL);
678
/* if (ilib == tlib) zoomview(NULL, NULL, NULL); */
684
681
/*------------------------------------------------------*/
716
713
/*---------------------------------------------------------*/
718
void getlib(Widget button, caddr_t clientdata, caddr_t nulldata)
715
void getlib(xcWidget button, caddr_t clientdata, caddr_t nulldata)
720
717
buttonsave *savebutton = (buttonsave *)malloc(sizeof(buttonsave));
721
718
getgeneric(savebutton, button, getlib, NULL);
726
723
/*---------------------------------------------------------*/
728
void getuserlib(Widget button, caddr_t clientdata, caddr_t nulldata)
725
void getuserlib(xcWidget button, caddr_t clientdata, caddr_t nulldata)
730
727
buttonsave *savebutton = (buttonsave *)malloc(sizeof(buttonsave));
731
728
getgeneric(savebutton, button, getuserlib, NULL);
856
853
ps = fopen(inname, "r");
858
855
if (ps == NULL && mode == FONTLIB) {
859
/* printf("looking in %s/fonts\n", tmp_s); */
856
/* Fprintf(stdout, "looking in %s/fonts\n", tmp_s); */
860
857
sprintf(inname, "%s/fonts/%s", tmp_s, _STR);
861
858
ps = fopen(inname, "r");
862
859
if (ps == NULL) {
863
860
sprintf(inname, "%s/fonts/%s.lps", tmp_s, _STR);
864
861
ps = fopen(inname, "r");
866
if (ps == NULL) printf("not found there.\n");
864
Fprintf(stdout, "%s not found, still trying. . .\n", inname);
877
875
ps = fopen(inname, "r");
879
877
if (ps == NULL && mode == FONTLIB) {
880
/* printf("looking in %s/fonts\n", BUILTINS_DIR); */
878
/* Fprintf(stdout, "looking in %s/fonts\n", BUILTINS_DIR); */
881
879
sprintf(inname, "%s/fonts/%s", BUILTINS_DIR, _STR);
882
880
ps = fopen(inname, "r");
883
881
if (ps == NULL) {
884
882
sprintf(inname, "%s/fonts/%s.lps", BUILTINS_DIR, _STR);
885
883
ps = fopen(inname, "r");
887
if (ps == NULL) printf("not found there.\n");
885
if (ps == NULL) Fprintf(stdout, "%s not found.\n", inname);
889
887
if (ps == NULL) {
890
888
Wprintf("No library file found.");
918
916
/* Don't write terminating newline to the object's name string */
919
917
if ((nptr = strchr(cptr + 2, '\n')) != NULL) *nptr = '\0';
920
918
if (xobjs.userlibs[mode - LIBRARY].number == 0) {
921
sprintf(xobjs.libtop[mode]->name, "Library: %.79s", cptr + 2);
919
sprintf(xobjs.libtop[mode]->thisobject->name,
920
"Library: %.79s", cptr + 2);
934
933
else if (!strcmp(keyword, "XCircuitLib")) break;
937
objectread(ps, objectdata, 0, 0, mode, temp, DEFAULTCOLOR);
936
objectread(ps, topobject, 0, 0, mode, temp, DEFAULTCOLOR);
938
937
cleanupaliases(mode);
940
939
if (mode != FONTLIB) composelib(mode);
942
/* printf("Loaded library %s\n", inname); */
941
/* Fprintf(stdout, "Loaded library %s\n", inname); */
943
942
sprintf(_STR, "Loaded library %s", inname);
1003
1000
/*--------------------------------------------------------------*/
1004
1001
/* Load an xcircuit file into xcircuit */
1003
/* mode = 0 is a "load" function. Behavior: load on */
1004
/* current page if empty. Otherwise, load on first empty */
1005
/* page found. If no empty pages exist, create a new page */
1006
/* and load there. */
1007
/* mode = 1 is an "import" function. Behavior: add */
1008
/* contents of file to the current page. */
1005
1009
/*--------------------------------------------------------------*/
1007
1011
void loadfile(short mode)
1096
1100
/* for the object name, but the full path for the filename. */
1098
1102
if ((pdchar = strrchr(_STR, '/')) != NULL)
1099
sprintf(objectdata->name, "%s", pdchar + 1);
1103
sprintf(topobject->name, "%s", pdchar + 1);
1101
sprintf(objectdata->name, "%s", _STR);
1105
sprintf(topobject->name, "%s", _STR);
1103
1107
renamepage(areastruct.page);
1104
printname(objectdata);
1108
printname(topobject);
1105
1109
Wprintf("Starting new drawing");
1173
1177
/* read out-of-page library definitions */
1175
1179
if (strstr(temp, "%%Page:") == NULL && strstr(temp, "offsets") == NULL)
1176
objectread(ps, objectdata, 0, 0, USERLIB, temp, DEFAULTCOLOR);
1180
objectread(ps, topobject, 0, 0, USERLIB, temp, DEFAULTCOLOR);
1178
1182
if (strstr(temp, "%%Page:") != NULL)
1179
1183
sscanf(temp + 8, "%99s", pagestr);
1200
1204
/* good so far; let's clear out the old data structure */
1202
1206
if (mode == 0) {
1204
reset(objectdata, NORMAL);
1207
reset(topobject, NORMAL);
1208
pagereset(areastruct.page);
1206
1209
xobjs.pagelist[areastruct.page]->pmode = temppmode;
1207
1210
if (temppmode == 1) {
1208
1211
xobjs.pagelist[areastruct.page]->pagesize.x = pagesize.x;
1209
1212
xobjs.pagelist[areastruct.page]->pagesize.y = pagesize.y;
1216
else topobject->valid = False;
1213
1219
/* read to the "scale" line, picking up inch/cm type, drawing */
1214
1220
/* scale, and grid/snapspace along the way */
1230
1236
else if (strstr(temp, "is_symbol") != NULL) {
1231
1237
sscanf(temp, "%*c %49s", teststr);
1232
checkschem(objectdata, teststr);
1238
checkschem(topobject, teststr);
1235
1241
else if (strstr(temp, "gridspace"))
1292
objectread(ps, objectdata, offx, offy, LIBRARY, temp, DEFAULTCOLOR);
1298
objectread(ps, topobject, offx, offy, LIBRARY, temp, DEFAULTCOLOR);
1294
1300
/* skip to next page boundary or file trailer */
1333
1339
sprintf(tpstr, "%d", page + 1);
1334
1340
if (!strcmp(pagestr, tpstr))
1335
sprintf(objectdata->name, "%.79s", rootptr);
1341
sprintf(topobject->name, "%.79s", rootptr);
1337
sprintf(objectdata->name, "%.79s", pagestr);
1343
sprintf(topobject->name, "%.79s", pagestr);
1339
1345
renamepage(areastruct.page);
1342
1348
/* set object position to fit to window separately for each page */
1343
centerview(objectdata);
1349
calcbbox(areastruct.topinstance);
1350
centerview(areastruct.topinstance);
1346
1353
/* Crash file recovery: read any out-of-page library definitions tacked */
1347
1354
/* onto the end of the file into the user library. */
1348
objectread(ps, objectdata, 0, 0, USERLIB, temp, DEFAULTCOLOR);
1355
objectread(ps, topobject, 0, 0, USERLIB, temp, DEFAULTCOLOR);
1349
1356
cleanupaliases(USERLIB);
1351
1358
sprintf(_STR, "Loaded file: %s (%d page%s)", inname, multipage,
1424
1431
case FONT_NAME:
1425
1432
if (curfont == curpart->data.font) {
1426
1433
/* Font change is redundant: remove it */
1427
curpart = deletestring(curpart, strhead, NORMINST);
1434
curpart = deletestring(curpart, strhead, areastruct.topinstance);
1430
1437
curfont = curpart->data.font;
1435
1442
/* Old style font scale is always written absolute, not relative. */
1436
1443
/* Changes in scale were not allowed, so just get rid of them. */
1437
1444
if (version < 2.25)
1438
curpart = deletestring(curpart, strhead, NORMINST);
1445
curpart = deletestring(curpart, strhead, areastruct.topinstance);
1441
1448
/* A font change may occur inside a parameter, so any font */
1651
1658
/* the number of parameters and parameter type. */
1653
1660
if (localdata->num_params < paramno) {
1654
fprintf(stderr, "readlabel() error: Parameter %d exceeds declared "
1661
Fprintf(stderr, "readlabel() error: Parameter %d exceeds declared "
1655
1662
"number of parameters (%d)!\n", paramno, localdata->num_params);
1656
deletestring(newpart, strhead, NORMINST);
1663
deletestring(newpart, strhead, areastruct.topinstance);
1658
1665
else if ((localdata->params[paramno - 1])->type != XC_STRING) {
1659
fprintf(stderr, "readlabel() error: Parameter %d is not a string "
1666
Fprintf(stderr, "readlabel() error: Parameter %d is not a string "
1660
1667
"but was called as one!\n", paramno);
1661
deletestring(newpart, strhead, NORMINST);
1668
deletestring(newpart, strhead, areastruct.topinstance);
1664
/* printf("Parameter %d called from object %s\n", paramno, */
1665
/* localdata->name); */
1671
/* Fprintf(stdout, "Parameter %d called from object %s\n", */
1672
/* paramno, localdata->name); */
1667
1674
endptr = segptr + 1;
1668
while (!isspace(*endptr)) endptr++;
1675
while (!isspace(*endptr) && (*endptr != '\0')) endptr++;
1670
1677
segptr = endptr;
1753
1765
if (newinst->thisobject->params == NULL)
1754
printf("Error: parameter list does not exist!\n");
1766
Fprintf(stdout, "Error: parameter list does not exist!\n");
1756
1768
ops = newinst->thisobject->params[i];
1757
1769
if (ops == NULL)
1758
printf("Error: parameter does not exist!\n");
1770
Fprintf(stdout, "Error: parameter does not exist!\n");
1760
1772
newinst->params[i]->type = ops->type;
1761
1773
if (ops->type == XC_FLOAT) {
1762
1774
sscanf(arrayptr, "%f",
1763
1775
&(newinst->params[i]->parameter.fvalue));
1764
/* printf("Object %s called with parameter "
1776
/* Fprintf(stdout, "Object %s called with parameter "
1765
1777
"%d value %3.2f\n", newinst->thisobject->name,
1766
1778
i + 1, newinst->params[i]->parameter.fvalue); */
1768
1780
else if (ops->type == XC_INT) {
1769
1781
sscanf(arrayptr, "%d",
1770
1782
&(newinst->params[i]->parameter.ivalue));
1771
/* printf("Object %s called with parameter "
1783
/* Fprintf(stdout, "Object %s called with parameter "
1772
1784
"%d value %d\n", newinst->thisobject->name,
1773
1785
i + 1, newinst->params[i]->parameter.ivalue); */
1776
printf("Error: unknown parameter type!\n");
1788
Fprintf(stderr, "Error: unknown parameter type!\n");
1779
1791
arrayptr = advancetoken(arrayptr);
1901
1920
/*--------------------------------------------------------------*/
1921
/* Create a new instance of an object in the library's list of */
1922
/* instances. This instance will be used on the library page */
1923
/* when doing "composelib()". */
1924
/*--------------------------------------------------------------*/
1926
objinstptr addtoinstlist(int libnum, objectptr libobj, Boolean virtual)
1928
objinstptr newinst = (objinstptr) malloc(sizeof(objinst));
1929
liblistptr spec = (liblistptr) malloc(sizeof(liblist));
1932
newinst->type = OBJECT;
1933
objectdefaults(newinst, libobj, 0, 0);
1935
spec->virtual = (u_char)virtual;
1936
spec->thisinst = newinst;
1939
/* Add to end, so that duplicate, parameterized instances */
1940
/* always come after the original instance with the default */
1943
if ((srch = xobjs.userlibs[libnum].instlist) == NULL)
1944
xobjs.userlibs[libnum].instlist = spec;
1946
while (srch->next != NULL) srch = srch->next;
1950
/* Calculate the instance-specific bounding box */
1951
calcbboxinst(newinst);
1956
/*--------------------------------------------------------------*/
1902
1957
/* Continuation Line --- add memory to "buffer" as necessary. */
1903
1958
/* Add a space character to the current text in "buffer" and */
1904
1959
/* return a pointer to the new end-of-text. */
2375
2430
for (; *lineptr != ' '; lineptr--);
2377
2432
if ((strchr(lineptr, '.') != NULL) && (version < 2.25)) {
2378
fprintf(stderr, "Error: File version claims to be %2.1f,"
2433
Fprintf(stderr, "Error: File version claims to be %2.1f,"
2379
2434
" but has version %2.1f labels\n", version, PROG_VERSION);
2380
fprintf(stderr, "Attempting to resolve problem by updating version.\n");
2435
Fprintf(stderr, "Attempting to resolve problem by updating version.\n");
2381
2436
version = PROG_VERSION;
2382
2437
for (; *lineptr == ' '; lineptr--);
2383
2438
for (; *lineptr != ' '; lineptr--);
2412
2467
(*newlabel)->pin = False;
2413
2468
if (strcmp(keyword, "label")) { /* all the schematic types */
2414
2469
/* enable schematic capture if it is not already on. */
2415
if (!areastruct.schemon) doxschema(NULL, NULL, NULL);
2470
if (!areastruct.schemon) doxschema(NULL, 0, NULL);
2416
2471
if (!strcmp(keyword, "pinlabel"))
2417
2472
(*newlabel)->pin = LOCAL;
2418
2473
else if (!strcmp(keyword, "pinglobal"))
2444
2499
(*newlabel)->scale = firstscale->data.scale;
2445
deletestring(firstscale, &((*newlabel)->string), NORMINST);
2500
deletestring(firstscale, &((*newlabel)->string),
2501
areastruct.topinstance);
2449
2505
firstfont = (*newlabel)->string;
2450
2506
if (firstfont->type != FONT_NAME) {
2451
2507
if (tmpfont == -1) {
2452
fprintf(stderr, "Error: Label with no font designator?\n");
2508
Fprintf(stderr, "Error: Label with no font designator?\n");
2455
2511
firstfont = makesegment(&((*newlabel)->string), (*newlabel)->string);
2501
2557
*retstr = '\0';
2505
sscanf(++lineptr, "%hd %hd %hd %hd", &localdata->lleft2.x,
2506
&localdata->lleft2.y, &localdata->width2, &localdata->height2);
2507
if (mode == FONTLIB) {
2508
localdata->lowerleft.x = localdata->lleft2.x;
2509
localdata->lowerleft.y = localdata->lleft2.y;
2510
localdata->width = localdata->width2;
2511
localdata->height = localdata->height2;
2514
sscanf(++lineptr, "%hd %hd %hd %hd", &localdata->lowerleft.x,
2515
&localdata->lowerleft.y, &localdata->width, &localdata->height);
2560
sscanf(++lineptr, "%hd %hd %hd %hd",
2561
&localdata->bbox.lowerleft.x, &localdata->bbox.lowerleft.y,
2562
&localdata->bbox.width, &localdata->bbox.height);
2519
2565
/* read "hidden" attribute */
2534
2579
sscanf(++lineptr, "%79s", keyword);
2536
2581
/* Find the library containing the object, add a record to its */
2537
/* speclist list, and create a new instance and add it to the */
2582
/* instlist list, and create a new instance and add it to the */
2540
2585
for (i = 0; i < xobjs.numlibs; i++) {
2541
2586
for (j = 0; j < xobjs.userlibs[i].number; j++) {
2542
2587
libobj = xobjs.userlibs[i].library + j;
2543
2588
if (!strcmp(keyword, (*libobj)->name)) {
2544
objectpairptr spec = (objectpairptr)
2545
malloc(sizeof(objectpair));
2546
NEW_OBJINST(newinst, localdata);
2547
objectdefaults(*newinst, *libobj, 0, 0);
2548
spec->thisobject = *libobj;
2549
spec->thisinst = *newinst;
2550
spec->nextpair = xobjs.userlibs[i].speclist;
2551
xobjs.userlibs[i].speclist = spec;
2552
readparams(*newinst, *libobj, buffer);
2589
newobjinst = addtoinstlist(i, *libobj, TRUE);
2591
while (isspace(*lineptr)) lineptr++;
2593
/* May declare instanced scale and rotation first */
2594
if (*lineptr != '[') {
2595
lineptr = varfscan(localdata, lineptr,
2597
(genericptr)newobjinst, P_SCALE);
2598
lineptr = varscan(localdata, lineptr,
2599
&newobjinst->rotation,
2600
(genericptr)newobjinst, P_ROTATION);
2602
readparams(newobjinst, *libobj, lineptr);
2560
2610
/* read objects */
2562
2612
else if (!strcmp(keyword, "{")) { /* This is an object definition */
2563
objectpairptr newdef, redef = NULL;
2613
objlistptr newdef, redef = NULL;
2564
2614
objectptr *newobject;
2565
2615
objectptr *curlib = (mode == FONTLIB) ?
2566
2616
xobjs.fontlib.library : xobjs.userlibs[mode - LIBRARY].library;
2591
2641
xobjs.fontlib.number; libobj++) {
2592
2642
/* This font character may be a redefinition of another */
2593
2643
if (!objnamecmp(keyword, (*libobj)->name)) {
2594
newdef = (objectpairptr) malloc(sizeof(objectpair));
2644
newdef = (objlistptr) malloc(sizeof(objlist));
2595
2645
newdef->thisobject = *libobj;
2596
newdef->nextpair = redef;
2646
newdef->next = redef;
2597
2647
redef = newdef;
2604
2654
libobj = xobjs.userlibs[i].library + j;
2605
2655
/* This object may be a redefinition of another object */
2606
2656
if (!objnamecmp(keyword, (*libobj)->name)) {
2607
newdef = (objectpairptr) malloc(sizeof(objectpair));
2657
newdef = (objlistptr) malloc(sizeof(objlist));
2608
2658
newdef->thisobject = *libobj;
2609
newdef->nextpair = redef;
2659
newdef->next = redef;
2610
2660
redef = newdef;
2634
2684
/* rename the original one. */
2636
2686
else if (redef != NULL) {
2637
for (newdef = redef; newdef != NULL; newdef = newdef->nextpair) {
2687
for (newdef = redef; newdef != NULL; newdef = newdef->next) {
2639
2689
/* must make sure that default parameter values are */
2640
2690
/* plugged into the original object. */
2671
for (; (newdef = redef->nextpair); redef = newdef)
2721
for (; (newdef = redef->next); redef = newdef)
2727
/* Add an instance of the object to the library's instance list */
2729
if ((mode != FONTLIB) && (newobject != NULL)) {
2732
libinst = addtoinstlist(mode - LIBRARY, *newobject, FALSE);
2733
calcbboxvalues(libinst, (genericptr *)NULL);
2735
/* Center the view of the object in its instance */
2736
centerview(libinst);
2677
2739
else if (!strcmp(keyword, "def")) {
2678
2740
strncpy(retstr, buffer, 150);
2679
2741
retstr[149] = '\0';
2681
if (mode != FONTLIB) {
2682
calcbboxvalues(localdata, (u_char)1, (genericptr *)NULL);
2683
centerview(localdata);
2685
2743
return False; /* end of object def or end of object library */
2717
2775
else if (!strcmp(keyword, "beginparm")) { /* parameterized object */
2718
2776
short tmpnum, i;
2719
2777
for (--keyptr; *keyptr == ' '; keyptr--);
2720
for (; *keyptr != ' '; keyptr--);
2778
for (; isdigit(*keyptr) && (keyptr >= buffer); keyptr--);
2721
2779
sscanf(keyptr, "%hd", &tmpnum);
2722
2780
lineptr = buffer;
2723
2781
while (isspace(*lineptr)) lineptr++;
2748
2806
newpart->type = PARAM_END;
2750
2808
ops->type = (u_char)XC_STRING;
2751
/* printf("Parameter %d to object %s defaults to string \"%s\"\n",
2752
i + 1, localdata->name, ops->parameter.string); */
2809
ops->which = P_SUBSTRING;
2810
/* Fprintf(stdout, "Parameter %d to object %s defaults "
2811
"to string \"%s\"\n", i + 1, localdata->name,
2812
ops->parameter.string); */
2753
2813
*linetmp = csave;
2754
2814
lineptr = linetmp;
2755
2815
while (isspace(*lineptr)) lineptr++;
2757
2817
else { /* type is assumed to be XC_FLOAT */
2758
2818
ops->type = (u_char)XC_FLOAT;
2759
2819
sscanf(lineptr, "%f", &ops->parameter.fvalue);
2760
/* printf("Parameter %d to object %s defaults to value %3.2f\n",
2761
i + 1, localdata->name, ops->parameter.fvalue); */
2820
/* Fprintf(stdout, "Parameter %d to object %s defaults to "
2821
"value %3.2f\n", i + 1, localdata->name,
2822
ops->parameter.fvalue); */
2762
2823
lineptr = advancetoken(lineptr);
2768
2829
else if (!strcmp(keyword, "trivial")) {
2769
2830
localdata->schemtype = TRIVIAL;
2770
if (!areastruct.schemon) doxschema(NULL, NULL, NULL);
2831
if (!areastruct.schemon) doxschema(NULL, 0, NULL);
2773
2834
else if (!strcmp(keyword, "begingate")) {
2841
2901
(*newinst)->params = NULL;
2842
2902
(*newinst)->num_params = 0;
2843
2903
(*newinst)->passed = NULL;
2904
(*newinst)->bbox.lowerleft.x = (*libobj)->bbox.lowerleft.x;
2905
(*newinst)->bbox.lowerleft.y = (*libobj)->bbox.lowerleft.y;
2906
(*newinst)->bbox.width = (*libobj)->bbox.width;
2907
(*newinst)->bbox.height = (*libobj)->bbox.height;
2909
(*newinst)->schembbox = NULL;
2845
2912
lineptr = varfscan(localdata, buffer, &(*newinst)->scale,
2846
2913
(genericptr)*newinst, P_SCALE);
2889
2957
/* Save a PostScript file */
2890
2958
/*------------------------*/
2892
void setfile(Widget button, Widget fnamewidget, caddr_t clientdata)
2962
void setfile(char *filename, int mode)
2964
/* see if name has been changed in the buffer */
2966
if (strcmp(xobjs.pagelist[areastruct.page]->filename, filename)) {
2967
Wprintf("Changing name of edit file.");
2968
free(xobjs.pagelist[areastruct.page]->filename);
2969
xobjs.pagelist[areastruct.page]->filename = strdup(filename);
2972
if (strstr(xobjs.pagelist[areastruct.page]->filename, "Page ") != NULL) {
2973
Wprintf("Warning: Enter a new name.");
2974
if (beeper) XBell(dpy, 100);
2978
if (beeper) XBell(dpy, 100);
2982
#else /* !TCL_WRAPPER */
2984
void setfile(xcWidget button, xcWidget fnamewidget, caddr_t clientdata)
2894
2986
/* see if name has been changed in the buffer */
2911
savefile(objectdata, CURRENT_PAGE);
3003
savefile(CURRENT_PAGE);
2913
3005
/* Change "close" button to read "done" */
2915
di = XtParent(button);
3007
di = xcParent(button);
2916
3008
db = XtNameToWidget(di, "Close");
2917
3009
XtSetArg(wargs[0], XtNlabel, " Done ");
2918
3010
XtSetValues(db, wargs, 1);
2928
3022
void incr_changes(objectptr thisobj)
3024
/* It is assumed that empty pages are meant to be that way */
3025
/* and are not to be saved, so changes are marked as zero. */
3027
if (thisobj->parts == 0) {
3028
thisobj->changes = 0;
2930
3032
thisobj->changes++;
2931
3033
xobjs.new_changes++;
2933
3035
if (xobjs.new_changes > MAXCHANGES) {
2934
3039
savetemp(NULL, NULL);
2935
3041
xobjs.new_changes = 0; /* reset the count */
2940
3046
/* tempfile save */
2941
3047
/*--------------------------------------------------------------*/
2943
XtTimerCallbackProc savetemp(Widget w, XtIntervalId *id)
3051
xcTimeOutProc savetemp(caddr_t clientdata)
3053
if (xobjs.timeout_id == NULL) { /* Not called by timeout callback */
3054
xcRemoveTimeOut(xobjs.timeout_id);
3056
xobjs.timeout_id = NULL;
3060
xcTimeOutProc savetemp(caddr_t clientdata, xcIntervalId *id)
2945
3062
if (id == NULL) /* Not called by timeout callback */
2946
XtRemoveTimeOut(xobjs.timeout_id);
3063
xcRemoveTimeOut(xobjs.timeout_id);
2948
3067
/* First see if there are any unsaved changes in the file. */
2949
3068
/* If not, then just reset the counter and continue. */
2966
3085
xobjs.tempfile = strdup(template);
2967
3086
free(template);
2969
savefile(objectdata, ALL_PAGES);
3088
savefile(ALL_PAGES);
2972
xobjs.timeout_id = XtAppAddTimeOut(app, (u_long)60000 *
2973
xobjs.save_interval, (XtTimerCallbackProc)savetemp, NULL);
3091
xobjs.timeout_id = xcAddTimeOut(app, (u_long)60000 *
3092
xobjs.save_interval, (xcTimeOutProc)savetemp, NULL);
2986
3105
(*(wroteobjs + i))->changes = 0;
2989
/*--------------------------------------------------------------*/
3108
/*---------------------------------------------------------------*/
3109
/* Save indicated library. If libno is 0, save current page if */
3110
/* the current page is a library. If not, save the user library */
3111
/*---------------------------------------------------------------*/
2991
void savelib(Widget button, caddr_t clientdata, caddr_t nulldata)
3113
void savelibpopup(xcWidget button, pointertype libno, caddr_t nulldata)
2993
buttonsave *savebutton = (buttonsave *)malloc(sizeof(buttonsave));
3116
buttonsave *savebutton;
3117
int ilib = (int)libno;
2996
if ((ilib = is_library(objectdata)) < 0) ilib = xobjs.numlibs - 1;
3119
if (ilib == 0) ilib = is_library(topobject);
3120
if (ilib < 0) ilib = xobjs.numlibs - 1;
3121
if ((ilib = is_library(topobject)) < 0) ilib = xobjs.numlibs - 1;
2998
3123
if (xobjs.userlibs[ilib].number == 0) {
2999
Wprintf("No user objects to save.");
3124
Wprintf("No objects in library to save.");
3002
getgeneric(savebutton, button, savelib, (void *)ilib);
3129
savebutton = (buttonsave *)malloc(sizeof(buttonsave));
3130
getgeneric(savebutton, button, savelibpopup, (void *)ilib);
3003
3131
popupprompt(button, "Enter name for library:", "\0", savelibrary,
3004
3132
savebutton, NULL);
3007
3136
/*---------------------------------------------------------*/
3009
void savelibrary(Widget w, int ilib)
3138
void savelibrary(xcWidget w, int ilib)
3012
3141
char outname[150], *outptr;
3013
3142
objectptr *wroteobjs, *libptr;
3015
3144
short written = 0;
3016
3145
char *uname = NULL;
3017
3146
char *hostname = NULL;
3020
3149
sscanf(_STR2, "%249s", outname);
3021
3150
if ((outptr = strrchr(outname, '/')) == NULL) outptr = outname;
3022
3151
if (strchr(outptr, '.') == NULL) sprintf(outname, "%s.lps", _STR2);
3023
tilde_expand(outname);
3152
xc_tilde_expand(outname);
3025
3154
ps = fopen(outname, "w");
3026
3155
if (ps == NULL) {
3055
3184
wroteobjs = (objectptr *) malloc (sizeof(objectptr));
3057
/* write all of the object definitions used, bottom up */
3059
for (libptr = xobjs.userlibs[ilib].library; libptr < xobjs.userlibs[ilib].library +
3060
xobjs.userlibs[ilib].number; libptr++)
3061
printobjects(ps, *libptr, 0.0, 0.0, 0.0, 0, 0, &wroteobjs, &written, DEFAULTCOLOR);
3063
/* note the virtual object copies and their parameters */
3065
for (spec = xobjs.userlibs[ilib].speclist; spec != NULL; spec =
3067
printparams(ps, spec->thisinst, 0);
3068
fprintf(ps, "/%s libinst\n", spec->thisobject->name);
3186
/* write all of the object definitions used, bottom up, with virtual instances */
3187
/* in the correct placement. */
3189
for (spec = xobjs.userlibs[ilib].instlist; spec != NULL; spec = spec->next) {
3190
if (!spec->virtual) {
3191
printobjects(ps, spec->thisinst->thisobject, 0.0, 0.0, 0.0, 0, 0,
3192
&wroteobjs, &written, DEFAULTCOLOR);
3195
if ((spec->thisinst->scale != 1.0) || (spec->thisinst->rotation != 0)) {
3196
fprintf(ps, "%3.2f %d ", spec->thisinst->scale,
3197
spec->thisinst->rotation);
3199
printparams(ps, spec->thisinst, 0);
3200
fprintf(ps, "/%s libinst\n", spec->thisinst->thisobject->name);
3201
if ((spec->next != NULL) && (!(spec->next->virtual)))
3071
3206
setassaved(wroteobjs, written);
3111
3246
/* Main file saving routine */
3112
3247
/*----------------------------------------------------------------------*/
3114
void savefile(objectptr localdata, short mode)
3249
void savefile(short mode)
3116
3251
FILE *ps, *pro;
3117
3252
char outname[150], temp[150], prologue[150], *fname, *fptr;
3118
short written = 0, fontsused[256], i, page, curpage, multipage, savepage, stcount;
3119
objectptr *wroteobjs, writepage, *mpages;
3120
int *mpageno, findex;
3253
short written = 0, fontsused[256], i, page, curpage, multipage;
3254
short savepage, stcount, *pagelist;
3255
objectptr *wroteobjs;
3256
objinstptr writepage;
3121
3258
float psscale, psnorm;
3122
3259
float xmargin = 72.0, ymargin = 72.0;
3260
int bboxx, bboxy, width, height;
3126
if (mode == CURRENT_PAGE)
3264
if (mode != ALL_PAGES)
3127
3265
fname = xobjs.pagelist[areastruct.page]->filename;
3129
3267
/* doubly-protected backup: protect against errors during file write */
3135
3273
if ((fptr = strrchr(fname, '/')) == NULL) fptr = fname;
3136
if ((mode == CURRENT_PAGE) && (strchr(fptr, '.') == NULL))
3274
if ((mode != ALL_PAGES) && (strchr(fptr, '.') == NULL))
3137
3275
sprintf(outname, "%s.ps", fname);
3138
3276
else sprintf(outname, "%s", fname);
3140
tilde_expand(outname);
3278
xc_tilde_expand(outname);
3142
3280
ps = fopen(outname, "w");
3143
3281
if (ps == NULL) {
3148
3286
/* calculate the bounding box of the drawing */
3289
width = toplevelwidth(areastruct.topinstance);
3290
height = toplevelheight(areastruct.topinstance);
3292
width = topobject->bbox.width;
3293
height = topobject->bbox.height;
3150
3296
/* find margins */
3152
3298
psscale = getpsscale(xobjs.pagelist[areastruct.page]->outscale, areastruct.page);
3153
3299
if (xobjs.pagelist[areastruct.page]->pmode & 1) {
3154
3300
if (xobjs.pagelist[areastruct.page]->orient == 90) {
3155
3301
xmargin = (xobjs.pagelist[areastruct.page]->pagesize.x -
3156
((float)localdata->height * psscale)) / 2;
3302
((float)height * psscale)) / 2;
3157
3303
ymargin = (xobjs.pagelist[areastruct.page]->pagesize.y -
3158
((float)localdata->width * psscale)) / 2;
3304
((float)width * psscale)) / 2;
3161
3307
xmargin = (xobjs.pagelist[areastruct.page]->pagesize.x -
3162
((float)localdata->width * psscale)) / 2;
3308
((float)width * psscale)) / 2;
3163
3309
ymargin = (xobjs.pagelist[areastruct.page]->pagesize.y -
3164
((float)localdata->height * psscale)) / 2;
3310
((float)height * psscale)) / 2;
3170
3316
/* circuit and give them the same filename, so that they will be saved */
3171
3317
/* together as a set. */
3173
if (areastruct.schemon) {
3319
if ((areastruct.schemon) && (mode != NO_SUBCIRCUITS)) {
3174
3320
Wprintf("Gathering all subcircuits. . .");
3175
if (findsubschems(areastruct.page, objectdata, 0) == -1)
3176
Wprintf("Error: Check for recursion in circuit!");
3321
collectsubschems(areastruct.page);
3180
/* check for multiple-page output: get the number of pages */
3325
/* Check for multiple-page output: get the number of pages; */
3326
/* ignore empty pages. */
3183
mpages = (objectptr *) malloc (sizeof(objectptr));
3184
mpageno = (int *) malloc (sizeof(int));
3185
3329
savepage = areastruct.page;
3187
for (page = 0; page < xobjs.pages; page++) {
3188
writepage = xobjs.pagelist[page]->pageobj;
3189
if (writepage != NULL)
3190
if ((mode == ALL_PAGES) || (!strcmp(xobjs.pagelist[page]->filename,
3191
xobjs.pagelist[areastruct.page]->filename))) {
3193
mpages = (objectptr *)realloc(mpages, multipage * sizeof(objectptr));
3194
mpageno = (int *)realloc(mpageno, multipage * sizeof(int));
3195
mpages[multipage - 1] = writepage;
3196
mpageno[multipage - 1] = page;
3331
if (mode == NO_SUBCIRCUITS)
3332
pagelist = pagetotals(areastruct.page, INDEPENDENT);
3333
else if (mode == ALL_PAGES)
3334
pagelist = pagetotals(areastruct.page, ALL_PAGES);
3336
pagelist = pagetotals(areastruct.page, TOTAL_PAGES);
3338
for (page = 0; page < xobjs.pages; page++)
3339
if (pagelist[page] > 0)
3199
3342
if (multipage == 0) {
3200
3343
Wprintf("Panic: could not find this page in page list!");
3216
3358
tdate = time(NULL);
3217
3359
fprintf(ps, "%%%%CreationDate: %s", asctime(localtime(&tdate)));
3218
3360
fprintf(ps, "%%%%Pages: %d\n", multipage);
3219
3362
if (xobjs.pagelist[areastruct.page]->orient == 90) {
3220
bboxx = (int)((float)localdata->height * psscale) + (int)xmargin + 4;
3221
bboxy = (int)((float)localdata->width * psscale) + (int)ymargin + 4;
3363
bboxx = (int)((float)height * psscale) + (int)xmargin + 4;
3364
bboxy = (int)((float)width * psscale) + (int)ymargin + 4;
3224
bboxx = (int)((float)localdata->width * psscale) + (int)xmargin + 4;
3225
bboxy = (int)((float)localdata->height * psscale) + (int)ymargin + 4;
3367
bboxx = (int)((float)width * psscale) + (int)xmargin + 4;
3368
bboxy = (int)((float)height * psscale) + (int)ymargin + 4;
3227
3370
/* in order to reconstruct the page size, it is necessary that the */
3228
3371
/* bounding box extent + margin = page size. This of course assumes */
3242
3385
/* find all of the fonts used in this document */
3243
3386
/* log all fonts which are native PostScript */
3245
for (page = 0; page < multipage; page++) {
3246
writepage = mpages[page];
3247
findfonts(writepage, fontsused);
3250
for(i = 0; i <= fontcount; i++) {
3388
for (curpage = 0; curpage < xobjs.pages; curpage++)
3389
if (pagelist[curpage] > 0) {
3390
writepage = xobjs.pagelist[curpage]->pageinst;
3391
findfonts(writepage->thisobject, fontsused);
3394
for (i = 0; i <= fontcount; i++) {
3251
3395
if (fontsused[i] & 0x8000)
3252
3396
if ((fonts[i].flags & 0x8018) == 0x0) {
3253
3397
stcount += strlen(fonts[i].psname) + 6;
3262
3406
fprintf(ps, "\n%%%%EndComments\n");
3264
sprintf(prologue, "%s/%s", PROLOGUE_DIR, PROLOGUE_FILE);
3265
pro = fopen(prologue, "r");
3408
tmp_s = getenv((const char *)"XCIRCUIT_LIB_DIR");
3409
if (tmp_s != NULL) {
3410
sprintf(prologue, "%s/%s", tmp_s, PROLOGUE_FILE);
3411
pro = fopen(prologue, "r");
3266
3416
if (pro == NULL) {
3267
sprintf(prologue, "%s", PROLOGUE_FILE);
3417
sprintf(prologue, "%s/%s", PROLOGUE_DIR, PROLOGUE_FILE);
3268
3418
pro = fopen(prologue, "r");
3269
3419
if (pro == NULL) {
3270
Wprintf("Can't open prolog.");
3420
sprintf(prologue, "%s", PROLOGUE_FILE);
3421
pro = fopen(prologue, "r");
3423
Wprintf("Can't open prolog.");
3335
3488
wroteobjs = (objectptr *) malloc (sizeof(objectptr));
3337
for (page = 0; page < multipage; page++) {
3338
writepage = mpages[page];
3339
curpage = mpageno[page];
3491
for (curpage = 0; curpage < xobjs.pages; curpage++) {
3492
if (pagelist[curpage] == 0) continue;
3494
writepage = xobjs.pagelist[curpage]->pageinst;
3497
width = toplevelwidth(writepage);
3498
height = toplevelheight(writepage);
3500
width = writepage->thisobject->bbox.width;
3501
height = writepage->thisobject->bbox.height;
3341
3504
psnorm = xobjs.pagelist[curpage]->outscale;
3342
3505
psscale = getpsscale(psnorm, curpage);
3343
3506
if (xobjs.pagelist[curpage]->pmode & 1) {
3344
3507
if (xobjs.pagelist[curpage]->orient == 90) {
3345
3508
xmargin = (xobjs.pagelist[curpage]->pagesize.x -
3346
((float)writepage->height * psscale)) / 2;
3509
((float)height * psscale)) / 2;
3347
3510
ymargin = (xobjs.pagelist[curpage]->pagesize.y -
3348
((float)writepage->width * psscale)) / 2;
3511
((float)width * psscale)) / 2;
3351
3514
xmargin = (xobjs.pagelist[curpage]->pagesize.x -
3352
((float)writepage->width * psscale)) / 2;
3515
((float)width * psscale)) / 2;
3353
3516
ymargin = (xobjs.pagelist[curpage]->pagesize.y -
3354
((float)writepage->height * psscale)) / 2;
3517
((float)height * psscale)) / 2;
3358
3521
/* Write all of the object definitions used, bottom up */
3360
printobjects(ps, writepage, psnorm, xmargin, ymargin, page + 1,
3361
mpageno[page], &wroteobjs, &written, DEFAULTCOLOR);
3523
printobjects(ps, writepage->thisobject, psnorm, xmargin, ymargin, ++page,
3524
curpage, &wroteobjs, &written, DEFAULTCOLOR);
3362
3525
fprintf(ps, "pgsave restore showpage\n");
3364
3527
/* For crash recovery, log the filename for each page */
3393
3556
else { /* No unsaved changes in these objects */
3394
3557
setassaved(wroteobjs, written);
3395
setassaved(mpages, multipage);
3558
for (i = 0; i < xobjs.pages; i++)
3559
if (pagelist[i] > 0)
3560
xobjs.pagelist[i]->pageinst->thisobject->changes = 0;
3396
3561
xobjs.new_changes = countchanges(NULL);
3564
/* Free allocated memory */
3565
free((char *)pagelist);
3566
free((char *)wroteobjs);
3446
3611
/* Write string to PostScript string, ignoring NO_OPs */
3447
3612
/*----------------------------------------------------*/
3449
int nosprint(char *sptr)
3614
char *nosprint(char *sptr)
3451
u_char *pptr, *qptr = _STR;
3616
int qtmp, slen = 100;
3617
u_char *pptr, *qptr, *bptr;
3619
bptr = (u_char *)malloc(slen); /* initial length 100 */
3456
3624
/* Includes extended character set (non-ASCII) */
3458
3626
for (pptr = sptr; pptr && *pptr != '\0'; pptr++) {
3627
/* Ensure enough space for the string, including everything following the "for" loop */
3629
if (qtmp + 7 >= slen) {
3631
bptr = (char *)realloc(bptr, slen);
3635
/* Deal with non-printable characters and parentheses */
3459
3636
if (*pptr > (char)126) {
3460
3637
sprintf(qptr, "\\%3o", (int)(*pptr));
3500
3677
strcpy(ostr[segs], "()");
3503
writesegment(chrptr, &lastscale, &lastfont);
3504
ostr[segs] = (char *)malloc(1 + strlen(_STR));
3505
strcpy(ostr[segs], _STR);
3680
tmpstr = writesegment(chrptr, &lastscale, &lastfont);
3681
if (tmpstr[0] != '\0')
3682
ostr[segs] = tmpstr;
3523
3702
/* (Recursive, so we can write segments in the reverse order) */
3524
3703
/*--------------------------------------------------------------*/
3526
void writesegment(stringpart *chrptr, float *lastscale, int *lastfont)
3705
char *writesegment(stringpart *chrptr, float *lastscale, int *lastfont)
3528
3707
int type = chrptr->type;
3530
3711
case PARAM_START:
3531
3712
sprintf(_STR, "v%d ", chrptr->data.paramno + 1);
3601
3782
sprintf(_STR, "{%d %d Kn} ", chrptr->data.kern[0], chrptr->data.kern[1]);
3603
3784
case TEXT_STRING:
3604
nosprint(chrptr->data.string);
3785
/* Everything except TEXT_STRING will always fit in the _STR fixed-length character array. */
3786
return nosprint(chrptr->data.string);
3789
retstr = (char *)malloc(1 + strlen(_STR));
3790
strcpy(retstr, _STR);
3609
3794
/*--------------------------------------------------------------*/
3761
3940
fprintf (ps, "/pgsave save def bop\n");
3942
origin = localdata->bbox.lowerleft;
3943
corner.x = origin.x + localdata->bbox.width;
3944
corner.y = origin.y + localdata->bbox.height;
3764
3947
if (localdata->symschem != NULL) {
3765
3948
fprintf(ps, "%% %s is_symbol\n", localdata->symschem->name);
3951
/* For a page, extend bounding box around schematic pins */
3952
extendschembbox(xobjs.pagelist[mpage]->pageinst, &origin, &corner);
3769
xaddin = (int)(xmargin / psscale) - localdata->lowerleft.x;
3770
yaddin = (int)(ymargin / psscale) - localdata->lowerleft.y;
3955
xaddin = (int)(xmargin / psscale) - origin.x;
3956
yaddin = (int)(ymargin / psscale) - origin.y;
3771
3957
fprintf(ps, "%% %hd %hd offsets\n", xaddin, yaddin);
3773
3959
if (xobjs.pagelist[mpage]->drawingscale.x != 1
3783
3969
if (xobjs.pagelist[mpage]->background.name != (char *)NULL) {
3784
3970
float iscale = (xobjs.pagelist[mpage]->coordstyle == CM) ? CMSCALE : INCHSCALE;
3785
fprintf(ps, "%d %d insertion\n",
3786
(int)((float)xaddin * iscale), (int)((float)yaddin * iscale));
3971
if (xobjs.pagelist[mpage]->orient == 90)
3972
fprintf(ps, "%5.4f %d %d 90 psinsertion\n", psnorm,
3973
(int)((float)xaddin * iscale * psnorm) + (int)(ymargin - xmargin),
3974
(int)((float)yaddin * iscale * psnorm) -
3975
((int)((float)(corner.y - origin.y) * psscale) +
3976
(int)(xmargin + ymargin)));
3978
fprintf(ps, "%5.4f %d %d 0 psinsertion\n", psnorm,
3979
(int)((float)xaddin * iscale * psnorm),
3980
(int)((float)yaddin * iscale * psnorm));
3787
3981
savebackground(ps, xobjs.pagelist[mpage]->background.name);
3788
fprintf(ps, "end_insert\n");
3982
fprintf(ps, "\nend_insert\n");
3791
3985
if (xobjs.pagelist[mpage]->orient == 90)
3792
3986
fprintf(ps, "90 rotate %d %d translate\n", (int)(ymargin - xmargin),
3793
-((int)((float)localdata->height * psscale) +
3987
-((int)((float)(corner.y - origin.y) * psscale) +
3794
3988
(int)(xmargin + ymargin)));
3796
3990
fprintf(ps, "%5.4f ", psnorm);
3828
4022
if (psscale == 0) {
3829
4023
fprintf(ps, "/%s {\n", localdata->name);
3831
sprintf(_STR, "%% %hd %hd %hd %hd bbox\n", localdata->lleft2.x,
3832
localdata->lleft2.y, localdata->_width, localdata->height);
3834
sprintf(_STR, "%% %hd %hd %hd %hd bbox\n", localdata->lowerleft.x,
3835
localdata->lowerleft.y, localdata->_width, localdata->height);
4024
/* No longer writes "bbox" record */
3838
4025
if (localdata->hidden == True) fprintf(ps, "%% hidden\n");
4140
4322
if (psscale == 0) fprintf(ps, "endgate\n} def\n\n");
4144
/* If saving was successful, then set object "changed" flag to show */
4145
/* that there are no unsaved changes in the object. */
4148
4327
/*----------------------------------------------------------------------*/