home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume7 / basic / part06 < prev    next >
Text File  |  1986-12-03  |  12KB  |  477 lines

  1. Subject:  v07i078:  A BASIC Interpreter, Part06/06
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by: phil@Cs.Ucl.AC.UK
  6. Mod.sources: Volume 7, Issue 78
  7. Archive-name: basic/Part06
  8.  
  9. # Shar file shar06 (of 6)
  10. #
  11. # This is a shell archive containing the following files :-
  12. #    pyramid/conf.h
  13. #    pyramid/term.c
  14. #    vax/Makefile
  15. #    vax/as.s
  16. #    vax/asm.sed
  17. #    vax/conf.h
  18. #    vax/term.c
  19. # ------------------------------
  20. # This is a shell archive, shar, format file.
  21. # To unarchive, feed this text into /bin/sh in the directory
  22. # you wish the files to be in.
  23.  
  24. echo x - pyramid/conf.h 1>&2
  25. sed 's/^X//' > pyramid/conf.h << 'End of pyramid/conf.h'
  26. X/*
  27. X * BASIC by Phil Cockcroft
  28. X */
  29. X/*
  30. X * configuration file for pyramid systems (BSD unix only)
  31. X */
  32. X
  33. X/*
  34. X * memory sizes.
  35. X */
  36. X
  37. X#define MAXMEM  (memp)1000000   /* max amount of memory */
  38. X#define MEMINC  8191            /* sizeof memory increments -1 */
  39. X
  40. X/*
  41. X * various options
  42. X */
  43. X
  44. X#define V7                      /* must be defined */
  45. X#define BERK                    /* must be defined */
  46. X#define UCB_NTTY                /* must be defined */
  47. X#define LKEYWORDS
  48. X#define LNAMES
  49. X#define RENUMB
  50. X#define SCOMMS
  51. X#define VFORK
  52. X#define BLOCKSIZ        1024
  53. X#define BSD42
  54. X#define ALIGN4
  55. X#define MPORTABLE
  56. X#define PORTABLE
  57. X
  58. X/*
  59. X * terminal dependent stuff
  60. X */
  61. X
  62. X#define CTRLINT         03      /* sig int control c */
  63. X#define CTRLQUIT        034     /* sig quit FS */
  64. X#define DEFPAGE         80      /* default terminal width */
  65. X#define DEFLENGTH       24      /* default number of lines on screen */
  66. X
  67. X/* #define VAX_ASSEM */ /* if you want to use assembler in various routines*/
  68. X            /* this only works for the vax */
  69. X
  70. X/* #define NOEDIT    /* define if don't want editing ever ! */
  71. X             /* NB basic -e will still turn on editing */
  72. X             /* basic -x will still turn off editing */
  73. X
  74. X/* #define LKEYWORDS /* define this if you want to have variable names which*/
  75. X             /* contain commands this is like the later versions of */
  76. X             /* microsoft but not like the orignal version */
  77. X             /* it wastes more space since you have to have some */
  78. X             /* spaces in to distinguish keywords */
  79. X
  80. X/* #define RENUMB    /* define if you want to put the code for renumbering */
  81. X             /* in. It works but is very wasteful of space. If you */
  82. X             /* are short of space then don't use it. */
  83. X
  84. X/* #define LNAMES    /* define if you want long variables names. This only */
  85. X             /* slows it down by a small fraction */
  86. X
  87. X/* #define _BLOCKED  /* This is a switch to allow block mode files */
  88. X             /* don't define it here look below for where it is done*/
  89. X             /* in the file handling bits */
  90. X
  91. X/* #define BSD42     /* if useing a 4.2 system */
  92. X
  93. X/* #define SCOMMS    /* to allow shortened command names e.g. l. -> list */
  94. X             /* this might cause some problems with overwriting of */
  95. X             /* core but I think they have all been solved */
  96. X/* #define VFORK     /* if your system supports vfork() */
  97. End of pyramid/conf.h
  98. chmod u=rw-,g=r,o=r pyramid/conf.h
  99. echo x - pyramid/term.c 1>&2
  100. sed 's/^X//' > pyramid/term.c << 'End of pyramid/term.c'
  101. X/*
  102. X * BASIC by Phil Cockcroft
  103. X */
  104. X/*
  105. X * machine dependent terminal info
  106. X */
  107. X
  108. X#include "pyramid/conf.h"
  109. X#include <sgtty.h>
  110. X
  111. X#ifndef SCOPE
  112. X#define SCOPE 0
  113. X#endif
  114. X
  115. Xstruct  sgttyb  nsttyb, osttyb;
  116. Xstruct  tchars  ntchr,otchr;
  117. X#ifdef  UCB_NTTY
  118. Xstruct  ltchars nltchr,oltchr;
  119. X#endif
  120. X
  121. Xextern  int     ter_width;
  122. Xextern  char    noedit;
  123. X
  124. Xstatic  int     got_mode;
  125. X
  126. Xsetu_term()
  127. X{
  128. X    register i;
  129. X    char    *p, *getenv();
  130. X
  131. X    ioctl(0,TIOCGETP,&osttyb);
  132. X    ioctl(0,TIOCGETC,&otchr);
  133. X    nsttyb = osttyb;
  134. X    ntchr = otchr;
  135. X#ifdef  TIOCSLPN
  136. X    osttyb.sg_length = DEFLENGTH;
  137. X    nsttyb.sg_length = 0;
  138. X    if(ter_width <= 0)
  139. X        ter_width = osttyb.sg_width & 0377;
  140. X    osttyb.sg_width = DEFPAGE;
  141. X    nsttyb.sg_width = 0;
  142. X#endif
  143. X    ntchr.t_brkc = -1;
  144. X    ntchr.t_eofc = -1;
  145. X    ntchr.t_intrc = CTRLINT;
  146. X    ntchr.t_quitc = CTRLQUIT;
  147. X    if( (p = getenv("TERM")) && strcmp(p, "ucl7009") == 0){
  148. X        ntchr.t_startc = -1;
  149. X        ntchr.t_stopc = -1;
  150. X    }
  151. X    i = osttyb.sg_flags & ( LCASE | XTABS);
  152. X    nsttyb.sg_flags = CBREAK | ANYP | i;
  153. X    osttyb.sg_flags = ECHO | ANYP | CRMOD | SCOPE | i;
  154. X#ifdef  UCB_NTTY
  155. X    ioctl(0,TIOCGLTC,&oltchr);
  156. X    nltchr = oltchr;                /* is this needed ?? */
  157. X    nltchr.t_suspc = -1;
  158. X    nltchr.t_dsuspc = -1;
  159. X    nltchr.t_rprntc = -1;
  160. X    nltchr.t_flushc = -1;
  161. X    nltchr.t_werasc = -1;
  162. X    nltchr.t_lnextc = -1;
  163. X#endif
  164. X    if(ter_width <= 0)
  165. X        ter_width=DEFPAGE;
  166. X    got_mode = 1;
  167. X}
  168. X
  169. Xset_term()
  170. X{
  171. X    if(noedit || !got_mode)
  172. X        return;
  173. X    ioctl(0,TIOCSETN,&nsttyb);
  174. X    ioctl(0,TIOCSETC,&ntchr);
  175. X#ifdef  UCB_NTTY
  176. X    ioctl(0,TIOCSLTC,&nltchr);
  177. X#endif
  178. X}
  179. X
  180. Xrset_term(type)
  181. X{
  182. X
  183. X    if(noedit || !got_mode)
  184. X        return;
  185. X#ifdef  TIOCSLPN
  186. X    if(type)
  187. X        osttyb.sg_width = ter_width;
  188. X#endif
  189. X    ioctl(0,TIOCSETN,&osttyb);
  190. X    ioctl(0,TIOCSETC,&otchr);
  191. X#ifdef  UCB_NTTY
  192. X    ioctl(0,TIOCSLTC,&oltchr);
  193. X#endif
  194. X}
  195. End of pyramid/term.c
  196. chmod u=rw-,g=r,o=r pyramid/term.c
  197. echo x - vax/Makefile 1>&2
  198. sed 's/^X//' > vax/Makefile << 'End of vax/Makefile'
  199. X# Makefile for a vax
  200. X
  201. X# which cursor file we want.
  202. X# can be ucl or ukc
  203. XCURSOR = ucl
  204. X
  205. Xbasic:  as.o bas1.o bas2.o bas3.o bas4.o bas5.o bas6.o bas7.o bas8.o \
  206. X       bas9.o cursor.o termcap.o assist.o term.o
  207. X    cc -O as.o bas1.o bas2.o bas3.o bas4.o bas5.o bas6.o bas7.o \
  208. X       bas8.o bas9.o cursor.o termcap.o assist.o term.o -lm -ltermcap -o basic
  209. X
  210. Xclean:
  211. X    rm -f *.o *.s cursor.c term.c
  212. X
  213. Xassist.o: bas.h assist.c
  214. X    cc -O -c assist.c
  215. X
  216. Xtermcap.o: bas.h termcap.c cursor.c
  217. X    cc -O -c termcap.c
  218. X
  219. Xcursor.c: cursor/cursor.c.${CURSOR}
  220. X    cp cursor/cursor.c.${CURSOR} cursor.c
  221. X
  222. Xcursor.o: cursor.c
  223. X    cc -O -c cursor.c
  224. X
  225. Xterm.o: term.c
  226. X    cc -O -c term.c
  227. X
  228. Xterm.c: vax/term.c vax/conf.h
  229. X    cp vax/term.c term.c
  230. X
  231. Xas.o:   vax/as.s
  232. X    cp vax/as.s as.s
  233. X    cc -O -c as.s
  234. X    rm as.s
  235. X
  236. X.c.o:
  237. X    cc -O -S -DBSD42 $*.c
  238. X    sed -f vax/asm.sed <$*.s | as -o $*.o
  239. X    rm -f $*.s
  240. X
  241. Xbas.h: vax/conf.h
  242. X
  243. Xbas1.o: bas1.c bas.h
  244. Xbas2.o: bas2.c bas.h
  245. Xbas3.o: bas3.c bas.h
  246. Xbas4.o: bas4.c bas.h
  247. Xbas5.o: bas5.c bas.h
  248. Xbas6.o: bas6.c bas.h
  249. Xbas7.o: bas7.c bas.h
  250. Xbas7.c: cursor.c
  251. Xbas8.o: bas8.c bas.h
  252. Xbas9.o: bas9.c bas.h
  253. End of vax/Makefile
  254. chmod u=rw-,g=r,o=r vax/Makefile
  255. echo x - vax/as.s 1>&2
  256. sed 's/^X//' > vax/as.s << 'End of vax/as.s'
  257. X    .text
  258. X    .align  1
  259. X    .globl  _Getch
  260. X_Getch:
  261. X    movl    _point,r0
  262. XL190:
  263. X    cmpb    (r0)+,$32
  264. X    beql    L190
  265. X    movl    r0,_point
  266. X    movzbl  -(r0),r0
  267. X    rsb
  268. X
  269. X    .globl  _Check
  270. X_Check:
  271. X    movl    _point,r1
  272. XL197:
  273. X    cmpb    (r1)+,$32
  274. X    beql    L197
  275. X    movzbl  -(r1),r0
  276. X    beql    L198
  277. X    cmpb    r0,$58
  278. X    beql    L198
  279. X    cmpl    r0,$233                 # ELSE = 0351
  280. X    bneq    L199
  281. X    tstb    _elsecount
  282. X    beql    L199
  283. XL198:
  284. X    movl    r1,_point
  285. X    rsb
  286. XL199:
  287. X    pushl   $1
  288. X    calls   $1,_error
  289. X    # no return since _error does not return
  290. X
  291. X    .globl  __cleanup
  292. X    .globl    __exit
  293. X__cleanup:
  294. X    pushl   $0
  295. X    calls   $1,__exit
  296. X    ret
  297. End of vax/as.s
  298. chmod u=rw-,g=r,o=r vax/as.s
  299. echo x - vax/asm.sed 1>&2
  300. sed 's/^X//' > vax/asm.sed << 'End of vax/asm.sed'
  301. Xs/calls    $0,_getch$/jsb    _Getch/
  302. Xs/calls    $0,_check$/jsb    _Check/
  303. Xs/calls    r[0-9]*,_getch$/jsb    _Getch/
  304. Xs/calls    r[0-9]*,_check$/jsb    _Check/
  305. End of vax/asm.sed
  306. chmod u=rw-,g=r,o=r vax/asm.sed
  307. echo x - vax/conf.h 1>&2
  308. sed 's/^X//' > vax/conf.h << 'End of vax/conf.h'
  309. X/*
  310. X * BASIC by Phil Cockcroft
  311. X */
  312. X/*
  313. X * configuration file for vax systems (BSD unix only)
  314. X */
  315. X
  316. X/*
  317. X * memory sizes.
  318. X */
  319. X
  320. X#define MAXMEM  (memp)1000000   /* max amount of memory */
  321. X#define MEMINC  8191            /* sizeof memory increments -1 */
  322. X
  323. X/*
  324. X * various options
  325. X */
  326. X
  327. X#define V7                      /* must be defined */
  328. X#define BERK                    /* must be defined */
  329. X#define UCB_NTTY                /* must be defined */
  330. X#define LKEYWORDS
  331. X#define LNAMES
  332. X#define RENUMB
  333. X#define SCOMMS
  334. X#define VFORK
  335. X#define VAX_ASSEM
  336. X#define BLOCKSIZ        1024
  337. X
  338. X/*
  339. X * terminal dependent stuff
  340. X */
  341. X
  342. X#define CTRLINT         03      /* sig int control c */
  343. X#define CTRLQUIT        034     /* sig quit FS */
  344. X#define DEFPAGE         80      /* default terminal width */
  345. X#define DEFLENGTH       24      /* default number of lines on screen */
  346. X
  347. X/* #define VAX_ASSEM */ /* if you want to use assembler in various routines*/
  348. X            /* this only works for the vax */
  349. X
  350. X/* #define NOEDIT    /* define if don't want editing ever ! */
  351. X             /* NB basic -e will still turn on editing */
  352. X             /* basic -x will still turn off editing */
  353. X
  354. X/* #define LKEYWORDS /* define this if you want to have variable names which*/
  355. X             /* contain commands this is like the later versions of */
  356. X             /* microsoft but not like the orignal version */
  357. X             /* it wastes more space since you have to have some */
  358. X             /* spaces in to distinguish keywords */
  359. X
  360. X/* #define RENUMB    /* define if you want to put the code for renumbering */
  361. X             /* in. It works but is very wasteful of space. If you */
  362. X             /* are short of space then don't use it. */
  363. X
  364. X/* #define LNAMES    /* define if you want long variables names. This only */
  365. X             /* slows it down by a small fraction */
  366. X
  367. X/* #define _BLOCKED  /* This is a switch to allow block mode files */
  368. X             /* don't define it here look below for where it is done*/
  369. X             /* in the file handling bits */
  370. X
  371. X/* #define BSD42     /* if useing a 4.2 system */
  372. X
  373. X/* #define SCOMMS    /* to allow shortened command names e.g. l. -> list */
  374. X             /* this might cause some problems with overwriting of */
  375. X             /* core but I think they have all been solved */
  376. X/* #define VFORK     /* if your system supports vfork() */
  377. End of vax/conf.h
  378. chmod u=rw-,g=r,o=r vax/conf.h
  379. echo x - vax/term.c 1>&2
  380. sed 's/^X//' > vax/term.c << 'End of vax/term.c'
  381. X/*
  382. X * BASIC by Phil Cockcroft
  383. X */
  384. X/*
  385. X * machine dependent terminal info
  386. X */
  387. X
  388. X#include "vax/conf.h"
  389. X#include <sgtty.h>
  390. X
  391. X#ifndef SCOPE
  392. X#define SCOPE 0
  393. X#endif
  394. X
  395. Xstruct  sgttyb  nsttyb, osttyb;
  396. Xstruct  tchars  ntchr,otchr;
  397. X#ifdef  UCB_NTTY
  398. Xstruct  ltchars nltchr,oltchr;
  399. X#endif
  400. X
  401. Xextern  int     ter_width;
  402. Xextern  char    noedit;
  403. X
  404. Xstatic  int     got_mode;
  405. X
  406. Xsetu_term()
  407. X{
  408. X    register i;
  409. X    char    *p, *getenv();
  410. X
  411. X    ioctl(0,TIOCGETP,&osttyb);
  412. X    ioctl(0,TIOCGETC,&otchr);
  413. X    nsttyb = osttyb;
  414. X    ntchr = otchr;
  415. X#ifdef  TIOCSLPN
  416. X    osttyb.sg_length = DEFLENGTH;
  417. X    nsttyb.sg_length = 0;
  418. X    if(ter_width <= 0)
  419. X        ter_width = osttyb.sg_width & 0377;
  420. X    osttyb.sg_width = DEFPAGE;
  421. X    nsttyb.sg_width = 0;
  422. X#endif
  423. X    ntchr.t_brkc = -1;
  424. X    ntchr.t_eofc = -1;
  425. X    ntchr.t_intrc = CTRLINT;
  426. X    ntchr.t_quitc = CTRLQUIT;
  427. X    if( (p = getenv("TERM")) && strcmp(p, "ucl7009") == 0){
  428. X        ntchr.t_startc = -1;
  429. X        ntchr.t_stopc = -1;
  430. X    }
  431. X    i = osttyb.sg_flags & ( LCASE | XTABS);
  432. X    nsttyb.sg_flags = CBREAK | ANYP | i;
  433. X    osttyb.sg_flags = ECHO | ANYP | CRMOD | SCOPE | i;
  434. X#ifdef  UCB_NTTY
  435. X    ioctl(0,TIOCGLTC,&oltchr);
  436. X    nltchr = oltchr;                /* is this needed ?? */
  437. X    nltchr.t_suspc = -1;
  438. X    nltchr.t_dsuspc = -1;
  439. X    nltchr.t_rprntc = -1;
  440. X    nltchr.t_flushc = -1;
  441. X    nltchr.t_werasc = -1;
  442. X    nltchr.t_lnextc = -1;
  443. X#endif
  444. X    if(ter_width <= 0)
  445. X        ter_width=DEFPAGE;
  446. X    got_mode = 1;
  447. X}
  448. X
  449. Xset_term()
  450. X{
  451. X    if(noedit || !got_mode)
  452. X        return;
  453. X    ioctl(0,TIOCSETN,&nsttyb);
  454. X    ioctl(0,TIOCSETC,&ntchr);
  455. X#ifdef  UCB_NTTY
  456. X    ioctl(0,TIOCSLTC,&nltchr);
  457. X#endif
  458. X}
  459. X
  460. Xrset_term(type)
  461. X{
  462. X
  463. X    if(noedit || !got_mode)
  464. X        return;
  465. X#ifdef  TIOCSLPN
  466. X    if(type)
  467. X        osttyb.sg_width = ter_width;
  468. X#endif
  469. X    ioctl(0,TIOCSETN,&osttyb);
  470. X    ioctl(0,TIOCSETC,&otchr);
  471. X#ifdef  UCB_NTTY
  472. X    ioctl(0,TIOCSLTC,&oltchr);
  473. X#endif
  474. X}
  475. End of vax/term.c
  476. chmod u=rw-,g=r,o=r vax/term.c
  477.