home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / gt_error.prg < prev    next >
Text File  |  1993-10-14  |  5KB  |  178 lines

  1. /*
  2.     File......: GT_Error.prg
  3.     Author....: Martin Bryant
  4.     BBS.......: The Dark Knight Returns
  5.     Net/Node..: 050/069
  6.     User Name.: Martin Bryant
  7.     Date......: 05/02/93
  8.     Revision..: 1.0
  9.  
  10.     This is an original work by Martin Bryant and is placed
  11.     in the public domain.
  12.  
  13.     Modification history:
  14.     ---------------------
  15.  
  16.     Rev 1.0 05/02/93
  17.     PD Revision.
  18. */
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *      GT_ERROR()
  23.  *  $CATEGORY$
  24.  *      Video
  25.  *  $ONELINER$
  26.  *      Display an error message on the screen and wait for response
  27.  *  $SYNTAX$
  28.  *      GT_Error([<cMessage>]) -> lSuccess
  29.  *  $ARGUMENTS$
  30.  *      <cMessage> is a charater string todisplay.
  31.  *  $RETURNS$
  32.  *      lSuccess
  33.  *  $DESCRIPTION$
  34.  *      To display an error message on the screen, wait for
  35.  *      the user to respond and remove the message.
  36.  *  $EXAMPLES$
  37.  *      IF .NOT. lSuccess
  38.  *          GT_Error("It didn't Work !")
  39.  *      ENDIF
  40.  *  $SEEALSO$
  41.  *
  42.  *  $INCLUDE$
  43.  *
  44.  *  $END$
  45.  */
  46.  
  47. #include "GT_LIB.ch"
  48.  
  49. FUNCTION GT_Error(cMessage)
  50.  
  51. LOCAL aErrors := {  'An invalid Function number' ;
  52.     ,'A file could not be found' ;
  53.     ,'A path could not be found' ;
  54.     ,'Too many open files (No handle left)' ;
  55.     ,'Access being denied' ;
  56.     ,'An invalid handle' ;
  57.     ,'Memory control blocks being destroyed' ;
  58.     ,'Insufficient memory' ;
  59.     ,'An invalid memory block address' ;
  60.     ,'An invalid environment' ;
  61.     ,'An invalid format' ;
  62.     ,'An invalid access code' ;
  63.     ,'Some invalid data' ;
  64.     ,'A reserved DOS error' ;
  65.     ,'An invalid drive being specIfied' ;
  66.     ,'An attempt to remove the current directory' ;
  67.     ,'A "NOT SAME DEVICE" error' ;
  68.     ,'No more files available' ;
  69.     ,'An attempt to write to a write protected diskette' ;
  70.     ,'An unknown unit' ;
  71.     ,'The drive not being ready' ;
  72.     ,'An unknown command' ;
  73.     ,'A data error (CRC)' ;
  74.     ,'A bad request structure length' ;
  75.     ,'A seek error' ;
  76.     ,'An unknown media type' ;
  77.     ,'A sector not found error' ;
  78.     ,'The printer being out of paper' ;
  79.     ,'A write fault' ;
  80.     ,'A read fault' ;
  81.     ,'A general failure' ;
  82.     ,'A sharing violation' ;
  83.     ,'A lock violation' ;
  84.     ,'An invalid disk change' ;
  85.     ,'No FCB available' ;
  86.     ,'A sharing buffer overflow' ;
  87.     ,'A reserved DOS error' ;
  88.     ,'A reserved DOS error' ;
  89.     ,'A reserved DOS error' ;
  90.     ,'A reserved DOS error' ;
  91.     ,'A reserved DOS error' ;
  92.     ,'A reserved DOS error' ;
  93.     ,'A reserved DOS error' ;
  94.     ,'A reserved DOS error' ;
  95.     ,'A reserved DOS error' ;
  96.     ,'A reserved DOS error' ;
  97.     ,'A reserved DOS error' ;
  98.     ,'A reserved DOS error' ;
  99.     ,'A reserved DOS error' ;
  100.     ,'An unsupported network request' ;
  101.     ,'The remote computer not listening' ;
  102.     ,'A duplicate name on the network' ;
  103.     ,'The network name not found' ;
  104.     ,'The network being busy' ;
  105.     ,'The network device no longer exists' ;
  106.     ,'The network BIOS command limit exceeded' ;
  107.     ,'A network adaptor hardware error' ;
  108.     ,'An incorrect response from the network' ;
  109.     ,'An unexpected network error' ;
  110.     ,'An incompatible remote adaptor' ;
  111.     ,'The print queue being full' ;
  112.     ,'Insufficient space for print file' ;
  113.     ,'The print file being deleted (not enough space)' ;
  114.     ,'The network name being deleted' ;
  115.     ,'Access being denied' ;
  116.     ,'A network device type error' ;
  117.     ,'The network name cound not be found' ;
  118.     ,'The network name limit has been exceeded' ;
  119.     ,'The network BIOS session limit has been exceeded' ;
  120.     ,'A temporary pause' ;
  121.     ,'The network refusing a request' ;
  122.     ,'A print or disk redirection being paused' ;
  123.     ,'A reserved DOS error' ;
  124.     ,'A reserved DOS error' ;
  125.     ,'A reserved DOS error' ;
  126.     ,'A reserved DOS error' ;
  127.     ,'A reserved DOS error' ;
  128.     ,'A reserved DOS error' ;
  129.     ,'A reserved DOS error' ;
  130.     ,'The file currently existing' ;
  131.     ,'A reserved DOS error' ;
  132.     ,'Not being able to make a directory entry' ;
  133.     ,'Failing on interrupt 24H' ;
  134.     ,'Too many redirections' ;
  135.     ,'A duplicate redirection' ;
  136.     ,'An invalid password' ;
  137.     ,'An invalid parameter' ;
  138.     ,'A network device fault' }
  139.  
  140. LOCAL cCause := CRLF + CRLF + 'Cause: '
  141. LOCAL cClose := ')'
  142. LOCAL cDosError := '. (DOS error '
  143. LOCAL cPressKey := CRLF + CRLF + ;
  144.     'Press any key to continue'
  145.  
  146. LOCAL cProblem := ''
  147. LOCAL cScreen := SAVESCREEN(00,00,MAXROW(),MAXCOL())
  148. LOCAL lSuccess := .T.
  149. LOCAL nCursor := GT_Nocursor()
  150. LOCAL nError := Max(FERROR(),DOSERROR())
  151. LOCAL nTimeOut := 120
  152.  
  153. DOSERROR(0)
  154.  
  155. IF nError > 0
  156.  
  157.     cProblem := cCause + aErrors[nError] + cDosError + ;
  158.         LTRIM(STR(nError)) + cClose
  159.  
  160. ENDIF
  161.  
  162. GT_Message(cMessage + cProblem + cPressKey,'Error',NIL, ;
  163.     BOX_SS)
  164.  
  165. //  Wait and blank keyboard buffer
  166. GT_Beep()
  167. INKEY(nTimeOut)
  168. KEYBOARD CHR(0)
  169. INKEY()
  170. RESTSCREEN(00,00,MAXROW(),MAXCOL(),cScreen)
  171. SETCURSOR(nCursor)
  172.  
  173. /*
  174.     End of GT_Error()
  175. */
  176. RETURN(lSuccess)
  177.  
  178.