From 23281ed069ffeb0d2e94d0106cec6c93dde96c46 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 15 May 2012 03:17:39 +0000 Subject: [PATCH] Renamed a few files for consistency --- Makefile | 8 ++-- include/C99.h | 75 +++++++++++++++++++++++++++++++ include/{c99 => C99}/Makefile | 0 include/{c99 => C99}/project.conf | 0 include/{c99 => C99}/target.h | 0 include/Makefile | 6 +-- include/project.conf | 4 +- src/Makefile | 10 ++--- src/code.c | 2 +- src/project.conf | 10 ++--- src/target/Makefile | 24 +++++----- src/target/asm.c | 2 +- src/target/graph.c | 6 +-- src/target/indent.c | 2 +- src/target/project.conf | 12 ++--- 15 files changed, 118 insertions(+), 43 deletions(-) create mode 100644 include/C99.h rename include/{c99 => C99}/Makefile (100%) rename include/{c99 => C99}/project.conf (100%) rename include/{c99 => C99}/target.h (100%) diff --git a/Makefile b/Makefile index d764875..a9b9c44 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,12 @@ dist: $(PACKAGE)-$(VERSION)/doc/gtkdoc/tmpl/c99.sgml \ $(PACKAGE)-$(VERSION)/doc/gtkdoc/tmpl/target.sgml \ $(PACKAGE)-$(VERSION)/doc/gtkdoc/tmpl/project.conf \ - $(PACKAGE)-$(VERSION)/include/c99.h \ + $(PACKAGE)-$(VERSION)/include/C99.h \ $(PACKAGE)-$(VERSION)/include/Makefile \ $(PACKAGE)-$(VERSION)/include/project.conf \ - $(PACKAGE)-$(VERSION)/include/c99/target.h \ - $(PACKAGE)-$(VERSION)/include/c99/Makefile \ - $(PACKAGE)-$(VERSION)/include/c99/project.conf \ + $(PACKAGE)-$(VERSION)/include/C99/target.h \ + $(PACKAGE)-$(VERSION)/include/C99/Makefile \ + $(PACKAGE)-$(VERSION)/include/C99/project.conf \ $(PACKAGE)-$(VERSION)/src/c99.c \ $(PACKAGE)-$(VERSION)/src/code.c \ $(PACKAGE)-$(VERSION)/src/main.c \ diff --git a/include/C99.h b/include/C99.h new file mode 100644 index 0000000..0d4ca5b --- /dev/null +++ b/include/C99.h @@ -0,0 +1,75 @@ +/* $Id$ */ +/* Copyright (c) 2012 Pierre Pronchery */ +/* This file is part of DeforaOS Devel c99 */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#ifndef C99_C99_H +# define C99_C99_H + +# include + + +/* C99 */ +/* private */ +/* types */ +typedef struct _C99 C99; + + +/* public */ +/* types */ +typedef struct _C99Helper +{ + struct _C99 * c99; + int (*define_add)(C99 * c99, char const * name, char const * value); +} C99Helper; + +typedef struct _C99Option +{ + char const * name; + char const * value; +} C99Option; + +typedef struct _C99Prefs +{ + int flags; + char const * outfile; + const char ** paths; + size_t paths_cnt; + char ** defines; + size_t defines_cnt; + const char ** undefines; + size_t undefines_cnt; + int optlevel; + int warn; + char const * target; + C99Option * options; + size_t options_cnt; +} C99Prefs; +# define C99PREFS_c 0x1 +# define C99PREFS_E 0x2 +# define C99PREFS_g 0x4 +# define C99PREFS_s 0x8 + + +/* functions */ +C99 * c99_new(C99Prefs const * prefs, char const * pathname); +int c99_delete(C99 * c99); + +/* useful */ +int c99_define_add(C99 * c99, char const * name, char const * value); + +int c99_parse(C99 * c99); + +#endif /* !C99_C99_H */ diff --git a/include/c99/Makefile b/include/C99/Makefile similarity index 100% rename from include/c99/Makefile rename to include/C99/Makefile diff --git a/include/c99/project.conf b/include/C99/project.conf similarity index 100% rename from include/c99/project.conf rename to include/C99/project.conf diff --git a/include/c99/target.h b/include/C99/target.h similarity index 100% rename from include/c99/target.h rename to include/C99/target.h diff --git a/include/Makefile b/include/Makefile index ad4096c..dfe4866 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,4 +1,4 @@ -SUBDIRS = c99 +SUBDIRS = C99 PREFIX = /usr/local DESTDIR = RM ?= rm -f @@ -22,10 +22,10 @@ distclean: install: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done $(MKDIR) $(DESTDIR)$(INCLUDEDIR) - $(INSTALL) -m 0644 -- c99.h $(DESTDIR)$(INCLUDEDIR)/c99.h + $(INSTALL) -m 0644 -- C99.h $(DESTDIR)$(INCLUDEDIR)/C99.h uninstall: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done - $(RM) -- $(DESTDIR)$(INCLUDEDIR)/c99.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/C99.h .PHONY: all subdirs clean distclean install uninstall diff --git a/include/project.conf b/include/project.conf index baf2647..1fa5bf6 100644 --- a/include/project.conf +++ b/include/project.conf @@ -1,3 +1,3 @@ -subdirs=c99 +subdirs=C99 dist=Makefile -includes=c99.h +includes=C99.h diff --git a/src/Makefile b/src/Makefile index e6c0bd3..d9bb17f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,19 +28,19 @@ c99_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) c99: $(c99_OBJS) $(CC) -o c99 $(c99_OBJS) $(c99_LDFLAGS) -c99.o: c99.c common.h code.h parser.h ../include/c99.h +c99.o: c99.c common.h code.h parser.h ../include/C99.h $(CC) $(c99_CFLAGS) -c c99.c -code.o: code.c ../include/c99/target.h code.h ../config.h +code.o: code.c ../include/C99/target.h code.h ../config.h $(CC) $(c99_CFLAGS) -c code.c -main.o: main.c ../include/c99.h ../config.h +main.o: main.c ../include/C99.h ../config.h $(CC) $(c99_CFLAGS) -c main.c -parser.o: parser.c common.h code.h tokenset.h scanner.h ../include/c99.h ../config.h +parser.o: parser.c common.h code.h tokenset.h scanner.h ../include/C99.h ../config.h $(CC) $(c99_CFLAGS) -c parser.c -scanner.o: scanner.c ../include/c99.h ../config.h +scanner.o: scanner.c ../include/C99.h ../config.h $(CC) $(c99_CFLAGS) -c scanner.c tokenset.o: tokenset.c common.h code.h tokenset.h diff --git a/src/code.c b/src/code.c index 5e95292..167b0a7 100644 --- a/src/code.c +++ b/src/code.c @@ -23,7 +23,7 @@ #endif #include #include -#include "c99/target.h" +#include "C99/target.h" #include "code.h" #include "../config.h" diff --git a/src/project.conf b/src/project.conf index 6211b0d..fc75af2 100644 --- a/src/project.conf +++ b/src/project.conf @@ -14,19 +14,19 @@ sources=c99.c,code.c,main.c,parser.c,scanner.c,tokenset.c install=$(BINDIR) [c99.c] -depends=common.h,code.h,parser.h,../include/c99.h +depends=common.h,code.h,parser.h,../include/C99.h [code.c] -depends=../include/c99/target.h,code.h,../config.h +depends=../include/C99/target.h,code.h,../config.h [main.c] -depends=../include/c99.h,../config.h +depends=../include/C99.h,../config.h [parser.c] -depends=common.h,code.h,tokenset.h,scanner.h,../include/c99.h,../config.h +depends=common.h,code.h,tokenset.h,scanner.h,../include/C99.h,../config.h [scanner.c] -depends=../include/c99.h,../config.h +depends=../include/C99.h,../config.h [tokenset.c] depends=common.h,code.h,tokenset.h diff --git a/src/target/Makefile b/src/target/Makefile index cd92139..3065c1c 100644 --- a/src/target/Makefile +++ b/src/target/Makefile @@ -40,13 +40,13 @@ indent_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) indent.so: $(indent_OBJS) $(CCSHARED) -o indent.so $(indent_OBJS) $(indent_LDFLAGS) -asm.o: asm.c ../../include/c99/target.h ../../config.h +asm.o: asm.c ../../include/C99/target.h ../../config.h $(CC) $(asm_CFLAGS) -c asm.c -graph.o: graph.c ../../include/c99/target.h +graph.o: graph.c ../../include/C99/target.h $(CC) $(graph_CFLAGS) -c graph.c -indent.o: indent.c ../../include/c99/target.h +indent.o: indent.c ../../include/C99/target.h $(CC) $(indent_CFLAGS) -c indent.c clean: @@ -56,16 +56,16 @@ distclean: clean $(RM) -- $(TARGETS) install: $(TARGETS) - $(MKDIR) $(DESTDIR)$(LIBDIR)/c99/target - $(INSTALL) -m 0644 -- asm.so $(DESTDIR)$(LIBDIR)/c99/target/asm.so - $(MKDIR) $(DESTDIR)$(LIBDIR)/c99/target - $(INSTALL) -m 0644 -- graph.so $(DESTDIR)$(LIBDIR)/c99/target/graph.so - $(MKDIR) $(DESTDIR)$(LIBDIR)/c99/target - $(INSTALL) -m 0644 -- indent.so $(DESTDIR)$(LIBDIR)/c99/target/indent.so + $(MKDIR) $(DESTDIR)$(LIBDIR)/C99/target + $(INSTALL) -m 0644 -- asm.so $(DESTDIR)$(LIBDIR)/C99/target/asm.so + $(MKDIR) $(DESTDIR)$(LIBDIR)/C99/target + $(INSTALL) -m 0644 -- graph.so $(DESTDIR)$(LIBDIR)/C99/target/graph.so + $(MKDIR) $(DESTDIR)$(LIBDIR)/C99/target + $(INSTALL) -m 0644 -- indent.so $(DESTDIR)$(LIBDIR)/C99/target/indent.so uninstall: - $(RM) -- $(DESTDIR)$(LIBDIR)/c99/target/asm.so - $(RM) -- $(DESTDIR)$(LIBDIR)/c99/target/graph.so - $(RM) -- $(DESTDIR)$(LIBDIR)/c99/target/indent.so + $(RM) -- $(DESTDIR)$(LIBDIR)/C99/target/asm.so + $(RM) -- $(DESTDIR)$(LIBDIR)/C99/target/graph.so + $(RM) -- $(DESTDIR)$(LIBDIR)/C99/target/indent.so .PHONY: all clean distclean install uninstall diff --git a/src/target/asm.c b/src/target/asm.c index a88cf66..887d8b1 100644 --- a/src/target/asm.c +++ b/src/target/asm.c @@ -20,7 +20,7 @@ #include #include #include -#include "c99/target.h" +#include "C99/target.h" #ifdef DEBUG # include "../../config.h" #endif diff --git a/src/target/graph.c b/src/target/graph.c index a38befa..0e9a3bd 100644 --- a/src/target/graph.c +++ b/src/target/graph.c @@ -19,7 +19,7 @@ #include #include #include -#include "c99/target.h" +#include "C99/target.h" /* graph */ @@ -89,7 +89,7 @@ static int _graph_exit(void) ret |= error_set_code(1, "%s: %s", _filename, strerror(errno)); free(_filename); free(_function); - return 0; + return ret; } @@ -103,7 +103,7 @@ static int _graph_function_begin(char const * name) #endif free(_function); if((_function = strdup(name)) == NULL) - ret = error_set_code(1, "%s", strerror(errno)); + ret |= error_set_code(1, "%s", strerror(errno)); return ret; } diff --git a/src/target/indent.c b/src/target/indent.c index 7de74b5..d389560 100644 --- a/src/target/indent.c +++ b/src/target/indent.c @@ -20,7 +20,7 @@ #include #include #include -#include "c99/target.h" +#include "C99/target.h" #include "../common.h" #define max(a, b) ((a) > (b) ? (a) : (b)) diff --git a/src/target/project.conf b/src/target/project.conf index 87357fb..586dca3 100644 --- a/src/target/project.conf +++ b/src/target/project.conf @@ -11,23 +11,23 @@ type=plugin sources=asm.c cflags=`pkg-config --cflags asm` ldflags=`pkg-config --libs asm` -install=$(LIBDIR)/c99/target +install=$(LIBDIR)/C99/target [asm.c] -depends=../../include/c99/target.h,../../config.h +depends=../../include/C99/target.h,../../config.h [graph] type=plugin sources=graph.c -install=$(LIBDIR)/c99/target +install=$(LIBDIR)/C99/target [graph.c] -depends=../../include/c99/target.h +depends=../../include/C99/target.h [indent] type=plugin sources=indent.c -install=$(LIBDIR)/c99/target +install=$(LIBDIR)/C99/target [indent.c] -depends=../../include/c99/target.h +depends=../../include/C99/target.h