sisc.util
Class Util

java.lang.Object
  extended by sisc.util.Util
All Implemented Interfaces:
Version
Direct Known Subclasses:
AppContext, CompilerConstants, Context, DynamicEnvironment, Expression, FileManipulation, Interpreter, Library, LibraryManager, NativeModuleTemplate, OptionalPrimitives, Parser, PortValueWriter, Primitives, Primitives, ThreadContext, Threads

public abstract class Util
extends java.lang.Object
implements Version


Field Summary
static Symbol BACKQUOTE
           
static Symbol BEGIN
           
static java.util.WeakHashMap bundles
           
static boolean caseSensitive
           
static EmptyList EMPTYLIST
           
static SchemeVector EMPTYVEC
           
static EOFObject EOF
           
static Symbol ERRORK
           
static Symbol EVAL
           
static Symbol EXPSC
           
static Symbol EXPTOP
           
static SchemeBoolean FALSE
           
static Symbol FCONT
           
static Quantity FIVE
           
static Symbol JEXCEPTION
           
static Symbol LAMBDA
           
static Symbol LOCATION
           
static int maxFloatPrecision
           
static Symbol MESSAGE
           
static int minFloatPrecision
           
static Symbol NAME
           
static Symbol OTHER
           
static Symbol PARENT
           
static boolean permitInterrupts
           
static Syntax QUOTE
           
static Symbol QUOTESYM
           
static Symbol REPORT
           
static Symbol SETBANG
           
static Symbol SISC
           
static Symbol SISC_SPECIFIC
           
static Symbol SISCB
           
static Symbol SOURCE_COLUMN
           
static Symbol SOURCE_FILE
           
static Symbol SOURCE_LINE
           
static Symbol SYMENV
           
static Symbol THIS
           
static Symbol TOPLEVEL
           
static SchemeBoolean TRUE
           
static Symbol UNQUOTE
           
static Symbol UNQUOTE_SPLICING
           
static SchemeVoid VOID
           
static Value[] ZV
           
 
Fields inherited from interface sisc.util.Version
VERSION
 
Constructor Summary
Util()
           
 
Method Summary
static AnnotatedExpr annotated(Value o)
           
static Expression annotatedAppEval(java.lang.Class clazz, java.lang.String fn)
           
static Pair append(Pair p1, Pair p2)
           
static void argCheck(Pair argl, int arity)
           
static Symbol[] argsToSymbols(Pair p)
           
static Value assq(Value v, Pair p)
           
static SchemeBinaryInputPort bininport(Value o)
           
static java.io.InputStream bininstream(Value o)
           
static SchemeBinaryOutputPort binoutport(Value o)
           
static java.io.OutputStream binoutstream(Value o)
           
static Box box(Value o)
           
static char character(Value c)
           
static SchemeCharacterInputPort charinport(Value o)
           
static java.io.Reader charinreader(Value o)
           
static SchemeCharacterOutputPort charoutport(Value o)
           
static java.io.Writer charoutwriter(Value o)
           
static Charset charsetFromString(java.lang.String charsetName)
          Converts a character set name to a Charset.
static SchemeCharacter chr(Value o)
           
static CallFrame cont(Value o)
           
static java.lang.ClassLoader currentClassLoader()
           
static SymbolicEnvironment env(Value o)
           
static void error(Interpreter r, Pair error)
           
static void error(Interpreter r, java.lang.String errormessage)
           
static void error(Interpreter r, java.lang.String errormessage, Pair moreData)
           
static void error(Interpreter r, Value errormessage)
           
static void error(Interpreter r, Value where, java.lang.String errormessage)
           
static void error(Interpreter r, Value where, java.lang.String errormessage, java.lang.Exception e)
           
static void error(Interpreter r, Value where, java.lang.String errormessage, Pair moreData)
           
static Expression expr(Value o)
           
static Charset getDefaultCharacterSet()
          Return the default character set, which is UTF-8, but could in principle change.
static ImmutablePair immutablePair(Value o)
           
static ImmutableVector immutableVector(Value o)
           
static InputPort inport(Value o)
           
protected static java.lang.String javaExceptionToString(java.lang.Exception e)
           
static Value javaWrap(java.lang.Object o)
           
static java.lang.String justify(java.lang.String v, int p, char c)
           
static int length(Pair p)
           
static java.lang.String liMessage(Symbol bundleName, java.lang.String messageName)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.Object[] args)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.String arg1)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.String arg1, int arg2, int arg3)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.String arg1, java.lang.String arg2)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
           
static java.lang.String liMessage(Symbol bundle, java.lang.String messageName, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)
           
static Pair list(Value o1)
           
static Pair list(Value o1, Value o2)
           
static Pair list(Value o1, Value o2, Value o3)
           
static Pair list(Value o1, Value o2, Value o3, Value o4)
           
static Pair list(Value o1, Value o2, Value o3, Value o4, Value o5)
           
static java.net.URL makeURL(java.lang.String url)
           
static Pair mapcar(Pair list)
           
static Value memq(Value v, Pair p)
           
static NativeLibrary nlib(Value o)
           
static Quantity num(Value o)
           
static OutputPort outport(Value o)
           
static Pair pair(Value o)
           
static Expression[] pairToExpressions(Pair p)
           
static java.util.Vector pairToExpVect(Pair p)
          Deprecated. Obsoleted by pairToExpressions and pairToValues.
static Value[] pairToValues(Pair p)
           
static Procedure proc(Value o)
           
static Value read(java.lang.String expr)
           
static void registerBundle(Symbol bundleName)
           
static Pair reverse(Pair p)
           
static Pair reverseInPlace(Pair s)
           
static java.lang.String simpleErrorToString(Pair p)
           
static Pair sourceAnnotations(java.lang.String file, int line, int column, Pair anns)
           
static SchemeString str(Value o)
           
static java.lang.String string(Value o)
           
static Symbol sym(java.lang.String s)
           
static Symbol symbol(Value o)
           
static java.lang.String symval(Value o)
           
static Pair truePair(Value o)
           
static SchemeBoolean truth(boolean b)
           
static boolean truth(Value v)
           
static void typeError(java.lang.String type, Value o)
           
static void typeError(Symbol bundleName, java.lang.String type, Value o)
           
static void updateName(Value v, Symbol s)
           
static java.net.URL url(java.lang.String s)
           
static java.net.URL url(Value v)
           
static java.net.URL url(Value current, Value v)
           
static Pair valArrayToList(Value[] r)
           
static Pair valArrayToList(Value[] r, int offset, int len)
           
static SchemeVector valArrayToVec(Value[] r)
           
static SchemeVector vec(Value o)
           
static java.lang.String warn(java.lang.String messageClass)
           
static java.lang.String warn(java.lang.String messageClass, java.lang.String arg)
           
static java.lang.String warn(java.lang.String messageClass, java.lang.String sourceFile, int lineNumber, int columnNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caseSensitive

public static final boolean caseSensitive

permitInterrupts

public static final boolean permitInterrupts

minFloatPrecision

public static final int minFloatPrecision

maxFloatPrecision

public static final int maxFloatPrecision

ZV

public static final Value[] ZV

FIVE

public static final Quantity FIVE

EOF

public static EOFObject EOF

QUOTE

public static Syntax QUOTE

EMPTYLIST

public static EmptyList EMPTYLIST

VOID

public static SchemeVoid VOID

TRUE

public static SchemeBoolean TRUE

FALSE

public static SchemeBoolean FALSE

EMPTYVEC

public static SchemeVector EMPTYVEC

BEGIN

public static Symbol BEGIN

ERRORK

public static Symbol ERRORK

EXPSC

public static Symbol EXPSC

EXPTOP

public static Symbol EXPTOP

FCONT

public static Symbol FCONT

JEXCEPTION

public static Symbol JEXCEPTION

LAMBDA

public static Symbol LAMBDA

LOCATION

public static Symbol LOCATION

MESSAGE

public static Symbol MESSAGE

NAME

public static Symbol NAME

OTHER

public static Symbol OTHER

PARENT

public static Symbol PARENT

QUOTESYM

public static Symbol QUOTESYM

REPORT

public static Symbol REPORT

SETBANG

public static Symbol SETBANG

SISC

public static Symbol SISC

SISC_SPECIFIC

public static Symbol SISC_SPECIFIC

SYMENV

public static Symbol SYMENV

THIS

public static Symbol THIS

TOPLEVEL

public static Symbol TOPLEVEL

BACKQUOTE

public static Symbol BACKQUOTE

UNQUOTE

public static Symbol UNQUOTE

UNQUOTE_SPLICING

public static Symbol UNQUOTE_SPLICING

SOURCE_LINE

public static Symbol SOURCE_LINE

SOURCE_COLUMN

public static Symbol SOURCE_COLUMN

SOURCE_FILE

public static Symbol SOURCE_FILE

EVAL

public static Symbol EVAL

SISCB

public static Symbol SISCB

bundles

public static java.util.WeakHashMap bundles
Constructor Detail

Util

public Util()
Method Detail

warn

public static java.lang.String warn(java.lang.String messageClass)

warn

public static java.lang.String warn(java.lang.String messageClass,
                                    java.lang.String sourceFile,
                                    int lineNumber,
                                    int columnNumber)

warn

public static java.lang.String warn(java.lang.String messageClass,
                                    java.lang.String arg)

javaWrap

public static Value javaWrap(java.lang.Object o)

error

public static void error(Interpreter r,
                         Value where,
                         java.lang.String errormessage,
                         Pair moreData)
                  throws ContinuationException
Throws:
ContinuationException

error

public static void error(Interpreter r,
                         Value where,
                         java.lang.String errormessage,
                         java.lang.Exception e)
                  throws ContinuationException
Throws:
ContinuationException

error

public static void error(Interpreter r,
                         Value where,
                         java.lang.String errormessage)
                  throws ContinuationException
Throws:
ContinuationException

error

public static void error(Interpreter r,
                         java.lang.String errormessage,
                         Pair moreData)
                  throws ContinuationException
Throws:
ContinuationException

error

public static void error(Interpreter r,
                         java.lang.String errormessage)
                  throws ContinuationException
Throws:
ContinuationException

error

public static void error(Interpreter r,
                         Value errormessage)
                  throws ContinuationException
Throws:
ContinuationException

simpleErrorToString

public static java.lang.String simpleErrorToString(Pair p)

currentClassLoader

public static java.lang.ClassLoader currentClassLoader()

read

public static Value read(java.lang.String expr)
                  throws java.io.IOException
Throws:
java.io.IOException

error

public static void error(Interpreter r,
                         Pair error)
                  throws ContinuationException
Throws:
ContinuationException

justify

public static java.lang.String justify(java.lang.String v,
                                       int p,
                                       char c)

argCheck

public static final void argCheck(Pair argl,
                                  int arity)
                           throws java.lang.Exception
Throws:
java.lang.Exception

updateName

public static void updateName(Value v,
                              Symbol s)

length

public static int length(Pair p)

pairToExpVect

public static java.util.Vector pairToExpVect(Pair p)
Deprecated. Obsoleted by pairToExpressions and pairToValues.

Parameters:
p - the head of a list
Returns:
a Vector containing the same elements as the list

pairToExpressions

public static Expression[] pairToExpressions(Pair p)

pairToValues

public static Value[] pairToValues(Pair p)

argsToSymbols

public static Symbol[] argsToSymbols(Pair p)

typeError

public static void typeError(java.lang.String type,
                             Value o)

typeError

public static void typeError(Symbol bundleName,
                             java.lang.String type,
                             Value o)

sym

public static final Symbol sym(java.lang.String s)

symval

public static final java.lang.String symval(Value o)

num

public static final Quantity num(Value o)

pair

public static final Pair pair(Value o)

proc

public static final Procedure proc(Value o)

truePair

public static final Pair truePair(Value o)

character

public static final char character(Value c)

chr

public static final SchemeCharacter chr(Value o)

string

public static final java.lang.String string(Value o)

str

public static final SchemeString str(Value o)

symbol

public static final Symbol symbol(Value o)

vec

public static final SchemeVector vec(Value o)

outport

public static final OutputPort outport(Value o)

binoutport

public static final SchemeBinaryOutputPort binoutport(Value o)

binoutstream

public static final java.io.OutputStream binoutstream(Value o)

charoutport

public static final SchemeCharacterOutputPort charoutport(Value o)

charoutwriter

public static final java.io.Writer charoutwriter(Value o)

inport

public static final InputPort inport(Value o)

bininport

public static final SchemeBinaryInputPort bininport(Value o)

bininstream

public static final java.io.InputStream bininstream(Value o)

charinport

public static final SchemeCharacterInputPort charinport(Value o)

charinreader

public static final java.io.Reader charinreader(Value o)

env

public static final SymbolicEnvironment env(Value o)

box

public static final Box box(Value o)

cont

public static final CallFrame cont(Value o)

expr

public static final Expression expr(Value o)

annotated

public static final AnnotatedExpr annotated(Value o)

makeURL

public static java.net.URL makeURL(java.lang.String url)

url

public static java.net.URL url(Value v)

url

public static java.net.URL url(java.lang.String s)
                        throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

url

public static java.net.URL url(Value current,
                               Value v)

nlib

public static final NativeLibrary nlib(Value o)

immutablePair

public static final ImmutablePair immutablePair(Value o)

immutableVector

public static final ImmutableVector immutableVector(Value o)

truth

public static final SchemeBoolean truth(boolean b)

truth

public static final boolean truth(Value v)

assq

public static Value assq(Value v,
                         Pair p)

mapcar

public static Pair mapcar(Pair list)

reverse

public static Pair reverse(Pair p)

reverseInPlace

public static Pair reverseInPlace(Pair s)

append

public static Pair append(Pair p1,
                          Pair p2)

list

public static final Pair list(Value o1)

list

public static final Pair list(Value o1,
                              Value o2)

list

public static final Pair list(Value o1,
                              Value o2,
                              Value o3)

list

public static final Pair list(Value o1,
                              Value o2,
                              Value o3,
                              Value o4)

list

public static final Pair list(Value o1,
                              Value o2,
                              Value o3,
                              Value o4,
                              Value o5)

valArrayToList

public static final Pair valArrayToList(Value[] r,
                                        int offset,
                                        int len)

valArrayToList

public static final Pair valArrayToList(Value[] r)

valArrayToVec

public static final SchemeVector valArrayToVec(Value[] r)

memq

public static Value memq(Value v,
                         Pair p)

registerBundle

public static void registerBundle(Symbol bundleName)
                           throws java.util.MissingResourceException
Throws:
java.util.MissingResourceException

liMessage

public static java.lang.String liMessage(Symbol bundleName,
                                         java.lang.String messageName)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.String arg1)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.String arg1,
                                         java.lang.String arg2)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.String arg1,
                                         java.lang.String arg2,
                                         java.lang.String arg3)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.String arg1,
                                         java.lang.String arg2,
                                         java.lang.String arg3,
                                         java.lang.String arg4)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.String arg1,
                                         int arg2,
                                         int arg3)

liMessage

public static java.lang.String liMessage(Symbol bundle,
                                         java.lang.String messageName,
                                         java.lang.Object[] args)

javaExceptionToString

protected static java.lang.String javaExceptionToString(java.lang.Exception e)

sourceAnnotations

public static Pair sourceAnnotations(java.lang.String file,
                                     int line,
                                     int column,
                                     Pair anns)

annotatedAppEval

public static Expression annotatedAppEval(java.lang.Class clazz,
                                          java.lang.String fn)

getDefaultCharacterSet

public static Charset getDefaultCharacterSet()
Return the default character set, which is UTF-8, but could in principle change.

Returns:
a static Charset object

charsetFromString

public static Charset charsetFromString(java.lang.String charsetName)
Converts a character set name to a Charset. If the input name is null, then return the default Charset. If the input name does not correspond to a legal or supported character set, then return the default Charset and give a warning.

Parameters:
charsetName - the name of a putative character set, or null
Returns:
the Charset corresponding to the argument, or the default character set (see getDefaultCharacterSet()) if that is not possible