Exemplo n.º 1
0
/**
 * Create an instance of a queue object from Rexx code.
 *
 * @param init_args The pointer to the arguments.
 * @param argCount  The count of arguments.
 *
 * @return A new instance of the queue class.
 */
RexxObject *QueueClass::newRexx(RexxObject **init_args, size_t argCount)
{
    // this class is defined on the object class, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;

    Protected<QueueClass> newObj = new QueueClass;

    // handle Rexx class completion
    classThis->completeNewObject(newObj, init_args, argCount);
    return newObj;
}
Exemplo n.º 2
0
/**
 * Create a method object from a file.
 *
 * @param filename The target file name.
 *
 * @return The created method object.
 */
MethodClass *MethodClass::newFileRexx(RexxString *filename)
{
    // this class is defined on the object class, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;
    // get the method name as a string
    filename = stringArgument(filename, ARG_ONE);

    Protected<MethodClass> newMethod = LanguageParser::createMethod(filename);

    newMethod->setScope((RexxClass *)TheNilObject);
    classThis->completeNewObject(newMethod);
    return newMethod;
}
/**
 * Create a directory object from Rexx code.
 *
 * @param init_args The arguments to the NEW method.
 * @param argCount  The argument count.
 *
 * @return A new directory object.
 */
RexxObject *DirectoryClass::newRexx(RexxObject **init_args, size_t argCount)
{
    // this class is defined on the object class, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;

    // create the new identity table item (this version does not have a backing contents yet).
    Protected<DirectoryClass> temp = new DirectoryClass(true);
    // finish setting this up.
    classThis->completeNewObject(temp, init_args, argCount);

    // make sure this has been completely initialized
    temp->initialize();
    return temp;
}
Exemplo n.º 4
0
/**
 * Create a method object from a file.
 *
 * @param filename The target file name.
 * @param scope    The scope that the new method object will be given.
 *
 * @return The created method object.
 */
MethodClass *MethodClass::newFileRexx(RexxString *filename, PackageClass *sourceContext)
{
    // this class is defined on the object class, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;

    // parse all of the options
    processNewFileExecutableArgs(filename, sourceContext);

    // go create a method from filename
    Protected<MethodClass> newMethod = LanguageParser::createMethod(filename, sourceContext);

    classThis->completeNewObject(newMethod);
    return newMethod;
}
Exemplo n.º 5
0
/**
 * Allocate a new Stem object from Rexx code.
 *
 * @param init_args The standard variable argument pointer.
 * @param argCount  The count of arguments.
 *
 * @return A new stem instance.
 */
RexxObject *StemClass::newRexx(RexxObject **init_args, size_t       argCount)
{
    // this class is defined on the object class, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;

    // the name is an optional argument, we'll just pass along to the constructor which will
    // perform the validation.
    RexxObject *name;
    RexxClass::processNewArgs(init_args, argCount, init_args, argCount, 1, name, NULL);

    Protected<StemClass> newObj = new StemClass ((RexxString *)name);

    // handle Rexx class completion
    classThis->completeNewObject(newObj, init_args, argCount);
    return newObj;
}
Exemplo n.º 6
0
/**
 * Create a new method from REXX code contained in a string or an
 * array
 *
 * @param init_args The array of arguments to the new method.
 * @param argCount  The argument count.
 *
 * @return A new method object.
 */
MethodClass *MethodClass::newRexx(RexxObject **init_args, size_t argCount)
{
    // this method is defined as an instance method, but this is actually attached
    // to a class object instance.  Therefore, any use of the this pointer
    // will be touching the wrong data.  Use the classThis pointer for calling
    // any methods on this object from this method.
    RexxClass *classThis = (RexxClass *)this;

    RexxString *programName;
    Protected<ArrayClass> sourceArray;
    PackageClass *sourceContext;

    // parse all of the options
    processNewExecutableArgs(init_args, argCount, programName, sourceArray, sourceContext);

    // go create a method from whatever we were given for source.
    ProtectedObject newMethod = LanguageParser::createMethod(programName, sourceArray, sourceContext);

    // finish up the object creation.  Set the correct instance behavior (this could
    // be a subclass), check for uninit methods, and finally, send an init message using any
    // left over arguments.
    classThis->completeNewObject(newMethod, init_args, argCount);
    return newMethod;
}