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,7 +9,9 @@ PLOFILES = $(patsubst %.pl,%.o,$(PLFILES)) | ||
9 | # XXX/output.pl produces fz-XXX, the flatzinc-to-XXX compiler | 9 | # XXX/output.pl produces fz-XXX, the flatzinc-to-XXX compiler |
10 | FZBACKS = $(patsubst %/output.pl,%,$(wildcard */output.pl)) | 10 | FZBACKS = $(patsubst %/output.pl,%,$(wildcard */output.pl)) |
11 | FZSEM = $(patsubst %/output.pl,fz-%,$(wildcard */output.pl)) | 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 | # NOTE: we need to pass the `-l' flag to ensure the scanner internal | 16 | # NOTE: we need to pass the `-l' flag to ensure the scanner internal |
15 | # variable `yylineno' is available. | 17 | # variable `yylineno' is available. |
@@ -31,28 +33,34 @@ RM = /bin/rm -f | @@ -31,28 +33,34 @@ RM = /bin/rm -f | ||
31 | %.ast:: %.fzn | 33 | %.ast:: %.fzn |
32 | fzp < $< > $@ | 34 | fzp < $< > $@ |
33 | 35 | ||
34 | -all: fzp $(FZSEM) $(PLOFILES) $(FZOFILES) | 36 | +all: fzp $(FZSEM) $(PLOFILES) $(FZOFILES) $(FZAFILES) |
35 | 37 | ||
36 | fzp: $(OBJ) | 38 | fzp: $(OBJ) |
37 | $(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB) | 39 | $(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB) |
38 | 40 | ||
39 | -fz-%: %/output.o $(PLOFILES) | 41 | +fz-%: $(PLOFILES) lib%.a |
40 | $(GPLC) -o $@ $+ | 42 | $(GPLC) -o $@ $+ |
41 | 43 | ||
44 | +lib%.a: $(FZOFILES) | ||
45 | + ar rv $@ $+ | ||
46 | + | ||
42 | %.o: %.pl | 47 | %.o: %.pl |
43 | $(GPLC) $(GPLCFLAGS) -c $< | 48 | $(GPLC) $(GPLCFLAGS) -c $< |
44 | 49 | ||
45 | flatzinc.tab.c: flatzinc.y lex.yy.c | 50 | flatzinc.tab.c: flatzinc.y lex.yy.c |
46 | - $(YACC) $(YACCFLAGS) flatzinc.y | 51 | + $(YACC) $(YACCFLAGS) flatzinc.y |
47 | 52 | ||
48 | lex.yy.c: flatzinc.l | 53 | lex.yy.c: flatzinc.l |
49 | - $(LEX) $(LEXFLAGS) flatzinc.l | 54 | + $(LEX) $(LEXFLAGS) flatzinc.l |
50 | 55 | ||
51 | clean: | 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 | clobber: clean | 62 | clobber: clean |
55 | - $(RM) $(EXE_FILE) | 63 | + $(RM) $(EXE_FILE) |
56 | 64 | ||
57 | .PHONY: distclean | 65 | .PHONY: distclean |
58 | distclean: clobber | 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,10 +92,9 @@ cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST). | ||
92 | % emit an instruction which partly covers CI, leaving CO untreated | 92 | % emit an instruction which partly covers CI, leaving CO untreated |
93 | % FIXME: for now this just puts out comments | 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 | % -- goal --------------------------------------------------------------------- | 100 | % -- goal --------------------------------------------------------------------- |
fz/semantic.pl
@@ -49,7 +49,7 @@ sa_n(var(N,T,[],A), V, ST) :- !, | @@ -49,7 +49,7 @@ sa_n(var(N,T,[],A), V, ST) :- !, | ||
49 | st_insert(ST, N, V). | 49 | st_insert(ST, N, V). |
50 | 50 | ||
51 | sa_n(var(N,T,I,A), V, ST) :- % non-empty initializer | 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 | sa_attribs(A, AX, ST), | 53 | sa_attribs(A, AX, ST), |
54 | V=val(N,T,I,AX), % -- not var(N,T,NI,AX) -- | 54 | V=val(N,T,I,AX), % -- not var(N,T,NI,AX) -- |
55 | st_insert(ST, N, V). % and it becomes the ST entry value | 55 | st_insert(ST, N, V). % and it becomes the ST entry value |