/programs/develop/cmm/Makefile |
---|
1,29 → 1,28 |
Compiler = kos32-gcc |
Linker = kos32-ld |
# sudo apt-get install gcc-multilib g++-multilib |
SDK_DIR:= $(abspath ../../../contrib/sdk) |
Compiler = gcc |
Includes = -Id:\TEMP\mprog\kos\includes -I$(SDK_DIR)/sources/newlib/libc/include |
Compiler_Options = -m32 -c -fno-exceptions -D_UNIX_ |
#Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ |
Compatib_Posix = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp |
#-D: _WIN32_ or _UNIX_ |
#-D: for _WIN32_ add -D__CONSOLE__ |
Compiler_Options = -c -fno-exceptions -D_KOS_ -U_Win32 -U_WIN32 -U__MINGW32__ \ |
-mno-ms-bitfields -Wno-write-strings $(Includes) $(Compatib_Posix) |
Exe_file = cmm |
Exe_file = cmm.kex |
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/kos -L $(SDK_DIR)/lib |
#-Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib |
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib |
Add_Libs = |
Add_Libs = d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtbegin.o d:/TEMP/Dev-Cpp/lib/crt2.o d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtend.o |
#Link_Libs = -lc -lgcc |
Link_Libs = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app-dynamic.lds \ |
--image-base 0 -lgcc -ldll -lc.dll |
Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 |
My_Libs = main.o port.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o |
My_Libs = main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o |
#Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 |
#################### |
## Makefile rules ## |
#################### |
31,10 → 30,13 |
all : $(Exe_file) |
$(Exe_file) : $(My_Libs) |
$(Linker) -o cmm.kex --stack 0x100000 $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs) |
objcopy cmm.kex -O binary |
kpack cmm.kex |
# ld -o cmm.exe $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs) |
$(Compiler) -m32 -o $(Exe_file) $(My_Libs) |
# ld -o cmm.exe -Bdynamic d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtend.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../crt2.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtbegin.o -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc |
clean: |
rm *.o |
108,4 → 110,3 |
.asm.o: |
fasm $< |
/programs/develop/cmm/MakefileKolibriOS |
---|
0,0 → 1,111 |
Compiler = kos32-gcc |
Linker = kos32-ld |
SDK_DIR:= $(abspath ../../../contrib/sdk) |
Includes = -Id:\TEMP\mprog\kos\includes -I$(SDK_DIR)/sources/newlib/libc/include |
Compatib_Posix = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp |
Compiler_Options = -c -fno-exceptions -D_KOS_ -U_Win32 -U_WIN32 -U__MINGW32__ \ |
-mno-ms-bitfields -Wno-write-strings $(Includes) $(Compatib_Posix) |
Exe_file = cmm.kex |
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/kos -L $(SDK_DIR)/lib |
#-Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib |
Add_Libs = |
#Link_Libs = -lc -lgcc |
Link_Libs = -static -S -nostdlib -T $(SDK_DIR)/lib/app-dynamic.lds \ |
--image-base 0 -lgcc -ldll -lc.dll |
My_Libs = main.o port.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o |
#################### |
## Makefile rules ## |
#################### |
all : $(Exe_file) |
$(Exe_file) : $(My_Libs) |
$(Linker) -o cmm.kex --stack 0x100000 $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs) |
objcopy cmm.kex -O binary |
kpack cmm.kex |
clean: |
rm *.o |
# next are the exceptions that don't have to be compiled with the /zu option |
# since they will never be called from a interrupt. hey.. I _tried_ to find |
# a clean solution.. |
main.o : main.cpp |
$(Compiler) $(Compiler_Options) $< |
toka.o : toka.cpp |
$(Compiler) $(Compiler_Options) $< |
tokb.o : tokb.cpp |
$(Compiler) $(Compiler_Options) $< |
tokc.o : tokc.cpp |
$(Compiler) $(Compiler_Options) $< |
toke.o : toke.cpp |
$(Compiler) $(Compiler_Options) $< |
tokr.o : tokr.cpp |
$(Compiler) $(Compiler_Options) $< |
errors.o :errors.cpp |
$(Compiler) $(Compiler_Options) $< |
debug.o : debug.cpp |
$(Compiler) $(Compiler_Options) $< |
outobj.o : outobj.cpp |
$(Compiler) $(Compiler_Options) $< |
outpe.o : outpe.cpp |
$(Compiler) $(Compiler_Options) $< |
disasm.o : disasm.cpp |
$(Compiler) $(Compiler_Options) $< |
switch.o : switch.cpp |
$(Compiler) $(Compiler_Options) $< |
outle.o : outle.cpp |
$(Compiler) $(Compiler_Options) $< |
pointer.o : pointer.cpp |
$(Compiler) $(Compiler_Options) $< |
new_type.o : new_type.cpp |
$(Compiler) $(Compiler_Options) $< |
class.o : class.cpp |
$(Compiler) $(Compiler_Options) $< |
res.o : res.cpp |
$(Compiler) $(Compiler_Options) $< |
optreg.o : optreg.cpp |
$(Compiler) $(Compiler_Options) $< |
libobj.o : libobj.cpp |
$(Compiler) $(Compiler_Options) $< |
port.o: port.cpp |
$(Compiler) $(Compiler_Options) $< |
.cpp.o: |
$(Compiler) $(Compiler_Options) $< |
.asm.o: |
fasm $< |
/programs/develop/cmm/MakefileUnixWin |
---|
0,0 → 1,110 |
Compiler = gcc |
Compiler_Options = -c -m32 -fno-exceptions -D_UNIX_ |
#Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_ |
#-D: _WIN32_ or _UNIX_ |
#-D: for _WIN32_ add -D__CONSOLE__ |
Exe_file = cmm |
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib |
Add_Libs = d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtbegin.o d:/TEMP/Dev-Cpp/lib/crt2.o d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtend.o |
Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 |
My_Libs = main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o |
#Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 |
#################### |
## Makefile rules ## |
#################### |
all : $(Exe_file) |
$(Exe_file) : $(My_Libs) |
# ld -o cmm.exe $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs) |
$(Compiler) -m32 -o $(Exe_file) $(My_Libs) |
# ld -o cmm.exe -Bdynamic d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtend.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../crt2.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtbegin.o -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc |
clean: |
rm *.o |
# next are the exceptions that don't have to be compiled with the /zu option |
# since they will never be called from a interrupt. hey.. I _tried_ to find |
# a clean solution.. |
main.o : main.cpp |
$(Compiler) $(Compiler_Options) $< |
toka.o : toka.cpp |
$(Compiler) $(Compiler_Options) $< |
tokb.o : tokb.cpp |
$(Compiler) $(Compiler_Options) $< |
tokc.o : tokc.cpp |
$(Compiler) $(Compiler_Options) $< |
toke.o : toke.cpp |
$(Compiler) $(Compiler_Options) $< |
tokr.o : tokr.cpp |
$(Compiler) $(Compiler_Options) $< |
errors.o :errors.cpp |
$(Compiler) $(Compiler_Options) $< |
debug.o : debug.cpp |
$(Compiler) $(Compiler_Options) $< |
outobj.o : outobj.cpp |
$(Compiler) $(Compiler_Options) $< |
outpe.o : outpe.cpp |
$(Compiler) $(Compiler_Options) $< |
disasm.o : disasm.cpp |
$(Compiler) $(Compiler_Options) $< |
switch.o : switch.cpp |
$(Compiler) $(Compiler_Options) $< |
outle.o : outle.cpp |
$(Compiler) $(Compiler_Options) $< |
pointer.o : pointer.cpp |
$(Compiler) $(Compiler_Options) $< |
new_type.o : new_type.cpp |
$(Compiler) $(Compiler_Options) $< |
class.o : class.cpp |
$(Compiler) $(Compiler_Options) $< |
res.o : res.cpp |
$(Compiler) $(Compiler_Options) $< |
optreg.o : optreg.cpp |
$(Compiler) $(Compiler_Options) $< |
libobj.o : libobj.cpp |
$(Compiler) $(Compiler_Options) $< |
port.o: port.cpp |
$(Compiler) $(Compiler_Options) $< |
.cpp.o: |
$(Compiler) $(Compiler_Options) $< |
.asm.o: |
fasm $< |
/programs/develop/cmm/asmnemon.h |
---|
/programs/develop/cmm/dirlist.h |
---|
/programs/develop/cmm/disasm.cpp |
---|
706,7 → 706,7 |
char *second_660f[]={ |
const char *second_660f[]={ |
// 0 |
1152,7 → 1152,7 |
{ |
static char buffer[12]; // fix by cppcheck |
static char buffer[25]; |
WORD32 adr; |
1848,7 → 1848,7 |
int esc = e1*8 + REG(modrm()); |
if(MOD(modrm())==3){ //2- >C0 |
if(MOD(modrm())==3){ //2-\89 \81\80\89\92>C0 |
if (fspecial[esc]) { |
2572,7 → 2572,7 |
getbyte(); |
ua_str(second_660f[getbyte()]); |
ua_str((char *)second_660f[getbyte()]); |
goto endp; |
/programs/develop/cmm/id.h |
---|
/programs/develop/cmm/main.cpp |
---|
34,9 → 34,9 |
char *stubfile=NULL; |
char *winstub=NULL; |
FILE *hout=NULL; |
char *namestartupfile="startup.h--"; |
const char *namestartupfile="startup.h--"; |
char outext[4]="com"; |
char outext[4]="kex"; |
short extflag=TRUE;//ðàñøèðåíèå ìîæíî ïðèñâîèòü |
//int scrsize; |
unsigned char gwarning=FALSE; |
78,73 → 78,73 |
int startupfile=-1; |
int alignproc=8,aligncycle=8; |
char *usage[]={ |
const char *usage[]={ |
"USAGE: C-- [options] [FILE_NAME.INI] [SOURCE_FILE_NAME]", |
"", |
" C-- COMPILER OPTIONS", |
"", |
" OPTIMIZATION", |
"/OC optimize for code size /DE enable temporary expansion variable", |
"/OS optimize for speed /OST enable optimization string", |
"/ON enable optimization number /AP[=n] align start function", |
"/UST use startup code for variables /AC[=n] align start cycles", |
"-OC optimize for code size -DE enable temporary expansion variable", |
"-OS optimize for speed -OST enable optimization string", |
"-ON enable optimization number -AP[=n] align start function", |
"-UST use startup code for variables -AC[=n] align start cycles", |
#ifdef OPTVARCONST |
"/ORV replace variable on constant /OIR skip repeated initializing register", |
"-ORV replace variable on constant -OIR skip repeated initializing register", |
#else |
" /OIR skip repeated initializing register", |
" -OIR skip repeated initializing register", |
#endif |
"", |
" CODE GENERATION", |
"/2 80286 code optimizations /SA=#### start code address", |
"/3 80386 code optimizations /AL=## set value insert byte", |
"/4 80486 code optimizations /WFA fast call API functions", |
"/5 pentium code optimizations /IV initial all variables", |
"/A enable address alignment /SUV=#### start address variables", |
"/AS[=n] def. alignment in structures /LRS load in registers over stack", |
"/UL use 'lea' for adding registers /JS join stack calling functions", |
"/BA byte access to array",// /ASP addressing local variable via ESP", |
"-2 80286 code optimizations -SA=#### start code address", |
"-3 80386 code optimizations -AL=## set value insert byte", |
"-4 80486 code optimizations -WFA fast call API functions", |
"-5 pentium code optimizations -IV initial all variables", |
"-A enable address alignment -SUV=#### start address variables", |
"-AS[=n] def. alignment in structures -LRS load in registers over stack", |
"-UL use 'lea' for adding registers -JS join stack calling functions", |
"-BA byte access to array",// -ASP addressing local variable via ESP", |
"", |
" PREPROCESSOR", |
"/IP=<path> include file path /IA assembly instructions as identifier", |
"/D=<idname> defined identifier /CRI- not check include file on repeated", |
"/MIF=<file> main input file /IND=<name> import name from dll", |
"/SF=<file> other startup file", |
"-IP=<path> include file path -IA assembly instructions as identifier", |
"-D=<idname> defined identifier -CRI- not check include file on repeated", |
"-MIF=<file> main input file -IND=<name> import name from dll", |
"-SF=<file> other startup file", |
"", |
" LINKING", |
"/AT insert ATEXIT support block /NS disable stub", |
"/ARGC insert parse command line /S=##### set stack size", |
"/P insert parse command line /WIB=##### set image base address", |
"/C insert CTRL<C> ignoring code /WFU add Fix Up table, for Windows", |
"/R insert resize memory block /WMB create Windows mono block", |
"/ENV insert variable with environ /WS=<name> set name stub file for win32", |
"/J0 disable initial jump to main() /WBSS set post data in bss section", |
"/J1 initial jump to main() short /WO call API functions on ordinals", |
"/J2 initial jump to main() near /CPA clear post area", |
"/STUB= <name> set name stub file /WSI short import table, for Windows", |
"/DOS4GW file running with DOS4GW /WAF=#### align Windows file (def 512)", |
"/STM startup code in main function", |
"-AT insert ATEXIT support block -NS disable stub", |
"-ARGC insert parse command line -S=##### set stack size", |
"-P insert parse command line -WIB=##### set image base address", |
"-C insert CTRL<C> ignoring code -WFU add Fix Up table, for Windows", |
"-R insert resize memory block -WMB create Windows mono block", |
"-ENV insert variable with environ -WS=<name> set name stub file for win32", |
"-J0 disable initial jump to main() -WBSS set post data in bss section", |
"-J1 initial jump to main() short -WO call API functions on ordinals", |
"-J2 initial jump to main() near -CPA clear post area", |
"-STUB= <name> set name stub file -WSI short import table, for Windows", |
"-DOS4GW file running with DOS4GW -WAF=#### align Windows file (def 512)", |
"-STM startup code in main function", |
"", |
" OUTPUT FILES", |
"/TEXE DOS EXE file (model TINY) /D32 EXE file (32bit code for DOS)", |
"/EXE DOS EXE file (model SMALL) /W32 EXE for Windows32 GUI", |
"/OBJ OBJ output file /W32C EXE for Windows32 console", |
"/SOBJ slave OBJ output file /DLL DLL for Windows32", |
"/COFF OBJ COFF output file /DBG create debug information", |
"/SYM COM file symbiosis /LST create assembly listing", |
"/SYS device (SYS) file /B32 32bit binary files", |
"/MEOS executable file for MeOS /MAP create function map file", |
"/EXT= <ext> set file extension", |
"-TEXE DOS EXE file (model TINY) -D32 EXE file (32bit code for DOS)", |
"-EXE DOS EXE file (model SMALL) -W32 EXE for Windows32 GUI", |
"-OBJ OBJ output file -W32C EXE for Windows32 console", |
"-SOBJ slave OBJ output file -DLL DLL for Windows32", |
"-COFF OBJ COFF output file -DBG create debug information", |
"-SYM COM file symbiosis -LST create assembly listing", |
"-SYS device (SYS) file -B32 32bit binary files", |
"-MEOS executable file for MeOS -MAP create function map file", |
"-EXT= <ext> set file extension", |
"", |
" MISCELLANEOUS", |
"/HELP /H /? help, this info /WORDS list of C-- reserved words", |
"/W enable warning /LAI list of assembler instructions", |
"/WF=<file> direct warnings to a file /ME display my name and my address", |
"/MER=## set maximum number errors /X disable SPHINX C-- header in output", |
"/NW=## disable selected warnings /WE=## selected warning will be error", |
//" /SCD split code and date", |
"-HELP -H -? help, this info -WORDS list of C-- reserved words", |
"-W enable warning -LAI list of assembler instructions", |
"-WF=<file> direct warnings to a file -ME display my name and my address", |
"-MER=## set maximum number errors -X disable SPHINX C-- header in output", |
"-NW=## disable selected warnings -WE=## selected warning will be error", |
//" -SCD split code and date", |
NULL}; |
char *dir[]={ |
const char *dir[]={ |
"ME", "WORDS", "SYM", "LAI", |
"OBJ", "SOBJ", "J0", "J1", "J2", "C", "R", |
204,7 → 204,7 |
void PrintInfo(char **str); |
void LoadIni(char *name); |
//void CheckNumStr(); |
void ListId(int num,unsigned char *list,short *ofs); |
void ListId(int num,unsigned char *list,unsigned short *ofs); |
void printmemsizes(); |
void print8item(char *str); |
void doposts(void); |
222,6 → 222,27 |
int MakeObj(); |
void CheckUndefClassProc(); |
void ListId(int numfirstchar,unsigned char *list,unsigned short *ofs) |
{ |
char buf[40]; |
for(int i=0;i<numfirstchar;i++){ |
if((short)ofs[i]!=-1){ |
if(i<26)buf[0]=(char)('A'+i); |
else if(i==26)buf[0]='_'; |
else buf[0]=(char)(i-27+'a'); |
unsigned char *ii=(unsigned char *)(list+ofs[i]); |
while(*(short *)&*ii!=-1){ |
ii+=2; |
strcpy(buf+1,(char *)ii); |
ii+=strlen((char *)ii)+1; |
puts(buf); |
// CheckNumStr(); |
} |
} |
} |
} |
/* |
void PrintTegList(structteg *tteg) |
{ |
265,7 → 286,7 |
if(rawfilename!=NULL)IncludePath(rawfilename); |
rawfilename=rawext=NULL; |
LoadIni("c--.ini"); |
LoadIni((char *)"c--.ini"); |
for(count=1;count<argc;count++){ //îáðàáîòêà êîìàíäíîé ñòðîêè |
//if(argv[count][0]=='/'||argv[count][0]=='-'){ |
293,7 → 314,7 |
} |
} |
if(rawfilename==NULL){ |
PrintInfo(usage); |
PrintInfo((char **)usage); |
exit( e_noinputspecified ); |
} |
time(&systime); //òåêóùåå âðåìÿ |
315,14 → 336,7 |
printf("Bad input file extension '%s'.",rawext); |
exit(e_badinputfilename); |
} |
// Add dirname of the input file to include path. |
char *slash_idx = strrchr((char*)rawfilename, DIV_FOLD); |
if (slash_idx) { |
*slash_idx = '\0'; |
IncludePath((char*)rawfilename); |
*slash_idx = DIV_FOLD; |
} |
} |
void compile() |
{ |
695,7 → 709,7 |
int j,jj; |
puts("LIST OF RESERVED IDENTIFIERS:"); |
numstr=1; |
ListId(53,id,idofs); |
ListId(53,(unsigned char *)id,idofs); |
for(j=0;j<ID2S;j++){ |
puts(id2[j]); |
// CheckNumStr(); |
898,7 → 912,7 |
case c_help: |
case c_h: |
case c_hh: |
PrintInfo(usage); |
PrintInfo((char **)usage); |
exit(e_ok); |
case c_mif: |
if(ptr==NULL)return c_end; |
922,7 → 936,7 |
AlignCycle=(unsigned char)1^neg; |
if(ptr!=NULL){ |
aligncycle=getnumber((unsigned char *)ptr); |
if(aligncycle<1 || aligncycle>4096)aligncycle=8; // fix by cppcheck |
if(aligncycle<1&&aligncycle>4096)aligncycle=8; |
} |
break; |
case c_ws: //dos-stub for windows programs |
1254,26 → 1268,8 |
if(outputdata==output&&outputdata!=0)outputdata=(unsigned char *)MALLOC((size_t)MAXDATA); |
} |
void ListId(int numfirstchar,unsigned char *list,short *ofs) |
{ |
char buf[40]; |
for(int i=0;i<numfirstchar;i++){ |
if((short)ofs[i]!=-1){ |
if(i<26)buf[0]=(char)('A'+i); |
else if(i==26)buf[0]='_'; |
else buf[0]=(char)(i-27+'a'); |
unsigned char *ii=(unsigned char *)(list+ofs[i]); |
while(*(short *)&*ii!=-1){ |
ii+=2; |
strcpy(buf+1,(char *)ii); |
ii+=strlen((char *)ii)+1; |
puts(buf); |
// CheckNumStr(); |
} |
} |
} |
} |
int writeoutput() |
{ |
EXE_DOS_HEADER exeheader; // header for EXE format |
1658,8 → 1654,8 |
tok=ptr->rectok; |
if(tok==tk_structvar)datasize+=initstructvar((structteg *)ptr->newid,ptr->recrm); |
else{ |
long type,ssize; |
unsigned char typev; |
long type = 0,ssize = 0; |
unsigned char typev = 0; |
if(tok>=tk_charvar&&tok<=tk_doublevar){ |
type=tok-(tk_charvar-tk_char); |
typev=variable; |
1671,7 → 1667,6 |
if(am32==FALSE&&((itok.flag&f_far)==0))ssize=2; |
else ssize=4; |
} |
else printf("unexpected condition\n"); // fix by cppcheck |
datasize+=initglobalvar(type,ptr->recsize/ssize,ssize,typev); |
} |
free(input); |
1689,9 → 1684,6 |
{ |
char buf[256]; |
FILE *diskout; |
if (comfile == file_meos) |
sprintf(buf,"%s",rawfilename); |
else |
sprintf(buf,"%s.%s",rawfilename,ext); |
if((diskout=fopen(buf,mode))==NULL){ |
ErrOpenFile(buf); |
/programs/develop/cmm/new_type.cpp |
---|
/programs/develop/cmm/outpe.cpp |
---|
@@ -1427,7 +1427,7 @@ |
@@ -1837,7 +1837,7 @@ |
@@ -1889,9 +1889,9 @@ |
/programs/develop/cmm/port.cpp |
---|
99,7 → 99,7 |
int cchWideChar // size of buffer |
) |
{ |
int i = 0; // fix by cppcheck |
int i = 0; |
while ((lpMultiByteStr[i*2]!=0) && (lpMultiByteStr[i*2+1]!=0)) i++; |
return i/2; |
} |
147,7 → 147,7 |
char * getcwd (char *buffer, int size) |
{ |
volatile int len=0; // fix by cppcheck |
int len=0; |
if (size==0){ |
if (buffer!=0) |
return 0; |
/programs/develop/cmm/port.h |
---|
90,15 → 90,12 |
bool CharToOemA(char*, char*); |
int MultiByteToWideChar(unsigned int,unsigned int,char*,int,wchar_t *,int); |
#else |
int stricmp(const char*, const char*); |
int strnicmp(const char*, const char*, int); |
#endif |
char* strupr(char* s); |
char* strlwr(char* s); |
int stricmp(const char*, const char*); |
int strnicmp(const char*, const char*, int); |
#ifdef _PORT_CPP_ |
/programs/develop/cmm/res.h |
---|
/programs/develop/cmm/resname.h |
---|
/programs/develop/cmm/struct.h |
---|
278,7 → 278,7 |
typedef struct _OBJECT_ENTRY_ |
{ |
char name[8]; |
char name[16]; |
long vsize; |
long sectionRVA; |
long psize; |
414,7 → 414,7 |
struct MEOSheader |
{ |
unsigned char sign[8]; |
unsigned char sign[25]; |
unsigned long vers; |
unsigned long start; |
unsigned long size; |
/programs/develop/cmm/tok.h |
---|
191,7 → 191,7 |
#if !defined (_TOKR_) |
extern char useasm; |
extern short ofsmnem[]; |
extern unsigned short ofsmnem[]; |
extern unsigned char asmMnem[]; |
extern char asmparam; |
#endif |
198,7 → 198,7 |
#if !defined (_TOKA_) |
extern unsigned char id[]; |
extern short idofs[]; |
extern unsigned short idofs[]; |
extern char id2[ID2S][9]; |
extern char regs[2][8][4]; |
extern char begs[8][3]; |
350,7 → 350,7 |
unsigned long LocalStruct(int flag,int *localline); //èíèöèàëèçèðîâàòü ëîêàëüíóþ ñòðóêòóðó |
struct structteg * FindTeg(int Global,char *name=itok.name); //íàéòè òåã |
void dostruct(); |
int FastSearch(unsigned char *list,short *ofs,int type,char *str); |
int FastSearch(unsigned char *list,short unsigned *ofs,int type,char *str); |
void FindDirectiv(); |
unsigned long long scannumber(int *rm); |
void FastTok(int mode,int *tok4=&tok,ITOK *itok4=&itok); |
462,7 → 462,7 |
int updatecall(unsigned int which,unsigned int where,unsigned int top); |
void AddBackBuf(int,char); |
void CharToBackBuf(char c); |
void missingpar(char *name=""); |
void missingpar(char *name=(char *)""); |
int CheckCodeSize(); |
void CheckPosts(); |
int doanyundefproc(int jumpsend=FALSE); |
/programs/develop/cmm/toka.cpp |
---|
663,7 → 663,7 |
void CheckReg(int idx,int base,int *reg1,int *reg2,int razr) |
{ |
if(razr==r32){ |
unsigned char lreg[8]; |
unsigned char lreg[16]; |
int i; |
for(i=0;i<8;i++){ |
if(i==ESP||i==EBP)lreg[i]=1; |
675,7 → 675,7 |
} |
if(lreg[*reg1]==0)lreg[*reg1]=1; |
else{ |
for(i=7;i>=0;i--){ // fix by cppcheck, side effect - enable EAX |
for(i=8;i!=0;i--){ |
if(lreg[i]==0){ |
lreg[i]=1; |
*reg1=i; |
685,7 → 685,7 |
} |
// printf("\nreg1=%d",*reg1); |
if(lreg[*reg2]!=0){ |
for(i=7;i>=0;i--){ // fix by cppcheck, side effect - enable EAX |
for(i=8;i!=0;i--){ |
if(lreg[i]==0){ |
*reg2=i; |
break; |
4094,7 → 4094,7 |
return i; |
} |
int FastSearch(unsigned char *list,short *ofs,int type,char *str) |
int FastSearch(unsigned char *list,short unsigned *ofs,int type,char *str) |
{ |
if((strlen(str)-1)>0){ |
short offs=-1; |
/programs/develop/cmm/tokb.cpp |
---|
@@ -5287,7 +5284,7 @@ |
@@ -8313,9 +8310,9 @@ |
/programs/develop/cmm/tokc.cpp |
---|
9976,7 → 9976,7 |
int i; |
elementteg *bazael; |
structteg *newteg; |
int ssize=4,count; // fix by cppcheck |
int ssize=0,count; |
idrec *newrec,*ptr; |
if(alignword){ //âûðîâíÿòü íà ÷åòíûé àäðåñ |
if(am32==0){ |