aboutsummaryrefslogtreecommitdiff
path: root/core/bgdc/include
diff options
context:
space:
mode:
Diffstat (limited to 'core/bgdc/include')
-rw-r--r--core/bgdc/include/bgdc.h140
-rw-r--r--core/bgdc/include/codeblock.h92
-rw-r--r--core/bgdc/include/compiler.h129
-rw-r--r--core/bgdc/include/constants.h48
-rw-r--r--core/bgdc/include/errors.h44
-rw-r--r--core/bgdc/include/errors_st.h49
-rw-r--r--core/bgdc/include/identifiers.h59
-rw-r--r--core/bgdc/include/messages.h154
-rw-r--r--core/bgdc/include/procdef.h105
-rw-r--r--core/bgdc/include/segment.h71
-rw-r--r--core/bgdc/include/token.h85
-rw-r--r--core/bgdc/include/varspace.h74
12 files changed, 1050 insertions, 0 deletions
diff --git a/core/bgdc/include/bgdc.h b/core/bgdc/include/bgdc.h
new file mode 100644
index 0000000..649deea
--- /dev/null
+++ b/core/bgdc/include/bgdc.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+/*
+ * FILE : bgdc.h
+ * DESCRIPTION : Base includes in compiler and some vars and const defines
+ *
+ * HISTORY:
+ *
+ */
+
+#ifndef ENGLISH
+#define ENGLISH
+#endif
+
+/*
+ * VERSION
+ */
+
+#define BGDC_VERSION "BGDC " VERSION " (" __DATE__ " " __TIME__ ")"
+
+/*
+ * HEADER FILES
+ */
+
+#include <messages.h>
+#include <commons_defs.h>
+
+#include "files.h"
+#include "xctype.h"
+
+/* ---------------------------------------------------------------------- */
+/* Módulos generales de mantenimiento de datos */
+/* ---------------------------------------------------------------------- */
+
+#include "typedef.h"
+#include "constants.h"
+#include "identifiers.h"
+#include "xstrings.h"
+
+/* ---------------------------------------------------------------------- */
+/* Trucos de portabilidad */
+/* ---------------------------------------------------------------------- */
+
+#include "arrange.h"
+
+/* ---------------------------------------------------------------------- */
+/* Compilador */
+/* ---------------------------------------------------------------------- */
+
+#include "segment.h"
+#include "varspace.h"
+#include "token.h"
+#include "codeblock.h"
+#include "procdef.h"
+#include "compiler.h"
+
+extern char * main_path ;
+
+extern char * appexename ;
+extern char * appexepath ;
+extern char * appexefullpath ;
+
+extern int autoinclude ; /* Incluye ficheros en el DCB automáticamente */
+extern int imports[] ; /* Códigos de cadena con nombres de imports */
+extern int nimports ; /* Número de imports */
+extern int libmode ;
+
+extern char langinfo[64] ; /* language setting */
+
+extern int no_include_this_file ;
+
+extern int debug;
+
+/* Funciones para guardar y cargar un fichero DCB */
+
+#include "dcb.h"
+
+extern void dcb_add_file (const char * filename) ;
+extern int dcb_save (const char * filename, int options, const char * stubname) ;
+extern void dcb_settype (DCB_TYPEDEF * d, TYPEDEF * t) ;
+
+/* Funciones del sistema (no definidas) */
+
+typedef struct _sysproc
+{
+ int code ;
+ char * name ;
+ char * paramtypes ;
+ BASETYPE type ;
+ int params ;
+ int id ;
+
+ /* For sysproc_list */
+ struct _sysproc * next;
+}
+SYSPROC ;
+
+extern int sysproc_add (char * name, char * paramtypes, int type, void * func);
+extern SYSPROC * sysproc_get (int id) ;
+extern SYSPROC * * sysproc_getall (int id) ;
+extern char * sysproc_name (int code) ;
+extern void sysproc_init() ;
+
+extern void compile_warning( int, const char *fmt, ... );
+extern void compile_error( const char *fmt, ... );
+
+
+/* Constantes */
+
+extern void core_init() ;
+
+#include "offsets.h"
+#include "pslang.h"
+
diff --git a/core/bgdc/include/codeblock.h b/core/bgdc/include/codeblock.h
new file mode 100644
index 0000000..693f8bc
--- /dev/null
+++ b/core/bgdc/include/codeblock.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __CODEBLOCK_H
+#define __CODEBLOCK_H
+
+/* Bloques de código compilado. Contienen estructuras que sólo se emplean
+ * durante el compilado: la función program_postprocess() independiza los
+ * datos (CODEBLOCK.data[]) de dichas estructuras, que el intérprete
+ * no necesita */
+
+typedef struct _codeblock
+{
+ int * data ;
+ int reserved ;
+ int current ;
+ int previous ;
+ int previous2 ;
+
+ int * loops ;
+ int loop_count ;
+ int loop_reserved ;
+ int loop_active ;
+
+ int * labels ;
+ int label_count ;
+ int label_reserved ;
+ struct _labelsextra{
+ int name;
+ int file;
+ int line;
+ } * labelsextra;
+
+}
+CODEBLOCK ;
+
+typedef struct _codeblock_pos
+{
+ int current;
+ int previous;
+ int previous2;
+}
+CODEBLOCK_POS ;
+
+extern void codeblock_init(CODEBLOCK * c) ;
+extern void codeblock_add (CODEBLOCK * c, int code, int param) ;
+extern void codeblock_add_block (CODEBLOCK * c, CODEBLOCK_POS from, CODEBLOCK_POS to);
+extern void codeblock_loop_start (CODEBLOCK * c, int loop, int begin) ;
+extern void codeblock_loop_end (CODEBLOCK * c, int loop, int end) ;
+extern int codeblock_loop_add (CODEBLOCK * c) ;
+extern int codeblock_label_add (CODEBLOCK * c, int identifier) ;
+extern void codeblock_label_set (CODEBLOCK * c, int label, int offset) ;
+extern int codeblock_label_get (CODEBLOCK * c, int label);
+extern int codeblock_label_get_id_by_name (CODEBLOCK * c, int name);
+extern void codeblock_postprocess (CODEBLOCK * c) ;
+extern void codeblock_dump (CODEBLOCK * c) ;
+extern void mnemonic_dump (int i, int param) ;
+extern void program_postprocess () ;
+
+extern CODEBLOCK_POS codeblock_pos(CODEBLOCK * c);
+extern void codeblock_setpos(CODEBLOCK * c, CODEBLOCK_POS p);
+
+extern void codeblock_alloc (CODEBLOCK * c, int count);
+
+
+#endif
+
diff --git a/core/bgdc/include/compiler.h b/core/bgdc/include/compiler.h
new file mode 100644
index 0000000..7a66a4e
--- /dev/null
+++ b/core/bgdc/include/compiler.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __COMPILER_H
+#define __COMPILER_H
+
+#include <stdint.h>
+
+#include "typedef.h"
+#include "procdef.h"
+#include "varspace.h"
+
+/* Compilador */
+
+typedef struct _expresion_result
+{
+ int asignation ;
+ int call ;
+ int lvalue ;
+ int constant ;
+ TYPEDEF type ;
+
+ int count; /* Usados para array genericos */
+
+ int32_t value ;
+ float fvalue ;
+}
+expresion_result ;
+
+extern void compile_error (const char * error, ...) ;
+extern void compile_warning (int, const char * error, ...) ;
+
+/* Compilado de secciones superiores */
+extern void compile_init ();
+extern void compile_program ();
+extern void compile_sentence (PROCDEF * p) ;
+extern void compile_block(PROCDEF *) ;
+
+extern void import_mod( char * libname );
+
+/* Compilado de secciones especiales (definición de datos, etc) */
+extern int compile_array_data (VARSPACE * n, segment * data, int size, int subsize, BASETYPE *t) ;
+extern int compile_varspace (VARSPACE * n, segment * data, int additive, int copies, int padding, VARSPACE ** c, int alignment, int duplicateignore) ;
+extern void compile_constants () ;
+
+#define DEFAULT_ALIGNMENT 4
+
+/* Compilador de expresiones */
+extern expresion_result compile_value () ;
+extern expresion_result compile_factor () ;
+extern expresion_result compile_operand () ;
+extern expresion_result compile_operation () ;
+extern expresion_result compile_rotation () ;
+extern expresion_result compile_clausule () ;
+extern expresion_result compile_comparison () ;
+extern expresion_result compile_subexpresion () ;
+extern expresion_result compile_expresion (int need_constant, int need_lvalue, int discart_code, BASETYPE t) ;
+extern expresion_result convert_result_type (expresion_result res, BASETYPE t);
+
+/* Códigos de identificadores y palabras reservadas */
+
+extern int
+
+ identifier_program, identifier_debug, identifier_const,
+ identifier_begin, identifier_end, identifier_struct,
+ identifier_global, identifier_local, identifier_public, identifier_private,
+ identifier_const, identifier_dup, identifier_while,
+ identifier_repeat, identifier_until, identifier_switch,
+ identifier_case, identifier_default, identifier_loop,
+ identifier_for, identifier_from, identifier_step,
+ identifier_to, identifier_if, identifier_else,
+ identifier_break, identifier_continue, identifier_return,
+ identifier_frame, identifier_clone, identifier_yield,
+ identifier_onexit, identifier_onerror,
+ identifier_jmp, identifier_call,
+ identifier_on, identifier_exit, identifier_error, identifier_resume, identifier_stm_next,
+ identifier_sizeof, identifier_bandoffset,
+ identifier_offset, identifier_pointer, identifier_type,
+ identifier_and, identifier_or , identifier_xor, identifier_not,
+ identifier_band, identifier_bor, identifier_bxor, identifier_bnot,
+ identifier_plus, identifier_minus, identifier_plusplus, identifier_minusminus,
+ identifier_equal, identifier_multiply, identifier_mod,
+ identifier_divide, identifier_semicolon, identifier_colon,
+ identifier_comma, identifier_ror, identifier_rol,
+ identifier_rightp, identifier_leftp, identifier_rightb,
+ identifier_leftb, identifier_point, identifier_twopoints,
+ identifier_eq, identifier_ne, identifier_gte,
+ identifier_lte, identifier_lt, identifier_gt,
+ identifier_plusequal, identifier_minusequal, identifier_multequal,
+ identifier_divequal, identifier_modequal, identifier_orequal,
+ identifier_xorequal, identifier_andequal, identifier_rorequal,
+ identifier_rolequal, identifier_mouse, identifier_dword,
+ identifier_word, identifier_byte, identifier_string,
+ identifier_float, identifier_include, identifier_type,
+ identifier_import, identifier_elseif, identifier_question,
+ identifier_function, identifier_int, identifier_short,
+ identifier_char, identifier_unsigned, identifier_signed ;
+
+extern int reserved_words ; /* Número de palabras reservadas */
+
+extern int identifier_is_type(int id);
+extern int identifier_is_basic_type(int id);
+
+#endif
diff --git a/core/bgdc/include/constants.h b/core/bgdc/include/constants.h
new file mode 100644
index 0000000..ee67c7a
--- /dev/null
+++ b/core/bgdc/include/constants.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __CONSTANTS_H
+#define __CONSTANTS_H
+/* Gestor de constantes */
+
+#include "typedef.h"
+
+typedef struct _constant
+{
+ int code ;
+ int value ;
+ TYPEDEF type ;
+}
+CONSTANT ;
+
+extern void constants_init () ;
+extern void constants_dump () ;
+extern void constants_add (int code, TYPEDEF type, int value) ;
+extern CONSTANT * constants_search (int code) ;
+
+#endif
diff --git a/core/bgdc/include/errors.h b/core/bgdc/include/errors.h
new file mode 100644
index 0000000..7c30091
--- /dev/null
+++ b/core/bgdc/include/errors.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __ERRORS_H
+#define __ERRORS_H
+
+#include <errors_st.h>
+
+
+extern struct _errindex errtable[10] ;
+
+extern struct _errmsg * err_addError(int code,const char * msg) ;
+extern void err_delError(struct _errmsg * err) ;
+extern const char * err_getErrorByCode(int code) ;
+extern void err_buildErrorTable(void) ;
+extern void err_destroyErrorTable(void) ;
+
+#endif
+
diff --git a/core/bgdc/include/errors_st.h b/core/bgdc/include/errors_st.h
new file mode 100644
index 0000000..75153dd
--- /dev/null
+++ b/core/bgdc/include/errors_st.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __ERRORS_ST_H
+#define __ERRORS_ST_H
+
+typedef struct _errmsg
+{
+ int code ;
+ char * msg ;
+ struct _errmsg * next ;
+ struct _errmsg * prev ;
+}
+errmsg ;
+
+typedef struct _errindex
+{
+ int count ;
+ errmsg * errlist ;
+}
+errindex ;
+
+#endif
+
diff --git a/core/bgdc/include/identifiers.h b/core/bgdc/include/identifiers.h
new file mode 100644
index 0000000..1db7adf
--- /dev/null
+++ b/core/bgdc/include/identifiers.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __IDENTIFIERS_H
+#define __IDENTIFIERS_H
+
+typedef struct _identifier
+{
+ const char * name ;
+ int code ;
+ int line ; /* First USE for the identifier */
+ int f ; /* file where the id was found */
+ struct _identifier * next ;
+}
+identifier ;
+
+/* Gestor de identificadores */
+
+extern void identifier_init () ;
+extern void identifier_dump () ;
+extern int identifier_add (const char * string) ;
+extern int identifier_add_as (const char * string, int code) ;
+extern int identifier_search (const char * string) ;
+extern int identifier_search_or_add (const char * string) ;
+extern const char * identifier_name (int code) ;
+extern int identifier_line (int code) ;
+extern int identifier_file (int code) ;
+
+extern int identifier_next_code () ;
+
+extern identifier * identifier_first() ;
+extern identifier * identifier_next (identifier * id) ;
+
+#endif
diff --git a/core/bgdc/include/messages.h b/core/bgdc/include/messages.h
new file mode 100644
index 0000000..e82a4b6
--- /dev/null
+++ b/core/bgdc/include/messages.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __MESSAGES_H
+#define __MESSAGES_H
+
+#define MSG_LIBRARY_NOT_FOUND "Library \"%s\" not found"
+#define MSG_FILE_NOT_FOUND "%s: file not found"
+#define MSG_FILE_TOO_BIG "%s: file too big"
+#define MSG_FILE_EMPTY "%s: file is empty"
+#define MSG_READ_ERROR "%s: file reading error"
+#define MSG_DIRECTORY_MISSING "You must specify a directory"
+#define MSG_TOO_MANY_FILES "Too many files specified"
+#define MSG_USING "Use: %s [options] filename\n\n"
+#define MSG_OPTION_D " -d Debugging mode\n"
+#define MSG_OPTIONS \
+ " -o ouputfile Ouput DCB file\n" \
+ " -i dir Adds the directory to the PATH\n" \
+ " -a Automaticaly adds all files to the DCB\n" \
+ " -f file Adds a single file to the DCB\n" \
+ " -l lang Specify locale settings\n" \
+ " -s stub Generate a stubbed executable from the given stub\n" \
+ " -g Stores debugging information at the DCB\n" \
+ " -c File uses the MS-DOS character set\n" \
+ " -D macro=text Set a macro\n" \
+ " -p|--pedantic Don't use automatic declare\n" \
+ " --libmode Build a library\n" \
+ " -L library Include a library\n" \
+ " -C options Specify compiler options\n" \
+ " Where options are:\n" \
+ " a Enable automatic declare functions\n" \
+ "\n"
+#define MSG_LICENSE \
+ "This software is provided 'as-is', without any express or implied\n" \
+ "warranty. In no event will the authors be held liable for any damages\n" \
+ "arising from the use of this software.\n" \
+ "\n" \
+ "Permission is granted to anyone to use this software for any purpose,\n" \
+ "including commercial applications, and to alter it and redistribute it\n" \
+ "freely, subject to the following restrictions:\n" \
+ "\n" \
+ " 1. The origin of this software must not be misrepresented; you must not\n" \
+ " claim that you wrote the original software. If you use this software\n" \
+ " in a product, an acknowledgment in the product documentation would be\n" \
+ " appreciated but is not required.\n" \
+ "\n" \
+ " 2. Altered source versions must be plainly marked as such, and must not be\n" \
+ " misrepresented as being the original software.\n" \
+ "\n" \
+ " 3. This notice may not be removed or altered from any source\n" \
+ " distribution.\n"
+#define MSG_COMPILE_ERROR "%s%s:%d: error: %s"
+#define MSG_COMPILE_WARNING "%s%s:%d: warning: %s"
+#define MSG_CONSTANT_NAME_EXP "Constant name expected"
+#define MSG_INVALID_IDENTIFIER "Invalid identifier"
+#define MSG_EXPECTED "\"%s\" expected"
+#define MSG_PROCNAME_EXP "Procedure name expected"
+#define MSG_INVALID_PARAM "Parameter name invalid"
+#define MSG_INVALID_PARAMT "Parameter type invalid"
+#define MSG_TOO_MANY_PARAMS "Too many parameters in a definition"
+#define MSG_INCORRECT_PARAMC "Incorrect number of parameters. Function: %s MinParams: %d."
+#define MSG_NO_BEGIN "BEGIN expected"
+#define MSG_NO_END "END expected"
+#define MSG_ELSE_WOUT_IF "ELSE without IF"
+#define MSG_PROGRAM_NAME_EXP "Program name expected"
+#define MSG_PROCESS_NAME_EXP "Procedure name expected"
+#define MSG_INVALID_TYPE "Invalid data type"
+#define MSG_UNEXPECTED_TOKEN "Unexpected token (too many ENDs?)"
+#define MSG_UNEXPECTED_TOKEN_GENERIC "Unexpected token"
+#define MSG_NO_MAIN "Main procedure was not defined"
+#define MSG_INTEGER_REQUIRED "Integer type required"
+#define MSG_NUMBER_REQUIRED "Numeric type required"
+#define MSG_INCOMP_TYPES "Data types not compatible with operation"
+#define MSG_INCOMP_TYPE "Data type not accepted here"
+#define MSG_UNKNOWN_IDENTIFIER "Unknown identifier"
+#define MSG_NOT_AN_ARRAY "Not an array or struct array"
+#define MSG_BOUND "Index out of range"
+#define MSG_IDENTIFIER_EXP "Identifier expected"
+#define MSG_NOT_AN_LVALUE "Can't get the address of an inmediate value"
+#define MSG_NOT_A_POINTER "Pointer required"
+#define MSG_VARIABLE_REQUIRED "Variable required"
+#define MSG_STRUCT_REQUIRED "Struct required"
+#define MSG_DIVIDE_BY_ZERO "Division by zero"
+#define MSG_TYPES_NOT_THE_SAME "Values are of incompatible type"
+#define MSG_CONSTANT_EXP "Constant value expected"
+#define MSG_STRING_EXP "String expected"
+#define MSG_NO_LOOP "Out of loop"
+#define MSG_INVALID_STEP "Invalid STEP"
+#define MSG_INVALID_SENTENCE "Invalid sentence"
+#define MSG_VTA "Can't create an array of undefined multiple sizes"
+#define MSG_TOO_MANY_AL "Too many array levels"
+#define MSG_CONSTANT_REDECLARED_AS_VARIABLE "Constant redeclared as variable"
+#define MSG_VARIABLE_REDECLARED_AS_CONSTANT "Variable redeclared as constant"
+#define MSG_VARIABLE_REDECLARE "Variable redeclared"
+#define MSG_VARIABLE_REDECLARE_DIFF "Variable redeclared with different type"
+#define MSG_IDENTIFIER_EXP "Identifier expected"
+#define MSG_CANT_INIT_STR "This struct can't be initialized"
+#define MSG_TOO_MANY_INIT "Too many initializers"
+#define MSG_TOO_MANY_INCLUDES "Too many nested includes"
+#define MSG_IDENTIFIER_TOO_LONG "Identifier too long"
+#define MSG_INVALID_CHAR "Invalid Character"
+#define MSG_TOO_MANY_TYPES "Too many user-defined types"
+#define MSG_UNDEFINED_PROC "Undefined procedure"
+#define MSG_NO_COMPATIBLE_DLL "The library is not BennuGD compatible"
+#define MSG_TOO_MANY_SYSPROCS "Too many system functions"
+#define MSG_INCORRECT_PTR_INIT "A pointer can only be initialized to 0"
+#define MSG_NOT_ENOUGH_INIT "Not enough initializers"
+#define MSG_MULTIPLE_PROCS_FOUND "Various conflicting versions of %s found"
+#define MSG_QUESTION_INC "Incompatible types at the sides of ? operator"
+#define MSG_UNKNOWN_PREP "Unknown preprocessor directive"
+#define MSG_PTR_CONVERSION "Invalid conversion of non-pointer to pointer"
+#define MSG_CONVERSION "Unsupported data type cast"
+#define MSG_PROC_ALREADY_DEFINED "Process/function already defined"
+#define MSG_PROC_ALREADY_DECLARED "Process/function already declared"
+#define MSG_FRAME_REQUIRES_INT "FRAME requires an INT return value type"
+#define MSG_VARIABLE_ERROR "Variable already defined as process, expected type or variable name"
+#define MSG_PROTO_ERROR "Conflict with previous declaration"
+#define MSG_MACRO_ERROR "Macro %s already declared"
+#define MSG_OR " or "
+#define MSG_TOO_COMPLEX "Expression too complex"
+#define MSG_EXTRA_CHAR "Extra character"
+#define MSG_INVALID_EXP "Invalid expression"
+#define MSG_FILENAME_EXP "Filename expected"
+
+#define MSG_ON_PARAM_ERR "ERROR/EXIT expected"
+#define MSG_GOTO_EXP "GOTO/JMP expected"
+
+#endif
+
diff --git a/core/bgdc/include/procdef.h b/core/bgdc/include/procdef.h
new file mode 100644
index 0000000..ee6b47a
--- /dev/null
+++ b/core/bgdc/include/procdef.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __PROCDEF_H
+#define __PROCDEF_H
+
+/* Procesos (un "PROCDEF" es, en realidad, simplemente su definición) */
+
+#include "segment.h"
+#include "varspace.h"
+#include "codeblock.h"
+#include "typedef.h"
+
+#define MAX_PARAMS 256
+
+#define PROC_USES_FRAME 0x01
+#define PROC_USES_LOCALS 0x02
+#define PROC_FUNCTION 0x04
+#define PROC_USES_PUBLICS 0x08
+
+typedef struct _sentence
+{
+ int file ;
+ int line ;
+ int col ;
+ int offset ;
+}
+SENTENCE ;
+
+typedef struct _procdef
+{
+ VARSPACE * privars ;
+ segment * pridata ;
+
+ /* (2006/11/19 23:15 GMT-03:00, Splinter - jj_arg@yahoo.com) */
+ VARSPACE * pubvars ;
+ segment * pubdata ;
+ /* (2006/11/19 23:15 GMT-03:00, Splinter - jj_arg@yahoo.com) */
+
+ int typeid ;
+ int identifier ;
+ int params ;
+ int defined ;
+ int declared ;
+ int flags ;
+
+ int imported; /* this proc is a libproc */
+
+ BASETYPE paramname[MAX_PARAMS] ;
+ BASETYPE paramtype[MAX_PARAMS] ;
+ BASETYPE type ;
+
+ CODEBLOCK code ;
+
+ int exitcode;
+ int errorcode;
+
+ SENTENCE * sentences ;
+ int sentence_count ;
+}
+PROCDEF ;
+
+extern int procdef_count ;
+extern int procdef_maxid ;
+
+extern int procdef_getid() ;
+extern PROCDEF * procdef_new (int typeid, int identifier) ;
+extern PROCDEF * procdef_get (int typeid) ;
+extern PROCDEF * procdef_search (int identifier) ;
+extern PROCDEF * procdef_search_by_codeblock (CODEBLOCK * p);
+extern void procdef_destroy(PROCDEF *) ;
+
+extern void procdef_dump( PROCDEF * proc );
+
+/* Proceso "principal", el primero en definirse y ejecutarse */
+extern PROCDEF * mainproc ;
+
+extern void program_dumpprocesses();
+
+#endif
diff --git a/core/bgdc/include/segment.h b/core/bgdc/include/segment.h
new file mode 100644
index 0000000..f47ea3a
--- /dev/null
+++ b/core/bgdc/include/segment.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __SEGMENT_H
+#define __SEGMENT_H
+
+#include <stdint.h>
+
+#include "typedef.h"
+
+/* Un segmento es una zona lineal de datos que puede crecer dinámicamente */
+
+typedef struct _segment
+{
+ void * bytes ;
+ int current ;
+ int reserved ;
+ int id ;
+}
+segment ;
+
+extern segment * segment_new() ;
+extern segment * segment_duplicate(segment * s) ;
+extern segment * segment_get(int id) ;
+
+/* Devuelven el offset del nuevo dato */
+extern int segment_add_as (segment * s, int32_t value, BASETYPE t) ;
+extern int segment_add_dword (segment * s, int32_t value) ;
+extern int segment_add_word (segment * s, int16_t value) ;
+extern int segment_add_byte (segment * s, int8_t value) ;
+extern int segment_add_from (segment * s, segment * from) ;
+
+extern void segment_dump(segment *) ;
+extern void segment_destroy(segment *) ;
+extern void segment_copy(segment *, int base_offset, int total_length) ;
+extern void segment_alloc (segment * n, int count) ;
+
+extern segment * globaldata ;
+extern segment * localdata ;
+
+/* Segmentos nombrados (para tipos definidos por el usuario */
+
+extern segment * segment_by_name (int code) ;
+extern void segment_name (segment * s, int code) ;
+
+#endif
diff --git a/core/bgdc/include/token.h b/core/bgdc/include/token.h
new file mode 100644
index 0000000..2e94c8e
--- /dev/null
+++ b/core/bgdc/include/token.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __TOKEN_H
+#define __TOKEN_H
+
+#include <files.h>
+
+#define MAX_SOURCES 4096
+#define MAX_MACRO_PARAMS 256
+
+/* Tokenizador */
+
+/* Tipos de token */
+#define IDENTIFIER 1
+#define STRING 2
+#define NUMBER 3
+#define FLOAT 4
+#define LABEL 5
+#define NOTOKEN 6
+
+extern struct _token
+ {
+ int type ;
+ int code ;
+ float value ;
+ int file;
+ int line;
+ } token ;
+
+typedef struct _tok_pos
+ {
+ int use_saved;
+ struct _token token;
+ struct _token token_saved;
+ struct _token token_prev;
+ int line_count;
+ int current_file;
+ char *source_ptr;
+ } tok_pos;
+
+extern void token_init( const char * source, int file ) ;
+extern void token_next() ;
+extern void token_back() ;
+extern void token_dump() ;
+
+extern tok_pos token_pos();
+extern void token_set_pos( tok_pos tp );
+
+extern int line_count ;
+extern int current_file ;
+extern int n_files ;
+extern char files[MAX_SOURCES][__MAX_PATH] ;
+
+/* Se exportan todos los token */
+extern struct _token token ;
+extern struct _token token_prev ;
+extern struct _token token_saved ;
+
+#endif
diff --git a/core/bgdc/include/varspace.h b/core/bgdc/include/varspace.h
new file mode 100644
index 0000000..153e796
--- /dev/null
+++ b/core/bgdc/include/varspace.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __VARSPACE_H
+#define __VARSPACE_H
+
+#include <stdint.h>
+
+#include "typedef.h"
+
+/* Un VARSPACE es una zona de definición de variables */
+
+typedef struct _varspace
+{
+ struct _variable * vars ;
+ int size ;
+ int count ;
+ int reserved ;
+ int last_offset ;
+
+ int * stringvars ;
+ int stringvar_reserved ;
+ int stringvar_count ;
+}
+VARSPACE ;
+
+typedef struct _variable
+{
+ TYPEDEF type ;
+ int code ;
+ int offset ;
+}
+VARIABLE ;
+
+extern VARSPACE * varspace_new () ;
+extern void varspace_alloc (VARSPACE * n, int count) ;
+extern void varspace_init (VARSPACE * n) ;
+extern void varspace_add (VARSPACE * n, VARIABLE v) ;
+extern VARIABLE * varspace_search (VARSPACE * n, int code) ;
+extern void varspace_dump (VARSPACE * n, int indent) ;
+extern void varspace_destroy (VARSPACE * n) ;
+extern void varspace_varstring (VARSPACE * n, int offset) ;
+
+/* Datos globales y locales */
+
+extern VARSPACE global ;
+extern VARSPACE local ;
+
+#endif