Skip to content

Commit

Permalink
New construction ["foo",...].(expr).
Browse files Browse the repository at this point in the history
Creates an additional input to expr to modulate widget("foo")
  • Loading branch information
orlarey committed Nov 1, 2023
1 parent 5ec31f8 commit eb1cb57
Show file tree
Hide file tree
Showing 23 changed files with 3,950 additions and 3,742 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: true
Expand Down Expand Up @@ -50,7 +50,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand Down
23 changes: 23 additions & 0 deletions compiler/boxes/boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ Tree boxAbstr(Tree x, Tree y)
{
return tree(gGlobal->BOXABSTR, x, y);
}
Tree boxModulation(Tree x, Tree y)
{
return tree(gGlobal->BOXMODULATION, x, y);
}
Tree boxAppl(Tree x, Tree y)
{
return tree(gGlobal->BOXAPPL, x, y);
Expand All @@ -310,6 +314,11 @@ LIBFAUST_API bool isBoxAbstr(Tree t)
{
return t->node() == Node(gGlobal->BOXABSTR);
}

LIBFAUST_API bool isBoxModulation(Tree t)
{
return t->node() == Node(gGlobal->BOXMODULATION);
}
LIBFAUST_API bool isBoxAppl(Tree t)
{
return t->node() == Node(gGlobal->BOXAPPL);
Expand All @@ -319,6 +328,11 @@ LIBFAUST_API bool isBoxAbstr(Tree t, Tree& x, Tree& y)
{
return isTree(t, gGlobal->BOXABSTR, x, y);
}

LIBFAUST_API bool isBoxModulation(Tree t, Tree& x, Tree& y)
{
return isTree(t, gGlobal->BOXMODULATION, x, y);
}
LIBFAUST_API bool isBoxAppl(Tree t, Tree& x, Tree& y)
{
return isTree(t, gGlobal->BOXAPPL, x, y);
Expand All @@ -333,6 +347,15 @@ Tree buildBoxAbstr(Tree largs, Tree body)
}
}

Tree buildBoxModulation(Tree largs, Tree body)
{
if (isNil(largs)) {
return body;
} else {
return buildBoxModulation(tl(largs), boxModulation(hd(largs), body));
}
}

#if 0
Tree buildBoxAppl(Tree fun, Tree revarglist)
{
Expand Down
30 changes: 18 additions & 12 deletions compiler/boxes/boxes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ box ::= i | f | p0 | p1 | p3

#include "tlib.hh"

namespace PM { struct Automaton; }
namespace PM {
struct Automaton;
}

/*****************************************************************************
******************************************************************************
Expand All @@ -55,7 +57,7 @@ namespace PM { struct Automaton; }
Identifiers
*****************************************************************************/

Tree boxIdent(const char* name);
Tree boxIdent(const char* name);
LIBFAUST_API bool isBoxIdent(Tree t);
LIBFAUST_API bool isBoxIdent(Tree t, const char** name);

Expand Down Expand Up @@ -159,45 +161,49 @@ LIBFAUST_API bool isBoxOutputs(Tree t, Tree& x);
*****************************************************************************/

Tree buildBoxAbstr(Tree x, Tree y);
Tree buildBoxModulation(Tree x, Tree y);
Tree buildBoxAppl(Tree x, Tree y);

Tree boxAbstr(Tree x, Tree y);
Tree boxModulation(Tree x, Tree y);
Tree boxAppl(Tree x, Tree y);

LIBFAUST_API bool isBoxAbstr(Tree t);
LIBFAUST_API bool isBoxModulation(Tree t);
LIBFAUST_API bool isBoxAppl(Tree t);

LIBFAUST_API bool isBoxAbstr(Tree t, Tree& x, Tree& y);
LIBFAUST_API bool isBoxModulation(Tree t, Tree& x, Tree& y);
LIBFAUST_API bool isBoxAppl(Tree t, Tree& x, Tree& y);

Tree closure(Tree abstr, Tree genv, Tree vis, Tree lenv);

bool isClosure(Tree t, Tree& abstr, Tree& genv, Tree& vis, Tree& lenv);

// for foo(x,y).faa expressions
Tree boxAccess(Tree exp, Tree id);
Tree boxAccess(Tree exp, Tree id);
LIBFAUST_API bool isBoxAccess(Tree t, Tree& exp, Tree& id);

/*****************************************************************************
Boxes with local definitions
*****************************************************************************/

Tree boxWithLocalDef(Tree body, Tree ldef);
Tree boxWithLocalDef(Tree body, Tree ldef);
LIBFAUST_API bool isBoxWithLocalDef(Tree t, Tree& body, Tree& ldef);
Tree boxWithRecDef(Tree body, Tree ldef, Tree ldef2);
Tree boxWithRecDef(Tree body, Tree ldef, Tree ldef2);

/*****************************************************************************
Modification of local definitions
*****************************************************************************/

Tree boxModifLocalDef(Tree body, Tree ldef);
Tree boxModifLocalDef(Tree body, Tree ldef);
LIBFAUST_API bool isBoxModifLocalDef(Tree t, Tree& body, Tree& ldef);

/*****************************************************************************
Error Box
*****************************************************************************/

Tree boxError();
Tree boxError();
LIBFAUST_API bool isBoxError(Tree t);

/*****************************************************************************
Expand Down Expand Up @@ -252,13 +258,13 @@ LIBFAUST_API bool isBoxFVar(Tree s, Tree& type, Tree& name, Tree& file);
Modules
*****************************************************************************/

Tree boxEnvironment();
Tree boxEnvironment();
LIBFAUST_API bool isBoxEnvironment(Tree s);

Tree boxComponent(Tree filename);
Tree boxComponent(Tree filename);
LIBFAUST_API bool isBoxComponent(Tree s, Tree& filename);

Tree boxLibrary(Tree filename);
Tree boxLibrary(Tree filename);
LIBFAUST_API bool isBoxLibrary(Tree s, Tree& filename);

Tree importFile(Tree filename);
Expand Down Expand Up @@ -318,7 +324,7 @@ LIBFAUST_API bool isBoxSoundfile(Tree s, Tree& label, Tree& chan);
/*****************************************************************************
Case (pattern matching)
*****************************************************************************/
Tree boxCase(Tree rules);
Tree boxCase(Tree rules);
LIBFAUST_API bool isBoxCase(Tree s);
LIBFAUST_API bool isBoxCase(Tree s, Tree& rules);

Expand All @@ -333,7 +339,7 @@ bool isBoxPatternVar(Tree s, Tree& id);
/*****************************************************************************
Metadata (pattern matching)
*****************************************************************************/
Tree boxMetadata(Tree exp, Tree mdlist);
Tree boxMetadata(Tree exp, Tree mdlist);
LIBFAUST_API bool isBoxMetadata(Tree s, Tree& exp, Tree& mdlist);

/*****************************************************************************
Expand Down
Loading

0 comments on commit eb1cb57

Please sign in to comment.