Commit bbeed7f4 authored by Sergio Costas's avatar Sergio Costas

Renamed the .c and .h files to avoid confusions with the crust.h file

Now checks if there are no source files
parent a8544d09
......@@ -36,7 +36,7 @@ def get_data_files():
data_files = []
data_files.append(('crust',[os.path.join('src', 'lexyacclib', 'crust.h'), os.path.join('src', 'lexyacclib', 'crust.so')]))
data_files.append(('crust',[os.path.join('src', 'lexyacclib', 'crust_code.h'), os.path.join('src', 'lexyacclib', 'crust.so')]))
try:
for lang_name in [f for f in os.listdir('locale')]:
......@@ -55,7 +55,10 @@ def get_data_files():
params = ["make", "-C", "src/lexyacclib"]
rv = subprocess.run(params)
if (rv.returncode != 0):
print (rv.stderr.decode("utf-8"))
try:
print (rv.stderr.decode("utf-8"))
except:
pass
sys.exit(-1)
#here = os.path.abspath(os.path.dirname(__file__))
......
......@@ -1716,18 +1716,21 @@ def get_parameters():
return parameters
def main():
if (os.path.exists('lexyacclib/crust.h')) and (os.path.exists('lexyacclib/crust.so')):
lib = crust("lexyacclib/crust.h", "lexyacclib/crust.so", True)
if (os.path.exists('lexyacclib/crust_code.h')) and (os.path.exists('lexyacclib/crust.so')):
lib = crust("lexyacclib/crust_code.h", "lexyacclib/crust.so", True)
else:
lib = crust(pkg_resources.resource_filename('crust','/crust.h'),pkg_resources.resource_filename('crust','/crust.so'))
lib = crust(pkg_resources.resource_filename('crust','/crust_code.h'),pkg_resources.resource_filename('crust','/crust.so'))
parameters = get_parameters()
filelist = []
for f in parameters["files"]:
filelist.append(f)
filelist.sort()
for f in filelist:
if parameters["files"][f]:
process_file(lib, f, parameters)
if len(filelist) == 0:
print("No files")
else:
filelist.sort()
for f in filelist:
if parameters["files"][f]:
process_file(lib, f, parameters)
if __name__ == "__main__":
main()
......@@ -15,22 +15,22 @@ clean:
crust: crust.o c99.lex.o c99.yacc.o tokens.o
$(LN) crust.o c99.lex.o c99.yacc.o tokens.o
crust.o: crust.c lexyacc/c99.lex.h lexyacc/c99.yacc.h crust.h
$(CC) -o crust.o crust.c
crust.o: crust_code.c lexyacc/c99.lex.h lexyacc/c99.yacc.h crust_code.h
$(CC) -o crust.o crust_code.c
tokens.o: tokens.c
$(CC) -o tokens.o tokens.c
c99.lex.o: lexyacc/c99.lex.c crust.h
c99.lex.o: lexyacc/c99.lex.c crust_code.h
$(CC) -o c99.lex.o lexyacc/c99.lex.c
c99.yacc.o: lexyacc/c99.yacc.c crust.h
c99.yacc.o: lexyacc/c99.yacc.c crust_code.h
$(CC) -o c99.yacc.o lexyacc/c99.yacc.c
lexyacc/c99.lex.c lexyacc/c99.lex.h: lexyacc/c99.l crust.h lexyacc/c99.yacc.h
lexyacc/c99.lex.c lexyacc/c99.lex.h: lexyacc/c99.l crust_code.h lexyacc/c99.yacc.h
flex -o lexyacc/c99.lex.c --header-file=lexyacc/c99.lex.h lexyacc/c99.l
lexyacc/c99.yacc.c lexyacc/c99.yacc.h: lexyacc/c99.y crust.h
lexyacc/c99.yacc.c lexyacc/c99.yacc.h: lexyacc/c99.y crust_code.h
bison -o lexyacc/c99.yacc.c --defines=lexyacc/c99.yacc.h lexyacc/c99.y -Wconflicts-sr -v --report=all --report-file=report.txt
tokens.c: tokengen.py lexyacc/c99.y
......
......@@ -17,7 +17,7 @@
#include <stdio.h>
#include <unistd.h>
#include "crust.h"
#include "crust_code.h"
#include "lexyacc/c99.lex.h"
#include "lexyacc/c99.yacc.h"
......
......@@ -30,7 +30,7 @@ WS2 [ \\t]
%{
#include <stdio.h>
#include "c99.yacc.h"
#include "../crust.h"
#include "../crust_code.h"
int tmptype;
unsigned long long int tmpint;
......
......@@ -17,7 +17,7 @@
%{
#include <stdio.h>
#include "../crust.h"
#include "../crust_code.h"
extern int yylex();
extern int yyparse();
......
......@@ -59,10 +59,10 @@ class Test(unittest.TestCase):
lib.print_errors()
def open_crust(self):
if (os.path.exists('lexyacclib/crust.h')) and (os.path.exists('lexyacclib/crust.so')):
lib = crust.crust("lexyacclib/crust.h", "lexyacclib/crust.so")
if (os.path.exists('lexyacclib/crust_code.h')) and (os.path.exists('lexyacclib/crust.so')):
lib = crust.crust("lexyacclib/crust_code.h", "lexyacclib/crust.so")
else:
lib = crust.crust(pkg_resources.resource_filename('crust','/crust.h'),pkg_resources.resource_filename('crust','/crust.so'))
lib = crust.crust(pkg_resources.resource_filename('crust','/crust_code.h'),pkg_resources.resource_filename('crust','/crust.so'))
return lib
def _generic_test(self, filename, params):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment