Login  Register

Re: Finding packages

Posted by Bob Cowdery-4 on Jun 25, 2010; 8:45am
URL: https://forum.world.st/Finding-packages-tp2267325p2268153.html

Hi Adrian

Not having much luck really. I've tried two versions of OsProcess, one I
found from a previous Pharo message and the other from your link. Both
fail to load with Syntax errors and leave all the categories installed
but no code. This is the error which was in UnixProcess (a bit odd
seeing as I'm on Windows). I also loaded the OsProcessPlugin but that
appears to require compiling according to the readme. This all seems to
be much harder than it should be, or maybe it's just me.

Regards
Bob

argsAsFlatArrayAndOffsets: anArrayOfNullTerminatedStrings
    "Given anArrayOfNullTerminatedStrings, flatten the array into a
string buffer,
    leaving space at the beginning of the buffer for a list of C
pointers. Answer
    the string buffer and an array of address offsets. The address
offsets may later
    be converted to C pointers and overlaid on the beginning of the
buffer, resulting
    in a data structure which can be treated as a C array of strings
suitable for
    use as a Unix argv vector."

    "OSProcess thisOSProcess argsAsFlatArrayAndOffsets:
        (UnixProcess arguments collect:
            [:e | e, (Character value: 0) asString])"

    | offset arraySize flatStringArray ws addresses |
    "Preserve offset space to hold address pointers."
    offset := (anArrayOfNullTerminatedStrings size + 1) * self
processAccessor sizeOfPointer.
    "Allocate flat strings buffer"
    arraySize := (anArrayOfNullTerminatedStrings collect: [:e | e size]) sum
        + ((anArrayOfNullTerminatedStrings size + 1) * self
processAccessor sizeOfPointer).
    "Flatten the strings out into a buffer, leaving room at the
    beginning of the buffer for an array of addresses."
    flatStringArray := String new: arraySize.
    ws := WriteStream on: flatStringArray.
    offset timesRepeat: [ws nextPut: (Character value: 0)].
    anArrayOfNullTerminatedStrings do: [:e | ws nextPutAll: e].
    "Find address offsets to be used in creating the addresses for the
strings."
    ws := WriteStream on: (Array new: anArrayOfNullTerminatedStrings size).
    (anArrayOfNullTerminatedStrings collect: [:e | e size])
        inject: offset into: [:p :e | ws nextPut: p. Cannot store into
->p := p + e].
    addresses := ws contents.
    "Results"
    ^ Array with: flatStringArray with: addresses


Adrien BARREAU wrote:

> The first thing I do (don't know if it's the best idea) when I am
> searching for a package is to take a loot at www.squeaksource.com and
> search the project in the "projects" tab.
> But, it seems to be down for the moment.
>
> Adrien.
>
> For OSProcess, i suggest you read that:
> http://wiki.squeak.org/squeak/708 :)
>
> > Date: Thu, 24 Jun 2010 18:16:34 +0100
> > From: [hidden email]
> > To: [hidden email]
> > Subject: [Pharo-users] Finding packages
> >
> > Sorry if this is a bit of a basic question. Could someone enlighten me
> > on how to install packages please. I want to be able to run command
> > files under windows from within Pharo. It looks like I need OsProcess or
> > maybe CommandShell. I assume these should be installable from
> > Monticello. I don't see any search facility in the Monticello Browser
> > and tried a few repositories but failed to find what I needed. What's
> > the best way to find packages.
> >
> > Thanks
> > Bob
> >
> > _______________________________________________
> > Pharo-users mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
> ------------------------------------------------------------------------
> Vous voulez protéger votre numéro de CB ? Utilisez Internet Explorer 8
> <http://clk.atdmt.com/FRM/go/232102479/direct/01/>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>  


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users