1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* readobj2.c - routines for reading in object descriptions. |
6 |
|
*/ |
15 |
|
|
16 |
|
extern char *fgetword(); |
17 |
|
|
18 |
< |
OBJREC *objblock[MAXOBJBLK]; /* our objects */ |
22 |
< |
OBJECT nobjects = 0; /* # of objects */ |
23 |
< |
int newobject() {return(0);} |
24 |
< |
|
25 |
< |
|
26 |
< |
readobj(input, callback) /* read in an object file or stream */ |
18 |
> |
readobj2(input, callback) /* read in an object file or stream */ |
19 |
|
char *input; |
20 |
|
int (*callback)(); |
21 |
|
{ |
45 |
|
} else if (c == '!') { /* command */ |
46 |
|
ungetc(c, infp); |
47 |
|
fgetline(buf, sizeof(buf), infp); |
48 |
< |
readobj(buf, callback); |
48 |
> |
readobj2(buf, callback); |
49 |
|
} else { /* object */ |
50 |
|
ungetc(c, infp); |
51 |
< |
getobject(input, infp, callback); |
51 |
> |
getobject2(input, infp, callback); |
52 |
|
} |
53 |
|
} |
54 |
|
if (input[0] == '!') |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
< |
getobject(name, fp, f) /* read the next object */ |
61 |
> |
getobject2(name, fp, f) /* read the next object */ |
62 |
|
char *name; |
63 |
|
FILE *fp; |
64 |
|
int (*f)(); |
92 |
|
/* call function */ |
93 |
|
(*f)(&thisobj); |
94 |
|
/* free memory */ |
103 |
– |
if (thisobj.os != NULL) |
104 |
– |
switch (thisobj.otype) { |
105 |
– |
case OBJ_CONE: |
106 |
– |
case OBJ_CUP: |
107 |
– |
case OBJ_CYLINDER: |
108 |
– |
case OBJ_TUBE: |
109 |
– |
case OBJ_RING: |
110 |
– |
freecone(&thisobj); |
111 |
– |
break; |
112 |
– |
case OBJ_FACE: |
113 |
– |
freeface(&thisobj); |
114 |
– |
break; |
115 |
– |
case OBJ_INSTANCE: |
116 |
– |
freeinstance(&thisobj); |
117 |
– |
break; |
118 |
– |
} |
95 |
|
freefargs(&thisobj.oargs); |
96 |
+ |
free_os(&thisobj); |
97 |
|
} |