BINDIR := $(PREFIX)/bin
CC ?= clang
-CFLAGS += -Wall -I.
+CFLAGS += -Wall -I. -Wall -pedantic
#turn on tons of warnings if clang is present
ifeq ($(CC), clang)
CFLAGS += \
-Weverything \
- -Wno-missing-prototypes \
-Wno-padded \
-Wno-format-nonliteral \
-Wno-disabled-macro-expansion \
con_enablecolor();
} else if (!(console.handle_err = fopen(err, "w"))) return 0;
- // no buffering
+ /* no buffering */
setvbuf(console.handle_out, NULL, _IONBF, 0);
setvbuf(console.handle_err, NULL, _IONBF, 0);
static ppmacro *ppmacro_new(lex_ctx ctx, const char *name)
{
- (void)ctx;
ppmacro *macro = (ppmacro*)mem_a(sizeof(ppmacro));
+
+ (void)ctx;
memset(macro, 0, sizeof(*macro));
macro->name = util_strdup(name);
return macro;
lex_ctx ctx = ast_ctx(array);
if (from+1 == afterend) {
- // set this value
+ /* set this value */
ast_block *block;
ast_return *ret;
ast_array_index *subscript;
+ ast_store *st;
int assignop = type_store_instr[value->expression.vtype];
if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
if (!subscript)
return NULL;
- ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
+ st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
if (!st) {
ast_delete(subscript);
return NULL;
lex_ctx ctx = ast_ctx(array);
if (from+1 == afterend) {
- // set this value
+ /* set this value */
ast_block *block;
ast_return *ret;
ast_entfield *entfield;
ast_array_index *subscript;
+ ast_store *st;
int assignop = type_storep_instr[value->expression.vtype];
if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
return NULL;
}
- ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
+ st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
if (!st) {
ast_delete(entfield);
return NULL;
*out = *in + 'a' - 'A';
else
*out = *in;
+
+ *out = (isalpha(*in) && isupper(*in)) ? *in + 'a' - 'A' : *in;
}
*out = 0;
return sz-1;
}
+
+bool util_filexists(const char *file) {
+ FILE *fp = fopen(file, "rb");
+ if (!fp) return false;
+
+ /* it exists */
+ fclose(fp);
+ return true;
+}
+
FILE *util_fopen(const char *filename, const char *mode)
{
#ifdef WIN32
#endif
}
-bool util_filexists(const char *file) {
- FILE *fp = fopen(file, "rb");
- if (!fp) return false;
-
- /* it exists */
- fclose(fp);
- return true;
-}
-
void _util_vec_grow(void **a, size_t i, size_t s) {
size_t m = *a ? 2*_vec_beg(*a)+i : i+1;
void *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);