[BACK]Return to tu1.sm1 CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/tu1.sm1, Revision 1.1.1.1

1.1       maekawa     1: %%% tu1.sm1,  1998, 11/3
                      2: %%% A sample program for authors of packages.
                      3:
                      4: %%% global variables for bfunction
                      5: %%% bfunction.*
                      6: /bfunction.v [(x) (y) (z)] def   %% default value of v (variables).
                      7: /bfunction.s (s) def             %% default value of s.
                      8: /bfunction.verbose 0 def
                      9:
                     10: /bfunction {
                     11:   /arg1 set
                     12:   [/in-bfunction /aa /typev /setarg /f /s /v] pushVariables
                     13:   [(CurrentRingp) (KanGBmessage)] pushEnv  %% push current global environment.
                     14:   [
                     15:
                     16:     /aa arg1 def
                     17:     aa isArray { } { (array bfunction) message error } ifelse
                     18:     /setarg 0 def
                     19:     aa { tag } map /typev set
                     20:     typev [ StringP ] eq
                     21:     {  /f aa 0 get def
                     22:        /v bfunction.v def
                     23:        /s bfunction.s def
                     24:        /setarg 1 def
                     25:     } { } ifelse
                     26:     typev [StringP StringP] eq
                     27:     {  /f aa 0 get def
                     28:        /v [ aa 1 get to_records pop ] def
                     29:        /s bfunction.s def
                     30:        /setarg 1 def
                     31:     } { } ifelse
                     32:     typev [StringP ArrayP] eq
                     33:     {  /f aa 0 get def
                     34:        /v aa 1 get def
                     35:        /s bfunction.s def
                     36:        /setarg 1 def
                     37:     } { } ifelse
                     38:     setarg { } { (Argument mismatch) message error } ifelse
                     39:
                     40:     [(KanGBmessage) bfunction.verbose] system_variable
                     41:
                     42:
                     43:     %%% PROGRAM BODY
                     44:
                     45:     /arg1 [f v s] def
                     46:   ] pop
                     47:   popEnv
                     48:   popVariables
                     49:   arg1
                     50: } def
                     51:
                     52: %% Auxiliary function for bfunction.
                     53: %% bfunction.*
                     54: /bfunction.foo1 {
                     55:
                     56: } def
                     57:
                     58:
                     59: %% Write usages as follows.
                     60: [(bfunction)
                     61:  [( a bfunction b)
                     62:   (array a; poly b;)
                     63:   (a :  [f] ;  string f ;)
                     64:   (a :  [f v] ; string f,v; )
                     65:   (b is the bfunction of the polynomial f given as a string.)
                     66:   $Example  [(x^3-y^2) (x,y)] bfunction :: $
                     67:  ]
                     68: ] putUsages
                     69: (bfunction ) messagen
                     70:
                     71: ;
                     72:
                     73:
                     74:
                     75:
                     76:
                     77:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>