mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Added GNU GCC support, linux binary
This commit is contained in:
parent
bd11b5eb90
commit
2a1ee3fd37
14
compiler/scasm/Makefile
Executable file
14
compiler/scasm/Makefile
Executable 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
|
@ -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
|
||||
|
@ -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;
|
||||
@ -2205,4 +2199,4 @@ rpn::~rpn()
|
||||
{
|
||||
// ops.clear();
|
||||
// vals.clear();
|
||||
}
|
||||
}
|
||||
|
@ -126,4 +126,5 @@ void DataMngr::GetData(std::vector<DataMngr::Datum *> &dList)
|
||||
{
|
||||
dList.push_back( (*i) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,4 +86,5 @@ void DefineMngr::SearchAndReplace(std::string &text)
|
||||
i = List.begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,4 +193,5 @@ bool ErrorMngr::IsSymbol(std::string &str)
|
||||
void ErrorMngr::SetLine(int ln)
|
||||
{
|
||||
line = ln;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,5 @@ public:
|
||||
int32_t offset;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_NAMETABLE_H
|
||||
#endif //_INCLUDE_NAMETABLE_H
|
||||
|
||||
|
@ -90,4 +90,5 @@ void NativeMngr::GetNatives(std::vector<NativeMngr::Native *> &nList)
|
||||
{
|
||||
nList.push_back( (*i) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -103,4 +103,5 @@ int ProcMngr::GetCip(std::string &sym)
|
||||
return ncip;
|
||||
|
||||
return p->ASM->cip;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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] == '-')
|
||||
@ -122,4 +121,4 @@ void print_options()
|
||||
printf("\t-v\t\t- Output version and exit\n");
|
||||
printf("\t-o\t\t- Specify file to write\n");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
@ -531,4 +531,4 @@ void CExpr::Update()
|
||||
sprintf(buf, "%d", numVal);
|
||||
data.assign(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
compiler/scasm/sasm
Executable file
BIN
compiler/scasm/sasm
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user