1 v load permanent fingerprints and remap v 0*aa0)S+*aa20**aaa*aa" "<
2 >"GNIF"4#v($$v > 0"89b.tognuf"#@i$$$$ v
3 v ># #<0a".detroppus ton GNIF">:#,_@ (^reload)
5 v ZQ'C'># #<0a".detroppus ton NRTS">:#,_@
7 v YL'YA'># #<0a".detroppus ton KCOS">:#,_@
9 v YP'># #<0a".detroppus ton EKCS">:#,_@
11 initialize funge-space state
12 >'G'KZ'P'BZ'L'IZ"ELIF"4#v(0000"tad.tognuf/atad"#vOv
13 v -a0 p***aaa200 <) ># ># ># ># #< >0a".dab "v
14 > >:0\0\p v defs v _^#:G^#g 15p1e :<-a0 p15< v"State"<
15 v$_^#!: +1 < > 1-I0e1gB $ 1+ : | >:#,_51gC@
16 v) Cg15 p\0\0 $$$># ^#<000< >$2aaa***v
17 >'KY'BY'IYv v:G^#Bg1e0I-1 _^#:G^#g15 p1e: < +2<
18 v < >!#^_1-IV0e1g1+:e1pp$ 1>: v $
20 | gg1e: pg1e \$\VI-1_v#:Gv#g15 <
24 v < TODO FIXME: load ignore from statefile
25 try to load REXP for ignores
26 >"PXER"4#v($$'C'BZ'CY'FY00aa+-g!#v_00aa+-G7#vBv
30 save settings from the loader
32 v G1fP1f p10>#<0a".sserdda PI dilavnI">:#,_@
34 non-persistent state init
35 > 000f-p 010f-p 0"cri.nib.ledom"00fe+-P v
36 v p-+aa000 P-+ff00"tokens.bin.irc"0 <
38 load the babble model list
39 > 0ccc**00"tsil.selyts"#vi$$$$v
42 Build initial login packet at (0,0)
43 >0" KCIN"00PN5+11p50P11g:d\0p1+:a\0p1+11p0ad v
44 vp11++2*93g11P0g11"USER fungot * * :fungot-0.1"<
45 Create a socket and connect to server
47 vp12:>#<0a".tekcos a etaerc ot elbanU">:#,_@
49 v >#<0a".tcennoc ot elbanU">:#,_@
50 Send out the registration packet.
51 >0011g21g#vW11g-!#v_0a".deliaf dnes kciN">:#,_@
53 Main dispatch loop: parse IRC messages.
55 v < > >0a".deliaf daer CRI">:#,_@
59 >:11g\`| coming here if this byte needs to be processed emptycmd .
60 v <> :12g+0g :a-#v_ v and here if newline v 0< .
61 # >:d-#v_> $:0\12g+0p 02g0G03P :12g+1+ 02p 03g!| .
63 end of bytes from irc .
64 >12g+12pv updated eptr .
65 v < toggle to print raw: .
66 have to memmove message v$_,#! #:<"RAW >>> "0 < .
67 v +1 p0 -g20 < >03G>:#,_$v .
68 >02g >:12g\`! #v_ ::0g ^ v" <<<"a0< .
69 ^ p200p21-g20< >:#,_$ v .
70 0 <-- dummy value to discard up there .
71 irc message handler ^ return here when finished .
74 check for prefix v +1< .
75 > 03g':-#v_104p 1>:3g" "-| .
76 v 0 p400< v P41G31p3\0:< .
79 command start pos at stack .
80 find next space or 0 .
81 > :31p>:3g:#v_ >\ :0\3p 31g3G15P v .
86 0 0 command ends in nonzero, so at least one option
87 5 5 parse the options in a loop, :opt ends
89 >31g :3g':-#^_ 1+ 0\:v
90 >:3g:#v_ >\ :0\3p 31g >3G 05g5+0\P v
93 ^ p50+1g50 _v# p13+1 <
96 irc message has been split, process it
100 > 15G0"GNIP"Q#v_0ad"tognuf: GNOP"03P03e21g#vW^
101 v < v"Pong send failed."a0<
105 > 15G0"GSMVIRP"Q| parse privmsg target/prefix for reply
106 >06g'#-!#v_ 04g!| v+1 < > > ^
107 v <p4\!'<> 1>:4g:!#v_ '!- |v1 6 < privmsg print
108 | P60 G41 <1p4\0:<>p v_^#`g16:*2*ff_^#-g17g16 <
109 v _ d-if $># $61g:d\3p1+: a\3p1+ v
110 check the ignore list ^W^# g 12\3\0 <
112 > 04g!#v_00aa+-g!#v_ 14G0#vE 51p>51g:!#^_1-51pv
116 v_v#!-g14 < >0": "06GA0" GSMVIRP"A v
117 cmdchk ^g70 P30 p17p16:N <
119 non-command privmsg handling
120 catch-all own-name hook
126 >10f-G14GQ#^_00f-g1+>:00f-p3`!#^_61g71p ^
128 ^ < YB'YK' <)< <Cg17 $<
129 >f1G07GF!#^_>_v>'G'KZ'P'BZ"ELIF"4#^( 080 00fe+-K #^O71p 882**e1p01-v
130 v:g4:<1_v#g40< # >#v ^# p9\2+1_v#`*ff:g18 < p180p901p9:<
131 v_$$ v> ^^ P3p16+g< < v _v#! -2g9 < ^ <
132 ' >0':14GAN51p61g:51 ^ >71g00#vS$81gv 0
133 ! >1+^ p > > > > > > ^
134 >-#^_0\4^ > ^ v p15g9:<-1 <
135 v p17O^# K -+ff00 080Cg17< >:!#v_ 71g\0\#^S$^
136 > 0 > :9g:2- #v_$$71gC^ ^p9+ < pickword:
137 >1p3B1+^ >281g1 ^ >$$ 71g091gc1g8*+ #^S5 #^R$v
138 ^6+g15:g16 p15N < v 0< v0< v+1/3g18_v# g80 <
143 > \4*#v? 1>+\1-:#v_$ 18ge1g* 28g+e 1g*v p
144 v<> 2^ vp15%+g84 *g1e+ g83< 9
146 >51g\-#^ 5# 1# p#< > 71g 8 #^R $ v 1
147 ^_v#!`g1 5:+g87*g1e+g86*g1e+g85*g1eg84< 8
148 >$ 08g e1g*18g+e1g*28g+e1g*38g+ 81g1+:^
151 > ^ 0SE":,)'..!f"('?/s
152 >:98 +`#v_ 0\ jvvvvvvvvvvvvvvvvvv
153 v S^#*4\0\g1 7\0< ^ " fno" "rd"< >"): "^
154 >4#^R18ge1g* 28g+v^ << >'/ ^
155 vg80 S^#\0 +g83 *g1e<^ "'< >'? ^
156 >:51p#^R$ 51gv ^ :'< >"' " ^
157 v :-1 < ^ ,'< >"( " ^
158 > 8g\ :#^_ $" " ^ )'< >'"" " ^
164 v3*g1e+g82*g1e+g81*g1eg80 $R^#4g17 <^ < <
165 >8g+:c1p1-b1p0a1p71g#^L91p$ > a1gb1g`#v_ 71g 0 a1gb1g+2/ 8*91g+#^Sv
167 cur> ^ p1b-1/2+g1bg1a $_v#`g15: +g83*g1e+g82*g1e+g81*g1eg80 $R^#<
168 >51g\`#v_ 48ge1g*58g+e1g*68g+e1g*78g+ ^
169 cur< ^ p1a+1/2+g1bg1a < ^match
171 check for owner-prefix to make it easier for other commands
176 actual command-character commands
178 "reload" >51g!#^_ "SYOT"4#^( ^
179 >17G 0"daoler"Q!| prefix check ^W^# g12\3\0+bg16P3g16"Reloaded."ad0<
182 "raw" >v > 51g!#^_ 57GN51p03P 51g:d\3p1+:a\3p1+ v
183 >17GN3`|>4L0" war"v > >0a".deliaf dnes waR" >:#,_@
184 v P51<0 _^#Q < ^_^#!-W^# g12\3\0: <
186 "code" >v > 51g!#^_ 0"R0"67GA08P "RBUS"4#^(v ^ ) <
187 >17GN4` |>5L0" edoc"v v YO'YJ'YA'<
188 v P51<0 _^#Q < > 080C 'R'AZ'R'JZ'R'OZ ^
190 "save" >51g!#^_ > 'G'KZ'P'BZ"ELIF"4#^( 001 v
191 >17G0"evas"Q!| vPv#AK\0\a\0\g15:<-a0 p15O^#"data/fungot.dat"0 <
192 v < >$ 1+:#^_$vv_v#gg1e:$Pv#AUgg1e\a\0\g15 <
193 v B80"Fail: "<S'0$C< v!g\0:< ***aaa2 <> v :
194 v B80"OK."0 Cg15 $_v ^+1 $< v$\ < >1+ ^
195 >:51g\0\a\0\KA#vP$1+:e1 p:0\g51g\0\a\UA#vP$1^
197 ^ ># #< )'KY'BY 08G>N51p61g:51g+61p3P ^
198 "ignor">v >51g!#^_77g:#v_$00aa+-G ^
199 >17GN5` |>6 L0"erongi" v>" "-#v_87G7#vB87G00aa+-P 0".KO"^
200 v P51<0_^#Q <v < >U0" :er daB"A ^
203 "bool" >?>0".oN" 61g:3+61p3P> ^
204 >17G0"loob"Q!|>0".seY" 61g:4+61p3P^
207 "style">v >$ 67g:#v_$ 0":elbaliavA" 61g:a+61p3P ccc**v
208 >17GN4` |>5L0"elyts"v >" "-v v p15N " "G\0: _^#g\0:<+1 < p3p16<
209 v P51<0 _^#Q <010 _ccc**v > 61g:51g+61p3P :0\Ga0ef+-GQ#^_'*61g:1+^
210 > 1+ >:0\g#v_$0".dnuof toN">N51p 61g:51g+61p3P ^
211 ^ _v#QG77G\0:< ^G77 <
212 vP-+ef00A"model.bin."0G77 >#pa#1<
213 >77G0".nib.snekot"A00ff+-P 77GN1+a1gG0" :elyts detceleS"A 77P15P ^
215 "str" >v > 67g" "-!#v_> > >0"]txet[ dda/tes/teg 9-0 rts"41gv
216 >17GN3`|>4L0" rts"vv0'g75< $ $ $ v"Usage: "<
217 v P51<0 _^#Q <>- :9`| >N51p61g:51g+61p3P ^
218 >:0\`#^_a- 7>:7g:" "-#v_$ v
219 ^ >$ ^v p800 $_^#! \+1\<
220 v_v#Q"set"0G77 _v#Q"get"0G77 < P80G7+1 p7\0: <
221 >7 7G0"dda"Q | > >:0\g!#v_ 0\G >N51p 61g:51g+61p3P^
222 >51p08G051gP 0" :teS"61g:5+61p3P 51g^ >0".ytpmE"^
223 >:51p 0\GNe1p 051gP 08Ge1g51gP 0".deddA"61g:6+61p3P ^
225 ^ < v$_^#`g16:*2*ff<p |
226 "bf" >v > 61g71p 0480 vv ># v# <
227 >17GN2`|>3L0" fb"vv\0:_v#!-!'_v#:g7:<4< vp3\a:+1p3\d:g16< < |#
228 v P51<0 _^#Q <>7p v> 1+^ >1+0\3\21g#vW$v |-g17g16 <
229 v p15+1 < $< ^ < < < #
233 > 17GN2`|>3L0" lu"Q#v_v #
239 "show">v >$ 2aaa *** 57g:#v_$>:0\g#v_$ 0^
240 > 17GN3`|>4L0"wohs"v ^ $<| -" "< ^ +2 <>:0\" "\0\GAN51p v
241 v P51<0 _^#Q < >2+ >:0\G67GQv ^ p16+g15g16P3g16 < >+
242 ^ _^#g\0: _ 1+:0\g:#v_$e1p1> :e1gg0\ jvvvvvvv
244 > 61g:51g+61p3P v 2 $$''''
246 > > >61g:1+61p3P :1-#^_$ ^ P3p16+1:g16 < <<<<
248 : ' ' ^+'_^#g150_v#!`p1c:<**288_v#g15:gg1e+1:p15<<
249 1 ^_^#g150-\*2g1c< ^**5aa <
251 ^ $$ _$ 1\GN51p 61g:51g+61p 3P 0^
255 "def" >v > 15>:7g:#v_>$$$0">edoc< >gnal< >dnammoc< fed" 41g" :egas"v
256 > 17GN3`|>4L0" fed"]+1< > " "-#v_:0\7p1+57G08P:>:7g:#v_$ ^ vP3g16p15NU'<
257 v P51<0 _^#Q < ^ < >1+^ >61g51g+61p f^
258 v\0:_v#g\0:< ***2aaa P90G7\+1p7\0:_^# !-" "< |
259 G > :51p08G051gP v > :0\0\p:0\1\p ^ v"Defined."0$ <
260 >08GQ!#v_2+^ v p\0\0+2: < ^ < >61g3Pv #
261 > >1+ 09G0"fb"Q!#v_ 09G0"lu"Q!#v_ ^ v+8g16< -
262 v \ p\0\0: < \0< >61p 1^1
263 code URL handlers hook here ^ \1 < :
267 "str:">v >$ :5+7g!#v_ > 0".LRU :rts daB"61g:d+61p3P $$$$ f^
268 > :7GN3`|>4L0":rts"vvg7+4:< > >$^
269 v P51<0 _^#Q <>'0-:0\`|
271 v P7g15G\0-a \p15:\ <
273 "http://srv/path">:7+:>:7g:#v_$$ 0".LRU daB"61g:8+61p3P $$$$ f^
274 v :7G7L0"//:ptth"Q!| >1+^> :7G 0fP 0\7p v URL parsed
275 v < ^ _^#-/'<>0".dnuo" "f ton tsoH"61g:f+61p3P $$$ f^
279 v g1e< finished with URL handlers, restore args
282 > 1>:7g:" "-#v_$:0\7p1+>51p 2aaa*** >:0\g!#^_ :0\ v
283 ^+1 _ ^ ^+2 _v#QG71G <
288 exec prog-copy if not at line 8 (maybe check lang)
289 >\:8-!#v_:e1p 0\g08p 1> ::e1gg: !#v_\8p v
294 >$ aaaaaa*****81p 88+:*91p aaa**:a1p >1-:0\v
295 |bf exec v10 $_^#!:p9<
296 v\+1\g8:<+1 p18-1_v#:g18 <
297 j >$$$ 0"!emit fo tuo... " 61g3P 61g88++61p ^
299 >:8gb1p\b1g+a1g%\ ^ <> ret^
300 >:8gb1p\::9gb1g+91g%\9p\ ^ +-
302 >\:9g!>#^_\8g ^ ] >$$$$0"... "61g1-3P61g3+61p ^
303 >\:9g:a-: #v_$ >$'.> 61g:1+61p:ff*`| out
304 >\:51g:7g:#v_v>3-!#^_ ^ ^ \ p3 < in
306 1 >$ >91g+91g% \9p\ ^
310 >$ ffaa***81p 009p019p 091p v
311 |ul exec >0"!kcats fo tuo... " 61g3P61g89++61p ^
314 + >81g1-:81p#v_$$ 0"!emit fo tuo... " 61g3P 61g88++61p ^
316 > $$ 0"!kcats hcum oot... " 61g:a9++61p3P ^
317 > \:0dc*:*- `#v_$$ 0"!gorp hcum oot... " 61g:99++61p3P ^
319 >:'~-#v_$ 91g:9G Na1p 0aP a1g1++9G N :91ga1g2+++0`!#v_0aP0aP ^
320 v < v P9++1g1bg19Ga0 P9g19 p1b <
322 >:':-#v_$ 91g9G N :91g1++0`!#v_$0aP ^
323 v < > 1+91g\-:91p9P v
325 >:'!-#v_$ 91g9G N 91g1++ :0`!#v_$$ ^
328 >:'*-#v_$ 91g9G N:a1p 91g1++9G N91g2a1g+++0`!#v_0aP0aP ^
329 v < v P9p19:+1g19 A <
331 >:'(-#v_$ :1\1+>:8g :#v_$$$ 0"!( detanimretnu... " 61g3P61ga9++61p ^
332 v < >:'(-!#v_')-#v_\1-:#v_v
335 ^ g1a P9p19:-\g19+1N G8+1 p8\0 p1a: <
337 >:'a-#v_$ 0') 91g9G N91g1++0`!#v_0aP0aP ^
338 v < v P9p19:-2g19AA ('0 <
340 >:'^-#v_$ 91g9G N:a1p 91g1++ :0`!#v_$$ ^
341 v < >91p 0aP :1+8gb1p v
342 ^ -1 p8\g1b+1\ P8g1aGa0 p1a: --1g1a: <
344 $ >'S-!#v_ $ 0"!nsni dab... " 61g3P61gd+61p ^
345 $ > 91g9G N 91g1++ :0`! #v_ $$ ^
346 $ ^_v#` g16 **777 P3p16+g15:g16p15N p19 <
347 ^ < > 0"!tuptuo hcum oot... " 777** :aa++61p 3P ^
353 >^>e1p:0\> :7g :#v_$$!#v_ >$0".][ dehctamsiM" 61g3P 61ge+61p $f^
354 |bf prep >:'[- #v_$\1+\v #
357 v p181 pg1e00< v># v#<
358 > #v #+ #1 #<^#<p18+2g18 pg1e+1g18 pg1eg18 <
360 parsed >:'!-!#v_ >:'<-#v_$1\>:1+7g'<-!#v_\a1g%a1g\-v
361 v pg1eg180 $$< ^ +1\+1\<
362 >:'>-#v_$1\>:1+6g'>-!#v_\v <
363 v-\g19%g19\_v#--'g7+1:<\1$_v#!--':< ^ +1\+1\< >a1g% 1 ^
364 # > v >\1+\1+ ^ > > > > ^
365 ^2%g19<\_v#-+'g7+1:<\1$_v#!-+':<
366 1 >\1+\1+ ^ >:'[-#v_$03^>:'.-#v_$15^>16^
367 >:e1gg:#v_$$ v >:']-#^_$04^>',-!#^_ ^
369 > ::1\>2+:e1gg:3-!#v_4-#v_\1-:#v_v
372 1 ^ pg1eg1b+1: pg1e+1\ <
376 >$:1\0\p e1p :1-d1p >::7g \d1g-e1gp :7g#^_$ ^
386 (*,0): data packet storage
387 (*,1): misc. variables
388 (0,1): server IP address
389 (1,1): often data packet length
391 (3,1): at message-splitting, start of current command/option
392 (4,1): command character
394 (6,1): privmsg reply packet prefix len
396 (15-,1): bot's nickname
397 (*,2): socket message-splitting vars
398 (0,2): start of message
399 (1,2): end of message
400 (15-,2): owner prefix
401 (*,3): current raw irc message to handle/also reply packet
402 (*,4-x): parsed irc message
403 (0,4): 1 if prefix, 0 if not
404 (1-x,4): the prefix string if (0,4) is 1
405 (0,5): amount of command options, 0..15
406 (1-x,5): command string (always)
407 (*,6-x): command options, depending on amount
410 (5,1): short-time temp
411 (7,1): model/token file handle
412 (8,1): last output token generated
413 (9,1): bsearch table file offset (ret)
414 (a,1): bsearch min idx
415 (b,1): bsearch max idx
416 (c,1): bsearch entry amount (ret)
418 (*,8): I/O buffer for file ops
419 (*,9): generated token stream
422 langs: 0=bf, 1=underload
424 column 5 is used to go to program prep: stack: retaddr src_x dst_y lang
425 returns via column 80 with stack popped (src_y=7, dst_x=0)
426 column 6 is used to go to program exec: stack: retaddr org_y lang
427 returns via column 79 (copies prog to y=8 if org_y != 8)
429 (5,1): input string pointer (x, y=7)
430 (6,1): reply packet current length
431 (7,1): reply packet initial length for checking
432 (e,1): temp storage for y for progcopy/progprep
435 two-cell opcodes: first cell op, second arg. ops:
436 0: end program (no arg)
437 1: add arg (modulo 1000) to bfarray pointer - used for <>
438 2: add arg (modulo 256) to cell value - used for +-
439 3: jump to arg if cell zero - used for [
440 4: jump to arg if cell nonzero - used for ]
441 5: output cell (arg dummy 1) - used for .
442 6: input cell (arg dummy 1) - used for ,
445 (9,1): 256 - used in % for cell values
446 (a,1): 1000 - used in % for bfarray locs
447 top of stack (usually): input prog pointer (x, y=8)
448 second on stack: data array pointer (x, y=9)
451 - check that [] match
452 - convert instructions to bytecode with [] args missing
453 - scan bytecode and write targets to all [] pairs
454 (8,1): output program position
456 underload does not use a bytecode format, mostly because of ^.
457 underload prep just copies the program
459 top of stack: input prog pointer (x, y=8)
460 y=9 is used for the stack
461 y=10 is used for temp. data storage,
462 y=1 is used for variables (standard fungot):
463 9,1: underload stack top
465 underload stack goes to negative fungespace
466 the stack pointer starts at 0 meaning empty stack,
467 and there must always be a 0 at x=0/1,y=9 for string term.
469 brainfuck interp uses:
470 (5,1): input string position (x, y=7)
471 (6,1): output message position (x, y=3)
472 (7,1): output message start (to check if any; +2 for crlf)
473 (8,1): cycle count for limit
474 (9,1): 256; for modulo
475 (a,1): 255: for modulo
476 top of stack (at start): input program position (x, y=7)
477 second on stack: input data array position (x, y=8)
481 two rows per registered command
482 first row has zero-terminated command name
483 second row first cell is language code, 0=bf
484 rest of second row has the bytecode
486 --- this code block prints out parts of the IRC message ---
487 --- if you put it at the point where the message has been split ---
489 > 04g!#v_ 0" :xiferP">:#,_$ 14G>:#,_$ a, v
491 > 0" :dnammoC">:#,_$ 15G>:#,_$ a, v
492 v1 $_,#! #:<"arguments:"0.g50 <
494 ^+1,''$_,#! #:<G\0+5: <