<<12-07-2012>>

00:11:37*zahary quit (Read error: Connection reset by peer)
00:16:38*zahary joined #nimrod
00:18:21*Trixar_za is now known as Trix[a]r_za
01:52:21*zahary quit (Read error: Connection reset by peer)
01:54:21*zahary joined #nimrod
02:06:32*zahary quit (Quit: Leaving.)
02:46:41*SchalaZeal joined #nimrod
02:47:19SchalaZealHow would I go about making a tuple whose fields span more than 1 line, for readability?
02:53:59fowlseparate the fields with ,
02:54:18SchalaZealhmm... well I'll try again
02:54:49fowlhttp://pastebin.com/5P3pTn0s
02:54:58fowlthat worked fine in interactive mode
02:55:41SchalaZealoops I forgot the brackets
03:00:22SchalaZealI always wondered why {.pure, final.} objects are used instead of {.pure.} tuples for C wrappers. C structs are like tuples in that they share the sequential order factor (ie. struct Person fred = {"Fred", 29}; and TPerson fred = ("Fred", 29))
03:00:37SchalaZealmakes more sense I'd think
05:11:10AraqSchalaZeal: the reason is that C's structs use nominal typing
05:11:19Araqso we use a nominal type in nimrod as well
05:11:36Araqplus when most of the wrappers were created tuples weren't up for the task ...
05:11:40Araqsee you later
05:26:49SchalaZealah ok
05:28:19SchalaZealfor format() in times, I'm trying to find a separator token to use so "sszzz" won't be an invalid format but instead like... "59+08:00" (seconds, tz offset)
05:29:52SchalaZealspecifically I'm trying to make a proc that takes a TTime as a parameter and returns it as an ISO8601 date-time strong
05:30:28SchalaZeallike 2012-07-12T22:30:54+08:00
05:30:34SchalaZealstring**
05:31:57SchalaZeal"yyyy'-'MM'-'dd'T'HH':'mm':'sszzz" does not seem to work
05:32:13SchalaZealbecause of the sszzz part
05:55:11SchalaZealerr... guess not... adding '' helps
05:55:13SchalaZealheh
05:59:11SchalaZealhmm.. +/- in the offset won't show
06:05:43SchalaZealis it a bug or am I flubbing up?
06:14:33*fowl quit (Quit: Leaving)
06:17:34*fowl joined #nimrod
07:39:49SchalaZealugh..... making a binding to one function in libeay32.dll is frustrating
08:07:56*zahary joined #nimrod
08:39:32*Trix[a]r_za is now known as Trixar_za
08:45:35fowlomg
08:45:40fowlparsing json this way is messy
08:46:15fowli long for ruby's JSON.parse()
08:47:27SchalaZealI'm having a tough time figuring out how to generate a SHA1 digest
08:48:53fowlhmm i only saw md5 and base64 stuff
08:49:27SchalaZealWell the protocol I'm implementing calls to use SHA1 for passwords
09:07:27*SchalaZeal quit ()
10:26:48dom96hello.
10:29:07dom96ARMs test results are the same as x86 test results. That's quite good.
11:01:21dom96fowl: Why do you think parsing JSON in Nimrod is messy?
11:42:09*XAMPP[0] joined #nimrod
11:45:15*XAMPP quit (Read error: Connection reset by peer)
12:01:28*Trixar_za is now known as Trix[a]r_za
12:42:13fowldom96, the way i have to do it is messy, checking if every field is there before i use it
12:42:54dom96fowl: You don't have to check.
12:43:36fowli have to check if an object exists and is an object before i attempt to index it, then make sure the index is there
12:45:33dom96No you don't: https://gist.github.com/a3272bad33db21602937
12:46:06dom96Only scenario where you would check in is if the structure of the JSON cannot be guaranteed.
12:46:16fowldom96, you know that everything is there, i'm expecting sections/values to be missing
12:46:53dom96well then it's not wonder you need to check, how does Ruby get around this?
12:47:00dom96Don't you have to perform checks there too?
12:52:28*fowl quit (Ping timeout: 246 seconds)
13:16:55*Araq_ joined #nimrod
13:26:36*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 13.0.1/20120614114901])
13:26:55*Araq_ joined #nimrod
13:28:15*fowl joined #nimrod
13:28:15*fowl quit (Changing host)
13:28:15*fowl joined #nimrod
13:29:53dom96<dom96> well then it's not wonder you need to check, how does Ruby get around this?
13:29:53dom96<dom96> Don't you have to perform checks there too?
13:30:02dom96fowl: ^^
13:31:23fowlah
13:34:25fowlits a lot more forgiving in ruby, parsing it gives u a hash then you can just use `hash["key"] or defaultValue` because missing key defaults to nil
13:35:02dom96You could probably write a nice proc that does that for you.
13:36:15fowlthis is what i came up with https://gist.github.com/3098147
13:40:10*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 13.0.1/20120614114901])
13:42:58dom96I can't cope up with anything better heh
13:46:14fowlwhen nim compiles to c there is a lot of backtracing stuff like F.line = 70;F.filename = "tables.nim"; doesnt that slow down the program
13:53:32dom96That's only in debug mode.
13:53:41dom96It disappears when you compile with -d:release
13:53:45fowlah
13:54:04fowlthat makes sense :D
14:00:48dom96:)
14:39:47*Trix[a]r_za is now known as Trixar_za
15:29:40dom96Araq: Should type conversion of PTreeModel to PListStore be possible?
15:58:35*SchalaZeal joined #nimrod
15:59:57SchalaZealdoes Nimrod or any of its wrappers have SHA1 support?
16:01:11AraqSchalaZeal: I dunno about the wrappers, there is no native nimrod implementation
16:01:32Araqopenssl wrapper may provide it? I dunno
16:02:57SchalaZealIt does but the wrapper isn't comprehensive, and I had a memory error when trying to make a binding for SHA1()
16:03:48SchalaZealSHA1() is declared in openssl/sha1.h as taking unsigned char*s and what not
16:04:57Araqwhat's so hard about 'cstring'? it is compatible to "unsigned char*" ...
16:05:11SchalaZealoh?
16:05:27Araqwhat's so hard to grasp that "unsigned" has almost no effect when wrapping a DLL?
16:05:47SchalaZealdidn't know that... here I was making a cuchar datatype with importc unsigned char
16:05:49Araqand "volatile const" too btw ...
16:06:27SchalaZealwell I learned something new today--though what do you mean by almost?
16:07:21AraqmySignedCInt = c_proc_that_takes_unsigned()
16:07:38Araq# --> mySignedCInt contains a negative number for large unsigned numbers
16:07:57SchalaZealso... not really relevant?
16:08:04Araqyes
16:08:25SchalaZealyes as in it isn't or is?
16:08:33Araqyes it isn't :-)
16:08:38SchalaZealSorry if this is unnerving
16:08:41SchalaZeallol ok
16:09:15*SchalaZeal has to update her own wrappers now.
16:09:41SchalaZealI is not very attentivez
16:11:58SchalaZealSometimes implementing backwards compatibility is a pain
16:12:56dom96Araq: Should type conversion of PTreeModel to PListStore be possible?
16:13:07dom96(read the logs damn it :P)
16:13:09Araqno idea what you're talking about, dom96
16:13:28dom96Well, I used type names because it's a bit hard to explain I guess.
16:13:36dom96PListStore inherits from PTreeModel
16:13:50SchalaZealooh! I think I got SHA1() to work!
16:14:43SchalaZealproc sha1*(d: cstring, n: int, md: cstring): cstring{.cdecl, importc: "SHA1", dynlib: libeay32.} manages to print out gibberish when I pass it to echo with cstring parameters
16:15:22SchalaZealsaid parameters, of course, being something readable
16:17:34Araqdom96: context?
16:21:10dom96var ls = cast[PListStore](win.errorListWidget.getModel())
16:21:13dom96ls.append(...)
16:28:29SchalaZealIn the times module, when using format() I can't get the positive/negative character to show up in timezone offset
16:29:07SchalaZealhttp://pastebin.com/bnskE2Yd
16:29:18SchalaZealthat's how I'm currently doing it
16:33:53SchalaZealWas wondering if it's a bug or my own slip up
16:33:55Araqdom96: dont cast
16:34:13dom96Araq: What do I do instead then?
16:35:32*Trixar_za is now known as Trix[a]r_za
16:39:07AraqPListStore(...getModel()) ?
16:39:35Araqand if that isn't allowed it's a bug in the wrapper or you're trying wrong things
16:39:39dom96That doesn't work.
16:40:02Araqlinks to the gtk docs please
16:41:26dom96http://developer.gnome.org/gtk/2.24/GtkListStore.html
16:47:15Araqit says GtkListStore "implements" GtkTreeModel
16:47:34AraqI dunno what that means for binary compatibility in Gtk ...
16:47:49Araqperhaps the 'cast' is valid and necessary ...
16:57:20SchalaZealHow would I get the plus/minus sign to appear on a formatted date? formatting 'zzz' doesn't work
16:57:48Araqdunno, dom96?
16:58:07SchalaZealhe wrote format()?
16:58:22dom96yeah, I wrote it.
16:58:57dom96'zzz' should give the plus/minus
16:59:00dom96I guess that's a bug
16:59:04SchalaZealAh, well when I specify 'zzz' in format, it would print 08:00 as opposed to -08:00 or +08:00
16:59:10SchalaZealAh okay
17:01:21SchalaZealI'm a little confused when and when not to use incompleteStruct pragma in my wrappers. I've seen other wrappers declare {.pure, final.} objects of structs that have the fields hidden
17:02:04dom96I'll fix it for you. Just give me a couple of minutes :)
17:02:28SchalaZealawesome
17:02:55SchalaZealanyway, I thought incompleteStruct was for such a purpose but... am I wrong?
17:03:41dom96I don't think so. I'm not really sure.
17:04:23SchalaZealhmm
17:06:00SchalaZealand when I'm making a const for a lib name to use for dynlib pragma, do the parentheses only work for .so/.dylib, or can it be used for DLLs too?
17:06:46AraqincompleteStruct is only ever necessary with 'header'
17:06:48Araqif you don't import via a header, you don't need it
17:06:53Araqand it will only do harm
17:06:55Araqthe () work for DLLs too of course
17:07:05Araqgonna fix these connection problems, see you later
17:07:38SchalaZealah ok
17:08:17dom96gah, my offset is 00:00
17:08:28dom96So that doesn't help :P
17:12:55dom96SchalaZeal: Any ideas how to change timezone temporarily?
17:23:55SchalaZealuhm
17:24:03SchalaZealhmm
17:24:12SchalaZeallet me check docs
17:24:47SchalaZealTTimeInfo.timezone or tzname?
17:24:54SchalaZealmodify those?
17:25:15SchalaZealbtw, my offset was 00:00 as well
17:26:02SchalaZealprefs test
17:26:06dom96well maybe it prints the minus and plus when the offset is actually something?
17:26:07SchalaZealoh there we go
17:26:21SchalaZealyeah that's my guess
17:26:33SchalaZealthing is it isn't being detected
17:27:03SchalaZealtimezone that is
17:28:40dom96how so?
17:29:45SchalaZealwell... it was 00:00 for me too
17:29:56SchalaZealand I believe I am GMT 08:00
17:30:05SchalaZealor... whatever Pacific US time is
17:30:27dom96oh
17:44:22dom96Well, I just set the timezone to Asia/Kolkata and it says -05:00
17:48:52dom96Not sure why it says that Berlin is -1
17:48:57dom96Should be +1
17:49:01SchalaZealodd
17:49:09dom96Well actually +2 currently I think
17:49:17SchalaZealwell at least you made progress
17:50:05dom96date +%z
17:50:09dom96gives the right thing hrm
17:50:53SchalaZealhm
17:51:14dom96timezone = -3600
17:51:23dom96So I'm really puzzled
17:51:39dom96hrm.
17:51:57dom96However that's non-dst so... it's correct I think
17:52:03dom96except for the minus
17:54:27dom96It's the offset west of UTC
17:54:30dom96so hrm
17:54:41dom96Maybe I should just negate it
17:56:28SchalaZealpossibly
17:56:51Araqbut if C does it that way, maybe there is a reason for it?
17:57:19Araqdates are hard to get right
17:57:25Araqplease look up this stuff ...
17:57:54Araqdon't just hack around until you get what you think is a "correct" result ...
17:58:35dom96Hey, I did look it up.
17:59:59Araqok then
18:01:11dom96Apparently I didn't look it up well enough
18:03:56Araqwhat ocaml's strings are mutable?
18:04:37dom96"difference from UTC and local standard time"
18:04:39dom96hrm
18:05:08SchalaZealIf a numeric value isn't specified for an enum value, is it 0?
18:06:32SchalaZealTrying to port over an unnamed enum but it has no numeric values
18:08:39Araqit starts from 0 then, yes
18:09:44SchalaZealokay
18:11:02Araqany reason why you don't c2nim it?
18:11:30SchalaZealbecause it gets messy
18:11:58SchalaZealand also apparently this developer felt the need to have an unordered enum
18:12:33SchalaZeallike enum MyEnum { A = 9, B = 5, C = 6 }; ..... easy fix but man that's annoying
18:13:51AraqI always use c2nim and then fix the nimrod code :-)
18:14:07Araqwell I also fix the C code to compile with c2nim ...
18:14:15Araqbut it saves lots of tedious typing
18:14:44SchalaZealheh
18:15:25SchalaZealI'm looking c2nim over... uhm... what's --dynlib mean? That I can pass in a DLL input, or that it points the procs to import from a DLL?
18:17:18Araqthe later
18:19:16dom96Well I'm really puzzled by this timezone stuff.
18:20:10SchalaZealhmm... c2nim chokes on a function pointer typedef
18:20:21Araqwho doesn't?
18:20:23Araq:D
18:20:33Araqfunction pointer syntax is a pita in C ...
18:20:57SchalaZealcomment it out, type it myself later?
18:21:13Araqyep
18:21:30Araqthat's the spirit of c2nim :D
18:26:32SchalaZealheh... solved most of my problems finding and replacing "WINAPI" with nothing
18:27:13SchalaZealhmm... but now I have another concern
18:27:25SchalaZealif consts count as defines
18:27:36SchalaZealbecause if not..........yeeeeeeeah..........
18:27:44Araqer SchalaZeal
18:27:52Araqplease learn to use c2nim ...
18:28:01Araq#def WINAPI
18:28:11Araqwould do the replacement for you for example
18:29:50SchalaZealokay... uhm... thing is when I converted the consts, it would be like "const Foo = true" and later "when defined(Foo)"
18:30:58Araqhrm
18:37:10Araqwell translate that to:
18:37:15Araqconst Foo = true
18:37:17Araqwhen Foo:
18:37:29Araqthat's the most nimrodic way
18:40:57SchalaZealok
18:49:03SchalaZealugh..... one of the Microsoft compiler catering #ifdef statements caused all the code to indent and there's no dedent
18:49:08SchalaZealfeature*
18:50:24Araqdetermine what's defined
18:50:32Araqand get rid of the #ifdef
18:50:36Araqand then use c2nim
18:50:57SchalaZealok
18:55:42SchalaZealthere we go
18:56:08SchalaZealcomment out the header define guards, indent problem gone
19:06:47SchalaZealhmm.... c2nim seems to translate unsigned primitives into stuff like cunsignedint, which doesn't exist
19:08:33Araqyeah well
19:08:49AraqI did it this way so no information is lost
19:08:53Araqyou can easily do:
19:08:55SchalaZealguess I find and replace stuff like cunsignedint -> cint?
19:09:06Araqyeah that's one way to do it
19:09:09Araqanother is:
19:09:14SchalaZealwhat's your way?
19:09:38Araqtype cunsignedint = uint32 # now exists ;-)
19:10:28SchalaZealyeah but aren't the signed C primitive types in the system module from C imports?
19:11:08SchalaZealI mean I could do type cunsignedint{.importc: "unsigned int", nodecl.} = uint32
19:11:35SchalaZealI think
19:11:46Araqugh, please don't
19:11:53Araqthis feature is quite fragile ...
19:12:07SchalaZealif you insist
19:14:36SchalaZealew.... http://pastebin.com/VBagpj1U
19:15:17SchalaZealthat..... is pretty ugly
19:20:04Araqcunsignedchar --> just use 'char'
19:20:17Araqand I would seriously use the dynlib approach
19:20:26Araq'header' is ugly and much more fragile
19:20:41Araqas then I have to install the headers and import libs and stuff
19:20:47Araqjust wrap the DLL please
19:21:25SchalaZealyeah
19:21:31SchalaZealthought so
19:23:22*Amrykid is now known as OdhE4DxgmF7Lb76W
19:23:37*OdhE4DxgmF7Lb76W is now known as Amrykid
19:34:39SchalaZealalrighty, now to just fill in the part C2Nim choked on
19:55:28SchalaZealdone
19:55:36SchalaZeallets write a test app
20:00:15*XAMPP[0] quit (Quit: There is no such thing as coincidence, only the inevitable.)
20:04:20*XAMPP joined #nimrod
21:58:39SchalaZealand I failed
22:00:37dom96what happened? D:
22:01:09SchalaZealStormLib is too complicated to even test a wrapper on
22:02:08SchalaZealIt goes hand in hand with the ugly Win32 API
22:02:15*zahary quit (Quit: Leaving.)
22:03:09dom96hehe
22:03:20dom96What is StormLib? Some kind of a Diablo 1 extractor thing?
22:04:21SchalaZealMPQ archive format
22:04:32SchalaZealup to version 4
22:04:53Araqcool
22:05:13Araqit seems to be quite easy to wrap according to the docs
22:05:19Araqwhat's the problem?
22:05:31*zahary joined #nimrod
22:05:57SchalaZealIt's too integrated with Win32
22:06:04SchalaZealWin32 has an ugly API
22:06:48SchalaZealyes they have cross platform counterparts of what's needed but that doesn't make it look any more appealing
22:08:44Araqbool WINAPI SFileOpenArchive(
22:08:46Araq const char * szMpqName, // Archive file name
22:08:48Araq DWORD dwPriority, // Archive priority
22:08:49Araq DWORD dwFlags, // Open flags
22:08:50Araq HANDLE * phMPQ // Pointer to result HANDLE
22:08:52Araq);
22:08:54AraqDWORD = int32
22:09:00AraqHANDLE --> winlean.THandle
22:09:08Araqin fact
22:09:12Araqjust import winlean
22:31:12SchalaZealah
22:31:36SchalaZealwell thing is I was hoping for a cross platform solution
22:34:23SchalaZealHere's what I have so far
22:34:25SchalaZealhttps://github.com/Schala/nimrod-modules/blob/master/lib/wrappers/storm.nim
22:38:27Araqthat looks good
22:38:31Araqwhat's the problem?
22:40:24SchalaZealtried rewriting the example file extract proc in Nimrod, kept messing up
22:47:38Araqhrm, but I have to sleep now
22:47:41Araqgood night
22:50:55SchalaZealk
22:50:58SchalaZealnight
23:08:25*XAMPP quit (Read error: Connection reset by peer)
23:08:44*XAMPP joined #nimrod
23:08:45*XAMPP quit (Changing host)
23:08:45*XAMPP joined #nimrod