00:00:00 --- log: started retro/11.04.16 03:35:35 --- quit: erider (Ping timeout: 246 seconds) 04:01:32 --- join: roarde (~roarde@pdpc/supporter/active/roarde) joined #retro 04:13:34 --- quit: roarde (Quit: Leaving) 04:54:40 --- join: erider (~chatzilla@pool-108-3-149-46.bltmmd.fios.verizon.net) joined #retro 04:54:51 --- quit: erider (Changing host) 04:54:51 --- join: erider (~chatzilla@unaffiliated/erider) joined #retro 04:54:56 morning 05:23:45 good morning 06:15:56 hey crc shouldn't this increment the value not the pointer *s++; 06:16:10 crc I was looking at you example 06:16:26 *s = c; 06:16:28 *s++; 06:16:30 l++; 06:16:46 shouldn't it be s++ 06:22:42 crc: while (isalpha(c = getc(in))) { 06:22:43 temp[i++] = c; 06:22:45 } 06:23:14 that should build a string right 06:39:45 hey crc: http://pastebin.com/FQe5TZm6 for some reason this goes into a forever loop 06:51:36 a few issues: 06:51:36 1) a pointer to nowhere (char *temp;) 06:51:36 2) since the pointer is incremented, the printf() will start from the current value, not the original one 06:55:42 crc so I need to set it to NULL 06:58:46 no, you need to point it to an allocated memory area 06:59:30 e.g., http://sprunge.us/BfDQ 07:00:49 crc: I have my numbers just like that and I get no issues 07:01:47 while (isdigit(c = getc(in))) { 07:01:49 temp[i++] = c; 07:01:50 } 07:01:52 num = atol(temp); 07:02:09 that's not incrementing the pointer though 07:02:47 and how is temp declared for that function? 07:02:56 char *temp; 07:03:25 so still problematic in that it's not specifically pointing anywhere 07:03:54 ok 07:04:00 * erider is fixing it now 07:04:13 but here you are indirectly accessing it (via an index variable) rather than incrementing, so the original address is not lost 07:06:00 I tried that with the chars with no luck 07:09:18 http://sprunge.us/CTbg 07:13:47 I think I fixed it 07:13:54 crc: question 07:14:01 yes? 07:14:27 doesn't *temp++ increment the value not the pointer 07:15:03 why can't I do temp++ 07:15:31 or temp[i++] 07:22:35 crc: I wonder if I could have used isalpha like in my original 07:23:09 isalpha matches any alphabetic char 07:23:17 temp[i++] will work 07:31:36 I think I have something that will work 07:36:36 crc: http://pastebin.com/L2XgH166 07:43:57 crc: alright on to strings 07:44:39 * erider has fixnum, Boolean and char literals 08:07:42 hmm not quite finish with the literals :( 08:45:06 ok good now 09:05:02 I wonder how hard it'd be to write a simple lisp-like parser in retro... 09:05:26 I have some code already for dealing with cons cells 09:58:51 crc: unknown :) 10:23:05 --- join: aisa (~aisa@c-68-35-164-105.hsd1.nm.comcast.net) joined #retro 10:33:51 crc: is it always a good ideal to set a pointer to null 13:52:44 why would you want it set to null? 13:55:12 crc: just wondering is good practice to set it to something, because of junk 14:19:19 char *ptr; <---- this is fine, just point it somewhere valid before use 14:56:19 --- quit: aisa (Quit: aisa) 16:02:48 crc: ok, hey question 16:03:42 yes? 16:03:52 crc: is it better to parse char by char of just suck the whole thing into a buffer and parse that 16:04:17 the reason way I asks is because I just found a bug 16:05:02 it depends on the application 16:05:03 my fixnum routine is taking one more char than it should 16:06:00 I generally read by tokens (e.g., with retro), breaking when a particular character is encountered. For some things though (such as rancid), I read a line, then parse it into various parts 16:06:05 so with I have this (2 . 2) it keeps 2) but when I do (2 . 2 ) its good 16:06:18 I am working on pairs :) 16:06:27 pair = cons? 16:06:42 yeah car, cdr and con 16:07:29 can you pastebin the entire code? 16:08:04 crc: sure it doesn't do much be echo right now 16:08:22 easier to debug if I have the full code :) 16:15:53 http://pastebin.com/VcRXgdwz 16:18:25 I need to look at how I am handling fixnums 16:22:58 crc: I am wondering if atol is dong something weird 16:25:32 crc: wonder if this would fix it? (isdigit(c = getc(in)) && (!is_delimiter(c))) 16:28:19 nope 16:28:49 no? 16:29:21 the num buffer must be getting an extra char 16:30:20 doesn't appear so 16:33:02 read() is consuming the ) 16:35:38 really!? 16:36:14 I think so, trying to confirm now 16:36:56 I am going to try an ungetc 16:38:32 http://sprunge.us/QTRN 16:38:45 a patch that lets (2 . 2) parse properly 16:40:20 yeah the ungetc worked for one thing 16:40:48 crc: hey that is the problem with reading one char at a time 16:42:11 reading lines into a buffer has its own issues. what if you fill the buffer before the input is completed? token by token is easier, but not always possible. 16:45:26 crc: well I guess I will keep moving with token by token method :) 16:49:42 crc: you said you never used ungetc? then how did you put token back on the stream? 16:50:01 I don't use ungetc in my code 16:52:05 crc: how do you rewind 16:52:20 I don't 16:52:49 retro's standard parser can't rewind the input source 16:56:11 oh 16:58:07 even if I wanted to, the vm does not expose the input stack directly, so there's no way to rewind 16:58:29 crc: I have learned with using ungetc you have to follow the parser char by char to follow the flow so you can add the ungetc where needed 16:59:22 * erider wonders if you should try to implement it without ungetc 18:56:17 crc: any movement on the logger today? 19:01:24 --- join: edrx (~Eduardo@186.205.236.21) joined #retro 19:01:38 no code changes 19:02:07 hi edrx 19:02:14 hi crc and cfa 19:02:42 I am trying to write the lua functions that call libretro 19:03:21 I connected to ask a few questions on #lua, I was not expecting to meet you so soon 8-) 19:04:08 I normally lurk here in the evenings 19:07:32 I have been living mostly offline 19:18:21 hmm libretro 20:06:30 * crc is having connection problems (wimax doesn't do well during thunderstorms with heavy rain) 20:07:10 erider: the C implementation of the vm can be built as a library now, and (at least potentially) be used/embedded into other applications 20:08:02 that is interesting 20:09:14 it'll be more interesting in a few weeks, when I have time to add functions to allow finer control over running retro code, and extending the I/O ports at runtime 20:10:22 I wonder how he is going to use it in lua 20:11:07 crc: it works!!!!!! 8-) 20:11:27 lemme clean up the makefile and build a tarball 20:11:28 yay! 20:13:01 it would be great to have another way to call retro from lua, though 20:13:39 edrx: I'm looking into ways to allow more control over retro from the library functions 20:13:44 I'd like to pass a zero-terminated string to retro and make it execute it as a line of input, then return 20:13:57 ok 20:16:04 I've dabbled with controling retro from other languages (javascript) in the past, so should be able to draw at least a little from my old experiments 20:16:31 great 20:29:55 crc: is this supposed to work? 20:30:27 echo '2 3 * putn cr bye' | ./test 20:31:33 sorry, it does work. I wrote "test" instead of "./test" in the makefile... 20:31:56 ok 20:32:19 that should work, unless something is seriously screwed up in the vm 20:37:49 crc: the makefile is ready, and all tests work. let me add targets for downloading and building lua inside the luaretro directory, and I'll pack everything and send it to you. 20:38:18 ok, sounds good 21:01:54 crc: what os are you using? the makefile should run on any linux without changes, I guess 21:02:14 I use linux and os x 21:02:45 ok, making the tarball 8-) 21:22:29 crc: http://angg.twu.net/RETRO/luaretro.tgz 21:22:37 I am not a C programmer 21:22:43 *at all* 21:23:25 so expect all kinds of ugly bad habits (in luaretro.c) 21:24:08 http://angg.twu.net/RETRO/Makefile.html#help 21:24:29 "make runluatest" should work right away on a linux box 21:25:57 "make LUAOS=osx runluatest" should download and build lua51 correctly on osx, but I don't expect the rest to work 21:28:53 on linux, I had to add a LUA51SRC to the makefile to get it to build. works ok otherwise. 21:29:38 oops! fixing it... 21:30:19 when you make retro callable from javascript 21:30:36 how did you execute retro code from js? 21:30:49 s/make/made/ 21:31:42 two ways: a string evaluation function that mapped a string as input, and a set of functions for getting a pointer to a function (by name) and invoking the pointer 21:32:50 --- quit: erider (Ping timeout: 246 seconds) 21:33:07 would it be easy to add a string evaluation function to libretro.c? 21:34:02 for osx, "make LUAOS=macosx runluatest" works after adding the LUA51SRC and -llua to the rule for retro.so 21:34:49 fixing the makefile... 21:35:38 it'll require small changes to the input handling (dev_getc in the libretro.c you have, rxReadConsole in the latest source in my repo) 21:35:49 --- join: starlight (~tau@186-194-34-129.i-next.psi.br) joined #retro 21:35:57 hi. 21:36:03 hello 21:41:09 edrx: I'm going to head to bed now (almost 1am here). this looks very promising, so I'll work with it a bit tomorrow. I should be able to get a string evaluation into place pretty quickly, and update things for the latest vm code. 21:42:03 sleep well 8-) (almost 2am here, btw) 21:42:16 I'll add a stub for a lua function that call the string evaluation function 21:42:46 and I'll put the new version, with a README, at http://angg.twu.net/RETRO/ 21:42:56 sounds good 23:59:59 --- log: ended retro/11.04.16