freenode/lisp - IRC Chatlog
Search
22:00:00
Nilby
"I wish Lisp was more popular.", while holding monkey's paw. Mu-hahhaha. Clojure, is knocking.
22:01:31
emaczen
Does anyone know of a standard C function using struct tm that I can test passing by value
22:04:02
Nilby
emaczen: There aren't any. Nor in unix/linux kernel, or most unix-ish C lib. MacOS/iOS and Windows, do though.
22:04:37
phoe
emaczen: you could try writing your own trivial C function, prove that it works properly, and then compile it into a shared object that you then load.
22:06:41
emaczen
I thought about generating a new objc function for every one that passes/returns structs with a pointer
22:08:08
Nilby
Pass by struct seems like weird quirk/misunderstanding of C, which C++ solved by just letting you not have to type literal '&'.
22:10:11
emaczen
Does anyone think generating the equivalent objc methods with pointers instead of struct by values, and then compiling it as a shared object is too dirty? pjb: What do you suggest? fiddlerwoaroof_: what do you think?
22:12:14
emaczen
I just don't like that about 10% of all objc methods have a struct (really only NSRange NSPoint NSSize and NSRect)
22:14:17
Nilby
And I think mostly because it's an optimization becuase those can fit in a register or a few registers.
22:15:33
Shinmera
you can probably get away with a generic un/pack function that you pass a function pointer + args to or something, so you only have to write it for each type of struct to un/pack.
22:19:47
Nilby
Just that you don't have to do the extra de-reference if your struct can fit in a machine word or a couple of words.
22:20:27
Nilby
That way you also don't have to worry about allocation, which we don't worry much about in Lisp anyway.
22:23:33
Nilby
To pass a struct by pointer, you have to allocate it in stack or heap, and then dereference it at least once, probably more. To pass by value, if it's small enough you can just cram it in registers and then call the function.
22:28:10
Nilby
It does vary with ABI, so the way that it works could theoretically vary based on which complier, but there is a fairly standard way that's documented in, for example the Intel archetecture. Note that a Lisp FFI may have to do multiple ABIs.
22:28:44
emaczen
pjb: Why? I was just going to generate objc code by literally (with-open-file (format ) ....) then (run-program gcc ...) to compile it as a shared object
22:29:05
Nilby
I had the misfortune of coding in C a lot before any C compiler could pass by struct.
22:32:26
emaczen
pjb: For example, with -(void)drawRect:(NSRect)aRect I could define -(void)drawRectPointer:(NSRectPointer)ptr and the implementation of drawRectPointer: would just call drawRect: by dereferencing the pointer
22:36:27
Nilby
But of course saying there are no pointers, is not really true, just like in Lisp. But really more like: let the compiler figure it out.
22:39:13
|Pirx|
java has this "inner classes" thing because they have no pointers, but they're really a pointer
0:00:00
harovali
hi! trying to run cl-ncurses, my distro fails to provide the /usr/lib/libncurses.so file the library asks for. There are other files in my /usr fs which could be equivalent to what cl-ncurses expects, but I'm trying blind on it, any helpis welcome
0:06:18
pjb
harovali: perhaps asking on the channel of your distro for the replacement they put for ncurses?
0:07:04
pjb
harovali: I would propose you to download, compile and install your own copy of ncurses. Probably in /usr/local/lib, in which case you may have to add this path to cffi:*foreign-library-directories*.
0:36:13
harovali
pjb do you know if any ncurses version number is known to be needed for cl-ncurses?
6:04:51
ebzzry
Is there a way to temporarily disable the package reader when reading the symbol X:Y ?
6:09:53
pjb
ebzzry: you can put a reader macro on all the consituent characters, and from there, read the syntax you want.
6:18:29
White_Flame
ebzzry: if you only converted colon to a constituent, you'd get the symbol named "X:Y"
6:23:31
beach
ebzzry: I recommend you use Eclector. It lets you interpret tokens whatever way you like.
6:40:16
ebzzry
pjb: I agree. However, the syntax of the language is that there can be embedded colons inside it, like foo:bar.
7:01:06
beach
ebzzry: READ is meant for reading Common Lisp expressions. If you want to read something else, it is usually a better idea to write a parser for it, rather than trying to twist READ into something that it was not meant for.
9:23:30
splittist
For hysterical raisins I am a (the?) moderator of the beirc-devel mailing list. There is a bit of spam that needs deleting in the moderation queue, but I can't for the life of me recover my password to do so. Could some kind common-lisp.net admin assist?
9:25:48
jackdaniel
splittist: if you ask at #common-lisp.net channel you are more likely to get a response
9:33:23
montaropdf
Any pointer to a document or package to use the LISP syntax as a database format?
9:34:04
montaropdf
I wnat to use LISP to keep records of transaction and to store various types of data in simple tables.
9:37:36
montaropdf
both datfly nd postmodern are libraries to work with database, I am looking for a database format made of LISP strings.
9:46:51
montaropdf
My idea was to have one table per file, with the table definition at the top and transaction records or data records following the definition. the definition and records should be stored as LISP string: a record could look like (insert record-date field1 field2 field3...)
9:48:50
jackdaniel
maybe defining a class and treating class = table, instance = record, slot = field would suffice?
9:49:38
montaropdf
This would allow me to use a simple text editor to edit the DB and use a companion library to create reports or transfert the whole stuff into a more traditional database format.