|
Jatha Software | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jatha.dynatype.StandardLispValue
org.jatha.compile.LispPrimitive
org.jatha.compile.UsePackagePrimitive
public class UsePackagePrimitive
Adds new packages to use for a package.
(use-package packages-to-use &optional package)
packages-to-use may be either a list of packages or packages names, or package nicknames. It could also be be a single package or package name. A package name/nickname may be either a symbol or a string
package defaults to the current package if not specified. Otherwise it is the package or package name of the package that will use packages-to-use
use-package returns t
| Field Summary |
|---|
| Fields inherited from class org.jatha.compile.LispPrimitive |
|---|
functionName, functionNameSymbol, inlineP, maxNumberOfArgs, minNumberOfArgs |
| Fields inherited from class org.jatha.dynatype.StandardLispValue |
|---|
f_lisp |
| Constructor Summary | |
|---|---|
UsePackagePrimitive(Jatha lisp)
|
|
| Method Summary | |
|---|---|
LispValue |
CompileArgs(LispCompiler compiler,
SECDMachine machine,
LispValue args,
LispValue valueList,
LispValue code)
The CompileArgs method turns the arguments of the function call into SECD abstract machine code. |
void |
Execute(SECDMachine machine)
Execute performs the operation using the abstract machine registers. |
| Methods inherited from class org.jatha.compile.LispPrimitive |
|---|
basic_functionp, BuiltinFunctionCode, CompileArgs, grindef, indent, internal_prin1, internal_princ, internal_print, LispFunctionNameString, LispFunctionNameSymbol, parameterCountString, printCode, printCode, toString, validArgumentLength, validArgumentList |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UsePackagePrimitive(Jatha lisp)
| Method Detail |
|---|
public void Execute(SECDMachine machine)
LispPrimitiveLispValueFactory.
Example implementations:
FIRST
class FirstPrimitive extends LispPrimitive
{
public First()
{
super("FIRST", 1); // 1 argument
}
public void Execute(SECDMachine machine)
{
LispValue arg = machine.S.pop();
machine.S.push(my_first(arg));
machine.C.pop();
}
}
A multi-argument function must pop the arguments in reverse order.
public void Execute(SECDMachine machine)
{
LispValue arg2 = machine.S.pop();
LispValue arg1 = machine.S.pop();
machine.S.push(my_new_function(arg1, arg2));
machine.C.pop();
}
}
To register the new primitive, call:
Jatha.COMPILER.Register(new FirstPrimitive());
Execute in class LispPrimitivemachine - The abstract machine instance.LispCompiler
public LispValue CompileArgs(LispCompiler compiler,
SECDMachine machine,
LispValue args,
LispValue valueList,
LispValue code)
throws CompilerException
LispPrimitive
CompileArgs in class LispPrimitiveCompilerExceptionLispCompiler
|
Jatha Software | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||