diff options
Diffstat (limited to 'libstorycode')
-rw-r--r-- | libstorycode/narrative.c | 24 | ||||
-rw-r--r-- | libstorycode/narrative.h | 5 | ||||
-rw-r--r-- | libstorycode/presentation.c | 60 | ||||
-rw-r--r-- | libstorycode/presentation.h | 36 | ||||
-rw-r--r-- | libstorycode/slide.c | 54 | ||||
-rw-r--r-- | libstorycode/slide.h | 36 | ||||
-rw-r--r-- | libstorycode/storycode.c | 44 | ||||
-rw-r--r-- | libstorycode/storycode.h | 35 | ||||
-rw-r--r-- | libstorycode/storycode.l | 2 | ||||
-rw-r--r-- | libstorycode/stylesheet.c | 51 | ||||
-rw-r--r-- | libstorycode/stylesheet.h | 36 |
11 files changed, 382 insertions, 1 deletions
diff --git a/libstorycode/narrative.c b/libstorycode/narrative.c index 971af82..c2e0d27 100644 --- a/libstorycode/narrative.c +++ b/libstorycode/narrative.c @@ -28,3 +28,27 @@ #include <stdlib.h> #include <string.h> +#include "narrative.h" + +struct _narrative +{ + int n_items; + struct narrative_item *items; +}; + + +Narrative *narrative_new() +{ + Narrative *n; + n = malloc(sizeof(*n)); + if ( n == NULL ) return NULL; + n->n_items = 0; + n->items = NULL; + return n; +} + +void narrative_free(Narrative *n) +{ + free(n->items); + free(n); +} diff --git a/libstorycode/narrative.h b/libstorycode/narrative.h index 096ace5..b9a9f7c 100644 --- a/libstorycode/narrative.h +++ b/libstorycode/narrative.h @@ -27,5 +27,10 @@ #include <config.h> #endif +typedef struct _narrative Narrative; + +extern Narrative *narrative_new(void); +extern void narrative_free(Narrative *n); + #endif /* NARRATIVE_H */ diff --git a/libstorycode/presentation.c b/libstorycode/presentation.c new file mode 100644 index 0000000..2ac751f --- /dev/null +++ b/libstorycode/presentation.c @@ -0,0 +1,60 @@ +/* + * presentation.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> + +#include "presentation.h" +#include "stylesheet.h" +#include "slide.h" +#include "narrative.h" + +struct _presentation +{ + Stylesheet *stylesheet; + Narrative *narrative; + int n_slides; + Slide **slides; +}; + + +Presentation *presentation_new() +{ + Presentation *p; + p = malloc(sizeof(*p)); + if ( p == NULL ) return NULL; + p->stylesheet = NULL; + p->narrative = NULL; + p->slides = NULL; + p->n_slides = 0; + return p; +} + +void presentation_free(Presentation *p) +{ + free(p); +} diff --git a/libstorycode/presentation.h b/libstorycode/presentation.h new file mode 100644 index 0000000..7f4b144 --- /dev/null +++ b/libstorycode/presentation.h @@ -0,0 +1,36 @@ +/* + * presentation.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 PRESENTATION_H +#define PRESENTATION_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +typedef struct _presentation Presentation; + +extern Presentation *presentation_new(void); +extern void presentation_free(Presentation *p); + + +#endif /* PRESENTATION_H */ diff --git a/libstorycode/slide.c b/libstorycode/slide.c new file mode 100644 index 0000000..28a4ee3 --- /dev/null +++ b/libstorycode/slide.c @@ -0,0 +1,54 @@ +/* + * slide.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> + +#include "slide.h" + +struct _slide +{ + int n_items; + struct slide_item *items; +}; + + +Slide *slide_new() +{ + Slide *s; + s = malloc(sizeof(*s)); + if ( s == NULL ) return NULL; + s->n_items = 0; + s->items = NULL; + return s; +} + +void slide_free(Slide *s) +{ + free(s->items); + free(s); +} diff --git a/libstorycode/slide.h b/libstorycode/slide.h new file mode 100644 index 0000000..be9b08c --- /dev/null +++ b/libstorycode/slide.h @@ -0,0 +1,36 @@ +/* + * slide.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 SLIDE_H +#define SLIDE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +typedef struct _slide Slide; + +extern Slide *slide_new(void); +extern void slide_free(Slide *n); + + +#endif /* SLIDE_H */ diff --git a/libstorycode/storycode.c b/libstorycode/storycode.c new file mode 100644 index 0000000..e9eb505 --- /dev/null +++ b/libstorycode/storycode.c @@ -0,0 +1,44 @@ +/* + * storycode.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> + +#include "presentation.h" + +#include "storycode_parse.h" +#include "storycode_lex.h" + +Presentation *storycode_parse_presentation(const char *sc) +{ + YY_BUFFER_STATE b; + + b = sc_scan_string(sc); + scparse(); + sc_delete_buffer(b); + return NULL; +} diff --git a/libstorycode/storycode.h b/libstorycode/storycode.h new file mode 100644 index 0000000..476941e --- /dev/null +++ b/libstorycode/storycode.h @@ -0,0 +1,35 @@ +/* + * storycode.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 STORYCODE_H +#define STORYCODE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "presentation.h" + +extern Presentation *storycode_parse_presentation(const char *sc); + + +#endif /* STORYCODE_H */ diff --git a/libstorycode/storycode.l b/libstorycode/storycode.l index a64fbec..e8fd70a 100644 --- a/libstorycode/storycode.l +++ b/libstorycode/storycode.l @@ -22,7 +22,7 @@ %{ #define YYDEBUG 1 - #include "storycode.tab.h" + #include "storycode_parse.h" %} %option noyywrap nounput noinput diff --git a/libstorycode/stylesheet.c b/libstorycode/stylesheet.c new file mode 100644 index 0000000..00210ec --- /dev/null +++ b/libstorycode/stylesheet.c @@ -0,0 +1,51 @@ +/* + * stylesheet.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> + +#include "stylesheet.h" + +struct _stylesheet +{ + int n_items; +}; + + +Stylesheet *stylesheet_new() +{ + Stylesheet *s; + s = malloc(sizeof(*s)); + if ( s == NULL ) return NULL; + s->n_items = 0; + return s; +} + +void stylesheet_free(Stylesheet *s) +{ + free(s); +} diff --git a/libstorycode/stylesheet.h b/libstorycode/stylesheet.h new file mode 100644 index 0000000..f7af223 --- /dev/null +++ b/libstorycode/stylesheet.h @@ -0,0 +1,36 @@ +/* + * stylesheet.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 STYLESHEET_H +#define STYLESHEET_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +typedef struct _stylesheet Stylesheet; + +extern Stylesheet *stylesheet_new(void); +extern void stylesheet_free(Stylesheet *s); + + +#endif /* STYLESHEET_H */ |