home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e065 / 2.ddi / USERUTL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  7.0 KB  |  214 lines

  1. /* Dec 1990 (userutl.h)  Version 4.00 */
  2.  
  3. /************************************************************************
  4.  * Copyright(C) 1988-1990 NeuralWare Inc
  5.  * Penn Center West, IV-227, Pittsburgh, PA 15276 
  6.  *
  7.  * All rights reserved.  No part of this program may be reproduced,
  8.  * stored in a retrieval system, or transmitted, in any form or by any
  9.  * means, electronic, mechanical, photocopying, recording or otherwise
  10.  * without the prior written permission of the copyright owner, 
  11.  * NeuralWare, Inc.
  12.  ************************************************************************
  13.  */
  14.  
  15. #include "host.h"
  16.  
  17. #ifdef __ZTC__
  18. #ifndef DLC
  19. #define DLC 1
  20. #endif
  21. #endif
  22.  
  23. #ifdef THINK_C  /* No command line for Think C */
  24. #ifndef MAC
  25. #define MAC 1
  26. #endif
  27. #include <stdio.h>
  28. #endif
  29.  
  30. #ifdef MAC
  31. #undef  UNIX
  32. #endif
  33.  
  34. #ifdef DLC
  35. #undef  UNIX
  36. #endif
  37.  
  38. #ifdef XTM
  39. struct sem {
  40.   int semval;
  41. };
  42. struct sembuf{
  43.   int sem_num;
  44.   int sem_op;
  45.   int sem_flg;
  46. };
  47. #endif
  48.  
  49. #ifdef  UNIX
  50. #if defined(RS6) || defined(XTM)
  51.  
  52. #define    SEMTYPE    struct sem
  53.  
  54. #else
  55.  
  56. #if defined(EWS) || defined(VAXULT)
  57. typedef union {
  58.   int              val;
  59.   struct semid_ds *buf;
  60.   ushort          *array;
  61. } SEMTYPE;
  62.  
  63. #define semval  val   /* for "arg.val" */
  64.  
  65. #else
  66. #define    SEMTYPE    union semun
  67. #define semval  val   /* for "arg.val" */
  68. #endif
  69.  
  70. #endif
  71.  
  72. #endif  /* UNIX */
  73.  
  74. #if defined(THINK_C)
  75. #define NEW_LINE    ((int)'\r')
  76. #define NEW_LINE_STR  "\r"
  77. #else /* THINK_C */
  78. #define NEW_LINE    ((int)'\n')
  79. #define NEW_LINE_STR  "\n"
  80. #endif /* THINK_C */
  81.  
  82. /* Request codes for commands from NeuralWorks */
  83.  
  84. #define RQ_LEARNIN      1        /* training input */
  85. #define RQ_LEARNOUT     2        /* training desired output */
  86. #define RQ_LEARNRSLT    6        /* training result */
  87. #define RQ_READ         3        /* operational input */
  88. #define RQ_WRITE        4        /* operational output */
  89. #define RQ_WRSTEP      10        /* interim output (Hopfield/BAM) */
  90. #define RQ_LSTART       7        /* start learning */
  91. #define RQ_RSTART       8        /* start recall */
  92. #define RQ_LEND        14        /* end learning */
  93. #define RQ_REND        15        /* end recall */
  94. #define RQ_TERM         5        /* terminate */
  95. #define RQ_ATTENTION    9        /* unsolicited request for attention */
  96. #define RQ_REWIND      11        /* rewind input file */
  97. #define RQ_INSTRUM     13        /* output data from instrument */
  98. #define RQ_RCLTST      16        /* Recall Test */
  99. #define RQ_EXPLAIN     17        /* Explain output */
  100.  
  101. /* the following definitions are for requests to NeuralWorks */
  102.  
  103. #define UGX_DATA         0  /* responded to data */
  104. #define UGX_GETDS        1  /* get a string from dialog area */
  105. #define UGX_PUTDS        2  /* put a string to dialog area */
  106. #define UGX_SAVENET      3  /* save the network */
  107. #define UGX_GRPARM       4  /* get x-size, y-size, ncolors */
  108. #define UGX_CLEAR        5  /* clear a window's contents */
  109. #define UGX_DELETE       6  /* delete a window */
  110. #define UGX_WINDOW       7  /* set up a window */
  111. #define UGX_LINE         8  /* draw a line */
  112. #define UGX_POINT        9  /* draw a point */
  113. #define UGX_BOX         10  /* draw an outline box */
  114. #define UGX_BOXF        11  /* draw a filled box */
  115. #define UGX_PUTS        12  /* put a string in a window */
  116. #define UGX_MOUSE       13  /* read mouse position / buttons */
  117. #define UGX_RDPOINT     14  /* read a point */
  118. #define UGX_RDNETINF    15  /* read network info */
  119. #define UGX_GETINSTRT   16  /* Get instrument title */
  120.  
  121. /* the following are ONLY for requests from user control routines */
  122.  
  123. #define UGX_LOADNET     17  /* load a network */
  124. #define UGX_LEARN       18  /* learn */
  125. #define UGX_RECALL      19  /* recall */
  126. #define UGX_MSGIO       20  /* message I/O */
  127.  
  128. /* Additional features for accessing network data */
  129.  
  130. #define UGX_PEIO        25  /* PE read/write */
  131. #define UGX_SCHDIO      26  /* L/R Schedule R/W */
  132. #define UGX_CTRIO       27  /* Super-Layer Ctrs R/W */
  133.  
  134. /* The following codes are for faster graphics where fewer context 
  135.    switches are needed */
  136.  
  137. #define UGX_BLIT        21             /* blit an array to the screen*/
  138. #define UGX_PBLIT       24  /* blit a single-color pattern to scrn */
  139.  
  140. /* New features added for Pruning */
  141.  
  142. #define UGX_WTSTATS     22  /* weight statistics */
  143. #define UGX_PRUNE       23  /* prune network */
  144.  
  145. #ifndef NPHIST
  146. #define NPHIST  100   /* # of items in histogram */
  147. #endif
  148.  
  149. /* mouse button bit definitions for "ug_mouse" */
  150.  
  151. #define MBUT_RIGHT      0x04  /* right mouse button */
  152. #define MBUT_MIDDLE     0x02  /* middle mouse button */
  153. #define MBUT_LEFT       0x01  /* left mouse button */
  154.  
  155. /************************************************************************
  156.  *                  *
  157.  *    Graphics menu interface header file     *
  158.  *                  *
  159.  ************************************************************************
  160.    These structures and defines are included for convience as part of the
  161.    graphics interface used by several of the User I/O examples.  They are
  162.    not necessary to the operation of the program.
  163.  
  164.    The GMENU structure defines the basic parameters for a menu.  Menu
  165.    items (which go ACROSS the screen) are defined in an array of
  166.    GMENU_ITEM structures.
  167.  */
  168.  
  169. typedef struct {  /* Graphics menu item */
  170.         int      code;          /* menu item code */
  171.         char    *text;          /* line of text for menu item */
  172.         char    *text2;         /* auxillary line of text for menu item */
  173.         int      flag;
  174. #define GM_HILITE   0x0001      /* item highlighted */
  175. #define GM_LOCKED   0x0002      /* item locked */
  176.         int      x0,y0,x1,y1;   /* interior box (for highlighting) */
  177.         int      xt, yt;        /* x,y coords of text */
  178. } GMENU_ITEM;
  179.  
  180.  
  181. typedef struct {  /* Graphics menu - horizontal line of items */
  182.         GMENU_ITEM     *item;           /* pointer to array of items */
  183.         int             num_items;      /* number of menu items */
  184.         int             key;            /* window key */
  185.         int             flag;
  186. #define GM_AUX          0x0001          /* Set if auxillary line of text */
  187.         int             x0, y0;         /* BL of menu relative to window */
  188.         int             x1, y1;         /* TR of menu relative to BL */
  189. } GMENU;
  190.  
  191. #define GM_MARGIN 2   /* text margin in y direction  */
  192.  
  193.  
  194. extern int      gm_intcolor;    /* interior color */
  195. extern int      gm_outcolor;    /* outline color */
  196. extern int      gm_txtcolor;    /* text color */
  197.  
  198.  
  199. #ifdef PROTOTYPING
  200. /* --- prototypes --- */
  201. extern  InitGMenu(GMENU *,int,int );              /* Initialize a menu */
  202. extern  DispGMenu( GMENU * );                     /* Display menu */
  203. extern  DispGItem(GMENU *,GMENU_ITEM *,int,int ); /* Display menu item */
  204. extern  GMENU_ITEM *LookGMenu( GMENU *, int * );  /* Look at menu */
  205. #else
  206. extern  GMENU_ITEM *LookGMenu();                  /* look at menu */
  207. #endif
  208.  
  209. #ifndef UIO_STRC_H
  210. #include "uio_strc.h"
  211. #endif
  212.  
  213. #include "uio_reqs.pro"
  214.