Section 10.2.1, “Process Termination - anyos_find_process” |
Section 10.2.2, “Reassigning Strings - anyos_assign” |
The different versions of this function use either the Gamma function qnx_name_locate or the Gamma function access to check if either the qserve or nserve commands, identified by the name or command parameter, are running.
/*-------------------------------------------------------------------- * Function: anyos_find_process * 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_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_find_process * Application: common * Returns: t or nil * Description: Finds a process based on the name of a command, rather * than the name of a processes (as is done in QNX 4 and * Linux). The qnx_name_locate function is not available * in QNX 6 due to its unique kernel architecture. *------------------------------------------------------------------*/ function anyos_find_process(command, name) { if(access(string("/dev/", command), 0) == -1) nil; else t; }
The QNX versions of this function use the Gamma switch statement to select and reassign strings based on OS-specific needs. The function allows for generic PhabReadWidgetFile calls to Photon 1.14 widget files for QNX 4, or Photon 2 widget files for QNX 6, as well as a few other strings not held in common.
/*-------------------------------------------------------------------- * Function: anyos_assign * Returns: function * Description: Not currently used in Linux. Used in QNX 4 and QNX 6 * for making OS-dependent assignments. *------------------------------------------------------------------*/ function anyos_assign(str) { nil; }
/*-------------------------------------------------------------------- * 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: 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": "ph2controlwin/wgt/Ptcontrol.wgtw"; case "monitor_widgetfile": "ph2monitorwin/wgt/Ptmonitor.wgtw"; case "log_widgetfile": "ph2logwin/wgt/Ptlog.wgtw"; case "history_widgetfile": "ph2historywin/wgt/PtHist.wgtw"; case "deadband_widgetfile": "ph2historywin/wgt/DeadBandWindow.wgtw"; case "gamstring": "gamma"; case "graph_font": "TextFont07"; } }
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.