IRC channel logs
2017-06-11.log
back to list of logs
<spk121>catonano: saw the email on unsigned short. Do you know the size of unsigned short on your machine? Instead of using the symbol 'unsigned-short you can just use the number of bytes that the parameter is supposed to occupy. (list '* 4 '*), for example <catonano>spk121: right. No, I don't know the size of unsigned-short on my machine. But even iff I could find tat out, that would be less portable, right ? <spk121>catonano: Yes. It would be less portable. There should be an unsigned short in <spk121>the library. It is a bug if it is missing. <catonano>I don't tink it's missing. In fact I comiled it and I got no warning <catonano>./pre-inst-env /home/me/.guix-profile/bin/guild compile -Wunbound-variable -Warity-mismatch -Wformat -o "freexl/common.go" "freexl/common.scm" <spk121>You're right. I just looked in the source for (system foreign) and unsigned-short is in there <catonano>then why is my wrapper not working ? :-/ <mwette>I don't think the value of unsigned-short is system size <mwette>at guile propt, (use-modules (system foreign)) unsigned-short yields `5' <catonano>the third argument is an unsigned int, NOT an unsigned short <catonano>only the second argument is an unsigned short <spk121>mwette: you are right. Those size values are an enum. <catonano>I'm not sure I understand what you mean, spk121 mwette <mwette>i just ran freexl.h through my ffi-helper (autocoder), will post to guile-user <spk121>catonano: Before, I told you that you could use the size of the byte directly, like ('* 4 '*), instead of using a variable like "int". I was wrong about that. you have to use the symbols like "int" <catonano>I was wondering: I am calling my procedure like this: <catonano>and 32010 is a scheme nuumber, not a C number <paroneayea>ACTION writes baby's first implementation of quicksort <paroneayea>since I don't have a CS background I'm coming to these things later in my career than I feel like everyone else is <cmaloney>paroneayea: You're coming at it from a functional language perspective so it's going to be easier than having to bolt that perspective onto a procedural bent <cmaloney>That's partly why Quicksort has such a reputation: trying to learn recursion from a procedural perspective while you're learning about the stack is _fun_ <cmaloney>And my generation of coders learned it in Pascal, which made things even more mysterious. <reepca>Is the behavior of rename-file when the file being renamed to already exists well-defined in guile? <reepca>(I ask because the C++ code I'm replacing uses rename(), which leaves it unspecified whether it overwrites or fails, and want to make sure I'm not making the same mistake) <cmaloney>reepca: Any particular reason you wouldn't want to stat if the file already exists? <reepca>I'm not exactly sure how concurrency in the file system is handled, but if I understand correctly it's possible that the file could be made to exist between when I check if it exists and when I use rename-file. <reepca>in fact the use case I'm looking at is specifically where I expect it to exist, and need to atomically replace it with another file by the same name <catonano>so it seems that -3 means "FREEXL_INVALID_HANDLE" <catonano>so maybe the culprit is freexl-open. it's populating a foul handle <catonano>spk121: mwette you might want to know that I managed to make it work !!