FAUST compiler  0.9.9.6b8
Public Member Functions | List of all members
RemainderPrim Class Reference
Inheritance diagram for RemainderPrim:
Inheritance graph
[legend]
Collaboration diagram for RemainderPrim:
Collaboration graph
[legend]

Public Member Functions

 RemainderPrim ()
 
virtual unsigned int arity ()
 
virtual bool needCache ()
 
virtual Type infereSigType (const vector< Type > &args)
 
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)
 
- Public Member Functions inherited from xtended
 xtended (const char *name)
 
virtual ~xtended ()
 
Sym symbol ()
 
const char * name ()
 
Tree box ()
 
virtual bool isSpecialInfix ()
 generaly false, but true for binary op # such that #(x) == _::x More...
 

Detailed Description

Definition at line 8 of file remainderprim.cpp.

Constructor & Destructor Documentation

RemainderPrim::RemainderPrim ( )
inline

Definition at line 13 of file remainderprim.cpp.

13 : xtended("remainder") {}
xtended(const char *name)
Definition: xtended.hh:18

Member Function Documentation

virtual unsigned int RemainderPrim::arity ( )
inlinevirtual

Implements xtended.

Definition at line 15 of file remainderprim.cpp.

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

15 { return 2; }

Here is the caller graph for this function:

virtual Tree RemainderPrim::computeSigOutput ( const vector< Tree > &  args)
inlinevirtual

Implements xtended.

Definition at line 33 of file remainderprim.cpp.

References arity(), isNum(), xtended::symbol(), and tree().

33  {
34  num n,m;
35  assert (args.size() == arity());
36  if (isNum(args[0],n) & isNum(args[1],m)) {
37  return tree(remainder(double(n), double(m)));
38  } else {
39  return tree(symbol(), args[0], args[1]);
40  }
41  }
Definition: num.hh:58
bool isNum(Tree a)
Definition: signals.hh:187
virtual unsigned int arity()
Sym symbol()
Definition: xtended.hh:24
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

virtual string RemainderPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 43 of file remainderprim.cpp.

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

44  {
45  assert (args.size() == arity());
46  assert (types.size() == arity());
47 
48  return subst("remainder$2($0,$1)", args[0], args[1], isuffix());
49  }
virtual unsigned int arity()
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47
const char * isuffix()
suffix for math functions
Definition: floats.cpp:43

Here is the call graph for this function:

virtual string RemainderPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 51 of file remainderprim.cpp.

References arity(), and subst().

52  {
53  assert (args.size() == arity());
54  assert (types.size() == arity());
55 
56  return subst("$0\\pmod{$1}", args[0], args[1]); // Same as fmodprim.cpp.
57  }
virtual unsigned int arity()
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47

Here is the call graph for this function:

virtual int RemainderPrim::infereSigOrder ( const vector< int > &  args)
inlinevirtual

Implements xtended.

Definition at line 27 of file remainderprim.cpp.

References arity(), and max().

27  {
28  assert (args.size() == arity());
29  return max(args[0], args[1]);
30  }
double max(double x, double y)
Definition: interval.hh:60
virtual unsigned int arity()

Here is the call graph for this function:

virtual Type RemainderPrim::infereSigType ( const vector< Type > &  args)
inlinevirtual

Implements xtended.

Definition at line 19 of file remainderprim.cpp.

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

20  {
21  assert (args.size() == arity());
22  return castInterval(floatCast(args[0]|args[1]), interval()); // temporary rule !!!
23  }
virtual unsigned int arity()
Type floatCast(Type t)
Definition: sigtype.hh:270
Type castInterval(Type t, const interval &i)
Definition: sigtype.hh:278

Here is the call graph for this function:

virtual bool RemainderPrim::needCache ( )
inlinevirtual

Implements xtended.

Definition at line 17 of file remainderprim.cpp.

17 { return true; }
virtual void RemainderPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
)
inlinevirtual

Definition at line 25 of file remainderprim.cpp.

25 {}

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