pebblisp/src/calc.h

73 lines
1.3 KiB
C

#ifndef CALC_H
#define CALC_H
#include <pebble.h>
#include "pebblisp.h"
#define SMAX_LENGTH 256
#define RESULT_LENGTH 20
#define CELL_HEIGHT 44
#define SCRIPT_COUNT 5
Window *s_menu_window;
Window *s_code_window;
// Custom layers
Window *s_custom_window;
TextLayer *s_heading_text_layer;
char header[30] = "";
// Code layers
TextLayer *s_input_text_layer;
TextLayer *s_result_text_layer;
// Menu layers
MenuLayer *s_menu_layer;
TextLayer *s_list_message_layer;
int current_code;
// Currently selected button, starts on '('
static int8_t selected_token = 1;
// PebbLisp environment
static struct Environment env;
// Live code text
char mytext[SMAX_LENGTH] = "";
// The actual displayed code text
char temptext[SMAX_LENGTH] = "";
// The result of execution
char resulttext[RESULT_LENGTH] = "";
const char *tokens[] = {
" ", "(", ")",
"+ ", "- ", "* ", "/ ",
"1","2","3",
"4","5","6",
"7","8","9", "0", "x",
"a", "b", "c", "d", "e",
"= ", "< ", "> ",
"\"",
"cat", "map", "fil",
"fn", "def", "if", "\n",
"...",
"END"
};
const char *func_tokens[] = {
"spent ", "window ",
"max ", "min ",
"sq ", "cube ", "exp "
};
const uint32_t inbox_size = 1024;
const uint32_t outbox_size = 64;
bool using_func_tokens = false;
#endif