<<17-05-2013>>

00:33:32*Endeg quit (*.net *.split)
00:33:32*XAMPP quit (*.net *.split)
00:33:36*OrionPK quit (*.net *.split)
00:33:39*comex quit (*.net *.split)
00:33:42*dom96 quit (*.net *.split)
00:44:45*Trixar_za is now known as Trix[a]r_za
00:52:46*OnionPK joined #nimrod
00:52:46*Endeg joined #nimrod
00:52:46*XAMPP joined #nimrod
00:52:46*comex joined #nimrod
00:52:46*dom96 joined #nimrod
00:52:48*Trix[a]r_za is now known as Trixar_za
01:53:09*q66 quit (Remote host closed the connection)
01:59:26*Nimrod joined #nimrod
02:01:11*Trixar_za is now known as Trix[a]r_za
02:02:13*Nimrod_ quit (Ping timeout: 248 seconds)
02:07:12*Trix[a]r_za is now known as Trixar_za
03:00:42*reactormonk joined #nimrod
03:00:47reactormonksup
03:01:45reactormonkAraq, any way to stop both gcc and linker call and replace that with my own exec, just one per project?
03:01:54reactormonkNimrod, down in texas too? ;-)
03:32:52*Trixar_za is now known as Trix[a]r_za
03:57:24reactormonkhmm, c2nim can't parse function pointers
03:57:26reactormonkvoid attachInterrupt(uint8_t, void (*)(void), int mode);
03:57:38fowlyeah
03:57:50fowljust pull that out into a typedef right above the function
04:02:32*OnionPK quit (Read error: Connection reset by peer)
04:14:33*Endeg quit (Read error: Connection reset by peer)
04:29:06Nimrod[22:01:58] <reactormonk> Nimrod, down in texas too? ;-)
04:29:18NimrodNope, back from Texas (where I go to school)
04:52:55reactormonkNimrod, aww
04:53:03reactormonkfowl, hum?
04:53:51reactormonkNimrod, where?
04:54:02NimrodWhat?
04:54:20*Nimrod left #nimrod ("Leaving")
04:54:25reactormonkNimBot, which school.
05:03:52fowlreactormonk: c2nim has problems with complex types inside func decls like that
05:04:10fowlso just pull the void(*)(void) into a typedef and use that in the function
05:06:06reactormonklooks like a function to me
05:06:14reactormonkso a `proc` annotation should do
05:06:29reactormonkalso, the file has a shitload of macros
05:07:48fowlyea
05:08:21fowli'd just put typedef void (*foo)(void); above it then change foo to something sensible later
05:08:40fowlmacros are annoying, they've made me give up on more than a few wrappers
05:19:29*fowl quit (Ping timeout: 256 seconds)
05:31:53*fowl joined #nimrod
05:53:20reactormonkwould be nice to have all of them
05:54:34reactormonkhmm
05:54:42reactormonkfowl, how would you define the above?
05:56:04fowltypedef void (*callback)(void);
05:58:04fowlor typedef void *callback(void);
06:02:32reactormonkhuh?
06:02:39fowlwhat
06:02:40reactormonkor just `proc` in nimrod?
06:02:41fowlwhat are you asking me
06:02:46fowloh
06:03:01fowlvoid attachInterrupt(uint8_t, void (*)(void), int mode);
06:03:37fowlproc attachInterrupt* (x: uint8, cb: proc(): pointer, mode: cint) {.importc.}
06:04:29fowlthat proc(): pointer should probably be {.cdecl.} too
06:04:53fowlor at least {.noconv.}
06:10:26reactormonknoconv?
06:13:25reactormonkextern const uint16_t PROGMEM port_to_mode_PGM[];
06:13:30reactormonkhow do I deal with that?
06:13:53fowlwhat des PROGMEM do
06:14:50reactormonkhttp://pastie.org/private/3dhwbkblf13m8phxvz53ig
06:21:57fowlvar port_to_mode* {.importc, nodecl.}: ptr cushort
06:22:31fowlunless PROGMEM does something ..
06:26:38reactormonkthose are registers
06:29:46fowldunno what that means
06:31:00reactormonkhardware registers
06:31:02reactormonkat least volatile
06:31:35fowli dont think that register/volatile belongs between the type and name, it should be more to the left by extern
06:34:24reactormonkwhat's extern?
06:35:28fowlhttp://publications.gbdirect.co.uk/c_book/chapter8/const_and_volatile.html
06:38:37fowlreactormonk: i think it has something to do with whats exposed in the DLL
06:39:17reactormonkthe target is ARM
06:42:32reactormonkyep, I have read that one before
06:47:21reactormonkfowl, forgot about PROGMEM
07:07:09*ARCADIVS quit (Quit: WeeChat 0.3.8)
08:24:47*Endeg joined #nimrod
09:53:35*q66 joined #nimrod
11:42:16*fowl quit (Ping timeout: 256 seconds)
11:45:31*zahary_ joined #nimrod
14:51:43*Endy joined #nimrod
15:09:53*Endy quit (Ping timeout: 248 seconds)
16:08:37*Trix[a]r_za quit (Ping timeout: 248 seconds)
16:11:30*Trix[a]r_za joined #nimrod
16:21:38reactormonkthe nasty part about this is - I need macros here, as it looks like
16:26:45reactormonkwhat does typedef void PROGMEM prog_void;
16:26:46reactormonkmean?
16:26:59reactormonk#define PROGMEM __ATTR_PROGMEM__
16:27:11reactormonk#ifndef __ATTR_PROGMEM__
16:27:14reactormonk#define __ATTR_PROGMEM__ __attribute__((__progmem__))
16:27:16reactormonk#endif
16:48:38Araqreactormonk: {.pragma becreative, extern: "PROGMEM $1".}
16:48:52Araqvar x {.becreative.}: int
17:12:36reactormonkinteresting.
17:16:44*Endy joined #nimrod
17:19:57reactormonkhm.
17:23:34Araqping zahary_
17:28:52*fowl joined #nimrod
17:29:57reactormonkextern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; => const array[uint8] digital_pin_to_timer_PGM {.becreative, importc:"digital_ping_to_Timer_PGM".} ?
17:30:14AraqC's const is not Nimrod's const
17:30:25Araqwhy do you think c2nim ignores it?
17:30:37reactormonktrue again
17:32:58fowlreactormonk: did my line not work
17:33:17Araqvar digital_pin_to_timer_PGM {.importc: "PROGMEM digital_pin_to_timer_PGM".}: ptr array [0..2000, byte]
17:33:26Araqand yeah I made up the 0..2000
17:40:57*ARCADIVS joined #nimrod
17:43:07*Endy quit (Ping timeout: 264 seconds)
17:52:54*q66_ joined #nimrod
17:54:19reactormonkfowl, the ptr part?
17:54:54fowlwhat sorry
17:55:20*q66 quit (Disconnected by services)
17:55:25*q66_ is now known as q66
18:04:48*Endy joined #nimrod
18:53:02reactormonkAraq, any way to address it without the []?
18:53:12reactormonkI think it's pointer arithmetics here
18:53:39Araqthat's why I made it an array for ya
18:53:50Araqso you can use it as myvar[23]
18:54:00reactormonkhm
18:54:07reactormonkand I gotta figure out the bounds myself.
18:54:16Araqnot really
18:54:26Araqjust come up with some absurd upper limit
18:54:42Araqyou won't have any reasonable bounds checking then
18:54:47reactormonkok
18:54:56Araqbut then you can't get that easily if you don't know the size
18:55:18Araqand if the C API exposes only such a crappy interface there is only so much you can do about it
18:55:41reactormonkkk
19:29:09*Endy quit (Ping timeout: 248 seconds)
19:46:49reactormonkAraq, yeah, that's the hardware interface, depending on the board
20:03:04Araqguys, I have news:
20:03:47AraqI'll make a speech at the next emerging langs
20:04:16Araqon Wed Sept 18th
20:05:14Araqin my humility I named the talk: "Nimrod: A new approach to meta programming" :-)
20:06:07reactormonk:D
20:07:17dom96Awesome. I hope they record it!
20:07:33AraqI allowed recording :P
20:07:33reactormonkAraq, where is that one?
20:07:49AraqSt. Louis, Missouri
20:08:21dom96oh cool, they replied to my tweet: https://twitter.com/d0m96/status/335469190196625409
20:08:29dom96"Not sure yet" :\
20:08:48Araqwell I can release the video I think
20:08:59dom96I would fly there if it wasn't so damn expensive to fly to the USA.
20:09:15reactormonkAraq, when not(defined(Arduino_h)): <- a little bit too near the original
20:09:17dom96Araq: Yeah, but they also have to record it.
20:09:40Araqreactormonk: I tweak the C input until the generated code fits
20:09:57Araqin other words I'd remove the #ifdef crap in the header file
20:11:11reactormonkhttp://sprunge.us/TZce O.o
20:11:32Araqreactormonk: just remove it
20:11:42Araqnimrod supports binary numbers via 0b000111
20:11:49reactormonkfigured so ;-)
20:12:26reactormonktemplate constrain*(amt, low, high: expr): expr =
20:12:29reactormonk (if (amt) < (low): (low) else: (if (amt) > (high): (high) else: (amt)))
20:12:31reactormonkdo we have something for that?
20:12:47Araqyeah system.clamp
20:12:53dom96Araq: You should get a twitter account and live tweet about the whole conference ;)
20:13:04Araqover my dead body :P
20:13:56dom96But what if someone makes dongle jokes behind you? How will you punish those fools if not with a twitter account?
20:14:13reactormonkAraq, we can do that
20:14:49Araq"punish"? I'd congratulate them
20:15:18dom96You will still need twitter for that :P
20:16:06dom96Araq: Do a live tweet pretty pleaseee
20:16:37AraqI'm live in #nimrod instead
20:17:00Araqand tell you guys how my bowel is working
20:17:29dom96ok, but you must take pictures, upload them somewhere and give us links :P
20:17:45Araqmeh, pics of my bowel ... I dunno ...
20:18:14dom96no! The conference man, the conference!
20:20:47Araqmeh I'll make some pics that maybe happen to have something to do with the conference (*cough* girls *cough*)
20:21:13dom96yeah, good luck finding any :P
20:46:32fowlAraq: of course you would do a talk in STL after I leave. -_-
20:47:55fowloh its in september, i might be back there then
20:49:47Araqgood
20:51:51reactormonkAraq, #define interrupts() sei()
20:52:01reactormonkproduces template noInterrupts*(: expr): expr = cli()
20:52:30Araqhow so?
20:52:40reactormonktemplate interrupts*(): expr = sei()
20:53:00Araqlooks like a good translation
20:53:35reactormonkwait, I corrected it
20:53:38reactormonktemplate interrupts*(: expr): expr = sei()
20:53:56Araqthat looks weird :P
21:03:14reactormonkAraq, I assume converting them from template to proc is fine
21:05:18Araqdepends on the template but yeah
21:05:32reactormonkproc clockCyclesToMicroseconds*(a: int): int =
21:05:35reactormonk ((a) div clockCyclesPerMicrosecond())
21:05:51reactormonkwhat about http://sprunge.us/VeiJ ?
21:08:44Araqlooks quite good
21:08:55Araqc2nim is quote smart :P
21:08:58Araq*quite
21:09:48reactormonknot sure what the types here are
21:10:03reactormonkall ints?
21:10:16Araqwhy not leave it as templates and 'expr'?
21:12:04reactormonktype
21:12:07reactormonk boolean* = uint8_t
21:12:09reactormonk byte* = uint8_t
21:12:11reactormonkhm
21:12:19fowlthose are bs
21:12:34fowlyou can just use bool
21:13:08reactormonkhttp://sprunge.us/PjeV <- what about those?
21:13:09Araqand system.byte
21:13:16reactormonkI suppose I don't need the first three
21:13:46fowlyou have to translate those avr/ files or just the relevant datatypes/functions
21:14:23fowlscratch the part of the sentence about relevant data/types functions, im high >_>
21:15:31reactormonkno nice little 'paste c include statement here'?
21:15:57Araqsorry; no.
21:17:25reactormonkso I gotta convert the whole tree?
21:17:57Araqperhaps
21:18:14fowlreactormonk: i just do the minimum that it takes to get a demo working then finish it later
21:19:00Araqreactormonk: C headers often contain mostly bullshit like typedefs to work around C's broken primitive types etc. etc.
21:19:39fowlhave you run into any unions yet
21:19:47reactormonknow the little problem is this: #include "pins_arduino.h"
21:19:55reactormonkaaand http://sprunge.us/EhYF
21:20:39Araqlooks like they went the "lets use the FS instead of the PP" route ...
21:20:56Araqresulting in even "cleaner" code
21:21:02Araqfor your wrapping pleasures
21:21:11fowlthey should have a common API
21:21:28Araqtrue, good point, fowl
21:21:42reactormonkPP?
21:21:52Araqpreprocessor
21:22:04reactormonkoh
21:22:24reactormonkhttp://sprunge.us/WUIB it's not that much
21:23:34reactormonkso, how do I work with this?
21:25:40reactormonktranslate every single file?
21:27:33Araqtranslate the file for your board?
21:28:56reactormonkhm
21:33:00reactormonkhttp://sprunge.us/XaaV oh god...
21:36:05fowlreactormonk: does it not translate?
21:36:22reactormonknope
21:36:33fowljust make it ptr array[0 .. <5, cushort]
21:36:44fowloh is that for your board
21:36:47reactormonkyep
21:39:09fowlvar port_to_mode_PGM*{.importc.}: ptr array[0.. <1024, uint16]
21:39:57fowlreactormonk: dont translate the file and your board specific stuff, just find the common api
21:40:17reactormonkfowl, yeah, that's why I asked for the pin include
21:40:28reactormonkI have the common API here
21:40:41reactormonkor just a good old #include macro statement
21:41:02reactormonkbut that would be PITA to translate as soon as nimrod gets its own compiler backend
21:41:58fowlreactormonk: all the declaring is just so that nimrod knows how to get to the func/var and how to treat it (the type)
21:42:15reactormonkYeah. But how do I tell nimrod to import X?
21:42:59fowlyou dont, you have a pins_arduino.nim that lays out the common structure of those system-specific files
21:44:26fowlunsized arrays are always ptr array[0..int.max, T]
21:47:50fowlthat is because they point to a DATA section or an allocated pointer #someone correct me if im wrong
21:49:08AraqI prefer array [0.. 100_000, T] instead of int.max; this way you get at least somewhat meaningful checking
21:49:31Araqyou don't want to access the whole address space with it anyway
21:59:32fowlhow i prevent s from copying on line 4 https://gist.github.com/fowlmouth/704acc4b0e78ae18192f
22:01:30Araquse local variables and use shallowCopy instead of '='
22:01:36Araqin 'foo'
22:01:47reactormonkhttp://sprunge.us/ONha
22:01:49reactormonkhm
22:02:00reactormonkthe problem is that they use different types depending where the stuff is
22:02:06reactormonk... multiple address spaces.
22:03:36Araqno need for the 'var string' then either fowl
22:03:54reactormonkactually it's typedef void prog_void PROGMEM;
22:04:00reactormonkthe other is just doxygen WA
22:08:40AraqI don't get it; standard C would be volatile void* that points to some fixed address
22:11:01Araqin fact ... I'd use inline assembler for the poke/peek primitives and then use those. it's already as CPU specific as it can get. C doesn't help here
22:21:39*OrionPK joined #nimrod
22:22:02fowlAraq: why is there no isEmpty() or something like that for seqs
22:22:06fowl/strings
22:23:27AraqI use s.len == 0
22:24:10AraqI'm not too happy with lots of aliases for trivial things
22:24:23fowli dont think its trivial
22:24:42fowlwhether i need .len > 0 or .len == 0, they are checking the same thing
22:25:50fowland its really common >_>
22:26:49OrionPKhow about .isThereAnythingInHere?()
22:29:00Araqwhat if your string only consists of whitespace? :P
22:29:32OrionPKC# has IsNullOrWhiteSpace() :)
22:32:11AraqC# also has string.Empty
22:32:26Araqvery useful, otherwise you'd have to use ""
22:32:52OrionPKyeah, although "" probably uses string.Empty at runtime
22:35:04*zahary_ quit (Ping timeout: 256 seconds)
22:35:05Araqfowl: what's not trivial about .len > 0?
22:35:37AraqI get 'not isNil' vs 'isNil' wrong just as I get '== 0' vs > 0 wrong
22:37:03Araqin fact it's a common bug for me, doesn't matter how it's named ('empty' / 'full')
22:43:14fowlits irritating to write all the time when the concept is "is this empty"
22:43:52fowltime for a new module fowltek/libfowl
22:44:11Araqimport rubyness ?
22:45:09Araqimport pythonness --> converter toBool(s: string): bool = s.len != 0
22:45:20fowlyes i'll have `template unless*(cond; body:stmt):stmt = if not cond: body` in there too
22:45:22Araqif "yay": echo "woo hoo"
22:46:22fowlpython prefers explicit to implicit and "" is true
22:46:38Araqpython doesn't make any sense
22:46:47Araqhow is dynamic typing explicit?
22:47:19Araqthat's not some small feature ... the language is dynamic like crazy
22:47:57fowli guess thats why its called a dynamic language?
22:48:27Araqyeah but the "explicit over implicit" rule is some major bullshit then
22:48:29fowlexplicit to implicit in things like the global keyword, explicit return statement, declaring self as a method parameter
22:48:56fowli asked in #python and they told me the language is designed for n00bs
22:49:01Araqsorry these are all minor things compared to lack of any type annotations
22:52:11fowlwell in relevance to your converter example, theres no implicit between bool and anything, only False and None are false, the rest are objects and represent truth, i dont think that has a place in nimrod and i try to only use converters conservatively
22:53:25Araqhuh?
22:53:35Araqif "abc": # valid python
22:54:14Araqpython has a notion of emptiness that does convert to bool
22:54:23Araqwell in 'if' and the like
22:54:35fowlbool("")
22:54:38fowl#=> False
22:54:49fowlif "": print("hi")
22:54:54fowl# nothing
22:55:10Araqyep
22:55:41Araqso it's not just False and None that are false
22:55:42fowl(bool(0), True if 0 else False)
22:56:12fowl#> (False, False)
22:56:47fowleh i read it wrong
22:59:06fowlanyways im only suggesting isEmpty() for strings/collections
23:01:40Araqyeah. I'm against it.
23:01:47Araqexcept perhaps in this form:
23:01:56Araqtemplate isEmpty(x: expr): bool = x.len == 0
23:02:16Araqso that any collection that has a 'len' has it automatically
23:02:34AraqI don't want to re-implement trivial stuff for each collection type
23:05:34fowlword