2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
gb_reserved.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2017-01-13 04:29:42 +01:00
|
|
|
(c) 2000-2017 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GB_RESERVED_H
|
|
|
|
#define __GB_RESERVED_H
|
|
|
|
|
2010-05-22 20:02:34 +02:00
|
|
|
#include "gb_common.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
#include "gb_table.h"
|
|
|
|
|
2009-09-20 19:32:12 +02:00
|
|
|
enum
|
|
|
|
{
|
2010-12-29 09:21:51 +01:00
|
|
|
RSF_NONE = 0x0000,
|
|
|
|
RSF_OP = 0x0001,
|
|
|
|
RSF_TYPE = 0x0002,
|
|
|
|
RSF_ASGN = 0x0004,
|
|
|
|
RSF_NOT = 0x0008, // operator can have NOT before it
|
|
|
|
|
|
|
|
RSF_N_ARY = 0x0000,
|
|
|
|
RSF_UNARY = 0x0010,
|
|
|
|
RSF_BINARY = 0x0020,
|
|
|
|
RSF_POST = 0x0030,
|
|
|
|
RSF_ONLY = 0x0040,
|
|
|
|
|
|
|
|
RSF_OPN = 0x0001,
|
|
|
|
RSF_OP1 = 0x0011,
|
|
|
|
RSF_OP2 = 0x0021,
|
|
|
|
RSF_OPP = 0x0031,
|
|
|
|
RSF_OP2S = 0x0061,
|
|
|
|
RSF_OP2SM = 0x00A1,
|
|
|
|
|
|
|
|
RSF_POINT = 0x0100, // last pattern is a point or an exclamation mark
|
|
|
|
RSF_IDENT = 0x0200, // last pattern waits for an identifier
|
|
|
|
RSF_CLASS = 0x0400, // last pattern waits for a class
|
|
|
|
RSF_AS = 0x0800, // last pattern waits for a datatype
|
|
|
|
RSF_PREV = 0x1000, // last pattern use the flags of the last last pattern
|
|
|
|
RSF_EVENT = 0x2000, // last pattern waits for an event name
|
|
|
|
RSF_PUB = 0x4000, // last pattern is PUBLIC, PRIVATE or STATIC
|
|
|
|
|
2009-09-20 19:32:12 +02:00
|
|
|
RSF_IMASK = 0xFF00
|
|
|
|
};
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2016-03-14 02:40:50 +01:00
|
|
|
enum {
|
|
|
|
RST_SAME = 17, // T_OBJECT + 1
|
|
|
|
RST_ADD,
|
|
|
|
RST_AND,
|
|
|
|
RST_NOT,
|
|
|
|
RST_BCLR,
|
|
|
|
RST_MIN
|
|
|
|
};
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#define RES_is_operator(value) (COMP_res_info[value].flag & RSF_OP)
|
|
|
|
#define RES_is_type(value) (COMP_res_info[value].flag & RSF_TYPE)
|
|
|
|
#define RES_is_assignment(value) (COMP_res_info[value].flag & RSF_ASGN)
|
|
|
|
#define RES_is_only(value) (COMP_res_info[value].flag & RSF_ONLY)
|
|
|
|
#define RES_get_ident_flag(value) (COMP_res_info[value].flag & RSF_IMASK)
|
2010-05-25 13:19:00 +02:00
|
|
|
#define RES_get_read_switch(value) (COMP_res_info[value].read_switch)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define RES_priority(_res) (COMP_res_info[_res].priority)
|
|
|
|
|
|
|
|
#define RES_is_unary(value) ((COMP_res_info[value].flag & 0x30) == RSF_UNARY)
|
|
|
|
#define RES_is_binary(value) ((COMP_res_info[value].flag & 0x30) == RSF_BINARY)
|
|
|
|
#define RES_is_n_ary(value) ((COMP_res_info[value].flag & 0x30) == RSF_N_ARY)
|
|
|
|
#define RES_is_post(value) ((COMP_res_info[value].flag & 0x30) == RSF_POST)
|
|
|
|
|
|
|
|
#define RES_get_type(_res) (COMP_res_info[_res].value)
|
|
|
|
#define RES_get_assignment_operator(_res) (COMP_res_info[_res].value)
|
|
|
|
|
2010-12-29 09:21:51 +01:00
|
|
|
#define RES_can_have_not_before(value) (COMP_res_info[value].flag & RSF_NOT)
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
typedef
|
2010-12-18 05:27:59 +01:00
|
|
|
enum {
|
|
|
|
RS_NONE,
|
|
|
|
RS_BOOLEAN,
|
|
|
|
RS_BYTE,
|
|
|
|
RS_DATE,
|
|
|
|
RS_SINGLE,
|
|
|
|
RS_FLOAT,
|
|
|
|
RS_INTEGER,
|
|
|
|
RS_LONG,
|
|
|
|
RS_SHORT,
|
|
|
|
RS_STRING,
|
|
|
|
RS_VARIANT,
|
|
|
|
RS_OBJECT,
|
|
|
|
RS_POINTER,
|
|
|
|
RS_CLASS,
|
|
|
|
RS_FUNCTION,
|
|
|
|
RS_STRUCT,
|
|
|
|
RS_CONST,
|
|
|
|
RS_PRIVATE,
|
|
|
|
RS_PUBLIC,
|
|
|
|
RS_STATIC,
|
2012-03-06 02:50:41 +01:00
|
|
|
RS_FAST,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_PROPERTY,
|
|
|
|
RS_EVENT,
|
|
|
|
RS_INHERITS,
|
|
|
|
RS_IMPLEMENTS,
|
|
|
|
RS_E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|
RS_LET,
|
2012-01-31 03:33:01 +01:00
|
|
|
RS_PINF,
|
|
|
|
RS_MINF,
|
2014-11-12 23:25:37 +01:00
|
|
|
RS_USE,
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_PRINT,
|
|
|
|
RS_INPUT,
|
|
|
|
RS_READ,
|
|
|
|
RS_WRITE,
|
|
|
|
RS_OPEN,
|
|
|
|
RS_CLOSE,
|
|
|
|
RS_SEEK,
|
|
|
|
RS_APPEND,
|
|
|
|
RS_CREATE,
|
|
|
|
RS_BINARY,
|
|
|
|
RS_LINE,
|
|
|
|
RS_FLUSH,
|
|
|
|
RS_EXEC,
|
|
|
|
RS_SHELL,
|
|
|
|
RS_WAIT,
|
|
|
|
RS_SLEEP,
|
|
|
|
RS_KILL,
|
|
|
|
RS_MOVE,
|
|
|
|
RS_COPY,
|
|
|
|
RS_INC,
|
|
|
|
RS_DEC,
|
|
|
|
RS_MKDIR,
|
|
|
|
RS_RMDIR,
|
|
|
|
RS_WATCH,
|
|
|
|
RS_LINK,
|
|
|
|
RS_LOCK,
|
|
|
|
RS_UNLOCK,
|
|
|
|
RS_LIBRARY,
|
|
|
|
RS_DEBUG,
|
|
|
|
RS_PIPE,
|
|
|
|
RS_RANDOMIZE,
|
|
|
|
RS_BYREF,
|
2009-09-17 22:58:27 +02:00
|
|
|
RS_MEMORY,
|
2012-01-15 09:54:57 +01:00
|
|
|
RS_CHMOD,
|
|
|
|
RS_CHOWN,
|
|
|
|
RS_CHGRP,
|
2010-12-18 05:27:59 +01:00
|
|
|
|
|
|
|
RS_P_IF,
|
|
|
|
RS_P_ELSE,
|
|
|
|
RS_P_ENDIF,
|
2010-12-27 15:28:59 +01:00
|
|
|
RS_P_CONST,
|
2011-04-16 15:25:46 +02:00
|
|
|
RS_P_LINE,
|
2010-12-18 05:27:59 +01:00
|
|
|
|
|
|
|
RS_COLON,
|
|
|
|
RS_SCOLON,
|
|
|
|
RS_COMMA,
|
|
|
|
RS_3PTS,
|
|
|
|
RS_SHARP,
|
|
|
|
RS_AT,
|
|
|
|
RS_QUES,
|
|
|
|
RS_LBRC,
|
|
|
|
RS_RBRC,
|
|
|
|
RS_EQUAL,
|
|
|
|
RS_NEAR,
|
|
|
|
RS_LBRA,
|
|
|
|
RS_RBRA,
|
|
|
|
RS_PT,
|
|
|
|
RS_EXCL,
|
|
|
|
RS_PLUS,
|
|
|
|
RS_MINUS,
|
|
|
|
RS_STAR,
|
|
|
|
RS_SLASH,
|
|
|
|
RS_FLEX,
|
|
|
|
RS_AMP,
|
2010-12-29 09:21:51 +01:00
|
|
|
RS_FILE,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_GT,
|
|
|
|
RS_LT,
|
|
|
|
RS_GE,
|
|
|
|
RS_LE,
|
|
|
|
RS_NE,
|
|
|
|
RS_LSQR,
|
|
|
|
RS_RSQR,
|
|
|
|
RS_AND,
|
|
|
|
RS_OR,
|
|
|
|
RS_NOT,
|
|
|
|
RS_XOR,
|
|
|
|
RS_BSLASH,
|
|
|
|
RS_DIV,
|
2010-12-14 00:46:01 +01:00
|
|
|
RS_PERCENT,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_MOD,
|
|
|
|
RS_IS,
|
2010-12-29 09:21:51 +01:00
|
|
|
RS_NOT_IS,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_LIKE,
|
2010-12-29 09:21:51 +01:00
|
|
|
RS_NOT_LIKE,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_BEGINS,
|
2010-12-29 09:21:51 +01:00
|
|
|
RS_NOT_BEGINS,
|
2010-12-18 05:27:59 +01:00
|
|
|
RS_ENDS,
|
2010-12-29 09:21:51 +01:00
|
|
|
RS_NOT_ENDS,
|
2010-12-18 05:27:59 +01:00
|
|
|
|
|
|
|
RS_PLUS_EQ,
|
|
|
|
RS_MINUS_EQ,
|
|
|
|
RS_STAR_EQ,
|
|
|
|
RS_SLASH_EQ,
|
|
|
|
RS_DIV_EQ,
|
|
|
|
RS_MOD_EQ,
|
|
|
|
RS_AMP_EQ,
|
|
|
|
RS_FILE_EQ,
|
|
|
|
}
|
|
|
|
RESERVED_ID;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2010-12-18 05:27:59 +01:00
|
|
|
OP_NONE ,
|
|
|
|
OP_COLON ,
|
|
|
|
OP_EQUAL ,
|
|
|
|
OP_NEAR ,
|
|
|
|
OP_LBRA ,
|
|
|
|
OP_RBRA ,
|
|
|
|
OP_PT ,
|
|
|
|
OP_EXCL ,
|
|
|
|
OP_COMMA ,
|
|
|
|
OP_3PTS ,
|
|
|
|
OP_PLUS ,
|
|
|
|
OP_MINUS ,
|
|
|
|
OP_STAR ,
|
|
|
|
OP_SLASH ,
|
|
|
|
OP_FLEX ,
|
|
|
|
OP_AMP ,
|
2010-12-29 09:21:51 +01:00
|
|
|
OP_FILE ,
|
2010-12-18 05:27:59 +01:00
|
|
|
OP_GT ,
|
|
|
|
OP_LT ,
|
|
|
|
OP_GE ,
|
|
|
|
OP_LE ,
|
|
|
|
OP_NE ,
|
|
|
|
OP_LSQR ,
|
|
|
|
OP_RSQR ,
|
|
|
|
OP_AND ,
|
|
|
|
OP_OR ,
|
|
|
|
OP_NOT ,
|
|
|
|
OP_XOR ,
|
|
|
|
OP_DIV ,
|
|
|
|
OP_MOD ,
|
|
|
|
OP_IS ,
|
2010-12-29 09:21:51 +01:00
|
|
|
OP_LIKE
|
2007-12-30 17:41:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef
|
2010-12-18 05:27:59 +01:00
|
|
|
struct {
|
|
|
|
const char *name;
|
|
|
|
short flag;
|
2016-03-14 02:40:50 +01:00
|
|
|
uchar value;
|
|
|
|
uchar read_switch;
|
|
|
|
uchar priority;
|
|
|
|
uchar type;
|
2010-12-18 05:27:59 +01:00
|
|
|
short code;
|
2009-09-27 11:28:52 +02:00
|
|
|
short subcode;
|
2010-12-18 05:27:59 +01:00
|
|
|
void (*func)();
|
|
|
|
}
|
|
|
|
COMP_INFO;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2010-12-18 05:27:59 +01:00
|
|
|
struct {
|
|
|
|
const char *name;
|
|
|
|
ushort opcode;
|
|
|
|
ushort optype;
|
2016-03-14 02:40:50 +01:00
|
|
|
uchar type;
|
2010-12-18 05:27:59 +01:00
|
|
|
short min_param;
|
|
|
|
short max_param;
|
|
|
|
}
|
|
|
|
SUBR_INFO;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#ifndef __RESERVED_C
|
|
|
|
|
|
|
|
EXTERN COMP_INFO COMP_res_info[];
|
|
|
|
EXTERN SUBR_INFO COMP_subr_info[];
|
|
|
|
|
2010-05-25 13:19:00 +02:00
|
|
|
//EXTERN TABLE *COMP_res_table;
|
|
|
|
//EXTERN TABLE *COMP_subr_table;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-19 02:36:38 +01:00
|
|
|
EXTERN int SUBR_VarPtr;
|
2014-05-08 17:10:21 +02:00
|
|
|
EXTERN int SUBR_IsMissing;
|
2008-03-17 15:54:17 +01:00
|
|
|
EXTERN int SUBR_Mid;
|
|
|
|
EXTERN int SUBR_MidS;
|
2008-01-19 02:36:38 +01:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#endif
|
|
|
|
|
2008-01-19 02:36:38 +01:00
|
|
|
void RESERVED_init(void);
|
|
|
|
void RESERVED_exit(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-19 02:36:38 +01:00
|
|
|
int RESERVED_find_word(const char *word, int len);
|
2010-05-25 13:19:00 +02:00
|
|
|
int RESERVED_find_subr(const char *word, int len);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-19 02:36:38 +01:00
|
|
|
SUBR_INFO *SUBR_get(const char *subr_name);
|
|
|
|
SUBR_INFO *SUBR_get_from_opcode(ushort opcode, ushort optype);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#endif
|