diff --git a/Makefile b/Makefile index a9b9c44..6f9b92d 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ dist: $(PACKAGE)-$(VERSION)/include/C99.h \ $(PACKAGE)-$(VERSION)/include/Makefile \ $(PACKAGE)-$(VERSION)/include/project.conf \ + $(PACKAGE)-$(VERSION)/include/C99/c99.h \ $(PACKAGE)-$(VERSION)/include/C99/target.h \ $(PACKAGE)-$(VERSION)/include/C99/Makefile \ $(PACKAGE)-$(VERSION)/include/C99/project.conf \ diff --git a/include/C99.h b/include/C99.h index 0d4ca5b..dedd199 100644 --- a/include/C99.h +++ b/include/C99.h @@ -15,61 +15,10 @@ -#ifndef C99_C99_H -# define C99_C99_H +#ifndef DEVEL_C99_H +# define DEVEL_C99_H -# include +# include "C99/c99.h" +# include "C99/target.h" - -/* 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 */ +#endif /* !DEVEL_C99_H */ diff --git a/include/C99/Makefile b/include/C99/Makefile index 0faa60c..3d357b6 100644 --- a/include/C99/Makefile +++ b/include/C99/Makefile @@ -14,10 +14,13 @@ clean: distclean: clean install: - $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/c99 - $(INSTALL) -m 0644 -- target.h $(DESTDIR)$(INCLUDEDIR)/c99/target.h + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/C99 + $(INSTALL) -m 0644 -- c99.h $(DESTDIR)$(INCLUDEDIR)/C99/c99.h + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/C99 + $(INSTALL) -m 0644 -- target.h $(DESTDIR)$(INCLUDEDIR)/C99/target.h uninstall: - $(RM) -- $(DESTDIR)$(INCLUDEDIR)/c99/target.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/C99/c99.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/C99/target.h .PHONY: all clean distclean install uninstall diff --git a/include/C99/c99.h b/include/C99/c99.h new file mode 100644 index 0000000..2732e6a --- /dev/null +++ b/include/C99/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 DEVEL_C99_C99_H +# define DEVEL_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 /* !DEVEL_C99_C99_H */ diff --git a/include/C99/project.conf b/include/C99/project.conf index fcec56f..259267d 100644 --- a/include/C99/project.conf +++ b/include/C99/project.conf @@ -1,5 +1,8 @@ -includes=target.h +includes=c99.h,target.h dist=Makefile +[c99.h] +install=$(INCLUDEDIR)/C99 + [target.h] -install=$(INCLUDEDIR)/c99 +install=$(INCLUDEDIR)/C99 diff --git a/include/C99/target.h b/include/C99/target.h index b309c7d..8bf5598 100644 --- a/include/C99/target.h +++ b/include/C99/target.h @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2011 Pierre Pronchery */ +/* 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 @@ -15,16 +15,17 @@ -#ifndef _C99_TARGET_TARGET_H -# define _C99_TARGET_TARGET_H +#ifndef DEVEL_C99_TARGET_H +# define DEVEL_C99_TARGET_H +# include # include "c99.h" -/* Target */ +/* C99Target */ /* public */ /* types */ -typedef struct _TargetPlugin +typedef struct _C99TargetPlugin { C99Helper * helper; C99Option * options; @@ -36,6 +37,6 @@ typedef struct _TargetPlugin int (*function_call)(char const * name); int (*function_end)(void); int (*label_set)(char const * name); -} TargetPlugin; +} C99TargetPlugin; -#endif /* !_C99_TARGET_TARGET_H */ +#endif /* !DEVEL_C99_TARGET_H */ diff --git a/src/c99.c b/src/c99.c index 46a60ee..daa802d 100644 --- a/src/c99.c +++ b/src/c99.c @@ -23,7 +23,7 @@ #include "common.h" #include "code.h" #include "parser.h" -#include "c99.h" +#include "C99/c99.h" /* private */ diff --git a/src/code.c b/src/code.c index 167b0a7..af5a740 100644 --- a/src/code.c +++ b/src/code.c @@ -98,7 +98,7 @@ struct _Code /* target */ C99Helper * helper; Plugin * plugin; - TargetPlugin * target; + C99TargetPlugin * target; /* types */ CodeType * types; size_t types_cnt; diff --git a/src/code.h b/src/code.h index e55a264..d79af6d 100644 --- a/src/code.h +++ b/src/code.h @@ -18,7 +18,7 @@ #ifndef _C99_CODE_H # define _C99_CODE_H -# include "c99.h" +# include "C99/c99.h" /* Code */ diff --git a/src/main.c b/src/main.c index 5ccea60..44f83ad 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,7 @@ #include #include #include -#include "c99.h" +#include "C99/c99.h" #include "../config.h" diff --git a/src/parser.c b/src/parser.c index 0366fe8..7c624aa 100644 --- a/src/parser.c +++ b/src/parser.c @@ -27,7 +27,7 @@ #include "common.h" #include "tokenset.h" #include "scanner.h" -#include "c99.h" +#include "parser.h" #include "../config.h" #ifdef DEBUG diff --git a/src/parser.h b/src/parser.h index 6a35c51..64ec178 100644 --- a/src/parser.h +++ b/src/parser.h @@ -18,7 +18,7 @@ #ifndef C99_PARSER_H # define C99_PARSER_H -# include "c99.h" +# include "C99/c99.h" /* protected */ diff --git a/src/scanner.c b/src/scanner.c index ae76201..64fcdcf 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -18,7 +18,7 @@ #include #include #include "common.h" -#include "c99.h" +#include "scanner.h" #include "../config.h" diff --git a/src/scanner.h b/src/scanner.h index a0393b0..612a764 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -18,7 +18,7 @@ #ifndef C99_SCANNER_H # define C99_SCANNER_H -# include "c99.h" +# include "C99/c99.h" /* protected */ diff --git a/src/target/asm.c b/src/target/asm.c index 887d8b1..530f4ca 100644 --- a/src/target/asm.c +++ b/src/target/asm.c @@ -85,7 +85,7 @@ static int _asm_section(char const * name); /* public */ /* variables */ -TargetPlugin target_plugin = +C99TargetPlugin target_plugin = { NULL, _asm_options, diff --git a/src/target/graph.c b/src/target/graph.c index 0e9a3bd..2b9a309 100644 --- a/src/target/graph.c +++ b/src/target/graph.c @@ -41,7 +41,7 @@ static int _graph_function_end(void); /* public */ /* variables */ -TargetPlugin target_plugin = +C99TargetPlugin target_plugin = { NULL, /* helper */ NULL, /* options */ diff --git a/src/target/indent.c b/src/target/indent.c index d389560..aad3c12 100644 --- a/src/target/indent.c +++ b/src/target/indent.c @@ -48,7 +48,7 @@ static int _indent_function_end(void); /* public */ /* variables */ -TargetPlugin target_plugin = +C99TargetPlugin target_plugin = { NULL, /* helper */ NULL, /* options */