Remove SCASM, which was pointless and buggy bloat.

This commit is contained in:
David Anderson 2013-02-08 00:38:35 -08:00
parent 6e4f09366e
commit 7d9376a64b
38 changed files with 0 additions and 6718 deletions

View File

@ -1,14 +0,0 @@
CPPFILES = amxasm.cpp cexpr.cpp amx_symbol.cpp amx_proc.cpp \
amx_parser.cpp amx_natives.cpp amx_macro.cpp amx_label.cpp \
amx_error.cpp amx_define.cpp amx_data.cpp amx_compiler.cpp
FLAGS = -march=i386 -m32
all: sasm
sasm:
g++ $(FLAGS) -DHAVE_STDINT_H -Wall $(CPPFILES) -o sasm -s
clean:
-rm *.o
-rm sasm

View File

@ -1,176 +0,0 @@
#!/usr/bin/perl
#(C)2004 AMX Mod X Development Team
# by David "BAILOPAN" Anderson
# output will occur in bin.x.proc
# where x is debug or opt and proc is ix86 or amd64
# You must use this script from the project src dir
#options =
# debug - enable gdb debugging
# amd64 - compile for AMD64
# proc=ix86 - assumed not amd64
# clean - clean the specifications above
$PROJECT = "sasm";
$gccf = "gcc";
@CPP_SOURCE_FILES = ("amx_compiler.cpp", "amx_data.cpp", "amx_define.cpp", "amx_error.cpp", "amx_label.cpp", "amx_macro.cpp", "amx_natives.cpp", "amx_proc.cpp", "amx_parser.cpp", "amx_symbol.cpp", "amxasm.cpp", "cexpr.cpp");
@C_SOURCE_FILES = ();
my %OPTIONS, %OPT;
$OPT{"debug"} = "-g -ggdb";
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DHAVE_STDINT_H -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
$OPTIONS{"include"} = "";
while ($cmd = shift)
{
if ($cmd =~ /amd64/) {
$OPTIONS{"amd64"} = 1;
} elsif ($cmd =~ /debug/) {
$OPTIONS{"debug"} = 1;
} elsif ($cmd =~ /proc=i(\d)86/) {
$proc = $1;
if ($OPTIONS{"amd64"})
{
die "You cannot compile for i".$proc."86 and AMD64.\n";
} else {
$OPTIONS{"proc"} = "i".$proc."86";
}
} elsif ($cmd =~ /clean/) {
$OPTIONS{"clean"} = 1;
}
}
$gcc = `$gccf --version`;
if ($gcc =~ /2\.9/)
{
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
} else {
$OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2";
}
if ($OPTIONS{"debug"})
{
$cflags = $OPT{"debug"};
} else {
if (!$OPTIONS{"amd64"})
{
$proc = $OPTIONS{"proc"};
if (!$proc)
{
$proc = 3;
}
$cflags = "-march=i".$proc."86 -m32 ".$OPT{"opt"};
} else {
$cflags = $OPT{"opt"};
}
}
if ($OPTIONS{"amd64"})
{
$cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
}
if ($OPTIONS{"debug"})
{
$outdir = "bin.debug";
} else {
$outdir = "bin.opt";
}
if ($OPTIONS{"amd64"})
{
$outdir .= ".amd64";
$bin = $PROJECT."_amd64.so";
} else {
$proc = $OPTIONS{"proc"};
if ($proc)
{
$outdir .= ".i".$proc."86";
$bin = $PROJECT."_i".$proc."86.so";
} else {
$outdir .= ".i386";
$bin = $PROJECT."_i386.so";
}
}
unlink("$outdir/$bin");
if ($OPTIONS{"clean"})
{
`rm $outdir/*.o`;
die("Project cleaned.\n");
}
#create the dirs
#build link list
my @LINK;
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $CPP_SOURCE_FILES[$i];
$file =~ s/\.cpp/\.o/;
push(@LINK, $outdir."/".$file);
}
for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
{
$file = $C_SOURCE_FILES[$i];
$file =~ s/\.c/\.o/;
push(@LINK, $outdir."/".$file);
}
if (!(-d $outdir))
{
mkdir($outdir);
}
$inc = $OPTIONS{"include"};
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $CPP_SOURCE_FILES[$i];
$ofile = $file;
$ofile =~ s/\.cpp/\.o/;
$ofile = "$outdir/$ofile";
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
$ofile_time = (stat($ofile))[9];
if ($file_time > $ofile_time)
{
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $C_SOURCE_FILES[$i];
$ofile = $file;
$ofile =~ s/\.c/\.o/;
$ofile = "$outdir/$ofile";
$gcc = "cc $cflags -Dstrcmpi=strcasecmp $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
$ofile_time = (stat($file))[9];
if ($file_time > $ofile_time)
{
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
$gcc = "$gccf $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin";
print "$gcc\n";
`$gcc`;

View File

@ -1,240 +0,0 @@
;(C)2004 David "BAILOPAN" Anderson
; Assembler version of Anti-Flood
#define VERSION "0.20-A"
#define PLUGIN_HANDLED
#macro ARGN(argc) (12+(argc*CELL))
.CODE
halt 0 ;Return point for end
.NATIVE
register_plugin
register_cvar
random_num
register_clcmd
server_cmd
get_maxplayers
get_playersnum
get_cvar_num
set_cvar_num
get_user_flags
client_cmd
get_user_userid
.DATA
Plugin db "Slots Reservation"
Version db VERSION
Author db "AMXX Dev Team"
Cvar db "amx_reservation"
CvarVal db "1"
Callback db "ackSignal"
loopBack db "amxres0000"
.CODE
PROC plugin_init
push.c Author ;push author
push.c Version ;push version
push.c Plugin ;push name
push.c CELL*3 ;push 3 args
sysreq.c register_plugin ;call register_plugin
stack CELL*4 ;clean-up
push.c CvarVal ;push Cvar initial value
push.c Cvar ;push Cvar
push.c CELL*2 ;push 2 args
sysreq.c register_cvar ;call register_cvar
stack CELL*3 ;clean-up
push.c 90 ;push max range
push.c 65 ;push min range
push.c CELL*2 ;push 2 args
sysreq.c random_num ;call random_num
stack CELL*3 ;clean-up
stor.pri loopBack+CELL*6 ;store pri in loopBack[6]
push.c 90 ;push max range
push.c 65 ;push min range
push.c CELL*2 ;push 2 args
sysreq.c random_num ;call random_num
stack CELL*3 ;clean-up
stor.pri loopBack+CELL*7 ;store pri in loopBack[7]
push.c 90 ;push max range
push.c 65 ;push min range
push.c CELL*2 ;push 2 args
sysreq.c random_num ;call random_num
stack CELL*3 ;clean-up
stor.pri loopBack+CELL*8 ;store pri in loopBack[8]
push.c 90 ;push max range
push.c 65 ;push min range
push.c CELL*2 ;push 2 args
sysreq.c random_num ;call random_num
stack CELL*3 ;clean-up
stor.pri loopBack+CELL*9 ;store pri in loopBack[9]
push.c Callback ;push callback
push.c loopBack ;push loopback
push.c CELL*2
sysreq.c register_clcmd ;call register_clcmd
stack CELL*3 ;clean-up
zero.pri ;return 0
retn ;final cleanup
ENDP
.DATA
KickMsg db "kick #%d \"Dropped due to slot reservation\""
.CODE
PROC ackSignal
push.s ARGN(0) ;push the first argument
push.c CELL*1 ;push one argument
sysreq.c get_user_userid ;call get_user_userid
stack CELL*2 ;clean-up
push.pri ;push the result of the last call
push.c KickMsg ;push the kick message
push.c CELL*2 ;push 2 args
sysreq.c server_cmd ;call server_cmd
stack CELL*3 ;clean-up
zero.pri ;return 0
retn ;final cleanup
ENDP
.DATA
VisCvar db "sv_visiblemaxplayers"
.CODE
;players, maxplayrs, limit
PROC setVisibleSlots
stack -CELL ;new variable
load.s.pri ARGN(0) ;get first parameter into [PRI]
add.c 1 ;[PRI] += 1
stor.s.pri -CELL ;[var] = [PRI]
load.s.pri ARGN(0) ;Reset [PRI] to first param
load.s.alt ARGN(1) ;get second parameter into [ALT]
jeq setMax ;does players == maxplayers?
jump setLimitCheck ; -- no, jump to next check
setMax: ; -- yes
stor.s.alt -CELL ; store the maxplayers into [var]
jump endSetIf ; we're done, jump to the end
setLimitCheck:
load.s.alt ARGN(2) ;load the third param into [ALT]
jless setLimit ;is playres < limit?
jump endSetIf ; -- no, jump to end
setLimit: ; -- yes
stor.s.alt -CELL ;store limit into [var]
endSetIf:
push.s -CELL ;push [var] onto stack
push.c VisCvar ;push cvar onto stack
push.c CELL*2 ;push 2 args
sysreq.c set_cvar_num ;call set_cvar_num
stack CELL*3 ;clean-up
stack CELL ;restore stack
zero.pri ;return 0
retn ;final cleanup
ENDP
PROC client_authorized
push.c 0 ;push 0 args
sysreq.c get_maxplayers ;call get_maxplayers
stack CELL ;clean-up
push.pri ;store the result - maxplayers
push.c 1 ;push 1
push.c CELL ;push 1 args
sysreq.c get_playersnum ;call get_playersnum
stack CELL*2 ;clean-up
push.pri ;store the result - players
push.c Cvar ;push cvar
push.c CELL ;push 1 arg
sysreq.c get_cvar_num ;call get_cvar_num
stack CELL*2 ;clean-up
xchg ;last result is now in alt
load.s.pri -CELL ;load the first result into pri
sub ;pri = maxplayers - cvar
push.pri ;store the result - limit
push.s ARGN(0) ;push the id
push.c CELL ;push 1 arg
sysreq.c get_user_flags ;call get_user_flags
stack CELL*2 ;clean-up
const.alt 2 ;2 = ADMIN_RESERVATION
and ;flags & 2
jeq setVis ;if (flags & 2) == 2, short circuit
;otherwise check this condition
load.s.pri -CELL*2 ;load players into pri
load.s.alt -CELL*3 ;load limit into alt
jleq setVis ;if players <= limit, jump
jump setVisSkip ;otherwise skip
setVis:
push.s -CELL*3 ;push limit
push.s -CELL ;push maxplayers
push.s -CELL*2 ;push players
push.c CELL*3 ;push 3 args
call setVisibleSlots ;call setVisibleSlots
stack CELL*3 ;restore stack
zero.pri ;return 0
retn ;finalize
setVisSkip:
push.c loopBack ;push loopback cmd
push.s ARGN(0) ;push the id passed
push.c CELL*2 ;push 2 args
sysreq.c client_cmd ;call client_cmd
stack CELL*3 ;clean-up
stack CELL*3 ;restore stack
const.pri PLUGIN_HANDLED ;return
retn ;finalize
ENDP
PROC client_disconnect
push.c 0 ;push 0 args
sysreq.c get_maxplayers ;call get_maxplayers
stack CELL ;clean-up
push.pri ;store the result - maxplayers
push.c 1 ;push 1
push.c CELL ;push 1 args
sysreq.c get_playersnum ;call get_playersnum
stack CELL*2 ;clean-up
push.pri ;store the result - players
dec.s -CELL*2 ;players--
push.c Cvar ;push cvar
push.c CELL ;push 1 arg
sysreq.c get_cvar_num ;call get_cvar_num
stack CELL*2 ;clean-up
xchg ;last result is now in alt
load.s.pri -CELL ;[pri] = maxplayers
sub ;[pri] = maxplayers - cvar
push.pri ;store the result - limit
push.s -CELL*3 ;push limit
push.s -CELL ;push maxplayers
push.s -CELL*2 ;push playersnum-1
push.c CELL*3 ;push 3 args
call setVisibleSlots ;call
stack 3*CELL ;clean up 3 vars
zero.pri ;return 0
retn ;finalize
ENDP
.PUBLIC
ackSignal
plugin_init
client_authorized
client_disconnect

View File

@ -1,432 +0,0 @@
/* Pawn Abstract Machine (for the Pawn language)
*
* Copyright (c) ITB CompuPhase, 1997-2005
*
* 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.
*
* Version: $Id: amx.h 3736 2008-08-16 20:13:12Z damagedsoul $
*/
#if defined FREEBSD && !defined __FreeBSD__
#define __FreeBSD__
#endif
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
#include <sclinux.h>
#endif
#ifndef AMX_H_INCLUDED
#define AMX_H_INCLUDED
#if defined HAVE_STDINT_H
#include <stdint.h>
#else
#if defined __LCC__ || defined __DMC__ || defined LINUX
#if defined HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __MACH__
#include <ppc/types.h>
typedef unsigned short int uint16_t;
typedef unsigned long int uint32_t;
#elif defined __FreeBSD__
#include <inttypes.h>
#else
typedef short int int16_t;
typedef unsigned short int uint16_t;
#if defined SN_TARGET_PS2
typedef int int32_t;
typedef unsigned int uint32_t;
#else
typedef long int int32_t;
typedef unsigned long int uint32_t;
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#elif defined __GNUC__
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define HAVE_I64
#endif
#endif
#endif
#define HAVE_STDINT_H
#endif
#if defined _LP64 || defined WIN64 || defined _WIN64
#if !defined __64BIT__
#define __64BIT__
#endif
#endif
#if HAVE_ALLOCA_H
#include <alloca.h>
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32 /* || defined __MSDOS__ */
#if !defined alloca
#define alloca(n) _alloca(n)
#endif
#endif
#if !defined arraysize
#define arraysize(array) (sizeof(array) / sizeof((array)[0]))
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined PAWN_DLL
#if !defined AMX_NATIVE_CALL
#define AMX_NATIVE_CALL __stdcall
#endif
#if !defined AMXAPI
#define AMXAPI __stdcall
#endif
#endif
/* calling convention for native functions */
#if !defined AMX_NATIVE_CALL
#define AMX_NATIVE_CALL
#endif
/* calling convention for all interface functions and callback functions */
#if !defined AMXAPI
#if defined STDECL
#define AMXAPI __stdcall
#elif defined CDECL
#define AMXAPI __cdecl
#elif defined GCC_HASCLASSVISIBILITY
#define AMXAPI __attribute__ ((visibility("default")))
#else
#define AMXAPI
#endif
#endif
#if !defined AMXEXPORT
#define AMXEXPORT
#endif
/* File format version Required AMX version
* 0 (original version) 0
* 1 (opcodes JUMP.pri, SWITCH and CASETBL) 1
* 2 (compressed files) 2
* 3 (public variables) 2
* 4 (opcodes SWAP.pri/alt and PUSHADDR) 4
* 5 (tagnames table) 4
* 6 (reformatted header) 6
* 7 (name table, opcodes SYMTAG & SYSREQ.D) 7
* 8 (opcode STMT, renewed debug interface) 8
*/
#define CUR_FILE_VERSION 8 /* current file version; also the current AMX version */
#define MIN_FILE_VERSION 6 /* lowest supported file format version for the current AMX version */
#define MIN_AMX_VERSION 8 /* minimum AMX version needed to support the current file format */
#if !defined PAWN_CELL_SIZE
#define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */
#endif
#if PAWN_CELL_SIZE==16
typedef uint16_t ucell;
typedef int16_t cell;
#elif PAWN_CELL_SIZE==32
typedef uint32_t ucell;
typedef int32_t cell;
#elif PAWN_CELL_SIZE==64
typedef uint64_t ucell;
typedef int64_t cell;
#else
#error Unsupported cell size (PAWN_CELL_SIZE)
#endif
#define UNPACKEDMAX ((1L << (sizeof(cell)-1)*8) - 1)
#define UNLIMITED (~1u >> 1)
struct tagAMX;
typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
cell *result, cell *params);
typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
#if !defined _FAR
#define _FAR
#endif
#if defined _MSC_VER
#pragma warning(disable:4103) /* disable warning message 4103 that complains
* about pragma pack in a header file */
#pragma warning(disable:4100) /* "'%$S' : unreferenced formal parameter" */
#endif
/* Some compilers do not support the #pragma align, which should be fine. Some
* compilers give a warning on unknown #pragmas, which is not so fine...
*/
#if (defined SN_TARGET_PS2 || defined __GNUC__) && !defined AMX_NO_ALIGN
#define AMX_NO_ALIGN
#endif
#if defined __GNUC__
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
#if !defined AMX_NO_ALIGN
#if defined LINUX || defined __FreeBSD__
#pragma pack(1) /* structures must be packed (byte-aligned) */
#elif defined MACOS && defined __MWERKS__
#pragma options align=mac68k
#else
#pragma pack(push)
#pragma pack(1) /* structures must be packed (byte-aligned) */
#if defined __TURBOC__
#pragma option -a- /* "pack" pragma for older Borland compilers */
#endif
#endif
#endif
typedef struct tagAMX_NATIVE_INFO {
const char _FAR *name PACKED;
AMX_NATIVE func PACKED;
} PACKED AMX_NATIVE_INFO;
#define AMX_USERNUM 4
#define sEXPMAX 19 /* maximum name length for file version <= 6 */
#define sNAMEMAX 31 /* maximum name length of symbol name */
typedef struct tagAMX_FUNCSTUB {
ucell address PACKED;
char name[sEXPMAX+1];
} PACKED AMX_FUNCSTUB;
typedef struct tagFUNCSTUBNT {
ucell address PACKED;
ucell nameofs PACKED; //we need this for amxx to be backwards comaptible
} PACKED AMX_FUNCSTUBNT;
/* The AMX structure is the internal structure for many functions. Not all
* fields are valid at all times; many fields are cached in local variables.
*/
typedef struct tagAMX {
unsigned char _FAR *base PACKED; /* points to the AMX header plus the code, optionally also the data */
unsigned char _FAR *data PACKED; /* points to separate data+stack+heap, may be NULL */
AMX_CALLBACK callback PACKED;
AMX_DEBUG debug PACKED; /* debug callback */
/* for external functions a few registers must be accessible from the outside */
cell cip PACKED; /* instruction pointer: relative to base + amxhdr->cod */
cell frm PACKED; /* stack frame base: relative to base + amxhdr->dat */
cell hea PACKED; /* top of the heap: relative to base + amxhdr->dat */
cell hlw PACKED; /* bottom of the heap: relative to base + amxhdr->dat */
cell stk PACKED; /* stack pointer: relative to base + amxhdr->dat */
cell stp PACKED; /* top of the stack: relative to base + amxhdr->dat */
int flags PACKED; /* current status, see amx_Flags() */
/* user data */
long usertags[AMX_USERNUM] PACKED;
void _FAR *userdata[AMX_USERNUM] PACKED;
/* native functions can raise an error */
int error PACKED;
/* passing parameters requires a "count" field */
int paramcount;
/* the sleep opcode needs to store the full AMX status */
cell pri PACKED;
cell alt PACKED;
cell reset_stk PACKED;
cell reset_hea PACKED;
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
/* support variables for the JIT */
int reloc_size PACKED; /* required temporary buffer for relocations */
long code_size PACKED; /* estimated memory footprint of the native code */
} PACKED AMX;
/* The AMX_HEADER structure is both the memory format as the file format. The
* structure is used internaly.
*/
typedef struct tagAMX_HEADER {
int32_t size PACKED; /* size of the "file" */
uint16_t magic PACKED; /* signature */
char file_version; /* file format version */
char amx_version; /* required version of the AMX */
int16_t flags PACKED;
int16_t defsize PACKED; /* size of a definition record */
int32_t cod PACKED; /* initial value of COD - code block */
int32_t dat PACKED; /* initial value of DAT - data block */
int32_t hea PACKED; /* initial value of HEA - start of the heap */
int32_t stp PACKED; /* initial value of STP - stack top */
int32_t cip PACKED; /* initial value of CIP - the instruction pointer */
int32_t publics PACKED; /* offset to the "public functions" table */
int32_t natives PACKED; /* offset to the "native functions" table */
int32_t libraries PACKED; /* offset to the table of libraries */
int32_t pubvars PACKED; /* the "public variables" table */
int32_t tags PACKED; /* the "public tagnames" table */
int32_t nametable PACKED; /* name table */
} PACKED AMX_HEADER;
//This is always the same for us
#define AMX_MAGIC 0xf1e0
enum {
AMX_ERR_NONE,
/* reserve the first 15 error codes for exit codes of the abstract machine */
AMX_ERR_EXIT, /* forced exit */
AMX_ERR_ASSERT, /* assertion failed */
AMX_ERR_STACKERR, /* stack/heap collision */
AMX_ERR_BOUNDS, /* index out of bounds */
AMX_ERR_MEMACCESS, /* invalid memory access */
AMX_ERR_INVINSTR, /* invalid instruction */
AMX_ERR_STACKLOW, /* stack underflow */
AMX_ERR_HEAPLOW, /* heap underflow */
AMX_ERR_CALLBACK, /* no callback, or invalid callback */
AMX_ERR_NATIVE, /* native function failed */
AMX_ERR_DIVIDE, /* divide by zero */
AMX_ERR_SLEEP, /* go into sleepmode - code can be restarted */
AMX_ERR_INVSTATE, /* invalid state for this access */
AMX_ERR_MEMORY = 16, /* out of memory */
AMX_ERR_FORMAT, /* invalid file format */
AMX_ERR_VERSION, /* file is for a newer version of the AMX */
AMX_ERR_NOTFOUND, /* function not found */
AMX_ERR_INDEX, /* invalid index parameter (bad entry point) */
AMX_ERR_DEBUG, /* debugger cannot run */
AMX_ERR_INIT, /* AMX not initialized (or doubly initialized) */
AMX_ERR_USERDATA, /* unable to set user data field (table full) */
AMX_ERR_INIT_JIT, /* cannot initialize the JIT */
AMX_ERR_PARAMS, /* parameter error */
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
AMX_ERR_GENERAL, /* general error (unknown or unspecific error) */
};
/* AMX_FLAG_CHAR16 0x01 no longer used */
#define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000 /* busy browsing */
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
#define AMX_EXEC_MAIN -1 /* start at program entry point */
#define AMX_EXEC_CONT -2 /* continue from last address */
#define AMX_USERTAG(a,b,c,d) ((a) | ((b)<<8) | ((long)(c)<<16) | ((long)(d)<<24))
#if !defined AMX_COMPACTMARGIN
#define AMX_COMPACTMARGIN 64
#endif
/* for native functions that use floating point parameters, the following
* two macros are convenient for casting a "cell" into a "float" type _without_
* changing the bit pattern
*/
#if PAWN_CELL_SIZE==32
#define amx_ftoc(f) ( * ((cell*)&f) ) /* float to cell */
#define amx_ctof(c) ( * ((float*)&c) ) /* cell to float */
#elif PAWN_CELL_SIZE==64
#define amx_ftoc(f) ( * ((cell*)&f) ) /* float to cell */
#define amx_ctof(c) ( * ((double*)&c) ) /* cell to float */
#else
#error Unsupported cell size
#endif
#define amx_StrParam(amx,param,result) \
do { \
cell *amx_cstr_; int amx_length_; \
amx_GetAddr((amx), (param), &amx_cstr_); \
amx_StrLen(amx_cstr_, &amx_length_); \
if (amx_length_ > 0 && \
((result) = (void*)alloca((amx_length_ + 1) * sizeof(*(result)))) != NULL) \
amx_GetString((char*)(result), amx_cstr_, sizeof(*(result))>1, amx_length_); \
else (result) = NULL; \
} while (0)
uint16_t * AMXAPI amx_Align16(uint16_t *v);
uint32_t * AMXAPI amx_Align32(uint32_t *v);
#if defined _I64_MAX || defined HAVE_I64
uint64_t * AMXAPI amx_Align64(uint64_t *v);
#endif
int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
int AMXAPI amx_Cleanup(AMX *amx);
int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index);
int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
int AMXAPI amx_FindPublic(AMX *amx, const char *funcname, int *index);
int AMXAPI amx_FindPubVar(AMX *amx, const char *varname, cell *amx_addr);
int AMXAPI amx_FindTagId(AMX *amx, cell tag_id, char *tagname);
int AMXAPI amx_Flags(AMX *amx,uint16_t *flags);
int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname);
int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname);
int AMXAPI amx_GetPubVar(AMX *amx, int index, char *varname, cell *amx_addr);
int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar, size_t size);
int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id);
int AMXAPI amx_GetUserData(AMX *amx, long tag, void **ptr);
int AMXAPI amx_Init(AMX *amx, void *program);
int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code);
int AMXAPI amx_MemInfo(AMX *amx, long *codesize, long *datasize, long *stackheap);
int AMXAPI amx_NameLength(AMX *amx, int *length);
AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func);
int AMXAPI amx_NumNatives(AMX *amx, int *number);
int AMXAPI amx_NumPublics(AMX *amx, int *number);
int AMXAPI amx_NumPubVars(AMX *amx, int *number);
int AMXAPI amx_NumTags(AMX *amx, int *number);
int AMXAPI amx_Push(AMX *amx, cell value);
int AMXAPI amx_PushArray(AMX *amx, cell *amx_addr, cell **phys_addr, const cell array[], int numcells);
int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char *string, int pack, int use_wchar);
int AMXAPI amx_RaiseError(AMX *amx, int error);
int AMXAPI amx_Register(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number);
int AMXAPI amx_Release(AMX *amx, cell amx_addr);
int AMXAPI amx_SetCallback(AMX *amx, AMX_CALLBACK callback);
int AMXAPI amx_SetDebugHook(AMX *amx, AMX_DEBUG debug);
int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar, size_t size);
int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
int AMXAPI amx_StrLen(const cell *cstring, int *length);
int AMXAPI amx_UTF8Check(const char *string, int *length);
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
int AMXAPI amx_UTF8Len(const cell *cstr, int *length);
int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
#if PAWN_CELL_SIZE==16
#define amx_AlignCell(v) amx_Align16(v)
#elif PAWN_CELL_SIZE==32
#define amx_AlignCell(v) amx_Align32(v)
#elif PAWN_CELL_SIZE==64 && (defined _I64_MAX || defined HAVE_I64)
#define amx_AlignCell(v) amx_Align64(v)
#else
#error Unsupported cell size
#endif
#define amx_RegisterFunc(amx, name, func) \
amx_Register((amx), amx_NativeInfo((name),(func)), 1);
#if !defined AMX_NO_ALIGN
#if defined LINUX || defined __FreeBSD__
#pragma pack() /* reset default packing */
#elif defined MACOS && defined __MWERKS__
#pragma options align=reset
#else
#pragma pack(pop) /* reset previous packing */
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* AMX_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_compiler.h 835 2004-08-12 16:31:50Z dvander $
*/
#ifndef _INCLUDE_AMXCOMPILER_H
#define _INCLUDE_AMXCOMPILER_H
#define CHK_PARAMS(d) \
if (paramList.size() > d) \
{ \
CError->ErrorMsg(Warning_Param_Count, paramList.size(), d); \
} else if (paramList.size() < d) { \
CError->ErrorMsg(Err_Param_Count, paramList.size(), d); \
delete ASM; \
ASM = 0; \
}
#define PUSH_PARAM(n,sym) \
if (paramList.size() >= n) \
{ \
ASM->params.push_back(Eval(*(paramList[n-1]), sym)); \
lastCip+=cellsize; \
}
class rpn
{
public:
~rpn();
//TODO: use linked lists, but not std::list
std::vector<char> ops;
std::vector<CExpr> vals;
};
class Compiler
{
public:
Compiler();
~Compiler();
Compiler(std::string &f);
void Load(std::string &f);
bool Parse();
bool Compile(std::string &out);
int CurLine() { return curLine; }
ErrorMngr *ErrorHandler() { return CError; }
void PrintCodeList();
public:
int FindArguments(std::string &text, std::vector<std::string*> &List, int &end, bool simple = false);
void Clear();
int CipCount();
int CurCip() { return lastCip; }
Asm *CurAsm() { return curAsm; }
bool SetDebug();
bool SetPack();
bool SetDOpt();
int DerefSymbol(std::string &str, SymbolType sym = Sym_None);
bool IsSymbol(std::string &str);
private:
void ProcessDirective(std::string &text);
void Init();
void InitOpcodes();
int Eval(std::string &str, SymbolType sym = Sym_None);
CExpr EvalE(std::string &str, SymbolType sym = Sym_None);
CExpr EvalRpn(rpn *r, SymbolType sym);
OpToken OperToken(char c);
char OperChar(OpToken c);
void WriteCell(FILE *fp, ucell *c, int repeat);
private:
std::vector<Asm *> CodeList;
std::map<std::string,int> OpCodes;
std::stack<std::string> LabelStack;
char *Output;
ErrorMngr *CError;
SymbolList *CSymbols;
DefineMngr *CDefines;
MacroList *CMacros;
DataMngr *DAT;
ProcMngr *PROC;
LabelMngr *CLabels;
NativeMngr *CNatives;
std::string filename;
int curLine;
int lastCip;
int cellsize;
int stacksize;
bool debug;
bool pack;
bool dopt;
int bitsOut;
Asm *curAsm;
};
#endif //_INCLUDE_AMXCOMPILER_H

View File

@ -1,196 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_data.cpp 828 2004-08-11 14:31:26Z dvander $
*/
#include "amxasm.h"
DataMngr::~DataMngr()
{
Clear();
}
void DataMngr::Clear()
{
std::vector<DataMngr::Datum *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
DataMngr::Datum::Datum()
{
db = false;
offset = -1;
fill = 0;
zeroed = false;
}
void DataMngr::Add(std::string &s, CExpr &expr, bool db, int fill)
{
DataMngr::Datum *D = new DataMngr::Datum();
D->symbol.assign(s);
D->e = expr;
D->fill = fill;
D->db = db;
int size = 0;
if (db)
{
size = ((D->e.GetType() == Val_Number) ?
cellsize : D->e.Size() * cellsize);
} else {
size = (D->e.GetNumber() * cellsize);
}
if (List.size() == 0)
{
D->offset = 0;
} else {
DataMngr::Datum *p = List[List.size()-1];
if (p->db)
{
D->offset = p->offset +
((p->e.GetType() == Val_Number) ?
cellsize : p->e.Size() * cellsize);
} else {
D->offset = p->offset + (p->e.GetNumber() * cellsize);
}
}
cursize += size;
List.push_back(D);
}
DataMngr::Datum *DataMngr::FindData(std::string &sym)
{
std::vector<DataMngr::Datum *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ((*i)->symbol.compare(sym) == 0)
{
return (*i);
}
}
return NULL;
}
int DataMngr::GetOffset(std::string &sym)
{
DataMngr::Datum *D = NULL;
D = FindData(sym);
if (D == NULL)
return DataMngr::nof;
return D->offset;
}
int DataMngr::GetSize()
{
return cursize;
}
void DataMngr::GetData(std::vector<DataMngr::Datum *> &dList)
{
std::vector<DataMngr::Datum *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
dList.push_back( (*i) );
}
}
void DataMngr::PrintTable()
{
std::vector<DataMngr::Datum *>::iterator i;
DataMngr::Datum *p = 0;
printf("Symbol\tSize\n");
for (i=List.begin(); i!=List.end(); i++)
{
p = (*i);
printf("%s\t%d\n", p->symbol.c_str(), p->offset);
}
}
//Rewrite the DAT section so empties are at the end
void DataMngr::Optimize()
{
std::vector<DataMngr::Datum *> DbList;
std::vector<DataMngr::Datum *> MtList;
std::vector<DataMngr::Datum *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i)->db )
{
DbList.push_back( (*i) );
} else if ( (*i)->fill == 0 ) {
MtList.push_back( (*i) );
} else {
DbList.push_back( (*i) );
}
}
List.clear();
lastOffset = 0;
cursize = 0;
int size = 0;
for (i=DbList.begin(); i!=DbList.end(); i++)
{
size = (( (*i)->e.GetType() == Val_Number
|| (*i)->e.GetType() == Val_Float ) ?
cellsize : (*i)->e.Size() * cellsize);
(*i)->offset = lastOffset;
lastOffset += size;
(*i)->zeroed = false;
List.push_back( (*i) );
}
cursize = lastOffset;
DbList.clear();
for (i=MtList.begin(); i!=MtList.end(); i++)
{
size = ( (*i)->e.GetNumber() * cellsize );
(*i)->offset = lastOffset;
lastOffset += size;
(*i)->zeroed = true;
List.push_back( (*i) );
}
MtList.clear();
optimized = true;
}

View File

@ -1,63 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_data.h 828 2004-08-11 14:31:26Z dvander $
*/
#ifndef _INCLUDE_AMXDATA_H
#define _INCLUDE_AMXDATA_H
class DataMngr
{
public:
class Datum
{
public:
Datum();
std::string symbol;
CExpr e;
bool db;
int offset;
int fill;
bool zeroed;
};
public:
~DataMngr();
DataMngr() { cellsize = 4; lastOffset = 0; cursize = 0; optimized = false; }
DataMngr(int cell) { lastOffset = 0; cellsize = cell; cursize = 0; optimized = false; }
void Add(std::string &s, CExpr &expr, bool db = false, int fill = 0);
DataMngr::Datum *FindData(std::string &sym);
void GetData(std::vector<DataMngr::Datum *> &dList);
int GetOffset(std::string &sym);
int GetSize();
void Clear();
void PrintTable();
void Optimize();
bool IsOptimized() { return optimized; }
private:
std::vector<DataMngr::Datum *> List;
int lastOffset;
int cellsize;
int cursize;
bool optimized;
public:
static const int nof = -1;
};
#endif //_INCLUDE_AMXDATA_H

View File

@ -1,90 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_define.cpp 826 2004-08-11 10:01:56Z dvander $
*/
#include "amxasm.h"
DefineMngr::~DefineMngr()
{
Clear();
}
void DefineMngr::Clear()
{
std::vector<DefineMngr::Define *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
void DefineMngr::Define::Set(std::string &s, std::string &d)
{
sym.assign(s);
def.assign(d);
}
DefineMngr::Define *DefineMngr::AddDefine(std::string &sym, std::string &def)
{
DefineMngr::Define *D = new DefineMngr::Define;
D->Set(sym, def);
List.push_back(D);
return D;
}
DefineMngr::Define *DefineMngr::FindDefine(std::string &sym)
{
std::vector<DefineMngr::Define*>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ((*i)->GetSymbol()->compare(sym)==0)
{
return (*i);
}
}
return NULL;
}
void DefineMngr::SearchAndReplace(std::string &text)
{
std::vector<DefineMngr::Define*>::iterator i;
DefineMngr::Define *D = NULL;
int pos;
for (i=List.begin(); i!=List.end(); i++)
{
D = (*i);
pos = FindSymbol(text, *(D->GetSymbol()), 0);
if (pos != -1)
{
text.replace(pos, D->GetSymbol()->size(), *(D->GetDefine()));
i = List.begin();
}
}
}

View File

@ -1,49 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_define.h 821 2004-08-11 08:18:14Z dvander $
*/
#ifndef _INCLUDE_DEFINE_H
#define _INCLUDE_DEFINE_H
class DefineMngr
{
public:
class Define
{
public:
void Set(std::string &s, std::string &d);
const std::string *GetSymbol() { return &sym; }
const std::string *GetDefine() { return &def; }
private:
std::string sym;
std::string def;
};
private:
std::vector<Define *> List;
public:
~DefineMngr();
void Clear();
DefineMngr::Define *AddDefine(std::string &sym, std::string &def);
DefineMngr::Define *FindDefine(std::string &sym);
void SearchAndReplace(std::string &text);
};
#endif //_INCLUDE_DEFINE_H

View File

@ -1,198 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_error.cpp 835 2004-08-12 16:31:50Z dvander $
*/
#include "amxasm.h"
ErrorMngr::ErrorMngr()
{
printf("Not instantiated with a compiler.");
Cmp = NULL;
line = -1;
assert(Cmp);
}
void ErrorMngr::Clear()
{
Totals[0] = 0;
Totals[1] = 0;
Totals[2] = 0;
Totals[3] = 0;
HighestError = Err_None;
}
int ErrorMngr::CurLine()
{
return ((Compiler *)Cmp)->CurLine();
}
int ErrorMngr::CurCip()
{
return ((Compiler *)Cmp)->CurCip();
}
ErrorMngr::ErrorMngr(void *c)
{
Cmp = c;
DefineErrors();
Totals[0] = 0;
Totals[1] = 0;
Totals[2] = 0;
Totals[3] = 0;
line = -1;
HighestError = Err_None;
}
ErrorType ErrorMngr::GetErrorType(ErrorCode id)
{
if (id > fatals_start && id < fatals_end)
return Err_Fatal;
if (id > warnings_start && id < warnings_end)
return Err_Warning;
if (id > notices_start && id < notices_end)
return Err_Notice;
if (id > errors_start && id < errors_end)
return Err_Error;
return Err_None;
}
void ErrorMngr::DefineErrors()
{
List.resize(fatals_end+1);
List.at(Warning_Hex_Start) = "Hexadecimal notation is 0xN, 0 missing";
List.at(Warning_Null_Expression) = "Bad expression will evaluate to 0";
List.at(Warning_Param_Count) = "Expected %d parameters, found %d";
List.at(Err_String_Terminate) = "String not terminated properly";
List.at(Err_String_Extra) = "Unexpected characters after string end (character '%c')";
List.at(Err_Unexpected_Char) = "Unexpected character found (character '%c')";
List.at(Err_Wandering_Stuff) = "Unknown directive placed outside of a section";
List.at(Err_Symbol_Reuse) = "Symbol \"%s\" already defined on line %d";
List.at(Err_Invalid_Stor) = "Invalid DAT storage identifier \"%s\"";
List.at(Err_Unknown_Symbol) = "Unknown symbol \"%s\"";
List.at(Err_Symbol_Type) = "Expected symbol type %d, got %d (bad symbol)";
List.at(Err_Invalid_Symbol) = "Invalid symbol";
List.at(Err_Opcode) = "Invalid or unrecognized opcode";
List.at(Err_Unmatched_Token) = "Unmatched token '%c'";
List.at(Err_Param_Count) = "Expected %d parameters, found %d";
List.at(Err_Unknown_Define) = "Unknown define referenced";
List.at(Err_Misplaced_Directive) = "Misplaced preprocessor directive";
List.at(Err_Bad_Label) = "Label referenced without being created";
List.at(Err_Bad_Not) = "Wrong type argument to bit-complement";
List.at(Err_Invalid_Operator) = "Operator used on bad type";
List.at(Err_Invalid_Pragma) = "Invalid pragma";
List.at(Err_Invalid_Proc) = "Procedure referenced that does not exist";
List.at(Err_FileNone) = "No file specified";
List.at(Err_FileOpen) = "Could not open file \"%s\"";
List.at(Err_NoMemory) = "Ran out of memory";
List.at(Err_PragmaStacksize) = "Invalid stacksize on #pragma stacksize";
List.at(Err_InvalidMacro) = "Invalid or empty macro definition";
List.at(Err_SymbolRedef) = "Symbol \"%s\" already defined on line %d";
List.at(Err_Reserved) = "Symbol assigned to a reserved token";
List.at(Err_MacroParamCount) = "Parameter count for macro \"%s\" incorrect";
List.at(Err_FatalTokenError) = "Fatal token error encountered";
List.at(Err_Invalid_Section) = "Section identifier \"%s\" is not valid, ignoring section.";
}
void ErrorMngr::PrintReport()
{
static char *ErrorSwi[4] = {"Notice", "Warning", "Error", "Fatal Error"};
int i = 0;
printf("+---------------------------+\n");
for (i=0; i<4; i++)
{
printf("| %ss: %s%d |\n", ErrorSwi[i], (i!=3)?"\t\t":"\t", Totals[i]);
}
printf("+---------------------------+\n");
}
void ErrorMngr::ErrorMsg(ErrorCode error, ...)
{
static char *ErrorSwi[4] = {"Notice", "Warning", "Error", "Fatal Error"};
static char errbuf[1024];
ErrorType type = GetErrorType(error);
if (type == -1)
return;
int curLine = 0;
if (line == -1)
{
curLine = ((Compiler *)Cmp)->CurLine();
} else {
curLine = line;
line = -1;
}
va_list argptr;
va_start(argptr, error);
if (((Compiler *)Cmp)->CurLine() == -1)
sprintf(errbuf, "%s(%d): %s\n", ErrorSwi[type], error, GetError(error));
else
sprintf(errbuf, "%s(%d) on line %d: %s\n", ErrorSwi[type], error, curLine, GetError(error));
vprintf(errbuf, argptr);
va_end(argptr);
Totals[type]++;
if (type == Err_Fatal)
exit(0);
if (type > HighestError)
HighestError = type;
}
const char *ErrorMngr::GetError(ErrorCode id)
{
if (id == fatals_start || id == fatals_end)
return NULL;
if (id == warnings_start || id == warnings_end)
return NULL;
if (id == notices_start || id == notices_end)
return NULL;
if (id == errors_start || id == errors_end)
return NULL;
if (id < notices_start || id > fatals_end)
return NULL;
return List.at(id);
}
int ErrorMngr::DerefSymbol(std::string &str, int sym)
{
return ((Compiler *)Cmp)->DerefSymbol(str, (SymbolType)sym);
}
bool ErrorMngr::IsSymbol(std::string &str)
{
return ((Compiler *)Cmp)->IsSymbol(str);
}
void ErrorMngr::SetLine(int ln)
{
line = ln;
}

View File

@ -1,109 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_error.h 835 2004-08-12 16:31:50Z dvander $
*/
#ifndef _INCLUDE_AMX_ERROR
#define _INCLUDE_AMX_ERROR
typedef enum
{
Err_None=-1,
Err_Notice,
Err_Warning,
Err_Error,
Err_Fatal,
} ErrorType;
typedef enum
{
notices_start,
notices_end,
warnings_start,
Warning_Hex_Start,
Warning_Null_Expression,
Warning_Param_Count,
warnings_end,
errors_start,
Err_String_Terminate,
Err_String_Extra,
Err_Unexpected_Char,
Err_Invalid_Section,
Err_Wandering_Stuff,
Err_Symbol_Reuse, /* Non-fatal version of Redef */
Err_Invalid_Stor,
Err_Unknown_Symbol,
Err_Symbol_Type,
Err_Invalid_Symbol,
Err_Opcode,
Err_Unmatched_Token,
Err_Param_Count,
Err_Unknown_Define,
Err_Misplaced_Directive,
Err_Bad_Label,
Err_Bad_Not,
Err_Invalid_Operator,
Err_Invalid_Pragma,
Err_Invalid_Proc,
errors_end,
fatals_start,
Err_FileNone,
Err_FileOpen,
Err_NoMemory,
Err_PragmaStacksize,
Err_InvalidMacro,
Err_SymbolRedef,
Err_Reserved,
Err_MacroParamCount,
Err_FatalTokenError,
fatals_end,
} ErrorCode;
class ErrorMngr
{
private:
void DefineErrors();
const char *GetError(ErrorCode id);
ErrorType GetErrorType(ErrorCode id);
private:
std::vector<const char *> List;
ErrorType HighestError;
void *Cmp;
int Totals[4];
int line;
public:
ErrorMngr();
ErrorMngr(void *c);
void Clear();
void ErrorMsg(ErrorCode error, ...);
ErrorType GetStatus() { return HighestError; }
void PrintReport();
int CurLine();
int CurCip();
void SetLine(int ln);
int DerefSymbol(std::string &str, int sym = 0);
bool IsSymbol(std::string &str);
};
#endif //_INCLUDE_AMX_ERROR

View File

@ -1,182 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_label.cpp 926 2004-08-21 18:57:47Z dvander $
*/
#include "amxasm.h"
LabelMngr::~LabelMngr()
{
Clear();
}
LabelMngr::Label::Label()
{
cip = -1;
sym = 0;
}
void LabelMngr::Clear()
{
std::list<LabelMngr::Label *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
LabelMngr::Label *LabelMngr::AddLabel(SymbolList::Symbol *sym, int cip)
{
LabelMngr::Label *p = new LabelMngr::Label;
p->sym = sym;
p->cip = cip;
List.push_back(p);
return p;
}
LabelMngr::Label *LabelMngr::FindLabel(std::string &sym)
{
std::list<LabelMngr::Label *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i)->sym->IsEqual(sym) )
{
return (*i);
}
}
return NULL;
}
bool LabelMngr::SetCip(std::string &sym, int cip)
{
LabelMngr::Label *p = NULL;
p = FindLabel(sym);
if (p == NULL)
return false;
p->cip = cip;
return true;
}
void LabelMngr::QueueLabel(std::string &sym, Asm *ASM)
{
std::string d(sym);
LQ[d].push(ASM);
}
void LabelMngr::CompleteQueue(bool isLocal)
{
std::map<std::string,std::stack<Asm *> >::iterator i;
std::stack<Asm *> *stk = 0;
std::stack<std::map<std::string,std::stack<Asm *> >::iterator> DeleteStack;
std::string search;
Asm *ASM = 0;
LabelMngr::Label *p = 0;
for (i=LQ.begin(); i!=LQ.end(); i++)
{
search.assign( (*i).first );
p = FindLabel(search);
stk = &((*i).second);
if (p == NULL || p->cip == LabelMngr::ncip)
{
if ((!isLocal || (isLocal && search[0]=='_')) && CError)
{
while (!stk->empty())
{
CError->SetLine(stk->top()->line);
CError->ErrorMsg(Err_Bad_Label);
stk->pop();
}
DeleteStack.push( i );
}
} else {
while (!stk->empty())
{
ASM = stk->top();
ASM->params[0] = p->cip;
stk->pop();
}
DeleteStack.push( i );
}
}
while (!DeleteStack.empty())
{
LQ.erase(DeleteStack.top());
DeleteStack.pop();
}
}
int LabelMngr::GetCip(std::string &sym)
{
LabelMngr::Label *p = NULL;
p = FindLabel(sym);
if (p == NULL)
return ncip;
return p->cip;
}
bool LabelMngr::EraseLabel(std::string &sym)
{
std::list<LabelMngr::Label *>::iterator i;
LabelMngr::Label *L = 0;
for (i=List.begin(); i!=List.end(); i++)
{
L = (*i);
if ( L->sym->IsEqual(sym) )
{
i = List.erase(i);
L->sym = 0;
delete L;
L = 0;
return true;
}
}
return false;
}
void LabelMngr::PrintList()
{
std::list<LabelMngr::Label *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
printf("Label:\t%s\t%d\t%d\n", (*i)->sym->sym.c_str(), (*i)->cip, (*i)->sym->line);
}
}

View File

@ -1,57 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_label.h 835 2004-08-12 16:31:50Z dvander $
*/
#ifndef _INCLUDE_AMXLABEL_H
#define _INCLUDE_AMXLABEL_H
class LabelMngr
{
public:
class Label
{
public:
Label();
SymbolList::Symbol *sym;
int cip;
};
public:
~LabelMngr();
LabelMngr() { CError = NULL; assert(CError!=NULL); }
LabelMngr(ErrorMngr *e) { CError = e; }
LabelMngr::Label *AddLabel(SymbolList::Symbol *sym, int cip);
LabelMngr::Label *FindLabel(std::string &sym);
int GetCip(std::string &sym);
void Clear();
bool SetCip(std::string &sym, int cip);
void QueueLabel(std::string &sym, Asm *ASM);
void CompleteQueue(bool isLocal = false);
bool EraseLabel(std::string &sym);
void PrintList();
private:
std::list<LabelMngr::Label *> List;
std::map<std::string, std::stack<Asm *> > LQ;
ErrorMngr *CError;
public:
static const int ncip = -1;
};
#endif //_INCLUDE_AMXLABEL_H

View File

@ -1,173 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_macro.cpp 826 2004-08-11 10:01:56Z dvander $
*/
#include "amxasm.h"
MacroList::~MacroList()
{
Clear();
}
void MacroList::Clear()
{
std::vector<MacroList::Macro *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
MacroList::Macro::~Macro()
{
std::vector<std::string *>::iterator i;
for (i=argList.begin(); i!=argList.end(); i++)
{
if ( (*i) )
delete (*i);
}
argList.clear();
}
MacroList::MacroList()
{
printf("Not instantiated with a compiler\n");
exit(0);
}
MacroList::MacroList(void *c)
{
CError = ((Compiler *)c)->ErrorHandler();
Cmp = c;
}
std::string *MacroList::BeginReplacement(MacroList::Macro *macro)
{
std::string *mstring = new std::string(macro->macro);
macro->arg = macro->argList.begin();
macro->argpos = 0;
return mstring;
}
int MacroList::ReplaceArgument(MacroList::Macro *m, std::string *macro, std::string &arg, int pos = 0)
{
int bPos = 0;
bPos = FindSymbol(*macro, *(*m->arg), pos);
if (bPos != -1)
{
macro->replace(bPos, (*m->arg)->size(), arg);
bPos += (int)arg.size();
}
m->arg++;
m->argpos++;
return bPos;
}
void MacroList::EndReplacement(MacroList::Macro *m, std::string *macro)
{
if (m->arg != m->argList.end())
{
CError->ErrorMsg(Err_MacroParamCount, m->symbol.c_str());
}
m->arg = m->argList.begin();
m->argpos = 0;
}
MacroList::Macro *MacroList::AddMacroBegin(std::string &symbol, std::string &mac)
{
Macro *macro = new Macro;
macro->macro.assign(mac);
macro->symbol.assign(symbol);
return macro;
}
void MacroList::AddMacroArgument(MacroList::Macro *m, std::string &arg)
{
std::string *sArg = new std::string(arg);
m->argList.push_back(sArg);
}
void MacroList::AddMacroEnd(MacroList::Macro *m)
{
List.push_back(m);
}
MacroList::Macro *MacroList::FindMacro(std::string &sym)
{
std::vector<Macro *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ((*i)->macro.compare(sym) == 0)
return (*i);
}
return NULL;
}
void MacroList::SearchAndReplace(std::string &text)
{
std::vector<Macro *>::iterator i;
MacroList::Macro *m = NULL;
int pos=0, symPos=0, bPos=0, argPos=0;
for (i=List.begin(); i!=List.end(); i++)
{
m = (*i);
pos = FindSymbol(text, m->symbol, 0);
if (pos != -1)
{
/* Strip the arguments */
std::string argstring;
symPos = pos + (int)m->symbol.size();
argstring.assign(text.substr(symPos+1, text.size()-symPos));
std::vector<std::string *> argList;
((Compiler *)Cmp)->FindArguments(argstring, argList, bPos, true);
/* Build the macro */
std::string *ms;
ms = BeginReplacement(m);
std::vector<std::string *>::iterator j;
for (j=argList.begin(); j!=argList.end(); j++)
{
argPos = ReplaceArgument(m, ms, *(*j), argPos);
}
EndReplacement(m, ms);
/* Search and replace */
text.replace(pos, bPos-pos, *ms);
/* Cleanup */
delete ms;
i = List.begin();
}
}
}

View File

@ -1,58 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_macro.h 821 2004-08-11 08:18:14Z dvander $
*/
#ifndef _INCLUDE_MACRO_H
#define _INCLUDE_MACRO_H
class MacroList
{
public:
class Macro
{
public:
~Macro();
std::vector<std::string*>::iterator arg;
std::vector<std::string*> argList;
std::string symbol;
std::string macro;
int argpos;
};
public:
MacroList();
MacroList(void *c);
~MacroList();
void Clear();
MacroList::Macro *AddMacroBegin(std::string &symbol, std::string &mac);
void AddMacroArgument(MacroList::Macro *m, std::string &arg);
void AddMacroEnd(MacroList::Macro *m);
MacroList::Macro *FindMacro(std::string &sym);
std::string *BeginReplacement(MacroList::Macro *macro);
int ReplaceArgument(MacroList::Macro *m, std::string *macro, std::string &arg, int pos);
void EndReplacement(MacroList::Macro *m, std::string *macro);
void SearchAndReplace(std::string &text);
private:
std::vector<Macro *> List;
ErrorMngr *CError;
void *Cmp;
};
#endif //_INCLUDE_MACRO_H

View File

@ -1,41 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_nametable.h 826 2004-08-11 10:01:56Z dvander $
*/
#ifndef _INCLUDE_NAMETABLE_H
#define _INCLUDE_NAMETABLE_H
class NameRecord
{
public:
const char *Name;
int32_t offset;
};
class AddrTable
{
public:
int32_t addr;
int32_t offset;
};
#endif //_INCLUDE_NAMETABLE_H

View File

@ -1,94 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_natives.cpp 826 2004-08-11 10:01:56Z dvander $
*/
#include "amxasm.h"
NativeMngr::~NativeMngr()
{
Clear();
}
void NativeMngr::Clear()
{
std::vector<NativeMngr::Native *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
void NativeMngr::AddNative(SymbolList::Symbol *S)
{
NativeMngr::Native *N = new NativeMngr::Native;
N->S = S;
N->used = false;
List.push_back(N);
}
int NativeMngr::GetNativeId(std::string &sym)
{
int pos = 0;
std::vector<NativeMngr::Native *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i)->S->IsEqual(sym) )
{
return pos;
}
pos++;
}
return ncip;
}
NativeMngr::Native *NativeMngr::FindNative(std::string &sym)
{
std::vector<NativeMngr::Native *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i)->S->IsEqual(sym) )
{
return (*i);
}
}
return NULL;
}
void NativeMngr::GetNatives(std::vector<NativeMngr::Native *> &nList)
{
std::vector<NativeMngr::Native *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
nList.push_back( (*i) );
}
}

View File

@ -1,49 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_natives.h 821 2004-08-11 08:18:14Z dvander $
*/
#ifndef _INCLUDE_NATIVES_H
#define _INCLUDE_NATIVES_H
class NativeMngr
{
public:
class Native
{
public:
Native() { used = false; S = NULL; }
SymbolList::Symbol *S;
bool used;
};
public:
~NativeMngr();
void AddNative(SymbolList::Symbol *S);
void Clear();
NativeMngr::Native *FindNative(std::string &sym);
int GetNativeId(std::string &sym);
void GetNatives(std::vector<NativeMngr::Native *> &nList);
public:
static const int ncip = -1;
private:
std::vector<NativeMngr::Native *> List;
};
#endif //_INCLUDE_NATIVES_H

View File

@ -1,209 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_parser.cpp 826 2004-08-11 10:01:56Z dvander $
*/
#include "amxasm.h"
char isletter(char c)
{
if (c >= 65 && c <= 90)
return c;
if (c >= 97 && c <= 122)
return c;
if (c == '_')
return c;
return 0;
}
char expr(char c)
{
if (c == '(')
return ')';
if (c == ')')
return '(';
return 0;
}
char literal(char c)
{
if (c == '"')
return '"';
if (c == '\'')
return '\'';
return 0;
}
void StripComments(std::string &text)
{
size_t i = 0;
char c = 0, l = 0;
for (i=0; i<text.size(); i++)
{
c = text[i];
if (literal(c))
{
if (!l)
{
l = c;
} else {
l = 0;
}
} else {
if (!l)
{
if (c == ';')
{
text.erase(i, text.size()-i);
return;
}
}
}
}
}
void StringBreak(std::string &Source, std::string &Left, std::string &Right)
{
int done_flag = 0;
unsigned int i=0;
Left.clear();
Right.clear();
for (i=0; i<Source.size(); i++)
{
if (isspace(Source[i]) && !done_flag)
{
while (isspace(Source[++i]));
done_flag = 1;
}
if (!done_flag)
{
Left.push_back(Source[i]);
} else {
Right.push_back(Source[i]);
}
}
}
/* Strips whitespace from the beginning and end of a string */
void Strip(std::string &text)
{
int i = 0;
if (text.size() == 1)
{
if (isspace(text[0]))
{
text.clear();
return;
}
}
if (isspace(text[0]))
{
for (i=0; i<(int)text.size(); i++)
{
if (!isspace(text[i])
|| (isspace(text[i]) && (i==(int)(text.size()-1))))
{
text.erase(0, i);
break;
}
}
}
if (text.size() < 1)
return;
if (isspace(text[text.size()-1]))
{
for (i=(int)(text.size()-1); i>=0; i--)
{
if (!isspace(text[i])
|| (isspace(text[i]) && (i==0)))
{
text.erase(i+1, text.size()-1-i);
break;
}
}
}
if (text.size() == 1)
{
if (isspace(text[0]))
{
text.clear();
return;
}
}
}
/* This is a very simple symbol searcher
* It only restricts the pattern location to outside of
* string literals and other symbols.
*/
int FindSymbol(std::string &text, const std::string &sym, int startPos = 0)
{
unsigned int i = 0;
char c = 0, d = 0, l = 0;
for (i=startPos; i<text.size(); i++)
{
d = text[i];
/* If the string can't possibly fit, opt out */
if (sym.size() > text.size() - i)
break;
/* Skip literal strings */
if (l)
{
if (d == l)
l = 0;
c = d;
continue;
} else {
l = literal(d);
if (l)
{
c = d;
continue;
}
}
/* If the last character was a letter, we're in a symbol already */
if (isletter(c))
{
c = d;
continue;
}
/* If the current character is a letter, test for a symbol */
if (text.compare(i, sym.size(), sym) == 0)
return i;
c = d;
}
return -1;
}

View File

@ -1,36 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_parser.h 821 2004-08-11 08:18:14Z dvander $
*/
#ifndef _INCLUDE_PARSER_H
#define _INCLUDE_PARSER_H
void StringBreak(std::string &Source, std::string &Left, std::string &Right);
int FindArguments(std::string &text, std::vector<std::string*> &List, int &end);
int FindSymbol(std::string &text, const std::string &sym, int startPos);
void ProcessDirective(std::string &text);
void StripComments(std::string &text);
void Strip(std::string &text);
char isletter(char c);
char literal(char c);
char expr(char c);
#endif //_INCLUDE_PARSER_H

View File

@ -1,159 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_proc.cpp 926 2004-08-21 18:57:47Z dvander $
*/
#include "amxasm.h"
ProcMngr::ProcMngr()
{
CError = 0;
printf("Instantiated without a compiler!\n");
assert(CError);
}
ProcMngr::ProcMngr(ErrorMngr *e)
{
CError = e;
}
ProcMngr::~ProcMngr()
{
Clear();
}
void ProcMngr::Clear()
{
std::vector<ProcMngr::AsmProc *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
ProcMngr::AsmProc *ProcMngr::AddProc(SymbolList::Symbol *Symbol, Asm *ASM)
{
ProcMngr::AsmProc *a = new ProcMngr::AsmProc;
a->ASM = ASM;
a->Symbol = Symbol;
a->pb = false;
List.push_back(a);
return a;
}
bool ProcMngr::SetPublic(std::string &sym)
{
ProcMngr::AsmProc *a = NULL;
a = FindProc(sym);
if (a == NULL)
return false;
a->pb = true;
return true;
}
void ProcMngr::GetPublics(std::vector<ProcMngr::AsmProc *> &pbList)
{
std::vector<ProcMngr::AsmProc *>::reverse_iterator i;
for (i=List.rbegin(); i!=List.rend(); i++)
{
if ((*i)->pb == true)
{
pbList.push_back( (*i) );
}
}
}
ProcMngr::AsmProc *ProcMngr::FindProc(std::string &sym)
{
std::vector<ProcMngr::AsmProc *>::iterator i;
for (i = List.begin(); i != List.end(); i++)
{
if ( (*i)->Symbol->IsEqual(sym) )
{
return (*i);
}
}
return NULL;
}
int ProcMngr::GetCip(std::string &sym)
{
ProcMngr::AsmProc *p = NULL;
p = FindProc(sym);
if (p == NULL || p->ASM == NULL)
return ncip;
return p->ASM->cip;
}
void ProcMngr::QueueProc(std::string &sym, Asm *ASM)
{
std::string d(sym);
PQ[d].push(ASM);
}
void ProcMngr::CompleteQueue()
{
std::map<std::string,std::stack<Asm *> >::iterator i;
std::string search;
ProcMngr::AsmProc *p = 0;
std::stack<Asm *> *stk = 0;
for (i=PQ.begin(); i!=PQ.end(); i++)
{
search.assign( (*i).first );
p = FindProc(search);
stk = &((*i).second);
if (p == NULL || p->ASM == NULL)
{
while (!stk->empty())
{
CError->SetLine(stk->top()->line);
CError->ErrorMsg(Err_Invalid_Proc);
stk->pop();
}
} else {
while (!stk->empty())
{
stk->top()->cip = p->ASM->cip;
stk->top()->params[0] = p->ASM->cip;
stk->pop();
}
}
}
}

View File

@ -1,56 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_proc.h 835 2004-08-12 16:31:50Z dvander $
*/
#ifndef _INCLUDE_AMXPROC_H
#define _INCLUDE_AMXPROC_H
class ProcMngr
{
public:
class AsmProc
{
public:
SymbolList::Symbol *Symbol;
Asm *ASM;
bool pb;
};
public:
~ProcMngr();
ProcMngr();
ProcMngr(ErrorMngr *e);
ProcMngr::AsmProc *AddProc(SymbolList::Symbol *Symbol, Asm *ASM);
ProcMngr::AsmProc *FindProc(std::string &sym);
int GetCip(std::string &sym);
bool SetPublic(std::string &sym);
void GetPublics(std::vector<ProcMngr::AsmProc *> &pbList);
void QueueProc(std::string &sym, Asm *ASM);
void CompleteQueue();
void Clear();
private:
std::vector<ProcMngr::AsmProc *> List;
std::map<std::string, std::stack<Asm *> > PQ;
ErrorMngr *CError;
public:
static const int ncip = -1;
};
#endif //_INCLUDE_AMXPROC_H

View File

@ -1,140 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_symbol.cpp 835 2004-08-12 16:31:50Z dvander $
*/
#include "amxasm.h"
bool is_valid_symbol_marker(char c)
{
if (c >= '0' && c <= '9')
return true;
if (isletter(c))
return true;
return false;
}
bool IsValidSymbol(std::string &text)
{
size_t i = 0;
if (!text.size() || !isletter(text[0]))
{
return false;
}
for (i=0; i<text.size(); i++)
{
if (!is_valid_symbol_marker(text[i]))
{
return false;
}
}
return true;
}
void SymbolList::Clear()
{
std::list<SymbolList::Symbol *>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ( (*i) )
delete (*i);
}
List.clear();
}
SymbolList::~SymbolList()
{
Clear();
}
bool SymbolList::Symbol::IsEqual(std::string &s)
{
return (sym.compare(s)==0);
}
SymbolList::Symbol* SymbolList::AddSymbol(const char *szSym, SymbolType type, int line)
{
SymbolList::Symbol *S = new SymbolList::Symbol;
S->line = line;
S->type = type;
S->sym.assign(szSym);
List.push_back(S);
return S;
}
SymbolList::Symbol *SymbolList::AddSymbol(std::string &sym, SymbolType type, int line)
{
SymbolList::Symbol *S = new SymbolList::Symbol;
S->line = line;
S->type = type;
S->sym.assign(sym);
List.push_back(S);
return S;
}
SymbolList::Symbol* SymbolList::FindSymbol(std::string &sym)
{
std::list<Symbol*>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
if ((*i)->IsEqual(sym))
return (*i);
}
return NULL;
}
void SymbolList::PrintTable()
{
std::list<Symbol*>::iterator i;
for (i=List.begin(); i!=List.end(); i++)
{
printf("Symbol \"%s\" defined on line %d\n", (*i)->sym.c_str(), (*i)->line);
}
}
bool SymbolList::EraseSymbol(std::string &sym)
{
std::list<SymbolList::Symbol *>::iterator i;
SymbolList::Symbol *S = 0;
for (i=List.begin(); i!=List.end(); i++)
{
S = (*i);
if ( S && S->IsEqual(sym) )
{
delete S;
i = List.erase(i);
S = 0;
return true;
}
}
return false;
}

View File

@ -1,65 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amx_symbol.h 835 2004-08-12 16:31:50Z dvander $
*/
#ifndef _INCLUDE_SYMBOL_H
#define _INCLUDE_SYMBOL_H
bool IsValidSymbol(std::string &text);
typedef enum
{
Sym_None,
Sym_Define,
Sym_Macro,
Sym_Proc,
Sym_Dat,
Sym_Reserved,
Sym_Label,
Sym_Native,
} SymbolType;
class SymbolList
{
public:
class Symbol
{
public:
bool IsEqual(std::string &s);
SymbolType type;
std::string sym;
int line;
};
public:
~SymbolList();
SymbolList::Symbol* AddSymbol(std::string &sym, SymbolType type, int line);
SymbolList::Symbol* AddSymbol(const char *szSym, SymbolType type, int line);
SymbolList::Symbol* FindSymbol(std::string &sym);
bool EraseSymbol(std::string &sym);
void PrintTable();
void Clear();
private:
std::list<Symbol*> List;
};
#endif //_INCLUDE_SYMBOL_H

View File

@ -1,143 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amxasm.cpp 921 2004-08-21 06:20:27Z dvander $
*/
#include "amxasm.h"
std::string filename;
std::string output_name;
Compiler Program;
int main(int argc, char **argv)
{
get_options(argc, argv, Program);
if (filename.size() < 1)
{
print_version();
print_options();
exit(0);
}
Program.Load(filename);
if (Program.Parse())
{
if (Program.Compile(output_name.size() ? output_name : filename))
printf("Done.\n");
else
printf("Compile build failed.\n");
} else {
printf("Compile failed.\n");
}
exit(0);
}
void get_options(int argc, char **argv, Compiler &Prog)
{
int i = 0; /* index */
char opt_flag = 0; /* flag for option detection */
char *option = 0; /* option pointer */
for (i=1; i<argc; i++)
{
if (argv[i][0] == '-')
{
opt_flag = 1;
option = argv[i];
switch (argv[i][1])
{
case 'o':
{
if (strlen(argv[i]) > 2)
{
output_name.assign(&(argv[i][2]));
} else {
opt_flag = 'o';
}
break;
}
case 'c':
{
Program.SetPack();
opt_flag = 0;
break;
}
case 'v':
{
opt_flag = 0; /* no options expected */
print_version();
exit(0);
break;
} /* case */
case 'd':
{
opt_flag = 0;
Prog.SetDebug();
break;
}
case 'h':
{
opt_flag = 0;
Prog.SetDOpt();
break;
}
case 'f':
{
opt_flag = 0;
Prog.SetDOpt();
Prog.SetPack();
}
} /* switch */
} else { /* - */
if (!opt_flag)
{
filename.assign(argv[i]);
} else {
switch (opt_flag)
{
case 'o':
{
output_name.assign(argv[i]);
break;
}
}
}
} /* if */
}
}
void print_version()
{
printf("Small/AMX Assembler 1.02\n");
printf("(C)2004 David 'BAILOPAN' Anderson\n");
}
void print_options()
{
printf("\nOptions:\n");
printf("\t-d\t\t- Add debug opcodes (will double file size)\n");
printf("\t-v\t\t- Output version and exit\n");
printf("\t-o\t\t- Specify file to write\n");
printf("\t-c\t\t- Enable compact encoding\n");
printf("\t-h\t\t- Optimize DAT section\n");
printf("\t-f\t\t- Optimal Build\n");
printf("\n");
}

View File

@ -1,225 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: amxasm.h 824 2004-08-11 09:32:24Z dvander $
*/
#ifndef _INCLUDE_AMXASM_H
#define _INCLUDE_AMXASM_H
//C includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
//C++ includes
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <stack>
#include <list>
#include <map>
class Asm
{
public:
int op;
std::vector<int> params;
int cip;
int line;
};
#include "amx.h"
#include "amx_error.h"
#include "cexpr.h"
#include "amx_parser.h"
#include "amx_symbol.h"
#include "amx_macro.h"
#include "amx_define.h"
#include "amx_data.h"
#include "amx_proc.h"
#include "amx_label.h"
#include "amx_natives.h"
#include "amx_nametable.h"
#include "amx_compiler.h" //This should be last!
#define SMALL_CELL_SIZE 32
typedef enum
{
Asm_Invalid = -1,
Asm_None,
Asm_Data,
Asm_Code,
Asm_Public,
Asm_Native,
} AsmSection;
/* From amx.c */
typedef enum {
OP_NONE, /* invalid opcode */
OP_LOAD_PRI,
OP_LOAD_ALT,
OP_LOAD_S_PRI,
OP_LOAD_S_ALT,
OP_LREF_PRI,
OP_LREF_ALT,
OP_LREF_S_PRI,
OP_LREF_S_ALT,
OP_LOAD_I,
OP_LODB_I,
OP_CONST_PRI,
OP_CONST_ALT,
OP_ADDR_PRI,
OP_ADDR_ALT,
OP_STOR_PRI,
OP_STOR_ALT,
OP_STOR_S_PRI,
OP_STOR_S_ALT,
OP_SREF_PRI,
OP_SREF_ALT,
OP_SREF_S_PRI,
OP_SREF_S_ALT,
OP_STOR_I,
OP_STRB_I,
OP_LIDX,
OP_LIDX_B,
OP_IDXADDR,
OP_IDXADDR_B,
OP_ALIGN_PRI,
OP_ALIGN_ALT,
OP_LCTRL,
OP_SCTRL,
OP_MOVE_PRI,
OP_MOVE_ALT,
OP_XCHG,
OP_PUSH_PRI,
OP_PUSH_ALT,
OP_PUSH_R,
OP_PUSH_C,
OP_PUSH,
OP_PUSH_S,
OP_POP_PRI,
OP_POP_ALT,
OP_STACK,
OP_HEAP,
OP_PROC,
OP_RET,
OP_RETN,
OP_CALL,
OP_CALL_PRI,
OP_JUMP,
OP_JREL,
OP_JZER,
OP_JNZ,
OP_JEQ,
OP_JNEQ,
OP_JLESS,
OP_JLEQ,
OP_JGRTR,
OP_JGEQ,
OP_JSLESS,
OP_JSLEQ,
OP_JSGRTR,
OP_JSGEQ,
OP_SHL,
OP_SHR,
OP_SSHR,
OP_SHL_C_PRI,
OP_SHL_C_ALT,
OP_SHR_C_PRI,
OP_SHR_C_ALT,
OP_SMUL,
OP_SDIV,
OP_SDIV_ALT,
OP_UMUL,
OP_UDIV,
OP_UDIV_ALT,
OP_ADD,
OP_SUB,
OP_SUB_ALT,
OP_AND,
OP_OR,
OP_XOR,
OP_NOT,
OP_NEG,
OP_INVERT,
OP_ADD_C,
OP_SMUL_C,
OP_ZERO_PRI,
OP_ZERO_ALT,
OP_ZERO,
OP_ZERO_S,
OP_SIGN_PRI,
OP_SIGN_ALT,
OP_EQ,
OP_NEQ,
OP_LESS,
OP_LEQ,
OP_GRTR,
OP_GEQ,
OP_SLESS,
OP_SLEQ,
OP_SGRTR,
OP_SGEQ,
OP_EQ_C_PRI,
OP_EQ_C_ALT,
OP_INC_PRI,
OP_INC_ALT,
OP_INC,
OP_INC_S,
OP_INC_I,
OP_DEC_PRI,
OP_DEC_ALT,
OP_DEC,
OP_DEC_S,
OP_DEC_I,
OP_MOVS,
OP_CMPS,
OP_FILL,
OP_HALT,
OP_BOUNDS,
OP_SYSREQ_PRI,
OP_SYSREQ_C,
OP_FILE,
OP_LINE,
OP_SYMBOL,
OP_SRANGE,
OP_JUMP_PRI,
OP_SWITCH,
OP_CASETBL,
OP_SWAP_PRI,
OP_SWAP_ALT,
OP_PUSHADDR,
OP_NOP,
OP_SYSREQ_D,
OP_SYMTAG,
/* ----- */
OP_NUM_OPCODES
} OPCODE;
void get_options(int argc, char **argv, Compiler &Prog);
void InitOpcodes();
void DestroyArgList(std::vector<std::string *> &List);
void print_version();
void print_options();
#endif //_INCLUDE_AMXASM_H

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assembler", "assembler.vcxproj", "{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}.Debug|Win32.ActiveCfg = Debug|Win32
{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}.Debug|Win32.Build.0 = Debug|Win32
{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}.Release|Win32.ActiveCfg = Release|Win32
{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FFFC86BE-94E7-458A-A61B-4D0F3B45658B}</ProjectGuid>
<RootNamespace>assembler</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">sasm</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">sasm</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)assembler.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="amx_compiler.cpp" />
<ClCompile Include="amx_data.cpp" />
<ClCompile Include="amx_define.cpp" />
<ClCompile Include="amx_error.cpp" />
<ClCompile Include="amx_label.cpp" />
<ClCompile Include="amx_macro.cpp" />
<ClCompile Include="amx_natives.cpp" />
<ClCompile Include="amx_parser.cpp" />
<ClCompile Include="amx_proc.cpp" />
<ClCompile Include="amx_symbol.cpp" />
<ClCompile Include="amxasm.cpp" />
<ClCompile Include="cexpr.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="amx.h" />
<ClInclude Include="amx_compiler.h" />
<ClInclude Include="amx_data.h" />
<ClInclude Include="amx_define.h" />
<ClInclude Include="amx_error.h" />
<ClInclude Include="amx_label.h" />
<ClInclude Include="amx_macro.h" />
<ClInclude Include="amx_nametable.h" />
<ClInclude Include="amx_natives.h" />
<ClInclude Include="amx_parser.h" />
<ClInclude Include="amx_proc.h" />
<ClInclude Include="amx_symbol.h" />
<ClInclude Include="amxasm.h" />
<ClInclude Include="cexpr.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="amx_compiler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_define.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_error.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_label.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_macro.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_natives.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_proc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amx_symbol.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="amxasm.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cexpr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="amx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_compiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_data.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_define.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_error.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_label.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_macro.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_nametable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_natives.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_proc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amx_symbol.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="amxasm.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="cexpr.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,545 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: cexpr.cpp 921 2004-08-21 06:20:27Z dvander $
*/
#include <string>
#include "amxasm.h"
CExpr::CExpr()
{
numVal = 0;
type = Val_None;
block = 0;
bDone = false;
CError = NULL;
}
CExpr::CExpr(ErrorMngr *e)
{
numVal = 0;
type = Val_None;
block = 0;
bDone = false;
CError = e;
}
CExpr::CExpr(ErrorMngr *e, std::string &text)
{
numVal = 0;
type = Val_None;
block = 0;
CError = e;
bDone = false;
data.assign(text);
}
void CExpr::Clear()
{
if (type == Val_Block && block)
delete [] block;
numVal = 0;
type = Val_None;
block = 0;
}
CExpr::~CExpr()
{
if (block && type == Val_Block)
delete [] block;
}
char CExpr::IsLiteral(char c)
{
if (c == '"')
return '"';
if (c == '\'')
return '\'';
return 0;
}
char CExpr::IsHex(char c)
{
if (c >= '0' && c <= '9')
return c;
if (c >= 'A' && c <= 'F')
return c;
if (c >= 'a' && c <= 'f')
return c;
return 0;
}
cExprType CExpr::GetType()
{
return type;
}
void CExpr::Set(std::string &text)
{
data.assign(text);
}
int CExpr::DeHex(std::string blk)
{
size_t pos = 0, xc = 0, xpos = 0, ms = 0;
/* run through the characters */
for (pos = 0; pos < blk.size(); pos++)
{
if (blk[pos] == 'x')
{
xc++;
if (xc > 1)
break;
xpos = pos;
} else if (blk[pos] == '-') {
if (pos != 0)
ms = 1;
} else if (blk[pos] != ' '
&& (blk[pos] < '0' || blk[pos] > '9')
&& (!xc || (xc && !IsHex(blk[pos])))) {
CError->ErrorMsg(Err_Unexpected_Char, blk[pos]);
return 0;
}
}
if (xc > 1)
{
CError->ErrorMsg(Err_Unexpected_Char, 'x');
return 0;
}
if (ms)
{
CError->ErrorMsg(Err_Unexpected_Char, '-');
return 0;
}
if (xc)
{
if (xpos == 0 || blk[xpos-1] != '0')
{
if (CError)
CError->ErrorMsg(Warning_Hex_Start);
}
blk.erase(0, xpos+1);
pos = 0;
int j = 0;
while (blk[pos])
{
blk[pos] -= 48;
if (blk[pos] > 16)
blk[pos] -= 7;
if (blk[pos] >= 16)
blk[pos] -= 32;
if (blk[pos] >= 16 || blk[pos] < 0)
{
if (CError)
{
CError->ErrorMsg(Err_Unexpected_Char, blk[pos]);
}
return 0;
}
j *= 16;
j += blk[pos];
pos++;
}
return j;
}
return atoi(blk.c_str());
}
int CExpr::Size()
{
if (type == Val_String || type == Val_Block)
return numVal;
if (type == Val_Number)
return (SMALL_CELL_SIZE/8);
return 0;
}
const char *CExpr::GetString(int *d)
{
const char *ret = 0;
if (type == Val_String)
{
ret = data.c_str();
if (d != NULL)
*d = numVal;
} else if (type == Val_Block) {
ret = block;
if (d != NULL)
*d = numVal;
}
return ret;
}
int CExpr::GetNumber()
{
if (type == Val_Float)
{
memcpy((void*)&numVal, (void*)&fData, sizeof(float));
}
return numVal;
}
/* Returns true if the expr can be evaluated */
int CExpr::Analyze()
{
size_t pos = 0, xc = 0, xpos = 0, fd = 0;
/* run through the characters */
if (data.compare("$") == 0)
{
return 1;
}
for (pos = 0; pos < data.size(); pos++)
{
if (data[pos] == '.')
{
fd++;
if (fd > 1 || xc)
return 0;
} else if (data[pos] == 'x') {
xc++;
if (xc > 1 || fd)
return 0;
xpos = pos;
} else if (data[pos] != ' '
&& (data[pos] < '0' || data[pos] > '9')
&& (!xc || (xc && !IsHex(data[pos])))) {
return 0;
}
}
return 1;
}
cExprType CExpr::Evaluate(int symNum)
{
size_t i = 0;
char litc = 0, c = 0;
cExprType t = Val_None;
std::string num;
block = new char[2];
bDone = true;
if (data.compare("$") == 0)
{
type = Val_Number;
numVal = CError->CurCip();
Update();
return t;
} else {
if (CError->IsSymbol(data)
|| (IsValidSymbol(data) && symNum == Sym_Label || symNum == Sym_Proc))
{
type = Val_Number;
numVal = CError->DerefSymbol(data, symNum);
Update();
return t;
}
}
if (data.find('\'', 0) != std::string::npos || data.find('"', 0) != std::string::npos)
{
/* STRESS TEST */
for (i=0; i<data.size(); i++)
{
c = data[i];
if (c == '\\')
{
if (i == data.size() - 1)
{
if (CError)
CError->ErrorMsg(Err_String_Terminate);
t = Val_Error;
} else {
char cp = data[i+1];
char *nc = 0;
if (cp == 't')
nc = "\t";
else if (cp == 'n')
nc = "\n";
else if (cp == '\\')
nc = "\\";
else if (cp == '"')
nc = "\"";
else if (cp == '\'')
nc = "'";
if (nc)
{
data.replace(i, 2, nc);
continue;
}
}
}
if (IsLiteral(c) != 0)
{
if (litc == IsLiteral(c))
{
litc = 0;
/* The literal has terminated. Expect no more. */
if (i != data.size() - 1)
{
t = Val_Error;
if (CError)
CError->ErrorMsg(Err_String_Extra, data[i+1]);
} else {
/* STRING DISCOVERED */
t = Val_String;
/* Erase literals */
data.erase(0, 1);
data.erase(data.size()-1, 1);
numVal = (int)(data.size()+1);
break;
}
} else {
litc = IsLiteral(c);
}
}
}
} else if (data.find(' ', 0) != std::string::npos) {
/* Build a mem block from values, store length in numVal */
t = Val_Block;
size_t pos = 0, npos = 0;
numVal = 0;
pos = data.find(' ', 0);
block[numVal++] = DeHex(data.substr(0, pos));
while ((pos = data.find(' ', pos)) != std::string::npos)
{
npos = data.find(' ', pos+1);
block = (char *)realloc(block, numVal+2);
if (npos != std::string::npos)
{
block[numVal] = (char)DeHex(data.substr(pos, npos-pos));
} else {
block[numVal] = (char)DeHex(data.substr(pos));
}
pos++;
numVal++;
}
} else {
if (data.find('.', 0) != std::string::npos)
{
/* Get as a float */
fData = (float)atof(data.c_str());
t = Val_Float;
memcpy((void*)&numVal, (void*)&fData, sizeof(float));
} else {
/* Just get the number */
t = Val_Number;
numVal = DeHex(data);
char buf[32];
sprintf(buf, "%d", numVal);
data.assign(buf);
}
}
if (litc)
{
if (CError)
CError->ErrorMsg(Err_String_Terminate);
}
type = t;
return t;
}
void CExpr::Not()
{
if (type != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Bad_Not);
}
numVal = ~numVal;
}
void CExpr::Oper(OpToken op, CExpr &e)
{
switch (op)
{
case Token_Xor:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal = numVal ^ e.GetNumber();
break;
}
case Token_Shr:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal >>= e.GetNumber();
break;
}
case Token_Sub:
{
if (GetType() == Val_Number)
{
if (e.GetType() == Val_Number)
{
numVal -= e.GetNumber();
} else if (e.GetType() == Val_Float) {
numVal -= (int)e.GetFloat();
}
} else if (GetType() == Val_Float) {
if (e.GetType() == Val_Number)
{
fData -= (float)e.GetNumber();
} else if (e.GetType() == Val_Float) {
fData -= e.GetFloat();
}
}
break;
}
case Token_Mod:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal = numVal % e.GetNumber();
break;
}
case Token_Mul:
{
if (GetType() == Val_Number)
{
if (e.GetType() == Val_Number)
{
numVal *= e.GetNumber();
} else if (e.GetType() == Val_Float) {
numVal *= (int)e.GetFloat();
}
} else if (GetType() == Val_Float) {
if (e.GetType() == Val_Number)
{
fData *= (float)e.GetNumber();
} else if (e.GetType() == Val_Float) {
fData *= e.GetFloat();
}
}
break;
}
case Token_Div:
{
if (GetType() == Val_Number)
{
if (e.GetType() == Val_Number)
{
numVal /= e.GetNumber();
} else if (e.GetType() == Val_Float) {
numVal /= (int)e.GetFloat();
}
} else if (GetType() == Val_Float) {
if (e.GetType() == Val_Number)
{
fData /= (float)e.GetNumber();
} else if (e.GetType() == Val_Float) {
fData /= e.GetFloat();
}
}
break;
}
case Token_Shl:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal <<= e.GetNumber();
break;
}
case Token_And:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal &= e.GetNumber();
break;
}
case Token_Or:
{
if (e.GetType() != Val_Number)
{
if (CError)
CError->ErrorMsg(Err_Invalid_Operator);
}
numVal |= e.GetNumber();
break;
}
case Token_Add:
{
if (GetType() == Val_Number)
{
if (e.GetType() == Val_Number)
{
numVal += e.GetNumber();
} else if (e.GetType() == Val_Float) {
numVal += (int)e.GetFloat();
}
} else if (GetType() == Val_Float) {
if (e.GetType() == Val_Number)
{
fData += (float)e.GetNumber();
} else if (e.GetType() == Val_Float) {
fData += e.GetFloat();
}
}
break;
}
default:
{
numVal = 0;
break;
}
}
Update();
}
void CExpr::Update()
{
if (type == Val_Float)
{
numVal = (int)fData;
} else if (type == Val_Number) {
fData = (float)numVal;
}
if (type != Val_String && type != Val_Block)
{
char buf[24];
sprintf(buf, "%d", numVal);
data.assign(buf);
}
}

View File

@ -1,96 +0,0 @@
/* AMX Assembler
* Copyright (C)2004 David "BAILOPAN" Anderson
*
* 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.
*
* Version: $Id: cexpr.h 821 2004-08-11 08:18:14Z dvander $
*/
#ifndef _INCLUDE_CEXPR_H
#define _INCLUDE_CEXPR_H
/* This class is used for a single expression element
* It reads in a symbol and evaluates it.
*/
typedef enum
{
Token_None,
Token_Or,
Token_Xor,
Token_And,
Token_Shr,
Token_Shl,
Token_Mod,
Token_Div,
Token_Mul,
Token_Sub,
Token_Add,
Token_Not,
/* End */
Tokens_Total,
} OpToken;
typedef enum
{
Val_None,
Val_Error,
Val_String,
Val_String_Hex,
Val_String_Number,
Val_Number_Hex,
Val_Number,
Val_Block,
Val_Hex,
Val_Float,
} cExprType;
class CExpr
{
public:
CExpr();
CExpr(ErrorMngr *e);
CExpr(ErrorMngr *e, std::string &text);
void Set(std::string &text);
const char *GetString(int *d=NULL);
int Analyze();
cExprType Evaluate(int symNum = 0);
cExprType GetType();
int GetNumber();
float GetFloat() { return fData; }
int Size();
void Clear();
void Not();
void Oper(OpToken op, CExpr &e);
~CExpr();
private:
void Update();
char IsHex(char c);
char IsLiteral(char c);
int DeHex(std::string blk);
private:
char *block;
std::string data;
cExprType type;
float fData;
int numVal;
bool bDone;
private:
ErrorMngr *CError;
};
#endif //_INCLUDE_CEXPR_H

View File

@ -1,80 +0,0 @@
;(C)2004 David "BAILOPAN" Anderson
; Demonstration of AMX Mod X plugin writing in assembly.
#define VERSION "1.00"
#define AUTHOR "BAILOPAN"
#define PLUGIN "Asm Test"
#define CELL 4
#macro ARGN(argc) (12+(argc*CELL))
.CODE
halt 0 ;Return point for end
.NATIVE
get_user_name ;id, buffer[], maxLen
register_plugin ;name[], version[], author[]
register_concmd ;cmd[], callback[], access, descr[]
server_print ;fmt[], ...
.DATA
Plugin db PLUGIN
Version db VERSION
Author db AUTHOR
Cmd db "amx_asmtest"
Callback db "cmdCallback"
Descr db "Test"
.DATA
HELLO db "Hello, %s!"
.CODE
PROC cmdCallback
stack -128*CELL
zero.pri
addr.alt -128*CELL
fill 128*CELL
push.c 127
pushaddr -128*CELL
push.s ARG(0)
push.c CELL*3
sysreq.c get_user_name
stack CELL*4
pushaddr -128*CELL
push.c HELLO
push.c CELL*2
sysreq.c server_print
stack CELL*3
stack 128*CELL
zero.pri
retn
ENDP
.CODE
;Technically PROC could simply be "proc"
; this is more for reasons of readability.
; feel free to use "proc" and omit ENDP
; if you would like to code one huge list of instructions.
PROC plugin_init
push.c Author ;push the plugin name
push.c Version ;push the plugin version
push.c Plugin ;push the plugin author
push.c CELL*3 ;push 3 arguments
sysreq.c register_plugin ;call register_plugin
stack CELL*4 ;clean up the stack
push.c Callback ;push string
push.c CELL ;push one argument
sysreq.c server_print ;call server_print
stack CELL*2 ;clean up the stack
push.c Descr ;push the description
push.c 0 ;push the access level
push.c Callback ;push callback
push.c Cmd ;push the command
push.c CELL*4 ;push 4 arguments
sysreq.c register_concmd ;call register_concmd
stack CELL*5 ;cleanup
zero.pri ;zero pri
retn ;return + cleanup
ENDP
.PUBLIC
plugin_init
cmdCallback

Binary file not shown.

Binary file not shown.

View File

@ -40,9 +40,6 @@ public override sealed bool ExcludeCopy(string file)
return true;
if ( (file.IndexOf("dlsym")!=-1) && Releaser.IsWindows )
return true;
if ( ((ABuilder.GetFileName(file).CompareTo("sasm")) == 0)
&& Releaser.IsWindows )
return true;
if (ABuilder.GetFileName(file).CompareTo("svn_version.tpl") == 0)
{
return true;

Binary file not shown.

Binary file not shown.