home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 160.lha / BCPL / hello.c < prev    next >
C/C++ Source or Header  |  1988-04-27  |  2KB  |  43 lines

  1. /* hello.c - an example of calling the BCPL library from C
  2. Compile and link with Manx 3.4:
  3.   cc hello
  4.   ln hello.o bcpllib.o -lc
  5. Author: Bill Kinnersley
  6. Date: Mar 12, 1988
  7. Mail:   Physics Dept.
  8.         Montana State University
  9.         Bozeman, MT 59717
  10.         BITNET: iphwk@mtsunix1
  11.         INTERNET: iphwk%mtsunix1.bitnet@cunyvm.cuny.edu
  12.         UUCP: ...psuvax1!mtsunix1.bitnet!iphwk
  13. */
  14. #include <stdio.h>
  15. #include <exec/memory.h>
  16. #include <libraries/dosextens.h>
  17. #include "bcpl.h"
  18. void *AllocMem();
  19. extern long *a;
  20. main() {
  21.         long proc, root, n, num;
  22.         struct Process *mytask;
  23.         char *s, *t, *buf;
  24.         BPTR bs, bt;
  25.         BCPLInit();
  26.         /*s = "Not is the time"; t = "NoT is the time";
  27.         bs = MakeBSTR(s); bt = MakeBSTR(t); num = BCPL(STRCMP,bs,bt);
  28.         printf("returned %ld\n",num); FreeBSTR(bs); FreeBSTR(bt);*/
  29.         proc = BCPL(FINDTASK); printf("My CLI Process is at %lx\n",proc);
  30.         root = BCPL(FINDROOT); printf("The root is at %lx\n", root);
  31.         s = "Here's a tab:%T5, a signed:%N, and an unsigned:%U8\n";
  32.         bs = MakeBSTR(s);
  33.         BCPL(WRITEF, bs, -1L, -1L); BCPL(NEWLINE);
  34.         FreeBSTR(bs);
  35.         /*num = BCPL(RDCH); num = BCPL(RDCH); BCPL(WRCH,num);BCPL(NEWLINE);*/
  36.         /*buf = (char *)AllocMem(80L,MEMF_PUBLIC);
  37.         num = BCPL(READIN,bptr(buf),80L);
  38.         BCPL(WRITEOUTB,bptr(buf),num); FreeMem(buf,80L);*/
  39.         /*num = BCPL(READN); printf("num=%ld\n",num);*/
  40.         /*n = BCPL(MOD, 23L, 5L); printf("n=%ld\n", n);*/
  41.         BCPLQuit();
  42. }
  43.