rich@RICE.EDU (Richard Murphey) (06/12/89)
Does anyone have suggestions on how to configure ghostscript 1.2 for X11R3 and SunOS 3.5 using gcc-1.35? I have managed to compile and run gs and would welcome any advice on how to configure it better for X11. Thanks, Rich now, on to the report... In building the X window version of ghostscript version 1.2 using gcc version 1.35, the compiler reports errors for structures declared inside parameter lists, several function prototypes and for the initializer of `x_device.' The following context diffs eliminate these errors and have produced a working version of gs for this configuration. Configuration: Sun3/260, Sun UNIX 4.2 Release 3.5, gcc-1.35, X11R3 Symptom: gcc -ansi -g -c gsfont.c gxfont.h:29: warning: `struct gs_show_enum_s' declared inside parameter list gxfont.h:29: warning: such a name is accessible only within its parameter list, gxfont.h:29: warning: which is probably not what you want. gxfont.h:32: warning: `struct gs_show_enum_s' declared inside parameter list gsfont.c:189: warning: `struct gs_show_enum_s' declared inside parameter list gsfont.c: In function gs_no_build_char_proc: gsfont.c:190: conflicting types for `gs_no_build_char_proc' gxfont.h:32: previous declaration of `gs_no_build_char_proc' *** Error code 1 gcc -ansi -g -c gxdraw.c gxdraw.c: In function gx_default_draw_line: gxdraw.c:234: number of arguments doesn't match prototype gxdraw.c: In function gx_default_fill_trapezoid: gxdraw.c:235: number of arguments doesn't match prototype gxdraw.c: In function gx_default_tile_trapezoid: gxdraw.c:236: number of arguments doesn't match prototype *** Error code 1 gcc -ansi -g -c gdevx.c gdevx.c:141: initializer for scalar variable requires one element gdevx.c: In function alt_put_image: gdevx.c:461: warning: `alt_put_image' was declared `extern' and later `static' gdevx.c:154: warning: previous declaration of `alt_put_image' *** Error code 1 The diffs which have worked for me: diff -cb gss/gdevx.c gs/gdevx.c *** gss/gdevx.c Fri Feb 24 03:25:25 1989 --- gs/gdevx.c Thu Jun 8 23:15:48 1989 *************** *** 121,127 **** } gx_device_X; /* The instance is public. */ ! gx_device_X x_device = { sizeof(gx_device_X), &x_procs, 640, 350, /* x and y extent */ --- 121,128 ---- } gx_device_X; /* The instance is public. */ ! struct gx_device_X_s x_device = ! { sizeof(gx_device_X), &x_procs, 640, 350, /* x and y extent */ *************** *** 131,144 **** 1, /* bits per color pixel */ /* End of monochrome/color parameters */ 1, /* bit-big-endian (for now) */ ! 0, /* connection not initialized */ ! { 0, 0, /* width, height */ 0, XYBitmap, NULL, /* xoffset, format, data */ LSBFirst, 8, /* byte-order, bitmap-unit */ ! MSBFirst, 8, 1 /* bitmap-bit-order, bitmap-pad, depth */ } - }; /* Macro for casting gx_device argument */ #define xdev ((gx_device_X *)dev) --- 132,179 ---- 1, /* bits per color pixel */ /* End of monochrome/color parameters */ 1, /* bit-big-endian (for now) */ ! /* 0, */ /* connection not initialized */ ! { ! 0, 0, /* width, height */ 0, XYBitmap, NULL, /* xoffset, format, data */ LSBFirst, 8, /* byte-order, bitmap-unit */ ! MSBFirst, 8, 1, /* bitmap-bit-order, bitmap-pad, depth */ ! 0, /* bytes_per_line */ ! 1, /* bits_per_pixel */ ! 0, /* red_mask */ ! 0, /* green_mask */ ! 0, /* blue_mask */ ! 0x0, /* obdata */ ! { ! 0x0, /* create_image */ ! 0x0, /* destroy_image */ ! 0x0, /* get_pixel */ ! 0x0, /* put_pixel */ ! 0x0, /* sub_image */ ! 0x0 /* add_pixel */ } + }, + 0x0, /* dpy */ + 0x0, /* scr */ + 0x0, /* vis */ + 0, /* cmap */ + 0, /* win */ + 0x0, /* gc */ + { + 0, /* pixmap */ + 0, /* no_pixmap */ + 0, /* width */ + 0, /* height */ + 0, /* raster */ + 0x0, /* bits */ + 0 /* bits_size */ + }, /* ht */ + 0, /* fill_style */ + {0, 0, 0, 0, 0, 0, 0, 0}, /* colors */ + 0, /* back_color */ + 0 /*fore_color */ + }; /* x_device */ /* Macro for casting gx_device argument */ #define xdev ((gx_device_X *)dev) diff -cb gss/gsfont.c gs/gsfont.c *** gss/gsfont.c Fri Feb 24 03:05:13 1989 --- gs/gsfont.c Fri Jun 9 00:07:31 1989 *************** *** 185,191 **** /* Dummy (ineffective) BuildChar procedure */ int ! gs_no_build_char_proc(struct gs_show_enum_s *penum, gs_state *pgs, ! gs_font *pfont, int chr, char *data) { return 1; /* failure, but not error */ } --- 185,197 ---- /* Dummy (ineffective) BuildChar procedure */ int ! gs_no_build_char_proc(P5(char *penum, struct gs_state_s *pgs, ! struct gs_font_s *pfont, int chr, char *data)) { return 1; /* failure, but not error */ } diff -cb gss/gxdevice.h gs/gxdevice.h *** gss/gxdevice.h Fri Feb 24 01:39:43 1989 --- gs/gxdevice.h Thu Jun 8 22:51:57 1989 *************** *** 59,65 **** /* gx_default_proc, e.g. gx_default_tile_rectangle. */ /* The device procedure can also call this procedure */ /* if it doesn't implement the function for particular */ ! /* values of the arguments. * /* Open the device. OPTIONAL */ int (*open_device)(P1(gx_device *)); --- 59,65 ---- /* gx_default_proc, e.g. gx_default_tile_rectangle. */ /* The device procedure can also call this procedure */ /* if it doesn't implement the function for particular */ ! /* values of the arguments. */ /* Open the device. OPTIONAL */ int (*open_device)(P1(gx_device *)); diff -cb gss/gxdraw.c gs/gxdraw.c *** gss/gxdraw.c Fri Feb 24 03:13:25 1989 --- gs/gxdraw.c Thu Jun 8 23:41:40 1989 *************** *** 231,236 **** } /****** STUBS ******/ ! int gx_default_draw_line() { return -1; } ! int gx_default_fill_trapezoid() { return -1; } ! int gx_default_tile_trapezoid() { return -1; } --- 231,236 ---- } /****** STUBS ******/ ! int gx_default_draw_line(gx_device *a, int s, int d, int f, int q, int w) { return -1; } ! int gx_default_fill_trapezoid(gx_device *a, int s, int d, int f, int q, int w, int e, int r) { return -1; } ! int gx_default_tile_trapezoid(gx_device *q, gx_bitmap *w, int e, int r, int a, int s, int d, int f, int z, int x) { return -1; } diff -cb gss/gxfont.h gs/gxfont.h *** gss/gxfont.h Fri Feb 24 01:41:14 1989 --- gs/gxfont.h Fri Jun 9 00:07:27 1989 *************** *** 28,34 **** (P5(struct gs_show_enum_s *, struct gs_state_s *, struct gs_font_s *, int /* char code */, char * /* build_char_data */)); int gs_no_build_char_proc ! (P5(struct gs_show_enum_s *, struct gs_state_s *, struct gs_font_s *, int, char *)); struct gs_font_s { gs_font *next, *prev; /* chain for scaled font cache */ --- 28,34 ---- (P5(struct gs_show_enum_s *, struct gs_state_s *, struct gs_font_s *, int /* char code */, char * /* build_char_data */)); int gs_no_build_char_proc ! (P5(char *, struct gs_state_s *, struct gs_font_s *, int, char *)); struct gs_font_s { gs_font *next, *prev; /* chain for scaled font cache */ diff -cb gss/ux-gcc-x.mak gs/ux-gcc-x.mak *** gss/ux-gcc-x.mak Fri Feb 24 00:45:31 1989 --- gs/ux-gcc-x.mak Fri Jun 9 00:21:08 1989 *************** *** 28,43 **** # -DDEBUG enables debugging features in the language interpreter. # -Dgs_DEBUG enables debugging features in the library. ! CCDEBUG= # Define the other compilation flags. ! CFLAGS=-O -ansi # Define platform flags for ld. # The following are appropriate for Sun OS4.0. ! LDPLAT=-Bstatic # ---------------------------- End of options --------------------------- # --- 28,44 ---- # -DDEBUG enables debugging features in the language interpreter. # -Dgs_DEBUG enables debugging features in the library. ! CCDEBUG=-g # Define the other compilation flags. ! CFLAGS=-ansi # Define platform flags for ld. # The following are appropriate for Sun OS4.0. ! #LDPLAT=-Bstatic ! LDPLAT= # ---------------------------- End of options --------------------------- # *************** *** 97,100 **** GSUNIX=gs.$(OBJ) gsmain.$(OBJ) utrace.$(OBJ) $(INT) gs_lib0.$(OBJ) gdevx.$(OBJ) gs: $(GSUNIX) ! cc $(CFLAGS) $(LDPLAT) -X -o gs $(GSUNIX) -lX11 -lm --- 98,101 ---- GSUNIX=gs.$(OBJ) gsmain.$(OBJ) utrace.$(OBJ) $(INT) gs_lib0.$(OBJ) gdevx.$(OBJ) gs: $(GSUNIX) ! gcc $(CFLAGS) $(LDPLAT) -o gs $(GSUNIX) -lX11 -lm Thanks for any advice you can offer, Rich Murphey Electrical Engineering Rice University rich@rice.edu