home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 21
/
CD_ASCQ_21_040595.iso
/
dos
/
prg
/
c
/
freedos3
/
source
/
emacs16d
/
_case.min
< prev
next >
Wrap
Text File
|
1991-07-19
|
4KB
|
192 lines
Name:F:capitalize-word
Capitalize word(s) before/after point.
[*]
#(Fxlat-words,capitalize,(arg1))
[*]
Name:F:downcase-region
Change the entire region to lowercase.
[*]#(Fxlat-region,#(Fmark),Fxlat-lower)[*]
Name:F:downcase-word
Lowercase word(s) before/after point.
[*]
#(Fxlat-words,downcase,(arg1))
[*]
Name:F:upcase-region
Uppercase the region.
[*]#(Fxlat-region,#(Fmark),Fxlat-upper)[*]
Name:F:upcase-word
Uppercase word(s) before/after point.
[*]
#(Fxlat-words,upcase,(arg1))
[*]
Name:Fcapitalize-word-do
Capitalize the word after point.
[*]#(sp,+)
#(Fxlat-region,>,Fxlat-upper)
#(sp,>)
#(Fxlat-region,},Fxlat-lower)
#(sp,})
[*]
Name:Fcase
Args:(a01,a02,a03,a04,a05,a06,a07,a08,a09,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
[wjm 4/13/90] The only argument that should be unprotected is the one
instance of arg2.
[wjm 4/30/90] Allow up to 18 cases, plus (mandatory) default.
................
(lots more explanation than code. This sucker's tricky)
If you look at the second ==, #(==,arg1,arg2,(...)), you might expect
that if arg1 == arg2 then (...) gets returned. However, Fcase is called
like this:
#(Fcase,arg1,
(new,(
stuff to do if arg1 = new.
)),
(forward,(
stuff to do if arg1 = forward.
)),
(backward,(
stuff to do if arg1 = backward.
)),
(
stuff to do if arg1 isn't any of the above
)
)
As you can see, arg2 has an unprotected comma in it, so that when the
second == gets executed, it looks like this:
#(==,arg1,new,(yes),(no))
Tests:
#(Fcase,a,(a,yes a),(b,yes b))
#(Fcase,b,(a,yes a),(b,yes b)) [doesn't work]
#(Fcase,b,(a,yes a),(b,yes b),(yes c))
#(Fcase,c,(a,yes a),(b,yes b),(yes c))
Ok, the code starts here:
[*]#(==,(a03),,(a02),(
#(==,(a02),,,(
#(==,(a01),a02,(
#(SELF,(a01),(a03),(a04),(a05),(a06),(a07),(a08),(a09),(a10),(a11),(a12),(a13),(a14),(a15),(a16),(a17),(a18),(a19),(a20))
))
))
))
[*]
Name:Fcase-fold
Given a string in old-search and old-replace and a match in temp, return the
replacement string.
arg1 = ASCII value of char from old-search.
arg2 = ASCII value of char from old-replace.
arg3 = ASCII value of char from temp.
[*]#(==,arg1,,,(
#(Fisupper,arg2,(
##(bc,arg2,d,a)
),(
#(Fisupper,arg1,(
##(bc,arg2,d,a)
),(
#(Fand,(Fisupper,arg3),(Fisupper,arg2),(
##(bc,##(--,arg2,32),d,a)
),(
##(bc,arg2,d,a)
))
))
))
))
#(==,##(old-search),,(
#(rs,old-search)
#(rs,old-replace)
),(
#(SELF,##(bc,##(go,old-search)),##(bc,##(go,old-replace)),##(bc,##(go,temp)))
))[*]
Name:Fdowncase-word-do
Lowercase the word after point.
[*]#(sp,+)
#(Fxlat-region,},Fxlat-lower)
#(sp,})
[*]
Name:Fupcase-word-do
Uppercase the word after point.
[*]#(sp,+)
#(Fxlat-region,},Fxlat-upper)
#(sp,})
[*]
Name:Fxlat-lower
[*]
!"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz[*]
Name:Fxlat-region
Translate the region according to the mark in arg1, and the string in arg2.
Note: cannot be called with a local mark (0..9).
[*]#(pm,2)
#(sm,0,arg1)
#(==,
#(mb,0,no,yes)
#(ds,temp,##(si,arg2,##(rm,0)))
#(==,##(temp),,,(
#(dm,0)
#(is,##(go,temp))
#(sm,0,<)
#(is,##(gs,temp))
))
,yes,(
#(sm,1,.)
#(sp,0)
#(sm,0,1)
))
#(sm,arg1,0)
#(pm)[*]
Name:Fxlat-upper
[*]
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ[*]
Name:Fxlat-words
Translate words, accepting numerical arguments like GNU Emacs.
BUG: in case of a negative argument, if there are too few words
between [ and point, also words to the right of point might be translated.
[*]
#(==,(arg2),,(
#(F(arg1)-word-do)
),(
#(==,(arg2),-,(
#(sp,-{)#(ds,count,1)
),(
#(g?,0,(arg2),(
#(ds,count,##(--,0,(arg2)))
#(sp,#(Floop,-{,##(count)))
),(
#(ds,count,(arg2))
))
))
#(Floop,(#(F(arg1)-word-do)),##(count))
))
[*]