Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
61
Task/Abbreviations-simple/SNOBOL4/abbreviations-simple.sno
Normal file
61
Task/Abbreviations-simple/SNOBOL4/abbreviations-simple.sno
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
* Program: abbr_simple.sbl
|
||||
* To run: sbl abbr_simple.sbl
|
||||
* Description: Abbreviations, simple
|
||||
* Comment: Tested using the Spitbol for Linux version of SNOBOL4
|
||||
|
||||
commands =
|
||||
+ "add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3 "
|
||||
+ "compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicate "
|
||||
+ "3 xEdit 1 expand 3 extract 3 find 1 Nfind 2 Nfindup 6 NfUP 3 Cfind 2 findUP 3 fUP 2 "
|
||||
+ "forward 2 get help 1 hexType 4 input 1 powerInput 3 join 1 split 2 spltJOIN load "
|
||||
+ "locate 1 Clocate 2 lowerCase 3 upperCase 3 Lprefix 2 macro merge 2 modify 3 move 2 "
|
||||
+ "msg next 1 overlay 1 parse preserve 4 purge 3 put putD query 1 quit read recover 3 "
|
||||
+ "refresh renum 3 repeat 3 replace 1 Creplace 2 reset 3 restore 4 rgtLEFT right 2 left "
|
||||
+ "2 save set shift 2 si sort sos stack 3 status 4 top transfer 3 type 1 up 1 "
|
||||
|
||||
commands = replace(commands,&lcase,&ucase)
|
||||
numerals = '0123456789'
|
||||
|
||||
|
||||
* Function filltable will fill the command abbreviations table
|
||||
define("filltable(s,n)slen,i")
|
||||
ct = table(300, ,"*error*") :f(errr);* command abbreviations table
|
||||
:(filltable_end)
|
||||
filltable
|
||||
slen = size(s)
|
||||
ct[s] = s
|
||||
eq(n,slen) :s(filltable3)
|
||||
i = n - 1
|
||||
filltable2
|
||||
i = lt(i,slen - 1) i + 1 :f(filltable3)
|
||||
ct[substr(s,1,i)] = s
|
||||
:(filltable2)
|
||||
filltable3
|
||||
filltable = ""
|
||||
:(return)
|
||||
filltable_end
|
||||
|
||||
|
||||
x0
|
||||
* Populate command abbreviations table
|
||||
commands ? (span(' ') | "") breakx(&ucase) span(&ucase) . c
|
||||
+ span(' ') (span(numerals) | "") . ablen = "" :f(x1)
|
||||
ablen = ident(ablen) size(c)
|
||||
ret = filltable(c,ablen)
|
||||
:(x0)
|
||||
x1
|
||||
* Process user string
|
||||
userstring = "riG rePEAT copies put mo rest types fup. 6 poweRin"
|
||||
output = "Original user string:"
|
||||
output = userstring
|
||||
userstring = replace(userstring,&lcase,&ucase)
|
||||
x2
|
||||
userstring ? (span(' ') | "") (break(' ') | (len(1) rem)) . c = "" :f(x3)
|
||||
user_commands = (gt(size(user_commands),0) user_commands ' ' ct[c], ct[c])
|
||||
:(x2)
|
||||
x3
|
||||
output = ""
|
||||
output = "User string with abbreviations expanded:"
|
||||
output = user_commands
|
||||
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue