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

34 lines
737 B

6 years ago
#ifndef _LIBSE_H
#define _LIBSE_H
#include <stdio.h>
typedef struct {
void* ptr;
int size;
int alloced;
int sexpr;
} car_t;
typedef struct cons {
union {
void* ptr;
car_t car;
};
struct cons* cdr;
} list_t;
#define SET_PARSE_NIL (1<<0)
#define SET_PARSE_QUOTE (1<<1)
#define SET_PARSE_ESCAPE (1<<2)
#define SET_PARSE_INSENSITIVE (1<<3)
6 years ago
#define SETP_DEFAULT (SET_PARSE_QUOTE | SET_PARSE_ESCAPE)
#define SETP_LISP (SETP_DEFAULT | SET_PARSE_INSENSITIVE | SET_PARSE_NIL)
list_t* se_parse(const char* sexpr, unsigned int flags); //Parse string into list.
6 years ago
void se_free(list_t* list); //Free whole list.
void se_print(FILE* fp, const list_t* list); //Print list to fp, if fp is NULL, print to stdout.
#endif /* _LIBSE_H */