Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pab/devel - conditional exports #90

Merged
merged 35 commits into from
Nov 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f993d7d
genfoam: Remove support for -Wold-hashcodes.
pbroadbery Oct 19, 2013
bee3969
tfGetCatExportsFrParents wasn't dealing with lists correctly.
pbroadbery Oct 26, 2013
22def9c
dnf/ablogic: DNF now supports simplification of expressions containing
pbroadbery Oct 27, 2013
cf2e45c
dnf/ablogic: Add some extra tests, and improve dnf debug output.
pbroadbery Oct 27, 2013
1723314
aldortest: noticed that the float test was failing.. fix is simple, so
pbroadbery Oct 27, 2013
5070962
absyn.c: Rework hash function to take care of Pretend, Restrict and T…
pbroadbery Oct 27, 2013
758ff38
tform.c: Small improvements to debug output.
pbroadbery Oct 27, 2013
32f6ff0
Showexports.c: include condition in category output
pbroadbery Oct 27, 2013
7949eb0
syme.c: add missing fieldInfo for SYFI_ConditionContext. Also, be par…
pbroadbery Oct 28, 2013
458f63a
lib/ax0/test: Use $(DBG), cos everything else does.
pbroadbery Nov 1, 2013
0cef663
Set libraryincdir in libfoamlib - makes %.gloop targets work properly
pbroadbery Nov 1, 2013
4983eea
build: Make Tests.am depend on Makefile.am
pbroadbery Nov 1, 2013
6fa6abb
lib/ax0: axextend.as: ShouldHaveSegmentGenerator's condition was inco…
pbroadbery Nov 1, 2013
791d31b
genfoam.c: gen0HasImport returns a Word, cast it back to a boolean
pbroadbery Nov 1, 2013
16a6fc2
showexports: category pretty printing wasn't correct. fix
pbroadbery Nov 1, 2013
b12c57b
syme.c: As an optimisation, call tiSefo if possible before launching …
pbroadbery Nov 1, 2013
c896db1
sefo.c: track '%' on with expressions across file boundaries.
pbroadbery Nov 1, 2013
ec47cc3
Add new test for explicit conditions into aldor test suite.
pbroadbery Nov 2, 2013
848f1e8
tinfer.c: Implicit imports and conditionals
pbroadbery Nov 1, 2013
c681a92
syme.c: Fix case of AB_And in a type expression.
pbroadbery Nov 1, 2013
78e834a
tests: Add better test for symeAddCondition
pbroadbery Nov 1, 2013
3416518
tform.c: Use already existing function to add a condition to a list of
pbroadbery Nov 1, 2013
0ac9d87
aldor/test: Add -Wcheck to argument list.
pbroadbery Nov 1, 2013
80bef0f
absyn.c: Add abNewAndAll to get a conjuction from a list of tests
pbroadbery Nov 1, 2013
d032a3f
absyn.c: New abNewOrAll function.
pbroadbery Nov 1, 2013
20e7b70
syme.c: Check that conditions can be type inferred before adding them to
pbroadbery Nov 1, 2013
534083a
scobind.c: Dump the information about conditional context in which an
pbroadbery Nov 1, 2013
c6c5658
foamlib: ~=$List was missing in the case where S isn't a BasicType.
pbroadbery Nov 2, 2013
78cdd04
aldor_gloop.as - define << when not X has OutputType, instead of Prim…
pbroadbery Nov 2, 2013
f8a9ee9
complex.as: Define ^ in terms of binary powering when R is not a Floa…
pbroadbery Nov 2, 2013
6e0d9a9
algebra/sit_quotby.as: Mark normalize on FractionBy as broken for
pbroadbery Nov 2, 2013
cf41895
sit_sercat: Definition of monicNewtonSeries and tryExpandFraction
pbroadbery Nov 2, 2013
1c6c420
Verify that when an export is required from an add body, make sure th…
pbroadbery Nov 1, 2013
7547146
terror.c: Warnings on conditionally missing exports
pbroadbery Nov 2, 2013
087ff88
algebra library: remove debug flag in build
pbroadbery Nov 2, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aldor/aldor/lib/libfoamlib/al/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ libraryname := foamlib
AXLFLAGS := -Z db -Fc -Q8 $(AXLCDB)

include $(top_srcdir)/lib/buildlib.mk
libraryincdir := $(top_srcdir)/aldor/lib/libfoamlib/al

Libraryname := Axl

Expand Down
4 changes: 4 additions & 0 deletions aldor/aldor/lib/libfoamlib/al/list.as
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,16 @@ List(S: Type): ListCategory S with == FakedConditionalOperations S add {
-- on conditionals
FakedConditionalOperations(S: Type): with {
=: (%, %) -> Boolean;
~=: (%, %) -> Boolean;
<<: (TextWriter, %) -> TextWriter;
member?: (S, %) -> Boolean;
} == add {
(a: %) = (b: %): Boolean == {
error "no equality on this object";
}
(a: %) ~= (b: %): Boolean == {
error "no equality on this object";
}
member?(a: S, b: %): Boolean == {
error "no member? on this object";
}
Expand Down
5 changes: 3 additions & 2 deletions aldor/aldor/src/ablogic.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ local DNF_Atom ablogNextIx;
local void
ablogInitTables(void)
{
ablogToTable = tblNew((TblHashFun) abHash, (TblEqFun) sefoEqual);
ablogFrTable = tblNew((TblHashFun) 0, (TblEqFun) 0);
ablogToTable = tblNew((TblHashFun) abHashSefo, (TblEqFun) sefoEqual);
ablogFrTable = tblNew((TblHashFun) 0, (TblEqFun) 0);
ablogNextIx = 1;
}

Expand Down Expand Up @@ -125,6 +125,7 @@ ablogInit(void)

ablogInitTables();
fmtRegister("AbLogic", ablogFormatter);
fmtRegister("DNF", dnfFormatter);

ablogIsInit = true;
}
Expand Down
69 changes: 69 additions & 0 deletions aldor/aldor/src/absyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,22 @@ abNewOfOpAndList(AbSynTag abtag, SrcPos pos, AbSyn op, AbSynList args)
return ab;
}

AbSyn
abNewAndAll(SrcPos pos, AbSynList absyn)
{
if (cdr(absyn) == listNil(AbSyn))
return car(absyn);

return abNewAnd(pos, car(absyn), abNewAndAll(pos, cdr(absyn)));
}
AbSyn
abNewOrAll(SrcPos pos, AbSynList absyn)
{
if (cdr(absyn) == listNil(AbSyn))
return car(absyn);
return abNewOr(pos, car(absyn), abNewAndAll(pos, cdr(absyn)));
}

void
abFree(AbSyn ab)
{
Expand Down Expand Up @@ -700,6 +716,46 @@ abEqualModDeclares(AbSyn ab1, AbSyn ab2)
h &= 0x3FFFFFFF; \
}

Hash
abHashSefo(AbSyn ab)
{
Hash h = 0;
Length i;

if (abHasTag(ab, AB_Declare))
return abHashSefo(ab->abDeclare.type);
if (abHasTag(ab, AB_Qualify))
return abHashSefo(ab->abQualify.what);
if (abHasTag(ab, AB_PretendTo))
return abHashSefo(ab->abPretendTo.expr);
if (abHasTag(ab, AB_RestrictTo))
return abHashSefo(ab->abRestrictTo.expr);
if (abHasTag(ab, AB_Test))
return abHashSefo(ab->abTest.cond);

if (abIsSymTag(abTag(ab)))
h = strHash(symString(abLeafSym(ab)));
else if (abIsDocTag(abTag(ab)))
h = strHash(docString(abLeafDoc(ab)));
else if (abIsStrTag(abTag(ab)))
h = strHash(abLeafStr(ab));
else if (abHasTag(ab, AB_Define)) {
abHashArg(h, abHashSefo(ab->abDefine.lhs));
abHashArg(h, abHashSefo(ab->abDefine.rhs));
}
else if (abTag(ab) == AB_Lambda) {
abHashArg(h, abHashSefo(ab->abLambda.param));
abHashArg(h, abHashSefo(ab->abLambda.rtype));
}
else
for (i = 0; i < abArgc(ab); i++)
abHashArg(h, abHashSefo(abArgv(ab)[i]));

h += abInfo(abTag(ab)).hash;
h &= 0x3FFFFFFF;
return h;
}

Hash
abHash(AbSyn ab)
{
Expand Down Expand Up @@ -1625,6 +1681,7 @@ abTransferSemantics(AbSyn from, AbSyn to)
abSetImplicit(to, abImplicit(from));
abSetTContext(to, abTContext(from));
abSetDefineIdx(to, abDefineIdx(from));
abSetSelf(to, abSelf(from));
}

switch (abState(from)) {
Expand Down Expand Up @@ -1669,6 +1726,7 @@ abNewSemantics(void)
as->embed = 0;
as->defnIdx = -1;
as->impl = NULL;
as->self = listNil(Syme);

return as;
}
Expand Down Expand Up @@ -1709,6 +1767,17 @@ abSetSyme(AbSyn ab, Syme syme)
return syme;
}

void
abSetSelf(AbSyn ab, SymeList symes)
{
/* scobind may hand this a 0 ab */
if (ab) {
if (! ab->abHdr.seman)
ab->abHdr.seman = abNewSemantics();
ab->abHdr.seman->self = symes;
}
}

void
abSetDefineIdx(AbSyn ab, int idx)
{
Expand Down
7 changes: 7 additions & 0 deletions aldor/aldor/src/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ struct abSeman {
AbSyn implicit; /* Implicit operator on expression. */
AbEmbed embed; /* Implicit embedding for product contexts. */
SImpl impl; /* Syme implementation, if any */
SymeList self; /* value of '%' for withs */
};

typedef struct abSeman *AbSeman;
Expand Down Expand Up @@ -870,6 +871,7 @@ extern struct ab_info abInfoTable[];
# define abTContext(a) ((a)->abHdr.seman ? (a)->abHdr.seman->embed : 0)
# define abDefineIdx(a) ((a)->abHdr.seman ? (a)->abHdr.seman->defnIdx : -1)
# define abSymeImpl(a) ((a)->abHdr.seman ? (a)->abHdr.seman->impl : 0)
# define abSelf(a) ((a)->abHdr.seman ? (a)->abHdr.seman->self : 0)

# define abRepeatIterc(a) (abArgc(a)-1) /* -1 for body */
# define abCollectIterc(a)(abArgc(a)-1) /* -1 for body */
Expand Down Expand Up @@ -943,13 +945,17 @@ extern AbSyn abNewOfList (AbSynTag t, SrcPos, AbSynList);
extern AbSyn abNewOfOpAndList (AbSynTag t, SrcPos,AbSyn op,AbSynList);
extern AbSyn abNewOfToken (AbSynTag t, Token);

extern AbSyn abNewAndAll (SrcPos, AbSynList);
extern AbSyn abNewOrAll (SrcPos, AbSynList);

extern AbSyn abCopy (AbSyn);
extern AbSyn abReposition (AbSyn, SrcPos pos, SrcPos end);
extern AbSyn abMarkAsMacroExpanded (AbSyn);
extern Bool abContains (AbSyn, AbSyn);
extern Bool abEqual (AbSyn, AbSyn);
extern Bool abEqualModDeclares (AbSyn, AbSyn);
extern Hash abHash (AbSyn);
extern Hash abHashSefo (AbSyn);
extern Hash abHashList (AbSynList);
extern Hash abHashModDeclares (AbSyn);
extern void abSubSymbol (AbSyn, Symbol, Symbol);
Expand All @@ -976,6 +982,7 @@ extern AbSeman abNewSemantics (void);
extern Doc abSetComment (AbSyn, Doc);
extern Stab abSetStab (AbSyn, Stab);
extern Syme abSetSyme (AbSyn, Syme);
extern void abSetSelf (AbSyn, SymeList);
extern TForm abSetTForm (AbSyn, TForm);
extern AbSyn abSetImplicit (AbSyn, AbSyn);
extern AbEmbed abSetTContext (AbSyn, AbEmbed);
Expand Down
2 changes: 0 additions & 2 deletions aldor/aldor/src/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,6 @@ cmdDoOptDeveloper(String arg)
NoWhereHack = true;
else if (strAEqual("runtime-hashcheck", arg))
genSetHashcheck();
else if (strAEqual("old-hcodes", arg))
genResetNewHashCodes();
else if (strAIsPrefix("keyword", arg)) {
String darg = cmdDGetOptArg(arg, "keyword", NULL);
cmdDoKeywordStatus(darg, true);
Expand Down
Loading