summaryrefslogtreecommitdiff
path: root/dviware/catdvi/linebuf.h
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/catdvi/linebuf.h
Initial commit
Diffstat (limited to 'dviware/catdvi/linebuf.h')
-rw-r--r--dviware/catdvi/linebuf.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/dviware/catdvi/linebuf.h b/dviware/catdvi/linebuf.h
new file mode 100644
index 0000000000..cf796dbb21
--- /dev/null
+++ b/dviware/catdvi/linebuf.h
@@ -0,0 +1,67 @@
+/* catdvi - get text from DVI files
+ Copyright (C) 2000, 2001 Bjoern Brill <brill@fs.math.uni-frankfurt.de>
+
+ 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; either version 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+
+/* Implements a simplistic "string of glyph_t" class. Can grow dynamically.
+ * Null termination is provided, but not used by the class methods.
+ */
+
+#ifndef LINEBUF_H
+#define LINEBUF_H
+
+#include <stddef.h>
+
+/* for definition of glyph_t */
+#include "page.h"
+
+typedef struct linebuf_t linebuf_t;
+struct linebuf_t {
+ size_t size_alloc;
+ size_t size_curr;
+ glyph_t * gstring;
+};
+
+/* Construct as empty string. Specify initially allocated space (to avoid
+ * continuous realloc()s). Use 0 for default size (currently 80 glyphs).
+ */
+void linebuf_init(struct linebuf_t * this, size_t initial_size_alloc);
+
+/* Construct from array garray of length len. */
+void linebuf_garray_init(linebuf_t * this, const glyph_t garray[], size_t len);
+
+/* Construct from 0-terminated array garray0. */
+void linebuf_garray0_init(linebuf_t * this, const glyph_t garray0[]);
+
+/* destructor */
+void linebuf_done(struct linebuf_t * this);
+
+void linebuf_clear(struct linebuf_t * this);
+
+/* Append another linebuf */
+void linebuf_append(linebuf_t * this, const linebuf_t * appendix);
+
+/* Append one glpyh */
+void linebuf_putg(struct linebuf_t * this, glyph_t g);
+
+/* Look at last glyph */
+glyph_t linebuf_peekg(struct linebuf_t * this);
+
+/* Remove last glyph */
+glyph_t linebuf_unputg(struct linebuf_t * this);
+
+#endif