Commit 1fa8bcd253481dbb38b339fed0ad31a43d49080d
1 parent
6289a377
Exists in
master
back-end specific code now goes into a library (libXXX.a)
Showing
4 changed files
with
23 additions
and
12 deletions
Show diff stats
fz/Makefile
... | ... | @@ -9,7 +9,9 @@ PLOFILES = $(patsubst %.pl,%.o,$(PLFILES)) |
9 | 9 | # XXX/output.pl produces fz-XXX, the flatzinc-to-XXX compiler |
10 | 10 | FZBACKS = $(patsubst %/output.pl,%,$(wildcard */output.pl)) |
11 | 11 | FZSEM = $(patsubst %/output.pl,fz-%,$(wildcard */output.pl)) |
12 | -FZOFILES = $(patsubst %,%/*.o,$(FZBACKS)) | |
12 | +FZPLFILES = $(foreach B,$(FZBACKS),$(wildcard $B/*.pl)) | |
13 | +FZOFILES = $(patsubst %.pl,%.o,$(FZPLFILES)) | |
14 | +FZAFILES = $(patsubst %,lib%.a,$(FZBACKS)) | |
13 | 15 | |
14 | 16 | # NOTE: we need to pass the `-l' flag to ensure the scanner internal |
15 | 17 | # variable `yylineno' is available. |
... | ... | @@ -31,28 +33,34 @@ RM = /bin/rm -f |
31 | 33 | %.ast:: %.fzn |
32 | 34 | fzp < $< > $@ |
33 | 35 | |
34 | -all: fzp $(FZSEM) $(PLOFILES) $(FZOFILES) | |
36 | +all: fzp $(FZSEM) $(PLOFILES) $(FZOFILES) $(FZAFILES) | |
35 | 37 | |
36 | 38 | fzp: $(OBJ) |
37 | 39 | $(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB) |
38 | 40 | |
39 | -fz-%: %/output.o $(PLOFILES) | |
41 | +fz-%: $(PLOFILES) lib%.a | |
40 | 42 | $(GPLC) -o $@ $+ |
41 | 43 | |
44 | +lib%.a: $(FZOFILES) | |
45 | + ar rv $@ $+ | |
46 | + | |
42 | 47 | %.o: %.pl |
43 | 48 | $(GPLC) $(GPLCFLAGS) -c $< |
44 | 49 | |
45 | 50 | flatzinc.tab.c: flatzinc.y lex.yy.c |
46 | - $(YACC) $(YACCFLAGS) flatzinc.y | |
51 | + $(YACC) $(YACCFLAGS) flatzinc.y | |
47 | 52 | |
48 | 53 | lex.yy.c: flatzinc.l |
49 | - $(LEX) $(LEXFLAGS) flatzinc.l | |
54 | + $(LEX) $(LEXFLAGS) flatzinc.l | |
50 | 55 | |
51 | 56 | clean: |
52 | - $(RM) $(OBJ) $(PLOFILES) $(FZOFILES) $(GENCFILES) $(OTHER) core | |
57 | + $(RM) \ | |
58 | + $(OBJ) $(PLOFILES) \ | |
59 | + $(FZOFILES) $(FZAFILES) \ | |
60 | + $(GENCFILES) $(OTHER) core | |
53 | 61 | |
54 | 62 | clobber: clean |
55 | - $(RM) $(EXE_FILE) | |
63 | + $(RM) $(EXE_FILE) | |
56 | 64 | |
57 | 65 | .PHONY: distclean |
58 | 66 | distclean: clobber | ... | ... |
fz/paccs/output.pl
... | ... | @@ -92,10 +92,9 @@ cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST). |
92 | 92 | % emit an instruction which partly covers CI, leaving CO untreated |
93 | 93 | % FIXME: for now this just puts out comments |
94 | 94 | |
95 | -cg_coverage([], [], _ST) --> []. | |
96 | -cg_coverage([C|CS], [C|CX], ST) --> | |
97 | - { format_to_codes(S, "// ~w\n", [C]) }, S, | |
98 | - cg_coverage(CS, CX, ST). | |
95 | +cg_coverage([C|CS], CS, _ST) --> | |
96 | + { C=constraint(CE, _A), | |
97 | + format_to_codes(S, "// ~w\n", [CE]) }, S. | |
99 | 98 | |
100 | 99 | |
101 | 100 | % -- goal --------------------------------------------------------------------- | ... | ... |
fz/semantic.pl
... | ... | @@ -49,7 +49,7 @@ sa_n(var(N,T,[],A), V, ST) :- !, |
49 | 49 | st_insert(ST, N, V). |
50 | 50 | |
51 | 51 | sa_n(var(N,T,I,A), V, ST) :- % non-empty initializer |
52 | - sa_n_traverse(I, NI, ST), % parse initializer (& ignore T and A), | |
52 | + sa_n_traverse(I, _NI, ST), % parse initializer (& ignore T and A), | |
53 | 53 | sa_attribs(A, AX, ST), |
54 | 54 | V=val(N,T,I,AX), % -- not var(N,T,NI,AX) -- |
55 | 55 | st_insert(ST, N, V). % and it becomes the ST entry value | ... | ... |