1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
685 B
C

/*
* rpn.c: evalutor of RPN formulas
*/
#include <stdint.h>
#include <syslog.h>
#include <stdlib.h>
#include "config.h"
#include "rpn.h"
#include "trie.h"
// Growing stack implementation
struct grow {
struct trie_retval *arr;
int64_t elems;
int64_t alloc;
}
static struct grow *grow_init(void) {
struct grow *g = malloc(sizeof(struct grow));
if (g == NULL) {
syslog(cfg_log_facility | LOG_ERR, "rpn: Could not initialize growing array: %m");
return NULL;
}
g -> arr = NULL;
g -> elems = 0;
g -> alloc = 0;
return g;
}
static bool grow_push (int64_t val, struct grow *stack) {
if (stack -> alloc <= stack -> elems) {
stack
}
}
bool rpn_eval (char rpn[]) {
}