diff options
-rw-r--r-- | libstorycode/narrative.c | 30 | ||||
-rw-r--r-- | libstorycode/narrative.h | 31 | ||||
-rw-r--r-- | libstorycode/storycode.l (renamed from src/storycode.l) | 0 | ||||
-rw-r--r-- | libstorycode/storycode.y (renamed from src/storycode.y) | 32 | ||||
-rw-r--r-- | meson.build | 21 |
5 files changed, 96 insertions, 18 deletions
diff --git a/libstorycode/narrative.c b/libstorycode/narrative.c new file mode 100644 index 0000000..971af82 --- /dev/null +++ b/libstorycode/narrative.c @@ -0,0 +1,30 @@ +/* + * narrative.c + * + * Copyright © 2019 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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 <http://www.gnu.org/licenses/>. + * + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <string.h> + diff --git a/libstorycode/narrative.h b/libstorycode/narrative.h new file mode 100644 index 0000000..096ace5 --- /dev/null +++ b/libstorycode/narrative.h @@ -0,0 +1,31 @@ +/* + * narrative.h + * + * Copyright © 2019 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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 <http://www.gnu.org/licenses/>. + * + */ + +#ifndef NARRATIVE_H +#define NARRATIVE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + + +#endif /* NARRATIVE_H */ diff --git a/src/storycode.l b/libstorycode/storycode.l index a64fbec..a64fbec 100644 --- a/src/storycode.l +++ b/libstorycode/storycode.l diff --git a/src/storycode.y b/libstorycode/storycode.y index cbd952a..625f080 100644 --- a/src/storycode.y +++ b/libstorycode/storycode.y @@ -49,27 +49,23 @@ %% -storycode: - %empty -| storycode scblock +presentation: + stylesheet narrative +| narrative +; + +narrative: + narrative_el +| narrative narrative_el ; -scblock: - stylesheet { printf("That was the stylesheet\n"); } -| prestitle { printf("prestitle: '%s'\n", $1); } +narrative_el: + prestitle { printf("prestitle: '%s'\n", $1); } | bulletpoint { printf("* '%s'\n", $1); } | slide | STRING { printf("Text line '%s'\n", $1); } ; -stylesheet: - STYLES OPENBRACE { printf("Here comes the stylesheet\n"); } - style_narrative { printf("Stylesheet - narrative\n"); } - style_slide { printf("Stylesheet - slide\n"); } - CLOSEBRACE -; - - /* Can be in narrative or slide */ prestitle: @@ -80,6 +76,7 @@ bulletpoint: BP STRING { $$ = $2; } ; + /* ------ Slide contents ------ */ slide: @@ -153,6 +150,13 @@ length: /* ------ Stylesheet ------ */ +stylesheet: + STYLES OPENBRACE { printf("Here comes the stylesheet\n"); } + style_narrative { printf("Stylesheet - narrative\n"); } + style_slide { printf("Stylesheet - slide\n"); } + CLOSEBRACE +; + style_narrative: NARRATIVE OPENBRACE style_narrative_def CLOSEBRACE { printf("narrative style\n"); } ; diff --git a/meson.build b/meson.build index 759fa0b..7e6ac83 100644 --- a/meson.build +++ b/meson.build @@ -27,13 +27,17 @@ gresources = gnome.compile_resources('colloquium-resources', 'data/colloquium.gresource.xml', source_dir: 'data', c_name: 'colloquium') + +# libstorycode +libstorycode_includes = include_directories('libstorycode') + flex = find_program('flex') bison = find_program('bison') storycode_tab_ch = custom_target('storycode.tab.c', output : ['storycode.tab.c', 'storycode.tab.h'], - input : 'src/storycode.y', + input : 'libstorycode/storycode.y', command : [bison, '--defines=@OUTPUT1@', '-p', 'sc', '--report=all', @@ -42,18 +46,27 @@ storycode_tab_ch = custom_target('storycode.tab.c', storycode_c = custom_target('storycode.c', output : ['storycode.c', 'storycode.h'], - input : ['src/storycode.l', storycode_tab_ch], + input : ['libstorycode/storycode.l', storycode_tab_ch], command : [flex, '--outfile=@OUTPUT0@', '--header-file=@OUTPUT1@', '-P', 'sc', '@INPUT@']) +libstorycode = library('storycode', + ['libstorycode/narrative.c', + storycode_c, + ], + include_directories : libstorycode_includes, + install : true) + +libstorycode_dep = declare_dependency(include_directories : libstorycode_includes, + link_with : libstorycode) + executable('sc2_test', ['src/sc2_test.c', - storycode_c, ], gresources, - dependencies : [gtkdep]) + dependencies : [gtkdep, libstorycode_dep]) # Main program executable('colloquium', |