This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
veritypes.h
59 lines (48 loc) · 1.56 KB
/
veritypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Verity - generates truth tables of logical statements
Copyright (C) 2007, 2008 John T. Wodder II
This file is part of Verity.
Verity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Verity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Verity. If not, see <http://www.gnu.org/licenses/>. */
#ifndef VERITYPES_H
#define VERITYPES_H
#include <stdio.h>
#include <stdlib.h>
#define checkMem(p) if (!(p)) {perror("verity"); exit(1); }
typedef struct symbol {
char c;
_Bool truth;
int refQty;
struct symbol* next;
} symbol;
typedef struct expr {
int oper, paren;
struct expr* next;
symbol* sym;
struct expr* args[];
} expr;
struct {
enum {txtTbl=0, wideTbl, utfTbl, latexTbl, texTbl, psTbl} tblType;
_Bool eval : 1, standalone : 1;
} flags;
extern symbol* symTbl;
extern expr* statements;
extern int symQty, stmntQty;
void addStmnt(expr* ex);
symbol* getSym(char c);
expr* symExpr(symbol* sym);
expr* notExpr(expr* ex);
expr* opExpr(int op, expr* left, expr* right);
expr* parenExpr(expr* ex);
_Bool evalExpr(expr* ex);
expr* colonExpr(symbol* sym, expr* ex);
void clearLists(void);
void freeExpr(expr* ex);
#endif