home *** CD-ROM | disk | FTP | other *** search
INI File | 1992-10-20 | 36.6 KB | 681 lines |
- [This is file \AM\EM.INF]
- [Information about the operators and functions in AAEMACS]
-
- typedef unsigned char byte;
- '&' = '->' = 'pointer to'; '#' = number (of)
- All class etc members are public.
- These declarations apply hereinunder:- buffer Bu; line L; mark M; gp_cur G;
- region R; macro Ma; macstep Ms; keyarray Ka; tree T; parsing P; val K; val S;
- char c,*s; int i,j,k,n,d; byte b; func Kf /* key-subroutine */; screenline Sc;
- (and ditto with numerals after, e.g. Bu1, Bu2 are buffers)
- ---------- text string
- [class val]
- TYPE MEMBER DESCRIPTION
- char* S.s ->text (0 if S.n==0)
- int S.n how many characters in string
-
- TYPE FUNCTION DESCRIPTION
- OR OPERATION
- char S[i] i'th char in string
- val val(s,n) assemble s and n into a val
- val val(s) convert char* to val: assemble s & strlen(s) into a val
- val s (i.e. a char* where a val should be) ditto
- val val() val with text length = 0
- void S=s S.s=s; S.n=strlen(s); no string-copy
- void S1=S2 copy S2.s and S2.n; no string-copy
- val val(S) how to copy a val (no string-copy)
- int S==c logical: if S.n==1 & S[0]==c
- int S==s logical: if S.n==strlen(s) & string s matches text of S
- void S.newbody() give S a new separate copy of its text string
- void S.record() append S to macro currently being recorded
- void S1.getifn(S2,s) if S2 is null then S1 = string got by asking user
- with s as prompt; else S1 = S2
-
- TYPE GLOBAL VARIABLE DESCRIPTION
- val _ dustbin for unwanted val* & val& function arguments to point to
- ---------- detached chain of lines, e.g. a kill in the kill ring
- [class Text]
- TYPE MEMBER DESCRIPTION
- line* beg -> start of chain of lines
- line* end -> end of chain of lines
-
- TYPE FUNCTION DESCRIPTION
- OR OPERATION
- Text Text() empty Text
- Text Text(&L1,&L2) set up a Text with beg=L1 and end=L2
- Text Text(T) copy T.beg & T.end, does not duplicate the lines
- Text Text(S) convert val to Text by setting up lines etc.
- Obeys linefeed etc.
- Text S (i.e. a val where a Text should be) ditto
- int T.read(s) read file named s into a chain of lines; set T -> them
- void T1=T2 copy T2's text lines; make T1 -> them
- void T.clear() make T empty
- void T.print() print text of T on the debug file
-
- TYPE GLOBAL VARIABLE DESCRIPTION
- Text killring[16]; kill ring
- short nkill; current place in kill ring
- ---------- position on screen
- [class gp_cur]
- byte c column (counted from 0)
- byte r row (counted from 0)
-
- gp_cur gp_cur(b1,b2) set up gp_cur as col b1, row b2
- gp_cur gp_cur(b1) set up gp_cur as col b1, row 0
- gp_cur b1 ditto
- gp_cur gp_cur() set up gp_cur as col 0, row 0
- gp_cur gp_cur(G) how to copy a gp_cur
- void G1=G2 assign, i.e. copy
-
- gp_cur cursor; the cursor
- char *Moan,*Display; -> strings waiting to be printed at bottom of screen
- ---------- a position in a file buffer
- [class mark]
- mark* prev -> previous mark in that buffer's mark ring
- mark* next -> next mark in that buffer's mark ring
- line* r -> line marked
- short c distance from start of line
-
- mark mark(&L,i) set up a mark (.prev & .next are undefined)
- mark mark() ditto but with r=0, c=0
- mark mark(M) copy M.r and M.c only
- byte charat(M) the character that the mark points to
- void M1=M2 copy M2.r and M2.c only
- void M++ move mark 1 char forward (set M.r=0 if it hits end of file)
- void ++M ditto
- void M-- move mark 1 char back (set M.r=0 if it hits start of file)
- void --M ditto
- void M=c copy c into the char that M points to
- void M+=c at mark M, insert char c
- void M+=s at mark M, insert string s
- void M+=&Bu at mark M, insert copy of text of buffer Bu
- line* M/i at mark M, split line (= insert end-of-line). Return -> line
- after this new split. If i!=0, any mark at the split point goes
- into the new line; else it stays in the old line.
- void !M delete character that M points to
- void M.bs() backspace-delete character that M points to
- region M.yank(T,0) insert text T at mark. Return region -> inserted text.
- region M.yank(T,1) ditto but insert a copy of T
- void M>>=n at M insert n undefined chars. No check for array-out-of-bounds
- void M<<=n at M delete n chars;
- duplicate n last chars of line to keep length same.
- int M.Up() move M up 1 line; result logical = if success
- int M.Down() move M down 1 line; result logical = if success
- int M.Left() move M left 1 line; result logical = if success
- int M.Right() move M right 1 line; result logical = if success
- int M.is_white() logical: if space or tab or end-of-line at M
- int M.is_alpha() logical: if letter at M
- int M.is_alnum() logical: if letter or digit at M
- void M.find_white() move M forwards to space or tab or end-of-line
- void M.find_white(0) ditto
- void M.find_white(1) move M backwards to space or tab or end-of-line
- void M.skip_white(0,1) move M forwards over spaces, tabs, end-of-lines
- void M.skip_white(0,0) ditto but stop at end-of-line
- void M.skip_white(0) ditto
- void M.skip_white() ditto
- void M.skip_white(1,1) move M backwards over spaces, tabs, end-of-lines
- void M.skip_white(1,0) ditto but stop at end-of-line
- void M.skip_white(1) ditto
- void M.skip_alpha(-) move M over letters. Args as M.skip_white(-)
- void M.skip_alnum(-) move M over letters & digits. Args as M.skip_white(-)
- void M.find_alpha(-) move M to letter. Args as M.skip_white(-)
- void M.find_alnum(-) move M to letter or number. Args as M.skip_white(-)
- int M.at_eol() logical: if end-of-line at M
- void M.skipword(n) move M n words forwards (backwards if n<0)
- int M.isin(R) logical: if M is in region R
- int M1<M2 logical: if M1 is before M2 in text order in file buffer
- int M1==M2 logical: if M1 and M2 are the same
- int M1!=M2 logical: if M1 and M2 are not the same
- void M.push() push copy of cursor onto top of mark stack
- void M.hsup() push copy of cursor onto bottom of mark stack
- void M.pop() take top member off mark stack & set cursor = it
- void M.skipsentence(n) move N to nth end-of-sentence forwards (back if n<0)
- void M.skippara(n) move N to nth end-of-paragraph forwards (back if n<0)
- byte charat(M) the char that M points to
- ---------- a region of text in a file buffer, defined by two marks
- [class region]
- mark R.beg start of region R
- mark B.end end of region R
-
- region M1-=M2 the region between M1 and M2
- region M1-M2 ditto, making sure that the region is not back-to-front
- region region() region with both bounds null
- region region(M1,M2) region with bounds M1 & M2 (no check that M1<M2)
- void R1=R2 copy bounds of region
- mark R.Delete() delete text in region. Result -> join where deletion was
- mark R.kill() ditto, but put deleted matter in kill ring
- void R.copykill() put copy of region into kill ring
- void R.format() re-lineate the text in the region
- int R.huntf(S) look in R for text of S, starting at R.beg
- int R.huntf(S,0) ditto
- int R.huntf(S,1) ditto but only look for whole word == S
- int R.huntb(S) look in R for text of S, starting at R.end
- int R.huntb(S,0) ditto
- int R.huntb(S,1) ditto but only look for whole word == S
- int R.hunt(S,i,n) ditto, backwards if i!=0, whole words only if n!=0
- void R.replace(S,S2,i,j) ditto, replace text found by S2, repeat.
- If i!=0, ask each time. If j!=0, whole words only.
- Zero trailing i and j args can be omitted.
- region R.moveto(M) delete region, insert it at M. Result -> new place of R
- region R.repl(T) delete region, insert T instead. Result -> inserted T
- region R.repl(T,0) ditto
- region R.repl(T,1) ditto but take a copy of T to use instead of T itself
- void R.right_order() swop the bounds of R if they are in the wrong order.
- Moan about a bug if either bound is null.
- void R.color(n1,n2) note colors for region R: foreground n1, background n2
- void R.Case(0) change all letters in region R to lowercase
- void R.Case() ditto
- void R.Case(1) change all letters in region R to uppercase
- int R.ok_to_delete() ask user if he wants region R deleted
- void R.expandtabs() expand tabs to spaces in region R
- void R.maketabs() contract spaces to tabs in region R
- ------------------- a line of text in a file buffer
- [class line]
- line* next -> next line (0 for last line in file)
- line* prev -> previous line (0 for first line in file)
- short int how many chars in line
- char* s test of line (physically has (L,n+15)&~15 bytes)
- char la logical: if line has been altered since last displayed
- static short int notshown (set to 4000hex in main())
- short int sl screen line number that this line is displayed on.
- (= L.notshown if this line is not currently on screen)
-
- void nullline() empty line
- line line() empty line
- line line(s) line with text specified
- line s ditto
- line line(s,n) ditto, length of text also specified
- void -L remove previous eol, i.e. chain line L to previous line
- void L-- remove next eol, i.e. chain line L to next line
- void --L ditto. For this & 2 previous forms, line L must be in buffer
- void L-T ditto. Use this form if line L is in Text T instead of in buffer
- void L.display(i) display line L on screen line i
- int L.dispfold(i) display line L on screen lines i etseq, folded if long
- int L.nparts() how many screen lines needed to display line L folded
- int L.nparts(-1) ditto
- int L.nparts(i) if i>=0, how many screen lines needed to
- display the first i characters if line L folded
- int L.showeol() logical: if need to display eol character at end of L
- void L1-L2 link lines L1 and L2 in that consecutive text order
- line* L/S insert new line (whose text = copy of S) after L; result -> it
- line* S/L insert new line (whose text = copy of S) before L; result -> it
- void L=s give L new text
- void L+=c append character c to end of text of line L
- void L+=L2 append copy of text of line L2 to end of text of line L
- void L=i alter L.n to i, and adjust text accordingly
- void L+=i alter L.n to L.n+i, and adjust text accordingly
- void L-=i alter L.n to L.n-i, and adjust text accordingly
- void L.empty() delete text of line L
- int L.to_tabexp(n) new place # of nth char in L if tabs in L were expanded
- int L.to_tabexp(n,0) ditto
- int L.to_tabexp(n,1) ditto but 6*(counted in 'n'-widths proportional)
- int L.from_tabexp(-) reverse of L.to_tabexp(-), same args
- int L.to_scrcolno(n) convert char # to screen col #, in line L
- int L.from_scrcolno(n) convert screen col # to char #, in line L
- int L.blank() logical, if line is empty
- void L.dotty() use L.to_scrcolno(-) to check B->dot.c against B->dotcc
- void L.split_if_long() insert eol's if line L is longer than allowed
- void L.de_trailing_space() remove trailing tabs and spaces from line L
- int L.is_bop() logical: if L is first line of paragraph
- int L.is_eop() logical: if L is last line of paragraph
- int L.lineno() line number in file buffer (first line is line 0 here)
- void L.del() delete line L
-
- line* dustbin -> chain of deleted lines. They are put here, not
- free()'d at once, so pointers to them don't get to point to any
- newly created line's or strings etc causing confusion.
- void emptydustbin() empty the dustbin
- line* line0 dummy line
- line* modeline dummy line for the modes line at the bottoms of windows
- ---------- a line on the screen
- class screenline{public:
- line* Sc.l line in buffer that Sc is displaying
- line* Sc.nl new ditto when altering screen display
- int Sc.lp which part of folded line that Sc is displaying
- int Sc.nlp new ditto when altering screen display
- int Sc.np Not used. Was 'how many parts in folded buffer line'
- int Sc.lc how many characters on this screen line
- int Sc.ok logical: if this screen line has not been spoilt
- int Sc.nc how many characters can be displayed on this screen line
- unsigned short* Sc.sa Sc.sa[i] = colors to use with i-th character of Sc
- buffer* Sc.buf which buffer Sc is displaying a line of
-
- screenline Sl[] -> lines of the screen
- ---------- file buffer
- class buffer
- buffer* Bu.next -> next buffer in chain of buffers
- mark Bu.start -> char which is top left char on screen
- int Bu.startc backup for Bu.start.c
- int Bu.stback if folding long lines, where in Bu.start.r to start
- mark Bu.dot cursor. Start of Bu's chain of marks
- byte Bu.row1 # of first row of screen used by buffer
- byte Bu.lastrow # of last row of screen used by buffer
- byte Bu.nrows how many rows of this buffer's text on screen incl. info line
- byte Bu.ncols how many columns of text on screen
- short Bu.dotcc screen col # of Bu.dot
- short Bu.dotcc2 backup of ditto
- line Bu.text completes circle of lines of Bu's text.
- Bu.text.next -> first line, Bu.text.prev -> last line
- bmode Bu.mode editor mode of this buffer
- byte Bu.truncated logical: if file couldn't be read completely
- byte Bu.invisible logical: if this buffer is not to be displayed
- byte Bu.readonly logical: if this buffer can't be written to its file
- byte Bu.changed logical: if Bu's text changed since it was saved last
- byte Bu.oldch backup for ditto
- - - (the next 8 members are Bu's <modes>)
- byte Bu.overlay logical: if to insert or overlay chars typed in
- byte Bu.tabtype how to display tabs
- byte Bu.twod what to do when running off end of line
- byte Bu.wrap logical: if to automatically split overlong lines
- byte Bu.Case logical: if to distinguish case of letters on searching
- byte Bu.longlines logical: if to display long lines folded
- byte Bu.esc_as_alt logical: if to treat all esc-key as alt-key
- byte Bu.skip_after_word what to do between words when skipping words
- static int Bu.nmodes how many modes (now 8)
- int Bu.rmargin right margin for auto newline mode
- int Bu.sortcol how many chars for sortlines to ignore at start of lines
- char* Bu.fname file name
- char* Bu.bname buffer name
-
- void Bu.initbuffer() initialize buffer Bu
- buffer buffer() initialized buffer
- buffer buffer(s) new buffer named after and read from file s
- buffer s ditto
- buffer buffer(s,1) ditto
- buffer buffer(s,0) new empty buffer named after file s
- line* Bu[n] -> nth text line of buffer Bu
- void Bu.deltext() delete all Bu's text
- buffer* Bu.linkin() put Bu into buffer chain
- void Bu.read() read Bu from its file
- void Bu.write() write Bu to its file
- void Bu.clearscreen() clear Bu's screen area
- void Bu.go_to() make Bu the current buffer
- mark Bu.bof() -> start of text of Bu
- mark Bu.eof() -> end of text of Bu
- int Bu.nmarks() how many ordinary marks currently in Bu
- mark& Bu.Mark(n) (n+1)th mark. if n<0, (-n)th from bottom of stack
- void Bu.display() redisplay altered lines of Bu's screen area
- void Bu.dispfold(n) ditto in fold-long-lines mode, omitting n screen lines
- after start of line Bu.start.r
- void Bu.dispfold() as Bu.dispfold(0)
- void Bu.rem1mark() remove top mark from Bu's mark stack
- void Bu.up() move Bu.dot up one position
- void Bu.down() move Bu.dot down one position
- void Bu.left() move Bu.dot left one position
- void Bu.right() move Bu.dot right one position
- void Bu.split_window_with(n) split Bu's window. Bu keeps n screen lines
- (0 = half its lines). Ask for buffer for new window
- void Bu+=c as Bu.dot+=c
- void Bu+=s as Bu.dot+=s
-
- buffer* buf0 dummy buffer
- buffer* bhead start of chain of buffers
- buffer* B -> current buffer. Lines worked on <must> be in this buffer
- int bcount how many buffers defined
- line *T entry point of circle of lines currently being handled
- Buffer has extra final empty line unless last char in file is not end-of-line
- ---------- some global variables
- char DIR[] name of current DOS directory
- #define HELPFILE "HELP"
- #define BIGHELPFILE "HELP.BIG"
- char helpfile[],bighelpfile[] names of these two files
- char T1w[],T2w[]; working space for reading 1st & 2nd subr text args
- val T1t,T2t; ditto
- val specialchars; chars with special meanings in strings in AAEMACS macro
- listings: they are now '"' '\' '^'
- int needswrap work space in auto line feed mode
- int regfcol foreground color for region to be specially colored
- int regbcol background color for region to be specially colored
- int play logical: if obeying a macro
- int obtype logical: if killing or yanking or neither:-
- enum {ob_kill=1,ob_yank=2,ob_other=3};
- int prevobtype previous value of ditto
- region lastyank -> last text yanked
- region colreg -> special color region
- buffer* colbuf which buffer colreg points to text of
- buffer* window[] which buffer is in each screen window
- int nwindows; how many windows
- int currentwindow;
- long _ax,_bx,_cx,_dx,_si,_di,_bp,_es; long GP_4; short GP_2; char GP_1;
- to put registers in for interrupt calls
- enum Color{Black=0,Blue=1,Green=2,Cyan=3,Red=4,Magenta=5,Orange=6,White=7};
- ----------
- byte gp_Mode screen VGA/etc mode
- byte gp_Rows,gp_Cols how many rows and columns of chars on screen
- short gp_Attr,gp_Attr_def text colors to use
- unsigned short sch(byte C,byte A){return C|(A<<8);}
- assemble char and its color info for screen position
- #define screen ((unsigned short*)0xe01b8000) Gnu C address of screen
- #define scr(row,col) (screen[(col)+(row)*gp_Cols]) a char on the screen
- byte getkey() read a key (for special key call twice,gets 0 then char)
- int doschar() ditto?
- int typahead() logical: if a char is waiting to be read
- int beep() the terminal beeps
- int gp_mode() current screen (VGA/etc) mode
- void gp_mode(c) set screen (VGA/etc) mode
- void gp_cursor(G) move cursor to G
- void gp_cursor(i,n) move cursor to screen line i, screen col (count from 0)
- gp_cur gp_cursor() current cursor position
- void gp_clear() clear screen line 0
- void gp_clear(i) clear screen line i
- void gp_clear(i,j) clear screen line i, cols k to end
- void gp_clear(i,j,k) clear screen line i, cols j to k
- short Attrib(i,j) char color byte: foreground color i, background color j.
- i & j 0 to 7; i+8 for bright, j+8 for flashing
- short Attrib(i,j,0) ditto
- short Attrib(i,j,1) ditto but flashing
- ----------
- Codes of special keys. Some of these may be different on different PC's:-
- enum {alt_sharp=43, alt_apostr=40, alt_comma=51, alt_minus=130, alt_fullstop=5,
- alt_slash=53, alt_0=129, alt_1=120, alt_2=121, alt_3=122, alt_4=123, alt_5=124,
- alt_6=125, alt_7=126, alt_8=127, alt_9=128, alt_semicolon=39, alt_equals=131,
- alt_A=30, alt_B=48, alt_C=46, alt_D=32, alt_E=18, alt_F=33, alt_G=34, alt_H=35,
- alt_I=23, alt_J=36, alt_K=37, alt_L=38, alt_M=50, alt_N=49, alt_O=24, alt_P=25,
- alt_Q=16, alt_R=19, alt_S=31, alt_T=20, alt_U=22, alt_V=47, alt_W=17, alt_X=45,
- alt_Y=21, alt_Z=44, alt_leftsq=26, alt_rightsq=27, alt_grave=41, ctrl_2=3,
- alt_bksp=14, alt_esc=1, alt_ret=28, sh_tab=15, alt_tab=165, ctrl_tab=148,
- del=83, alt_del=163, ctrl_del=147, end=79, alt_end=159, ctrl_end=117, home=71,
- alt_home=151, ctrl_home=119, insert=82, alt_insert=162, ctrl_insert=146,
- pagedown=81, alt_pagedown=161, ctrl_pagedown=118, pageup=73, alt_pageup=153,
- ctrl_pageup=132, downarrow=80, leftarrow=75, rightarrow=77, uparrow=72,
- alt_downarrow=160, alt_leftarrow=155, alt_rightarrow=157, alt_uparrow=152,
- ctrl_downarrow=145, ctrl_leftarrow=115, ctrl_rightarrow=116, ctrl_uparrow=141,
- f1=59, f2=60, f3=61, f4=62, f5=63, f6=64, f7=65, f8=66, f9=67, f10=68, f11=133,
- f12=134, sh_f1=84, sh_f2=85, sh_f3=86, sh_f4=87, sh_f5=88, sh_f6=89, sh_f7=90,
- sh_f8=91, sh_f9=92, sh_f10=93, sh_f11=135, sh_f12=136, ctrl_f1=94, ctrl_f2=95,
- ctrl_f3=96, ctrl_f4=97, ctrl_f5=98, ctrl_f6=99, ctrl_f7=100, ctrl_f8=101,
- ctrl_f9=102, ctrl_f10=103, ctrl_f11=137, ctrl_f12=138, alt_f1=104, alt_f2=105,
- alt_f3=106, alt_f4=107, alt_f5=108, alt_f6=109, alt_f7=110, alt_f8=111,
- alt_f9=112, alt_f10=113, alt_f11=139, alt_f12=140};
- ----------
- char *altnames[256],*altshortnames[256]; val keynames[];
- arrays to read key names into from file INFO.DAT
- ----------
- void showmoan() display any awaiting moans and displays
- void MOAN(s) set awaiting moan to s
- char* fullfilename(s1,s2) in string s1 put full pathname of file s2;
- replace / by \ return s1 as function value
- char* newstr(s) new string which is a copy of s
- ----------
- int bytes(s) 4 bytes starting at address s, treated as an int
- int roundup(i) i rounded up to multiple of 16
- char* copytext(s1,s2,n) copy n chars from s2 etseq to s1 etseq; do not
- stop at zero chars; return s1 as function value
- int comptext(s1,s2,n) like strncmp but do not stop at zero chars
- int comptext(s1,s2,n,0) ditto
- int comptext(s1,s2,n,1) ditto but ignore case of letters
- ----------
- #define add_to_list(head,item) ((item)->next=(head), (head)=(item))
- #define remove_from_list(head,item) ({typeof(item) *I; \
- for(I=&(head);*I;I=&((*I)->next)) if(*I==(item)) {*I=(*I)->next; break;}})
- ----------
- /**** make fault remarks without mallocking, in case fault was 'out of store' */
- ----------
- void recolor(i,j,k) color of jth char of ith screen line to k
- int displayn(S,n,k,i,j)
- int displayn(s,n,k,i,j)
- void display(S,n,k,i,j)
- void display(s,n,k,i,j)
- In these last 4 lines. j=Black if omitted, i=White if omitted;
- display s or S on screen line n (displayn = do not clear to end
- of line) with foreground color i, background color j
- void clearscreen() clear the screen
- void ask(s1,s2,0) ask question s1, get reply in string s2
- void ask(s1,s2,1) moan "illegal reply" then ask question as ditto
- void getstring(s,i,S,n) on screen line i ask question s and get reply
- in S, maximum length n. Various facilities:-
- end (at start) = go to end & keep old reply; altY = insert last
- kill; altB = expect keysequence bound to buffer; del = delete;
- altdel = backspace-delete; left & right arrows = move cursor;
- home & end = go to start & end; altend = abort calling command;
- other special key = normal exit
- ----------
- char chwidth[256]; proportionate char width for Epson printer
- byte to__upper[256],to__lower[256]; for char case conversion
- char chtype[256]; enum{c_alpha=1,c_alnum=2,c_white=4}; re char type
- ----------
- #define to_upper(c) to__upper[(byte)(c)]
- #define to_lower(c) to__lower[(byte)(c)]
- /*----- x==y ignoring case? */
- #define cheq(x,y,Case) (Case?((x)==(y)):to_upper(x)==to_upper(y))
- #define iswhite(c) (chtype[(byte)(c)]&c_white)
- #define isalpha(c) (chtype[(byte)(c)]&c_alpha)
- #define isalnum(c) (chtype[(byte)(c)]&c_alnum)
- ----------
- region Found; -> text region found by various routines
- ----------
- char* keyname(c) -> name of char c (copy at once the string pointed to!)
- char* keyname(c,0) ditto
- char* keyname(c,1) -> name of special char c
- void Obey() get a keyboard key sequence and obey it
- void Obey(n,0) ditto, ignore n
- void Obey(n,1) ditto, but obey it with numeric argument n
- void Obey(n,i,-1) as obey(n,i)
- void Obey(n,i,j) ditto but take j as first key in sequence
- void Obey(n,i,j,-1) ditto
- void Obey(n,i,j,k) ditto but take j & k as first two keys in sequence
- int yesno(s,i) on screen line i ask yes/no question s.
- (on last line if i == -1 or omitted)
- ---------- key-subroutines and standard header for them
- typedef void func(val,val,val);
- #define Kf(name) void name(val N=val(1,0),int D=0,val T1=_,val T2=_)
- #define KF(name) void name(val N=val(1,0),int D=0,val T1=_,val T2=_)
- ----------
- char* chname(c) -> string = name of character c
- void instring(&B,S) insert into B, quoted string = name of keysequence S
- ---------- entry in table of names of AAEMACS subroutines
- typedef struct{func *f; key bound to subroutine
- int n; 0
- char*name; string = name of subroutine
- } Subr;
- ---------- a value and its type, incl. information re what a key is bound to
- [class val] (also see above)
- n (byres 0-3) value (bytes 4-7)
- >0 char*s -> a string of n chars
- 0 unbound char*s if s==0 or 1, nothing, else empty string
- -1 _subr subr*f -> a function void ....(val,val,val)
- -2 _macro macro*m -> a macro
- -3 _char int i the char i. 256-511 mean 'alt/special key i&255'
- -4 _keyarray keyarray*k -> an array of val's corresponding to key values
- -5 _buffer buffer*b -> a buffer
- -6 _int int i the integer i
- -7 _keyseq char*s -> a keysequence,kept in chars s[1] to s[s[0]-1]
- -8 _rsvword int i the i'th reserved_word
- -9 _unidfname char*s -> an unidentified word (terminated by '\000')
- -10 _call struct call_*C -> base & args of a function call
- -11 _bad char*s -> a string describing what was wrong
- -12 _Subr Subr*S -> an entry in the table of subr names & info
- -13 _func func*fn -> a function val ....(int,val*)
- -14 _Func Func*Fn -> an enter in the table of func names & info
-
- val val() unbound key
- val val(s,n) key-info bound to string s of n characters
- val val(s) ditto, length = strlen(s)
- val s ditto
- void K=S bind K to text of S
- val val(S) key-info bound to string = text of S
- val S ditto
- void K=Kf bind K to key-subroutine Kf
- val val(Kf) key-info bound to key-subroutine Kf
- (etc, see in file EM.H)
- void K(i,n,S1,S2) if K is bound to a key subroutine, call it with these
- arguments. Arguments S1 and S2 can be omitted.
- void K.newbody() give K a new copy of whatever it is pointing to
- void K.expandkeyseq(s) If K is bound to string which is a valid key sequence,
- make in s etseq a description of it for macro printout
- void K.expandkeyseq(s,0) ditto
- void K.expandkeyseq(s,1) ditto, short version
- int K==c 1 if K is bound to a char and that char is c, else 0
- val& K.keyseq() If K is bound to string which is a valid key sequence,
- value = the key information for the key described by K
- ----------
- typedef struct call_{int n; val arg[1];} call;
- Set up by malloc() to actually have n elements in arg[]. Analysis tree fork in
- parsing macros. arg[0] = call base, arg[1 etc) are its arguments if any.
- ---------- array of 256 key bindings to look up in
- [class keyarray]
- val* a; array of val's
- short n; actual length of a
- (out of bounds access causes 'a' to be lengthened as needed)
-
- void Ka.subarray() make Ka empty
- keyarray keyarray() empty keyarray
- val& Ka[i] i'th element of Ka
- void Ka.print(n,i) insert into current buffer a listing of the key
- bindings in Ka. n and i control the listing.
-
- keyarray keys; head of lookup tree of key bindings
- val key0;
- ----------- one statement in a macro
- [class macstep]
- val N numeric argument of macro step, if any
- val f keyfunction or macro to be called by this macro step
- val T1 1st string or keysequence arg of macro step (if any)
- val T2 2nd string or keysequence arg of macro step (if any)
- macstep*next next step in this macro (=0 in last step)
-
- enum {_insert=0,_overlay=1,_nomove=2,_arg=3,_keyseq=4};
- macstep macstep(K) append to current macro a step calling key K with no
- integer argument; returns that macstep
- macstep K ditto
- macstep macstep(K,0) ditto
- macstep macstep(K,0,0) ditto
- macstep macstep(K,n,1) ditto but with integer argument = n
- void Ms1=Ms2 copy macstep but do not copy Ms2.next
- macstep macstep(Ms) Ms copied, but Ms.next is not copied
- void Ms.expandkeyseq(s,n) Ms must be a keyseq; insert into buffer that
- keyseq expanded into names of keys. n controls how.
- void Ms() obey the macstep. Complains if recursion goes >16 deep.
- void Ms(n) ditto. n counts the recursion depth
- int Ms.print() print Ms into buffer as macro printout
- ----------- macro header
- [class macro]
- macstep* last -> last step in this macro
- macstep* prevlast -> step that was last before last step was added
- macstep* text -> first step in this macro
- macstep* name Ma.name.f is bound to a string = name of macro
- char bound logical = if this macro is bound to a key
-
- macro macro() an empty macro
- void Ma+=Ms append macstep to macro
- void Ma+=S append S to macro as text argument
- void Ma() obey macro
- void Ma(n,1) obey macro with numeric argument n
- void Ma(n,i,j) obey macro: j counts recursion depth
- void Ma-- remove from macro the step(s) after Ma.prevlast
- void Ma.print() print macro in buffer as macro printout
- void Ma.print(s) ditto, with macro name printed as s
- void Ma.tidy() e.g. chain up successive insert-a-character's
- void Ma.empty() make Ma empty
- ----------
- func*keep[23];
- macro lastobey,*record,*Macro;
- macstep**laststep,**prevstep;
- char keychar,keyseqc[64],repeating;
- macstep keyseq; /* work space */
- ----------
- void Insert(n,i,c) if n>0, insert char c into buffer n times. Ignores i.
- void Replace(n,i,S1,S2,s,j,k) replace T1 by t2 in region. n & i say
- which mark defines region. s is prompting string.
- Ask user each time if j!=0. Whole words only if k!=0
- void search(n,i,S,s,j,k) search in buffer for S. In region defined by
- mark n of i!=0. s is prompt string. backward search if j!=0.
- Whole words only if k!=0
- void incrsearch(n,i,s,j)
- ditto, but incremental search as search string is typed in
- void readescno(i) read integer arg as esc-&-digits, using i as first digit
- void readaltno(i) read integer arg as alt-digits, using i as first digit
- char& bufmode(int i,Bu) the field of Bu that holds its ith mode
- char& bufmode(i) ditto, for the current buffer
- ----------
- char**dispmode[];
- ----------
- void ordinarykey(int N,int D,byte c,int rec=1);
- insert or overlay character as buffer mode
- val&getkeyseq(char*P,char c=-1); read key sequence from keyboard
- void recordkey();
- void forallkeys(void subr(val*),int L=0,keyarray&K=keys);
- void moan_if_no_help(val*f);
- void print_if_macro(val*f);
- void print_if_buffer(val*f);
- void print_keyf(val*f);
- func*namedsubr(val name);
- val*getk(val arg,char*prompt=0); read bindable key sequence from keyboard
- ----------
- char Filename[256];
- val Fn;
- buffer *foundbuffer;
- char *sortname[];
- ---------- parsing tree for macro line read in as text
- [class tree]
- int sort one of:-
- enum{_bad=0,_elem=1,_call=2,_special=3,_idle=4,_unidfname=5,_oddment=6};
- val value value (if it can be found) of expression parsed as tree
- int n how many arguments
- tree** arg -> array of pointers to arguments (arg 0 = call base)
-
- void T1=T2 copy fields
- tree tree(i,n) tree header, sort i, n args
- tree tree(i) tree header, sort i, 0 args
- tree i ditto
- tree tree() tree header, sort '_bad', 0 args
- tree tree(i,K) tree header, type i, 0 args, value=K
- tree tree(i,L,j,k) tree header, value=null, n=k-j, type i,
- arg -> jth character of L
- void S=T S = T.value, which should hold a string
- val* T.inkeyseq() read a keysequence printout
- val T.raw() convert T to string if it is string or unidentified name
- int T==s logical: if T is string or unidentified name which = s
- tree T[i] ith argument of T
- ---------- pointer to buffer text being parsed by read-a-macro */
- [class mark] (see above, and:-)
- line* r -> line being parsed
- int c which character in L the parsing pointer is at
- int P.eol() logical: is P at end of line?
- byte P.ch() char at pointer (ctrl-M if at end of line)
- int P.is_white() logical: if P is at space or tabulate char
- void P.skipwhite() jump P over spaces and/or tabs
- int P.thisch(c) skipwhite. Skip next char if it is c. Report next char
- tree* P.elem() look for an element, move P over text parsed
- tree* P.expr() look for an expression, move P over text parsed
- tree* P.call() look for an call, move P over text parsed
- tree* P.parse() parse P's current line
- ----------
- void translate(&Bu) Bu should contain macro printout: read in the macros
- and obey any lines starting '#'
- int buf_named(S) logical: is there a buffer named S?
- int findbuf(S) if there is buffer named S, go to that buffer & return 0
- else make new buffer named S & go to it & return 1
- int findbuf_new(S,0) ditto, but use expansion of S to a full pathname
- int findbuf_new(S,1) ditto, and read file S into buffer named S
- int findbuf_new(S) ditto
- region thisword() 2 marks delimiting word at cursor in current buffer
- region thisword(n) 2 marks delimiting n words in current cursor starting
- (ending if n<0) with word at cursor
- region thispara() 2 marks delimiting paragraph at cursor in current buffer
- void casechange(1,L,i,j) change letters in chars i to j-1 of L to uppercase
- void casechange(0,L,i,j) change letters in chars i to j-1 of L to lowercase
- ----------
- val eosentchars; /* characters that can mark end of sentence */
- ----------
- #define _(name) {&name,#name}
- Subr subrname[];
- ----------
- (The key functions are declared in MAIN.CC and EM.H)
- ----------
- void start_an_arg();
- val&getkeyseq(val P,char c=-1);
- void recordkeyseq(val &T);
- void getstring(char*pt,int Sl,val &T,int max);
- ----------
- byte esc_alt[26];
- enum{esc='['-64};
- ----------
- void out_of_store();
- void showmoan();
- int fileexists(char*);
- ----------
- #define totab(i) (((i)|7)+1) /* next tab position after i */
- #define sptotab(i) (7-((i)&7))
- /* how many spaces (not inclusive) from i to next tab position after i */
-