3.15. lib/qnx4.g - QNX 4 library

/*--------------------------------------------------------------------
 * File:        qnx4.g
 *
 * Description: Functions that run only in QNX 4.
 *
 * Functions:
 *                anyver_loadlibs
 *                anyos_find_process
 *                anyos_assign
 *                RtTrend.put_data
 *                anyver_num_callback
 *                anyver_numeric_assign
 *                anyver_change_settings
 *------------------------------------------------------------------*/

require("lib/photon.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");
}

/*--------------------------------------------------------------------
 * Function:    anyos_find_process
 * Application: common
 * Returns:     t or nil
 * Description: A wrapper for the qnx_name_locate() function used in
 *              anyos_start_qnserves().  Allows for alternate code in
 *              QNX 6.
 *------------------------------------------------------------------*/
function anyos_find_process(command, name)
{
  qnx_name_locate (0, name, 0);
}

/*--------------------------------------------------------------------
 * Function:    anyos_assign
 * Application: common
 * Returns:     a string
 * Description: Creates a way to reassign a single string to different
 *              strings, based on the OS.
 *------------------------------------------------------------------*/
function anyos_assign(str)
{
  switch(str)
    {
    case "control_widgetfile": "phcontrolwindow/wgt/Ptcontrol.wgtw";
    case "monitor_widgetfile": "phmonitorwin/wgt/Ptmonitor.wgtw";
    case "log_widgetfile": "phlogwin/wgt/Ptlog.wgtw";
    case "history_widgetfile": "phhistorywin/wgt/PtHist.wgtw";
    case "deadband_widgetfile": "phhistorywin/wgt/DeadBandWindow.wgtw";
    case "gamstring": "phgamma";
    case "graph_font": "helv10";
    }
}

/*--------------------------------------------------------------------
 * Function:    RtTrend.put_data
 * Application: Monitor
 * Returns:     method
 * Description: Standardizes the .rttrend_data() for RtTrend in Photon 1.14
 *              and .trend_data() for PtTrend in Photon 2 into one common
 *              method call.
 *------------------------------------------------------------------*/
method RtTrend.put_data(array)
{
  .rttrend_data = array;
}

/*--------------------------------------------------------------------
 * Function:    anyver_num_callback
 * Application: Monitor
 * Returns:     t or nil
 * Description: Allows for expanded functionality in QNX 6.
 *------------------------------------------------------------------*/
function anyver_num_callback(num, !pnt)
{
  PtAttachCallback(num, Pt_CB_NUMERIC_CHANGED,
                   `write_point(@pnt, ((@eval(num)).numeric_value)));
  pnt = eval(pnt);
  num.numeric_value = eval(pnt);
  add_exception_function(pnt, `(@num).numeric_value = eval(@pnt));
}

/*--------------------------------------------------------------------
 * Function:    anyver_numeric_assign
 * Application: Monitor
 * Returns:     t or nil
 * Description: Allows for expanded functionality in QNX 6.
 *------------------------------------------------------------------*/
function anyver_numeric_assign(num1, num2, num3, num4, num5)
{
  nil;
}

/*--------------------------------------------------------------------
 * Function:    anyver_change_settings
 * Application: Monitor
 * Returns:     t or nil
 * Description: Changes the settings on a group of PtNumeric widgets.
 *              For QNX 4, these are PtNumericInteger widgets, but for
 *              QNX 6, they are PtNumericFloat widgets.
 *------------------------------------------------------------------*/
function anyver_change_settings(n2, v2, n3, v3, n4, v4,
                                n5, v5, n6, v6)
{
  n2.numeric_value = v2;
  n3.numeric_value = v3;
  n4.numeric_value = v4;
  n5.numeric_value = v5;
  n6.numeric_value = v6;
}

princ("Version is QNX4.\n");