Smart CODE
Your on-line guide to the generated code

Before we begin

  1. Smart Code is very straightforward. As well as the interface code generated by X-Designer, and callback stubs, you can also choose to generate extra Smart Code for

  2. Tookit Independence
  3. Internet Thin-Client (Intranet) applications
  4. Accessing Internet resources
  5. Apart from a global header file, all the new code is generated into subdirectories. These directories are named according to their function and the language you chose. So, Motif specific code generated in c will be in the subdirectory motif_c, callouts (stubs that are intended for you to program) in java will be in callouts_java.

  6. For C and C++, all the new code is glued together through the Makefile. For java, the arrangement of packages is such that the command
    
    $ javac *.java
    
    
    will build everything (if you are using the right JDK and your CLASSPATH is set up properly.

    If you are generating code for the Java JDK 1.1, two shell scripts are generated:

  7. javac11.sh - which will set up your CLASSPATH before invoking javac
  8. java11.sh - which will set up your CLASSPATH before running the application
  9. For the 1.0 JDK, javac10.sh and java10.sh are generated.

  10. It helps to take Smart Code on a "need to know" basis.

  11. You need to know about the callouts_* directory. Code in here is in the form of stubs that you will fill out to make your application work.

  12. To familiarise yourself with the group data structures, we recommend the roadmap documentation generated at the same time as the code. This can be read in your web browser and is an annotated summary of what you need to know to program using the groups that you have created. The group code is in groups_* and the toolkit wrappers are in motif_* mfc_* or awt_* depending on what you are generating. You do not need to examine these directories. However, the toolkit wrapper directories are a rich source of code that shows how to program the individual controls using each toolkit API.

  13. If you are writing a thin-client application, you will need to know about files with the same name as your callbacks, in the server_* directory. All the files required to build a server need to be together so you can take the server and build it remotely. Thats why these files are not in the callouts_* area.

  14. You will find it very useful for Thin-Client and Internet programming, if you have a passing acquaintance with the Java URL and InputStream/OutputStream class APIs. Our C and C++ implementations of these APIs allow you to write your application code in the same style, whichever of the generation options you use. The code is in the http_* subdirectory along with the other internet connectivity code, but we recommend that you ignore this directory, and program from the documented APIs.

For both Thin-Client and Internet Smart Code

you can configure your internet connection at runtime with routines to use/change proxy settings, the URL itself and any extra data sent as part of the URL.

If you are using Get/Set Smart Code

you will write your code in the callouts_* directory. Callout files have the suffix _user. Thin-client and Internet stubs have the suffix _cs so if you switch style, your original _user files will not be touched, but will no longer be referenced in the Makefile.

If you are using Thin-Client Smart Code

You can just build the client application


$ make
without any coding, and write your application entirely in the server, built with the command


$ make server

You can check the user's data, and/or the data returning from the server, and abort the callback at either point.

You can control the data that is sent down to the server by making some (or all) interface elements in your group private and using extra data elements in the group to send (and receive) data in a different form if that is more appropriate for your server.

You can override the internal data handling code by defining Send and Receive handlers.

You can handle error conditions using the Out of Band Handler.

If you are using Internet Smart Code

You have to provide a Receive Handler to process the data.

You can process the incoming data as a stream, or you can use the Smart Code InputData to load the data automatically so you can acces it through getData() and getSize() methods.

If you want to POST data to a web server, you provide a Send handler.

If you want to process URLs in HTML, you don't need to parse the HTML yourself. Smart Code allows you to express an interest in particular features of the input stream (much like you set up callbacks on the interface), and then "pick out" these features as they arrive. You don't need to write or use a traditional parser to process HTML.