home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************/
- /* */
- /* uio_cmds.c - User IO program template showing format of all */
- /* all commands from NeuralWorks. A User program */
- /* must provide all these functions */
- /* */
- /* Documentation: TR Young December 27, 1990 */
- /* Author: John C. Fairman August 31, 1990 */
- /* Copyright 1990 by NeuralWare Inc. */
- /* */
- /* $Author : $ */
- /* $Date : $ */
- /* $Source : $ */
- /* $Revision : $ */
- /* $Log : $ */
- /* */
- /*******************************************************************/
- /*
- *
- * Functions necessary for handling the User I/O package itself:
- *
- * UIO_Init()
- * UIO_Term()
- * UIO_Attention()
- *
- *
- * Functions necessary for handling a learning session:
- *
- * UIO_Learn_Start()
- * UIO_Learn_Input()
- * UIO_Learn_Output()
- * UIO_Learn_Result()
- * UIO_Learn_End()
- *
- *
- * Functions necessary for handling a recall or testing session:
- *
- * UIO_Recall_Start()
- * UIO_Read()
- * UIO_Write()
- * UIO_Write_Step()
- * UIO_Recall_Test()
- * UIO_Recall_End()
- *
- *
- * Other miscellaneous functions:
- *
- * UIO_Instrument()
- * UIO_Rewind()
- * UIO_Explain()
- *
- *
- * Note: All these functions must be defined to avoid link errors.
- * Fill in the ones you need for your UserIO program.
- */
-
- /******************************************************************
- * NOTE: Do not include <stdio.h>. This is dealt with in userutl.h
- * and related files. Some platforms, such as the Macintosh, redefine
- * the stdio functions.
- *
- */
-
- #define UIO_SERVER 1
- #define SERVER_EMULATOR_FILE 1
- #define SKIP_COMPAT_DATA 1
- #include "userutl.h"
- #include "uio_strc.h"
- #include "uio_tran.h"
- #include "uio_reqs.pro"
- #include "uio_cmds.pro"
-
- #ifdef MAC
- #include "macuio.redef"
- #endif
-
- /*******************************************************************/
- /* */
- /* Functions necessary for handling the User I/O package itself. */
- /* */
- /*******************************************************************/
-
- /* function: UIO_Init.c
- * Executed once by NWorks at the begining of User IO execution.
- * Used for function initialization, memory allocation, file openning.
- *
- * arguments: file = name of the User IO program being executed
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Init(file)
- TEXT *file;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /* function: UIO_Term()
- * Executed once by NWorks before loading another User IO program
- * or whenever deleting the network using either menu selections
- * or dialog boxes:
- *
- * IO...||Parameters||USRIO filename selection
- * File...||Open...||NWorks filename selection
- * File...||New
- * File...||Close
- * File...||Revert to Saved
- * File...||Quit
- *
- * Used to release all allocated memory, close any open files, etc.
- * to clean up after the User IO program execution
- *
- * arguments: process = integer number assigned to User IO task
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Term(process)
- NINT process;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
- /* function: UIO_Attention()
- * Executed once by NWorks at menu selection:
- *
- * I/O...||Attention I/O
- *
- * Used for function initialization,
- * keyboard input of learn/recall parameters, etc.
- *
- * Also used for the main body of a User Control program
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Attention()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /*******************************************************************/
- /* */
- /* Functions necessary for handling a learning session. */
- /* */
- /*******************************************************************/
-
- /* function: UIO_Learn_Start()
- * Executed by NWorks at the begining of learn exectution
- * from menu selections:
- * Run...||Learn...||For nn
- * Run...||Learn...||One Pass/All
- * Run...||Learn...||One
- * Run...||Learn...||Now
- * Run...||Learn...||Until
- *
- * Used for function initialization,
- * keyboard input of learn parameters, etc.
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Learn_Start()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /* function: UIO_Learn_Input.c
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- *
- * io lrnin
- *
- * is encountered.
- * Used for reading predictor variable (i.e. Input or X in Y=f(X))
- * information into network.
- *
- * arguments: LayN = index assigned to the layer that
- * will receive the input data;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the input data array
- *
- * Datap = pointer to array to be filled with input data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Learn_Input(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /* function: UIO_Learn_Output()
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- *
- * io lrnout
- *
- * is encountered.
- * Used for reading observed response variable
- * (i.e. desired Output or Y in Y=f(X))
- * information into network.
- *
- * arguments: LayN = index assigned to the layer that
- * will receive the input data;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the input data array
- *
- * Datap = pointer to array to be filled with input data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Learn_Output(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
-
- /* function: UIO_Learn_Result()
- * Executed by NWorks during learn execution given a
- * control strategy instruction:
- *
- * io lrnrslt
- *
- * is encountered.
- * Nworks returns predicted response (i.e. Result or
- * Y-hat in Y=f(X) where f is the estimated network)
- * information caluclated by network.
- *
- * arguments: LayN = index assigned to the layer that
- * returns the predicted response output;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the output data array
- *
- * Datap = pointer to array that contains output data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Learn_Result(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /* function: UIO_Learn_End()
- * Called by NWorks at the end of learn exectution.
- * Used for summary information of learn procedure.
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Learn_End()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /*******************************************************************/
- /* */
- /* Functions necessary for handling a recall or testing session. */
- /* */
- /*******************************************************************/
-
- /* function: UIO_Recall_Start()
- * Executed once by NWorks at the beginning of recall execution
- * from menu selections:
- *
- * Run...||Test...||For nn
- * Run...||Test...||One Pass/All
- * Run...||Test...||One
- * Run...||Recall...||For nn
- * Run...||Recall...||One Pass/All
- * Run...||Recall...||One
- * Run...||Recall...||Now
- *
- * Used for function initialization,
- * keyboard input of recall parameters, etc.
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
-
- NINT UIO_Recall_Start()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /* function: UIO_Read()
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- * read
- * is encountered.
- * Used for supplying predictor variable
- * (i.e. Input or X in Y=f(X))
- * information to NWorks network.
- *
- * arguments: LayN = index assigned to the layer that
- * will receive the input data;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the input data array
- *
- * Datap = pointer to array to be filled with input data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Read(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /* function: UIO_Write()
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- * rcltst
- * is encountered.
- * Nworks gives User IO predicted response
- * (i.e. Actual Output or Y-hat in Y=f(X) where
- * f is the NWorks estimated network)
- * information from the NWorks network.
- *
- * arguments: LayN = index assigned to the layer that
- * returns the predicted response output;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the output data array
- *
- * Datap = pointer to array that contains output data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Write(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /* function: UIO_Write_Step()
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- * wrstep
- * is encountered.
- * Nworks gives User IO predicted partial response
- * (i.e. Actual Output or Y-hat in Y=f_j(X) where
- * f_j is the j is the LayN-th layer of the NWorks
- * estimated network) at the specified layer using
- * information supplied to, and caluclated by, the network.
- *
- * arguments: LayN = index assigned to the layer that
- * returns the predicted partial response output;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the output data array
- *
- * Datap = pointer to array that contains output data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Write_Step(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /* function: UIO_Recall_Test()
- * Executed by NWorks during learn execution whenever a
- * control strategy instruction:
- * rcltst
- * is encountered.
- * Used for supplying observed response variable
- * (i.e. Test data or Desired Output or Y in Y=f(X))
- * information to NWorks network.
- *
- * arguments: LayN = index assigned to the layer that
- * will receive the input data;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the input data array
- *
- * Datap = pointer to array to be filled with input data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Recall_Test(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
- /* function: UIO_Recall_End()
- * Executed once by NWorks at the end of recall execution
- * from menu selection:
- *
- * Run...||Test...||For nn
- * Run...||Test...||One Pass/All
- * Run...||Test...||One
- * Run...||Recall...||For nn
- * Run...||Recall...||One Pass/All
- * Run...||Recall...||One
- * Run...||Recall...||Now
- *
- * Used for function initialization,
- * keyboard input of learn parameters, etc.
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Recall_End()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /*******************************************************************/
- /* */
- /* Other miscellaneous functions. */
- /* */
- /*******************************************************************/
-
- /* function: UIO_Instrument()
- * Executed by NWorks whenever an instrument generates
- * logging output that is sent to UIO
- * (User IO selected for logging in instrument edit dialog box)
- *
- * arguments: Instrument_id = integer assigned to instrument
- * that sent logging output
- * nDataElems = integer dimension of array
- * that holds logging output
- * DataElemp = floating pointer to array
- * that holds logging output
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Instrument(Instrument_id, nDataElems, DataElemp)
- NINT Instrument_id;
- NINT nDataElems;
- SREAL *DataElemp;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /* function: UIO_Rewind()
- * Executed once by NWorks from menu selections:
- *
- * I/O...||Rewind Input...||All
- * I/O...||Rewind Input...||Learn
- * I/O...||Rewind Input...||Rcl/Test
- * I/O...||Rewind Input...||Close File(s)
- *
- * Used for input file rewinding, closing files
- *
- * arguments: none
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Rewind()
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
- /**/
- /* function: UIO_Explain()
- * Executed by NWorks once for each PE in the Output Layer
- * during menu selections:
- *
- * Run...||Explain...||For nn
- * Run...||Explain...||One Pass/All
- * Run...||Explain...||One
- * Run...||Explain...||Now
- *
- * Allows input of information for the NWorks Explain feature.
- *
- * arguments: LayN = index assigned to the layer that
- * will receive the predicted response output;
- * index is assigned according to relative
- * (to other layers) screen position
- *
- * nPEs = dimension of the input data array, the number
- * of PE's in the input layer
- *
- * Datap = pointer to array that contains input data
- *
- * return: UIO_OK = 0, continue execution, do not update screen
- * UIO_UPDATE = 1, continue execution, do update screen
- * UIO_ERROR = -1, terminate execution, do update screen
- */
-
- NINT UIO_Explain(LayN, nPEs, Datap)
- NINT LayN;
- NINT nPEs;
- SREAL *Datap;
- {
- NINT ret_val = UIO_OK;
-
-
- /* USER TO PLACE CODE HERE */
-
- return(ret_val);
- }
-
-
-
-