Blame view

Giac_maj/giac-1.4.9/src/gen_user 615 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  Making a new class, derivative of gen_user
  
  You must declare
  class my_gen::public gen_user {
    virtual my_gen * memory_alloc() const { return (my_gen *) malloc(sizeof(*this)); }
  };
  and redefine each operator you would like to redefine.
  You must define a constructor taking a gen (it will be of type _COMP most
  certainly) and returning a gen of type _USER with it's _USERptr pointing
  to a * my_gen, make from this constructor a standard unary_function_ptr 
  at_my_gen with name my_gen and register it for the lexer
  sym_tab_register("my_gen",at_my_gen);
  so that the user can write something like that
  a:=my_gen(1,2,3)