[cmm] New option /OPATH to specify output file name

This is needed to migrate to tup-0.8.

git-svn-id: svn://kolibrios.org@10040 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2024-05-21 14:42:21 +00:00
parent 9b1c982736
commit 917cebdce1

View File

@ -28,6 +28,7 @@
static char **_Argv; //!!! simplest way to make your own variable static char **_Argv; //!!! simplest way to make your own variable
unsigned char compilerstr[]="SPHINX C-- 0.239"; unsigned char compilerstr[]="SPHINX C-- 0.239";
char opath[4096];
char *rawfilename; /* file name */ char *rawfilename; /* file name */
char *rawext; char *rawext;
LISTCOM *listcom; LISTCOM *listcom;
@ -137,7 +138,7 @@ const char *usage[]={
"-SYM COM file symbiosis -LST create assembly listing", "-SYM COM file symbiosis -LST create assembly listing",
"-SYS device (SYS) file -B32 32bit binary files", "-SYS device (SYS) file -B32 32bit binary files",
"-MEOS executable file for MeOS -MAP create function map file", "-MEOS executable file for MeOS -MAP create function map file",
"-EXT= <ext> set file extension", "-EXT= <ext> set file extension -OPATH output file path",
"", "",
" MISCELLANEOUS", " MISCELLANEOUS",
"-HELP -H -? help, this info -WORDS list of C-- reserved words", "-HELP -H -? help, this info -WORDS list of C-- reserved words",
@ -168,7 +169,7 @@ const char *dir[]={
#ifdef OPTVARCONST #ifdef OPTVARCONST
"ORV", "ORV",
#endif #endif
"MAP", "WE", "EXT", NULL}; "MAP", "WE", "EXT", "OPATH", NULL};
enum { enum {
c_me, c_key, c_sym, c_lasm, c_endinfo=c_lasm, c_me, c_key, c_sym, c_lasm, c_endinfo=c_lasm,
@ -191,7 +192,7 @@ enum {
#ifdef OPTVARCONST #ifdef OPTVARCONST
c_orv, c_orv,
#endif #endif
c_map, c_we, c_ext, c_end}; c_map, c_we, c_ext, c_opath, c_end};
#define NUMEXT 6 //÷èñëî ðàçðåøåííûõ ðàñøèðåíèé êîìïèëèðóåìîãî ôàéëà #define NUMEXT 6 //÷èñëî ðàçðåøåííûõ ðàñøèðåíèé êîìïèëèðóåìîãî ôàéëà
char extcompile[NUMEXT][4]={"c--","cmm","c","h--","hmm","h"}; char extcompile[NUMEXT][4]={"c--","cmm","c","h--","hmm","h"};
@ -1066,6 +1067,9 @@ nexpardll:
strcpy(outext,BackString(ptr)); //***lev*** strcpy(outext,BackString(ptr)); //***lev***
extflag=FALSE; //÷òîáû ðàñøèðåíèå íå ïåðåçàáèâàëîñü äðóãèìè êëþ÷àìè, åñëè îíè èäóò ïîçæå extflag=FALSE; //÷òîáû ðàñøèðåíèå íå ïåðåçàáèâàëîñü äðóãèìè êëþ÷àìè, åñëè îíè èäóò ïîçæå
break; //***lev*** break; //***lev***
case c_opath:
strcpy(opath,BackString(ptr));
break;
} }
break; break;
} }
@ -1719,10 +1723,12 @@ FILE *CreateOutPut(char *ext,char *mode)
{ {
char buf[256]; char buf[256];
FILE *diskout; FILE *diskout;
if(ext && strlen(ext)) { if (*opath) {
strcpy(buf,opath);
} else if(ext && strlen(ext)) {
sprintf(buf,"%s.%s",rawfilename,ext); sprintf(buf,"%s.%s",rawfilename,ext);
} else { } else {
strcpy(buf, rawfilename); strcpy(buf,rawfilename);
} }
if((diskout=fopen(buf,mode))==NULL){ if((diskout=fopen(buf,mode))==NULL){