ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe
Class CopyLoaded

java.lang.Object
  extended byjavafe.Tool
      extended byjavafe.FrontEndTool
          extended byjavafe.CopyLoaded
All Implemented Interfaces:
Listener

public class CopyLoaded
extends FrontEndTool
implements Listener


Field Summary
 java.util.Vector argumentFileNames
           
private  java.io.PrintWriter libIndirectWriter
           
 java.util.Vector loaded
          * Keeping track of loaded CompilationUnits: * *
 java.util.Vector progIndirectFiles
           
private  java.io.PrintWriter progIndirectWriter
           
 
Fields inherited from class javafe.FrontEndTool
compositeClassPath, compositeSourcePath
 
Fields inherited from class javafe.Tool
badUsageExitCode, errorExitCode, okExitCode, options, outOfMemoryExitCode
 
Constructor Summary
CopyLoaded()
           
 
Method Summary
private  void copySourceFile(java.lang.String original, java.lang.String newName)
          Copy the source file original into the file newName.
 java.lang.String[] directoryPackage(java.lang.String dir)
           
 java.lang.String fileNameName(java.lang.String s)
           
 java.lang.String[] fileNamePackage(java.lang.String file)
           
private  java.lang.String[] fillArray(java.util.StringTokenizer st, int len)
           
 java.lang.String FQNname(java.lang.String s)
           
 java.lang.String[] FQNpackage(java.lang.String s)
           
 void frontEndToolProcessing(java.util.ArrayList args)
          Perform any front-end-tool-specific processing.
 void handleCU(CompilationUnit cu)
          Process each CU's type decls.
 void handleTD(TypeDecl td)
          Called from handleCU on each TypeDecl from the CU's loaded from the program files.
static void main(java.lang.String[] args)
          * Main processing code: * *
private  java.lang.String makeDirPath(java.lang.String[] P)
           
private  java.lang.String makeDirTree(java.lang.String root, java.lang.String[] P)
           
 Options makeOptions()
          Called to create a new Options object.
 java.lang.String name()
          Return the non-null name of this tool.
 void notify(CompilationUnit justLoaded)
          Each time a CompilationUnit is loaded by OutsideEnv, this routine in the current Listener (see OutsideEnv.setListener) is called with the newly-loaded CompilationUnit.
 CopyLoadedOptions options()
           
private  java.lang.String packageDirForFile(CompilationUnit cu)
           
 void printSpec(java.lang.String s)
          Prints the spec file for the FQN s.
private  boolean processTD(TypeDecl td)
          Typecheck a TypeDecl; return true if we had to abort.
 void setup()
           
 
Methods inherited from class javafe.FrontEndTool
clear, handleOptions, makePragmaParser, makePrettyPrint, makeStandardTypeReader, makeTypeCheck, processOptions, run, setupPaths
 
Methods inherited from class javafe.Tool
badOptionUsage, currentTime, spaceUsed, timeUsed, usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

libIndirectWriter

private java.io.PrintWriter libIndirectWriter

progIndirectWriter

private java.io.PrintWriter progIndirectWriter

progIndirectFiles

public final java.util.Vector progIndirectFiles

argumentFileNames

public final java.util.Vector argumentFileNames

loaded

public java.util.Vector loaded
* Keeping track of loaded CompilationUnits: * *

Constructor Detail

CopyLoaded

public CopyLoaded()
Method Detail

name

public java.lang.String name()
Description copied from class: Tool
Return the non-null name of this tool. E.g., "ls" or "cp". Used in usage and error messages.

Specified by:
name in class Tool

setup

public void setup()
Overrides:
setup in class FrontEndTool

packageDirForFile

private java.lang.String packageDirForFile(CompilationUnit cu)

notify

public void notify(CompilationUnit justLoaded)
Description copied from interface: Listener
Each time a CompilationUnit is loaded by OutsideEnv, this routine in the current Listener (see OutsideEnv.setListener) is called with the newly-loaded CompilationUnit.

The passed CompilationUnit will already have the sig fields of its direct TypeDecls adjusted. (See the class comments for OutsideEnv).

Specified by:
notify in interface Listener

main

public static void main(java.lang.String[] args)
* Main processing code: * *


makeOptions

public Options makeOptions()
Description copied from class: FrontEndTool
Called to create a new Options object.

Overrides:
makeOptions in class FrontEndTool

options

public CopyLoadedOptions options()

FQNpackage

public java.lang.String[] FQNpackage(java.lang.String s)

FQNname

public java.lang.String FQNname(java.lang.String s)

fileNamePackage

public java.lang.String[] fileNamePackage(java.lang.String file)

fileNameName

public java.lang.String fileNameName(java.lang.String s)

directoryPackage

public java.lang.String[] directoryPackage(java.lang.String dir)

fillArray

private java.lang.String[] fillArray(java.util.StringTokenizer st,
                                     int len)

makeDirTree

private java.lang.String makeDirTree(java.lang.String root,
                                     java.lang.String[] P)

makeDirPath

private java.lang.String makeDirPath(java.lang.String[] P)

printSpec

public void printSpec(java.lang.String s)
Prints the spec file for the FQN s. The file is written relative to the outDir.


frontEndToolProcessing

public final void frontEndToolProcessing(java.util.ArrayList args)
Description copied from class: FrontEndTool
Perform any front-end-tool-specific processing.

The remaining arguments are args[offset], args[offset+1], ...

Specified by:
frontEndToolProcessing in class FrontEndTool

copySourceFile

private void copySourceFile(java.lang.String original,
                            java.lang.String newName)
Copy the source file original into the file newName. newName is appended to the outDir to construct the full file location of the new file. This method also puts the newName into the correct indirection file.


handleCU

public void handleCU(CompilationUnit cu)
Process each CU's type decls.


handleTD

public void handleTD(TypeDecl td)
Called from handleCU on each TypeDecl from the CU's loaded from the program files. In addition, it calls itself recursively to handle types nested within outside types.


processTD

private boolean processTD(TypeDecl td)
Typecheck a TypeDecl; return true if we had to abort.

Precondition: td is not from a binary file.


ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage