Update from Maciek
git-svn-id: svn://svn.cc65.org/cc65/trunk@147 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
fed0a0a52d
commit
c69ab79e76
2 changed files with 25 additions and 9 deletions
|
@ -15,7 +15,6 @@
|
||||||
- more or less comments? it was hard to code, should be even harder to
|
- more or less comments? it was hard to code, should be even harder to
|
||||||
understand =D
|
understand =D
|
||||||
- add loadable icons feature (binary - 63 bytes)
|
- add loadable icons feature (binary - 63 bytes)
|
||||||
- counted menusize is most possibly wrong (const offsets, not sure about text)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* - err, maybe free allocated memory, huh? (who cares, it's just a little prog...)
|
/* - err, maybe free allocated memory, huh? (who cares, it's just a little prog...)
|
||||||
|
@ -61,21 +60,32 @@ void printSHeader (void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void openCFile (void) {
|
void openCFile (void) {
|
||||||
if ((outputCFile = fopen (outputCName,"a"))==0)
|
if ((CFnum==0) && (forceFlag==0)) {
|
||||||
|
/* test if file exists already and no forcing*/
|
||||||
|
if ((outputCFile = fopen (outputCName,"r"))!=0)
|
||||||
|
Error("file %s already exists, no forcing, aborting\n", outputCName);
|
||||||
|
}
|
||||||
|
if ((outputCFile = fopen (outputCName,outputCMode))==0)
|
||||||
Error("can't open file %s for writting: %s\n",outputCName,strerror (errno));
|
Error("can't open file %s for writting: %s\n",outputCName,strerror (errno));
|
||||||
if (CFnum==0) { printCHeader(); CFnum++; }
|
if (CFnum==0) { outputCMode[0]='a'; printCHeader(); CFnum++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void openSFile (void) {
|
void openSFile (void) {
|
||||||
if ((outputSFile = fopen (outputSName,"a"))==0)
|
if ((SFnum==0) && (forceFlag==0)) {
|
||||||
|
/* test if file exists already and no forcing*/
|
||||||
|
if ((outputSFile = fopen (outputSName,"r"))!=0)
|
||||||
|
Error("file %s already exists, no forcing, aborting\n", outputSName);
|
||||||
|
}
|
||||||
|
if ((outputSFile = fopen (outputSName,outputSMode))==0)
|
||||||
Error("can't open file %s for writting: %s\n",outputSName,strerror (errno));
|
Error("can't open file %s for writting: %s\n",outputSName,strerror (errno));
|
||||||
if (SFnum==0) { printSHeader(); SFnum++; }
|
if (SFnum==0) { outputSMode[0]='a'; printSHeader(); SFnum++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void printUsage (void) {
|
void printUsage (void) {
|
||||||
fprintf(stderr, "Usage: %s [options] file\n"
|
fprintf(stderr, "Usage: %s [options] file\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-h, -?\t\tthis help\n"
|
"\t-h, -?\t\tthis help\n"
|
||||||
|
"\t-f\t\tforce writting files\n"
|
||||||
"\t-o name\t\tname C output file\n"
|
"\t-o name\t\tname C output file\n"
|
||||||
"\t-s name\t\tname asm output file\n",
|
"\t-s name\t\tname asm output file\n",
|
||||||
progName);
|
progName);
|
||||||
|
@ -197,14 +207,14 @@ struct menuitem *curItem, *newItem;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
/* menu is VERTICAL, ysize=item*15, count largest xsize of all items +~8? */
|
/* menu is VERTICAL, ysize=item*15, count largest xsize of all items +~8? */
|
||||||
myMenu.bot=myMenu.top+(15*item);
|
myMenu.bot=myMenu.top+(14*item)-1;
|
||||||
for (a=0;a!=item;a++) {
|
for (a=0;a!=item;a++) {
|
||||||
tmpsize=getNameSize(curItem->name);
|
tmpsize=getNameSize(curItem->name);
|
||||||
size = (size > tmpsize) ? size : tmpsize;
|
size = (size > tmpsize) ? size : tmpsize;
|
||||||
curItem=curItem->next;
|
curItem=curItem->next;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
myMenu.right=myMenu.left+size;
|
myMenu.right=myMenu.left+size-1;
|
||||||
|
|
||||||
curItem=myMenu.item;
|
curItem=myMenu.item;
|
||||||
for (a=0;a!=item;a++) {
|
for (a=0;a!=item;a++) {
|
||||||
|
@ -449,6 +459,9 @@ char *p, *tmp;
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
if (arg[0] == '-') {
|
if (arg[0] == '-') {
|
||||||
switch (arg[1]) {
|
switch (arg[1]) {
|
||||||
|
case 'f':
|
||||||
|
forceFlag=1;
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
outputCName=argv[++i];
|
outputCName=argv[++i];
|
||||||
break;
|
break;
|
||||||
|
@ -474,14 +487,14 @@ char *p, *tmp;
|
||||||
if (outputCName==NULL) {
|
if (outputCName==NULL) {
|
||||||
outputCName = malloc(strlen(arg));
|
outputCName = malloc(strlen(arg));
|
||||||
strcpy (outputCName, tmp);
|
strcpy (outputCName, tmp);
|
||||||
strcat (outputCName, ".hh");
|
strcat (outputCName, ".h");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (outputSName==NULL) {
|
if (outputSName==NULL) {
|
||||||
outputSName = malloc(strlen(arg));
|
outputSName = malloc(strlen(arg));
|
||||||
strcpy (outputSName, tmp);
|
strcpy (outputSName, tmp);
|
||||||
strcat (outputSName, ".ss");
|
strcat (outputSName, ".s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,3 +65,6 @@ char *progName;
|
||||||
char *outputCName=NULL, *outputSName=NULL;
|
char *outputCName=NULL, *outputSName=NULL;
|
||||||
FILE *outputCFile, *outputSFile;
|
FILE *outputCFile, *outputSFile;
|
||||||
int CFnum=0, SFnum=0;
|
int CFnum=0, SFnum=0;
|
||||||
|
int forceFlag=0;
|
||||||
|
char outputCMode[2]="w";
|
||||||
|
char outputSMode[2]="w";
|
||||||
|
|
Loading…
Add table
Reference in a new issue