head 1.2; access; symbols last-version-before-change-to-ossp-style:1.1.1.1 VAR_0_0_0:1.1.1.1 VENDOR:1.1.1; locks; strict; comment @ * @; 1.2 date 2001.11.13.12.08.30; author simons; state dead; branches; next 1.1; 1.1 date 2001.11.09.17.01.37; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.11.09.17.01.37; author rse; state Exp; branches; next ; desc @@ 1.2 log @- Moved all routines into a single source file var.c. - Renamed varexp.h to var.h. - Removed odin-based build system. - Moved test cases into var_test.c. - Adapted build system. @ text @#include "internal.h" var_rc_t input(const char* begin, const char* end, const var_config_t* config, const char nameclass[256], var_cb_t lookup, void* lookup_context, int force_expand, tokenbuf* output) { int rc; tokenbuf result; init_tokenbuf(&result); do { rc = text(begin, end, config->varinit, config->escape); if (rc > 0) { if (!append_to_tokenbuf(output, begin, rc)) { rc = VAR_OUT_OF_MEMORY; goto error_return; } begin += rc; } else if (rc < 0) goto error_return; rc = variable(begin, end, config, nameclass, lookup, lookup_context, force_expand, &result); if (rc > 0) { if (!append_to_tokenbuf(output, result.begin, result.end - result.begin)) { rc = VAR_OUT_OF_MEMORY; goto error_return; } else begin += rc; } else if (rc < 0) goto error_return; } while (rc > 0); if (begin != end) { rc = VAR_INPUT_ISNT_TEXT_NOR_VARIABLE; goto error_return; } return VAR_OK; error_return: free_tokenbuf(&result); return rc; } @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @import first cut of OSSP var @ text @@