QNX 4 or QNX 6 (in lib/qnx4.g, lib/qnx6.g)

Cogent Tools Demo and Tutorials: Version 4.0
Prev | Chapter 10. Abstracted Functions | Next

# 10.3. QNX 4 or QNX 6 (in `lib/qnx4.g`, `lib/qnx6.g`)

## 10.3.1. Loading Extra Libraries for QNX 4 - `anyver_loadlibs`, `gui_require`

The `anyver_load_libs` function is a wrapper for two function calls which are only necessary in QNX 4. The QNX 6 version of this function is merely a place-holder.

### 10.3.1.1. For QNX 4 (`lib/qnx4.g`)

       /*--------------------------------------------------------------------
        * Function:    anyver_loadlibs
        * Application: common
        * Returns:     t or nil
        * Description: Loads two libraries not generally needed for Photon
        *              widgets, but used by Cogent's CwGraph widget, which is
        *              in the History program.
        *------------------------------------------------------------------*/
       function anyver_loadlibs()
       {
         dyna_add_lib("/usr/cogent/lib/photon_s.dlb");
         dyna_add_lib("/usr/cogent/lib/phwidgets.dlb");
       }

### 10.3.1.2. For QNX 6 (`lib/qnx6.g`)

       /*--------------------------------------------------------------------
        * Function:    anyver_loadlibs
        * Application: common
        * Returns:     t or nil
        * Description: Not currently used in QNX 6.  A place-holder for
        *              functionality needed in QNX 4.
        *------------------------------------------------------------------*/
       function anyver_loadlibs()
       {
         nil;
       }

The `gui_require` function is called from within the `lib/qnx6.g` file, and thus does not need or have a QNX 4 counterpart. It checks the name of the Controller argument passed in the `system` command in the `demo.g` program, and loads the GTK or Photon libraries needed. If the Controller or any other program in the Demo is started independently in QNX 6, this function will ensure that the appropriate GUI libraries still get loaded.

       /*--------------------------------------------------------------------
        * Function:    gui_require
        * Application: common
        * Returns:     function
        * Description: Tests for GUI, and chooses GTK or Photon libraries.
        *------------------------------------------------------------------*/
       function gui_require()
       {
         local str_arg = string(car(argv));

         if (strstr(str_arg, "gtk") != -1)
           require("lib/gtk.g");
         else
           require("lib/photon.g");
       }

       gui_require();

Prev | Home | Next
Linux, QNX 4, or QNX 6 (in `lib/linux.g`, `lib/qnx4.g`, `lib/qnx6.g`) | Up | GTK or Photon (in `lib/gtk.g`, `lib/photon.g`)

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.