Added GNU GCC support, linux binary

This commit is contained in:
David Anderson 2004-08-11 10:01:56 +00:00
parent bd11b5eb90
commit 2a1ee3fd37
15 changed files with 40 additions and 26 deletions

14
compiler/scasm/Makefile Executable file
View File

@ -0,0 +1,14 @@
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
all: sasm
sasm:
g++ $(FLAGS) -Wall $(CPPFILES) -o sasm -s
clean:
-rm *.o
-rm sasm

View File

@ -43,7 +43,7 @@
typedef int int32_t;
typedef unsigned int uint32_t;
#else
typedef long int int32_t;
//typedef long int int32_t;
typedef unsigned long int uint32_t;
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32

View File

@ -199,13 +199,12 @@ bool Compiler::Compile(std::string &out)
dat = cod + CipCount();
hea = dat + DAT->GetSize();
stp = hea + stacksize;
int16_t cipHdr = 0x00;
cip = -1;
fileSize = hea;
std::string amxname;
amxname.assign(out);
int pos = (int)amxname.find(".asm");
size_t pos = amxname.find(".asm");
if (pos != std::string::npos)
{
amxname.replace(pos, 4, ".amx");
@ -264,8 +263,6 @@ bool Compiler::Compile(std::string &out)
fwrite(s, sizeof(char), strlen(s)+1, fp);
}
//fwrite((void*)&cipHdr, sizeof(int16_t), 1, fp);
/* Write the code */
std::vector<Asm *>::iterator ci;
@ -662,7 +659,7 @@ bool Compiler::Parse()
if (params.size() > 0)
{
FindArguments(params, paramList, argPos, true);
if (argPos != params.size()-1)
if (argPos != (int)(params.size()-1))
{
CError->ErrorMsg(Err_Unexpected_Char, params[argPos]);
continue;
@ -1723,7 +1720,6 @@ int Compiler::FindArguments(std::string &text, std::vector<std::string*> &List,
char c = 0, d = 0, l = 0, size = 0;
std::stack<char> Stack;
end = -1;
bool temp = false;
for (i=0; i<text.size(); i++)
{
@ -1896,7 +1892,6 @@ int Compiler::Eval(std::string &str, SymbolType sym)
{
std::stack<rpn *> Stack;
std::string bpstr;
int litidx = 0;
int i = 0;
rpn *r = new rpn;
int pos = 0;
@ -2036,7 +2031,6 @@ int Compiler::Eval(std::string &str, SymbolType sym)
CExpr Compiler::EvalRpn(rpn *r, SymbolType sym)
{
int i = 0, j = 0;
char c = 0;
CExpr er, el;
std::vector<CExpr>::iterator Q;
std::vector<char>::iterator R;

View File

@ -127,3 +127,4 @@ void DataMngr::GetData(std::vector<DataMngr::Datum *> &dList)
dList.push_back( (*i) );
}
}

View File

@ -87,3 +87,4 @@ void DefineMngr::SearchAndReplace(std::string &text)
}
}
}

View File

@ -194,3 +194,4 @@ void ErrorMngr::SetLine(int ln)
{
line = ln;
}

View File

@ -111,7 +111,7 @@ void LabelMngr::CompleteQueue(bool isLocal)
while (!stk->empty())
{
CError->SetLine(stk->top()->line);
CError->ErrorMsg(Err_Bad_Lbel);
CError->ErrorMsg(Err_Bad_Label);
stk->pop();
}
}
@ -155,3 +155,4 @@ bool LabelMngr::EraseLabel(std::string &sym)
return false;
}

View File

@ -77,7 +77,7 @@ std::string *MacroList::BeginReplacement(MacroList::Macro *macro)
int MacroList::ReplaceArgument(MacroList::Macro *m, std::string *macro, std::string &arg, int pos = 0)
{
int i = 0, bPos = 0;
int bPos = 0;
bPos = FindSymbol(*macro, *(*m->arg), pos);
@ -170,3 +170,4 @@ void MacroList::SearchAndReplace(std::string &text)
}
}
}

View File

@ -38,3 +38,4 @@ public:
};
#endif //_INCLUDE_NAMETABLE_H

View File

@ -91,3 +91,4 @@ void NativeMngr::GetNatives(std::vector<NativeMngr::Native *> &nList)
nList.push_back( (*i) );
}
}

View File

@ -84,7 +84,6 @@ void StripComments(std::string &text)
void StringBreak(std::string &Source, std::string &Left, std::string &Right)
{
int done_flag = 0;
int l=0;
unsigned int i=0;
Left.clear();

View File

@ -104,3 +104,4 @@ int ProcMngr::GetCip(std::string &sym)
return p->ASM->cip;
}

View File

@ -58,7 +58,6 @@ 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 */
char c = 0; /* option marker */
for (i=1; i<argc; i++)
{
if (argv[i][0] == '-')

View File

@ -223,8 +223,8 @@ int CExpr::Analyze()
cExprType CExpr::Evaluate(int symNum)
{
size_t i = 0, blk = 0;
char litc = 0, c = 0, csave = 0;
size_t i = 0;
char litc = 0, c = 0;
cExprType t = Val_None;
std::string num;

BIN
compiler/scasm/sasm Executable file

Binary file not shown.