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:39 | reactormonk | fancy, so depending on type, stuff is written to the RAM or not |
04:19:50 | reactormonk | any idea how to represent that in nimrod? |
04:20:14 | fowl | example? |
04:20:45 | reactormonk | #define __ATTR_PROGMEM__ __attribute__((__progmem__)) |
04:20:53 | reactormonk | #define PROGMEM __ATTR_PROGMEM__ |
04:20:57 | reactormonk | typedef int8_t prog_int8_t PROGMEM; |
04:22:22 | reactormonk | so prog_int8_t is stored in another address space |
04:23:14 | fowl | you should just import prog_int8_t like type prog_int8_t* {.importc.} = int8 |
04:23:49 | fowl | er wait you can only do that with {.header.} |
04:24:12 | fowl | i dunno, didnt araq's extern: "$1 PROGMEM" work |
04:24:21 | reactormonk | didn't try |
04:37:27 | fowl | you have to link with a DLL? |
05:02:38 | reactormonk | nope, only code |
05:02:45 | reactormonk | install arduino |
05:03:08 | reactormonk | fowl, http://arduino.cc/en/Reference/HomePage |
05:04:19 | fowl | ok then you should be able to do type prog_int8_t* {.importc, header: "the/header.h".} = int8 |
05:05:27 | fowl | you 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:00 | reactormonk | doesn't need to be... maybe |
05:24:07 | reactormonk | not needed, people can just use the progmem pragma |
05:24:10 | reactormonk | {.pragma progmem, extern: "PROGMEM $1".} |
05:24:42 | fowl | for what |
05:24:49 | reactormonk | the only slight problem might be const uint16_t PROGMEM port_to_mode_PGM[] = { |
05:24:52 | reactormonk | NOT_A_PORT, |
05:24:54 | reactormonk | NOT_A_PORT, |
05:24:56 | reactormonk | (uint16_t) &DDRB, |
05:24:58 | reactormonk | (uint16_t) &DDRC, |
05:25:00 | reactormonk | (uint16_t) &DDRD, |
05:25:02 | reactormonk | }; |
05:25:04 | reactormonk | ... for storing stuff in the PROGMEM |
05:25:24 | fowl | that type decl has PROGMEM in it, surely you dont need to repeat that when you declare variables of that type.. |
05:29:17 | reactormonk | # const uint16_t PROGMEM port_to_mode_PGM[] = { |
05:29:19 | reactormonk | goes to? |
05:29:30 | reactormonk | ehm, does nimrod have an int16? |
05:29:49 | fowl | yea |
05:29:52 | fowl | int16, uint16 |
05:30:24 | fowl | var port_to_mode* {.progmem, importc.}: ptr array[0.. <1024, uint16] |
05:32:08 | reactormonk | what's the array constructor syntax? { } or [ ]? |
05:34:09 | fowl | [] but you dont want that |
05:34:37 | reactormonk | but? |
05:35:46 | fowl | that data already exists, you just need access to it from nimrod |
05:36:50 | reactormonk | const port_to_output_PGM* {.progmem, importc.}: ptr array[0..4, uint16] |
05:38:41 | reactormonk | and I assume I gotta add the header to every importc around? |
05:39:59 | fowl | probably |
05:40:03 | fowl | i dont think you want const there though |
05:40:49 | fowl | also 4 is the highest bounds for your hardware only |
05:41:44 | reactormonk | so what |
05:41:51 | reactormonk | that's generally arduinos |
05:44:39 | reactormonk | when defined(__AVR_ATmega8__): |
05:44:44 | reactormonk | now that doesn't work ^^ |
05:45:40 | fowl | so your arduino wrapper will be specific to your hardware |
05:45:46 | reactormonk | pins_arduino.nim(25, 2) Error: invalid pragma: {.pragma, progmem, extern: "PROGMEM $1".} |
05:45:53 | fowl | for no real reason |
05:45:56 | reactormonk | +/- |
05:46:14 | reactormonk | I guess I'll importc that one too |
05:50:21 | * | xcombelle joined #nimrod |
05:53:14 | reactormonk | any idea about the pragma? |
05:53:43 | reactormonk | {.pragma: "progmem", extern: "PROGMEM $1".} |
05:53:46 | reactormonk | doesn't work either |
05:53:53 | fowl | no, sorry |
05:55:10 | fowl | try |
05:55:25 | fowl | {.pragma: progmem, extern:"PROGMEM $1".} |
05:55:46 | reactormonk | sweet |
05:56:04 | fowl | yea i have to look it up every time i use it <_< |
05:56:45 | reactormonk | so it picks up my nimrod.cfg that tells it not to compile :-) |
05:57:56 | reactormonk | any way I can tell the compiler where to stuff the files? |
05:58:46 | reactormonk | how do you deal with http://sprunge.us/BQHV |
05:58:48 | fowl | i dont follow, stuff what files |
05:58:56 | reactormonk | the *.c files |
05:59:28 | fowl | the generated .c files? |
06:00:15 | fowl | reactormonk: use importc/header for DEFAULT, EXTERNAL and INTERNAL |
06:01:25 | reactormonk | Error: internal error: getTypeDescAux(tyExpr) |
06:03:04 | reactormonk | maybe related to https://github.com/Araq/Nimrod/issues/147 |
06:05:56 | reactormonk | oh |
06:06:01 | reactormonk | var DEFAULT*: expr {.importc, header: "Arduino.h"} |
06:06:03 | reactormonk | guess why |
06:06:39 | reactormonk | #define DEFAULT 0 |
06:06:43 | reactormonk | what's this type? |
06:06:46 | reactormonk | int? |
06:06:58 | fowl | cint |
06:07:20 | fowl | c's int is int32, nimrod's is int64 if you have it, cint is c's int |
06:08:22 | reactormonk | var |
06:08:24 | reactormonk | DEFAULT*: cint {.importc, header: "Arduino.h"} |
06:08:31 | reactormonk | any reason why this gives me 'invalid indent'? |
06:08:48 | reactormonk | http://sprunge.us/gabM |
06:09:35 | fowl | oh |
06:09:42 | fowl | the pragma goes after the visibility |
06:09:48 | fowl | var x* {..}: ty |
06:12:13 | reactormonk | but the other way round with procs |
06:13:26 | reactormonk | for stuff like int digitalRead(uint8_t); |
06:13:35 | reactormonk | grab the corresponding C file or simply importc? |
06:27:57 | reactormonk | what was the 'no mangle' again? |
06:28:08 | reactormonk | I need to define setup and loop accordingly |
06:39:17 | * | fowl quit (Ping timeout: 256 seconds) |
06:51:09 | * | fowl joined #nimrod |
07:00:40 | Araq | reactormonk: the 'extern', importc or exportc means "no mangle" |
08:05:31 | NimBot | Araq/Nimrod a9f3450 Araq [+0 ±3 -0]: preparations for the new symbol binding rules for clean templates |
08:19:23 | * | zahary_ joined #nimrod |
08:32:13 | NimBot | Araq/Nimrod 89284c3 Araq [+0 ±2 -0]: fixes #440 |
08:32:14 | NimBot | Araq/Nimrod 20007dc Araq [+0 ±1 -0]: fixes #437, fixes #436 |
09:14:58 | * | xcombelle quit (Read error: Connection reset by peer) |
09:56:37 | NimBot | Araq/Nimrod 057f83b Araq [+0 ±1 -0]: fixes #399 |
09:56:37 | NimBot | Araq/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:31 | reactormonk | Araq, so extern: "loop" if I want to define "loop" |
16:44:33 | Araq | reactormonk: well better use 'importc' or 'exportc' |
16:57:18 | reactormonk | Araq, can I tell nimrod to generate the .c files in the same dir as the .nim files? |
16:59:10 | Araq | there is --nimcache:DIR but I never tested to use the same dir ;-) |
17:01:05 | reactormonk | hm. does --nimcache:DIR depend on $PWD or the nimrod.cfg file? |
17:01:32 | Araq | no |
17:01:45 | Araq | (whatever that means) |
17:02:24 | reactormonk | nope, you can't specify "." |
17:02:38 | reactormonk | ... at least in the config file |
17:04:01 | Araq | you can use --nimcache:$projectdir I think |
17:04:28 | reactormonk | oh fuck, that's gonna be ugly |
17:05:09 | reactormonk | because 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:33 | Araq | just don't use ino then |
17:05:54 | Araq | the less you use the more likely it ends up working |
17:07:11 | reactormonk | the less I use, the more I have to build myself |
17:07:33 | Araq | yeah and then you can actually fix things |
17:08:53 | reactormonk | not interested in developing a serial iterface for nimrod |
17:09:40 | reactormonk | hmm, I don't need that. |
17:10:35 | Araq | you can also use --genscript to make nimrod generate a shell script that does the compilation and then edit that |
17:11:15 | reactormonk | there's a separate command 'upload' which handles the serial communication for me |
17:33:18 | reactormonk | any way I can symlink the nimbase.h into my dir? |
17:33:40 | Araq | I'd copy it over instead, it doesn't change anyway |
17:36:34 | reactormonk | http://sprunge.us/VOYB huh |
17:37:47 | reactormonk | http://sprunge.us/djXU the whole think |
17:37:54 | * | Endy quit (Ping timeout: 264 seconds) |
17:38:46 | Araq | who is general failure and why is he reading my hard disk? |
17:39:06 | reactormonk | yep. |
17:43:18 | reactormonk | now that's gonna be ugly :-/ |
17:43:50 | reactormonk | because if I do the compilation myself, I have to do all the ugly shit with -D__ARDUINO_MX87239__ |
17:53:30 | reactormonk | Araq, can I unlink signal.h? Arduino doesn't suppor that part |
17:54:34 | Araq | -d:noSignalHandler may work |
17:55:06 | Araq | but ugh it's in nimbase.h ... |
17:55:16 | Araq | we shouldn't do that |
18:01:06 | NimBot | Araq/Nimrod 75a0bb1 Dominik Picheta [+12 ±6 -1]: Implemented new Nimrod website designed by @PhilipWitte. |
18:01:06 | NimBot | Araq/Nimrod 041efeb Dominik Picheta [+0 ±2 -0]: Website adjustments; added table style and span.pre style. |
18:01:40 | reactormonk | is the new website online by now? |
18:01:50 | dom96 | Not yet |
18:02:17 | reactormonk | aww |
18:06:41 | reactormonk | src/nimcache/nimbase.h:485: error: size of array ‘assert_numbits’ is negative |
18:07:48 | reactormonk | Araq, http://sprunge.us/KcLQ |
18:07:55 | reactormonk | src/nimcache/system.c:6046: error: ‘SIGSEGV’ undeclared (first use in this function) |
18:08:57 | reactormonk | forgot to rebuild the sketch. http://sprunge.us/BifB |
18:09:53 | reactormonk | yep, and dlfcn.h doesn't exist on an arduino for sure. |
18:13:54 | reactormonk | not sure about sys/mman.h either |
18:17:05 | reactormonk | oh, 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:30 | reactormonk | what goes down the train without dynamic allocation? Objects? Or can I allocate them statically. |
18:17:44 | Araq | sure you can |
18:18:52 | reactormonk | can I exclude named .h files? |
18:20:40 | reactormonk | aka 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:23 | dom96 | fowl: Could you make a pull request for your dsl module? (and clean it up if needs be) |
19:29:47 | dom96 | We're releasing 0.9.2 quite soonish ;) |
19:36:25 | fowl | ok |
19:37:43 | * | exhu joined #nimrod |
19:37:45 | reactormonk | Araq, should I try wrapping a bunch of when(not(noSignalHandler)) and same for dynamic alloc? |
19:37:56 | reactormonk | gotta say though I don't even know the syntax for staic alloc... |
19:38:11 | reactormonk | wait, just tell it not to make it a reference? |
19:47:00 | Araq | reactormonk: yes. |
19:47:18 | Araq | hi exhu ... the macros bug you found it actually quite hard to fix :P |
19:47:37 | reactormonk | Araq, is it possible to make the dynamic alloc optional? |
19:47:39 | Araq | switching to luajit would fix it though ... ;-) |
19:47:53 | exhu | hi Araq, i'm glad you fixed it quickly, thanks! |
19:49:00 | exhu | Araq, will luajit be a dependency for a produced program, or only during compilation phase? |
19:49:17 | reactormonk | exhu, I assume the name 'jit' implies a runtime dependency |
19:49:57 | Araq | no, only for compilation |
19:50:20 | Araq | exhu: I didn't fix it ... |
19:51:02 | exhu | Araq, eh, i've post several issues recently, the one that prevented compilation of unit tests is fixed. |
19:51:24 | Araq | oh yeah ... that was easy and reported 3x |
19:52:26 | exhu | Araq, 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:31 | Araq | well I know how it can be fixed but it's too risky, we want to release 0.9.2 tomorrow ... |
19:53:38 | fowl | exhu: 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:55 | exhu | Araq, 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:55 | Araq | the macro ain't for you ... it's for your users :P |
20:00:21 | Araq | plus an ORM screams for macros |
20:00:48 | reactormonk | isn't the NoSQL movement strong nowadays ;-) |
20:01:13 | exhu | i'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:16 | exhu | the second urging feature for my app is the gui toolkit, don't know which way to go here. |
20:02:46 | reactormonk | Araq, or do we need a target "microcontroller" ;-) |
20:04:08 | exhu | i'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:20 | exhu | i remember writing simple wrappers for win32 api gui in the 90s -- early 2000s, it was a piece of cake. |
20:05:26 | Araq | reactormonk: we have that target already |
20:05:34 | reactormonk | Araq, tell me |
20:08:28 | Araq | reactormonk: http://nimrod-code.org/nimrodc.html#nimrod-for-embedded-systems |
20:08:54 | Araq | I know --gc:none doesn't work with -d:useMalloc anymore, will fix it tonight |
20:09:19 | reactormonk | Araq, argh. Not enough googability on nimrod :-( |
20:11:40 | reactormonk | src/nimcache/nimbase.h:256:20: error: signal.h: No such file or directory |
20:11:43 | reactormonk | still. |
20:11:52 | reactormonk | there are no signals when there is no OS. |
20:15:18 | Araq | yeah fix it, nimbase.h doesn't need it anyway |
20:18:07 | reactormonk | system.c still includes it though |
20:20:05 | Araq | even with -d:noSignalHandler ? |
20:20:10 | reactormonk | yep |
20:20:23 | reactormonk | d = noSignalHandler |
20:20:28 | reactormonk | if this works in nimrod.cfg |
20:22:03 | Araq | it should |
20:22:10 | Araq | well fix it then :P |
20:22:50 | reactormonk | ok |
20:23:00 | reactormonk | where should I start looking? |
20:23:22 | Araq | lib/system/ansi_c.nim |
20:23:27 | reactormonk | kk |
20:31:32 | fowl | i think macro_dsl needs a new name |
20:31:40 | fowl | its less a dsl and more a collection of helpers |
20:31:54 | Araq | just put it into macros.nim |
20:32:08 | Araq | but leave out the controversial parts :P |
20:32:27 | Araq | not use we need := to generate an assignment for instance |
20:32:31 | Araq | *not sure |
20:33:09 | dom96 | Does anyone have an example of how to use macros.quote? |
20:34:18 | fowl | dom96: quote: let x = 42 |
20:35:22 | dom96 | How do you interpolate? |
20:35:39 | fowl | Araq: its <- now, and it only matches on PNimrodNodes :p |
20:36:09 | fowl | dom96: quote: let x = `y` |
20:36:33 | fowl | iirc it resolves symbols too early to be meaningful in a macro but ill try it real quick and see |
20:36:48 | Araq | yeah it's buggy/wrong |
20:37:11 | * | dom96 wonders why the example in the docs shows the usage together with a 'do' |
20:37:17 | fowl | thats quote do: my bad |
20:37:33 | dom96 | ahh, so you do need 'do' |
20:38:03 | fowl | dom96: i've been using parseExpr() a lot lately |
20:38:32 | fowl | newStmtList(parseStmt("let x = $1" % $var"), ...) |
20:38:35 | dom96 | fowl: Yeah, that's what I used too. But I feel that 'quote' may be better. |
20:38:57 | dom96 | Also if it's broken it should be fixed before we release ;) |
20:39:22 | Araq | yeah come up with a good example and I'll fix it |
20:41:42 | fowl | https://gist.github.com/fowlmouth/5605720 |
20:53:20 | dom96 | It's definitely not good that Eurovision is happening today... |
20:56:16 | * | exhu quit (Quit: Ex-Chat) |
20:58:19 | NimBot | Araq/Nimrod 742f9fe Simon Hafner [+0 ±1 -0]: nimbase.h doesn't need signal.h |
21:00:04 | fowl | https://gist.github.com/fowlmouth/f669d9722c72483a7608#file-macro_dsl-nim-L205 |
21:00:11 | fowl | are those names good |
21:00:20 | fowl | (and the rest of the funcs above) |
21:11:08 | Araq | newBlockStmt*(label: PNimrodNode = nil, statements: varargs[PNimrodNode] = []): PNimrodNode |
21:11:23 | Araq | that doesn't work properly I think |
21:14:10 | fowl | how about a separate newBlockStmtLabelled(label: PNimrodNode; statements: varargs[PNimrodNode] = []) |
21:15:49 | Araq | in fact I dislike your heavy usage of varags |
21:15:55 | Araq | what's wrong with openarray? |
21:16:06 | Araq | enforces the [] which make it clearer imo |
21:26:40 | fowl | i updated it |
21:29:38 | Araq | copyChildrenTo -> addChildrenTo |
21:30:15 | Araq | oh hrm |
21:30:20 | Araq | you do copy |
21:32:22 | Araq | fowl: ever used 'body'? |
21:32:43 | Araq | can't think of an example where you don't know whether it's a proc or a block... |
21:34:37 | Araq | template first*(n: PNimrodNode; cond: expr): PNimrodNode {.immediate, dirty.} |
21:34:39 | Araq | --> |
21:34:56 | Araq | template findIt*(n: PNimrodNode; cond: expr): PNimrodNode {.dirty.} |
21:35:34 | Araq | and it should be recursive :P |
21:38:02 | Araq | or make it 'findChild' |
21:38:41 | Araq | has_argument_named should be hasArgOfName I think |
21:41:54 | fowl | Araq: 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:29 | Araq | yeah ok but do you need the polymorphism? |
21:42:47 | Araq | I'd define body simply for procs |
21:43:39 | fowl | it should be useful to get the body out of anything that has a stmt list |
21:44:47 | Araq | meh fine |
21:45:01 | Araq | I still can't see why I ever would want that for blocks but alright |
21:45:26 | Araq | I mean why I would want that for 'block' but not also for 'while' for instance |
21:47:33 | fowl | because i hadnt needed it for while yet :p |
21:48:18 | Araq | suprisingly you needed it for block :P |
21:54:39 | fowl | dunno how to make findIt recursive |
21:54:52 | fowl | does that even make sense for a template |
21:58:45 | Araq | no you need an aux proc to get it recursive |
21:58:54 | Araq | but it's fine just name it 'findChild' |
21:59:07 | Araq | that suggests it's not recursive I hope |
22:24:24 | fowl | how about proc add_ident_if_absent* |
22:24:51 | Araq | make it camelCase and it's fine I think |
22:30:35 | fowl | ok 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:58 | Araq | well more docs would be nice |
22:31:16 | Araq | but I'll likely include it to macros.nim anyway |