home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / ipxlib / process.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-01  |  5.7 KB  |  139 lines

  1. // PROCESS.C -- Miscellaneous routines for IPXTEST
  2. // by Allen Brunson  06/01/94
  3.  
  4.  
  5. #include <conio.h>     // getch()
  6. #include <stdio.h>     // sprintf()
  7. #include "ipxtest.h"   // IPXtest-specific defines
  8.  
  9.  
  10. /****************************************************************************/
  11. /*                                                                          */
  12. /***  demoStart()                                                         ***/
  13. /*                                                                          */
  14. /****************************************************************************
  15.  
  16. This procedure starts up the various subsystems and displays opening
  17. messages.                                                                   */
  18.  
  19. void demoStart(void)                               // Begin demoStart()
  20.   {
  21.     vidStart();                                    // Start video
  22.  
  23.     message("IPXTEST -- Test program for IPXLIB"); // Display opening
  24.     message("by Allen Brunson  v0.20  06/01/94");  //  messages
  25.     message("");
  26.     message("Press F1 for help");                  // Display help message
  27.     message("");                                   //  reminder
  28.  
  29.     netStart();                                    // Start up net stuff
  30.   }                                                // End demoStart()
  31.  
  32.  
  33. /****************************************************************************/
  34. /*                                                                          */
  35. /***  demoStop()                                                          ***/
  36. /*                                                                          */
  37. /****************************************************************************
  38.  
  39. This procedure shuts down the various subsystems.                           */
  40.  
  41. void demoStop(void)                                // Begin demoStop()
  42.   {
  43.     netStop();                                     // Shut down IPXLIB
  44.  
  45.     message("");                                   // Print a blank line
  46.     message(                                       // Display final message
  47.      "Program finished.  Press a key to exit.");
  48.     getch();                                       // Get a key
  49.  
  50.     vidStop();                                     // Reset screen
  51.   }
  52.  
  53.  
  54. /****************************************************************************/
  55. /*                                                                          */
  56. /***  err()                                                               ***/
  57. /*                                                                          */
  58. /****************************************************************************
  59.  
  60. This procedure displays an error message for each of the possible IPXLIB
  61. errors.                                                                     */
  62.  
  63. word err(word error)                               // Begin err()
  64.   {
  65.     switch (error)                                 // Decision on error
  66.       {
  67.         case ipxeNOERR:                            // No error
  68.           return error;                            // Return
  69.  
  70.         case TRUE:                                 // TRUE
  71.           return error;                            // Return
  72.  
  73.         case ipxeNOIPX:                            // IPX not loaded
  74.           message("IPX driver not loaded.");
  75.           return error;
  76.  
  77.         case ipxeIPXNOTSTARTED:                    // ipxStart() not called
  78.           message("IPX not started.");
  79.           return error;
  80.  
  81.         case ipxeIPXSTARTED:                       // ipxStart() called twice
  82.           message("IPX is already started.");
  83.           return error;
  84.  
  85.         case ipxeBADCOMMPARMS:                     // Bad ipxStart() parms
  86.           message("Improper communication parameters.");
  87.           return error;
  88.  
  89.         case ipxeMEMTOOSMALL:                      // Memory block too small
  90.           message("IPX memory block is too small.");
  91.           return error;
  92.  
  93.         case ipxeSOCKETTABLEFULL:                  // Socket table full
  94.           message("No free IPX sockets.");
  95.           return error;
  96.  
  97.         case ipxeSOCKETOPEN:                       // Socket already open
  98.           message("Selected socket is in use.");
  99.           return error;
  100.  
  101.         case ipxeSOCKETNOTOPEN:                    // Socket not open
  102.           message("Socket isn't open.");
  103.           return error;
  104.  
  105.         case ipxeNOFREESENDECB:                    // No free send ECBs
  106.           message("No free send ECBs.");
  107.           return error;
  108.  
  109.         case ipxeRECVCANCEL:                       // Receive event canceled
  110.           message("Receive event was canceled.");
  111.           return error;
  112.  
  113.         case ipxeSENDCANCEL:                       // Send was canceled
  114.           message("Send event was canceled.");
  115.           return error;
  116.  
  117.         case ipxeRECVPKTTOOBIG:                    // Received packet too big
  118.           message("Received packet was too big for buffer.");
  119.           return error;
  120.  
  121.         case ipxeSENDPKTBAD:                       // Sent packet bad
  122.           message("Sent packet was malformed.");
  123.           return error;
  124.  
  125.         case ipxeSENDBADROUTE:                     // Can't send packet
  126.           message("Couldn't deliver packet.");
  127.           return error;
  128.  
  129.         case ipxeSENDNETFAIL:                      // Hardware failure
  130.           message("Hardware or network failure!");
  131.           return error;
  132.  
  133.         default:                                   // Unknown error
  134.           sprintf(str, "Unknown error %d.", error);
  135.           message(str);
  136.           return error;
  137.       }
  138.   }                                                // End err()
  139.