diff --git a/src/Makefile.in b/src/Makefile.in index c198a00f..f007a6c7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -30,7 +30,7 @@ REMINDSRCS= calendar.c dynbuf.c dorem.c dosubst.c expr.c files.c funcs.c \ globals.c hbcal.c init.c main.c md5.c moon.c omit.c queue.c \ sort.c token.c trigger.c userfns.c utils.c var.c -REMINDHDRS=config.h custom.h dynbuf.h err.h expr.h globals.h lang.h \ +REMINDHDRS=config.h custom.h dynbuf.h err.h globals.h lang.h \ md5.h protos.h rem2ps.h types.h version.h REMINDOBJS= $(REMINDSRCS:.c=.o) diff --git a/src/calendar.c b/src/calendar.c index edc72c3e..13675b36 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -35,7 +35,6 @@ #include "lang.h" #include "types.h" #include "protos.h" -#include "expr.h" #include "globals.h" #include "err.h" #include "md5.h" diff --git a/src/dorem.c b/src/dorem.c index e677ae4d..f351d852 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -23,7 +23,6 @@ #include "globals.h" #include "err.h" #include "protos.h" -#include "expr.h" static int ParseTimeTrig (ParsePtr s, TimeTrig *tim); static int ParseLocalOmit (ParsePtr s, Trigger *t); diff --git a/src/dosubst.c b/src/dosubst.c index bde9f374..34bc9cb3 100644 --- a/src/dosubst.c +++ b/src/dosubst.c @@ -13,7 +13,6 @@ #include "config.h" #include "types.h" -#include "expr.h" #define L_IN_DOSUBST #include #include diff --git a/src/expr.c b/src/expr.c index ae314ee6..04d8b8d8 100644 --- a/src/expr.c +++ b/src/expr.c @@ -21,7 +21,6 @@ #include "types.h" #include "protos.h" #include "globals.h" -#include "expr.h" #include #include #include diff --git a/src/expr.h b/src/expr.h deleted file mode 100644 index e010bb5d..00000000 --- a/src/expr.h +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************/ -/* */ -/* EXPR.H */ -/* */ -/* Contains a few definitions used by expression pareser and */ -/* evaluator. */ -/* */ -/* This file is part of REMIND. */ -/* Copyright (C) 2022 by Dianne Skoll */ -/* */ -/***************************************************************/ - -typedef struct udf_struct UserFunc; - -/* Define the types of values */ -#define ERR_TYPE 0 -#define INT_TYPE 1 -#define TIME_TYPE 2 -#define DATE_TYPE 3 -#define STR_TYPE 4 -#define DATETIME_TYPE 5 -#define SPECIAL_TYPE 6 /* Only for system variables */ -#define CONST_INT_TYPE 7 /* Only for system variables */ - -#define BEG_OF_EXPR '[' -#define END_OF_EXPR ']' -#define COMMA ',' - -/* These functions are in utils.c and are used to detect overflow - in various arithmetic operators. They have to be in separate - functions with extern linkage to defeat compiler optimizations - that would otherwise break the overflow checks. */ -extern int _private_mul_overflow(int a, int b); -extern int _private_add_overflow(int a, int b); -extern int _private_sub_overflow(int a, int b); diff --git a/src/funcs.c b/src/funcs.c index 11cc977d..428ead66 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -54,7 +54,6 @@ #include "globals.h" #include "protos.h" #include "err.h" -#include "expr.h" /* Defines that used to be static variables */ #define Nargs (info->nargs) diff --git a/src/init.c b/src/init.c index b54a949f..5d0a0410 100644 --- a/src/init.c +++ b/src/init.c @@ -38,7 +38,6 @@ #include "types.h" #include "globals.h" #include "protos.h" -#include "expr.h" #include "err.h" static int should_guess_terminal_background = 1; diff --git a/src/main.c b/src/main.c index ba600559..a7f1785b 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,6 @@ #include "types.h" #include "protos.h" -#include "expr.h" #include "globals.h" #include "err.h" diff --git a/src/moon.c b/src/moon.c index 3edebac1..93379bef 100644 --- a/src/moon.c +++ b/src/moon.c @@ -66,7 +66,6 @@ #include #include "types.h" #include "protos.h" -#include "expr.h" #include "globals.h" #include "err.h" diff --git a/src/omit.c b/src/omit.c index 854dcf7d..d3bc51a1 100644 --- a/src/omit.c +++ b/src/omit.c @@ -20,7 +20,6 @@ #include "protos.h" #include "globals.h" #include "err.h" -#include "expr.h" static int BexistsIntArray (int const array[], int num, int key); static void InsertIntoSortedArray (int *array, int num, int key); diff --git a/src/protos.h b/src/protos.h index a7c13f9f..04575df5 100644 --- a/src/protos.h +++ b/src/protos.h @@ -228,3 +228,11 @@ void WriteJSONTimeTrigger(TimeTrig const *tt); #include void PutWideChar(wchar_t const wc, DynamicBuffer *output); #endif + +/* These functions are in utils.c and are used to detect overflow + in various arithmetic operators. They have to be in separate + functions with extern linkage to defeat compiler optimizations + that would otherwise break the overflow checks. */ +extern int _private_mul_overflow(int a, int b); +extern int _private_add_overflow(int a, int b); +extern int _private_sub_overflow(int a, int b); diff --git a/src/queue.c b/src/queue.c index 81fe80ca..ee5d2ad2 100644 --- a/src/queue.c +++ b/src/queue.c @@ -34,7 +34,6 @@ #include "globals.h" #include "err.h" #include "protos.h" -#include "expr.h" #undef USE_INOTIFY #if defined(HAVE_SYS_INOTIFY_H) && defined(HAVE_INOTIFY_INIT1) diff --git a/src/sort.c b/src/sort.c index d83cb10d..c1eec354 100644 --- a/src/sort.c +++ b/src/sort.c @@ -18,7 +18,6 @@ #include #include "types.h" #include "protos.h" -#include "expr.h" #include "globals.h" #include "err.h" diff --git a/src/trigger.c b/src/trigger.c index 9119dd78..b0ef9756 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -15,7 +15,6 @@ #include #include "types.h" -#include "expr.h" #include "protos.h" #include "globals.h" #include "err.h" diff --git a/src/types.h b/src/types.h index a0c161ec..98e0f99a 100644 --- a/src/types.h +++ b/src/types.h @@ -13,6 +13,22 @@ #include #include "dynbuf.h" +typedef struct udf_struct UserFunc; + +/* Define the types of values */ +#define ERR_TYPE 0 +#define INT_TYPE 1 +#define TIME_TYPE 2 +#define DATE_TYPE 3 +#define STR_TYPE 4 +#define DATETIME_TYPE 5 +#define SPECIAL_TYPE 6 /* Only for system variables */ +#define CONST_INT_TYPE 7 /* Only for system variables */ + +#define BEG_OF_EXPR '[' +#define END_OF_EXPR ']' +#define COMMA ',' + /* Values */ typedef struct { char type; diff --git a/src/userfns.c b/src/userfns.c index 50154f6b..4d09d13d 100644 --- a/src/userfns.c +++ b/src/userfns.c @@ -26,7 +26,6 @@ #include "globals.h" #include "protos.h" #include "err.h" -#include "expr.h" #define FUNC_HASH_SIZE 32 /* Size of User-defined function hash table */ diff --git a/src/var.c b/src/var.c index 3297be82..1feef0dd 100644 --- a/src/var.c +++ b/src/var.c @@ -22,7 +22,6 @@ #include #include #include "types.h" -#include "expr.h" #include "globals.h" #include "protos.h" #include "err.h"