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" static void expand_range(char a, char b, char class[256]) { assert(a <= b); assert(class != NULL); do { class[(int)a] = 1; } while (++a <= b); } var_rc_t expand_character_class(const char* desc, char class[256]) { size_t i; assert(desc != NULL); assert(class != NULL); /* Clear the class array. */ for (i = 0; i < 256; ++i) class[i] = 0; /* Walk through the class description and set the appropriate entries in the array. */ while(*desc != '\0') { if (desc[1] == '-' && desc[2] != '\0') { if (desc[0] > desc[2]) return VAR_INCORRECT_CLASS_SPEC; expand_range(desc[0], desc[2], class); desc += 3; } else { class[(int)*desc] = 1; ++desc; } } return VAR_OK; } @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @import first cut of OSSP var @ text @@