50 lines
1.6 KiB
C
50 lines
1.6 KiB
C
/* ************************************************************************** */
|
|
/* _____ _ */
|
|
/* libg1m/basic.h |_ _|__ _ _| |__ ___ _ _ */
|
|
/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */
|
|
/* | | (_) | |_| | | | | __/ |_| | */
|
|
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
|
/* Last updated: 2017/01/07 17:00:25 |___/ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#ifndef LIBG1M_BASIC_H
|
|
# define LIBG1M_BASIC_H
|
|
# define CBASIC_MAX_ARGUMENTS 3
|
|
|
|
/* libg1m has utilities for interacting with Basic programs!
|
|
* Everything is basically a statement, but when it's just a
|
|
* value/variable/..., it's instruction 0x00 with one argument.
|
|
*
|
|
* Here are the types an argument can take: */
|
|
|
|
enum g1m_argument_type {
|
|
g1m_argtype_value,
|
|
g1m_argtype_variable,
|
|
g1m_argtype_string,
|
|
g1m_argtype_list,
|
|
g1m_argtype_mat,
|
|
};
|
|
|
|
/* And here's the structure of a statement: */
|
|
|
|
typedef struct g1m_basic_statement_s {
|
|
FONTCHARACTER opcode;
|
|
int argtype, id;
|
|
|
|
/* BCD values */
|
|
struct bcd real;
|
|
struct bcd imgn;
|
|
|
|
/* arguments */
|
|
int nargs;
|
|
struct g1m_basic_statement_s *args;
|
|
} g1m_bst_t;
|
|
|
|
/* And here is the function to fetch an instruction from a program content
|
|
* buffer: */
|
|
|
|
int g1m_fetch_instruction(const FONTCHARACTER *buf, size_t size,
|
|
size_t *isize, g1m_bst_t *statement);
|
|
|
|
#endif /* LIBG1M_BASIC_H */
|