Compiling VIS and Creating a New Package
 

 



next up previous contents
Next: About this document Up: No Title Previous: Maintenance Utilities

Compiling VIS and Creating a New Package

 

Compiling VIS

Standard Makefiles are provided with each package within VIS. To compile

  1. a personal version of VIS using your modifed sources:

    To build a VIS executable that includes a package in your private area (e.g., one you checked out and modified), run gmake CC=gcc vis-g there. This will create an executable called vis-g by compiling your source files and linking them with the public libvis-g.a.

  2. a new public version of VIS in the central area:

    Check in any modified packages and rebuild the executable and libraries by running gmake CC=gcc vis-g in the
    /projects/vis/vis-devel/machine/src directory. (machine is mips, alpha, etc.) The executable will be placed in /projects/vis/vis-devel/machine/bin; the libraries in
    /projects/vis/vis-devel/machine/lib.

For portability and uniformity, please use the suggested compiler gcc.

Adding Code to VIS

To add code to the VIS system (that may or may not become part of the public system), use the tst package. This dummy package is known to the VIS system, yet is easily adapted to your purposes. If later your package is included in the public system, it can easily be adapted to become permanent.

The VIS system knows about two functions in the tst package:

  • Tst_Init. This is called when the VIS system starts, and should register your new commands by calling Cmd_CommandAdd.

  • Tst_End. This is called when the VIS system terminates, and should free any global memory allocated by your package.

For example, to add a command _testRng to VIS, use the following function

/**Function********************************************************************
  Synopsis    [Implements the _test_rng command.]
  SideEffects []
******************************************************************************/
static int
CommandTestRng(
  Hrc_Manager_t ** hmgr,
  int  argc,
  char ** argv)
{
  int c;
  int verbose = 0;              /* default value */
  
  /*
   * Parse command line options.
   */

  util_getopt_reset();
  while ((c = util_getopt(argc, argv, "v")) != EOF) {
    switch(c) {
        case 'v':
          verbose = 1;
          break;
        default:
          goto usage;
    }
  }


  if (verbose) {
    (void) fprintf(vis_stdout, "The _test_rng command does nothing\n");
  }

  /*
   * Normal exit
   */

  return 0;

usage:
  (void) fprintf(vis_stderr, "usage: _test_rng [-v]\n");
  (void) fprintf(vis_stderr, "    -v\t\tverbose\n");

  /*
   * Error exit
   */

  return 1;
}

and change Tst_Init and Tst_End (in tst.c) as follows

/**CFile***********************************************************************
  FileName    [tst.c]
  PackageName [tst]
  Synopsis    [Test package initialization, ending, and the command _test.]
  Author      [Originated from SIS.]
  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
  All rights reserved.
******************************************************************************/

#include "tstInt.h"

static char rcsid[] = "$Id: node7.html,v 1.1.1.1 2001/04/26 21:30:15 vis Exp $";
USE(rcsid);


/*---------------------------------------------------------------------------*/
/* Definition of exported functions                                          */
/*---------------------------------------------------------------------------*/

/**Function********************************************************************
  Synopsis    [Initializes the test package.]
  SideEffects []
  SeeAlso     [Tst_End]
******************************************************************************/
void
Tst_Init()
{

  /*
   * Add a command to the global command table.  By using the leading
   * underscore, the command will be listed under "help -a" but not "help".
   */

  Cmd_CommandAdd("_test_rng", CommandTestRng, /* doesn't changes_network */ 0);
}

/**Function********************************************************************
  Synopsis    [Ends the test package.]
  SideEffects []
  SeeAlso     [Tst_Init]
******************************************************************************/
void
Tst_End()
{
  /*
   * For example, free any global memory (if any) which the test package is
   * responsible for.
   */
}

Adding a New Package to VIS

To add a new package to VIS,

  1. Make sure your code compiles and runs within VIS, and that it conforms to the conventions in this document.

  2. Create a directory in /projects/vis/vis-devel/common/src named package (e.g., rng).

  3. Add your package to the list of packages (PKGS =) in
    /projects/vis/vis-devel/common/src/Makefile.

  4. Make a symbolic link in the /projects/vis/vis-devel/common/include directory that points to your package's external header file (e.g., ln -s ../src/rng/rng.h).

  5. Add a #include in /projects/vis/vis-devel/common/src/vm/vm.h for your package's external header file (e.g., #include "rng.h").

  6. Add calls to your package's Init and End functions in
    /projects/vis/vis-devel/common/src/vmVinit.c.

  7. Make symbolic links in /projects/vis/vis-devel/machine/src to the source files in your package. Copy the Makefile to these directories, since it will be regenerated to reflect architecture-specific dependencies.

VIS Engineering Manual
Quick Reference



next up previous contents
Next: About this document Up: No Title Previous: Maintenance Utilities



Tom Shiple
Fri May 10 17:19:47 PDT 1996
Contact 
©2002-2018 U.C. Regents