|
FAUST compiler
0.9.9.6b8
|
#include "uitree.hh"
Go to the source code of this file.
Defines | |
| #define | ERROR(s, t) error(s,t); exit(1) |
Functions | |
| static Tree | makeSubFolderChain (Tree path, Tree elem) |
| static Tree | putFolder (Tree folder, Tree item) |
| static Tree | getFolder (Tree folder, Tree ilabel) |
| static void | error (const char *s, Tree t) |
| static bool | isBefore (Tree k1, Tree k2) |
| static bool | findKey (Tree pl, Tree key, Tree &val) |
| static Tree | updateKey (Tree pl, Tree key, Tree val) |
| static Tree | addKey (Tree pl, Tree key, Tree val) |
| Like updateKey but allow multiple items with same key. | |
| Tree | uiFolder (Tree label, Tree elements) |
| bool | isUiFolder (Tree t) |
| bool | isUiFolder (Tree t, Tree &label, Tree &elements) |
| Tree | uiWidget (Tree label, Tree varname, Tree sig) |
| bool | isUiWidget (Tree t, Tree &label, Tree &varname, Tree &sig) |
| Tree | addToFolder (Tree folder, Tree item) |
| Tree | putSubFolder (Tree folder, Tree path, Tree item) |
Variables | |
| Sym | UIFOLDER = symbol ("uiFolder") |
| Sym | UIWIDGET = symbol ("uiWidget") |
Definition at line 38 of file uitree.cpp.
Referenced by isBefore().
Like updateKey but allow multiple items with same key.
Definition at line 111 of file uitree.cpp.
References cons(), hd(), isBefore(), isNil(), left(), nil, and tl().
Referenced by addToFolder().
{
if (isNil(pl)) return cons ( cons(key,val), nil );
if (isBefore(key, left(hd(pl)))) return cons(cons(key,val), pl);
return cons ( hd(pl), addKey( tl(pl), key, val ));
}


| Tree addToFolder | ( | Tree | folder, |
| Tree | item | ||
| ) |
Definition at line 155 of file uitree.cpp.
References addKey(), isUiFolder(), uiFolder(), and uiLabel().
Referenced by putSubFolder().
{
Tree label, content;
if ( ! isUiFolder(folder, label, content)) { fprintf(stderr, "ERROR in addFolder : not a folder\n"); }
return uiFolder(label, addKey(content, uiLabel(item), item));
}


Definition at line 33 of file uitree.cpp.
{
fprintf(stderr, "ERROR : %s (%p)\n", s, t);
}
Definition at line 92 of file uitree.cpp.
References hd(), isBefore(), isNil(), left(), right(), and tl().
Referenced by getFolder().
{
if (isNil(pl)) return false;
if (left(hd(pl)) == key) { val = right(hd(pl)); return true; }
if (isBefore(left(hd(pl)),key)) return findKey (tl(pl), key, val);
return false;
}


Definition at line 164 of file uitree.cpp.
References findKey(), isUiFolder(), and nil.
Referenced by putSubFolder().
{
Tree flabel, content, item;
if (!isUiFolder(folder, flabel, content)) { fprintf(stderr, "ERROR in getFolder : not a folder\n"); }
if (findKey(content, ilabel, item)) {
return item;
} else {
return nil;
}
}


Definition at line 72 of file uitree.cpp.
References ERROR, isList(), isSym(), name(), CTree::node(), and tl().
Referenced by addKey(), findKey(), and updateKey().
{
// before comparing replace (type . label) by label
if (isList(k1)) { k1 = tl(k1); }
if (isList(k2)) { k2 = tl(k2); }
//fprintf(stderr, "isBefore("); print(k1, stderr); fprintf(stderr,", "); print(k2, stderr); fprintf(stderr,")\n");
Sym s1, s2;
if (!isSym(k1->node(), &s1)) {
ERROR("the node of the tree is not a symbol", k1);
}
if (!isSym(k2->node(), &s2)) {
ERROR("the node of the tree is not a symbol", k2);
}
//fprintf (stderr, "strcmp(\"%s\", \"%s\") = %d\n", name(s1), name(s2), strcmp(name(s1), name(s2)));
return strcmp(name(s1), name(s2)) < 0;
}


| bool isUiFolder | ( | Tree | t | ) |
Definition at line 136 of file uitree.cpp.
References isTree().
Referenced by Description::addGroup(), addToFolder(), Compiler::generateMacroInterfaceTree(), Compiler::generateUserInterfaceTree(), getFolder(), Compiler::prepareUserInterfaceTree(), putFolder(), and putSubFolder().


| bool isUiFolder | ( | Tree | t, |
| Tree & | label, | ||
| Tree & | elements | ||
| ) |
Definition at line 137 of file uitree.cpp.
References isTree().

| bool isUiWidget | ( | Tree | t, |
| Tree & | label, | ||
| Tree & | varname, | ||
| Tree & | sig | ||
| ) |
Definition at line 141 of file uitree.cpp.
References isTree().
Referenced by Description::addGroup(), Compiler::generateMacroInterfaceTree(), and Compiler::generateUserInterfaceTree().


| Tree makeSubFolderChain | ( | Tree | path, |
| Tree | elem | ||
| ) | [static] |
Definition at line 176 of file uitree.cpp.
References hd(), isNil(), putFolder(), tl(), and uiFolder().
Referenced by putSubFolder().
{
if (isNil(path)) {
return elem;
} else {
return putFolder(uiFolder(hd(path)), makeSubFolderChain(tl(path),elem));
}
}


Definition at line 146 of file uitree.cpp.
References isUiFolder(), uiFolder(), uiLabel(), and updateKey().
Referenced by makeSubFolderChain(), and putSubFolder().
{
Tree label, content;
if ( ! isUiFolder(folder, label, content)) { fprintf(stderr, "ERROR in addFolder : not a folder\n"); }
return uiFolder(label, updateKey(content, uiLabel(item), item));
}


| Tree putSubFolder | ( | Tree | folder, |
| Tree | path, | ||
| Tree | item | ||
| ) |
Definition at line 186 of file uitree.cpp.
References addToFolder(), getFolder(), hd(), isNil(), isUiFolder(), makeSubFolderChain(), putFolder(), putSubFolder(), and tl().
Referenced by Compiler::addUIWidget(), and putSubFolder().
{
if (isNil(path)) {
//return putFolder(folder, item);
return addToFolder(folder, item);
} else {
Tree subfolder = getFolder(folder, hd(path));
if (isUiFolder(subfolder)) {
return putFolder(folder, putSubFolder(subfolder, tl(path), item));
} else {
return putFolder(folder, makeSubFolderChain(path, item));
}
}
}


Definition at line 135 of file uitree.cpp.
References tree().
Referenced by addToFolder(), makeSubFolderChain(), and putFolder().


Definition at line 140 of file uitree.cpp.
References tree().
Referenced by ScalarCompiler::generateButton(), ScalarCompiler::generateCheckbox(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generateVBargraph(), and ScalarCompiler::generateVSlider().


Definition at line 100 of file uitree.cpp.
References cons(), hd(), isBefore(), isNil(), left(), nil, and tl().
Referenced by putFolder().
{
if (isNil(pl)) return cons ( cons(key,val), nil );
if (left(hd(pl)) == key) return cons ( cons(key,val), tl(pl) );
if (isBefore(left(hd(pl)),key)) return cons ( hd(pl), updateKey( tl(pl), key, val ));
return cons(cons(key,val), pl);
}


Definition at line 134 of file uitree.cpp.
Definition at line 139 of file uitree.cpp.
1.8.0