コード例 #1
0
ファイル: doc_compile.cpp プロジェクト: EBone/Faust
/**
 * @brief Main code generator dispatch.
 *
 * According to the type of the input signal, generateCode calls
 * the appropriate generator with appropriate arguments.
 *
 * @param	sig			The signal expression to compile.
 * @param	priority	The environment priority of the expression.
 * @return	<string>	The LaTeX code translation of the signal.
 */
string DocCompiler::generateCode (Tree sig, int priority)
{
	int 	i;
	double	r;
    Tree 	c, sel, x, y, z, u, label, ff, largs, type, name, file;
	
	if ( getUserData(sig) )							{ printGCCall(sig,"generateXtended");	return generateXtended	(sig, priority);		}
	else if ( isSigInt(sig, &i) ) 					{ printGCCall(sig,"generateNumber");	return generateNumber	(sig, docT(i));			}
	else if ( isSigReal(sig, &r) ) 					{ printGCCall(sig,"generateNumber");	return generateNumber	(sig, docT(r));			}
	else if ( isSigInput(sig, &i) ) 				{ printGCCall(sig,"generateInput");		return generateInput	(sig, docT(i+1)); 		}
	else if ( isSigOutput(sig, &i, x) ) 			{ printGCCall(sig,"generateOutput");	return generateOutput	(sig, docT(i+1), CS(x, priority));	}
	
	else if ( isSigFixDelay(sig, x, y) ) 			{ printGCCall(sig,"generateFixDelay");	return generateFixDelay	(sig, x, y, priority); 	}
	else if ( isSigPrefix(sig, x, y) ) 				{ printGCCall(sig,"generatePrefix");	return generatePrefix	(sig, x, y, priority); 	}
	else if ( isSigIota(sig, x) ) 					{ printGCCall(sig,"generateIota");		return generateIota 	(sig, x); 				}
	
	else if ( isSigBinOp(sig, &i, x, y) )			{ printGCCall(sig,"generateBinOp");		return generateBinOp	(sig, i, x, y, priority); 		}
	else if ( isSigFFun(sig, ff, largs) )			{ printGCCall(sig,"generateFFun");		return generateFFun 	(sig, ff, largs, priority); 	}
    else if ( isSigFConst(sig, type, name, file) )  { printGCCall(sig,"generateFConst");	return generateFConst	(sig, tree2str(file), tree2str(name)); }
    else if ( isSigFVar(sig, type, name, file) )    { printGCCall(sig,"generateFVar");		return generateFVar		(sig, tree2str(file), tree2str(name)); }
	
    // new special tables for documentation purposes

    else if ( isSigDocConstantTbl(sig, x, y) )      { printGCCall(sig,"generateDocConstantTbl");    return generateDocConstantTbl (sig, x, y);	}
    else if ( isSigDocWriteTbl(sig,x,y,z,u) )       { printGCCall(sig,"generateDocWriteTbl");       return generateDocWriteTbl (sig, x, y, z, u); }
    else if ( isSigDocAccessTbl(sig, x, y) )        { printGCCall(sig, "generateDocAccessTbl");     return generateDocAccessTbl(sig, x, y); }


	else if ( isSigSelect2(sig, sel, x, y) ) 		{ printGCCall(sig,"generateSelect2");	return generateSelect2 	(sig, sel, x, y, priority); 	}
	else if ( isSigSelect3(sig, sel, x, y, z) ) 	{ printGCCall(sig,"generateSelect3");	return generateSelect3 	(sig, sel, x, y, z, priority); 	}
	
    else if ( isProj(sig, &i, x) )                  { printGCCall(sig,"generateRecProj");	return generateRecProj	(sig, x, i, priority);	}
	
	else if ( isSigIntCast(sig, x) ) 				{ printGCCall(sig,"generateIntCast");	return generateIntCast	(sig, x, priority); 	}
	else if ( isSigFloatCast(sig, x) ) 				{ printGCCall(sig,"generateFloatCast");	return generateFloatCast(sig, x, priority); 	}
	
	else if ( isSigButton(sig, label) ) 			{ printGCCall(sig,"generateButton");	return generateButton   (sig, label); 			}
	else if ( isSigCheckbox(sig, label) ) 			{ printGCCall(sig,"generateCheckbox");	return generateCheckbox (sig, label); 			}
	else if ( isSigVSlider(sig, label,c,x,y,z) )	{ printGCCall(sig,"generateVSlider");	return generateVSlider 	(sig, label, c,x,y,z);	}
	else if ( isSigHSlider(sig, label,c,x,y,z) )	{ printGCCall(sig,"generateHSlider");	return generateHSlider 	(sig, label, c,x,y,z);	}
	else if ( isSigNumEntry(sig, label,c,x,y,z) )	{ printGCCall(sig,"generateNumEntry");	return generateNumEntry (sig, label, c,x,y,z);	}
	
	else if ( isSigVBargraph(sig, label,x,y,z) )	{ printGCCall(sig,"generateVBargraph");	return CS(z, priority);}//generateVBargraph 	(sig, label, x, y, CS(z, priority)); }
	else if ( isSigHBargraph(sig, label,x,y,z) )	{ printGCCall(sig,"generateHBargraph");	return CS(z, priority);}//generateHBargraph 	(sig, label, x, y, CS(z, priority)); }
    else if ( isSigAttach(sig, x, y) )				{ printGCCall(sig,"generateAttach");	return generateAttach	(sig, x, y, priority); }
    else if ( isSigEnable(sig, x, y) )				{ printGCCall(sig,"generateEnable");      return generateEnable	(sig, x, y, priority); }

	else {
        stringstream error;
        error << "ERROR in d signal, unrecognized signal : " << *sig << endl;
        throw faustexception(error.str());
	}
    faustassert(0);
	return "error in generate code";
}
コード例 #2
0
ファイル: compile.cpp プロジェクト: harryhaaren/faust
/**
 * Generate user interface macros corresponding 
 * to a user interface widget
 */
void Compiler::generateWidgetMacro(const string& pathname, Tree fulllabel, Tree varname, Tree sig)
{
	Tree path, c, x, y, z;
    string label;
    map<string, set<string> >   metadata;

    extractMetadata(tree2str(fulllabel), label, metadata);

    //string pathlabel = pathname+unquote(label);
	string pathlabel = pathname+label;


	if ( isSigButton(sig, path) ) 					{
		fClass->addUIMacro(subst("FAUST_ADDBUTTON(\"$0\", $1);", pathlabel, tree2str(varname)));

	} else if ( isSigCheckbox(sig, path) ) 			{
		fClass->addUIMacro(subst("FAUST_ADDCHECKBOX(\"$0\", $1);", pathlabel, tree2str(varname)));

	} else if ( isSigVSlider(sig, path,c,x,y,z) )	{
		fClass->addUIMacro(subst("FAUST_ADDVERTICALSLIDER(\"$0\", $1, $2, $3, $4, $5);",
				pathlabel,
				tree2str(varname),
				T(tree2float(c)),
				T(tree2float(x)),
				T(tree2float(y)),
				T(tree2float(z))));

	} else if ( isSigHSlider(sig, path,c,x,y,z) )	{
		fClass->addUIMacro(subst("FAUST_ADDHORIZONTALSLIDER(\"$0\", $1, $2, $3, $4, $5);",
				pathlabel,
				tree2str(varname),
				T(tree2float(c)),
				T(tree2float(x)),
				T(tree2float(y)),
				T(tree2float(z))));

	} else if ( isSigNumEntry(sig, path,c,x,y,z) )	{
		fClass->addUIMacro(subst("FAUST_ADDNUMENTRY(\"$0\", $1, $2, $3, $4, $5);",
				pathlabel,
				tree2str(varname),
				T(tree2float(c)),
				T(tree2float(x)),
				T(tree2float(y)),
				T(tree2float(z))));

	} else if ( isSigVBargraph(sig, path,x,y,z) )	{
		fClass->addUIMacro(subst("FAUST_ADDVERTICALBARGRAPH(\"$0\", $1, $2, $3);",
				pathlabel,
				tree2str(varname),
				T(tree2float(x)),
				T(tree2float(y))));

	} else if ( isSigHBargraph(sig, path,x,y,z) )	{
		fClass->addUIMacro(subst("FAUST_ADDHORIZONTALBARGRAPH(\"$0\", $1, $2, $3);",
				pathlabel,
				tree2str(varname),
				T(tree2float(x)),
				T(tree2float(y))));

	} else {
		fprintf(stderr, "Error in generating widget code\n");
		exit(1);
	}
}
コード例 #3
0
ファイル: compile.cpp プロジェクト: harryhaaren/faust
/**
 * Generate buildUserInterface C++ lines of code corresponding 
 * to user interface widget t
 */
void Compiler::generateWidgetCode(Tree fulllabel, Tree varname, Tree sig)
{
	Tree path, c, x, y, z;
    string label;
    map<string, set<string> >   metadata;
   
    extractMetadata(tree2str(fulllabel), label, metadata);

    // add metadata if any
    for (map<string, set<string> >::iterator i = metadata.begin(); i != metadata.end(); i++) {
        const string& key = i->first;
        const set<string>& values = i->second;
        for (set<string>::const_iterator j = values.begin(); j != values.end(); j++) {
            fClass->addUICode(subst("interface->declare(&$0, \"$1\", \"$2\");", tree2str(varname), wdel(key), wdel(*j)));
             fJSON.declare(NULL, wdel(key).c_str(), wdel(*j).c_str());
        }
    }

	if ( isSigButton(sig, path) ) 					{
        fClass->incUIActiveCount();
		fClass->addUICode(subst("interface->addButton(\"$0\", &$1);", checkNullLabel(varname, label), tree2str(varname)));
        fJSON.addButton(checkNullLabel(varname, label).c_str(), NULL);

	} else if ( isSigCheckbox(sig, path) ) 			{
        fClass->incUIActiveCount();
		fClass->addUICode(subst("interface->addCheckButton(\"$0\", &$1);", checkNullLabel(varname, label), tree2str(varname)));
        fJSON.addCheckButton(checkNullLabel(varname, label).c_str(), NULL);

	} else if ( isSigVSlider(sig, path,c,x,y,z) )	{
        fClass->incUIActiveCount();
		fClass->addUICode(subst("interface->addVerticalSlider(\"$0\", &$1, $2, $3, $4, $5);",
                                checkNullLabel(varname, label),
                                tree2str(varname),
                                T(tree2float(c)),
                                T(tree2float(x)),
                                T(tree2float(y)),
                                T(tree2float(z))));
        fJSON.addVerticalSlider(checkNullLabel(varname, label).c_str(), NULL, tree2float(c), tree2float(x), tree2float(y), tree2float(z));

	} else if ( isSigHSlider(sig, path,c,x,y,z) )	{
        fClass->incUIActiveCount();
		fClass->addUICode(subst("interface->addHorizontalSlider(\"$0\", &$1, $2, $3, $4, $5);",
                                checkNullLabel(varname, label),
                                tree2str(varname),
                                T(tree2float(c)),
                                T(tree2float(x)),
                                T(tree2float(y)),
                                T(tree2float(z))));
        fJSON.addHorizontalSlider(checkNullLabel(varname, label).c_str(), NULL, tree2float(c), tree2float(x), tree2float(y), tree2float(z));

	} else if ( isSigNumEntry(sig, path,c,x,y,z) )	{
        fClass->incUIActiveCount();
		fClass->addUICode(subst("interface->addNumEntry(\"$0\", &$1, $2, $3, $4, $5);",
                                checkNullLabel(varname, label),
                                tree2str(varname),
                                T(tree2float(c)),
                                T(tree2float(x)),
                                T(tree2float(y)),
                                T(tree2float(z))));
        fJSON.addNumEntry(checkNullLabel(varname, label).c_str(), NULL, tree2float(c), tree2float(x), tree2float(y), tree2float(z));

	} else if ( isSigVBargraph(sig, path,x,y,z) )	{
        fClass->incUIPassiveCount();
		fClass->addUICode(subst("interface->addVerticalBargraph(\"$0\", &$1, $2, $3);",
                                checkNullLabel(varname, label, true),
                                tree2str(varname),
                                T(tree2float(x)),
                                T(tree2float(y))));
        fJSON.addVerticalBargraph(checkNullLabel(varname, label).c_str(), NULL, tree2float(x), tree2float(y));

	} else if ( isSigHBargraph(sig, path,x,y,z) )	{
        fClass->incUIPassiveCount();
		fClass->addUICode(subst("interface->addHorizontalBargraph(\"$0\", &$1, $2, $3);",
                                checkNullLabel(varname, label, true),
                                tree2str(varname),
                                T(tree2float(x)),
                                T(tree2float(y))));
        fJSON.addHorizontalBargraph(checkNullLabel(varname, label).c_str(), NULL, tree2float(x), tree2float(y));
        
	} else {
		fprintf(stderr, "Error in generating widget code\n");
		exit(1);
	}
}
コード例 #4
0
ファイル: ppsig.cpp プロジェクト: kitchenSinkCollection/faust
ostream& ppsig::print (ostream& fout) const
{
    int 	i;
    double	r;
    Tree 	c, sel, x, y, z, u, var, le, label, id, ff, largs, type, name, file;

    if ( isList(sig) ) 						{
        printlist(fout, sig);
    }
    else if ( isProj(sig, &i, x) ) 					{
        fout << "proj" << i << '(' << ppsig(x, fEnv) << ')';
    }
    else if ( isRec(sig, var, le) )					{
        printrec(fout, var, le, fHideRecursion /*&& (getRecursivness(sig)==0)*/ );
    }

    // debruinj notation
    else if ( isRec(sig, le) )						{
        printrec(fout, le, fHideRecursion );
    }
    else if ( isRef(sig, i) )						{
        fout << "REF[" << i << "]";
    }

    else if ( getUserData(sig) ) 					{
        printextended(fout, sig);
    }
    else if ( isSigInt(sig, &i) ) 					{
        fout << i;
    }
    else if ( isSigReal(sig, &r) ) 					{
        fout << T(r);
    }
    else if ( isSigWaveform(sig) )                  {
        fout << "waveform{...}";
    }
    else if ( isSigInput(sig, &i) ) 				{
        fout << "IN[" << i << "]";
    }
    else if ( isSigOutput(sig, &i, x) ) 			{
        printout(fout, i, x) ;
    }

    else if ( isSigDelay1(sig, x) ) 				{
        fout << ppsig(x, fEnv, 9) << "'";
    }
    //else if ( isSigFixDelay(sig, x, y) ) 			{ printinfix(fout, "@", 8, x, y); 	}
    else if ( isSigFixDelay(sig, x, y) ) 			{
        printFixDelay(fout, x, y);
    }
    else if ( isSigPrefix(sig, x, y) ) 				{
        printfun(fout, "prefix", x, y);
    }
    else if ( isSigIota(sig, x) ) 					{
        printfun(fout, "iota", x);
    }
    else if ( isSigBinOp(sig, &i, x, y) )			{
        printinfix(fout, gBinOpTable[i]->fName, gBinOpTable[i]->fPriority, x, y);
    }
    else if ( isSigFFun(sig, ff, largs) )			{
        printff(fout, ff, largs);
    }
    else if ( isSigFConst(sig, type, name, file) )  {
        fout << tree2str(name);
    }
    else if ( isSigFVar(sig, type, name, file) )    {
        fout << tree2str(name);
    }

    else if ( isSigTable(sig, id, x, y) ) 			{
        printfun(fout, "TABLE", x, y);
    }
    else if ( isSigWRTbl(sig, id, x, y, z) )		{
        printfun(fout, "write", x, y, z);
    }
    else if ( isSigRDTbl(sig, x, y) )				{
        printfun(fout, "read", x, y);
    }
    else if ( isSigGen(sig, x) ) 					{
        fout << ppsig(x, fEnv, fPriority);
    }

    else if ( isSigDocConstantTbl(sig, x, y) )      {
        printfun(fout, "docConstantTbl", x, y);
    }
    else if ( isSigDocWriteTbl(sig, x, y, z, u) )   {
        printfun(fout, "docWriteTbl", x, y, z, u);
    }
    else if ( isSigDocAccessTbl(sig, x, y) )        {
        printfun(fout, "docAccessTbl", x, y);
    }

    else if ( isSigSelect2(sig, sel, x, y) ) 		{
        printfun(fout, "select2", sel, x, y);
    }
    else if ( isSigSelect3(sig, sel, x, y, z) ) 	{
        printfun(fout, "select3", sel, x, y, z);
    }

    else if ( isSigIntCast(sig, x) ) 				{
        printfun(fout, "int", x);
    }
    else if ( isSigFloatCast(sig, x) )				{
        printfun(fout, "float", x);
    }

    else if ( isSigButton(sig, label) ) 			{
        printui(fout, "button", label);
    }
    else if ( isSigCheckbox(sig, label) ) 			{
        printui(fout, "checkbox", label);
    }
    else if ( isSigVSlider(sig, label,c,x,y,z) )	{
        printui(fout, "vslider", label, c, x, y, z);
    }
    else if ( isSigHSlider(sig, label,c,x,y,z) )	{
        printui(fout, "hslider", label, c, x, y, z);
    }
    else if ( isSigNumEntry(sig, label,c,x,y,z) )	{
        printui(fout, "nentry", label, c, x, y, z);
    }
    else if ( isSigVBargraph(sig, label,x,y,z) )	{
        printui(fout, "vbargraph", label, x, y, z);
    }
    else if ( isSigHBargraph(sig, label,x,y,z) )	{
        printui(fout, "hbargraph", label, x, y, z);
    }
    else if ( isSigAttach(sig, x, y) )				{
        printfun(fout, "attach", x, y);
    }

    else {
        cerr << "NOT A SIGNAL : " << *sig << endl;
        //exit(1);
    }
    return fout;
}
コード例 #5
0
ファイル: description.cpp プロジェクト: Ace17/faust
int Description::addWidget(Tree label, Tree varname, Tree sig)
{
  Tree path, c, x, y, z;

  // add an active widget description

  if(isSigButton(sig, path))
  {
    fWidgetID++;
    fActiveWidgetCount++;
    addActiveLine(subst("<widget type=\"button\" id=\"$0\">", T(fWidgetID)));
    addActiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addActiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addActiveLine("</widget>");
  }
  else if(isSigCheckbox(sig, path))
  {
    fWidgetID++;
    fActiveWidgetCount++;
    addActiveLine(subst("<widget type=\"checkbox\" id=\"$0\">", T(fWidgetID)));
    addActiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addActiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addActiveLine("</widget>");
  }
  else if(isSigVSlider(sig, path, c, x, y, z))
  {
    fWidgetID++;
    fActiveWidgetCount++;
    addActiveLine(subst("<widget type=\"vslider\" id=\"$0\">", T(fWidgetID)));
    addActiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addActiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addActiveLine(subst("\t<init>$0</init>", T(tree2double(c))));
    addActiveLine(subst("\t<min>$0</min>", T(tree2double(x))));
    addActiveLine(subst("\t<max>$0</max>", T(tree2double(y))));
    addActiveLine(subst("\t<step>$0</step>", T(tree2double(z))));
    addActiveLine("</widget>");
  }
  else if(isSigHSlider(sig, path, c, x, y, z))
  {
    fWidgetID++;
    fActiveWidgetCount++;
    addActiveLine(subst("<widget type=\"hslider\" id=\"$0\">", T(fWidgetID)));
    addActiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addActiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addActiveLine(subst("\t<init>$0</init>", T(tree2double(c))));
    addActiveLine(subst("\t<min>$0</min>", T(tree2double(x))));
    addActiveLine(subst("\t<max>$0</max>", T(tree2double(y))));
    addActiveLine(subst("\t<step>$0</step>", T(tree2double(z))));
    addActiveLine("</widget>");
  }
  else if(isSigNumEntry(sig, path, c, x, y, z))
  {
    fWidgetID++;
    fActiveWidgetCount++;
    addActiveLine(subst("<widget type=\"nentry\" id=\"$0\">", T(fWidgetID)));
    addActiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addActiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addActiveLine(subst("\t<init>$0</init>", T(tree2double(c))));
    addActiveLine(subst("\t<min>$0</min>", T(tree2double(x))));
    addActiveLine(subst("\t<max>$0</max>", T(tree2double(y))));
    addActiveLine(subst("\t<step>$0</step>", T(tree2double(z))));
    addActiveLine("</widget>");

    // add a passive widget description
  }
  else if(isSigVBargraph(sig, path, x, y, z))
  {
    fWidgetID++;
    fPassiveWidgetCount++;
    addPassiveLine(subst("<widget type=\"vbargraph\" id=\"$0\">", T(fWidgetID)));
    addPassiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addPassiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addPassiveLine(subst("\t<min>$0</min>", T(tree2double(x))));
    addPassiveLine(subst("\t<max>$0</max>", T(tree2double(y))));
    addPassiveLine("</widget>");
  }
  else if(isSigHBargraph(sig, path, x, y, z))
  {
    fWidgetID++;
    fPassiveWidgetCount++;
    addPassiveLine(subst("<widget type=\"hbargraph\" id=\"$0\">", T(fWidgetID)));
    addPassiveLine(subst("\t<label>$0</label>", checkNullLabel(sig, xmlize(tree2str(label)), true)));
    addPassiveLine(subst("\t<varname>$0</varname>", tree2str(varname)));
    addPassiveLine(subst("\t<min>$0</min>", T(tree2double(x))));
    addPassiveLine(subst("\t<max>$0</max>", T(tree2double(y))));
    addPassiveLine("</widget>");
  }
  else
  {
    fprintf(stderr, "Error describing widget : unrecognized expression\n");
    exit(1);
  }

  return fWidgetID;
}
コード例 #6
0
/**
 * Infere the order of a term according to its components
 * @param sig the signal to analyze
 * @return the order of sig 
 */
static int infereSigOrder(Tree sig)
{
	int 		i;
	double 		r;
    Tree		sel, s1, s2, s3, s4, ff, id, ls, l, x, y, var, body, type, name, file;

	xtended* xt = (xtended*) getUserData(sig);
	// primitive elements
	if (xt) 								
	{
		//return 3;
		vector<int> args;
		for (int i=0; i<sig->arity(); i++) { args.push_back( O(sig->branch(i)) ); }
		return xt->infereSigOrder(args);
	}

	
	else if (isSigInt(sig, &i))					return 0;
		
	else if (isSigReal(sig, &r)) 				return 0;
		
	else if (isSigInput(sig, &i))				return 3;
		
	else if (isSigOutput(sig, &i, s1)) 			return 3;
		
	else if (isSigDelay1(sig, s1)) 				return 3;
	
	else if (isSigPrefix(sig, s1, s2)) 			return 3;
	
	else if (isSigFixDelay(sig, s1, s2)) 		return 3;
	
	else if (isSigBinOp(sig, &i, s1, s2)) 		return max(O(s1),O(s2));
	
	else if (isSigIntCast(sig, s1))				return O(s1);
        
    else if (isSigFloatCast(sig, s1))           return O(s1);

    else if (isSigFFun(sig,ff,ls) && isNil(ls)) return 1;

    else if (isSigFFun(sig, ff, ls))            return max(1,O(ls));

    else if (isSigFConst(sig,type,name,file))   return 1;

    else if (isSigFVar(sig,type,name,file))     return 2;
		
	else if (isSigButton(sig)) 					return 2;
	
	else if (isSigCheckbox(sig))				return 2;
	
	else if (isSigVSlider(sig))					return 2;
	 
	else if (isSigHSlider(sig))					return 2;
	
	else if (isSigNumEntry(sig))				return 2;
		
	else if (isSigHBargraph(sig, l, x, y, s1)) 	return O(s1);
		
	else if (isSigVBargraph(sig, l, x, y, s1)) 	return O(s1);
		
	else if (isSigAttach(sig, s1, s2)) 			return O(s1);
				
	else if (isRec(sig, var, body))				exit(1); //return 3;  // not supposed to happen.
				
	else if (isRef(sig, var))					exit(1); //return 3;  // not supposed to happen. 

	else if (isProj(sig, &i, s1))				return 3;
	                                                	
	else if (isSigTable(sig, id, s1, s2)) 		return 3;
		
	else if (isSigWRTbl(sig, id, s1, s2, s3)) 	return 3; 
			
    else if (isSigRDTbl(sig, s1, s2)) 			return 3;

    else if (isSigDocConstantTbl(sig, s1, s2)) 	return 3;

    else if (isSigDocWriteTbl(sig,s1,s2,s3,s4)) return 3;

    else if (isSigDocAccessTbl(sig,s1,s2))      return 3;

    else if (isSigGen(sig, s1)) 				return 3;
		
	else if (isSigSelect2(sig,sel,s1,s2)) 		return 3;
		
	else if (isSigSelect3(sig,sel,s1,s2,s3)) 	return 3;	
	
	else if (isList(sig)) 
	{
		int r = 0;
		while (isList(sig)) { int x = O(hd(sig)); if (x > r) r = x; sig = tl(sig); }
		return r;
	}
	
	// unrecognized signal here
	fprintf(stderr, "ERROR infering signal order : unrecognized signal  : "); print(sig, stderr); fprintf(stderr, "\n");
	exit(1);
	return 0;
}