IDL Java Code C++ Code

Wafer Graphics Server

The Wafer Graphics Server is at the heart of this demo and provides information to the user of the report generation GUI. It allows the user to see different statistical summaries of the selected lot and to assist in diagnosing process characteristics. It is implemented with the tools developed by Mark Hansen and David James

IDL for WaferGraphics Server

#include "Sequences.idl"

module WaferGraphicsServer {

interface WaferGraphicsServer {

   // This definition should be generalized by the ObjectDatabase
   // and extended here and in WaferDatabase to apply to wafers.

  exception NonExistentWaferException {
    string name;
  };


    // All of the methods below should throw an
    // exception NonExistentWaferException, but we only do this
    // for one method.


   // do the plotting functions need a `list' of attributes/args
   // to configure the plots.
  void plot(in string name, in string database) throws(NonExistentWaferException); 
  void pareto(in string name, in string database);
  void boxwafers(in string name, in string database);

  void histogram(in string name, in Sequences::DoubleSequence yields);
 };
};

C/C++ Implementation

The implementation of this object is relatively straightforward. We compile the IDL describing the Graphics server. Next we construct the C++ code which implements the server and its methods. We detail this in the next paragraphs. Finally, we write C code which is called from an S function and used to create the C++ server object and process requests. This routine blocks the calling function from returning until the Graphics Server is destroyed. This is done via the call to impl_is_ready() which is an infinite loop that processes method invocations from clients. An additional point to note is that the S evaluator is currently open and working in frame n when it invokes the .Call(). Implementing the methods as calls to eval() for the appropriate expression will yield sub-evaluations and assignments, etc. will not be performed at the usual level.

Note that this will all become simpler when we add our own S interface to and for servers. All of the code to handle remote invocations with S as a client and as a server will be generated dynamically either at run time or compiled for efficiency.

It would be better to implement this with S's user level threads. This would allow the server function and C routine to operate in their own thread and the S process to continue doing other things including terminate the server's thread. This is a necessary extension if we attempt to implement the Lot Selection Mechanism on the Graphics server. Also, it eradicates the problem of sub-evaluations since each method invocation for the server could be done as a top-level task in a 3rd thread (other than the primary one from which the server's thread was launched).

This routine must be externed so that S does not have to deal with mangled names used by C++. We use a new feature of S version 4 which allows us to deal with regular S objects at the C level and return them from a native routine. This same effect could be achieved with the .C interface in S and passing 3 strings to the C routine with slightly less flexibility. This is in the file start.cc.

s_object *
StartGraphicsServer(s_object *Sfunc, s_object *S_server, s_object *server_name)
{
 S_EVALUATOR 
 s_object *ans = NEW_LOGICAL(1);
 char *name = STRING_VALUE(server_name);
 char *funcName = STRING_VALUE(Sfunc);

 graphicsServer *server;
   server = new graphicsServer(name, funcName, S_evaluator);

     // Connect to the ORB.
     // This routine is available in the Utilities provided in the
     // SCorbaCommon chapter.

   CORBAORB_var orb = connectOrb();

     // Now connect to the BOA using the command line arguments
     // when S was invoked. We could pass in our own ones here
     // as arguments to the S function and initialize both the ORB
     // and BOA using them.
   extern CommandLineArgs CmdArgs;
   CORBABOA_var boa =  orb->BOA_init(CmdArgs.argc, CmdArgs.argv);

      // Announce that the server is ready
      // This will block indefinitely until
      // the server is deactivated via request from a client
      // or interrupted by a signal or some other mechanism.
   boa->obj_is_ready(server, CORBANil);
      // Announce that the server implementation is ready.
   boa->impl_is_ready( CORBANil);

   // return T if succesful.
   // Only get to this when the objects is deactivated.
  LOGICAL_POINTER(ans)[0] = TRUE;

return(ans);
}

The files graphicsServer.cc and graphicsServer.h define the C++ class implementing the GraphicsServer. The header file starts with details of handling different ORB implementation details. For the most part, we are simply including the CORBA header files and the skeleton header file generated by the IDL C++ compiler. Then we define the class with constructors and the methods declared in the IDL description of the GraphicsServer. Note that other (public) methods can be included in the class. In this way, the class can be used in other ways than the CORBA server specification without modification.

Two instance specific variables are used in the implementation. These are not visible to remote clients since they are not attributes in the IDL interface. Again, we have done very little to this point as all of the IDL method signatures we are obligated to implement could be pasted from the skeleton header file.

Next we turn our attention to implementing these methods at the C/C++ level. There are a variety of ways of doing this. Again, we use the S version 4 mechanism of constructing S objects at the C level.

The constructors set the protected fields which are the name of the S function to use for evaluate and the s_evaluator structure that identifies the particular S evaluator state used by this server.

In order to minimize the amount of code we duplicate, each of the IDL method implementations converts the arguments - lot and database names - into S objects and passes these to the specialized evaluate method generalEval() which The command

STRING_VECTOR(c_s_cpy(string,evaluator), evaluator)
is equivalent to the S expression c(string) and generates a character vector of length 1. We pass the number of arguments and the arguments themselves to generalEval and we are done. Note there is no return value. If there was, we would convert it to the appropriate CORBA type and return it in the usual manner. The ORB would take care of communicating it to the invoking client.

The histogram() method is very similar except it converts its arguments to a character vector of length 1 and a numeric vector with length equal to the length of the sequence passed to it in the yields argument. This is done using the support utility numericSequenceToSObject() routine which returns an S object. This is an element of a suite of routines used to convert IDL types to S objects that we will release with our S-CORBA interface.

We chose to use primitive IDL data types for this example to simplify matters. An example of how we might convert a more complicated remote object to an S object is provided in the file getWafer.cc and the routines SgetRemoteWafer() and getWaferObject(). Again, the remote object is handled as if it were local with private fields and we must rely on the public accessor methods to probe its data. These methods are described in the IDL file defining the Wafer interface. This will be automated for the most part in the S-CORBA interface since we can dynamically determine the structure of a remote object in terms of its attributes as specified in the IDL code. We will recursively construct these attributes as S objects with the recursion terminating in terms of the primitive objects supported by the suite of IDL-S object converters. Simple but highly effective, all due to the self-describing nature of the remote objects.

Finally, we look at generalEval. This is not very relevant from the CORBA point of view since at this point the remote data has been absorbed into S objects and what remains are the details of evaluating the appropriate S expression. The generalEval() method takes the name of the S function to invoke and a variable number of S objects to use as arguments in the call. It creates an S list containing the arguments and creates the expression

function name(list of s objects)
and evaluates it. We need only create wrapper S functions which call the appropriate S method with the individual arguments.

If this seems to involved, there are simpler ways. We can call the method directly without the need for the wrapper function. In this way, we need not create the list of S objects. In the near future, we will automate the entire procedure so that developers of S code can publish their methods at the S level without having to concern themselves with CORBA details.

In the future we can automate this procedure by "publishing" IDL code generated from an S class and list of methods. This can either be compiled to provide a C++ level interface which invokes the corresponding S level functions or dynamically determined via the CORBA Dynamic Skeleton Interface (DSI).

S Implementation

histogram

This is a simple wrapper to a call to hist().

Each of the methods below take a wafers object and plot it using methods from the S wafers library/chapter. The wrapper functions simply invoke these after retrieving the wafers object from the database and converting it to an S object.

plot

pareto

boxwafers

Lot Selection Mechanism & Events

The idea here is to display a composite wafer object for each of lot by aggregating the status values within a lot. Then we display all these in a second graphics window. This allows the

In order to do this, we either need to transfer each lot and compute the composite map locally or alternatively build a method to retrieve the composite map into the database. This is in the interest of efficiency in moving the data around.

Also, we need to have events supported in the ORB and a second thread in the S process listening to actions on the second graphics device. Similarly, the Report GUI needs to have a second thread listening for This is easy in Java, but the second thread in S requires the multi-threaded version with full thread-safe support for the graphics components. Other than this, we simply require the ability to broadcast on a CORBA Event Channel which we provide in the SCorbaCommon and supporting chapters.

This will be explained more fully in the future.

Files

graphicsServer.h
Definition of the server in keeping with the IDL.
graphicsServer.cc
Implementation of the server methods and constructors which concstruct S expressions and evaluate these.
start.cc
C routine which creates the graphics server as a C++ object and makes it available to the ORB.
S_src
S code providing function wrappers to the real plotting methods, S level function for getting a wafer from a remote database, etc.
SequenceUtils.h & SequenceUtils.cc
Prototypes and routines for utilities to convert between IDL/CORBA sequences and S objects. These will migrate to the Generic Data Types
WaferGraphicsServer.idl
IDL definition of the server.
getWafer.cc
C/C++ routines for obtaining a wafers object from a remote database as an S object.

Support Files generated from an S4 chapter initialization with modifications to include the CORBA configuration files, etc.
makefile
LIBRARY_FLAGS
S_LOCAL_FILES
S_MAKE_FLAGS

Duncan Temple Lang <duncan@research.bell-labs.com>
Last modified: Thu May 21 17:55:35 EDT 1998