cvsuser     03/07/02 16:08:31

  Modified:    config/gen/makefiles jako.in
  Added:       languages/jako/examples nci.jako
  Log:
    * Parrot gets a new Native Call Interface example separate from life.jako
      and mandelzoom.jako.
  
  Revision  Changes    Path
  1.10      +7 -2      parrot/config/gen/makefiles/jako.in
  
  Index: jako.in
  ===================================================================
  RCS file: /cvs/public/parrot/config/gen/makefiles/jako.in,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- jako.in   30 May 2003 17:17:02 -0000      1.9
  +++ jako.in   2 Jul 2003 23:08:30 -0000       1.10
  @@ -1,7 +1,7 @@
   #
   # Makefile.in
   #
  -# $Id: jako.in,v 1.9 2003/05/30 17:17:02 util Exp $
  +# $Id: jako.in,v 1.10 2003/07/02 23:08:30 gregor Exp $
   #
   
   PERL = ${perl}
  @@ -30,6 +30,7 @@
        examples/hello.pbc      \
        examples/leibniz.pbc    \
        examples/life.pbc       \
  +     examples/nci.pbc        \
        examples/mandelbrot.pbc \
        examples/mandelzoom.pbc \
        examples/mops.pbc       \
  @@ -56,6 +57,7 @@
   examples/mandelbrot.imc: examples/mandelbrot.jako jakoc
   examples/mandelzoom.imc: examples/mandelzoom.jako jakoc
   examples/mops.imc:       examples/mops.jako       jakoc
  +examples/nci.imc:        examples/nci.jako        jakoc
   examples/primes.imc:     examples/primes.jako     jakoc
   examples/queens.imc:     examples/queens.jako     jakoc
   examples/sub.imc:        examples/sub.jako        jakoc
  @@ -84,6 +86,7 @@
   examples/mandelbrot.pasm: examples/mandelbrot.imc imcc
   examples/mandelzoom.pasm: examples/mandelzoom.imc imcc
   examples/mops.pasm:       examples/mops.imc       imcc
  +examples/nci.pasm:        examples/nci.imc        imcc
   examples/primes.pasm:     examples/primes.imc     imcc
   examples/queens.pasm:     examples/queens.imc     imcc
   examples/sub.pasm:        examples/sub.imc        imcc
  @@ -107,6 +110,7 @@
   examples/mandelbrot.pbc: examples/mandelbrot.pasm
   examples/mandelzoom.pbc: examples/mandelzoom.pasm
   examples/mops.pbc:       examples/mops.pasm
  +examples/nci.pbc:        examples/nci.pasm
   examples/primes.pbc:     examples/primes.pasm
   examples/queens.pbc:     examples/queens.pasm
   examples/sub.pbc:        examples/sub.pasm
  @@ -131,10 +135,11 @@
        $(INTERP) examples/fib.pbc
        $(INTERP) examples/hello.pbc
        $(INTERP) examples/leibniz.pbc
  -     $(INTERP) examples/life.pbc
  +#    $(INTERP) examples/life.pbc
        $(INTERP) examples/mandelbrot.pbc
        $(INTERP) examples/mandelzoom.pbc
        $(INTERP) examples/mops.pbc
  +     $(INTERP) examples/nci.pbc
        $(INTERP) examples/primes.pbc
        $(INTERP) examples/queens.pbc
        $(INTERP) examples/sub.pbc
  
  
  
  1.1                  parrot/languages/jako/examples/nci.jako
  
  Index: nci.jako
  ===================================================================
  #
  # nci.jako
  #
  # Test out the Jako wrapping of Parrot's Native Call Interface
  # facility.
  #
  # Copyright (C) 2003 Gregor N. Purdy. All rights reserved.
  # This program is free software. Its use is subject to the same
  # license as Parrot.
  #
  
  sub int initscr  {fnlib = "libcurses.so"} ();
  sub int endwin   {fnlib = "libcurses.so"} ();
  sub int curs_set {fnlib = "libcurses.so"} (int x);
  
  sub int addstr   {fnlib = "libcurses.so"} (str s);
  sub int refresh  {fnlib = "libcurses.so"} ();
  sub int move     {fnlib = "libcurses.so"} (int x, int y);
  
  sub int getch    {fnlib = "libcurses.so"} ();
  sub int box      {fnlib = "libcurses.so"} (int screen, int v, int h);
  sub int hline    {fnlib = "libcurses.so"} (int ch, int n);
  
  sub str readline {op} (int fd);
  
  var int foo; # Store result from above functions here.
  
  var int screen;
  screen = initscr();
  
  foo = curs_set(0);
  foo = box(screen, 42, 42);
  foo = move(10, 20);
  foo = addstr("Hello, world!");
  foo = move(12, 15);
  foo = addstr("(Press any key to exit)");
  
  foo = move(8, 10);
  foo = hline(42, 33);
  
  foo = move(14, 10);
  foo = hline(42, 33);
  
  foo = refresh();
  
  foo = getch();
  
  foo = curs_set(1);
  foo = endwin();
  
  
  

Reply via email to