#ifndef XS_report_XS_H
#define XS_report_XS_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef bool
#define bool int
#endif
#define istypedefed 
#include <stdio.h>
#include <stdlib.h>
#define AACE_XDR_VERSION 100
#define AACE_XDR_MAGIC 0xa4ac1234
enum cmdtypes {
 CMD_NULL = 0 ,
 CMD_FOR = 1 ,
 CMD_IF = 2 ,
 CMD_WHILE = 3 ,
 CMD_LET = 4 ,
 CMD_NEED = 5 ,
 CMD_SKIP = 6 ,
 CMD_PAUSE = 7 ,
 CMD_PRINT = 8 ,
 CMD_PRINTFILE = 9 ,
 CMD_BLOCK = 10 ,
 CMD_CALL = 11 
};
typedef enum cmdtypes cmdtypes;

enum varcats {
 CAT_NULL = 0 ,
 CAT_INTERNAL = 1 ,
 CAT_PARAM = 2 ,
 CAT_VARIABLE = 3 ,
 CAT_SQL = 4 ,
 CAT_FUNCTION = 5 ,
 CAT_BUILTIN = 6 
};
typedef enum varcats varcats;

enum aggtypes {
 AGG_COUNT = 0 ,
 AGG_PERCENT = 1 ,
 AGG_AVG = 2 ,
 AGG_TOTAL = 3 ,
 AGG_MIN = 4 ,
 AGG_MAX = 5 
};
typedef enum aggtypes aggtypes;

enum expr_operands {
 EXPR_AND = 0 ,
 EXPR_OR = 1 ,
 EXPR_ADD = 2 ,
 EXPR_SUB = 3 ,
 EXPR_MUL = 4 ,
 EXPR_DIV = 5 ,
 EXPR_POW = 6 ,
 EXPR_MOD = 7 ,
 EXPR_CLIP = 8 ,
 EXPR_USING = 9 ,
 EXPR_COLUMN = 10 ,
 EXPR_SPACES = 11 ,
 EXPR_CONCAT = 12 ,
 EXPR_ISNULL = 13 ,
 EXPR_ISNOTNULL = 14 ,
 EXPR_ASCII = 15 ,
 EXPR_POSITION = 16 
};
typedef enum expr_operands expr_operands;

enum exprtype {
 EXPRTYPE_NULL = 0 ,
 EXPRTYPE_INT = 1 ,
 EXPRTYPE_DOUBLE = 2 ,
 EXPRTYPE_STRING = 3 ,
 EXPRTYPE_VARIABLE = 4 ,
 EXPRTYPE_VARIABLE_SUB = 5 ,
 EXPRTYPE_BUILTIN = 6 ,
 EXPRTYPE_COMPLEX = 7 ,
 EXPRTYPE_SIMPLE = 8 ,
 EXPRTYPE_LIST = 9 ,
 EXPRTYPE_COMPARE = 10 ,
 EXPRTYPE_FCALL = 11 ,
 EXPRTYPE_AGG = 12 
};
typedef enum exprtype exprtype;

struct expr {
exprtype type;
union {
int null;
int i;
double d;
char * s;
int varid;
char * name;
struct acerep_var_usage * var_usage;
struct complex_expr * expr;
struct compare_expr * cexpr;
struct simple_expr * sexpr;
struct expr_list * lexpr;
struct expr_call * fcall;
int aggid;
} expr_u;
};
typedef struct expr expr;
struct acerep_var_usage {
int varid;
istypedefed char * varname;
struct expr * subscript1;
struct expr * subscript2;
};
#ifndef OMIT_TYPEDEFS
typedef struct acerep_var_usage acerep_var_usage; /* XX */

#endif
struct expr_list {
struct {
 unsigned int elem_len;
 struct expr * elem_val;
} elem;
};
#ifndef OMIT_TYPEDEFS
typedef struct expr_list expr_list; /* XX */

#endif
struct expr_call {
char * fname;
struct expr_list * lexpr;
};
#ifndef OMIT_TYPEDEFS
typedef struct expr_call expr_call; /* XX */

#endif
struct complex_expr {
struct expr expr1;
enum expr_operands operand;
struct expr expr2;
};
#ifndef OMIT_TYPEDEFS
typedef struct complex_expr complex_expr; /* XX */

#endif
struct compare_expr {
char * method;
struct expr expr1;
struct expr expr2;
};
#ifndef OMIT_TYPEDEFS
typedef struct compare_expr compare_expr; /* XX */

#endif
struct simple_expr {
struct expr expr;
enum expr_operands operand;
};
#ifndef OMIT_TYPEDEFS
typedef struct simple_expr simple_expr; /* XX */

#endif
struct acerep_variable {
char * name;
char * datatype_string;
int category;
int param_no;
int datatype;
int dim;
int dataspace;
};
#ifndef OMIT_TYPEDEFS
typedef struct acerep_variable acerep_variable; /* XX */

#endif
struct ascii {
struct {
 unsigned int variables_len;
 struct acerep_variable * variables_val;
} variables;
};
#ifndef OMIT_TYPEDEFS
typedef struct ascii ascii; /* XX */

#endif
struct input_vals {
char * prompt;
char * variable_name;
int varid;
};
#ifndef OMIT_TYPEDEFS
typedef struct input_vals input_vals; /* XX */

#endif
struct output {
int right_margin;
int top_margin;
int left_margin;
int bottom_margin;
int page_length;
char * top_of_page;
int report_to_where;
char * report_to_filename;
};
#ifndef OMIT_TYPEDEFS
typedef struct output output; /* XX */

#endif
struct whereless_select {
char * select_portion;
char * into_portion;
char * group_by_portion;
};
#ifndef OMIT_TYPEDEFS
typedef struct whereless_select whereless_select; /* XX */

#endif
struct select_stmts {
istypedefed whereless_select whereless_statement;
char * statement;
int has_where;
int wherepos1;
int wherepos2;
struct {
 unsigned int varids_len;
 int * varids_val;
} varids;
struct {
 unsigned int varpos_len;
 int * varpos_val;
} varpos;
char * temp_tab_name;
struct {
 unsigned int orderby_list_len;
 int * orderby_list_val;
} orderby_list;
};
#ifndef OMIT_TYPEDEFS
typedef struct select_stmts select_stmts; /* XX */

#endif
struct read_stmt {
char * filename;
char * delimiters;
char * orderby;
};
#ifndef OMIT_TYPEDEFS
typedef struct read_stmt read_stmt; /* XX */

#endif
struct get_data {
int select_or_read;
union {
struct {
 unsigned int selects_len;
 struct select_stmts * selects_val;
} selects;
struct read_stmt read_data;
} get_data_u;
};
typedef struct get_data get_data;
struct cmd_for {
int varid;
struct expr start;
struct expr finish;
struct expr step;
struct acerep_command * command;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_for cmd_for; /* XX */

#endif
struct cmd_if {
struct expr condition;
struct acerep_command * command;
struct acerep_command * elsecommand;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_if cmd_if; /* XX */

#endif
struct cmd_call {
struct expr_call * fcall;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_call cmd_call; /* XX */

#endif
struct cmd_while {
struct expr condition;
struct acerep_command * command;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_while cmd_while; /* XX */

#endif
struct cmd_let {
int varid;
struct expr * value;
struct expr * sub1;
struct expr * sub2;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_let cmd_let; /* XX */

#endif
struct cmd_need {
int nlines;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_need cmd_need; /* XX */

#endif
struct cmd_pause {
char * message;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_pause cmd_pause; /* XX */

#endif
struct cmd_skip {
int nlines;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_skip cmd_skip; /* XX */

#endif
struct cmd_print {
struct expr print;
int printnl;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_print cmd_print; /* XX */

#endif
struct cmd_printfile {
struct expr filename_expr;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_printfile cmd_printfile; /* XX */

#endif
struct a4gl_report_function {
char * name;
};
#ifndef OMIT_TYPEDEFS
typedef struct a4gl_report_function a4gl_report_function; /* XX */

#endif
struct acerep_commands {
struct {
 unsigned int commands_len;
 struct acerep_command * commands_val;
} commands;
};
#ifndef OMIT_TYPEDEFS
typedef struct acerep_commands acerep_commands; /* XX */

#endif
struct acerep_command {
cmdtypes cmd_type;
union {
int null;
struct cmd_for cmd_for;
struct cmd_if cmd_if;
struct cmd_while cmd_while;
struct cmd_let cmd_let;
struct cmd_need cmd_need;
struct cmd_pause cmd_pause;
struct cmd_skip cmd_skip;
struct cmd_print cmd_print;
struct cmd_printfile cmd_printfile;
struct acerep_commands acerep_commands;
struct cmd_call cmd_call;
} acerep_command_u;
};
typedef struct acerep_command acerep_command;
enum formattype {
 FORMAT_PAGE_HEADER = 0 ,
 FORMAT_FIRST_PAGE_HEADER = 1 ,
 FORMAT_PAGE_TRAILER = 2 ,
 FORMAT_EVERY_ROW = 3 ,
 FORMAT_ON_EVERY_ROW = 4 ,
 FORMAT_BEFORE_GROUP = 5 ,
 FORMAT_AFTER_GROUP = 6 ,
 FORMAT_ON_LAST_ROW = 7 
};
typedef enum formattype formattype;

/* struct acerep_var_usage mt=3 ms=0 mn=acerep_var_usage mp=1 */
typedef struct acerep_var_usage * vup;
struct format {
enum formattype category;
struct expr * column;
struct acerep_commands commands;
};
#ifndef OMIT_TYPEDEFS
typedef struct format format; /* XX */

#endif
struct agg_val {
int format_id;
enum aggtypes type;
int isgroup;
struct expr * expr;
struct expr * wexpr;
};
#ifndef OMIT_TYPEDEFS
typedef struct agg_val agg_val; /* XX */

#endif
struct report {
char * magic;
char * report_name;
char * dbname;
struct ascii ascii;
struct {
 unsigned int functions_len;
 struct a4gl_report_function * functions_val;
} functions;
struct {
 unsigned int variables_len;
 struct acerep_variable * variables_val;
} variables;
struct {
 unsigned int inputs_len;
 struct input_vals * inputs_val;
} inputs;
struct output output;
struct get_data getdata;
struct {
 unsigned int fmt_len;
 struct format * fmt_val;
} fmt;
struct {
 unsigned int aggs_len;
 struct agg_val * aggs_val;
} aggs;
};
#ifndef OMIT_TYPEDEFS
typedef struct report report; /* XX */

#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /*XS_report_XS_H*/
