Just can't find out what's wrong
Two examples in the included source, the first, "checkcmd" uses words for
the switch cases, the other uses strings..
Also included is my addition to the switch function (but that itself is not
the one causing this problem)
This source does no no way reflect the current state of my IRC client (I
just wanted to make the source more readable using words instead of
strings) :)
/PeO
--
/* PeO - AMiGA owner since 1990, CGI, Perl, Assembly language & HTML-fanatic *\
\* Amiga 4000TE/060-50/604e 200, 146Mb, 33.4Gb, ZIP, JAZ, CVPPC/8 */
/* IIyama VM Pro 21", CP-SW2 Subwoofer system, NEC-222 *\
\* Plextor 12-Plex, Yamaha CRW 4416S, Artec A6000C+, Stylus Color 500 */
/* Lightfax 3660, Catweazel Z-II (3*IDE, 1*PC Floppy), Minolta DImage V *\
\* SCSI-Tower, Seagate Tapestor 4/8GB, Ariadne Ethernet, Minolta PagePro 6 */
REBOL []
RPL_WELCOME: "001"
RPL_YOURHOST: "002"
RPL_CREATED: "003"
RPL_MYINFO: "004"
RPL_BOUNCE: "005"
switch: func [
"Selects a choice and evaluates what follows it."
value "Value to search for."
cases [block!] "Block of cases to search."
/default case "Default case if no others are found."
][
either value: select cases value [do value] [
either default [do case] [none]]
]
switch2: func [
"Selects a choice and evaluates what follows it."
value "Value to search for."
cases [block!] "Block of cases to search."
/default case "Default case if no others are found."
/cs "Do a case-sensitive search"
][
either
either cs [value: select/case cases value] [value: select cases value] [
do value
] [
either default [
do case
] [
none
]
]
]
checkcmd: func [command [string!]] [
print reform ["type? command:" type? command]
print reform ["command:" command]
switch/default command [
RPL_WELCOME [
print "welcome"
]
RPL_YOURHOST [
print "yourhost"
]
RPL_CREATED [
print "created"
]
RPL_MYINFO [
print "myinfo"
]
RPL_BOUNCE [
print "bounce"
]
][
print "other command"
]
]
checkcmd2: func [command [string!]] [
print reform ["type? command:" type? command]
print reform ["command:" command]
switch/default command [
"001" [
print "welcome"
]
"002" [
print "yourhost"
]
"003" [
print "created"
]
"004" [
print "myinfo"
]
"005" [
print "bounce"
]
][
print "other command"
]
]
print ""
print "Output from checkcmd RPL_WELCOME"
checkcmd RPL_WELCOME
print ""
print "Output from checkcmd2 RPL_WELCOME"
checkcmd2 RPL_WELCOME