Functor support from Stefan
This commit is contained in:
parent
ba7fdb580d
commit
a48b4c4f8d
42
gverilog.c
42
gverilog.c
|
|
@ -66,6 +66,10 @@ struct target {
|
||||||
};
|
};
|
||||||
struct target target = {VVM, {"-t", "vvm", 0}};
|
struct target target = {VVM, {"-t", "vvm", 0}};
|
||||||
|
|
||||||
|
|
||||||
|
/* functors setup */
|
||||||
|
struct compset functors = {"-F","", 0};
|
||||||
|
|
||||||
/* output file */
|
/* output file */
|
||||||
struct compset outputfile = {"-o", "", 0};
|
struct compset outputfile = {"-o", "", 0};
|
||||||
|
|
||||||
|
|
@ -98,12 +102,16 @@ void sorry(char optelem)
|
||||||
|
|
||||||
targettype resolvtarget(char *target)
|
targettype resolvtarget(char *target)
|
||||||
{
|
{
|
||||||
if (strcmp(target, "vvm") == 0)
|
if (strcmp(target, "vvm") == 0) {
|
||||||
return VVM;
|
return VVM;
|
||||||
else if (strcmp(target, "xnf") == 0)
|
} else if (strcmp(target, "xnf") == 0) {
|
||||||
|
sprintf(functors.name, "%ssynth %snodangle %sxnfio",
|
||||||
|
functors.compsw, functors.compsw, functors.compsw);
|
||||||
|
functors.set = 1;
|
||||||
return XNF;
|
return XNF;
|
||||||
else
|
} else {
|
||||||
return OTHER;
|
return OTHER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -117,20 +125,17 @@ void error_exit(void)
|
||||||
|
|
||||||
void create_outputfilename(char *input, char *output)
|
void create_outputfilename(char *input, char *output)
|
||||||
{
|
{
|
||||||
int dotpos=0;
|
char *dotpos, *spacepos;
|
||||||
int spacepos=0;
|
|
||||||
int i=0;
|
|
||||||
|
|
||||||
for(i=strlen(input); i!=0; i--){
|
if ((dotpos = strrchr(input, (int)'.')) == NULL) {
|
||||||
if ((dotpos == 0) && (input[i] == '.')) dotpos = i;
|
dotpos = input + strlen(input);
|
||||||
if ((spacepos == 0) && (input[i] == ' ')) spacepos = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dotpos == 0) {
|
|
||||||
dotpos = strlen(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output = strncpy(output, &input[spacepos+1], dotpos-spacepos-1);
|
if ((spacepos = strrchr(input, (int)' ')) == NULL) {
|
||||||
|
spacepos = input;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = strncpy(output, spacepos, dotpos-spacepos);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -225,10 +230,13 @@ void postprocess(void)
|
||||||
unlink(tmpCCfile);
|
unlink(tmpCCfile);
|
||||||
break;
|
break;
|
||||||
case XNF: /* Just move file as is */
|
case XNF: /* Just move file as is */
|
||||||
|
sprintf(outputfile.name, "%s.xnf", outputfile.name);
|
||||||
if (compileinfo.debug) {
|
if (compileinfo.debug) {
|
||||||
printf("Moving file %s to %s\n", tmpCCfile, outputfile.name);
|
printf("Moving file %s to %s\n", tmpCCfile, outputfile.name);
|
||||||
} else {
|
} else {
|
||||||
rename(tmpCCfile, outputfile.name);
|
if (rename(tmpCCfile, outputfile.name) == -1) {
|
||||||
|
perror("Failed moving file. gverilog:postprocess\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OTHER: /* Just move file as is */
|
case OTHER: /* Just move file as is */
|
||||||
|
|
@ -236,7 +244,9 @@ void postprocess(void)
|
||||||
if (compileinfo.debug) {
|
if (compileinfo.debug) {
|
||||||
printf("Moving file %s to %s\n", tmpCCfile, outputfile.name);
|
printf("Moving file %s to %s\n", tmpCCfile, outputfile.name);
|
||||||
} else {
|
} else {
|
||||||
rename(tmpCCfile, outputfile.name);
|
if (rename(tmpCCfile, outputfile.name) == -1) {
|
||||||
|
perror("Failed moving file. gverilog:postprocess\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue