00:00:00 --- log: started forth/09.01.13 00:33:49 --- quit: ygrek (Remote closed the connection) 00:37:54 --- quit: nighty__ (Client Quit) 00:53:46 --- quit: gogonkt (Read error: 110 (Connection timed out)) 01:56:50 --- join: qFox (i=C00K13S@132pc222.sshunet.nl) joined #forth 04:35:44 --- join: nighty__ (n=nighty@x122091.ppp.asahi-net.or.jp) joined #forth 05:21:39 --- join: joelr1 (n=joelr1@169.Red-88-3-15.dynamicIP.rima-tde.net) joined #forth 05:21:42 good day 05:21:46 what does this do? 05:21:47 : [CC] ( i -- ) CREATE 17 + C, 05:21:47 DOES> ( -- uchar ) C@ TS0 + C@ ; 05:22:23 i mean, i understand that create is normally followed by a name but not here 05:22:44 it defines a creating word 05:22:53 this is TS0 05:22:54 | CREATE TS0 48 GAP \ STDIN get attributes (original) 05:23:18 tathi: a creating word that uses names up to 17 chars? 05:23:37 It is simplistic structure. 05:23:52 TS0 is an array, though, no? 05:23:54 Where have you found such archaic code? 05:24:09 yeah, presumably 05:24:50 [CC] defines a word which fetches the character from TS0 + 17 + i 05:24:58 No. 05:25:00 ASau: it's ... something i have to deal with :-( 05:25:06 It is structure or record. 05:25:16 woot! now i understand 05:25:22 You have access by name, thus it doesn't contain uniform data. 05:25:30 Hence, it isn't array. 05:25:35 ASau: whatever. That isn't helpful. 05:25:44 it's for fetching from field c_cc of a termios structure 05:25:58 the field is at offset 17 05:26:01 on linux 05:26:01 Ah. That makes sense. 05:26:08 You see how it works now/ 05:26:13 ? 05:26:17 yep, now i do, thanks! 05:26:23 i just have to adjust 17 to 16 for mac osx 05:27:01 Better convert it to more modern "struct ... end-struct" 05:27:25 another question... what would &ATTR be at first glance? i mean, what would you put the & prefix in front of? 05:27:25 You'll have more transparent access, not getters only. 05:27:35 Mask? 05:27:38 Bit mask. 05:27:47 ASau: i dig your radical approach but ... can't use it :D 05:27:55 ASau: great /mask/ 05:28:56 now i have to parse the meaning of the mask 05:29:35 I'm not sure what you're trying to do, but you have ready functions to operate with termios structure. 05:29:52 ASau: i know that, man, but i must deal with what i'm given 05:29:54 man 3 tcgetattr 05:30:05 it's like when life throws you lemons you must make lemonade 05:30:12 i can't switch to functions yet 05:30:18 Alright. 05:30:37 If you're just trying to port the code, there's no real reason to change it more than necessary. 05:31:14 tathi: absolutely 05:31:18 i'm trying to minimize the changes 05:31:20 Unless upstream is likely to be interested in your improvements... 05:31:43 and i'll have to convince upstream (forth,inc) that my changes are necessary :D 05:32:02 And even then, it probably makes sense to get it working first so you have something to test against. 05:32:07 i'm half-done porting swiftforth to the mac 05:32:21 I was guessing that's what it was. 05:32:25 it runs but decided that it's running without a console 05:32:54 because the good folks at forth,inc. decided to use ioctl instead of tcgetattr and the arguments and masks for that ioctl don't match on the mac 05:33:03 Ah. 05:33:57 so i'm trying to fudge to see if i can manage but i don't think i'm doing too well 05:34:08 Fixing linux-only program may be major pain, esp. fixing ioctls. 05:34:49 yeah 05:35:02 another question 05:35:04 CREATE &ATTR 05:35:05 37777700000 , 0 , \ c_iflag (see termios.txt) 05:35:05 37777777770 , 5 , \ c_oflag 05:35:05 37777770017 , 2260 , \ c_cflag 05:35:05 37777000000 , 105061 , \ c_lflag 05:35:21 in here 05:35:21 &ATTR 16 0 DO DUP 2@ TS1 I + @ AND OR \ Apply masks 05:35:22 TS1 I + ! 8 + 4 +LOOP DROP ; \ ...working copy in TS1 05:35:26 what is going on? 05:35:44 | CREATE TS1 48 GAP \ STDIN set attributes (no echo, for KEY 05:36:41 the mask is being applied to the first 8 cells at the beginning of ts1, right? 05:37:10 16 cells, surely? 05:37:20 oh, 4 cells 05:37:27 16 0 DO ... 4 +LOOP 05:37:31 16 cells. 05:37:54 4 +loop loops across 4-octet cells. 05:38:07 and what does that do in layman's terms 05:38:21 DO takes an index and a limit 05:38:39 +LOOP adds the number to the index, and loops unless it crosses the limit. 05:38:43 i mean, what's the end effect 05:39:04 All this just clears one part of bits and sets (probably) another part of bits. 05:39:09 oh. you were right, it ANDS and ORs the values from &ATTR with the 4 cells at TS1 05:39:17 iflag, oflag, cflag, and lflag 05:39:43 hmmm 05:39:46 Let's see...2@ leaves the cell at the lower address on top, I think. 05:39:52 so what is the 5 here? 37777777770 , 5 05:39:59 so the first one is the AND mask 05:39:59 it ands with 37.... and ors with 5? 05:40:04 yup. 05:40:10 i see 05:40:16 So you'd have to look at the definition of the termios structure to see what those are. 05:40:22 i wonder why they are using octal. any idea? 05:40:34 joelr1: you have to read /usr/include/termios.h 05:40:47 ASau: my termios has hex 05:40:48 joelr1: on _both_ systems, linux and osx. 05:40:52 i'll have to look at linux 05:41:04 may that has octal masks in there 05:41:07 All to understand what those bits mean. 05:41:16 Dunno, I'd expect them to use hex. 05:41:30 377777? 05:41:35 That's octal. 05:41:39 I'm almost sure. :) 05:41:45 yes, thus my question 05:42:36 The old-school UN*X guys would almost certainly have used octal for the termios stuff. 05:42:40 Hmm...yeah, looks like the linux /usr/include/bits/termios.h has octal. 05:43:19 that gives me FFFF8000 05:43:30 dammit 05:43:49 Like I said, it may be _major_ pain. 05:44:49 Bah. If the osx include file is as simple as the linux one, you just write a forth #define word that translates hex to octal, and run the appropriate bits of termios.h through it. 05:44:55 i feel silly for asking but remind me, how does C know it's octal? 05:45:00 0 prefix 05:45:05 i thought so 05:45:14 here, let me paste the linux #defines 05:45:49 mac uses hex for sure 05:46:55 yeah, i think i got the gist of it 05:47:29 i wonder why they are ORing 5 for c_oflags, though ... looking 05:48:00 You have to read it in linux termios.h 05:48:18 http://pastebin.com/m67f8c4fb here's from my /usr/include/bits/termios.h 05:48:55 OPOST and ONLCR 05:49:06 yep, got that 05:49:09 thanks tathi 05:49:38 ONLCR is 2 here. 05:50:04 so i'll have to map the octals used for the masks into the attribute combo 05:50:07 Just to illustrate why it is so important to read appropriate termios.h. 05:50:20 so that i can translate that to the attribute combo on the mac and convert to hex 05:50:23 argh 05:50:36 You can leave it in octal. 05:51:04 ASau: not necessarily. some flags on the mac are not implemented and i need to translate octal to flags first 05:51:10 to the ONCLR, etc. 05:51:18 to find them in the termios file on the mac 05:51:36 I *think* you want to create a constant and conditionally compile the value based on the platform, if you've got enough info to do that. 05:51:39 You may find it better to translate flags to symbols. 05:51:59 You could write a little Forth program to do the flags to symbol translation 05:52:05 Like "ONLCR OPOST +" and use it in future. 05:52:08 You can define the OS X constants in hex and leave the Linux constants in octal. 05:52:13 right 05:52:25 but first i need to figure out what 37777700000 is for c_iflags, for example 05:52:43 and the other 3 05:52:59 i guess it can be done with a program 05:53:09 Or the forth command line. 05:53:20 TreyB: command line? how is that? 05:53:31 Just put the interpreter into octal, in put the values, switch to hex and dump the stack. 05:53:33 joelr1: They're probably just zeroing the flags they care about, and leaving the rest. 05:53:49 tathi: except i don't know what flags they care about 05:53:58 and need to find out by applying them against 37777700000 05:54:01 it seems 05:54:23 Sure. I'm just pointing out that you probably want to look at the 0s, not the 1s. 05:54:32 TreyB: i need to find out if a particular flag exists in that mask, just dumping won't work 05:54:35 Er. I guess that was obvious. 05:55:41 lets see .... i need an array of cells where each cell contains avalue 05:55:49 joelr1: you can write some throw-away code to do that once you've defined the constants. 05:56:16 You've got the right idea going. 05:57:34 then i iterate and apply ... but i also need to "name" each array element 05:57:34 With a bit of effort you could even hack up a parsing word to chew throug the C #defines. 05:57:40 through 05:57:53 (man, I've dropped quite a few letters today) 05:58:13 what's an idiomatic forth way of doing this? 05:58:30 set up two arrays, one with names and another one with strings? 05:58:45 TreyB: i wouldn't bother with that yet 05:59:00 TreyB: i'll type the numbers in by hand 05:59:14 As you wish :-) 05:59:31 let me start on the task and let you comment :-) 05:59:35 if you don't mind of course 06:00:43 You have the task, so you get to choose. I have no responsibility so my vote really doesn't count :-) 06:01:30 Depends on how much you want to play with it. 06:02:09 i wanna get it over with quickly 06:02:14 heh 06:08:05 Ack. The cflags aren't really just flags. 06:08:10 OK, that's not quite as simple as I thought. 06:09:59 tathi: what do you mean? 06:10:56 Hang on a sec, let me get this working and I'll paste it. 06:13:49 Do you mean it hardcodes speed there? 06:14:51 yeah, some of them aren't single bit fields 06:15:23 Hm. BSD systems have separate fields for that. 06:16:32 at least it looks that way 06:17:03 tathi: can you elaborate? 06:19:23 hmm... what is 00020. (dot at the end)? 06:19:30 double-cell number 06:19:58 right 06:20:04 my bits/termios.h has (for instance) #define B19200 0000016 06:21:03 #define B19200 19200 06:21:03 #define B38400 38400 06:21:19 You will have to decode them context-specifically. 06:22:03 tathi: it really looks like linux encodes speeds. which is weird. 06:23:04 ASau: Indexed into a table of fixed values, I'd guess. 06:23:34 Probably. 06:25:41 joelr1: here's the easy part: http://pastebin.com/m34c5dcc0 06:26:18 translation from linux bits to symbol names 06:26:28 tathi: you are way faster than i am :) 06:26:33 tathi: thanks 06:27:06 tathi: why no tabdly? 06:27:50 I left out the multi-bit stuff -- my bit# just grabs the least significant bit. 06:27:59 so I commented out anything that wasn't a single bit. 06:28:36 i see 06:29:08 tathi: how do i use this? 06:29:21 oflag flags ! 5 .flags 06:30:02 8 base ! 37777700000 invert .flags decimal 06:30:05 that sort of thing 06:30:27 ok, let me try 06:30:31 I was lazy and just commented out cflag entirely... 06:30:45 there may actually be a couple of single-bit flags in there... 06:31:20 hmm 06:31:38 i'll have to fix it to be able to use all flags 06:32:08 i mean, just and with the value (37777700000) and if > 0 then print the index or something like that 06:32:15 but all the bits in the mask matter 06:34:11 Well, you should be able to use it as-is for everything but cflag 06:34:25 the only other things I commented out are names for groups of flags 06:34:35 TABDLY = TAB1 + TAB2 06:34:47 TAB3 = TABDLY 06:35:09 :2: Address alignment exception 06:35:09 8 base ! 37777700000 invert >>>.flags<<< decimal 06:35:09 aha 06:35:09 .flags = iflag, oflag, etc. 06:35:14 --- quit: preflex (Remote closed the connection) 06:35:20 hmm, no 06:35:26 ok 06:35:36 alignment exception? 06:35:40 yep, in gforth 06:35:45 Oh, that was dumb 06:35:52 Err...or was it? 06:35:55 hang on 06:36:12 tathi: also, shouldn't there be separate matching against iflags, oflags, etc.? 06:36:42 you have to set the variable 'flags' to the set you want to match against. 06:37:15 or make a redefinition : .flags ( x flags -- ) flags ! .flags ; 06:37:23 --- join: preflex (i=mauke@rm-f.net) joined #forth 06:37:29 Then you could do 5 oflag .flags 06:37:32 oh, that;s what you meant by oflag flags ! 5 .flags 06:37:43 what's the 5 in here? 06:37:44 yeah. 06:37:55 I thought about something like : #define save-input create bl word count evaluate , restore-input bl word count here swap dup allot cmove bl word drop ; 06:38:09 Is there a backtrace for the alignment exception? 06:38:25 I can't see where I missed any alignment. 06:38:32 :2: Address alignment exception 06:38:32 8 base ! 37777700000 invert >>>.flags<<< decimal 06:38:32 Backtrace: 06:38:32 $335F28 count 06:38:33 $D 06:38:33 $20 06:38:52 tathi: what's the number 5? the thing i'm trying to match against? 06:39:39 Bah, that won't work, as it leaves out the length of the name. 06:39:46 joelr1: address alignment = unaligned memory access. 06:40:04 yeah, but you shouldn't get that with count in gforth, as char = au 06:40:08 that's bizarre 06:40:34 joelr1: this is to translate the numbers from your &ADDR paste above into symbol names, so you can then more easily find the correct values for MacOS 06:40:37 tathi: ! and @ perform cell access. 06:40:50 ASau: count only works with chars 06:41:03 and the backtrace he just posted shows the error coming from count. 06:41:53 i can try the same in another forth 06:41:53 I'm not sure about that. 06:42:50 count ( c-addr1 -- c-addr2 u ) return c-addr1 char+, and the character at c-addr1. 06:43:10 Return the character string specification for the counted string stored at c-addr1. c-addr2 is the address of the first character after c-addr1. u is the contents of the character at c-addr1, which is the length in characters of the string at c-addr2. 06:43:24 tathi: i think that's my fault 06:43:24 it shouldn't be doing anything with cells 06:43:28 oh? 06:43:31 since i didn't set that variable first 06:43:39 --- quit: nighty__ (Client Quit) 06:44:00 tathi: perhaps 06:44:08 ah. but it should be set from filling the table 06:44:13 tathi: the user interface here has me baffled ;) 06:44:35 ok, how so? 06:44:40 oflag flags ! 5 .flags vs 8 base ! 37777700000 invert .flags decimal 06:44:59 oh, sorry. 06:45:24 you have to make sure flags is set for the right termios field. 06:45:31 hence 'oflag flags !' 06:45:35 that stays set until you change it. 06:45:49 then you can use .flags 06:46:02 I didn't bother setting the base for 5, since it's the same number in decimal or octal 06:46:37 I inverted the mask, since you want the names for the 0 bits, not the 1 bits. 06:46:37 tathi: i think this is... somewhat wrong ... not sure 06:46:54 i want to know what 5 _and_ the mask represent 06:46:59 And there are no names for those high bits, so it would probably segfault if you tried to look them up. 06:47:08 shouldn't i not be setting .flags to anything then? 06:47:31 Hmm. OK, let me start over. 06:48:11 In the &ATTR code you pasted earlier, the first value is a set of bits to be cleared. 06:48:27 the second value is a set of bits that get set. 06:48:31 tathi: i'd go something like this 37777700000 oflag whatisthis? 06:48:37 yeah. 06:48:38 and get the flag list 06:48:43 then 5 oflag whatisthis? 06:48:48 and get the flag list 06:48:54 no? 06:48:57 so define : whatisthis? flags ! .flags ; 06:49:10 you need to invert 377..., but otherwise yes 06:49:22 tathi: why do i need to invert it? 06:49:34 because the 0 bits are the important ones there 06:49:55 and there are no names for the high bits anyway, so the table entries are undefined and probably 0, so you'll get a segfault or something 06:50:05 tathi: oh, i see now 06:51:36 tathi: cool! mapping my bits now 06:51:51 You'll have to translate cflag by hand (well, use Forth as a calculator), but that's no big deal. 06:52:05 Then you can start figuring out how to fix it for MacOS 06:52:14 Which I don't really know anything about, so you're on your own there. :) 06:52:31 OK, I need to get back to work. 06:52:39 tathi: thanks a lot! 07:01:09 --- quit: joelr1 () 07:15:11 --- quit: ASau ("Off.") 07:54:25 --- quit: Quartus` (Read error: 110 (Connection timed out)) 08:48:55 Oh bother. I didn't handle the #define foo 0 case. 08:49:06 Oh well, he'll figure it out. 08:49:49 maybe 10:22:46 --- join: GeDaMo (n=gedamo@dyn-62-56-77-42.dslaccess.co.uk) joined #forth 10:28:28 --- join: JasonWoof (n=jason@c-66-31-44-71.hsd1.ma.comcast.net) joined #forth 10:28:28 --- mode: ChanServ set +o JasonWoof 10:43:34 --- join: gogonkt`1 (n=info@218.13.55.225) joined #forth 10:55:48 --- join: I440r (n=mark4__@ip70-162-227-36.ph.ph.cox.net) joined #forth 11:41:55 erm im running a clamscan and its telling me that framework-2.7.tar.gz: Perl.Hacktool FOUND <-- thats right off the gentoo mirror 11:43:03 bah wrong channel lol 11:43:27 I was wondering why I didn't understand that sentence :P 11:44:24 im running a virus scan and its telling me gentoo is distributing viruses!!!! lol mite be a false pos tho 11:44:52 --- join: ygrek (i=user@gateway/tor/x-fffe0550833e2c1b) joined #forth 11:45:09 Might be worth Googling to see if anyone else has had the same thing 11:45:38 ~~ 11:46:49 good idea 11:46:56 glad i thought of it 11:47:10 Pfft! :P 12:04:09 --- join: sixforty (n=sixforty@68-25-228-64.pools.spcsdns.net) joined #forth 12:57:04 --- quit: ygrek (Remote closed the connection) 13:13:03 --- join: ygrek (i=user@gateway/tor/x-2a945b46a78f761e) joined #forth 13:34:41 --- quit: GeDaMo ("Leaving.") 13:47:30 --- quit: sixforty ("work") 13:49:21 --- join: xjrn (n=jim@c-24-7-31-66.hsd1.ca.comcast.net) joined #forth 14:04:39 --- join: gogonkt (n=gogonkt@218.13.55.225) joined #forth 14:13:59 --- quit: gogonkt ("WeeChat 0.2.6") 14:14:06 --- join: gogonkt (n=gogonkt@218.13.55.225) joined #forth 14:15:04 --- quit: gogonkt (Client Quit) 14:18:08 --- join: gogonkt (n=gogonkt@218.13.55.225) joined #forth 14:18:54 --- quit: gogonkt`1 ("leaving") 14:19:44 --- quit: gogonkt (Client Quit) 14:19:56 --- join: gogonkt (n=gogonkt@218.13.55.225) joined #forth 14:22:42 --- quit: malyn ("Caught sigterm, terminating...") 14:30:46 --- quit: gogonkt ("WeeChat 0.2.6") 14:31:47 --- join: gogonkt`` (n=info@218.13.55.225) joined #forth 14:33:20 --- join: malyn (n=malyn@unaffiliated/malyn) joined #forth 14:35:54 --- quit: ygrek (Remote closed the connection) 14:47:49 --- join: joelr1 (n=joelr1@169.Red-88-3-15.dynamicIP.rima-tde.net) joined #forth 14:47:52 howdy folks 14:48:44 how do i do FOO WORD and have WORD CREATE FOO_BAR? 14:48:51 does this require the scratch pad? 14:50:02 tathi: ping 14:55:06 I'm not sure what you're asking 14:55:23 probably, yes. 14:56:01 tathi: ok, here 14:56:04 joelr1: depends on what forth you're using 14:56:12 imagine i wanted a word that created a word with a prefix 14:56:16 joelr1: afaik the only way to do it compatibly is to use EVALUATE 14:56:19 JasonWoof: ans forth 14:56:23 ok, that's what I thought 14:56:43 joelr1: 1) ans is kinda vague 2) it doesn't say how to do this 14:56:50 i'm mapping syscalls to function calls, for example. so that every sys_exit is mapped to _exit 14:57:03 3) forth implementors (if they follow ans at all) don't always follow the same version of that spec 14:57:05 this gets tedious quickly 14:57:06 _exit 1 SYSCALL: sys_exit \ status 14:57:23 aha 14:57:33 so i want to do _exit 1 SYSCALL instead and have SYSCALL pull sys_exit out of thin air ;-) 14:57:49 if you pass it the long form, you could do it relatively easily by manipulating >IN 14:58:07 no, i want to pass the short form :) 14:58:19 joelr1: use EVALUATE 14:58:31 i sense a need for BL WORD COUNT... hmm 14:58:33 then yeah, you have to have a buffer somewhere to build the long form in 14:58:47 look at gforth's compat/execute-parsing.fs 14:58:48 use WORD to read in "exit" and add "create sys_" to the begining of that string 14:58:50 or whatever the file is. 14:58:52 then EVALUATE it 14:59:10 JasonWoof: that won't work 14:59:14 here's what syscall looks like 14:59:17 sure it will 14:59:28 : SYSCALL: ( fn n -- ) SWAP ( n fn) 14:59:29 CODE [+ASSEMBLER] ( fn) # EAX MOV [PREVIOUS] 14:59:29 DUP 5 U< NOT ABORT" Invalid number of parameters" 14:59:29 >SYSCALL [+ASSEMBLER] ( addr) JMP END-CODE [PREVIOUS] ; 14:59:35 so i need to modify this code to do it 14:59:48 JasonWoof: see how it's using CODE already? 15:00:07 wait... you didn't write syscall:? 15:00:10 tathi: pad then. let me look what what gforth does 15:00:10 so add "CODE sys_" to the beginning of the string 15:00:13 JasonWoof: of course not 15:00:16 oh 15:00:20 JasonWoof: he's porting SwiftForth to OSX 15:00:31 well then construct the string "syscall: sys_exit" and call evaluate 15:00:42 oh, very good 15:00:44 tathi: are you sure about CODE? i already ahve code in that fun. i just need to add sys_ 15:00:56 joelr1: don't change syscall: just call it 15:00:57 yeah, just redefine syscall: 15:01:34 JasonWoof: don't think i can just call it. it's being called like this currently 15:01:43 _exit 1 SYSCALL: sys_exit \ status 15:01:45 and i want 15:01:45 _exit 1 SYSCALL: sys_exit \ status 15:01:46 joelr1: call it with evaluate 15:01:47 err 15:01:52 _exit 1 SYSCALL: \ status 15:02:08 oh, that would be tricky 15:02:27 tathi: but it would look oh so nice! 15:02:38 how about 1 SYSCALL: _exit ? 15:02:46 tathi: that's fine 15:02:55 : short-hand-syscall: bl word count prepend-syscall_sys_ execute ; 15:02:57 tathi: how does that change things? 15:03:10 because you can have SYSCALL: parse the name 15:03:20 prepend-syscall_sys_ prepends the string "syscall: sys_" 15:03:24 tathi: and prepend sys_? 15:03:29 ya 15:03:38 tathi: how? 15:03:51 JasonWoof: tathi is winning, i'm sorry 15:03:58 No, we're saying the same thing. 15:04:04 more or less 15:04:13 let's see...gforth has place and +place 15:04:26 tathi: i like your user interface better 15:04:53 Jason agrees with me about the user interface, I'm pretty sure. 15:04:55 tathi: no place in sf . let me see what place and place+ do 15:05:18 i don't like the "prepends the string syscall: sys_". i'd like to prepend sys_ 15:05:31 and keep my nice table of 1 SYSCALL: _exit, etc. 15:05:38 place ( c-addr u c-addr2 -- ) \ store c-addr u to c-addr2 as a counted string 15:05:41 still don't get it huh? 15:05:44 +place is the same, but appends it. 15:05:47 no 15:05:52 : place 15:05:52 over >r rot over 1+ r> move c! ; ok 15:05:53 you have to pass "syscall: sys_exit" to EVALUATE 15:06:08 JasonWoof: you keep pushing evaluate, i don't like that... for some reason 15:06:10 JasonWoof: no. He has been doing this a lot -- he has all the pieces, just needs some help putting them together for some reason. :) 15:06:12 call it intuition 15:06:29 joelr1: execute-parsing uses evaluate, but with some safeguards. 15:06:38 ph 15:06:40 oh 15:06:46 But it uses evaluate all the same -- there's no way around it in standard forth 15:07:06 joelr1: do you have some function that takes a string on the stack and CREATEs a word with that name? 15:07:14 There just wasn't (I think) any common practice back then to standardize. 15:07:18 because ANS forth doesn't define one 15:07:26 if you want to do this in ANS style you have to use EVALUATE 15:07:32 allright, what about 1 syscall: sys_exit? 15:07:39 tathi: and your in> suggestion? 15:07:52 you can pass the short form if you want 15:08:05 Doesn't really matter... 15:08:11 personally, I think you should just leave it alone, and have "sys_" prefixes on your definitions 15:08:23 yeah, I think I'm agreeing with Jason now. 15:08:34 would certainly be a lot easier to find definitions for things like sys_exit if the definition actually contained the text "sys_exit" 15:08:47 --- join: sixforty (n=sixforty@68-25-228-64.pools.spcsdns.net) joined #forth 15:08:50 er. hmm. 15:09:09 I'd certainly be pissed if I was grepping through the source code for your forth, trying to find the definition of sys_exit and that text did not appear in the sources anywhere 15:10:00 there are generally advantages to being explicit 15:10:12 ok 15:10:42 joelr1: it's true that what you're proposing isn't very forthy 15:11:03 You can do it: I have several times, but... 15:11:58 the thing I've wanted to do a few times is make a word that created multiple definitions 15:12:51 : SYSCALL: >IN @ >R PARSE-WORD 4 /STRING EVALUATE R> >IN ! SYSCALL: ; 15:13:02 That will give you 1 syscall: sys_exit 15:13:07 oops. 3 /string 15:13:09 cool 15:13:38 tathi: thanks 15:13:40 and that's a perfectly safe use of EVALUATE 15:13:54 :) 15:16:24 i'm enjoying forth tremendously 15:16:32 It's a fun language. 15:16:38 and living in gdb all day is not that hard either 15:16:42 not hard on me that is 15:16:52 <-- plans to use forth to make a living 15:16:53 And you're actually writing *in* Forth, instead of implementing it in some other language, which is good. :) 15:17:03 wait... executing _exit gives you the syscall number for exit() ? 15:17:35 I was wondering that, because 1 is the syscall number, I think...but also the number of parameters. 15:17:47 no 15:17:53 i'm not using syscalls 15:17:56 anymore 15:18:00 switched to functions 15:18:11 what's _EXIT do? 15:18:14 but i don't fancy going around the kernel code and fixing up all the invocations of sys_... 15:18:20 JasonWoof: man exit 15:18:33 joelr1: in your forth 15:18:42 in _exit 1 syscall: sys_exit 15:18:45 so what i want to do is call the libc exit function when sys_exit is invoked 15:18:47 I know what the syscall does 15:18:58 it's the C function exit 15:19:00 that one 15:19:15 joelr1: what does your forth word "_exit" do? 15:19:16 actually, it's a pointer to a stub that has the pointer to the actual function 15:19:27 JasonWoof: it's an assembler label 15:19:42 * JasonWoof blinks 15:19:47 before 5 HLT instructions that get populated by the dynamic linker with the pointer to _exit in libc 15:19:51 so _exit puts a function pointer on the stack, basically 15:19:58 tathi: right on mate 15:20:13 void ** 15:20:16 pointer to pointer 15:20:26 joelr1: have you considered using libffi or libffcall or whatever it's called? 15:20:35 JasonWoof: no need 15:20:43 that's girly 15:20:53 real men create macho files by hand, without using a linker 15:20:55 ffi is awefully handy 15:21:02 that's mach-o files 15:21:14 swiftforth has a nice ffi already 15:21:33 then your users can do things that you think are stupid, like link to libpython, and they don't have to bug you for bindings :) 15:21:39 the issue is not what ffi to use but how to create a nice interface for existing sys_call users 15:21:55 JasonWoof: swiftforth already provides for that 15:22:03 cool 15:22:14 JasonWoof: I gather swiftforth builds on pretty much whatever Forth already, Joel is just trying to port it to OSX while changing as little as possible. 15:22:27 so why can't you just use the existing ffi mechanism to call libc's exit()? 15:22:29 tathi: right on mate 15:22:35 and i also have to cross-compile from linux 15:22:46 right 15:23:01 swiftforth is written in ans forth? 15:23:02 JasonWoof: why should i bother? i already have a mechanism to call libc's exit 15:23:13 JasonWoof: Apparently. Pretty cool, huh? 15:23:18 yeah :) 15:23:20 someone has the linux version of swiftforth? 15:23:29 I didn't think to do that until kc5tja did 15:23:34 JasonWoof: i define a stub in the mach-o header and it gets populated by the dynamic linker. i save the ptr to a stub in a "forth assembler" label 15:23:51 until then I'd written my assembler code in assembler... 15:23:56 then i can just "call" that label where "call" is a another "forth assembler" word 15:24:21 basically, i've been given a tarball of forth source code and the linux binaries 15:24:22 joelr1: good times 15:24:46 heady times 15:24:49 but i'm almost done 15:24:50 I made mach-o binaries from my forth-ish thing 15:24:54 OK, time to eat. 15:24:55 should fit within 2 weeks 15:24:58 bbl 15:25:02 don't think I made it link to anything though 15:25:03 tathi: bon appetite 15:25:17 JasonWoof: i link against libc, dynamically 15:26:27 don't you need libld to have an ffi? 15:26:37 I'm fuzzy, never written an ffi 15:26:53 just syscalls on ppc (linux and macox) 15:27:00 s/macox/macosx/ 15:27:21 JasonWoof: yes, you use dlopen, dlsym, etc. 15:28:27 --- quit: I440r ("Leaving") 15:28:31 let me make sure I've got this right: I can download swiftforth sources, run them in gforth on linux, and it'll spit out an ELF file of swiftforth. Correct? 15:29:38 and what you're doing is modifying the swiftforth sources so you can have the option of it spitting out a mach-o file that will be swiftforth for mac os x. Correct 2? 15:29:48 JasonWoof: yes 15:29:55 yes 15:29:57 on both counts 15:29:58 * JasonWoof dances the disco duck 15:30:18 once i have a running mac kernel then i can do all the development on the mac, including bootstrapping other platforms 15:30:21 arm/iphone anyone? 15:30:23 ;) 15:30:39 iphones are locked 15:31:29 no 15:31:34 yes 15:31:42 apple chooses what you can run on them 15:31:47 i'm a developer officially 15:32:00 and apple doesn't care so long as it's a statically linked binary 15:32:02 you have to pay apple for the right to even develop for iphone 15:32:45 you cannot provide a software download for the iphone 15:33:51 JasonWoof: i already paid, became a member of the dev program 15:34:03 i gotta go fix the mac kernel 15:34:05 cheers! 15:34:25 toodles 15:37:07 --- quit: joelr1 () 16:16:26 --- quit: qFox (Read error: 131 (Connection reset by peer)) 16:21:07 --- quit: sixforty ("zzzzzzzzz") 16:27:29 --- join: nighty__ (n=nighty@210.188.173.245) joined #forth 17:01:22 --- part: schme left #forth 17:12:13 --- join: gogonkt (n=info@124.64.19.98) joined #forth 17:54:40 --- quit: xjrn (Connection timed out) 18:06:10 --- join: xjrn (n=jim@c-24-7-31-66.hsd1.ca.comcast.net) joined #forth 18:09:42 --- join: ioerror (n=ioerror@mail.lostinthenoise.net) joined #forth 18:11:00 I'm curious about writing tcp/ip programs in FORTH using Gforth, is there anyone who has suggested reading on the topic? 18:11:16 Specifically, I was thinking about writing `ping` in forth just for fun. 18:17:34 --- quit: xjrn (Read error: 60 (Operation timed out)) 18:35:44 --- join: ASau (n=user@193.138.70.52) joined #forth 18:51:27 ioerror: you'd need a library, or to interface with the kernel 18:51:40 I think... 18:51:53 I'm pretty sure gforth lacks networking support of any kind 18:52:34 JasonWoof, I figured that I can do it in assembler but I had hoped someone else had done this :-) 18:57:24 many people have written assemblers 18:57:54 eg swiftforth is written in forth which outputs the swiftforth binary when run 19:03:24 well, I was thinking of using gforth to call the system calls directly with assembler, thus making words that you can call to call the systemcalls 19:04:02 JasonWoof: that's wrong 19:05:11 ASau: that's what I was told 3.5 hours ago in this chatroom 19:05:13 I sent fixes to networking code when I worked with Cygwin. 19:05:29 That was more than year ago. 19:05:57 You have socket interface there. 19:08:17 ASau: you're saying that gforth has socket support built in? 19:09:04 That depends on your meaning of "built in". 19:09:11 Yes, gforth has socket support. 19:09:22 And it has it for pretty long time. 19:10:37 I don't see anything in the manual about it http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ 19:10:58 ASau, tell me more? :-) 19:11:58 ioerror: require unix/socket.fs 19:12:55 It fails due to wrong library generally, but you know how to fix that. 19:13:11 well, lookie there /usr/share/gforth/0.6.2/unix/socket.fs 19:13:32 you know, gforth might just be useful if it had decent documentation with examples 19:15:24 JasonWoof, what's a better forth implementation? 19:15:34 ASau, i don't know yet but I'll probably figure it out 19:15:35 dunno 19:15:58 I don't find forth very useful 19:16:14 wait, isn't this #forth? 19:16:25 yep 19:16:34 I like it 19:16:39 but I don't find it practical 19:16:55 and I don't particularly like gforth 19:17:07 mostly because it's very short on good documentation 19:17:33 What forth isn't short of documentation? 19:18:18 beats me 19:18:22 I don't like the direction gforth moves last half year. 19:18:34 gforth has moved in the last 6 months? 19:18:56 It continues drifting there. 19:19:32 holy crap, they actually released 0.7.0?!? 19:19:41 when did this happen? 19:19:46 Yes. 19:19:58 I don't remember. 19:20:09 0.7.0 is disappointing me. 19:20:53 ASau, so this socket code looks like just what i wanted 19:20:56 ASau, thanks for writing it 19:21:06 I'm not one who wrote. 19:21:12 I've fixed it in past. 19:21:16 ah, ok 19:21:20 0.6.2 doesn't contain fixes though. 19:21:33 my distro (ubuntu) still has 0.6.2 which appears to have been released on about 25-Aug-2003 19:21:52 I used that layer for practical work back. 19:22:10 Sure, there was no release for 5 years. 19:22:23 file date on 0.7.0 is nov 2 2008 19:22:40 I haven't yet packaged gforth 0.7.0. 19:22:46 Well... 19:22:56 I'm in no rush 19:23:04 I did, but it cannot enter distribution in this state. 19:23:12 unless it suddenly has amazing documentation 19:23:35 No. 19:23:58 It everything became worse, because the main difference isn't even bug fixes. 19:24:25 It is one more, new FFI, which requires run-time C compiler and libtool. 19:28:51 what the hell is this supposed to mean? 19:28:53 is a decimal prefix: 10 now produces (decimal) 10 19:29:12 that's from http://www.jwdt.com/~paysan/gforth.html 19:32:00 what the hell is this all about: libcc C function call interface (requires libtool and gcc at run-time) 19:36:24 --- quit: madgarden ("Leaving") 19:47:09 The latter is about FFI to C. 19:47:29 It requires libtool and C compiler at run time. 19:48:15 For instance, earlier you linked to libffi or ffcall and could call all those socket functions, 19:48:23 provided you know their prototypes. 19:48:44 Now you might encounter troubles. 19:54:05 what does it use the c compiler at runtime for? 19:57:55 To compile shared libraries. 20:01:04 ASau, do you have any example programs written with that socket code? 20:01:14 (I'm two days into learning forth for the first time) 20:02:05 Yes, I used to work with CISCO RADIUS and Netflow services and have some code to work with Postgres. 20:02:47 ASau, anything public? 20:03:04 No. 20:03:13 If you want it, ask me later a bit. 20:03:26 I'm regular here. 20:03:29 ASau, it also looks like it doesn't do icmp? 20:03:34 or raw sockets? 20:03:58 If you want raw sockets, you can get them. 20:03:59 oh? 20:04:05 my regexes have failed me :-) 20:04:08 The FFI layer is pretty thin. 20:04:24 I have to leave you for a while. 20:04:34 Sorry for running away, I'll return later. 20:04:48 no problem, thank you for your help! 20:23:27 --- quit: ASau (Read error: 113 (No route to host)) 20:57:31 --- join: madgarden (n=madgarde@CPE001d7e527f89-CM00159a65a870.cpe.net.cable.rogers.com) joined #forth 21:54:42 --- join: ygrek (i=user@gateway/tor/x-063c1ec5885ff5b5) joined #forth 22:45:27 woh, I don't like it when acpi says I have 54 seconds remaining 23:13:40 --- join: xjrn (n=jim@c-24-7-31-66.hsd1.ca.comcast.net) joined #forth 23:31:24 --- part: X-Scale2 left #forth 23:59:08 --- quit: JasonWoof ("off to bed") 23:59:59 --- log: ended forth/09.01.13