TinyMAZE/
TinyMAZE/config/
TinyMAZE/doc/
TinyMAZE/run/msgs/
TinyMAZE/src/
TinyMAZE/src/db/
TinyMAZE/src/ident/
TinyMAZE/src/io/
TinyMAZE/src/prog/
TinyMAZE/src/softcode/
TinyMAZE/src/util/
#ifndef SOFTCODE_H
#define SOFTCODE_H

#define VAR_STR 0
#define VAR_NUM 1

struct program_line_struct
{
  int line;
  char *code;
  struct program_line_struct *next;
};

struct program_struct
{
  char *name;
  char *trigger;
  struct program_line_struct *program;
  struct program_struct *next;
};

typedef struct program_line_struct PROGLINE;
typedef struct program_struct PROG;

struct scvar_struct
{
  bool type; /* VAR_STR or VAR_NUM */
  char *name;
  char *cvalue;
  int nvalue;
  bool can_modify;
  struct scvar_struct *next;
};

typedef struct scvar_struct SCVAR;

struct sc_if_struct
{
  int test;
  PROGLINE *endif;
  struct sc_if_struct *next;
};

struct sc_for_struct
{
  int max;
  int step;
  PROGLINE *top;
  PROGLINE *pnext;
  SCVAR *var;
  struct sc_for_struct *next;
};

typedef struct sc_if_struct SCIF;
typedef struct sc_for_struct SCFOR;

struct sc_gosub_struct
{
  PROGLINE *top;
  struct sc_gosub_struct *next;
};

typedef struct sc_gosub_struct SCGOSUB;

struct sc_input_struct
{
  SCVAR *var;
  struct sc_input_struct *next;
};

typedef struct sc_input_struct SCINPUT;

struct code_struct
{
  OBJ *executor;
  OBJ *object;
  time_t start_time;
  int triggered;
  int pid;
  PROG *program;
  PROGLINE *pline;
  SCVAR *vars;
  SCIF *iflist;
  SCFOR *forlist;
  SCGOSUB *gosublist;
  int advance;
  time_t wait;
  SCINPUT *input;
  struct code_struct *next;
};

typedef struct code_struct CODE;

extern CODE *code_list;
extern CODE *code_ptr;

#endif /* SOFTCODE_H */