Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal
Class ICE

java.lang.Object
  extended by org.openquark.cal.ICE
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
IO_Source_Generator_ICE

public class ICE
extends Object
implements Runnable

Interactive CAL Environment - this is command line environment for executing CAL code.

Type a CAL expression on the command line and press 'Enter' to execute the expression.

ICE commands start with a ':'.

Some environment variables that affect the behaviour of ICE.
org.openquark.cal.show_adjunct
if this is defined the generated I/O code for the executing expression will be displayed.
org.openquark.cal.machine.lecc.source
If this is defined the lecc machine will generate Java source code, otherwise Java byte-code is directly generated.");
org.openquark.cal.machine.lecc.runtime_statistics
Defining this generates runtime statistics for the lecc machine. Reduction count, function count, etc.");
org.openquark.cal.machine.lecc.runtime_call_counts
Defining this generates runtime statistics for function call frequency.");
org.openquark.cal.machine.debug_capable
Defining this causes a trace statement to be put at the beginning of each generated function.\nIt also enabled the ability to set breakpoints on CAL functions.");
org.openquark.cal.machine.lecc.output_directory
The value of this variable determines the destination of generated source/byte code.");
org.openquark.cal.machine.lecc.code_generation_stats
Defining this displays information about generated code. e.g. # of optimized applications, # of switches, etc.");
org.openquark.cal.machine.g.runtime_statistics
Defining this generates runtime statistics for the g machine. Reduction count, function count, etc.");
org.openquark.cal.machine.g.call_counts
Defining this generates runtime statistics for function call frequency.");
org.openquark.cal.machine.lecc.static_runtime
if this is defined, the lecc runtime will generate bytecode statically to disk, and load runtime classes from disk.
if not defined, runtime classes will be generated and provided on demand.
org.openquark.cal.machine.lecc.non_interruptible
if this is defined, the lecc runtime will not check whether a quit has been requested.
org.openquark.cal.machine.lecc.strict_foreign_entity_loading
if this is defined, foreign entities corresponding to foreign types and foreign functions will be loaded eagerly during deserialization.
Creation: Aug 19, 2002 at 2:16:12 PM

Author:
rcypher

Nested Class Summary
protected static class ICE.CommandType
           
protected  class ICE.ICECommand
          This class encapsulates a command which can be executed from the ICE command line.
 
Field Summary
static String ICE_PROP_MODULE
           
static String ICE_PROP_WORKSPACE
          Setting this system property causes ICE to load its workspace from the file system path named by the value (does not search the class path)
static String ICE_PROP_WORKSPACE_FILENAME
          Setting this system property causes ICE to load its workspace from the file on the classpath named by the value (unqualified file name - searches within folders called "Workspace Declarations" on the class path)
 
Constructor Summary
ICE(String instanceName, String[] args, WorkspaceManager workspaceManager, InputStream inputStream, PrintStream outputStream, WorkspaceDeclaration.StreamProvider streamProvider)
          Create a new ICE object.
 
Method Summary
protected  void addCommand(ICE.ICECommand info)
           
static void appMain(String[] args, String fallbackWorkspaceDeclaration)
          Create a new ICE object and start its input loop.
static void appMain(String[] args, String fallbackWorkspaceDeclaration, String fallbackClientID, ModuleName fallbackTargetModule)
          Run ice, with fallback settings for the workspace declaration, client id, and target module.
protected  boolean command_runCode(String code)
          Run the given piece of code and print out performance stats.
protected  void command_setModule(String newTargetModuleString)
          Set the current working module.
protected  File findFile(File root, String name)
          Recursively search for the named file/directory under the given root.
protected  Logger getIceLogger()
           
protected  String getModulePath(ModuleName moduleName)
           
protected  ModuleName getTargetModule()
           
 WorkspaceManager getWorkspaceManager()
           
protected  void initializeCommands()
          Initialize the commands that can be executed in ICE.
 boolean isBusy()
           
static void main(String[] args)
          Create a new ICE object and start its input loop.
protected  EntryPoint makeRunTarget(String expressionText, boolean wrapExpression)
          Take the given code, make it into a super combinator and compile it into our program.
protected  String qualifyCodeExpression(String expressionText)
           
protected  ModuleName resolveModuleNameInProgram(String moduleName, boolean logWarningIfNotResolvable)
          Resolves the given module name in the context of the current program.
 void run()
          Loop to fetch user input and take appropriate action.
protected  boolean sourceChanged(String newSource, InputStream sourceInputStream)
          Determine whether the source code for a given file has changed in a meaningful way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICE_PROP_WORKSPACE_FILENAME

public static final String ICE_PROP_WORKSPACE_FILENAME
Setting this system property causes ICE to load its workspace from the file on the classpath named by the value (unqualified file name - searches within folders called "Workspace Declarations" on the class path)

See Also:
Constant Field Values

ICE_PROP_WORKSPACE

public static final String ICE_PROP_WORKSPACE
Setting this system property causes ICE to load its workspace from the file system path named by the value (does not search the class path)

See Also:
Constant Field Values

ICE_PROP_MODULE

public static final String ICE_PROP_MODULE
See Also:
Constant Field Values
Constructor Detail

ICE

public ICE(String instanceName,
           String[] args,
           WorkspaceManager workspaceManager,
           InputStream inputStream,
           PrintStream outputStream,
           WorkspaceDeclaration.StreamProvider streamProvider)
Create a new ICE object. Original Author: rcypher

Parameters:
instanceName -
args -
workspaceManager -
inputStream -
outputStream -
streamProvider -
Method Detail

getTargetModule

protected final ModuleName getTargetModule()

main

public static void main(String[] args)
Create a new ICE object and start its input loop.

Parameters:
args -

appMain

public static void appMain(String[] args,
                           String fallbackWorkspaceDeclaration)
Create a new ICE object and start its input loop.

Parameters:
args -
fallbackWorkspaceDeclaration -

appMain

public static void appMain(String[] args,
                           String fallbackWorkspaceDeclaration,
                           String fallbackClientID,
                           ModuleName fallbackTargetModule)
Run ice, with fallback settings for the workspace declaration, client id, and target module.

Parameters:
args - the command line arguments to pass to ICE.
fallbackWorkspaceDeclaration - the fallback workspace declaration, used if non-null and the system property is not set.
fallbackClientID - the fallback client id., used if non-null and the system property is not set.
fallbackTargetModule - the fallback target module, used if non-null and the system property is not set.

initializeCommands

protected void initializeCommands()
Initialize the commands that can be executed in ICE.


findFile

protected File findFile(File root,
                        String name)
Recursively search for the named file/directory under the given root.

Parameters:
root -
name -
Returns:
a File if a match is found, null otherwise.

sourceChanged

protected boolean sourceChanged(String newSource,
                                InputStream sourceInputStream)
Determine whether the source code for a given file has changed in a meaningful way.

Parameters:
newSource - the new source code for the give file.
sourceInputStream - the source file.
Returns:
boolean whether the source code has changed.

getModulePath

protected String getModulePath(ModuleName moduleName)
Parameters:
moduleName -
Returns:
that describes the location of the module. This will normally be an absolute path to the file in the filesystem.

addCommand

protected void addCommand(ICE.ICECommand info)

run

public void run()
Loop to fetch user input and take appropriate action.

Specified by:
run in interface Runnable

resolveModuleNameInProgram

protected ModuleName resolveModuleNameInProgram(String moduleName,
                                                boolean logWarningIfNotResolvable)
Resolves the given module name in the context of the current program. If the given name cannot be unambiguously resolved, null is returned.

Parameters:
moduleName - the module name to resolve.
logWarningIfNotResolvable - whether to log warnings if the name is not resolvable.
Returns:
the corresponding fully qualified module name, or null if the given name cannot be unambiguously resolved.

command_setModule

protected void command_setModule(String newTargetModuleString)
Set the current working module.

Parameters:
newTargetModuleString -

command_runCode

protected boolean command_runCode(String code)
Run the given piece of code and print out performance stats.

Parameters:
code - String The code to be run.
Returns:
true if execution was successful, false otherwise.

makeRunTarget

protected EntryPoint makeRunTarget(String expressionText,
                                   boolean wrapExpression)
Take the given code, make it into a super combinator and compile it into our program. Original Author: rcypher

Parameters:
expressionText - String A string containing the CAL expression to be run.
wrapExpression -
Returns:
the EntryPoint for the given expression

qualifyCodeExpression

protected String qualifyCodeExpression(String expressionText)

getWorkspaceManager

public WorkspaceManager getWorkspaceManager()

isBusy

public boolean isBusy()
Returns:
Returns the busy.

getIceLogger

protected Logger getIceLogger()
Returns:
the iceLogger

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.