Start directives stream

This commit is contained in:
Wilson Lin 2018-08-10 22:02:35 +12:00
parent 376afcd793
commit 10c49d152d
3 changed files with 59 additions and 0 deletions

View File

@ -23,6 +23,7 @@ typedef enum hbe_errcode {
HBE_INTERR_PEEK_OFFSET_GEQ_ZERO = 1,
HBE_INTERR_UNKNOWN_ENTITY_TYPE,
HBE_INTERR_UNKNOWN_CONTENT_NEXT_STATE,
HBE_INTERR_NOT_A_HB_DIR,
HBE_CLI_TOO_MANY_OPTIONS = 17,
HBE_CLI_INVALID_TAG_SET,

37
src/main/c/stream/dir.c Normal file
View File

@ -0,0 +1,37 @@
#ifndef _HDR_HYPERBUILD_STREAM_DIR
#define _HDR_HYPERBUILD_STREAM_DIR
#include "../util/pipe.c"
#include "./streamoptions.c"
static void _hbs_dir_eval(hbs_options_t so, hbu_pipe_t pipe, hb_char_t *name, hb_char_t **arg_names, hb_char_t **arg_vals) {
// TODO
}
static void _hbs_dir_entity(hbs_options_t so, hbu_pipe_t pipe) {
// TODO
}
static void _hbs_dir_tag(hbs_options_t so, hbu_pipe_t pipe) {
// TODO
}
void hbs_dir(hbs_options_t so, hbu_pipe_t pipe) {
hb_char_t c = hbu_pipe_peek(pipe);
switch (c) {
case '&':
_hbs_dir_entity(so, pipe);
break;
case '<':
_hbs_dir_tag(so, pipe);
break;
default:
hbe_fatal(HBE_INTERR_NOT_A_HB_DIR, "INTERR Next character is not the start of a directive tag or entity");
}
}
#endif // _HDR_HYPERBUILD_STREAM_DIR

View File

@ -0,0 +1,21 @@
#ifndef _HDR_HYPERBUILD_STREAM_DIR_IMPORT
#define _HDR_HYPERBUILD_STREAM_DIR_IMPORT
#include "../../util/hbchar.h"
#include "../../util/pipe.c"
#include "../streamoptions.c"
#include "../content.c"
void hbsd_import(hbs_options_t so, hbu_pipe_t existing_pipe, hb_char_t *parent, char *path) {
// TODO
hbu_fstreamin_t input = hbu_fstreamin_create(path);
hbu_pipe_t new_pipe = hbu_pipe_create(input, (hbu_pipe_reader_cb_t) &hbu_fstreamin_read, path, existing_pipe->output, existing_pipe->writer);
hbs_content(so, new_pipe, parent);
// TODO
}
#endif // _HDR_HYPERBUILD_STREAM_DIR_IMPORT