home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / libs / plotlib.lha / Plot_1.lzh / Source / debugl2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-02  |  11.3 KB  |  333 lines

  1. /****************************************************************
  2. *                                                                                                                                *
  3. *     Filename : DebugL2.c                                                                                    *
  4. *                                                                                                                                *
  5. *****************************************************************
  6. *                                                                                                                                *
  7. *        Comment : Sourcedatei für Debugfunktionen Level 2                        *
  8. *                            Diese Funktionen helfen dem Programmierer die            *
  9. *                            geladenen Daten der Plotlibrary anzuschauen. Es        *
  10. *                            kann bei einer Implementation auf einen neuen            *
  11. *                            Rechner die Darstellung kontrolliert werden.            *
  12. *                            Diese Funktionen sollten nur während dieser                *
  13. *                            Implementationsphase verwendet werden, da sie            *
  14. *                            sehr gross sind und normalerweise auch nicht            *
  15. *                            benötigt werden.                                                                    *
  16. *                                                                                                                                *
  17. *                                Funktionen                                                        *
  18. *                            ==========                                                        *
  19. *                                                                                                                                *
  20. *                    displaydata()        sucht und zeigt Daten einer Kurve            *
  21. *                    displaycurve()    sucht und zeigt Kurvenstruktur                *
  22. *                    dispdata()            zeigt Daten einer Kurve                                *
  23. *                    dispplot()            zeigt Plotstruktur                                        *
  24. *                    dispcurve()            zeigt Kurvenstruktur                                    *
  25. *                                                                                                                                *
  26. *                Rev : V1.0                                                                                            *
  27. *                                                                                                                                *
  28. *        History : V1.0 erstellen dieses Files                            15/11/89    *
  29. *                                                                                                                                *
  30. *                Doc : Plotlibrary User's Guide                                                    *
  31. *                                                                                                                                *
  32. *             Bugs : keine bekannten                                                                        *
  33. *                                                                                                                                *
  34. *            Autor : Oesch Silvano                                                                            *
  35. *                                                                                                                                *
  36. *            Datum : 10/12/89                                                                                    *
  37. *                                                                                                                                *
  38. ****************************************************************/
  39.  
  40. /****************************************************************
  41. *                                                                                                                                *
  42. *    Plotlibrary Includedateien                                                                        *
  43. *                                                                                                                                *
  44. ****************************************************************/
  45.  
  46. #include "Plot.h"                                        /* allg. Includes                        */
  47. #include "DebugL2.h"                                /* und eigene einlesen            */
  48.  
  49. /****************************************************************
  50. *                                                                                                                                *
  51. *    externe Variablen                                                                                            *
  52. *                                                                                                                                *
  53. ****************************************************************/
  54.  
  55. extern struct Plot *plot;                        /* Plotpointer                            */
  56. extern int plerr;                                        /* Fehlervariable                        */
  57.  
  58. /****************************************************************
  59. *                                                                                                                                *
  60. *    Function : displaydata()                                                                            *
  61. *                                                                                                                                *
  62. *****************************************************************
  63. *                                                                                                                                *
  64. *         Input : int id                ID der Kurve                                                    *
  65. *                                                                                                                                *
  66. *        Output : void                                                                                                *
  67. *                                                                                                                                *
  68. *****************************************************************
  69. *                                                                                                                                *
  70. *     Comment : Zeigt die Daten einer Kurve welche mit ID bestimmt    *
  71. *                         wurde. Diese Funktion sollte nur zum debbugen            *
  72. *                         verwendet werde.                                                                        *
  73. *                                                                                                                                *
  74. ****************************************************************/
  75.  
  76. void displaydata(id)
  77. int id;
  78. {
  79.     struct Curve *curve;                            /* Kurvenzeiger                            */
  80.  
  81.     curve = slistid(id);                            /* suche Kurve                            */
  82.     if (curve)                                                /* gefunden ?                                */
  83.         dispdata(curve);                                /* dann zeige Daten                    */
  84.     else                                                            /* sonst                                        */
  85.         dis_ploterror();                                /* zeige Fehler                            */
  86. }
  87.  
  88. /****************************************************************
  89. *                                                                                                                                *
  90. *    Function : displaycurve()                                                                            *
  91. *                                                                                                                                *
  92. *****************************************************************
  93. *                                                                                                                                *
  94. *         Input : int id                ID der Kurve                                                    *
  95. *                                                                                                                                *
  96. *        Output : void                                                                                                *
  97. *                                                                                                                                *
  98. *****************************************************************
  99. *                                                                                                                                *
  100. *     Comment : Zeigt die Kurvenstruktur einer Kurve welche mit ID    *
  101. *                         bestimmt wurde. Diese Funktion sollte nur zum            *
  102. *                         debuggen verwendet werden.                                                    *
  103. *                                                                                                                                *
  104. ****************************************************************/
  105.  
  106. void displaycurve(id)
  107. int id;
  108. {
  109.     struct Curve *curve;                            /* Kurvenzeiger                            */
  110.  
  111.     curve = slistid(id);                            /* suche Kurve                            */
  112.     if (curve)                                                /* gefunden ?                                */
  113.         dispcurve(curve);                                /* dann zeige Kurvenstruk.    */
  114.     else                                                            /* sonst                                        */
  115.         dis_ploterror();                                /* zeige Fehler                            */
  116. }
  117.  
  118. /****************************************************************
  119. *                                                                                                                                *
  120. *    Function : dispdata()                                                                                    *
  121. *                                                                                                                                *
  122. *****************************************************************
  123. *                                                                                                                                *
  124. *         Input : curve                                                                                            *
  125. *                            struct Curve *curve        welche Kurvendaten                    *
  126. *                                                                                                                                *
  127. *        Output : void                                                                                                *
  128. *                                                                                                                                *
  129. *****************************************************************
  130. *                                                                                                                                *
  131. *     Comment : listet die Daten einer bestimmten Kurve anhand            *
  132. *                         ihres Darstellungstypes. Diese Funktion sollte nur    *
  133. *                         zum debuggen verwendet werden.                                            *
  134. *                                                                                                                                *
  135. ****************************************************************/
  136.  
  137. void dispdata(curve)
  138. struct Curve *curve;
  139. {
  140.     DATA *array=curve->val;                        /* Datenzeiger                            */
  141.     int i;                                                        /* allg Zähler                            */
  142.  
  143.     if (curve != NULL)                                /* Kurve vorhanden                    */
  144.     {                                                                    /* dann zeigen                            */
  145.         printf("Kurvendaten der Kurve %d :\n",curve->id);
  146.                                                                         /* Header                                        */
  147.         for (i=0;i<curve->count;i++)        /* alle Daten zeigen                */
  148.         {                                                                /* Zahlen ausgeben                    */
  149.             printf("[%d]\tx : % lG",i+1,*array++);
  150.             printf("\ty : % lG",*array++);
  151.             if (plot->typ != D3)                    /* je nach Typ 2 oder 3            */
  152.                 printf("\n");
  153.             else
  154.                 printf("\tz : % lG\n",*array++);
  155.         }
  156.     printf("Ende Kurvendaten\n\n");
  157.     }
  158.     else
  159.         printf("Null Pointer für Kurve als Parameter");
  160. }
  161.  
  162. /****************************************************************
  163. *                                                                                                                                *
  164. *    Function : dispplot()                                                                                    *
  165. *                                                                                                                                *
  166. *****************************************************************
  167. *                                                                                                                                *
  168. *         Input : void                                                                                                *
  169. *                                                                                                                                *
  170. *        Output : void                                                                                                *
  171. *                                                                                                                                *
  172. *****************************************************************
  173. *                                                                                                                                *
  174. *     Comment : zeigt die Plotstruktur. Diese Funktion sollte nur    *
  175. *                         zum debuggen verwendet werden.                                            *
  176. *                                                                                                                                *
  177. ****************************************************************/
  178.  
  179. void dispplot()
  180. {
  181.  
  182.     char *names[] =
  183.     {
  184.         "Titel",
  185.         "Xname",
  186.         "Xunit",
  187.         "Yname",
  188.         "Yunit",
  189.         "Zname",
  190.         "Zunit",
  191.         "Plotout"
  192.     };
  193.  
  194.     char **name;
  195.     int i;
  196.  
  197.     if (plot)                                                    /* nur zeigen wenn def.            */
  198.     {
  199.         printf("P L O T - Struktur\n");
  200.  
  201. /****************************************************************
  202. *                                                                                                                                *
  203. *    Zuerst werden alle Parameter dargestellt                                            *
  204. *                                                                                                                                *
  205. ****************************************************************/
  206.  
  207.         printf("    Typ : %d\t",plot->typ);
  208.         printf("   Grid : %d\t",plot->grid);
  209.         printf("  Clipp : %d\t",plot->clipp);
  210.         printf("Autoval : %d\n",plot->autoval);
  211.  
  212.         printf("   Xmes : %d\t",plot->xmes);
  213.         printf("   Ymes : %d\t",plot->ymes);
  214.         printf("   Zmes : %d\n",plot->zmes);
  215.  
  216.         printf("  Count : %d\t",plot->count);
  217.         printf(" CurrID : %d\n",plot->currid);
  218.  
  219.         printf("   Disp : %d\t",plot->disp);
  220.         printf(" MaxCol : %d\n",plot->maxcol);
  221.  
  222.         printf("  Xpic1 : %d\t",plot->xpic1);
  223.         printf("  XPic2 : %d\t",plot->xpic2);
  224.         printf("  XSize : %d\n",plot->xsize);
  225.  
  226.         printf("  Ypic1 : %d\t",plot->ypic1);
  227.         printf("  YPic2 : %d\t",plot->ypic2);
  228.         printf("  YSize : %d\n",plot->ysize);
  229.  
  230.         printf("  XText : %d\t",plot->xtext);
  231.         printf("  YText : %d\n",plot->ytext);
  232.  
  233.         printf("   Xout : %d\t",plot->xout);
  234.         printf("   Yout : %d\t",plot->yout);
  235.         printf("Xlength : %d\t",plot->xlength);
  236.         printf("Ylength : %d\n",plot->ylength);
  237.  
  238.         printf("  First : %p\t",plot->first);
  239.         printf("   Last : %p\n\n",plot->last);
  240.  
  241.         printf("   Xmin : % lG\t",plot->xmin);
  242.         printf("   Xmax : % lG\n",plot->xmax);
  243.         printf("  XStep : % lG\t",plot->xstep);
  244.         printf("  XGmin : % lG\t",plot->xgridmin);
  245.         printf("  XGmax : % lG\n",plot->xgridmax);
  246.  
  247.         printf("   Ymin : % lG\t",plot->ymin);
  248.         printf("   Ymax : % lG\n",plot->ymax);
  249.         printf("  YStep : % lG\t",plot->ystep);
  250.         printf("  YGmin : % lG\t",plot->ygridmin);
  251.         printf("  YGmax : % lG\n",plot->ygridmax);
  252.  
  253.         printf("   Zmin : % lG\t",plot->zmin);
  254.         printf("   Zmax : % lG\n",plot->zmax);
  255.         printf("  ZStep : % lG\t",plot->zstep);
  256.         printf("  ZGmin : % lG\t",plot->zgridmin);
  257.         printf("  ZGmax : % lG\n\n",plot->zgridmax);
  258.  
  259. /****************************************************************
  260. *                                                                                                                                *
  261. *    Jetzt kommen die Texte                                                                                *
  262. *                                                                                                                                *
  263. ****************************************************************/
  264.  
  265.         name = &plot->titel;
  266.         for (i=0;i<MAXNAMES;i++)
  267.         {
  268.             if (*name)
  269.                 printf("  %s : %s\n",names[i],*name);
  270.             else
  271.                 printf("  %s : NULL\n",names[i]);
  272.             name++;
  273.         }
  274.  
  275.         printf("Ende der P L O T - Struktur\n\n");
  276.     }
  277.     else
  278.         printf("Plot nicht definiert\n");
  279. }
  280.  
  281. /****************************************************************
  282. *                                                                                                                                *
  283. *    Function : dispcurve()                                                                                *
  284. *                                                                                                                                *
  285. *****************************************************************
  286. *                                                                                                                                *
  287. *         Input : curve                                                                                            *
  288. *                            struct Curve *curve                                                                *
  289. *                                                                                                                                *
  290. *        Output : void                                                                                                *
  291. *                                                                                                                                *
  292. *****************************************************************
  293. *                                                                                                                                *
  294. *     Comment : zeigt die Kurvenstruktur. Diese Funktion sollte        *
  295. *                         nur zum debuggen verwendet werden.                                    *
  296. *                                                                                                                                *
  297. ****************************************************************/
  298.  
  299. void dispcurve(curve)
  300. struct Curve *curve;
  301. {
  302.     if (curve)                                                /* nur wenn Kurve existiert    */
  303.     {
  304.         printf("C U R V E  - Struktur\n");
  305.         printf("   Next : %p\t",curve->next);
  306.         printf("  Value : %p\n",curve->val);
  307.  
  308.         if (curve->titel)
  309.             printf("  Titel : %s\t",curve->titel);
  310.         else
  311.             printf("  Titel : NULL\t");
  312.         printf("     ID : %d\n",curve->id);
  313.  
  314.         printf("  Color : %d\t",curve->color);
  315.         printf("  Count : %d\t",curve->count);
  316.         printf(" MaxCnt : %d\n\n",curve->maxcount);
  317.  
  318.         printf("   Xmin : % lG\t",curve->xmin);
  319.         printf("   Xmax : % lG\n",curve->xmax);
  320.  
  321.         printf("   Ymin : % lG\t",curve->ymin);
  322.         printf("   Ymax : % lG\n",curve->ymax);
  323.  
  324.         printf("   Zmin : % lG\t",curve->zmin);
  325.         printf("   Zmax : % lG\n\n",curve->zmax);
  326.  
  327.         printf("Ende der C U R V E - Struktur\n\n");
  328.     }
  329.     else
  330.         printf("Curve nicht definiert\n");
  331. }
  332.  
  333.