[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] writing primitives

On Wednesday, November 27, 2002, at 03:07 PM, James McCartney wrote:

You have to set the 'size' field.

well i did set the size field actually.  i assume this is like
Array.new(size), and i'm still trying to .put into it, but that won't
i looked at prArrayAdd but its not too clear.

the problem is still that the Array is empty.
Instance of Array {    (01F65E50, gc=58, fmt=01, flg=00, set=01)
  indexed slots [0]

int prGetPathsDialog(struct VMGlobals *g, int numArgsPushed)
        if (!g->canCallOS) return errCantCallOS;

        PyrSlot *receiver = g->sp - 2;
        PyrSlot *defaultPath = g->sp - 1;
	PyrSlot *prompt = g->sp;

        // check arg types
        if (!isKindOfSlot(defaultPath, class_string)) {
                return errWrongType;
        if (!isKindOfSlot(prompt, class_string)) {
                return errWrongType;

        NSString* nsDefaultPath = pyrSlotToNSString(defaultPath);
        NSString* nsPrompt = pyrSlotToNSString(prompt);
        //NSLog(@"defpath %@ prompt %@",nsDefaultPath,nsPrompt);

NSDocumentController *docctl = [NSDocumentController sharedDocumentController];
        if (!docctl) {
            NSLog(@"No NSDocumentController");
            return errFailed;

        // if default path not nil, locate to there

        // prompt
        NSArray *urls =  [docctl URLsFromRunningOpenPanel];

        // if cancelled, return nil
        if(!urls) {
            SetNil(receiver); // not working, returns receiver, File
            return errNone;
        } else {
            int i;
            int count = [urls count];

            // array to return
PyrObject *scArray = (PyrObject*)instantiateObject(g->gc, class_array, count, false, true);

            for (i = 0; i < count; i++)
                NSString *nspath = [[urls objectAtIndex: i ] path];
                NSLog (@"Object at index %d is: %@", i, nspath);

PyrString* pyrPathString = newPyrString(g->gc,[nspath cString],0,true);

                PyrSlot slot;
			  SetObject(&slot, pyrPathString);

                // neither of these work
                // putIndexedSlot(g ,scArray, &slot  ,i);
                scArray->slots[i].ucopy = slot.ucopy;


            return errNone;

On Wednesday, November 27, 2002, at 10:01  AM, crucial felix wrote:

no crashing now, but the returned array is empty.

--- james mccartney james@xxxxxxxxxxxxxx <http://www.audiosynth.com> SuperCollider - a real time synthesis programming language for the PowerMac.

sc-dev mailing list