summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-13 15:55:19 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-13 15:55:19 -0200
commit04b994830dfebfed9311f1c3714620ebbdc1f75a (patch)
tree027b6643d7b0984a89302abd0ea2bb8f1387209b
parentd662fac7b6541571ab9852f4e0290d48f0e97561 (diff)
Ansification and compile warning fixes.
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and most gcc 4.3 and sparse warnings.
-rw-r--r--.gitignore5
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac15
-rw-r--r--lex.l2
-rw-r--r--main.c141
-rw-r--r--main.h148
6 files changed, 162 insertions, 154 deletions
diff --git a/.gitignore b/.gitignore
index 9be51e2..2fa1107 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,8 @@ stamp-h1
xgc
xgc.1
*~
+*.o
+ylwrap
+xgc-*.tar.*
+ChangeLog
+tags
diff --git a/Makefile.am b/Makefile.am
index 4601ca0..55a7ec4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,7 +35,6 @@ xgc_SOURCES = \
interpret.c \
lex.l \
main.c \
- main.h \
planemask.c \
record.c \
testfrac.c \
@@ -53,6 +52,8 @@ gram.h: gram.c
# App default files
+DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults
+
appdefaultdir = @appdefaultdir@
dist_appdefault_DATA = \
@@ -106,6 +107,6 @@ MAINTAINERCLEANFILES += ChangeLog
.PHONY: ChangeLog
ChangeLog:
- (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+ $(CHANGELOG_CMD)
dist-hook: ChangeLog
diff --git a/configure.ac b/configure.ac
index b51bdb7..0d6daf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,23 +26,34 @@ AC_INIT(xgc,[1.0.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],x
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
+# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.2)
+
AM_CONFIG_HEADER(config.h)
+XORG_CWARNFLAGS
+
AC_PROG_LEX
AC_PROG_YACC
AC_PROG_CC
AC_PROG_INSTALL
PKG_CHECK_MODULES(XGC, xaw7)
-
+XGC_CFLAGS="$CWARNFLAGS $XGC_FLAGS"
AC_SUBST(XGC_CFLAGS)
AC_SUBST(XGC_LIBS)
PKG_CHECK_MODULES(APPDEFS, xt)
-appdefaultdir=$(pkg-config --variable=appdefaultdir xt)
+xt_appdefaultdir=$(pkg-config --variable=appdefaultdir xt)
+AC_ARG_WITH(appdefaultdir,
+ AC_HELP_STRING([--with-appdefaultdir=<pathname>],
+ [specify directory for app-defaults files (default is autodetected)]),
+ [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
AC_SUBST(appdefaultdir)
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+XORG_CHANGELOG
AC_OUTPUT([Makefile])
diff --git a/lex.l b/lex.l
index 268d9f9..6a7f6e0 100644
--- a/lex.l
+++ b/lex.l
@@ -166,5 +166,5 @@ PieSlice { yylval.num = ArcPieSlice;
%%
#ifndef yywrap
-int yywrap() { return (1); }
+int yywrap(void) { return (1); }
#endif
diff --git a/main.c b/main.c
index dcf277b..0002350 100644
--- a/main.c
+++ b/main.c
@@ -49,7 +49,6 @@ from the X Consortium.
#include "xgc.h"
#define DEFINE_TILE
#include "tile"
-#include "main.h"
static void fill_up_commandform(Widget);
static void quit(void);
@@ -58,6 +57,146 @@ static void clear_test_window(void);
static void clear_result_window(void);
static void set_foreground_and_background(void);
+/* The three columns in the XgcData arrays are:
+** name: the name of the toggle button
+** text: the corresponding text in the xgc syntax
+** code: the integer that the text corresponds to, for sending stuff
+** to X calls, etc.
+*/
+
+static XgcData FunctionData[NUM_FUNCTIONS] = {
+ {"clear", "clear", GXclear},
+ {"and", "and", GXand},
+ {"andReverse", "andReverse", GXandReverse},
+ {"copy", "copy", GXcopy},
+ {"andInverted", "andInverted", GXandInverted},
+ {"noop", "noop", GXnoop},
+ {"xor", "xor", GXxor},
+ {"or", "or", GXor},
+ {"nor", "nor", GXnor},
+ {"equiv", "equiv", GXequiv},
+ {"invert", "invert", GXinvert},
+ {"orReverse", "orReverse", GXorReverse},
+ {"copyInverted", "copyInverted", GXcopyInverted},
+ {"orInverted", "orInverted", GXorInverted},
+ {"nand", "nand", GXnand},
+ {"set", "set", GXset}
+};
+
+/* The two rows in the XgcStuff structure are:
+** name of label, xgc syntax text, # of toggles, # of columns of toggles
+** (0 columns means 1 row, as many columns as necessary)
+** appropriate XgcData
+*/
+
+XgcStuff FunctionStuff = {
+ {"Function","function",NUM_FUNCTIONS,4},
+ FunctionData
+};
+
+static XgcData TestData[NUM_TESTS] = {
+ {"Copy Area", "CopyArea", CopyArea},
+ {"Copy Plane", "CopyPlane", CopyPlane},
+ {"Points", "PolyPoint", PolyPoint},
+ {"Lines", "PolyLine", PolyLine},
+ {"Segments", "PolySegment", PolySegment},
+ {"Rectangles", "PolyRectangle", PolyRectangle},
+ {"Arcs", "PolyArc", PolyArc},
+ {"(Filled Polygons)", "FillPolygon", FillPolygon},
+ {"Filled Rectangles", "PolyFillRect", PolyFillRect},
+ {"Filled Arcs", "PolyFillArc", PolyFillArc},
+ {"Put Image", "PutImage", PutImage},
+ {"(Get Image)", "GetImage", GetImage},
+ {"Text 8", "PolyText8", PolyText8},
+ {"Image Text 8", "ImageText8", ImageText8},
+ {"Text 16", "PolyText16", PolyText16},
+ {"Image Text 16", "ImageText16", ImageText16}
+};
+
+XgcStuff TestStuff = {
+ {"Test","test",NUM_TESTS,2},
+ TestData
+};
+
+static XgcData LinestyleData[NUM_LINESTYLES] = {
+ {"Solid", "Solid", LineSolid},
+ {"OnOffDash", "OnOffDash", LineOnOffDash},
+ {"DoubleDash", "DoubleDash", LineDoubleDash}
+};
+
+XgcStuff LinestyleStuff = {
+ {"LineStyle","linestyle",NUM_LINESTYLES,0},
+ LinestyleData
+};
+
+static XgcData CapstyleData[NUM_CAPSTYLES] = {
+ {"NotLast", "NotLast", CapNotLast},
+ {"Butt", "Butt", CapButt},
+ {"Round", "Round", CapRound},
+ {"Projecting", "Projecting", CapProjecting}
+};
+
+XgcStuff CapstyleStuff = {
+ {"CapStyle","capstyle",NUM_CAPSTYLES,2},
+ CapstyleData
+};
+
+static XgcData JoinstyleData[NUM_JOINSTYLES] = {
+ {"Miter", "Miter", JoinMiter},
+ {"Round", "Round", JoinRound},
+ {"Bevel", "Bevel", JoinBevel}
+};
+
+XgcStuff JoinstyleStuff = {
+ {"JoinStyle","joinstyle",NUM_JOINSTYLES,0},
+ JoinstyleData
+};
+
+static XgcData FillstyleData[NUM_FILLSTYLES] = {
+ {"Solid", "Solid", FillSolid},
+ {"Tiled", "Tiled", FillTiled},
+ {"Stippled", "Stippled", FillStippled},
+ {"OpaqueStippled", "OpaqueStippled", FillOpaqueStippled}
+};
+
+XgcStuff FillstyleStuff = {
+ {"FillStyle","fillstyle",NUM_FILLSTYLES,2},
+ FillstyleData
+};
+
+static XgcData FillruleData[NUM_FILLRULES] = {
+ {"EvenOdd", "EvenOdd", EvenOddRule},
+ {"Winding", "Winding", WindingRule}
+};
+
+XgcStuff FillruleStuff = {
+ {"FillRule","fillrule",NUM_FILLRULES,0},
+ FillruleData
+};
+
+static XgcData ArcmodeData[NUM_ARCMODES] = {
+ {"Chord", "Chord", ArcChord},
+ {"PieSlice", "PieSlice", ArcPieSlice}
+};
+
+XgcStuff ArcmodeStuff = {
+ {"ArcMode","arcmode",NUM_ARCMODES,0},
+ ArcmodeData
+};
+
+/* Pointers to all the Xgcstuffs so we can run them through a loop */
+
+static XgcStuff *Everything[8] = {
+ &FunctionStuff,
+ &LinestyleStuff,
+ &CapstyleStuff,
+ &JoinstyleStuff,
+ &FillstyleStuff,
+ &FillruleStuff,
+ &ArcmodeStuff,
+ &TestStuff
+};
+
#ifdef notdef
int fildes[2]; /* for pipe */
FILE *outend;
diff --git a/main.h b/main.h
deleted file mode 100644
index 7f0e7b9..0000000
--- a/main.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-** xgc
-**
-** xgc.h
-**
-** Initialization of structures, etc.
-*/
-/* $XFree86$ */
-
-/* The three columns in the XgcData arrays are:
-** name: the name of the toggle button
-** text: the corresponding text in the xgc syntax
-** code: the integer that the text corresponds to, for sending stuff
-** to X calls, etc.
-*/
-
-XgcData FunctionData[NUM_FUNCTIONS] = {
- {"clear", "clear", GXclear},
- {"and", "and", GXand},
- {"andReverse", "andReverse", GXandReverse},
- {"copy", "copy", GXcopy},
- {"andInverted", "andInverted", GXandInverted},
- {"noop", "noop", GXnoop},
- {"xor", "xor", GXxor},
- {"or", "or", GXor},
- {"nor", "nor", GXnor},
- {"equiv", "equiv", GXequiv},
- {"invert", "invert", GXinvert},
- {"orReverse", "orReverse", GXorReverse},
- {"copyInverted", "copyInverted", GXcopyInverted},
- {"orInverted", "orInverted", GXorInverted},
- {"nand", "nand", GXnand},
- {"set", "set", GXset}
-};
-
-/* The two rows in the XgcStuff structure are:
-** name of label, xgc syntax text, # of toggles, # of columns of toggles
-** (0 columns means 1 row, as many columns as necessary)
-** appropriate XgcData
-*/
-
-XgcStuff FunctionStuff = {
- {"Function","function",NUM_FUNCTIONS,4},
- FunctionData
-};
-
-XgcData TestData[NUM_TESTS] = {
- {"Copy Area", "CopyArea", CopyArea},
- {"Copy Plane", "CopyPlane", CopyPlane},
- {"Points", "PolyPoint", PolyPoint},
- {"Lines", "PolyLine", PolyLine},
- {"Segments", "PolySegment", PolySegment},
- {"Rectangles", "PolyRectangle", PolyRectangle},
- {"Arcs", "PolyArc", PolyArc},
- {"(Filled Polygons)", "FillPolygon", FillPolygon},
- {"Filled Rectangles", "PolyFillRect", PolyFillRect},
- {"Filled Arcs", "PolyFillArc", PolyFillArc},
- {"Put Image", "PutImage", PutImage},
- {"(Get Image)", "GetImage", GetImage},
- {"Text 8", "PolyText8", PolyText8},
- {"Image Text 8", "ImageText8", ImageText8},
- {"Text 16", "PolyText16", PolyText16},
- {"Image Text 16", "ImageText16", ImageText16}
-};
-
-XgcStuff TestStuff = {
- {"Test","test",NUM_TESTS,2},
- TestData
-};
-
-XgcData LinestyleData[NUM_LINESTYLES] = {
- {"Solid", "Solid", LineSolid},
- {"OnOffDash", "OnOffDash", LineOnOffDash},
- {"DoubleDash", "DoubleDash", LineDoubleDash}
-};
-
-XgcStuff LinestyleStuff = {
- {"LineStyle","linestyle",NUM_LINESTYLES,0},
- LinestyleData
-};
-
-XgcData CapstyleData[NUM_CAPSTYLES] = {
- {"NotLast", "NotLast", CapNotLast},
- {"Butt", "Butt", CapButt},
- {"Round", "Round", CapRound},
- {"Projecting", "Projecting", CapProjecting}
-};
-
-XgcStuff CapstyleStuff = {
- {"CapStyle","capstyle",NUM_CAPSTYLES,2},
- CapstyleData
-};
-
-XgcData JoinstyleData[NUM_JOINSTYLES] = {
- {"Miter", "Miter", JoinMiter},
- {"Round", "Round", JoinRound},
- {"Bevel", "Bevel", JoinBevel}
-};
-
-XgcStuff JoinstyleStuff = {
- {"JoinStyle","joinstyle",NUM_JOINSTYLES,0},
- JoinstyleData
-};
-
-XgcData FillstyleData[NUM_FILLSTYLES] = {
- {"Solid", "Solid", FillSolid},
- {"Tiled", "Tiled", FillTiled},
- {"Stippled", "Stippled", FillStippled},
- {"OpaqueStippled", "OpaqueStippled", FillOpaqueStippled}
-};
-
-XgcStuff FillstyleStuff = {
- {"FillStyle","fillstyle",NUM_FILLSTYLES,2},
- FillstyleData
-};
-
-XgcData FillruleData[NUM_FILLRULES] = {
- {"EvenOdd", "EvenOdd", EvenOddRule},
- {"Winding", "Winding", WindingRule}
-};
-
-XgcStuff FillruleStuff = {
- {"FillRule","fillrule",NUM_FILLRULES,0},
- FillruleData
-};
-
-XgcData ArcmodeData[NUM_ARCMODES] = {
- {"Chord", "Chord", ArcChord},
- {"PieSlice", "PieSlice", ArcPieSlice}
-};
-
-XgcStuff ArcmodeStuff = {
- {"ArcMode","arcmode",NUM_ARCMODES,0},
- ArcmodeData
-};
-
-/* Pointers to all the Xgcstuffs so we can run them through a loop */
-
-static XgcStuff *Everything[8] = {
- &FunctionStuff,
- &LinestyleStuff,
- &CapstyleStuff,
- &JoinstyleStuff,
- &FillstyleStuff,
- &FillruleStuff,
- &ArcmodeStuff,
- &TestStuff
-};