Archived
1
0
Fork 0
This repository has been archived on 2023-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
lispy/lval/numbers.h

29 lines
777 B
C
Raw Normal View History

2018-06-07 19:10:53 -04:00
#ifndef LVALIO_NUMBERS
#define LVALIO_NUMBERS
#include <stddef.h>
#include "../mpc.h"
#include "base.h"
// Including operations.h for lval_err
#include "operations.h"
// Constructors for numeric data types
lval* lval_long(long x);
lval* lval_double(double x);
// Helper functions to parse the tree and obtain the full string to parse
size_t treeContentsLength(mpc_ast_t* t);
char* concatTreeContents(mpc_ast_t* t);
void concatNodeContents(char* stringToExtend, mpc_ast_t* t, size_t* currentLength);
// Parsing of numeric types
lval* lval_read_double(mpc_ast_t* t);
lval* lval_read_long(mpc_ast_t* t);
// Accessing the numeric data in a lval structure
// TODO: Rename these methods
double lval_getData(lval* x);
void lval_updateData(lval* x, double val, int type);
#endif