Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - sunsetandlabrea

#1
Anything else we might add? /
March 17, 2005, 12:08:10 PM
Thanks Lutz that is just the kind of thing I'm looking for.



Richard
#2
Anything else we might add? / anonymous contexts
March 17, 2005, 08:41:18 AM
Hello,



I'm still trying to learn.



I want to use contexts as a sort of object but somehow want to create anonymous contexts.



For instance in Delphi I have a class with a few attributes and a number of methods. I can recreate this in newLisp using contexts but in Delphi it is quite easy to create hundreds of these objects and assign each one to some sort of list. Afterwards I can iterate through the list with a simple index.



In newLisp though I have to name each context and so I can't see how I could do a similar thing.



Any help would be greatly appreciated.



Thanks,



Richard
#3
Anything else we might add? /
March 16, 2005, 01:59:41 PM
Excellent thanks for adding that, very useful.



Unfortunately having a separate installer pretty much inhibits me using newLisp in this particular commercial project. We take great pains to reduce the complexity of installation of our software and this would just add to it.



Thanks anyway,



Richard
#4
Anything else we might add? /
March 16, 2005, 12:39:54 PM
Hello again,



Thanks for the consideration of adding endian support, that will be a useful feature.



The license situation is unfortunate, it means I cannot use it for my project at work. Although it doesn't sound too bad having to run a separate installer it would be impractical for us, and add a layer of unnecessary complexity.



:-(



I presume you have chosen the GPL to inhibit inclusion into commercial products? If not perhaps you could consider a dual license with another open source license which would allow easier usage within a commercial project? (http://www.opensource.org/licenses/">http://www.opensource.org/licenses/).



Obviously I can understand your reasons for releasing under the GPL but for me personally I would have to choose a scripting language with a more liberal license - such as Python, Perl, TCL, etc.



Thanks,



Richard
#5
Anything else we might add? /
March 16, 2005, 09:13:12 AM
Hello,



Many thanks for your reply and the warm welcome!


Quotefirst be aware that the "f" format is for packing/unpacking 12bit floats so you code would have to be:


Yes, sorry the reading 2 bytes was a typo, I presume you meant 16bit floats?


Quotethe endian issue will be automatically resolved when you stay on the same platform. So a number packed/written on little-endian will come out fine when read back on little-endian, and the same is true for writing/reading on big-endian OS.


The problem is the file is always created on a PC, but may be read back on OS X which is obviously big-endian. So I have a requirement to read a little-endian file on a big-endian platform.



I'm more familiar with Python and that has a struct module where you can append an optional formatting character but otherwise works similiarly to unpack. So you have = for native, < for little-endian, and > for big-endian. I guess I'm looking for something similar. I was hoping to create a single function which could do all this for me in a simple manner, for instance:



(myread dat "< s13 f f d d")



Where dat would be an open file handle, and the string would be the unpack format. I guess I need to look at parsing the string and work from there.



Thanks for the pack / unpack, alignment tips I shall keep those in mind.



Also a quick license question. I am interested in newLisp also as a dll to add scripting to a commercial application. From my understanding of the GPL as long as I don't link the code into my application that would be ok? Is my understanding correct? What would happen if I used newLisp's link.lsp to embed one of my scripts within the dll would I still be ok?



Many thanks again,



Richard
#6
Anything else we might add? / endian tricks?
March 16, 2005, 07:49:10 AM
Hello,



I'm just learning newLisp (very impressed so far) and I'm new to lisp style languages.



I want to read in a binary file but deal with it both on Windows and OS X and of course there is an endian issue.



I'm reading it in something like:



(read-buffer dat 'example 2)

(first(unpack "f" example))



of course I can just do:



(first(unpack "f" (reverse example))



which works fine.



Ideally though I would like to be able to write a function which deals with all this issue and which I can pass an unpack style string and get back a list. i.e. something like:



(my-read dat "s13fdff")



So that would give me a list containing a 13 character string, a float, an integer and two more floats plus it would swap the bytes round if required on certain platforms.



Anyone any suggestions how I go about writing that?



Many thanks,



Richard