├── cc.out ├── ex ├── pi.ex.in ├── hanoi.ex.in ├── pi.ex │ ├── suggest.abc │ ├── perm.abc │ ├── types.abc │ └── pi.cmd ├── hanoi.ex │ ├── suggest.abc │ ├── types.abc │ ├── perm.abc │ └── hanoi.cmd ├── pi.ex.out ├── xref │ └── perm.abc ├── xref_ex │ └── perm.abc ├── try │ ├── position.abc │ ├── suggest.abc │ ├── types.abc │ ├── fill.cmd │ ├── perm.abc │ ├── generate.cmd │ ├── start.cmd │ └── analyze.cmd ├── xref.ex │ ├── suggest.abc │ ├── alphabet.mpd │ ├── types.abc │ ├── save.cmd │ ├── output.cmd │ ├── perm.abc │ ├── xref.cmd │ └── words.mfd ├── generate.ex │ ├── suggest.abc │ ├── types.abc │ ├── fill.cmd │ ├── perm.abc │ ├── generate.cmd │ ├── start.cmd │ └── analyze.cmd ├── wsgroup.abc ├── generate.ex.in ├── xref.ex.in ├── hanoi.ex.out ├── xref.ex.out ├── generate.ex.out ├── README ├── DoExamples ├── TryEditor ├── basic.ex.out └── basic.ex.in ├── .gitignore ├── stc ├── MF └── DEP ├── mac ├── sys_types.h ├── Makefile.mac ├── muabort.c ├── combine.r ├── combineg.r ├── args.h ├── defs.h ├── README ├── m1edit.c ├── sys_stat.h ├── dir.h ├── musync.c ├── osconf.h ├── rez.h ├── macdefs.h ├── m1time.c ├── conf.h ├── m1os.c ├── muaccess.c ├── m1err.c ├── m1about.c ├── mustat.c ├── intercept.h ├── os.h ├── mess2rez.c ├── feat.h ├── m1mess.c ├── m1appfiles.c ├── config.h ├── mach.h ├── m1main.c ├── abcmenus.h └── mac.h ├── b ├── MF ├── b1file.c ├── DEP └── getopt.c ├── bhdrs ├── release.h ├── getopt.h ├── bcom.h ├── bgfx.h ├── bmem.h ├── bfil.h ├── bedi.h └── port.h ├── btr ├── MF ├── etex.h ├── i1tlt.h ├── e1etex.c └── DEP ├── ._ABC.dmg ├── unix ├── MF ├── main.h ├── edit.c ├── trm.h ├── feat.h ├── comp.h.gen ├── dir.h ├── comp.h ├── dir.h.orig ├── DEP ├── os.h.gen.orig ├── dir.c ├── usage.c └── os.h.gen ├── bio ├── MF ├── i4inp.c ├── i4lis.c ├── i4bio.c ├── i4bio.h ├── i4out.c └── i4pack.c ├── tc ├── libtermcap.a ├── tc1.c ├── tc2.c ├── Makefile ├── README ├── tc3.c └── tputs.c ├── atari ├── objects │ ├── abc.tos │ ├── packed │ │ ├── abc.tos │ │ └── abckeys.tos │ └── keys │ │ ├── abckeys.tos │ │ └── Makefile ├── main.h ├── sig.c ├── dir.h ├── CREATE ├── edit.c ├── feat.h ├── trm.h ├── comp.h ├── os.h ├── README.ST ├── dir.c ├── usage.c └── mach.h ├── bint2 ├── MF └── i2tar.c ├── bint1 └── MF ├── bint3 └── MF ├── msdos ├── Modules.keys ├── main.h ├── dir.h ├── sig.c ├── edit.c ├── feat.h ├── comp.h ├── trm.h ├── Makefile.keys ├── os.h ├── Modules ├── usage.c └── mach.h ├── ihdrs ├── i3typ.h ├── i3scr.h ├── i3bws.h ├── i3sta.h ├── i3in2.h ├── i2gen.h ├── i3int.h ├── i3env.h ├── i2exp.h ├── i3cen.h ├── i0err.h └── i3sou.h ├── bed ├── MF ├── e1code.c └── e1lexi.c ├── ch_mach ├── ehdrs ├── code.h ├── queu.h ├── getc.h ├── gram.h ├── cell.h ├── erro.h └── supr.h ├── readyn.orig ├── BUGS ├── generic ├── main.h ├── dir.c ├── dir.h ├── sig.c ├── README ├── edit.c ├── trm.h ├── comp.h └── usage.c ├── TODO ├── doc ├── BugReport ├── Structure └── ABCproject ├── ukeys ├── abcxterm.key ├── abc2640b.key ├── abc2621.key ├── abc5620.key ├── abcadm31.key └── abc924.key ├── readyn ├── ch_all ├── boot ├── alloc.c ├── lang.h ├── README └── Makefile.bsd ├── scripts ├── mkdep ├── Collect └── Change ├── readdir.old ├── readdir1 ├── readdir ├── keys ├── keydef.h └── Makefile ├── insert.places ├── ch_install ├── README.md ├── EDITOR └── README /cc.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ex/pi.ex.in: -------------------------------------------------------------------------------- 1 | PI 20 2 | -------------------------------------------------------------------------------- /ex/hanoi.ex.in: -------------------------------------------------------------------------------- 1 | HANOI 3 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | __pycache__/ -------------------------------------------------------------------------------- /ex/pi.ex/suggest.abc: -------------------------------------------------------------------------------- 1 | PI ? 2 | -------------------------------------------------------------------------------- /ex/hanoi.ex/suggest.abc: -------------------------------------------------------------------------------- 1 | HANOI ? 2 | -------------------------------------------------------------------------------- /ex/pi.ex.out: -------------------------------------------------------------------------------- 1 | 3.14159265358979323846 2 | -------------------------------------------------------------------------------- /ex/pi.ex/perm.abc: -------------------------------------------------------------------------------- 1 | {["1PI"]:"pi.cmd"} 2 | -------------------------------------------------------------------------------- /ex/pi.ex/types.abc: -------------------------------------------------------------------------------- 1 | {["1PI"]:"qnUQ"} 2 | -------------------------------------------------------------------------------- /ex/xref/perm.abc: -------------------------------------------------------------------------------- 1 | {["8text"]:"text.cts"} 2 | -------------------------------------------------------------------------------- /ex/hanoi.ex/types.abc: -------------------------------------------------------------------------------- 1 | {["1HANOI"]:"qnUQ"} 2 | -------------------------------------------------------------------------------- /ex/xref_ex/perm.abc: -------------------------------------------------------------------------------- 1 | {["8text"]:"text.cts"} 2 | -------------------------------------------------------------------------------- /stc/MF: -------------------------------------------------------------------------------- 1 | all: i2tca.o i2tce.o i2tcp.o i2tcu.o 2 | -------------------------------------------------------------------------------- /ex/hanoi.ex/perm.abc: -------------------------------------------------------------------------------- 1 | {["1HANOI"]:"hanoi.cmd"} 2 | -------------------------------------------------------------------------------- /mac/sys_types.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long time_t; 2 | -------------------------------------------------------------------------------- /ex/try/position.abc: -------------------------------------------------------------------------------- 1 | start.cmd 4 2 | generate.cmd 9 3 | -------------------------------------------------------------------------------- /ex/xref.ex/suggest.abc: -------------------------------------------------------------------------------- 1 | OUTPUT ? 2 | SAVE ? AT ? 3 | XREF ? 4 | -------------------------------------------------------------------------------- /b/MF: -------------------------------------------------------------------------------- 1 | all: b1file.o b1grab.o b1memo.o b1mess.o b1outp.o getopt.o 2 | -------------------------------------------------------------------------------- /bhdrs/release.h: -------------------------------------------------------------------------------- 1 | #define RELEASE "1.05.03 (central workspace)" 2 | -------------------------------------------------------------------------------- /btr/MF: -------------------------------------------------------------------------------- 1 | all: e1etex.o i1btr.o i1lta.o i1obj.o i1tex.o i1tlt.o 2 | -------------------------------------------------------------------------------- /ex/try/suggest.abc: -------------------------------------------------------------------------------- 1 | ANALYZE ? 2 | FILL ? 3 | GENERATE 4 | START 5 | -------------------------------------------------------------------------------- /._ABC.dmg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/._ABC.dmg -------------------------------------------------------------------------------- /ex/generate.ex/suggest.abc: -------------------------------------------------------------------------------- 1 | ANALYZE ? 2 | FILL ? 3 | GENERATE 4 | START 5 | -------------------------------------------------------------------------------- /ex/try/types.abc: -------------------------------------------------------------------------------- 1 | {["1ANALYZE"]:"q'UQ";["1GENERATE"]:"Q";["1START"]:"Q"} 2 | -------------------------------------------------------------------------------- /unix/MF: -------------------------------------------------------------------------------- 1 | all: dir.o edit.o file.o keys.o main.o os.o sig.o trm.o usage.o 2 | -------------------------------------------------------------------------------- /bio/MF: -------------------------------------------------------------------------------- 1 | all: i4bio.o i4fil.o i4grp.o i4inp.o i4lis.o i4out.o i4pack.o i4rec.o 2 | -------------------------------------------------------------------------------- /ex/generate.ex/types.abc: -------------------------------------------------------------------------------- 1 | {["1ANALYZE"]:"q'UQ";["1GENERATE"]:"Q";["1START"]:"Q"} 2 | -------------------------------------------------------------------------------- /mac/Makefile.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/mac/Makefile.mac -------------------------------------------------------------------------------- /tc/libtermcap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/tc/libtermcap.a -------------------------------------------------------------------------------- /atari/objects/abc.tos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/atari/objects/abc.tos -------------------------------------------------------------------------------- /bint2/MF: -------------------------------------------------------------------------------- 1 | all: i2ana.o i2cmd.o i2dis.o i2exp.o i2fix.o i2gen.o i2syn.o i2tar.o i2tes.o i2uni.o 2 | -------------------------------------------------------------------------------- /mac/muabort.c: -------------------------------------------------------------------------------- 1 | #include "macdefs.h" 2 | 3 | abort() 4 | { 5 | Debugger(); 6 | exit(2); 7 | } 8 | -------------------------------------------------------------------------------- /bint1/MF: -------------------------------------------------------------------------------- 1 | all: i1com.o i1fun.o i1nua.o i1nuc.o i1nug.o i1nui.o i1num.o i1nuq.o i1nur.o i1nut.o i1tra.o 2 | -------------------------------------------------------------------------------- /atari/objects/packed/abc.tos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/atari/objects/packed/abc.tos -------------------------------------------------------------------------------- /ex/xref.ex/alphabet.mpd: -------------------------------------------------------------------------------- 1 | HOW TO REPORT alphabetic char: 2 | REPORT char in {'a'..'z'} OR char in {'A'..'Z'} 3 | -------------------------------------------------------------------------------- /atari/objects/keys/abckeys.tos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/atari/objects/keys/abckeys.tos -------------------------------------------------------------------------------- /atari/objects/packed/abckeys.tos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvanrossum/abc-unix/HEAD/atari/objects/packed/abckeys.tos -------------------------------------------------------------------------------- /ex/xref.ex/types.abc: -------------------------------------------------------------------------------- 1 | {["1OUTPUT"]:"qV1V2#]UQ";["1SAVE"]:"qV1UqV2UQ";["1XREF"]:"qV1']UQ";["3words"]:"'U'}";["6alphabetic"]:"'Uv"} 2 | -------------------------------------------------------------------------------- /ex/try/fill.cmd: -------------------------------------------------------------------------------- 1 | HOW TO FILL text: 2 | READ line RAW 3 | WHILE line > '': 4 | PUT line IN text[#text+1] 5 | READ line RAW 6 | -------------------------------------------------------------------------------- /bint3/MF: -------------------------------------------------------------------------------- 1 | all: i3bws.o i3cen.o i3com.o i3env.o i3err.o i3fil.o i3fpr.o i3gfx.o i3imm.o i3in2.o i3ini.o i3int.o i3loc.o i3scr.o i3sou.o i3sta.o i3typ.o 2 | -------------------------------------------------------------------------------- /ex/generate.ex/fill.cmd: -------------------------------------------------------------------------------- 1 | HOW TO FILL text: 2 | READ line RAW 3 | WHILE line > '': 4 | PUT line IN text[#text+1] 5 | READ line RAW 6 | -------------------------------------------------------------------------------- /ex/wsgroup.abc: -------------------------------------------------------------------------------- 1 | {[">"]:"xref";[">>"]:"pi";["generate"]:"generate";["hanoi"]:"hanoi";["pi"]:"pi";["try"]:"try";["xref"]:"xref";["xref.ex"]:"xref_ex"} 2 | -------------------------------------------------------------------------------- /ex/generate.ex.in: -------------------------------------------------------------------------------- 1 | START 2 | Mary had a little lamb, 3 | Its fleece was white as snow, 4 | And everywhere that Mary went, 5 | That lamb was sure to go. 6 | 7 | \EOF 8 | -------------------------------------------------------------------------------- /ex/xref.ex/save.cmd: -------------------------------------------------------------------------------- 1 | HOW TO SAVE word AT line: 2 | SHARE xtab 3 | IF word not.in keys xtab: 4 | PUT {} IN xtab[word] 5 | INSERT line IN xtab[word] 6 | -------------------------------------------------------------------------------- /mac/combine.r: -------------------------------------------------------------------------------- 1 | include "code.out" 'CODE'; 2 | include "messages.out" 'STR#'; 3 | include "bundle.out"; 4 | include "about.out"; 5 | include "dialogs.out"; 6 | include "menus.out"; 7 | -------------------------------------------------------------------------------- /ex/xref.ex/output.cmd: -------------------------------------------------------------------------------- 1 | HOW TO OUTPUT xtab: 2 | FOR word IN keys xtab: 3 | WRITE word<<10 4 | FOR line IN xtab[word]: 5 | WRITE line>>4, ' ' 6 | WRITE / 7 | -------------------------------------------------------------------------------- /mac/combineg.r: -------------------------------------------------------------------------------- 1 | include "codeg.out" 'CODE'; 2 | include "messages.out" 'STR#'; 3 | include "bundle.out"; 4 | include "about.out"; 5 | include "dialogs.out"; 6 | include "menus.out"; 7 | -------------------------------------------------------------------------------- /mac/args.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | extern char *bws_arg; 4 | extern char *wsp_arg; 5 | #ifndef NDEBUG 6 | extern bool dflag; 7 | #endif 8 | -------------------------------------------------------------------------------- /ex/xref.ex.in: -------------------------------------------------------------------------------- 1 | PUT {} IN text 2 | PUT 'Now is the time' IN text[1] 3 | PUT 'for all good men' IN text[2] 4 | PUT 'to come to the aid' IN text[3] 5 | PUT 'of the party' IN text[4] 6 | XREF text 7 | -------------------------------------------------------------------------------- /ex/xref.ex/perm.abc: -------------------------------------------------------------------------------- 1 | {["1OUTPUT"]:"output.cmd";["1SAVE"]:"save.cmd";["1XREF"]:"xref.cmd";["3words"]:"words.mfd";["6alphabetic"]:"alphabet.mpd";["8text"]:"text.cts";["8xtab"]:"xtab.cts";[":"]:"3words"} 2 | -------------------------------------------------------------------------------- /atari/main.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | Visible Porting long filemodtime(); 4 | Visible Porting Procedure freepath(); 5 | Visible Porting char *curdir(); 6 | -------------------------------------------------------------------------------- /unix/main.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | Visible Porting long filemodtime(); 4 | Visible Porting Procedure freepath(); 5 | Visible Porting char *curdir(); 6 | -------------------------------------------------------------------------------- /ex/hanoi.ex.out: -------------------------------------------------------------------------------- 1 | Move piece 1 from 1 to 2 2 | Move piece 2 from 1 to 3 3 | Move piece 1 from 2 to 3 4 | Move piece 3 from 1 to 2 5 | Move piece 1 from 3 to 1 6 | Move piece 2 from 3 to 2 7 | Move piece 1 from 1 to 2 8 | -------------------------------------------------------------------------------- /ex/try/perm.abc: -------------------------------------------------------------------------------- 1 | {["1ANALYZE"]:"analyze.cmd";["1FILL"]:"fill.cmd";["1GENERATE"]:"generate.cmd";["1START"]:"start.cmd";["8enders"]:"enders.cts";["8followers"]:"follower.cts";["8starters"]:"starters.cts";[":"]:"1START"} 2 | -------------------------------------------------------------------------------- /msdos/Modules.keys: -------------------------------------------------------------------------------- 1 | keydef.obj+ 2 | keyhlp.obj+ 3 | b1file.obj+ 4 | b1memo.obj+ 5 | b1mess.obj+ 6 | e1getc.obj+ 7 | file.obj+ 8 | keys.obj+ 9 | trm.obj+ 10 | os.obj 11 | abckeys.exe 12 | abckeys.map 13 | 14 | 15 | -------------------------------------------------------------------------------- /mac/defs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | #define MAXHIST 21 /* One more than the number of UNDO's allowed. */ 4 | 5 | #define SUGGBUFSIZE 128 6 | #define NSUGGSIZE 64 7 | 8 | -------------------------------------------------------------------------------- /ex/generate.ex/perm.abc: -------------------------------------------------------------------------------- 1 | {["1ANALYZE"]:"analyze.cmd";["1FILL"]:"fill.cmd";["1GENERATE"]:"generate.cmd";["1START"]:"start.cmd";["8enders"]:"enders.cts";["8followers"]:"follower.cts";["8starters"]:"starters.cts";[":"]:"1GENERATE"} 2 | -------------------------------------------------------------------------------- /ihdrs/i3typ.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* Type matching */ 4 | 5 | typedef value btype; 6 | btype valtype(); 7 | btype loctype(); 8 | /* Procedure must_agree(); */ 9 | 10 | -------------------------------------------------------------------------------- /mac/README: -------------------------------------------------------------------------------- 1 | The file macabc.sit.hqx is a binhexed version of a StuffIt archive 2 | that contains the application MacABC, the MacWrite file macabc.doc 3 | and the (MacWrite) TEXT file macabc.help. 4 | It is suitable for mail/sendnews. 5 | -------------------------------------------------------------------------------- /ex/xref.ex/xref.cmd: -------------------------------------------------------------------------------- 1 | HOW TO XREF text: 2 | SHARE xtab 3 | PUT {} IN xtab 4 | FOR line IN keys text: 5 | TREAT.LINE 6 | OUTPUT xtab 7 | TREAT.LINE: 8 | FOR word IN words text[line]: 9 | SAVE word AT line 10 | -------------------------------------------------------------------------------- /msdos/main.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | Visible Porting long filemodtime(); 4 | Visible Porting Procedure freepath(); 5 | Visible Porting char *curdir(); 6 | 7 | #define DRIVE_SEP ':' 8 | -------------------------------------------------------------------------------- /bed/MF: -------------------------------------------------------------------------------- 1 | all: e1cell.o e1code.o e1comm.o e1deco.o e1edit.o e1edoc.o e1erro.o e1eval.o e1getc.o e1goto.o e1gram.o e1help.o e1ins2.o e1inse.o e1lexi.o e1line.o e1move.o e1node.o e1outp.o e1que1.o e1que2.o e1save.o e1scrn.o e1spos.o e1sugg.o e1supr.o e1tabl.o e1wide.o 2 | -------------------------------------------------------------------------------- /mac/m1edit.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* edit via another editor */ 4 | 5 | #include "b.h" 6 | #include "main.h" 7 | 8 | Visible Procedure ed_file(string fname, intlet line, bool *changed) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /ch_mach: -------------------------------------------------------------------------------- 1 | : 'Check if we are cross compiling' 2 | 3 | case $1 in 4 | '') exit 0;; 5 | *) echo "Please compile and run mkmach on the destination machine" 6 | echo "and copy the results to ./$2." 7 | echo "Then call 'make all install'" 8 | echo " " 9 | exit 1;; 10 | esac 11 | -------------------------------------------------------------------------------- /ex/try/generate.cmd: -------------------------------------------------------------------------------- 1 | HOW TO GENERATE: 2 | SHARE followers, starters, enders 3 | PUT choice starters IN c1, c2 4 | WRITE c1^c2 5 | WHILE c2 not.in enders: 6 | PUT choice followers[c1, c2] IN c3 7 | WRITE c3 8 | PUT c2, c3 IN c1, c2 9 | WRITE / 10 | -------------------------------------------------------------------------------- /ex/generate.ex/generate.cmd: -------------------------------------------------------------------------------- 1 | HOW TO GENERATE: 2 | SHARE followers, starters, enders 3 | PUT choice starters IN c1, c2 4 | WRITE c1^c2 5 | WHILE c2 not.in enders: 6 | PUT choice followers[c1, c2] IN c3 7 | WRITE c3 8 | PUT c2, c3 IN c1, c2 9 | WRITE / 10 | -------------------------------------------------------------------------------- /bhdrs/getopt.h: -------------------------------------------------------------------------------- 1 | extern int opterr; /* no error messages if zero */ 2 | extern int optopt; /* option letter found */ 3 | extern int optind; /* argv index of next argument */ 4 | extern char *optarg; /* start of option argument */ 5 | 6 | extern int getopt(); /* returns option letter or '?' or EOF */ 7 | -------------------------------------------------------------------------------- /ex/xref.ex.out: -------------------------------------------------------------------------------- 1 | Now 1 2 | aid 3 3 | all 2 4 | come 3 5 | for 2 6 | good 2 7 | is 1 8 | men 2 9 | of 4 10 | party 4 11 | the 1 3 4 12 | time 1 13 | to 3 3 14 | -------------------------------------------------------------------------------- /mac/sys_stat.h: -------------------------------------------------------------------------------- 1 | struct stat { 2 | unsigned short st_mode; 3 | unsigned long st_size; 4 | unsigned long st_mtime; 5 | }; 6 | 7 | #define S_IFMT 0170000l 8 | #define S_IFDIR 0040000l 9 | #define S_IFREG 0100000l 10 | #define S_IREAD 0400 11 | #define S_IWRITE 0200 12 | #define S_IEXEC 0100 13 | -------------------------------------------------------------------------------- /mac/dir.h: -------------------------------------------------------------------------------- 1 | /* 2 | * "Dir.h" for the Macintosh. 3 | */ 4 | 5 | #define MAXNAMLEN 31 6 | #define MAXPATH 256 7 | 8 | #define DIR struct _dir 9 | 10 | struct _dir { 11 | long dirid; 12 | int nextfile; 13 | }; 14 | 15 | struct direct { 16 | char d_name[MAXPATH]; 17 | }; 18 | 19 | DIR *opendir(); 20 | struct direct *readdir(); 21 | closedir(); -------------------------------------------------------------------------------- /ihdrs/i3scr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* screen */ 4 | 5 | extern value iname; 6 | extern bool outeractive; 7 | extern bool at_nwl; 8 | extern bool Eof; 9 | extern FILE *ifile; 10 | extern FILE *sv_ifile; 11 | extern char *get_line(); 12 | extern char q_answer(); 13 | extern char *getfmtbuf(); 14 | 15 | -------------------------------------------------------------------------------- /ehdrs/code.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | extern char code_array[]; 4 | extern char invcode_array[]; 5 | extern int lastcode; 6 | 7 | extern Procedure initcodes(); 8 | 9 | #define RANGE 128 /* ASCII characters are in {0 .. RANGE-1} */ 10 | 11 | #define Code(c) code_array[c] 12 | #define Invcode(code) invcode_array[code] 13 | -------------------------------------------------------------------------------- /mac/musync.c: -------------------------------------------------------------------------------- 1 | /* The equivalent of the Unix 'sync' system call: FlushVol. 2 | For now, we only flush the default volume 3 | (since that's the only volume written to by MacB). */ 4 | 5 | #include "macdefs.h" 6 | 7 | int 8 | sync() 9 | { 10 | if (FlushVol((char*)NULL, 0) == noErr) 11 | return 0; 12 | else { 13 | errno= ENODEV; 14 | return -1; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ihdrs/i3bws.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | extern char *bwsdir; 4 | extern value ws_group; 5 | extern bool groupchanges; 6 | extern value curwskey; 7 | extern value lastwskey; 8 | extern value cur_ws; 9 | #ifdef WSP_DIRNAME 10 | value abc_wsname(); 11 | #endif 12 | extern char *cur_dir; /* absolute path to current workspace */ 13 | -------------------------------------------------------------------------------- /ihdrs/i3sta.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | Visible Procedure formula(); 4 | Visible Procedure proposition(); 5 | 6 | extern parsetree pc; /* 'Program counter', current parsetree node */ 7 | extern parsetree next; /* Next parsetree node (changed by jumps) */ 8 | extern bool report; /* 'Condition code register', outcome of last test */ 9 | -------------------------------------------------------------------------------- /readyn.orig: -------------------------------------------------------------------------------- 1 | : 'Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990.' 2 | : 3 | : 'read yes or no [default no]' 4 | 5 | n=$1 c=$2 6 | 7 | while true 8 | do 9 | read ans 10 | case $ans in 11 | y|Y|t|T|yes|Yes|YES|true|True|TRUE) exit 0;; 12 | ''|n|N|f|F|no|No|NO|false|False|FALSE) exit 1;; 13 | *) echo $n "Please answer with yes or no $c" 14 | esac 15 | done 16 | -------------------------------------------------------------------------------- /bhdrs/bcom.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | /* communication between interpreter and editor */ 4 | 5 | #define R_cmd 'c' /* command */ 6 | #define R_expr 'e' /* EG expression */ 7 | #define R_raw 'r' /* RAW expression */ 8 | #define R_ioraw 'i' /* RAW expression for abc_input */ 9 | #define R_answer 'q' /* Yes/No */ 10 | 11 | 12 | -------------------------------------------------------------------------------- /ex/try/start.cmd: -------------------------------------------------------------------------------- 1 | HOW TO START: 2 | SHARE followers, starters, enders 3 | PUT {}, {}, {} IN followers, starters, enders 4 | SET RANDOM 'Do sample.' 5 | READ line RAW 6 | WRITE line / 7 | WHILE line <> '': 8 | ANALYZE line 9 | READ line RAW 10 | WRITE line / 11 | FOR i IN {1..3}: 12 | FOR j IN {1..4}: 13 | GENERATE 14 | WRITE / 15 | -------------------------------------------------------------------------------- /ex/generate.ex/start.cmd: -------------------------------------------------------------------------------- 1 | HOW TO START: 2 | SHARE followers, starters, enders 3 | PUT {}, {}, {} IN followers, starters, enders 4 | SET RANDOM 'Do sample.' 5 | READ line RAW 6 | WRITE line / 7 | WHILE line <> '': 8 | ANALYZE line 9 | READ line RAW 10 | WRITE line / 11 | FOR i IN {1..3}: 12 | FOR j IN {1..4}: 13 | GENERATE 14 | WRITE / 15 | -------------------------------------------------------------------------------- /btr/etex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | extern int e_length(); 4 | extern value mk_etext(); 5 | extern char e_ncharval(); 6 | extern string e_strval(); 7 | extern string e_sstrval(); 8 | /* extern Procedure e_fstrval(); */ 9 | extern value e_icurtail(); 10 | extern value e_ibehead(); 11 | extern value e_concat(); 12 | /* extern Procedure e_concto(); */ 13 | -------------------------------------------------------------------------------- /ex/try/analyze.cmd: -------------------------------------------------------------------------------- 1 | HOW TO ANALYZE line: 2 | SHARE followers, starters, enders 3 | IF #line>2: 4 | PUT line item 1, line item 2 IN c1, c2 5 | INSERT c1, c2 IN starters 6 | INSERT line@#line IN enders 7 | FOR c3 IN line@3: 8 | IF (c1, c2) not.in keys followers: 9 | PUT {} IN followers[c1,c2] 10 | INSERT c3 IN followers[c1, c2] 11 | PUT c2, c3 IN c1, c2 12 | -------------------------------------------------------------------------------- /msdos/dir.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* 4 | * Interface for MS-DOS version of UNIX directory access package. 5 | * (opendir, readdir, closedir). 6 | */ 7 | 8 | struct direct { 9 | char d_namlen; 10 | char d_name[13]; 11 | }; 12 | 13 | typedef char DIR; 14 | 15 | Visible DIR *opendir(); 16 | Visible struct direct *readdir(); 17 | Visible Procedure closedir(); 18 | -------------------------------------------------------------------------------- /ex/generate.ex/analyze.cmd: -------------------------------------------------------------------------------- 1 | HOW TO ANALYZE line: 2 | SHARE followers, starters, enders 3 | IF #line>2: 4 | PUT line item 1, line item 2 IN c1, c2 5 | INSERT c1, c2 IN starters 6 | INSERT line@#line IN enders 7 | FOR c3 IN line@3: 8 | IF (c1, c2) not.in keys followers: 9 | PUT {} IN followers[c1,c2] 10 | INSERT c3 IN followers[c1, c2] 11 | PUT c2, c3 IN c1, c2 12 | -------------------------------------------------------------------------------- /ihdrs/i3in2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* Interpreter utilities */ 4 | 5 | value v_local(); 6 | value v_global(); 7 | loc local_loc(); 8 | loc global_loc(); 9 | loc trim_loc(); 10 | loc tbsel_loc(); 11 | value pre_fun(); 12 | extern value resval; 13 | 14 | value evalthread(); 15 | 16 | #define Changed_formal(v) (v == Vnil || !Is_indirect(v)) 17 | 18 | value locvalue(); 19 | -------------------------------------------------------------------------------- /mac/osconf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | /* Operating system dependent ABC configuration */ 4 | /* This contains the things ../mkconfig.c needs */ 5 | 6 | #include 7 | 8 | typedef unsigned char literal; /* to emphasize meaning only */ 9 | 10 | typedef short reftype; /* type used for reference counts */ 11 | #define Maxrefcnt Maxintlet /* Maxintlet is calculated in config.h */ 12 | -------------------------------------------------------------------------------- /bhdrs/bgfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Shared data between graphics routines. 3 | */ 4 | 5 | typedef struct ivector { 6 | int x; 7 | int y; 8 | } ivector; 9 | 10 | extern ivector dev_origin; /* Lower left corner of device */ 11 | extern ivector dev_corner; /* Upper right corner of device */ 12 | 13 | extern bool enter_gfx(); 14 | extern exit_gfx(); 15 | 16 | extern int gfx_mode; 17 | #define TEXT_MODE 1 18 | #define GFX_MODE 2 19 | #define SPLIT_MODE 3 20 | -------------------------------------------------------------------------------- /ex/xref.ex/words.mfd: -------------------------------------------------------------------------------- 1 | HOW TO RETURN words line: 2 | PUT {} IN list 3 | TO.WORD.START 4 | WHILE line > "": 5 | PUT line|1, line@2 IN word, line 6 | TO.WORD.END 7 | INSERT word IN list 8 | TO.WORD.START 9 | RETURN list 10 | TO.WORD.START: 11 | WHILE line > "" AND NOT alphabetic line|1: 12 | PUT line@2 IN line 13 | TO.WORD.END: 14 | WHILE alphabetic line|1: 15 | PUT word^line|1, line@2 IN word, line 16 | -------------------------------------------------------------------------------- /tc/tc1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tc1 [term] 3 | * dummy program to test termlib. 4 | * gets entry, counts it, and prints it. 5 | */ 6 | #include 7 | char buf[1024]; 8 | char *getenv(); 9 | 10 | main(argc, argv) char **argv; { 11 | char *p; 12 | int rc; 13 | 14 | if (argc < 2) 15 | p = getenv("TERM"); 16 | else 17 | p = argv[1]; 18 | rc = tgetent(buf,p); 19 | printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf); 20 | } 21 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | -- Jan-Hein B\"uhrman 19911018 2 | 3 | When you enter `abc -e' and enters your favorite editor (in my case `vi'), 4 | the terminal is not left in a completely sane state (I suspect that at least 5 | the LF -> CR/LF translation is not reset). 6 | 7 | The on-line Unix manual don't know how to deal with `.IR'-macros. 8 | 9 | Mac: initial editor error message is misplaced on the screen 10 | 11 | All: THe BTrees modules doesn't work on 64 bit systems 12 | -------------------------------------------------------------------------------- /generic/main.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Generic version, as basis for porting. 4 | * See Portability Guide (./PORTING.DOC) for details. 5 | */ 6 | 7 | /* In this file you can put your external definitions of functions, 8 | which are only used inside this directory */ 9 | 10 | Visible Porting long filemodtime(); 11 | Visible Porting Procedure freepath(); 12 | Visible Porting char *curdir(); 13 | -------------------------------------------------------------------------------- /atari/sig.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Handle interrupts */ 4 | 5 | #include "b.h" 6 | 7 | #ifdef SIGNAL 8 | 9 | #include 10 | 11 | Visible bool intrptd= No; /* currently not used */ 12 | 13 | Hidden SIGTYPE intsig(int sig) 14 | { 15 | signal(SIGINT, intsig); 16 | intrptd= Yes; 17 | } 18 | 19 | Visible Procedure initsig() { 20 | signal(SIGINT, intsig); 21 | } 22 | 23 | #endif /* SIGNAL */ 24 | 25 | 26 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | FAULTY PROGRAM: abc 2 | 3 | DESCRIPTION OF FAULT: 4 | if '~/abc' are shared between both UNIX and MSDOS a prolem occurs. 5 | MSDOS replaces 'LF' created by UNIX with 'CRLF' so that UNIX can't read 6 | '~/abc' 7 | any more without converting them back to UNIX 'LF' end-of-line-character 8 | (s). 9 | 10 | FIX: 11 | let unix ignore any 'CR' while reading files. 12 | 13 | ------ 14 | 15 | Issue new version with floorf replaced with floor_f 16 | -------------------------------------------------------------------------------- /btr/i1tlt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* Private definitions for B texts, lists and tables */ 4 | 5 | typedef struct telita { 6 | HEADER; btreeptr root; 7 | } a_telita, *telita; 8 | 9 | #define Itemtype(v) (((telita) (v))->len) /* Itemtype */ 10 | #define Root(v) (((telita) (v))->root) 11 | #define Tltsize(v) (Root(v) EQ Bnil ? 0 : Size(Root(v))) 12 | 13 | #define Character(v) ((bool) (Type(v) EQ Tex && Tltsize(v) EQ 1)) 14 | -------------------------------------------------------------------------------- /doc/BugReport: -------------------------------------------------------------------------------- 1 | Bug report from 2 | 3 | Name: 4 | Firm/Institute: 5 | Address: 6 | Telephone: 7 | Email address: 8 | 9 | Machine Type: 10 | Operating System: 11 | ABC Release: 1.05.01. 12 | 13 | Faulty program: 14 | 15 | Description of fault: 16 | 17 | Repeat by: 18 | 19 | ========================================================================== 20 | Send to 21 | ABC Group 22 | CWI / AA 23 | POB 4079 24 | 1009 AB Amsterdam 25 | The Netherlands 26 | 27 | or by electronic mail to abc@cwi.nl 28 | -------------------------------------------------------------------------------- /generic/dir.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Generic version, as basis for porting. 4 | * See Portability Guide (./PORTING.DOC) for details. 5 | */ 6 | 7 | #include "b.h" 8 | 9 | #ifndef HAS_READDIR 10 | 11 | #include "dir.h" 12 | 13 | Visible DIR * opendir(char *name) 14 | { 15 | } 16 | 17 | Visible struct direct * readdir(DIR *dirp) 18 | { 19 | } 20 | 21 | Visible Procedure closedir(DIR *dirp) 22 | { 23 | } 24 | 25 | #endif /* !HAS_READDIR */ 26 | -------------------------------------------------------------------------------- /bhdrs/bmem.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* B memory management */ 4 | 5 | typedef char *ptr; 6 | #define Nil ((ptr) 0) 7 | 8 | ptr getmem(); 9 | ptr savestr(); 10 | #define freestr(s) (freemem((ptr)(s))) 11 | 12 | #ifdef MEMTRACE 13 | typedef unsigned long address; /* for PC and symbol table (on a tahoe) */ 14 | #define F_ALLOC 'A' 15 | #define F_FREE 'F' 16 | #endif 17 | 18 | struct bufadm {char *buf, *pbuf, *end; }; 19 | typedef struct bufadm bufadm; 20 | -------------------------------------------------------------------------------- /ex/pi.ex/pi.cmd: -------------------------------------------------------------------------------- 1 | HOW TO PI n': 2 | \Print the first n places of pi. a, b, c and d get very large. 3 | WRITE '3.' 4 | PUT n' IN n 5 | PUT 3, 0, 40, 4, 24, 0, 1 IN k, a, b, c, d, e, f 6 | WHILE n>0: 7 | WHILE e=f AND n>0: 8 | WRITE e<<1 9 | PUT n-1 IN n 10 | PUT 10*(a-e*c), 10*(b-f*d) IN a, b 11 | PUT floor(a/c), floor(b/d) IN e, f 12 | PUT k**2, 2*k+1, k+1 IN p, q, k 13 | PUT b, p*a+q*b, d, p*c+q*d IN a, b, c, d 14 | PUT f, floor(b/d) IN e, f 15 | WRITE / 16 | -------------------------------------------------------------------------------- /mac/rez.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | /* general defines, also usable in Rez .r files */ 4 | 5 | #define ABOUTPICTID 128 /* Resource ID of About.. picture */ 6 | 7 | #define MACERRALERT 128 8 | #define MEMEXHALERT 129 9 | 10 | #define NEWLOCDLOG 256 11 | #define LOCATIONDLOG 257 12 | #define HOWTODLOG 258 13 | 14 | #define OKREPLACEALERT 192 15 | 16 | #define PRINTDLOG 259 17 | #define PRABORTALERT 260 18 | 19 | #define OKITEM 1 20 | #define CANCELITEM 2 21 | #define EDITITEM 3 22 | -------------------------------------------------------------------------------- /ex/generate.ex.out: -------------------------------------------------------------------------------- 1 | Mary had a little lamb, 2 | Its fleece was white as snow, 3 | And everywhere that Mary went, 4 | That lamb was sure to go. 5 | 6 | Its whittle as whittle that lamb, 7 | Marywhittleece to go. 8 | Its sure as snow, 9 | That Mary wherywhery was went, 10 | 11 | That Mary hat Marywhere to go. 12 | Its was sure that lamb was fle lamb, 13 | Its snow, 14 | Its sure lite to go. 15 | 16 | And a lite went, 17 | And evere a lite to go. 18 | And evere where thad every was was where to go. 19 | Mary where thad a lamb was went, 20 | 21 | -------------------------------------------------------------------------------- /ukeys/abcxterm.key: -------------------------------------------------------------------------------- 1 | # entry for running abc in an Xterm window: 2 | # function and arrow keys should come from termcap(5) (k1-k9, ku, kd, kl, kr) 3 | [delete] = "\177" = "Delete" 4 | # mouse handling: 5 | [mouse] = "\033[M\"" = "r-click" 6 | [mouse] = "\033[M!" = "m-" 7 | [mouse] = "\033[M " = "l-" 8 | [mouse-format] = "%r%+!%+!" = "mouse-format" 9 | # make mouse behave apropriate: 10 | [term-init] = "\033[?1h\033=\033[?9h" = "enable mouse" 11 | [term-done] = "\033[?1l\033>\033[?9l" = "unenable mouse" 12 | -------------------------------------------------------------------------------- /readyn: -------------------------------------------------------------------------------- 1 | : 'Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990.' 2 | : 3 | : 'read yes or no [default no] to message $1' 4 | 5 | : 'Determine if echo -n works' 6 | case `echo -n foo` in 7 | -n*) n="" c='\c';; 8 | *) n=-n c="";; 9 | esac 10 | 11 | echo " " 12 | echo $n "$1 [no] $c" 13 | while true 14 | do 15 | read ans 16 | case $ans in 17 | y|Y|t|T|yes|Yes|YES|true|True|TRUE) exit 0;; 18 | ''|n|N|f|F|no|No|NO|false|False|FALSE) exit 1;; 19 | *) echo "Please answer with yes or no." 20 | echo $n "$1 [no] $c" 21 | esac 22 | done 23 | -------------------------------------------------------------------------------- /ehdrs/queu.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* 4 | * B editor -- Definitions for queues of nodes. 5 | */ 6 | 7 | typedef struct queue *queue; 8 | 9 | struct queue { 10 | HEADER; 11 | node q_data; 12 | queue q_link; 13 | }; 14 | 15 | #define Qnil ((queue) Vnil) 16 | #ifdef lint 17 | Visible queue qcopy(); 18 | Visible Procedure qrelease(); 19 | #else 20 | #define qcopy(q) ((queue)copy((value)q)) 21 | #define qrelease(q) release((value)q) 22 | #endif 23 | #define emptyqueue(q) (!(q)) 24 | 25 | node queuebehead(); 26 | -------------------------------------------------------------------------------- /ehdrs/getc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | extern Procedure initkeys(); 4 | 5 | typedef struct tabent { 6 | int code; 7 | int deflen; 8 | string def; 9 | string rep; 10 | string name; 11 | } tabent; 12 | 13 | extern struct tabent deftab[]; 14 | extern int ndefs; /* number of entries in deftab */ 15 | extern Procedure addkeydef(); 16 | 17 | #ifdef KEYS 18 | 19 | #define MAXDEFS 200 20 | 21 | #else 22 | 23 | #define MAXDEFS 100 24 | extern Procedure initgetc(); 25 | extern Procedure endgetc(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /generic/dir.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Generic version, as basis for porting. 4 | * See Portability Guide (./PORTING.DOC) for details. 5 | */ 6 | 7 | #ifdef HAS_READDIR 8 | 9 | #include 10 | 11 | #else /* !HAS_READDIR */ 12 | 13 | struct direct { 14 | char d_name[ /* some value */ ]; 15 | /* other fields */ 16 | }; 17 | 18 | typedef /* whatever */ DIR; 19 | 20 | Visible DIR *opendir(); 21 | Visible struct direct *readdir(); 22 | Visible Procedure closedir(); 23 | 24 | #endif /* !HAS_READDIR */ 25 | -------------------------------------------------------------------------------- /ex/hanoi.ex/hanoi.cmd: -------------------------------------------------------------------------------- 1 | HOW TO HANOI n: 2 | INITIALISE 3 | FOR i IN {1..(2**n)-1}: 4 | SELECT.PROCESS 5 | WRITE 'Move piece', piece, 'from', from, 'to', to / 6 | RE.SCHEDULE 7 | INITIALISE: 8 | PUT {} IN process 9 | FOR i IN {1..n}: 10 | INSERT 2**(i-1), i, 1, (-1)**(i+n), 2**i IN process 11 | SELECT.PROCESS: 12 | PUT min process IN time, piece, from, direction, wait 13 | REMOVE min process FROM process 14 | RE.SCHEDULE: 15 | INSERT time+wait, piece, to, direction, wait IN process 16 | to: 17 | RETURN ((from+direction-1) mod 3) + 1 18 | -------------------------------------------------------------------------------- /atari/dir.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | #ifdef HAS_READDIR 4 | 5 | #include 6 | 7 | #else /* !HAS_READDIR */ 8 | 9 | /* 10 | * "dir.h" voor de Atari ST (Mark Williams C) 11 | */ 12 | 13 | #define MAXNAMLEN 31 14 | #define MAXPATH 256 15 | 16 | #define DIR struct _dir 17 | 18 | struct _dir { 19 | int flags; 20 | char name[MAXNAMLEN]; 21 | }; 22 | 23 | struct direct { 24 | char d_name[MAXPATH]; 25 | }; 26 | 27 | Visible DIR *opendir(); 28 | Visible struct direct *readdir(); 29 | Visible Procedure closedir(); 30 | 31 | #endif /* !HAS_READDIR */ 32 | -------------------------------------------------------------------------------- /ihdrs/i2gen.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | #define Is_node(t) ((t) != NilTree && Is_parsetree(t)) 4 | 5 | extern int nextvarnumber; /* Counts local targets (including formals) */ 6 | extern value locals, globals, mysteries, refinements; 7 | extern string gentab[]; 8 | 9 | struct state { 10 | parsetree h_last; 11 | parsetree *h_wanthere; 12 | parsetree h_bpchain; 13 | }; 14 | 15 | #define f_expr(p) fix(p, 'v') /* "evaluate" */ 16 | #define f_targ(p) fix(p, 'l') /* "locate" */ 17 | 18 | Visible value copystddef(); 19 | Visible bool modify_tag(); 20 | Visible bool is_name(); 21 | -------------------------------------------------------------------------------- /ch_all: -------------------------------------------------------------------------------- 1 | : 'Check if make all went allright.' 2 | 3 | destroot="$1" 4 | 5 | errors="no" 6 | 7 | echo " " 8 | 9 | for f in abc abckeys 10 | do 11 | if test ! -s $f 12 | then 13 | echo "*** Failed to make $f" 14 | errors="yes" 15 | fi 16 | done 17 | 18 | case $errors in 19 | yes) 20 | exit 1 21 | ;; 22 | no) 23 | case $destroot in 24 | '') echo "The 'abc' command should now work." 25 | echo "You can test the ABC interpreter with 'make examples'." 26 | ;; 27 | *) echo "That 'make all' went well." 28 | echo "Say 'make install' to install the ABC system in $destroot." 29 | ;; 30 | esac 31 | exit 0 32 | ;; 33 | esac 34 | -------------------------------------------------------------------------------- /generic/sig.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Generic version, as basis for porting. 4 | * See Portability Guide (./PORTING.DOC) for details. 5 | */ 6 | 7 | /* Handle signals */ 8 | 9 | #include "b.h" 10 | 11 | #ifdef SIGNAL 12 | 13 | #include 14 | 15 | Visible bool intrptd = No; 16 | 17 | Hidden SIGTYPE intsig(sig) 18 | int sig; /* sig == SIGINT */ 19 | { 20 | intrptd = Yes; 21 | signal(sig, intsig); 22 | } 23 | 24 | Visible Procedure initsig() 25 | { 26 | signal(SIGINT, intsig); /* interrupt */ 27 | } 28 | 29 | #endif /* SIGNAL */ 30 | 31 | -------------------------------------------------------------------------------- /mac/macdefs.h: -------------------------------------------------------------------------------- 1 | /* Useful #includes and #defines for programming a set of Unix 2 | look-alike file system access functions on the Macintosh. */ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | /* Macro to find out whether we can do HFS-only calls: */ 11 | #define FSFCBLen (* (short *) 0x3f6) 12 | #define hfsrunning() (FSFCBLen > 0) 13 | 14 | /* Universal constants: */ 15 | #define MAXPATH 256 16 | #define TRUE 1 17 | #define FALSE 0 18 | #define NULL 0 19 | #define EOS '\0' 20 | #define SEP ':' 21 | 22 | /* Call Macsbug: */ 23 | pascal void Debugger() extern 0xA9FF; 24 | -------------------------------------------------------------------------------- /boot/alloc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | /* 4 | * Allocate the arrays holding the tables. 5 | */ 6 | 7 | #include "b.h" 8 | #include "main.h" 9 | 10 | Visible Procedure allocate_tables() { 11 | 12 | symdef= (struct syminfo *) 13 | getmem((unsigned) maxsym*sizeof(struct syminfo)); 14 | 15 | classdef= (struct classinfo *) 16 | getmem((unsigned) maxclass*sizeof(struct classinfo)); 17 | 18 | lexdef= (struct lexinfo *) 19 | getmem((unsigned) maxlex*sizeof(struct lexinfo)); 20 | 21 | namelist= (struct nameinfo *) 22 | getmem((unsigned) maxname*sizeof(struct nameinfo)); 23 | } 24 | -------------------------------------------------------------------------------- /ehdrs/gram.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* 4 | * Routines defined in "gram.c". 5 | */ 6 | 7 | string *noderepr(); 8 | node gram(); 9 | node suggestion(); 10 | node variable(); 11 | string symname(); 12 | bool allows_colon(); 13 | 14 | /* 15 | * Macros for oft-used functions. 16 | */ 17 | 18 | #define Fwidth(str) ((str) ? fwidth(str) : 0) 19 | 20 | #define Fw_zero(str) (!(str) || strchr("\b\t", (str)[0])) 21 | #define Fw_positive(str) ((str) && (str)[0] >= ' ') 22 | #define Fw_negative(str) ((str) && (str)[0] == '\n') 23 | 24 | #define MAXNBUILTIN 50 /* should be calculated by boot/mktable */ 25 | -------------------------------------------------------------------------------- /atari/CREATE: -------------------------------------------------------------------------------- 1 | # Creation guide of the ABC binaries for the Atari via the cross compiler. 2 | # 3 | # First, compile mkmach.c with the cross compiler, run it on the Atari and 4 | # store the output in the file mach.h 5 | # 6 | # Call mkmf.cross for the atari in the parent directory to create 7 | # the Makefiles for abc and abckeys in the directories ./objects and 8 | # ./objects/keys. 9 | # Move to directory ./objects and call '/usr/local/gnu/make all' to create 10 | # the binaries abc.tos and abckeys.tos. 11 | 12 | cd .. 13 | scripts/mkmf.cross atari 14 | cd atari/objects 15 | /usr/local/gnu/make all 16 | /usr/local/gnu/make messages 17 | /usr/local/gnu/make clean 18 | -------------------------------------------------------------------------------- /ukeys/abc2640b.key: -------------------------------------------------------------------------------- 1 | # HP 2640b terminal 2 | [widen] = "\033p" = "Cntl-f1" 3 | [extend] = "\033q" = "Cntl-f2" 4 | [first] = "\033r" = "Cntl-f3" 5 | [last] = "\033s" = "Cntl-f4" 6 | # because arrow keys are drawn on the keyboards keys: 7 | [up] = "\033t" = "Cntl-f5" 8 | [down] = "\033u" = "Cntl-f6" 9 | [left] = "\033v" = "Cntl-f7" 10 | [right] = "\033w" = "Cntl-f8" 11 | # which leaves the following undefined: 12 | [previous] = "\033[" = "ESC-[" 13 | [next] = "\033]" = "ESC-]" 14 | [upline] = "\033k" = "ESC-k" 15 | [downline] = "\033j" = "ESC-j" 16 | # cursor sense: 17 | [cursor-sense] = "\e`\021" = "" 18 | [cursor-format] = "\e&a%r%dc%dY\015" = "" -------------------------------------------------------------------------------- /mac/m1time.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1989. */ 2 | 3 | #include "b.h" 4 | #include "bobj.h" 5 | #include "i1num.h" 6 | 7 | #include 8 | #include 9 | 10 | Visible value nowisthetime() { 11 | long ttt; 12 | DateTimeRec date; 13 | value now; 14 | 15 | GetDateTime(&ttt); 16 | Secs2Date(ttt, &date); 17 | 18 | now= mk_compound(6); 19 | 20 | *Field(now, 0)= mk_integer(date.year); 21 | *Field(now, 1)= mk_integer(date.month); 22 | *Field(now, 2)= mk_integer(date.day); 23 | *Field(now, 3)= mk_integer(date.hour); 24 | *Field(now, 4)= mk_integer(date.minute); 25 | *Field(now, 5)= mk_integer(date.second); 26 | return now; 27 | } 28 | -------------------------------------------------------------------------------- /msdos/sig.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | /* Handle signals */ 4 | 5 | #include "b.h" 6 | 7 | #ifdef SIGNAL 8 | 9 | #include 10 | #include /* for _fpreset() */ 11 | 12 | Visible bool intrptd = No; 13 | 14 | Hidden SIGTYPE intsig() 15 | { 16 | intrptd = Yes; 17 | signal(SIGINT, intsig); 18 | } 19 | 20 | Hidden SIGTYPE fpesig() 21 | { 22 | signal(SIGFPE, SIG_IGN); 23 | fpe_signal(); 24 | _fpreset(); /* reinitialize floating-point package */ 25 | signal(SIGFPE, fpesig); 26 | } 27 | 28 | Visible Procedure initsig() 29 | { 30 | signal(SIGINT, intsig); 31 | signal(SIGFPE, fpesig); 32 | } 33 | 34 | #endif /* SIGNAL */ 35 | -------------------------------------------------------------------------------- /generic/README: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1991. */ 2 | 3 | This directory 'generic' contains a skeleton version of the routines 4 | in the ABC implementation that we consider non-portable between 5 | different operating systems. Apart from this directory you will need 6 | the editor- and interpreter directories mentioned in ../doc/Structure. 7 | 8 | The file ./PORTING.DOC contains a guide for adapting the routines to your 9 | operating system. 10 | 11 | If your system has a 'make'-like utility for maintaining computer programs, 12 | the template ./Makefile might be helpfull to get started with. If not, 13 | it still can serve as a guide to the files needed, and the steps to be taken. 14 | 15 | Good Luck! 16 | -------------------------------------------------------------------------------- /scripts/mkdep: -------------------------------------------------------------------------------- 1 | : 'Shell script to create dependency lines for inclusion in a Makefile.' 2 | : 'This is done by pulling each file through the C preprocessor,' 3 | : 'filtering all "# 1" lines out and doing some substitutions' 4 | : 'on them. Since the format of these lines may be different on your' 5 | : 'system, you may have to modify the sed command below.' 6 | 7 | : 'The following should invoke your C preprocessor:' 8 | : 'check "man 1 cc" on non-BSD systems' 9 | CPP="cc -E" 10 | 11 | ARGS= 12 | while : 13 | do 14 | case $1 in 15 | -*) ARGS="$ARGS $1"; shift;; 16 | *) break;; 17 | esac 18 | done 19 | 20 | for file 21 | do 22 | obj=`basename $file .c`.o 23 | $CPP $ARGS $file | 24 | sed -n '/^# 1 "\(.*\)".*$/s//'$obj': \1/p' 25 | done 26 | -------------------------------------------------------------------------------- /ukeys/abc2621.key: -------------------------------------------------------------------------------- 1 | # HP2621 terminal 2 | # display screen labels f1-f8 upon startup, config-edit after exit: 3 | [term-init] = "\033&jB" = "" 4 | [term-done] = "\033&jA" = "" 5 | # use first four standard: 6 | [widen] = "\033p\015" = "f1" 7 | [extend] = "\033q\015" = "f2" 8 | [first] = "\033r\015" = "f3" 9 | [last] = "\033s\015" = "f4" 10 | # because arrow keys are drawn on the keyboards keys: 11 | [up] = "\033t\015" = "f5" 12 | [left] = "\033u\015" = "f6" 13 | [right] = "\033v\015" = "f7" 14 | [down] = "\033w\015" = "f8" 15 | # which makes rebind for following four necessary: 16 | [previous] = "\033[" = "ESC-[" 17 | [next] = "\033]" = "ESC-]" 18 | [upline] = "\033k" = "ESC-k" 19 | [downline] = "\033j" = "ESC-j" 20 | -------------------------------------------------------------------------------- /bio/i4inp.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #include "b.h" 4 | #include "bmem.h" 5 | #include "bobj.h" 6 | #include "i4bio.h" 7 | 8 | /* read_table_of_texts */ 9 | 10 | Visible Procedure abcinput(char *name_arg) { 11 | value name; 12 | value tab, v; 13 | value n, m; 14 | bool eoi= No; /* end of input */ 15 | 16 | name= mk_text(name_arg); 17 | if (!is_abcname(name)) { 18 | bioerrV(IO_NAME, name); 19 | release(name); 20 | return; 21 | } 22 | tab= mk_elt(); 23 | n= zero; 24 | while (!eoi) { 25 | eoi= read_ioraw(&v); 26 | if (Valid(v)) { 27 | n= sum(m= n, one); 28 | replace(v, &tab, n); 29 | release(m); release(v); 30 | } 31 | } 32 | still_ok= Yes; interrupted= No; 33 | def_target(name, tab); 34 | release(n); 35 | release(name); 36 | } 37 | -------------------------------------------------------------------------------- /ukeys/abc5620.key: -------------------------------------------------------------------------------- 1 | # Key bindings for the BLIT (TERM=5620). 2 | # Warning: this resets your function keys! 3 | 4 | # Initialize the function keys. 5 | 6 | [term-init]="[5620 PF keys]\r\n\e[1;2q\ew\e[2;2q\ee\e[3;2q\ef\e[4;2q\el\e[5;2q\ep\e[6;2q\en\e[7;2q\eu\e[8;2q\ed" = "" 7 | 8 | # Function key bindings are as in b(1) manual. 9 | # (Should reorder because of 3-2-3 lay-out?) 10 | 11 | [widen] = "\ew" = "f1" 12 | [extend] = "\ee" = "f2" 13 | [first] = "\ef" = "f3" 14 | [last] = "\el" = "f4" 15 | [previous] = "\ep" = "f5" 16 | [next] = "\en" = "f6" 17 | [upline] = "\eu" = "f7" 18 | [downline] = "\ed" = "f8" 19 | 20 | # Find some use for HOME and HOME DOWN keys. 21 | 22 | [upline] = "\e[H" = "Arrow-Home" 23 | [downline] = "\e[70;1H" = "Arrow-Home-Down" 24 | 25 | # Ignore CLEAR key. 26 | 27 | [ignore] = "\e[2J" = "" 28 | -------------------------------------------------------------------------------- /bint2/i2tar.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | #include "b.h" 4 | #include "bint.h" 5 | #include "bobj.h" 6 | #include "i2par.h" 7 | #include "i2nod.h" 8 | 9 | Forward Hidden parsetree singtarg(); 10 | 11 | Visible parsetree targ(txptr q) { 12 | return collateral(q, singtarg); 13 | } 14 | 15 | Hidden parsetree singtarg(txptr q) { 16 | parsetree v; value t; 17 | skipsp(&tx); 18 | if (nothing(q, MESS(2500, "nothing where address expected"))) 19 | return NilTree; 20 | if (open_sign) v= compound(q, targ); 21 | else if (is_tag(&t)) v= node2(TAG, t); 22 | else { 23 | parerr(MESS(2501, "no address where expected")); 24 | tx= q; 25 | return NilTree; 26 | } 27 | selection(q, &v); 28 | trim_target(q, &v); 29 | upto1(q, MESS(2502, "something unexpected in address")); 30 | return v; 31 | } 32 | -------------------------------------------------------------------------------- /ihdrs/i3int.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* Interpreter */ 4 | 5 | value pop(); 6 | /* Procedure push(); */ 7 | 8 | #define Stop ((parsetree)zero) /* Legal stop */ 9 | #define Halt NilTree /* Illegal stop (loose end of code) */ 10 | 11 | extern int call_level; 12 | 13 | #define _Thread(t) *Branch(t, Nbranches(t)) /* Next instruction */ 14 | #define _Thread2(t) *Branch(t, Nbranches(t)+1) /* Alternate next instr. or flag */ 15 | 16 | #ifdef MSDOS 17 | #ifdef M_I86LM 18 | 19 | #define Thread(t) (*_thread(t)) 20 | #define Thread2(t) (*_thread2(t)) 21 | parsetree *_thread(); 22 | parsetree *_thread2(); 23 | 24 | #endif /* M_I86LM */ 25 | #endif /* MSDOS */ 26 | 27 | #ifndef Thread 28 | #define Thread(t) _Thread(t) 29 | #endif 30 | #ifndef Thread2 31 | #define Thread2(t) _Thread2(t) 32 | #endif 33 | -------------------------------------------------------------------------------- /bhdrs/bfil.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #ifdef KEYS 4 | #define NEWKEYSFILE "abc.key" 5 | #endif 6 | 7 | #define PERMFILE "perm.abc" 8 | #define SUGGFILE "suggest.abc" 9 | #define POSFILE "position.abc" 10 | #define TYPESFILE "types.abc" 11 | #define WSGROUPFILE "wsgroup.abc" 12 | 13 | #define TEMPFILE "temp.abc" 14 | #define TEMP1FILE "temp1.abc" 15 | 16 | #define DEFAULT_WS "first" /* default name of startup workspace */ 17 | #define CENTRAL_WS "abc" /* default name of central workspace */ 18 | 19 | extern string permfile; 20 | extern string suggfile; 21 | extern string posfile; 22 | extern string typesfile; 23 | extern string wsgroupfile; 24 | 25 | extern string tempfile; 26 | extern string temp1file; 27 | 28 | /* extern Procedure freepath(); */ 29 | 30 | char *f_getline(); /* return line from file including \n */ 31 | -------------------------------------------------------------------------------- /ex/README: -------------------------------------------------------------------------------- 1 | The subdirectories here represent ABC workspaces, with example ABC how-to's. 2 | 3 | With DoExamples, the ABC interpreter in .. is tested (via the shell 4 | command '../abc') on the following four examples: 5 | 6 | generate generates new sentences based on those supplied 7 | by the user; 8 | hanoi the towers of hanoi; 9 | pi calculates the value of pi, using the unbounded 10 | arithmetic of ABC; 11 | xref a cross reference generator. 12 | 13 | For more information on these programs, see the B Newsletter, Issue 2. 14 | 15 | The ABC editor can only be tested by calling ../abc interactively, as 16 | is done by TryEditor. 17 | For this the 'try' workspace has been created from the 'generate' example, 18 | so you can always regenerate it with: 19 | 20 | cd ./generate 21 | cp * ../try 22 | 23 | The file ../EDITOR tells you how to try the ABC editor. 24 | -------------------------------------------------------------------------------- /readdir.old: -------------------------------------------------------------------------------- 1 | : readdir rootdir default remote message 2 | _rootdir=$1 3 | _default=$2 4 | _remote=$3 5 | _message=$4 6 | 7 | case `echo -n foo` in 8 | -n*) n="" c='\c';; 9 | *) n=-n c="";; 10 | esac 11 | 12 | dir='blurfl' 13 | while test ! -d "$_rootdir$dir" ; do 14 | case $dir in 15 | blurfl) 16 | echo " " 17 | echo "Please type the full pathname of a $_remote directory" 18 | echo "in which you have write permission, where we can install" 19 | echo $_message 20 | echo $n " [default $_default] $c" 21 | ;; 22 | *) echo "$_rootdir$dir does not appear to exist." 23 | if ./readyn "Are you sure you typed the right name?" 24 | then 25 | echo "Don't forget to make $_rootdir$dir before 'make install'." 26 | break 27 | else 28 | echo $n "Please try again [default $_default] $c" 29 | fi 30 | ;; 31 | esac 32 | read dir 33 | case $dir in 34 | "") dir=$_default;; 35 | esac 36 | done 37 | -------------------------------------------------------------------------------- /ex/DoExamples: -------------------------------------------------------------------------------- 1 | # Add new examples by creating a directory -ex, and input commands in -ex.in, and the output as it should be in -ex.out. 2 | WS='*.ex' 3 | OK=yes 4 | 5 | case $1 in 6 | local) abc=../abc;; 7 | *) abc=abc;; 8 | esac 9 | 10 | for ws in $WS 11 | do 12 | echo " " 13 | echo "Testing $ws example ..." 14 | $abc -w ./$ws <$ws.in > out 15 | if cmp -s out $ws.out 16 | then 17 | echo "... $ws example OK ..." 18 | else 19 | OK=no 20 | echo "... $ws example NOT OK ..." 21 | echo "Differences: should-be" 22 | diff out $ws.out 23 | fi 24 | done 25 | 26 | echo " " 27 | case $OK in 28 | no) echo Not all examples ran OK; exit 1;; 29 | yes) 30 | echo All examples ran OK. 31 | case $1 in 32 | local) echo "Now you can try the ABC editor with 'make try_editor'.";; 33 | *) echo "Now you can try the ABC editor with TryEditor.";; 34 | esac 35 | esac 36 | exit 0 37 | -------------------------------------------------------------------------------- /bio/i4lis.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #include "b.h" 4 | #include "bmem.h" 5 | #include "bobj.h" 6 | #include "bfil.h" 7 | #include "i3cen.h" 8 | #include "i3sou.h" 9 | #include "i4bio.h" 10 | 11 | /* list howto's */ 12 | 13 | Visible Procedure abclist(FILE *ofp) { 14 | intlet k, len; 15 | FILE *fp; 16 | value fname; 17 | char *line; 18 | 19 | len= length(cur_env->perm); 20 | for (k= 0; kperm, k); 22 | if (!Is_text(fname) || !unitfile(fname)) 23 | continue; 24 | fp= fopen(strval(fname), "r"); 25 | if (fp == NULL) 26 | continue; 27 | while (!interrupted && (line= f_getline(fp)) != NULL) { 28 | fputs(line, ofp); /* no vtrm, so no CR worries */ 29 | VOID fflush(ofp); 30 | freestr(line); 31 | } 32 | fclose(fp); 33 | putc('\n', ofp); /* no vtrm, so no CR worries */ 34 | VOID fflush(ofp); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /readdir1: -------------------------------------------------------------------------------- 1 | : readdir rootdir default remote message 2 | _rootdir=$1 3 | _default=$2 4 | _remote=$3 5 | _message=$4 6 | 7 | case `echo -n foo` in 8 | -n*) n="" c='\c';; 9 | *) n=-n c="";; 10 | esac 11 | 12 | dir='blurfl' 13 | while test ! -d "$_rootdir$dir" ; do 14 | case $dir in 15 | blurfl) 16 | ( 17 | echo " " 18 | echo "Please type the full pathname of a $_remote directory" 19 | echo "in which you have write permission, where we can install" 20 | echo $_message 21 | echo $n " [default $_default] $c" 22 | ) >&2 23 | ;; 24 | *) echo "$_rootdir$dir does not appear to exist." 25 | if ./readyn "Are you sure you typed the right name?" 26 | then 27 | echo "Don't forget to make $_rootdir$dir before 'make install'." 28 | break 29 | else 30 | echo $n "Please try again [default $_default] $c" 31 | fi 32 | ;; 33 | esac 34 | read dir 35 | case $dir in 36 | "") dir=$_default;; 37 | esac 38 | done 39 | echo $dir 40 | 41 | -------------------------------------------------------------------------------- /bed/e1code.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | /* 4 | * Compaction scheme for characters to save space in grammar tables 5 | * by combining characters with similar properties (digits, l.c. letters). 6 | */ 7 | 8 | #include "b.h" 9 | #include "code.h" 10 | 11 | Visible char code_array[RANGE]; 12 | Visible char invcode_array[RANGE]; 13 | Visible int lastcode= 0; 14 | 15 | Visible Procedure initcodes() { 16 | int c; 17 | 18 | code_array['\n'] = ++lastcode; 19 | invcode_array[lastcode] = '\n'; 20 | for (c = ' '; c <= '0'; ++c) { 21 | code_array[c] = ++lastcode; 22 | invcode_array[lastcode] = c; 23 | } 24 | for (; c <= '9'; ++c) 25 | code_array[c] = lastcode; 26 | for (; c <= 'a'; ++c) { 27 | code_array[c] = ++lastcode; 28 | invcode_array[lastcode] = c; 29 | } 30 | for (; c <= 'z'; ++c) 31 | code_array[c] = lastcode; 32 | for (; c < RANGE; ++c) { 33 | code_array[c] = ++lastcode; 34 | invcode_array[lastcode] = c; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bio/i4bio.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #include "b.h" 4 | #include "bint.h" 5 | #include "bmem.h" 6 | #include "bobj.h" 7 | #include "i2par.h" 8 | #include "i3scr.h" 9 | #include "i3sou.h" 10 | #include "i4bio.h" 11 | #include "port.h" 12 | 13 | Visible Procedure abcio(int type, char *tabname) 14 | { 15 | sv_ifile= ifile= stdin; 16 | 17 | switch (type) { 18 | case abcioInput: 19 | abcinput(tabname); 20 | break; 21 | case abcioOutput: 22 | abcoutput(tabname); 23 | break; 24 | case abcioList: 25 | abclist(stdout); 26 | break; 27 | case abcioPack: 28 | abcpack(stdout); 29 | break; 30 | case abcioWSrecover: 31 | if (!ws_recovered) 32 | rec_workspace(); 33 | break; 34 | case abcioGRrecover: 35 | if (!gr_recovered) 36 | rec_wsgroup(); 37 | break; 38 | } 39 | } 40 | 41 | Visible Procedure bioerr(int m) { 42 | putmess(m); 43 | } 44 | 45 | Visible Procedure bioerrV(int m, value v) { 46 | putSmess(m, strval(v)); 47 | } 48 | -------------------------------------------------------------------------------- /tc/tc2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tc2 [term] 3 | * Dummy program to test out termlib. 4 | * Commands are "tcc\n" where t is type (s for string, f for flag, 5 | * or n for number) and cc is the name of the capability. 6 | */ 7 | #include 8 | char buf[1024]; 9 | char *getenv(), *tgetstr(); 10 | 11 | main(argc, argv) char **argv; { 12 | char *p, *q; 13 | int rc; 14 | char b[3], c; 15 | char area[200]; 16 | 17 | if (argc < 2) 18 | p = getenv("TERM"); 19 | else 20 | p = argv[1]; 21 | rc = tgetent(buf,p); 22 | for (;;) { 23 | c = getchar(); 24 | if (c < 0) 25 | exit(0); 26 | b[0] = getchar(); 27 | if (b[0] < ' ') 28 | exit(0); 29 | b[1] = getchar(); 30 | b[2] = 0; 31 | getchar(); 32 | switch(c) { 33 | case 'f': 34 | printf("%s: %d\n",b,tgetflag(b)); 35 | break; 36 | case 'n': 37 | printf("%s: %d\n",b,tgetnum(b)); 38 | break; 39 | case 's': 40 | q = area; 41 | printf("%s: %s\n",b,tgetstr(b,&q)); 42 | break; 43 | default: 44 | exit(0); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /b/b1file.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #include "b.h" 4 | #include "bfil.h" 5 | #include "bmem.h" 6 | #include "port.h" 7 | 8 | Visible string permfile= PERMFILE; /* saves links file name vs. abc name */ 9 | Visible string suggfile= SUGGFILE; /* saves user suggestions */ 10 | Visible string posfile= POSFILE; /* saves focus positions */ 11 | Visible string typesfile= TYPESFILE; /* saves typecode's */ 12 | Visible string wsgroupfile= WSGROUPFILE; 13 | /* saves links workspace name vs. abc name */ 14 | 15 | Visible string tempfile= TEMPFILE; /* temporary file */ 16 | Visible string temp1file= TEMP1FILE; /* another temporary file */ 17 | 18 | Visible Procedure free_path(char *path) { 19 | if (path != NULL) 20 | freestr(path); 21 | } 22 | 23 | Visible Procedure endfile() 24 | { 25 | #ifdef MEMTRACE 26 | free_path(startdir); 27 | free_path(bwsdefault); 28 | free_path(messfile); 29 | free_path(helpfile); 30 | free_path(keysfile); 31 | free_path(buffile); 32 | #endif 33 | } 34 | 35 | -------------------------------------------------------------------------------- /mac/conf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* Configuration file: some easy changes to the system. */ 4 | 5 | /* Most machine-dependent changes are done automatically by mkconfig, */ 6 | /* the results of which can be found in config.h. */ 7 | /* You only need to change this file conf.h under rare circumstances. */ 8 | 9 | /* Miscellaneous definitions*/ 10 | typedef int expint; /*The 2nd argument of frexp points to this */ 11 | /*(see manual page frexp(3)). */ 12 | /*On some 68K systems must be short (foo!) */ 13 | 14 | #define Maxtrig 1e16 /*Max x for sin(x), cos(x), tan(x) */ 15 | /*(Can anybody find a way to compute this */ 16 | /*automatically?) */ 17 | 18 | #define MaxSmallInt (BASE-1) /* This must be so! */ 19 | #define MinSmallInt (-BASE) /* This must be so!!! */ 20 | 21 | #define SEED getseed() /*Any suitable random int (eg date or time) */ 22 | /*to start the random number generator with */ 23 | -------------------------------------------------------------------------------- /ehdrs/cell.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* 4 | * B editor -- Definitions for linked lists of screen lines, baptized `cells'. 5 | * (This is NOT an abstract data type!) 6 | */ 7 | 8 | struct cell { 9 | struct cell *c_link; 10 | node c_data; 11 | short c_onscreen; 12 | short c_oldindent; 13 | short c_newindent; 14 | short c_length; 15 | char c_oldvhole; 16 | char c_newvhole; /* Yes if this line contains a `vhole' */ 17 | char c_oldfocus; 18 | char c_newfocus; /* Yes if this line contains underlining */ 19 | }; 20 | 21 | typedef struct cell cell; 22 | 23 | #define Cnil ((cell*) NULL) 24 | 25 | #define Nowhere (-9999) 26 | 27 | #define SpaceRound(x) ((indent + (x) + llength - 1) / llength) 28 | #define Space(p) \ 29 | SpaceRound((p)->c_length + (p)->c_newindent + (p)->c_newvhole) 30 | #define Oldspace(p) \ 31 | SpaceRound((p)->c_length + (p)->c_oldindent + (p)->c_oldvhole) 32 | 33 | cell *replist(); 34 | cell *build(); 35 | 36 | extern int llength; 37 | extern int winheight; 38 | extern int indent; 39 | -------------------------------------------------------------------------------- /atari/edit.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | #include "b.h" 4 | #include "main.h" /* for filemodtime() */ 5 | 6 | #define COML 200 7 | Hidden char com_line[COML]; 8 | #define At_eos(s) ((s)+= strlen(s)) 9 | 10 | Visible bool ed_file(char *editor, char *fname, int line) 11 | { 12 | /* return Yes if file has been modified */ 13 | char *cl = com_line; 14 | long oldtime; 15 | 16 | strcpy(cl, editor); 17 | At_eos(cl); 18 | if (*(cl - 1) == '+') { 19 | if (line > 0) { /* add linenumber */ 20 | sprintf(cl, "%d", line); 21 | At_eos(cl); 22 | } 23 | else *(cl - 1) = ' '; /* remove '+' */ 24 | } 25 | *cl++ = ' '; 26 | strcpy(cl, fname); 27 | 28 | oldtime = filemodtime(fname); /* save modtime file */ 29 | system(com_line); /* call editor */ 30 | if (oldtime == 0L) 31 | /* can't get the file's modtime */ 32 | return Yes; 33 | else if (filemodtime(fname) != oldtime) /* changed ! */ 34 | return Yes; 35 | else 36 | return No; 37 | } 38 | -------------------------------------------------------------------------------- /msdos/edit.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | #include "b.h" 4 | #include "main.h" /* for filemodtime() */ 5 | 6 | #define COML 200 7 | Hidden char com_line[COML]; 8 | #define At_eos(s) ((s)+= strlen(s)) 9 | 10 | Visible bool ed_file(char *editor, char *fname, int line) 11 | { 12 | /* return Yes if file has been modified */ 13 | char *cl = com_line; 14 | long oldtime; 15 | 16 | strcpy(cl, editor); 17 | At_eos(cl); 18 | if (*(cl - 1) == '+') { 19 | if (line > 0) { /* add linenumber */ 20 | sprintf(cl, "%d", line); 21 | At_eos(cl); 22 | } 23 | else *(cl - 1) = ' '; /* remove '+' */ 24 | } 25 | *cl++ = ' '; 26 | strcpy(cl, fname); 27 | 28 | oldtime = filemodtime(fname); /* save modtime file */ 29 | system(com_line); /* call editor */ 30 | if (oldtime == 0L) 31 | /* can't get the file's modtime */ 32 | return Yes; 33 | else if (filemodtime(fname) != oldtime) /* changed ! */ 34 | return Yes; 35 | else 36 | return No; 37 | } 38 | -------------------------------------------------------------------------------- /ihdrs/i3env.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* environments and context */ 4 | 5 | typedef struct { 6 | value howtoname; 7 | env curnv; 8 | value r_names, *bndtgs; 9 | literal cntxt, resexp; 10 | parsetree cur_line; 11 | value cur_lino; 12 | } context; 13 | 14 | #define Enil ((env) NULL) 15 | 16 | /* contexts: */ 17 | #define In_command 'c' 18 | #define In_read '?' 19 | #define In_unit 'u' 20 | #define In_edval 'e' 21 | #define In_tarval 't' 22 | #define In_prmnv 'p' 23 | #define In_wsgroup 'w' 24 | 25 | /* results */ 26 | #define Ret 'V' 27 | #define Rep '+' 28 | #define Voi ' ' 29 | 30 | value* envassoc(); 31 | 32 | extern env curnv; extern value *bndtgs; 33 | extern literal cntxt, resexp; extern value howtoname; 34 | extern value errtname; 35 | extern intlet lino; 36 | extern intlet f_lino; 37 | extern intlet i_lino; 38 | 39 | extern context read_context; 40 | 41 | extern envtab prmnvtab; 42 | extern envchain prmnvchain; 43 | extern env prmnv; 44 | 45 | extern parsetree curline; 46 | extern value curlino; 47 | 48 | -------------------------------------------------------------------------------- /readdir: -------------------------------------------------------------------------------- 1 | : readdir rootdir default remote message 2 | _rootdir=$1 3 | _default=$2 4 | _remote=$3 5 | _message=$4 6 | 7 | case $_remote in 8 | "") please_type="Please type the full pathname of a directory";; 9 | *) please_type="Please type the full pathname of a $_remote directory";; 10 | esac 11 | 12 | case `echo -n foo` in 13 | -n*) n="" c='\c';; 14 | *) n=-n c="";; 15 | esac 16 | 17 | dir='blurfl' 18 | while test ! -d "$_rootdir$dir" ; do 19 | case $dir in 20 | blurfl) 21 | ( 22 | echo " " 23 | echo $please_type 24 | echo "where you have write permission, where we can install" 25 | echo $_message 26 | echo $n "[default $_default] $c" 27 | ) >&2 28 | ;; 29 | *) echo "$_rootdir$dir does not appear to exist." >&2 30 | if ./readyn "Are you sure you typed the right name?" >&2 31 | then 32 | echo "Don't forget to make $_rootdir$dir before 'make install'." >&2 33 | break 34 | else 35 | echo $n "Please try again [default $_default] $c" >&2 36 | fi 37 | ;; 38 | esac 39 | read dir 40 | case $dir in 41 | "") dir=$_default;; 42 | esac 43 | done 44 | echo $dir 45 | -------------------------------------------------------------------------------- /ehdrs/erro.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | /* 4 | * B editor -- User (error) messages collected together. 5 | */ 6 | 7 | #define COPY_EMPTY MESS(6000, "Empty copy buffer") 8 | #define READ_BAD MESS(6001, "Trouble with your how-to, see last line. Hit [interrupt] if you don't want this") 9 | #define EDIT_TABS MESS(6002, "Spaces and tabs mixed for indentation; check your program layout") 10 | #define EXIT_HOLES MESS(6003, "There are still holes left. Please fill or delete these first.") 11 | #define GOTO_BAD MESS(6004, "I cannot [goto] that position") 12 | #define GOTO_OUT MESS(6005, "Sorry, I could not [goto] that position") 13 | #define GOTO_REC MESS(6006, "You can't use [goto] in recording mode") 14 | #define INS_BAD MESS(6007, "Cannot insert '%c'") 15 | #define PLB_NOK MESS(6008, "No keystrokes recorded") 16 | #define REC_OK MESS(6009, "Keystrokes recorded, use [play] to play back") 17 | #define REDO_OLD MESS(6010, "This redo brought you to an older version. Use [undo] to cancel") 18 | #define SUSP_BAD MESS(6011, "Sorry, I failed to suspend ABC") 19 | -------------------------------------------------------------------------------- /msdos/feat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #undef EXT_RANGE /* extend range of approximate arithmetic */ 4 | #define TYPE_CHECK /* do static type checking */ 5 | #define CLEAR_MEM /* remove internal adm. before editing a howto */ 6 | #define SAVE_PERM /* write perm env after each edit */ 7 | 8 | #define MAXHIST 21 /* One more than the number of UNDO's allowed. */ 9 | 10 | typedef literal reftype; /* type used for reference counts */ 11 | #define Maxrefcnt 255 12 | 13 | #define SAVEBUF /* Save Copy Buffer on file between edit sessions */ 14 | #define USERSUGG /* Give suggestions for user-defined commands */ 15 | #define SAVEPOS /* Save focus position between edit sessions */ 16 | #define RECORDING /* [record] and [playback] commands */ 17 | #define SCROLLBAR /* Show scroll bar if unit > screen */ 18 | #define SHOWBUF /* Shows contents of copy buffer if locked */ 19 | #define HELPFUL /* Print help blurb on ESC-? or ? */ 20 | #define GOTOCURSOR /* enable [goto] operation */ 21 | #define CK_WS_WRITABLE /* give warning if workspace is read-only */ 22 | -------------------------------------------------------------------------------- /atari/feat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */ 2 | 3 | #define EXT_RANGE /* extend range of approximate arithmetic */ 4 | #define CLEAR_MEM /* remove internal adm. before editing a howto */ 5 | #define SAVE_PERM /* write perm env after each edit */ 6 | 7 | #define MAXHIST 21 /* One more than the number of UNDO's allowed. */ 8 | 9 | typedef literal reftype; /* type used for reference counts */ 10 | #define Maxrefcnt 255 11 | 12 | #define SAVEBUF /* Save Copy Buffer on file between edit sessions */ 13 | #define USERSUGG /* Give suggestions for user-defined commands */ 14 | #define SAVEPOS /* Save focus position between edit sessions */ 15 | #define RECORDING /* [record] and [playback] commands */ 16 | #define SCROLLBAR /* Show scroll bar if unit > screen */ 17 | #define SHOWBUF /* Shows contents of copy buffer if locked */ 18 | #define HELPFUL /* Print help blurb on ESC-? or ? */ 19 | #define GOTOCURSOR /* enable [goto] operation */ 20 | #define CK_WS_WRITABLE /* give warning if workspace is read-only */ 21 | #define TYPE_CHECK /* do static type checking */ 22 | -------------------------------------------------------------------------------- /tc/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DCM_N -DCM_GT -DCM_B -DCM_D 2 | 3 | DEST = .. 4 | 5 | ETC = .. 6 | 7 | HDRS = 8 | 9 | LIBRARY = libtermcap.a 10 | 11 | MAKEFILE = Makefile 12 | 13 | OBJS = termcap.o tgoto.o tputs.o 14 | 15 | PRINT = print 16 | 17 | SRCS = tc1.c tc2.c tc3.c \ 18 | termcap.c tgoto.c tputs.c 19 | 20 | all: $(LIBRARY) 21 | 22 | $(LIBRARY): $(OBJS) 23 | ar cru $(LIBRARY) $(OBJS) 24 | ranlib $(LIBRARY) 25 | 26 | clean:; @rm -f $(OBJS) $(LIBRARY) tc1 tc2 tc3 tc1.o tc2.o tc3.o 27 | 28 | index:; @ctags -wx $(HDRS) $(SRCS) 29 | 30 | install: library termcap 31 | 32 | termcap: 33 | cp termcap $(ETC) 34 | 35 | library: $(LIBRARY) 36 | cp $(LIBRARY) $(DEST) 37 | 38 | database: 39 | cp termcap $(ETC) 40 | 41 | print:; @$(PRINT) $(HDRS) $(SRCS) 42 | 43 | tags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) 44 | 45 | tc1: tc1.o $(LIBRARY) 46 | cc $(CFLAGS) tc1.o $(LIBRARY) -o tc1 47 | tc2: tc1.o $(LIBRARY) 48 | cc $(CFLAGS) tc1.o $(LIBRARY) -o tc2 49 | tc3: tc1.o $(LIBRARY) 50 | cc $(CFLAGS) tc1.o $(LIBRARY) -o tc3 51 | -------------------------------------------------------------------------------- /ukeys/abcadm31.key: -------------------------------------------------------------------------------- 1 | # ADM Siegler, used by Unix Windows on the Macintosh. 2 | # no function keys: 3 | [widen] = "\027" = "Cmnd-W" 4 | [extend] = "\005" = "Cmnd-E" 5 | [first] = "\006" = "Cmnd-F" 6 | [last] = "\014" = "Cmnd-L" 7 | [previous] = "\020" = "Cmnd-P" 8 | [next] = "\016" = "Cmnd-N" 9 | [upline] = "\025" = "Cmnd-U" 10 | [downline] = "\004" = "Cmnd-D" 11 | # arrow keys only work with Cmnd-key held down: 12 | [up] = "\017" = "Cmnd-Uparrow" 13 | [down] = "\035" = "Cmnd-Downarrow" 14 | [left] = "\013" = "Cmnd-Leftarrow" 15 | [right] = "\012" = "Cmnd-Rightarrow" 16 | # some more Mac like bindings: 17 | [redo] = "\001" = "Cmnd-A" 18 | [copy] = "\026" = "Cmnd-V" 19 | [copy] = "\031" = "Cmnd-Y" 20 | [copy] = "\002" = "Cmnd-B" 21 | [delete] = "\030" = "Cmnd-X" 22 | [record] = "\022" = "Cmnd-R" 23 | [playback] = "\024" = "Cmnd-T" 24 | [look] = "\033l" = "ESC-l" 25 | # mouse handling: 26 | [mouse] = "\033m" = "mouse-click" 27 | [mouse-format] = "%+!%+!0\033m%+!%+!@" = "mouse-format" 28 | -------------------------------------------------------------------------------- /ex/TryEditor: -------------------------------------------------------------------------------- 1 | : 'test ABC editor' 2 | 3 | case $1 in 4 | local) abc=../abc;; 5 | *) abc=abc;; 6 | esac 7 | 8 | cat <>> ?' to appear. 12 | Then press 's' to get 'S?ELECT:'. 13 | Next press 't' to see 'ST?ART'. 14 | Now press the [TAB]-key to accept this suggestion. 15 | Finally press the [RETURN]-key to start execution. 16 | 17 | ABC will prompt with '?' for some lines of text, until you type an empty line. 18 | After some time it will then generate a small poem from your twisted text. 19 | 20 | You can undo any change by pressing [BACKSPACE]. 21 | You can get help with ? or [ESC]-?. 22 | You can leave the ABC editor with [ESC]-[ESC]. 23 | You can leave 'abc' by typing QUIT. 24 | 25 | See 'HOW TO TRY THE ABC EDITOR' in ./EDITOR for more information. 26 | 27 | Loading ABC ... 28 | 29 | EOF 30 | 31 | $abc -g `pwd` -w try 32 | 33 | echo " " 34 | echo "If you are satisfied about the ABC editor" 35 | case $1 in 36 | local) echo "you can make ABC public with 'make install'.";; 37 | *) echo "you can clean on the compilation machine with 'make clean'.";; 38 | esac 39 | -------------------------------------------------------------------------------- /mac/m1os.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1986. */ 2 | 3 | #include "b.h" 4 | #include "bmem.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /* Check for pending interrupt */ 14 | 15 | int pollcnt= 0; 16 | 17 | Visible Procedure poll_interrupt() { 18 | if (trminterrupt()) 19 | int_signal(); 20 | } 21 | 22 | 23 | /* Rename a file. */ 24 | 25 | Visible int rename(char *f, char *g) { 26 | OSErr err= Rename(f, 0, g); 27 | return err == noErr ? 0 : -1; 28 | } 29 | 30 | 31 | /* Return appropriate number to start the random generator. */ 32 | 33 | Visible int getseed() { 34 | return TickCount(); 35 | } 36 | 37 | 38 | /* Is a file descriptor interactive? */ 39 | 40 | Visible bool isatty(int fd) { 41 | return ioctl(fd, FIOINTERACTIVE, (long*)0) == 0; 42 | } 43 | 44 | /* Assertion error. */ 45 | 46 | Visible asserr(char *file, int line) { 47 | char mess[255]; 48 | sprintf(mess, "Assertion botched in file %s, line %d.", 49 | file, line); 50 | DebugStr(mess); 51 | immexit(2); 52 | } 53 | 54 | /* Abort. */ 55 | 56 | 57 | -------------------------------------------------------------------------------- /keys/keydef.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1989. */ 2 | 3 | #define ABC_RELEASE "ABC Release %s." 4 | #define COPYRIGHT "Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1989." 5 | #define HEADING "This program allows you to redefine the key bindings for the ABC editor operations, producing a key definitions file." 6 | 7 | /****************************************************************************/ 8 | 9 | #define E_ILLEGAL "*** You are not allowed to start a definition with '%c' since that would make that character unavailable." 10 | 11 | #define E_TOO_MANY "*** Sorry, can't remember more key definitions" 12 | 13 | #define E_UNLAWFUL "*** It may not contain an unprintable character" 14 | 15 | #define E_IN_USE "*** That representation is in use for %s." 16 | 17 | #define E_UNKNOWN "*** unknown operation name" 18 | 19 | #define E_KEYFILE "*** Can't open key definitions file %s for writing; writing to standard output instead." 20 | 21 | #ifndef CANLOOKAHEAD 22 | 23 | #define E_INTERRUPT "*** You cannot include your interrupt character." 24 | 25 | #define E_NOTALLOWED "*** you are not allowed to change \"%s\"" 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /unix/edit.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990. */ 2 | 3 | #include "b.h" 4 | #include "main.h" /* for filemodtime() */ 5 | 6 | #define COML 200 7 | Hidden char com_line[COML]; 8 | #define At_eos(s) ((s)+= strlen(s)) 9 | 10 | Forward Hidden Procedure app_fname(); 11 | 12 | Visible bool ed_file(char *editor, char *fname, int line) 13 | { 14 | /* return Yes if file has been modified */ 15 | string cl= com_line; 16 | long oldtime; 17 | 18 | strcpy(cl, editor); 19 | if (*(cl+strlen(cl)-1) == '+') { 20 | if (line != 0) {At_eos(cl); sprintf(cl, "%d", line);} 21 | else *(cl+strlen(cl)-1)= ' '; 22 | } 23 | At_eos(cl); 24 | app_fname(cl, fname); 25 | 26 | oldtime= filemodtime(fname); 27 | system(com_line); 28 | if (oldtime == 0L) 29 | /* can't get the file's modtime */ 30 | return Yes; 31 | else if (filemodtime(fname) != oldtime) /* changed ! */ 32 | return Yes; 33 | else 34 | return No; 35 | } 36 | 37 | Hidden Procedure app_fname(string ceos, string fname) 38 | { 39 | intlet k, len= strlen(fname); 40 | *ceos++= ' '; 41 | for (k= 0; k