home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / net_analyzer.ph < prev    next >
Encoding:
Text File  |  1994-04-25  |  5.8 KB  |  213 lines

  1. /*****************************************************************************
  2.   FILE           : net_analyzer.ph
  3.   SHORTNAME      : net_analyzer.ph
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : private header file for corresponding '.c' file
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Tobias Soyez
  10.   DATE           : 09.11.1993
  11.  
  12.   CHANGED BY     : 
  13.   IDENTIFICATION : @(#)net_analyzer.ph    1.2 3/2/94
  14.   SCCS VERSION   : 1.2
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20.  
  21.  
  22. #ifndef _NET_ANALYZER_DEFINED_
  23. #define _NET_ANALYZER_DEFINED_
  24.  
  25.  
  26. #define NA_GRAPH_XY       1
  27. #define NA_GRAPH_TY       2
  28. #define NA_GRAPH_TE       3
  29.  
  30. #define NA_ERROR_LIN      1
  31. #define NA_ERROR_SQR      2
  32. #define NA_ERROR_SU       3
  33.  
  34. #define NA_DRAW_WINDOW    1
  35. #define NA_DRAW_PIXMAP    2
  36.  
  37. #define INFO_BORDER      25
  38. #define MAX_ARRAY_SIZE 5000
  39.  
  40.  
  41. typedef struct
  42. {
  43.   unsigned int x, y, w, h ;
  44. } Rectangle ;
  45.  
  46.  
  47. typedef struct
  48. {
  49.   bool  on, line, grid, record ;
  50. } Toggles ;
  51.  
  52.  
  53. typedef struct
  54. {
  55.   float  min, max, factor ;
  56.   int    unit_no, grid ;
  57.   bool   out ;
  58. } AxisAttributes ;
  59.  
  60.  
  61. typedef struct
  62. {
  63.   int  time, i ;
  64.   bool no_data ;
  65.   bool wrapped ;
  66.   float x[MAX_ARRAY_SIZE],
  67.         y[MAX_ARRAY_SIZE] ;
  68.   bool  lineflag[MAX_ARRAY_SIZE] ;
  69. } GraphData ;
  70.  
  71.  
  72. typedef struct 
  73. {
  74.   int             graphtype ;
  75.   AxisAttributes  hor     ; 
  76.   AxisAttributes  ver     ;
  77.   int             error   ;
  78.   int             error_unit ;
  79.   Bool            ave     ;
  80.   int             period  ;
  81.   int             m_test  ;
  82.   char            rec_filename[80] ;
  83.   FILE           *rec_file       ;
  84.  
  85.   Rectangle       window, pixmap, graph ;
  86.   Toggles         toggles ;
  87.   GraphData       gd ;
  88. } NaStateType ;
  89.  
  90.  
  91.  
  92. static NaStateType  na, se ;
  93. static int          na_Open      =    0 ;
  94. static bool         na_FirstCall = TRUE ;
  95.  
  96. static Pixmap       na_Pixmap       ;
  97. static Display     *na_Display      ;
  98. static XFontStruct *na_FontStruct   ;
  99. static Window       na_Window       ;
  100. static GC           na_GC           ;
  101. static int          na_Screen       ;
  102. static short        na_Depth        ;
  103. static char         info_line[1024] ;
  104. static Dimension    na_Width, na_Height ;
  105.  
  106. static Widget NA_CreateButtonItem (char   *name, Widget parent, 
  107.                                    Widget  left, Widget top   ) ;
  108. static Widget NA_CreateToggleItem (char   *name,  Widget parent,
  109.                                    Widget  group, Widget left, Widget top) ;
  110.  
  111.  
  112. /* ---------  network analyzer  ------------ */
  113.  
  114. static Widget w_NetworkAnalyzer, w_Window, w_Screen, w_Buttons ;
  115. static Widget b_Clear, b_Setup, b_Done, t_MTest ;
  116. static Widget t_On, t_Line, t_Grid, t_Record, b_DCtrl ;
  117.  
  118. static int          no_of_m_test ;
  119. static XtWorkProcId NA_WorkProcId ;
  120.  
  121. static float NA_Error (void) ;
  122.  
  123. static void NA_OpenRecordFile    (void) ;
  124. static void NA_CloseRecordFile   (void) ;
  125. static void NA_WriteToRecordFile (char *str) ; 
  126.  
  127. static void NA_DrawCS        (void) ;
  128. static void NA_DrawInfo      (void) ;
  129. static void NA_DrawPoint     (int i2, int mode) ;
  130. static void NA_DrawGraph     (void) ;
  131. static void NA_DrawGrid      (void) ;
  132. static void NA_ClearGraph    (void) ;
  133. static void NA_RedrawPixmap  (void) ;
  134. static void NA_ShowPixmap    (void) ;
  135. static void NA_ResizeWindow  (void) ;
  136. static void NA_EventProc     (Widget w, Display *display, XEvent *event) ;
  137. static void NA_CallbackProc  (Widget w, XtPointer client_data,
  138.                                         XtPointer call_data) ;
  139.  
  140. static void NA_CreateNetworkAnalyzerWidget (void) ;
  141. static void NA_ResetNetworkAnalyzer        (void) ;
  142.  
  143.  
  144.  
  145. /* ----------- setup functions ------------ */
  146.  
  147. static Widget w_Setup , w_box ;
  148. static Widget t_XY    , t_TY    , t_TE  ;  
  149. static Widget t_Lin   , t_Sqr   , t_Su, t_Ave ;
  150. static Widget b_Cancel, b_DoneS ;
  151. static Widget w_HorMin, w_HorMax, w_HorUnit, w_HorGrid ;
  152. static Widget w_VerMin, w_VerMax, w_VerUnit, w_VerGrid ;
  153. static Widget t_HorOut, t_HorAct, t_VerOut , t_VerAct  ;
  154. static Widget w_Period, w_MSteps, w_RecFile, w_Su      ;
  155.  
  156. static void NA_SetupGetValues    (void) ;
  157. static void NA_SetupGCheckValues (void) ;
  158. static void NA_SetupSetValues    (void) ;
  159. static void NA_SetupCallbackProc (Widget w, 
  160.                                   XtPointer client_data,
  161.                                   XtPointer call_data) ;
  162. static void NA_CreateSetupWidget (int graphtype) ;
  163. static void NA_OpenSetup         (Widget w,
  164.                                   XtPointer client_data,
  165.                                   XtPointer call_data) ;
  166.  
  167.  
  168. /* ----------- display control ------------ */
  169.  
  170. static Widget w_DisplayControl ;
  171. static Widget b_HorHalf , b_HorDouble ;
  172. static Widget b_HorLeft , b_HorLLeft  ;
  173. static Widget b_HorRight, b_HorRRight ;
  174. static Widget b_VerHalf , b_VerDouble ;
  175. static Widget b_VerUp   , b_VerUUp    ;
  176. static Widget b_VerDown , b_VerDDown  ;
  177. static Widget b_DoneDC ;
  178.  
  179. static int    na_DisplayControlOpen ;
  180.  
  181.  
  182. static void NA_DControlCallbackProc (Widget w, 
  183.                                      XtPointer client_data,
  184.                                      XtPointer call_data) ;
  185. static void NA_OpenDisplayControl   (Widget w,
  186.                                      XtPointer client_data,
  187.                                      XtPointer call_data) ;
  188.  
  189. /* ----------  extern  declarations  ---------- */
  190.  
  191. extern void NA_OpenNetworkAnalyzer   (Widget    w, 
  192.                                       XtPointer client_data,
  193.                                       XtPointer call_data) ;
  194. extern Bool NA_NetworkAnalyzerIsOpen (void) ;
  195. extern void NA_DrawNextPoint         (void) ;
  196. extern void NA_StopTest              (void) ;
  197. extern Bool NA_ContinueTest          (void) ;
  198.  
  199.  
  200. #endif
  201.  
  202.  
  203. /*****************************************************************************
  204.                            E N D   O F   F I L E
  205. ******************************************************************************/
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.