aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfig.c')
-rw-r--r--src/xfig.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/xfig.c b/src/xfig.c
index 10da5e4..913ba26 100644
--- a/src/xfig.c
+++ b/src/xfig.c
@@ -1,24 +1,33 @@
#include "project.h"
-BEGIN_OBJECT(Xfc)
- int r,g,b,n;
-END_OBJECT(Xfc)
-
-CREATOR(Xfc)=Obj_DefaultCreator;
-DESTRUCTOR(Xfc)=Obj_DefaultDestructor;
+OBJECT(Xfc,
+ int r;
+ int g;
+ int b;
+ int n;
+);
+
+CONSTRUCTOR(Xfc)=GObj_DefaultConstructor;
+DESTRUCTOR(Xfc)=GObj_DefaultDestructor;
-BEGIN_OBJECT(Private)
+OBJECT(Private,
Xfc_list xfcs;
int maxcol;
FILE *tmpfile;
FILE *file;
-END_OBJECT(Private)
+);
+
+static void private_constructor(Private);
+static void private_destructor(Private);
+
+CONSTRUCTOR(Private)=private_constructor;
+DESTRUCTOR(Private)=private_destructor;
static void private_constructor(Private p)
{
char name[1024];
-p->xfcs=CREATE_LIST(Xfc);
+p->xfcs=NEW_LIST(Xfc);
p->tmpfile=fopen(tmpnam(name),"w+");
@@ -28,12 +37,12 @@ unlink(name);
}
-#define BUFSIZ 1024
+#define XFIG_BUFSIZ 1024
static void private_destructor(Private p)
{
Xfc c;
-char buf[BUFSIZ];
+char buf[XFIG_BUFSIZ];
int i;
fflush(p->tmpfile);
@@ -54,7 +63,7 @@ Obj_Delete(p->xfcs);
printf("JWG: Writing xfig file\n");
-while ((i=fread(buf,1,BUFSIZ,p->tmpfile))>0) {
+while ((i=fread(buf,1,XFIG_BUFSIZ,p->tmpfile))>0) {
fwrite(buf,1,i,p->file);
}
@@ -69,8 +78,6 @@ free(p);
}
-CREATOR(Private)=private_constructor;
-DESTRUCTOR(Private)=private_destructor;
@@ -79,7 +86,7 @@ void xfig_init_private(Handle h)
{
Private p;
-p=CREATE_OBJ(Private);
+p=NEW(Private);
p->maxcol=32;
p->file=h->file;
@@ -109,13 +116,13 @@ if (p->maxcol==512) {
return(32);
}
-c=CREATE_OBJ(Xfc);
+c=NEW(Xfc);
c->r=r;
c->g=g;
c->b=b;
c->n=(p->maxcol++);
-Obj_Insert(p->xfcs,c,ObjInsertHead);
+GObj_InsertTail(p->xfcs,c);
return(c->n);