FAUST compiler  0.9.9.6b8
Public Member Functions
AbsPrim Class Reference
Inheritance diagram for AbsPrim:
Inheritance graph
[legend]
Collaboration diagram for AbsPrim:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AbsPrim ()
virtual unsigned int arity ()
virtual bool needCache ()
virtual Type infereSigType (const vector< Type > &types)
virtual void sigVisit (Tree sig, sigvisitor *visitor)
virtual int infereSigOrder (const vector< int > &args)
virtual Tree computeSigOutput (const vector< Tree > &args)
virtual string generateCode (Klass *klass, const vector< string > &args, const vector< Type > &types)
virtual string generateLateq (Lateq *lateq, const vector< string > &args, const vector< Type > &types)

Detailed Description

Definition at line 8 of file absprim.cpp.


Constructor & Destructor Documentation

AbsPrim::AbsPrim ( ) [inline]

Definition at line 13 of file absprim.cpp.

: xtended("abs") {}

Member Function Documentation

virtual unsigned int AbsPrim::arity ( ) [inline, virtual]

Implements xtended.

Definition at line 15 of file absprim.cpp.

Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().

{ return 1; }

Here is the caller graph for this function:

virtual Tree AbsPrim::computeSigOutput ( const vector< Tree > &  args) [inline, virtual]

Implements xtended.

Definition at line 36 of file absprim.cpp.

References abs(), arity(), isDouble(), isInt(), xtended::symbol(), and tree().

    {
        double f; int i;

        assert (args.size() == arity());

        if (isDouble(args[0]->node(),&f)) {
            return tree(fabs(f));

        } else if (isInt(args[0]->node(),&i)) {
            return tree(abs(i));

        } else {
            return tree(symbol(), args[0]);
        }
    }

Here is the call graph for this function:

virtual string AbsPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 53 of file absprim.cpp.

References arity(), infereSigType(), isuffix(), kReal, and subst().

    {
        assert (args.size() == arity());
        assert (types.size() == arity());

        Type t = infereSigType(types);
        if (t->nature() == kReal) {
            return subst("fabs$1($0)", args[0], isuffix());
        } else {
            return subst("abs($0)", args[0]);
        }
    }

Here is the call graph for this function:

virtual string AbsPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 66 of file absprim.cpp.

References arity(), infereSigType(), and subst().

    {
        assert (args.size() == arity());
        assert (types.size() == arity());
        
        Type t = infereSigType(types);
        return subst("\\left\\lvert{$0}\\right\\rvert", args[0]);
    }

Here is the call graph for this function:

virtual int AbsPrim::infereSigOrder ( const vector< int > &  args) [inline, virtual]

Implements xtended.

Definition at line 29 of file absprim.cpp.

References arity().

    {
        assert (args.size() == arity());
        return args[0];
    }

Here is the call graph for this function:

virtual Type AbsPrim::infereSigType ( const vector< Type > &  types) [inline, virtual]

Implements xtended.

Definition at line 19 of file absprim.cpp.

References abs(), arity(), and castInterval().

Referenced by generateCode(), and generateLateq().

    {
        assert (types.size() == arity());
        Type t = types[0];
        return castInterval(t, abs(t->getInterval()));
        return t;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool AbsPrim::needCache ( ) [inline, virtual]

Implements xtended.

Definition at line 17 of file absprim.cpp.

{ return true; }
virtual void AbsPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
) [inline, virtual]

Definition at line 27 of file absprim.cpp.

{}

The documentation for this class was generated from the following file: