|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.isi.stella.utilities.Utilities
public class Utilities
Constructor Summary | |
---|---|
Utilities()
|
Method Summary | |
---|---|
static boolean |
alreadyDocumentedObjectP(Stella_Object renamed_Object)
|
static java.lang.String |
buildFullUrlHierarchicalPart(java.lang.String path,
java.lang.String query,
java.lang.String fragment)
|
static void |
clearDocumentedObjectsRegistry()
|
static Cons |
computeMeasuresForInteger(int value)
|
static java.lang.String |
computeUnitsForInteger(int value,
boolean negateExponentP)
|
static java.lang.String |
decomposeInternetUrl(java.lang.String url,
java.lang.Object[] MV_returnarray)
Takes an internet style URL and returns the components of that URL as specified below. |
static DimNumber |
dmsToDegrees(Cons l)
Converts a (Degree Minute Second) to decimal degrees. |
static void |
generateManual(Cons manualSpec)
Generate a TEXINFO file containing a list of documented commands. |
static void |
generateManualFromTemplate(java.lang.String templatefile,
java.lang.String outputfile)
|
static java.lang.String |
getWebPage(java.lang.String host,
int port,
java.lang.String urlPath,
Dictionary returnHeaders)
Gets the webpage describe by path urlPath on host and port . |
static java.lang.String |
handleHttpHeaderFirstLine(java.lang.String line,
Dictionary fields,
java.lang.Object[] MV_returnarray)
Handles the first line of an http header. |
static void |
handleHttpHeaderOtherLine(java.lang.String line,
Dictionary fields)
Handles header lines other than the first one. |
static DimNumber |
hmsToHours(Cons l)
Converts a (Hour Minute Second) to decimal hours |
static void |
initializeUnitDefinitions()
Measure conversion factors. |
static int |
ipower(int x,
int exp)
|
static Stella_Object |
lookupObjectFromSpecification(Stella_Object specification)
|
static void |
manualDescribeObject(Stella_Object renamed_Object,
Stella_Object specification,
OutputStream stream)
|
static void |
manualDescribeUncategorizedObjects(Module module,
OutputStream stream)
|
static java.lang.String |
manualExpandTemplateCommands(java.lang.String line)
|
static InputStream |
openUrlStream(java.lang.String url)
Opens an input stream to url . |
static java.lang.String |
postData(java.lang.String host,
int port,
java.lang.String urlPath,
Dictionary headers,
java.lang.String content)
Posts content as data to urlPath on host and port . |
static int |
readHttpHeader(InputStream stream,
Dictionary fields,
java.lang.Object[] MV_returnarray)
Reads the HTTP header from stream , parses the header fields
and stores the results in fields . |
static void |
registerDocumentedObject(Stella_Object renamed_Object)
|
static void |
resetMeasures()
|
static void |
showMeasure(java.lang.String measureName)
Print all units and scale factors for measure measureName . |
static void |
showMeasureEvaluatorWrapper(Cons arguments)
|
static void |
showMeasures()
Print all defined measures. |
static void |
texinfoDescribeClass(Stella_Class renamed_Class,
OutputStream stream)
|
static void |
texinfoDescribeDocumentationString(Stella_Object renamed_Object,
java.lang.String documentation,
OutputStream stream,
List parameters)
|
static void |
texinfoDescribeMethod(MethodSlot method,
OutputStream stream)
|
static void |
texinfoDescribeSlot(StorageSlot slot,
OutputStream stream)
|
static void |
texinfoDescribeTypeDeclaration(java.lang.String parameter,
StandardObject type,
java.lang.String modifier,
OutputStream stream)
|
static void |
texinfoDescribeUnimplementedObject(Stella_Object specification,
OutputStream stream)
|
static void |
texinfoDescribeVariable(GlobalVariable variable,
OutputStream stream)
|
static java.lang.String |
texinfoEscapeString(java.lang.String string)
|
static java.lang.String |
texinfoGetParagraphCommand(java.lang.String string,
int start)
|
static List |
texinfoGetRealMethodParameterNames(MethodSlot method)
|
static List |
texinfoGetRealMethodParametersAndTypes(MethodSlot method,
java.lang.Object[] MV_returnarray)
|
static void |
texinfoInsertDoc(Stella_Object spec)
|
static void |
texinfoInsertPreamble()
|
static boolean |
texinfoObjectL(Stella_Object object1,
Stella_Object object2)
|
static boolean |
texinfoSpecialCharacterP(char ch)
|
static DimNumber |
timeDurationToDim(TimeDuration duration)
Converts the time duration duration to its
equivalent value as dimensioned number. |
static double |
unitToScaleFactorAndId(java.lang.String definition,
java.lang.Object[] MV_returnarray)
|
static java.lang.String |
urlPathToFilename(java.lang.String path)
|
static Stella_Object |
withInputUrl(Cons binding,
Cons body)
Sets up an unwind-protected form which opens a URL for input and closes it afterwards. |
static void |
writeHttpRequest(OutputStream stream,
java.lang.String method,
java.lang.String host,
java.lang.String urlPath,
Dictionary headers,
java.lang.String content)
Send content as an HTTP 1.0 request on stream using method . |
static void |
writePostRequest(OutputStream stream,
java.lang.String host,
java.lang.String urlPath,
Dictionary headers,
java.lang.String content)
|
static java.lang.String |
yieldTexinfoBareName(Stella_Object name)
|
static java.lang.String |
yieldTexinfoConstant(Symbol name)
|
static java.lang.String |
yieldTexinfoParameterName(java.lang.String name)
|
static java.lang.String |
yieldTexinfoTypeSpec(Stella_Object typeSpec)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static List $TEXINFO_STYLE_FEATURES$
public static Surrogate SGT_STELLA_CONS
public static Surrogate SGT_STELLA_TYPE_SPEC
public static java.lang.String $TEXINFO_WORD_DELIMITERS$
public static Symbol SYM_STELLA_VARIABLE_TYPE_SPECIFIER
public static Symbol SYM_STELLA_DOCUMENTATION
public static Symbol SYM_STELLA_SLOT_TYPE_SPECIFIER
public static Symbol SYM_STELLA_aREST
public static Symbol SYM_STELLA_aBODY
public static Symbol SYM_STELLA_METHOD_MACROp
public static Symbol SYM_STELLA_METHOD_COMMANDp
public static Symbol SYM_STELLA_METHOD_VARIABLE_ARGUMENTSp
public static Symbol SYM_STELLA_METHOD_BODY_ARGUMENTp
public static Keyword KWD_INFIX_PARAMETER_LISTS
public static final StellaSpecialVariable $MANUAL_OUTPUT_LANGUAGE$
public static Keyword KWD_TEXINFO
public static HashTable $DOCUMENTED_OBJECTS_REGISTRY$
public static Surrogate SGT_STELLA_SLOT
public static Surrogate SGT_STELLA_GLOBAL_VARIABLE
public static Surrogate SGT_STELLA_MODULE
public static Symbol SYM_UTILITIES_MANUAL_DESCRIBE_OBJECT
public static final StellaSpecialVariable $MANUAL_OUTPUT_STREAM$
public static java.lang.String $MANUAL_TEMPLATE_COMMAND_PREFIX$
public static Symbol SYM_UTILITIES_STARTUP_MANUALS
public static Symbol SYM_STELLA_METHOD_STARTUP_CLASSNAME
public static Cons $ALL_MEASURES$
public static Cons $BASE_MEASURES$
public static Ratio $RATIO_ONE$
public static Surrogate SGT_UTILITIES_RATIO
public static Symbol SYM_UTILITIES_NUMERATOR
public static Symbol SYM_UTILITIES_DENOMINATOR
public static Cons $UNIT_TOKENIZER_TABLE_DEFINITION$
public static Keyword KWD_START
public static Symbol SYM_STELLA_$
public static Keyword KWD_INTEGER
public static Keyword KWD_DELIMITER
public static Keyword KWD_FRACTION
public static Keyword KWD_UNIT
public static Keyword KWD_EOF
public static Keyword KWD_OTHERWISE
public static Keyword KWD_ERROR
public static Keyword KWD_INCLUDE
public static TokenizerTable $UNIT_TOKENIZER_TABLE$
public static Surrogate SGT_UTILITIES_MEASURE
public static Symbol SYM_UTILITIES_BASE_UNIT
public static Symbol SYM_UTILITIES_SCALE
public static Symbol SYM_UTILITIES_PRIME_ID
public static Symbol SYM_STELLA_NAME
public static Keyword KWD_PRESERVE
public static Surrogate SGT_UTILITIES_DIM_NUMBER
public static Symbol SYM_UTILITIES_PID
public static Symbol SYM_UTILITIES_MAGNITUDE
public static Symbol SYM_UTILITIES_PREFERRED_UNITS
public static Keyword KWD_DIGIT
public static Surrogate SGT_STELLA_TIME_DURATION
public static Symbol SYM_UTILITIES_STARTUP_UNITS
public static Symbol SYM_UTILITIES_STARTUP_UNIT_DEFS
public static Keyword KWD_MAC
public static Symbol SYM_STELLA_LET
public static Symbol SYM_STELLA_INPUT_STREAM
public static Symbol SYM_STELLA_NULL
public static Symbol SYM_STELLA_UNWIND_PROTECT
public static Symbol SYM_STELLA_PROGN
public static Symbol SYM_STELLA_SETQ
public static Symbol SYM_UTILITIES_OPEN_URL_STREAM
public static Symbol SYM_STELLA_WHEN
public static Symbol SYM_STELLA_DEFINEDp
public static Symbol SYM_STELLA_FREE
public static Symbol SYM_UTILITIES_STARTUP_HTTP
public static Symbol SYM_UTILITIES_STARTUP_UTILITIES_SYSTEM
Constructor Detail |
---|
public Utilities()
Method Detail |
---|
public static boolean texinfoSpecialCharacterP(char ch)
public static java.lang.String texinfoEscapeString(java.lang.String string)
public static java.lang.String yieldTexinfoTypeSpec(Stella_Object typeSpec)
public static java.lang.String yieldTexinfoBareName(Stella_Object name)
public static java.lang.String yieldTexinfoParameterName(java.lang.String name)
public static java.lang.String yieldTexinfoConstant(Symbol name)
public static java.lang.String texinfoGetParagraphCommand(java.lang.String string, int start)
public static void texinfoDescribeDocumentationString(Stella_Object renamed_Object, java.lang.String documentation, OutputStream stream, List parameters)
public static void texinfoDescribeVariable(GlobalVariable variable, OutputStream stream)
public static void texinfoDescribeClass(Stella_Class renamed_Class, OutputStream stream)
public static void texinfoDescribeSlot(StorageSlot slot, OutputStream stream)
public static List texinfoGetRealMethodParameterNames(MethodSlot method)
public static List texinfoGetRealMethodParametersAndTypes(MethodSlot method, java.lang.Object[] MV_returnarray)
public static void texinfoDescribeMethod(MethodSlot method, OutputStream stream)
public static void texinfoDescribeTypeDeclaration(java.lang.String parameter, StandardObject type, java.lang.String modifier, OutputStream stream)
public static void texinfoDescribeUnimplementedObject(Stella_Object specification, OutputStream stream)
public static void registerDocumentedObject(Stella_Object renamed_Object)
public static boolean alreadyDocumentedObjectP(Stella_Object renamed_Object)
public static void clearDocumentedObjectsRegistry()
public static Stella_Object lookupObjectFromSpecification(Stella_Object specification)
public static boolean texinfoObjectL(Stella_Object object1, Stella_Object object2)
public static void manualDescribeUncategorizedObjects(Module module, OutputStream stream)
public static void manualDescribeObject(Stella_Object renamed_Object, Stella_Object specification, OutputStream stream)
public static void generateManual(Cons manualSpec)
(<filename> <object-spec1> <object-spec2> ... <object-specN>)
The objects specified by <object-spec>s will be documented in sequence onto file <filename>. An object spec can be a simple symbol to name a function, macro or variable, a dotted symbol to name a method or slot, a surrogate to name a class, or a string (pathname) to name a module. If a module is specified, all as yet undocumented objects in that module that have a documentation string defined will be documented (this is a catch-all option).
manualSpec
- public static void generateManualFromTemplate(java.lang.String templatefile, java.lang.String outputfile)
public static java.lang.String manualExpandTemplateCommands(java.lang.String line)
public static void texinfoInsertDoc(Stella_Object spec)
public static void texinfoInsertPreamble()
public static int ipower(int x, int exp)
public static void resetMeasures()
public static double unitToScaleFactorAndId(java.lang.String definition, java.lang.Object[] MV_returnarray)
public static Cons computeMeasuresForInteger(int value)
public static java.lang.String computeUnitsForInteger(int value, boolean negateExponentP)
public static DimNumber timeDurationToDim(TimeDuration duration)
duration
to its
equivalent value as dimensioned number. The default time unit
will be used.
duration
-
public static DimNumber dmsToDegrees(Cons l)
l
-
public static DimNumber hmsToHours(Cons l)
l
-
public static void showMeasures()
public static void showMeasure(java.lang.String measureName)
measureName
.
measureName
- public static void showMeasureEvaluatorWrapper(Cons arguments)
public static void initializeUnitDefinitions()
Sources: [NIST] Guide for the Use of the International System of Units (SI) U.S. Department of Commerce National Institute of Standards and Technology (NIST) NIST Special Publication 811, 1995 Edition http://physics.nist.gov/Document/sp811.pdf
[MfM] Richard A. Young and Thomas J. Glover Measure for Measure 1996. ISBN 1-889796-00-X (Blue Willow, Inc.; Littleton, Colorado, USA) http://www.bluewillow.com/
public static java.lang.String handleHttpHeaderFirstLine(java.lang.String line, Dictionary fields, java.lang.Object[] MV_returnarray)
fields
fields with the empty string key ""
This is a low-level utility routine that can be used to build custom
message parsing code.
line
- fields
- MV_returnarray
-
public static void handleHttpHeaderOtherLine(java.lang.String line, Dictionary fields)
fields
as keyword value pairs.
This is a low-level utility routine that can be used to build custom
message parsing code.
line
- fields
- public static java.lang.String decomposeInternetUrl(java.lang.String url, java.lang.Object[] MV_returnarray)
o Protocol. The access protocol.
Those schemes which refer to internet protocols mostly have a common syntax for the rest of the object name. This starts with a double slash '//' to indicate its presence, and continues until the following slash '/':
o An optional user name, if required (as it is with a few FTP servers). The password, if present, follows the user name, separated from it by a colon; the user name and optional password are followed by a commercial at sign '@'. o The internet domain name of the host o The port number, if it is not the default number for the protocol, is given in decimal notation after a colon. o Path The path is a hierarchical representation of a particular path. It may define details of how the client should communicate with the server, including information to be passed transparently to the server without any processing by the client. The path is interpreted in a manner dependent on the scheme being used. Generally, the reserved slash '/' character (ASCII 2F hex) denotes a level in a hierarchical structure, the higher level part to the left of the slash. o Query is the part of the hierarchical information following a '?' character. o Fragment is the part of the hierarchical information following a '#' character.
References: http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
url
- MV_returnarray
-
public static int readHttpHeader(InputStream stream, Dictionary fields, java.lang.Object[] MV_returnarray)
stream
, parses the header fields
and stores the results in fields
. The first line of the response will be
stored in fields
with the empty string "" as the key. Other values will
have the header name as the key. The first return value is the response code
of the HTTP request. A response of 200 indicates success. Other common
responses are 404 (page not found). The second return value is the message
associated with the code. The third return value is the version information.
If the stream ends before a valid header is read, then null
is returned for
all values.
stream
- fields
- MV_returnarray
-
public static void writeHttpRequest(OutputStream stream, java.lang.String method, java.lang.String host, java.lang.String urlPath, Dictionary headers, java.lang.String content)
content
as an HTTP 1.0 request on stream
using method
.
The request is sent to urlPath
at host
. The stream
must be a TCP-stream
that is connected to host
at the appropriate port.
stream
- method
- host
- urlPath
- headers
- content
- public static void writePostRequest(OutputStream stream, java.lang.String host, java.lang.String urlPath, Dictionary headers, java.lang.String content)
public static java.lang.String postData(java.lang.String host, int port, java.lang.String urlPath, Dictionary headers, java.lang.String content)
content
as data to urlPath
on host
and port
.
The port value for standard http servers is 80. Returns the body of the
reply message as a string, if successful. Otherwise an HTTP-EXCEPTION is
signaled.
host
- port
- urlPath
- headers
- content
-
public static java.lang.String getWebPage(java.lang.String host, int port, java.lang.String urlPath, Dictionary returnHeaders)
urlPath
on host
and port
.
The port value for standard http servers is 80. If successful,
returns the body of the web message as a string. The headers
from the reply message will be set in returnHeaders
if not
null
. If an error occurs an HTTP-EXCEPTION is signaled.
host
- port
- urlPath
- returnHeaders
-
public static java.lang.String buildFullUrlHierarchicalPart(java.lang.String path, java.lang.String query, java.lang.String fragment)
public static java.lang.String urlPathToFilename(java.lang.String path)
public static InputStream openUrlStream(java.lang.String url)
url
.
Currently only http: with no user name or password and file: urls on the local
host with absolute pathnames are supported.
url
-
public static Stella_Object withInputUrl(Cons binding, Cons body)
_WITH_INPUT_URL__var_url__bodyI_
.
binding
- body
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |