diff options
author | Thomas White <taw@bitwiz.org.uk> | 2014-07-07 09:11:12 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2014-07-07 09:11:12 +0200 |
commit | b78321a41a1f8c6e75a8b9a1d774edc9ce7a5ed4 (patch) | |
tree | b97e551a6e7b9ec186ce35949bad4631ad652589 /src/sc_parse.c | |
parent | c04e68c97ab01b2196a0625bc5ab0df48b4b1124 (diff) |
Add frame creation
Diffstat (limited to 'src/sc_parse.c')
-rw-r--r-- | src/sc_parse.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/sc_parse.c b/src/sc_parse.c index 510f097..a3443a0 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -132,6 +132,46 @@ SCBlock *sc_block_append(SCBlock *bl, char *name, char *opt, char *contents, } +/* Append a new block to the chain inside "bl". + * "name", "options" and "contents" will not be copied. Returns the block just + * created, or NULL on error. */ +SCBlock *sc_block_append_inside(SCBlock *parent, + char *name, char *opt, char *contents) +{ + SCBlock *bln; + SCBlock *bl; + SCBlock **ptr; + + bl = parent->child; + if ( bl != NULL ) { + while ( bl->next != NULL ) bl = bl->next; + ptr = &bl->next; + } else { + ptr = &bl->child; + bl = NULL; + } + + bln = sc_block_new(); + if ( bln == NULL ) return NULL; + + bln->name = name; + bln->options = opt; + bln->contents = contents; + bln->child = NULL; + bln->next = NULL; + + if ( bl == NULL ) { + bln->prev = NULL; + } else { + bln->prev = bl; + } + *ptr = bln; + + return bln; +} + + + /* Frees "bl" and all its children */ void sc_block_free(SCBlock *bl) { |