summaryrefslogtreecommitdiff
path: root/support/dktools/test-dk4tsp08.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/test-dk4tsp08.c
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/test-dk4tsp08.c')
-rw-r--r--support/dktools/test-dk4tsp08.c191
1 files changed, 0 insertions, 191 deletions
diff --git a/support/dktools/test-dk4tsp08.c b/support/dktools/test-dk4tsp08.c
deleted file mode 100644
index 3dec48053f..0000000000
--- a/support/dktools/test-dk4tsp08.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- WARNING: This file was generated by dkct.
- Changes you make here will be lost if dkct is run again!
- You should modify the original source and run dkct on it.
- Original source: test-dk4tsp08.ctr
-*/
-
-/** @file test-dk4tsp08.c The test-dk4tsp08 module.
-*/
-
-
-#line 1 "test-dk4tsp08.ctr"
-
-#include "dk4conf.h"
-#include "dk4enc.h"
-#include "dk4tsp08.h"
-#include "dk4strm.h"
-#include "dk4strmf.h"
-#include "dk4strmo32.h"
-#include "dk4ansi.h"
-#include <string.h>
-
-
-
-
-#line 13 "test-dk4tsp08.ctr"
-
-
-
-#define LINE_VERSION 1
-
-
-/** Buffer for input from file.
-*/
-static char fbuf[4096];
-
-
-#if LINE_VERSION
-static char lbuf[4096];
-#endif
-
-
-#if LINE_VERSION
-int
-line_handler(void *obj, char *line, dk4_um_t lineno, dk4_er_t *erp)
-{
- size_t sz;
- int back = DK4_TSP_RES_ERROR;
- sz = strlen(line);
- if (0 < sz) {
- if (0 != dk4stream_write( (dk4_stream_t *)obj, line, sz, erp)) {
- back = DK4_TSP_RES_OK;
- }
- } else {
- back = DK4_TSP_RES_OK;
- }
- return back;
-}
-#else
-int
-char_handler(void *obj, char c, dk4_text_stream_position_t *pos, dk4_er_t *erp)
-{
- dk4_c32_t c32;
- int back = DK4_TSP_RES_ERROR;
- if (dk4ansi_decode(&c32, (unsigned char)c)) {
- if (dk4stream_c32_putc((dk4_stream_t *)obj, c32, erp)) {
- back = DK4_TSP_RES_OK;
- }
- }
- return back;
-}
-#endif
-
-
-
-int main(void)
-{
- dk4_tsp08_t tsp; /* Text stream processor. */
- dk4_er_t er; /* Error report */
- dk4_stream_t *outstream; /* Output stream */
- size_t nread; /* Number of bytes read */
-#if DK4_ON_WINDOWS
- int oldmode; /* Output text or binary mode */
- int oldinmode; /* Input text or binary mode */
-#endif
- int res; /* Result for text stream processing */
- int oldres; /* Previous result */
- int cc; /* Flag: Can continue */
-
-
-#line 76 "test-dk4tsp08.ctr"
-
-
-#line 77 "test-dk4tsp08.ctr"
-#if DK4_ON_WINDOWS
- oldmode = _setmode(_fileno(stdout), _O_BINARY);
- oldinmode = _setmode(_fileno(stdin), _O_BINARY);
-#endif
- dk4error_init(&er);
- outstream = dk4stream_open_for_file( stdout, DK4_STREAM_WRITE, 0, 0, &er);
- if (NULL != outstream) {
- dk4stream_set_output_encoding(outstream, DK4_FILE_ENCODING_ASCII);
-#if 1
- (void)dk4stream_write_bom_if_necessary(outstream, NULL);
-#endif
-#if LINE_VERSION
- res = dk4tsp08_setup_line(
- &tsp, (void *)outstream, line_handler, lbuf, sizeof(lbuf),
- DK4_ENCODING_ASCII, DK4_ENCODING_UTF8, &er
- );
-#else
- res = dk4tsp08_setup_char(
- &tsp, (void *)outstream, char_handler,
- DK4_ENCODING_UTF8, DK4_ENCODING_UTF8, &er
- );
-#endif
- if (DK4_TSP_RES_OK == res) {
- oldres = DK4_TSP_RES_OK;
- cc = 1;
- while (1 == cc) {
- nread = fread(fbuf, 1, sizeof(fbuf), stdin);
- if (0 < nread) {
- res = dk4tsp08_add_bytes(&tsp, (unsigned char *)fbuf, nread);
- switch (res) {
- case DK4_TSP_RES_OK: {
- } break;
- case DK4_TSP_RES_ERROR: {
- if (DK4_TSP_RES_OK == oldres) {
- oldres = DK4_TSP_RES_ERROR;
-
-
-#line 113 "test-dk4tsp08.ctr"
- }
- } break;
- case DK4_TSP_RES_FATAL: {
- if (DK4_TSP_RES_FATAL != oldres) {
- oldres = DK4_TSP_RES_FATAL;
-
-
-#line 119 "test-dk4tsp08.ctr"
- }
- } break;
- }
- } else {
- cc = 0;
- }
- }
- res = dk4tsp08_finish(&tsp);
- switch (res) {
- case DK4_TSP_RES_OK: {
- } break;
- case DK4_TSP_RES_ERROR: {
- if (DK4_TSP_RES_OK == oldres) {
- oldres = DK4_TSP_RES_ERROR;
-
-
-#line 134 "test-dk4tsp08.ctr"
- }
- } break;
- case DK4_TSP_RES_FATAL: {
- if (DK4_TSP_RES_FATAL != oldres) {
- oldres = DK4_TSP_RES_FATAL;
-
-
-#line 140 "test-dk4tsp08.ctr"
- }
- } break;
- }
- } else {
-
-#line 144 "test-dk4tsp08.ctr"
- }
- dk4stream_close(outstream, NULL);
- } else {
-
-#line 147 "test-dk4tsp08.ctr"
- }
- fflush(stdout);
-#if DK4_ON_WINDOWS
- _setmode(_fileno(stdin), oldinmode);
- _setmode(_fileno(stdout), oldmode);
-#endif
-
-
-#line 154 "test-dk4tsp08.ctr"
-
-
-#line 155 "test-dk4tsp08.ctr"
- return 0;
-}
-