<<18-05-2013>>

01:18:33*fowl quit (Ping timeout: 256 seconds)
01:30:08*fowl joined #nimrod
01:39:30*q66 quit (Remote host closed the connection)
04:19:39reactormonkfancy, so depending on type, stuff is written to the RAM or not
04:19:50reactormonkany idea how to represent that in nimrod?
04:20:14fowlexample?
04:20:45reactormonk#define __ATTR_PROGMEM__ __attribute__((__progmem__))
04:20:53reactormonk#define PROGMEM __ATTR_PROGMEM__
04:20:57reactormonktypedef int8_t prog_int8_t PROGMEM;
04:22:22reactormonkso prog_int8_t is stored in another address space
04:23:14fowlyou should just import prog_int8_t like type prog_int8_t* {.importc.} = int8
04:23:49fowler wait you can only do that with {.header.}
04:24:12fowli dunno, didnt araq's extern: "$1 PROGMEM" work
04:24:21reactormonkdidn't try
04:37:27fowlyou have to link with a DLL?
05:02:38reactormonknope, only code
05:02:45reactormonkinstall arduino
05:03:08reactormonkfowl, http://arduino.cc/en/Reference/HomePage
05:04:19fowlok then you should be able to do type prog_int8_t* {.importc, header: "the/header.h".} = int8
05:05:27fowlyou should test it with var x{.exportc: "FINDME".} : prog_int8_t and make sure its declared as prog_int8_t in the output.c
05:20:01*OrionPK quit (Quit: Leaving)
05:23:00reactormonkdoesn't need to be... maybe
05:24:07reactormonknot needed, people can just use the progmem pragma
05:24:10reactormonk{.pragma progmem, extern: "PROGMEM $1".}
05:24:42fowlfor what
05:24:49reactormonkthe only slight problem might be const uint16_t PROGMEM port_to_mode_PGM[] = {
05:24:52reactormonk NOT_A_PORT,
05:24:54reactormonk NOT_A_PORT,
05:24:56reactormonk (uint16_t) &DDRB,
05:24:58reactormonk (uint16_t) &DDRC,
05:25:00reactormonk (uint16_t) &DDRD,
05:25:02reactormonk};
05:25:04reactormonk... for storing stuff in the PROGMEM
05:25:24fowlthat type decl has PROGMEM in it, surely you dont need to repeat that when you declare variables of that type..
05:29:17reactormonk # const uint16_t PROGMEM port_to_mode_PGM[] = {
05:29:19reactormonkgoes to?
05:29:30reactormonkehm, does nimrod have an int16?
05:29:49fowlyea
05:29:52fowlint16, uint16
05:30:24fowlvar port_to_mode* {.progmem, importc.}: ptr array[0.. <1024, uint16]
05:32:08reactormonkwhat's the array constructor syntax? { } or [ ]?
05:34:09fowl[] but you dont want that
05:34:37reactormonkbut?
05:35:46fowlthat data already exists, you just need access to it from nimrod
05:36:50reactormonkconst port_to_output_PGM* {.progmem, importc.}: ptr array[0..4, uint16]
05:38:41reactormonkand I assume I gotta add the header to every importc around?
05:39:59fowlprobably
05:40:03fowli dont think you want const there though
05:40:49fowlalso 4 is the highest bounds for your hardware only
05:41:44reactormonkso what
05:41:51reactormonkthat's generally arduinos
05:44:39reactormonkwhen defined(__AVR_ATmega8__):
05:44:44reactormonknow that doesn't work ^^
05:45:40fowlso your arduino wrapper will be specific to your hardware
05:45:46reactormonkpins_arduino.nim(25, 2) Error: invalid pragma: {.pragma, progmem, extern: "PROGMEM $1".}
05:45:53fowlfor no real reason
05:45:56reactormonk+/-
05:46:14reactormonkI guess I'll importc that one too
05:50:21*xcombelle joined #nimrod
05:53:14reactormonkany idea about the pragma?
05:53:43reactormonk{.pragma: "progmem", extern: "PROGMEM $1".}
05:53:46reactormonkdoesn't work either
05:53:53fowlno, sorry
05:55:10fowltry
05:55:25fowl{.pragma: progmem, extern:"PROGMEM $1".}
05:55:46reactormonksweet
05:56:04fowlyea i have to look it up every time i use it <_<
05:56:45reactormonkso it picks up my nimrod.cfg that tells it not to compile :-)
05:57:56reactormonkany way I can tell the compiler where to stuff the files?
05:58:46reactormonkhow do you deal with http://sprunge.us/BQHV
05:58:48fowli dont follow, stuff what files
05:58:56reactormonkthe *.c files
05:59:28fowlthe generated .c files?
06:00:15fowlreactormonk: use importc/header for DEFAULT, EXTERNAL and INTERNAL
06:01:25reactormonkError: internal error: getTypeDescAux(tyExpr)
06:03:04reactormonkmaybe related to https://github.com/Araq/Nimrod/issues/147
06:05:56reactormonkoh
06:06:01reactormonkvar DEFAULT*: expr {.importc, header: "Arduino.h"}
06:06:03reactormonkguess why
06:06:39reactormonk#define DEFAULT 0
06:06:43reactormonkwhat's this type?
06:06:46reactormonkint?
06:06:58fowlcint
06:07:20fowlc's int is int32, nimrod's is int64 if you have it, cint is c's int
06:08:22reactormonkvar
06:08:24reactormonk DEFAULT*: cint {.importc, header: "Arduino.h"}
06:08:31reactormonkany reason why this gives me 'invalid indent'?
06:08:48reactormonkhttp://sprunge.us/gabM
06:09:35fowloh
06:09:42fowlthe pragma goes after the visibility
06:09:48fowlvar x* {..}: ty
06:12:13reactormonkbut the other way round with procs
06:13:26reactormonkfor stuff like int digitalRead(uint8_t);
06:13:35reactormonkgrab the corresponding C file or simply importc?
06:27:57reactormonkwhat was the 'no mangle' again?
06:28:08reactormonkI need to define setup and loop accordingly
06:39:17*fowl quit (Ping timeout: 256 seconds)
06:51:09*fowl joined #nimrod
07:00:40Araqreactormonk: the 'extern', importc or exportc means "no mangle"
08:05:31NimBotAraq/Nimrod a9f3450 Araq [+0 ±3 -0]: preparations for the new symbol binding rules for clean templates
08:19:23*zahary_ joined #nimrod
08:32:13NimBotAraq/Nimrod 89284c3 Araq [+0 ±2 -0]: fixes #440
08:32:14NimBotAraq/Nimrod 20007dc Araq [+0 ±1 -0]: fixes #437, fixes #436
09:14:58*xcombelle quit (Read error: Connection reset by peer)
09:56:37NimBotAraq/Nimrod 057f83b Araq [+0 ±1 -0]: fixes #399
09:56:37NimBotAraq/Nimrod 87cc542 Araq [+0 ±1 -0]: fixes #119
11:01:59*q66 joined #nimrod
11:08:08*Endy joined #nimrod
11:21:07*[1]Endy joined #nimrod
11:23:24*Endy quit (Ping timeout: 245 seconds)
11:25:28*[1]Endy quit (Ping timeout: 246 seconds)
12:23:33*Endy joined #nimrod
13:03:29*fowl quit (Ping timeout: 256 seconds)
15:55:31*OrionPK joined #nimrod
16:07:28*Trix[a]r_za is now known as Trixar_za
16:23:31reactormonkAraq, so extern: "loop" if I want to define "loop"
16:44:33Araqreactormonk: well better use 'importc' or 'exportc'
16:57:18reactormonkAraq, can I tell nimrod to generate the .c files in the same dir as the .nim files?
16:59:10Araqthere is --nimcache:DIR but I never tested to use the same dir ;-)
17:01:05reactormonkhm. does --nimcache:DIR depend on $PWD or the nimrod.cfg file?
17:01:32Araqno
17:01:45Araq(whatever that means)
17:02:24reactormonknope, you can't specify "."
17:02:38reactormonk... at least in the config file
17:04:01Araqyou can use --nimcache:$projectdir I think
17:04:28reactormonkoh fuck, that's gonna be ugly
17:05:09reactormonkbecause ino (the arduino build tool) does its own dependency scanning - and I assume nimrod doesn't bother too much about that in the generated source?
17:05:33Araqjust don't use ino then
17:05:54Araqthe less you use the more likely it ends up working
17:07:11reactormonkthe less I use, the more I have to build myself
17:07:33Araqyeah and then you can actually fix things
17:08:53reactormonknot interested in developing a serial iterface for nimrod
17:09:40reactormonkhmm, I don't need that.
17:10:35Araqyou can also use --genscript to make nimrod generate a shell script that does the compilation and then edit that
17:11:15reactormonkthere's a separate command 'upload' which handles the serial communication for me
17:33:18reactormonkany way I can symlink the nimbase.h into my dir?
17:33:40AraqI'd copy it over instead, it doesn't change anyway
17:36:34reactormonkhttp://sprunge.us/VOYB huh
17:37:47reactormonkhttp://sprunge.us/djXU the whole think
17:37:54*Endy quit (Ping timeout: 264 seconds)
17:38:46Araqwho is general failure and why is he reading my hard disk?
17:39:06reactormonkyep.
17:43:18reactormonknow that's gonna be ugly :-/
17:43:50reactormonkbecause if I do the compilation myself, I have to do all the ugly shit with -D__ARDUINO_MX87239__
17:53:30reactormonkAraq, can I unlink signal.h? Arduino doesn't suppor that part
17:54:34Araq-d:noSignalHandler may work
17:55:06Araqbut ugh it's in nimbase.h ...
17:55:16Araqwe shouldn't do that
18:01:06NimBotAraq/Nimrod 75a0bb1 Dominik Picheta [+12 ±6 -1]: Implemented new Nimrod website designed by @PhilipWitte.
18:01:06NimBotAraq/Nimrod 041efeb Dominik Picheta [+0 ±2 -0]: Website adjustments; added table style and span.pre style.
18:01:40reactormonkis the new website online by now?
18:01:50dom96Not yet
18:02:17reactormonkaww
18:06:41reactormonksrc/nimcache/nimbase.h:485: error: size of array ‘assert_numbits’ is negative
18:07:48reactormonkAraq, http://sprunge.us/KcLQ
18:07:55reactormonksrc/nimcache/system.c:6046: error: ‘SIGSEGV’ undeclared (first use in this function)
18:08:57reactormonkforgot to rebuild the sketch. http://sprunge.us/BifB
18:09:53reactormonkyep, and dlfcn.h doesn't exist on an arduino for sure.
18:13:54reactormonknot sure about sys/mman.h either
18:17:05reactormonkoh, and you can load stuff into the flash (which is way bigger than the RAM) if you don't need to modify it. But apparently no dynamic allocation.
18:17:30reactormonkwhat goes down the train without dynamic allocation? Objects? Or can I allocate them statically.
18:17:44Araqsure you can
18:18:52reactormonkcan I exclude named .h files?
18:20:40reactormonkaka make --d:noSignalHandler exclude .h and --d:noDynamicAlloc
18:30:29*bloup joined #nimrod
18:30:33*bloup left #nimrod ("WeeChat 0.3.7")
18:45:30*Endy joined #nimrod
19:04:26*fowl joined #nimrod
19:11:19*Trixar_za is now known as Trix[a]r_za
19:18:49*Trix[a]r_za is now known as Trixar_za
19:29:23dom96fowl: Could you make a pull request for your dsl module? (and clean it up if needs be)
19:29:47dom96We're releasing 0.9.2 quite soonish ;)
19:36:25fowlok
19:37:43*exhu joined #nimrod
19:37:45reactormonkAraq, should I try wrapping a bunch of when(not(noSignalHandler)) and same for dynamic alloc?
19:37:56reactormonkgotta say though I don't even know the syntax for staic alloc...
19:38:11reactormonkwait, just tell it not to make it a reference?
19:47:00Araqreactormonk: yes.
19:47:18Araqhi exhu ... the macros bug you found it actually quite hard to fix :P
19:47:37reactormonkAraq, is it possible to make the dynamic alloc optional?
19:47:39Araqswitching to luajit would fix it though ... ;-)
19:47:53exhuhi Araq, i'm glad you fixed it quickly, thanks!
19:49:00exhuAraq, will luajit be a dependency for a produced program, or only during compilation phase?
19:49:17reactormonkexhu, I assume the name 'jit' implies a runtime dependency
19:49:57Araqno, only for compilation
19:50:20Araqexhu: I didn't fix it ...
19:51:02exhuAraq, eh, i've post several issues recently, the one that prevented compilation of unit tests is fixed.
19:51:24Araqoh yeah ... that was easy and reported 3x
19:52:26exhuAraq, and the one you can't fix, i don't remember which :) i stopped ditching on macros, no ORM etc stuff for now.
19:52:41*Endy quit (Ping timeout: 252 seconds)
19:53:31Araqwell I know how it can be fixed but it's too risky, we want to release 0.9.2 tomorrow ...
19:53:38fowlexhu: its probably easier to do what you by passing the information directly like tablemacro(tablename, tuple[field1: int, field2: string]) and you should be able to put pragmas in the tuple ty like you wanted
19:56:55exhuAraq, and reading the antlr site, i've spotted a nice phrase by the authour of antlr tool (scanner-parser-ast parser generator), "Why program by hand in five days what you can spend twenty-five years of your life automating?" =) So i think i'll do it by hand rather than develop macros for the rest of the year -)
19:59:55Araqthe macro ain't for you ... it's for your users :P
20:00:21Araqplus an ORM screams for macros
20:00:48reactormonkisn't the NoSQL movement strong nowadays ;-)
20:01:13exhui'll probably leave macro fun for v2.0 of the program/lib i'm developing, i desperately need a working program that does the work, then i'll be ready to spend more time on improvement and unification.
20:02:16exhuthe second urging feature for my app is the gui toolkit, don't know which way to go here.
20:02:46reactormonkAraq, or do we need a target "microcontroller" ;-)
20:04:08exhui've studied some xlibs/xcb stuff, it's a real pain, so many legacy things, mixture of new and old xlib and xcb, no docs of how to use it etc. Win32 API is much better in this regard.
20:05:20exhui remember writing simple wrappers for win32 api gui in the 90s -- early 2000s, it was a piece of cake.
20:05:26Araqreactormonk: we have that target already
20:05:34reactormonkAraq, tell me
20:08:28Araqreactormonk: http://nimrod-code.org/nimrodc.html#nimrod-for-embedded-systems
20:08:54AraqI know --gc:none doesn't work with -d:useMalloc anymore, will fix it tonight
20:09:19reactormonkAraq, argh. Not enough googability on nimrod :-(
20:11:40reactormonksrc/nimcache/nimbase.h:256:20: error: signal.h: No such file or directory
20:11:43reactormonkstill.
20:11:52reactormonkthere are no signals when there is no OS.
20:15:18Araqyeah fix it, nimbase.h doesn't need it anyway
20:18:07reactormonksystem.c still includes it though
20:20:05Araqeven with -d:noSignalHandler ?
20:20:10reactormonkyep
20:20:23reactormonkd = noSignalHandler
20:20:28reactormonkif this works in nimrod.cfg
20:22:03Araqit should
20:22:10Araqwell fix it then :P
20:22:50reactormonkok
20:23:00reactormonkwhere should I start looking?
20:23:22Araqlib/system/ansi_c.nim
20:23:27reactormonkkk
20:31:32fowli think macro_dsl needs a new name
20:31:40fowlits less a dsl and more a collection of helpers
20:31:54Araqjust put it into macros.nim
20:32:08Araqbut leave out the controversial parts :P
20:32:27Araqnot use we need := to generate an assignment for instance
20:32:31Araq*not sure
20:33:09dom96Does anyone have an example of how to use macros.quote?
20:34:18fowldom96: quote: let x = 42
20:35:22dom96How do you interpolate?
20:35:39fowlAraq: its <- now, and it only matches on PNimrodNodes :p
20:36:09fowldom96: quote: let x = `y`
20:36:33fowliirc it resolves symbols too early to be meaningful in a macro but ill try it real quick and see
20:36:48Araqyeah it's buggy/wrong
20:37:11*dom96 wonders why the example in the docs shows the usage together with a 'do'
20:37:17fowlthats quote do: my bad
20:37:33dom96ahh, so you do need 'do'
20:38:03fowldom96: i've been using parseExpr() a lot lately
20:38:32fowlnewStmtList(parseStmt("let x = $1" % $var"), ...)
20:38:35dom96fowl: Yeah, that's what I used too. But I feel that 'quote' may be better.
20:38:57dom96Also if it's broken it should be fixed before we release ;)
20:39:22Araqyeah come up with a good example and I'll fix it
20:41:42fowlhttps://gist.github.com/fowlmouth/5605720
20:53:20dom96It's definitely not good that Eurovision is happening today...
20:56:16*exhu quit (Quit: Ex-Chat)
20:58:19NimBotAraq/Nimrod 742f9fe Simon Hafner [+0 ±1 -0]: nimbase.h doesn't need signal.h
21:00:04fowlhttps://gist.github.com/fowlmouth/f669d9722c72483a7608#file-macro_dsl-nim-L205
21:00:11fowlare those names good
21:00:20fowl(and the rest of the funcs above)
21:11:08AraqnewBlockStmt*(label: PNimrodNode = nil, statements: varargs[PNimrodNode] = []): PNimrodNode
21:11:23Araqthat doesn't work properly I think
21:14:10fowlhow about a separate newBlockStmtLabelled(label: PNimrodNode; statements: varargs[PNimrodNode] = [])
21:15:49Araqin fact I dislike your heavy usage of varags
21:15:55Araqwhat's wrong with openarray?
21:16:06Araqenforces the [] which make it clearer imo
21:26:40fowli updated it
21:29:38AraqcopyChildrenTo -> addChildrenTo
21:30:15Araqoh hrm
21:30:20Araqyou do copy
21:32:22Araqfowl: ever used 'body'?
21:32:43Araqcan't think of an example where you don't know whether it's a proc or a block...
21:34:37Araqtemplate first*(n: PNimrodNode; cond: expr): PNimrodNode {.immediate, dirty.}
21:34:39Araq-->
21:34:56Araqtemplate findIt*(n: PNimrodNode; cond: expr): PNimrodNode {.dirty.}
21:35:34Araqand it should be recursive :P
21:38:02Araqor make it 'findChild'
21:38:41Araqhas_argument_named should be hasArgOfName I think
21:41:54fowlAraq: yea i use body() all the time so i dont have to remember the stmt list is in the 7th slot for procs and the 2nd for blocks
21:42:29Araqyeah ok but do you need the polymorphism?
21:42:47AraqI'd define body simply for procs
21:43:39fowlit should be useful to get the body out of anything that has a stmt list
21:44:47Araqmeh fine
21:45:01AraqI still can't see why I ever would want that for blocks but alright
21:45:26AraqI mean why I would want that for 'block' but not also for 'while' for instance
21:47:33fowlbecause i hadnt needed it for while yet :p
21:48:18Araqsuprisingly you needed it for block :P
21:54:39fowldunno how to make findIt recursive
21:54:52fowldoes that even make sense for a template
21:58:45Araqno you need an aux proc to get it recursive
21:58:54Araqbut it's fine just name it 'findChild'
21:59:07Araqthat suggests it's not recursive I hope
22:24:24fowlhow about proc add_ident_if_absent*
22:24:51Araqmake it camelCase and it's fine I think
22:30:35fowlok im gonna walk to the donut shop and so if theres anything else (i just updated it) ill fix when i get back
22:30:58Araqwell more docs would be nice
22:31:16Araqbut I'll likely include it to macros.nim anyway