diff --git a/compiler/scasm/Makefile b/compiler/scasm/Makefile new file mode 100755 index 00000000..5cbcca99 --- /dev/null +++ b/compiler/scasm/Makefile @@ -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 diff --git a/compiler/scasm/amx.h b/compiler/scasm/amx.h index f1dbb9ff..dabfbf7d 100755 --- a/compiler/scasm/amx.h +++ b/compiler/scasm/amx.h @@ -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 diff --git a/compiler/scasm/amx_compiler.cpp b/compiler/scasm/amx_compiler.cpp index effff0de..063846d5 100755 --- a/compiler/scasm/amx_compiler.cpp +++ b/compiler/scasm/amx_compiler.cpp @@ -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::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 &List, char c = 0, d = 0, l = 0, size = 0; std::stack Stack; end = -1; - bool temp = false; for (i=0; i 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::iterator Q; std::vector::iterator R; @@ -2205,4 +2199,4 @@ rpn::~rpn() { // ops.clear(); // vals.clear(); -} \ No newline at end of file +} diff --git a/compiler/scasm/amx_data.cpp b/compiler/scasm/amx_data.cpp index 7e6b517d..32f17744 100755 --- a/compiler/scasm/amx_data.cpp +++ b/compiler/scasm/amx_data.cpp @@ -126,4 +126,5 @@ void DataMngr::GetData(std::vector &dList) { dList.push_back( (*i) ); } -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_define.cpp b/compiler/scasm/amx_define.cpp index d00beae4..fac6d67f 100755 --- a/compiler/scasm/amx_define.cpp +++ b/compiler/scasm/amx_define.cpp @@ -86,4 +86,5 @@ void DefineMngr::SearchAndReplace(std::string &text) i = List.begin(); } } -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_error.cpp b/compiler/scasm/amx_error.cpp index 42372e8f..d0ceca8a 100755 --- a/compiler/scasm/amx_error.cpp +++ b/compiler/scasm/amx_error.cpp @@ -193,4 +193,5 @@ bool ErrorMngr::IsSymbol(std::string &str) void ErrorMngr::SetLine(int ln) { line = ln; -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_label.cpp b/compiler/scasm/amx_label.cpp index 5f2e31a6..6709b5f0 100755 --- a/compiler/scasm/amx_label.cpp +++ b/compiler/scasm/amx_label.cpp @@ -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(); } } @@ -154,4 +154,5 @@ bool LabelMngr::EraseLabel(std::string &sym) } return false; -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_macro.cpp b/compiler/scasm/amx_macro.cpp index b5bfa674..3ee0e39f 100755 --- a/compiler/scasm/amx_macro.cpp +++ b/compiler/scasm/amx_macro.cpp @@ -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); @@ -169,4 +169,5 @@ void MacroList::SearchAndReplace(std::string &text) i = List.begin(); } } -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_nametable.h b/compiler/scasm/amx_nametable.h index 97ee85a3..9f1743a0 100755 --- a/compiler/scasm/amx_nametable.h +++ b/compiler/scasm/amx_nametable.h @@ -37,4 +37,5 @@ public: int32_t offset; }; -#endif //_INCLUDE_NAMETABLE_H \ No newline at end of file +#endif //_INCLUDE_NAMETABLE_H + diff --git a/compiler/scasm/amx_natives.cpp b/compiler/scasm/amx_natives.cpp index 6c369ce7..f86568dd 100755 --- a/compiler/scasm/amx_natives.cpp +++ b/compiler/scasm/amx_natives.cpp @@ -90,4 +90,5 @@ void NativeMngr::GetNatives(std::vector &nList) { nList.push_back( (*i) ); } -} \ No newline at end of file +} + diff --git a/compiler/scasm/amx_parser.cpp b/compiler/scasm/amx_parser.cpp index 4397eafd..521aa6c2 100755 --- a/compiler/scasm/amx_parser.cpp +++ b/compiler/scasm/amx_parser.cpp @@ -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(); diff --git a/compiler/scasm/amx_proc.cpp b/compiler/scasm/amx_proc.cpp index e7e9aca5..e30e37a7 100755 --- a/compiler/scasm/amx_proc.cpp +++ b/compiler/scasm/amx_proc.cpp @@ -103,4 +103,5 @@ int ProcMngr::GetCip(std::string &sym) return ncip; return p->ASM->cip; -} \ No newline at end of file +} + diff --git a/compiler/scasm/amxasm.cpp b/compiler/scasm/amxasm.cpp index cbff392a..1650d34b 100755 --- a/compiler/scasm/amxasm.cpp +++ b/compiler/scasm/amxasm.cpp @@ -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