[Plib-cvs] plib/examples/src/psl psl_demo.cxx,1.7,1.8
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2002-09-06 15:07:47
|
Update of /cvsroot/plib/plib/examples/src/psl In directory usw-pr-cvs1:/tmp/cvs-serv22280/plib/examples/src/psl Modified Files: psl_demo.cxx Log Message: Global variable initialisations now work. pslInit created and checked for. Index: psl_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/psl/psl_demo.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- psl_demo.cxx 6 Sep 2002 13:50:51 -0000 1.7 +++ psl_demo.cxx 6 Sep 2002 15:07:44 -0000 1.8 @@ -32,7 +32,21 @@ #include <plib/psl.h> -pslVariable hello ( int argc, pslVariable *argv, pslProgram *p ) +pslVariable print ( int argc, pslVariable *argv, pslProgram *p ) +{ + for ( int i = 0 ; i < argc ; i++ ) + printf ( "%f ", argv[i].f ) ; + + printf ( "\n" ) ; + + pslVariable ret ; + ret.f = 0.0f ; + + return ret ; +} + + +pslVariable identify ( int argc, pslVariable *argv, pslProgram *p ) { printf ( "I am %s.\n", (char *)( p->getUserData ()) ) ; @@ -45,13 +59,16 @@ pslExtension extensions [] = { - { "hello", 0, hello }, + { "identify", 0, identify }, + { "print", -1, print }, { NULL, 0, NULL } } ; int main () { + pslInit () ; + /* Create program 1 and compile it. */ pslProgram *prog_1 = new pslProgram ( extensions ) ; |