home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / msg.zip / DEMO.PRG next >
Text File  |  1988-10-24  |  2KB  |  46 lines

  1. ***
  2. * DEMO.PRG, by Steve Badaracco (public domain)
  3. * To demonstrate the MSG() function
  4. * For Clipper Summer '87
  5. * 10/24/88
  6. ***
  7.  
  8. ? '1 : '+ msg()        && attempt to close the message file (not opened)
  9.  
  10. ? '2 : '+ msg(43,.f.)  && valid show of message 43
  11.  
  12. ? '3a: '+ msg(.t.,.f.) && invalid first parameter
  13. ? '3b: '+ msg(.t.)     && same error, use MISC_ERROR
  14.  
  15. ? '4a: '+ msg()        && must close file before using another MSG file
  16. sysn = 'NONEXIST'      && will attempt to use a new (non-existent) MSG file
  17. ? '4b: ' + msg(40,.f.) && file not found
  18. ? '4c: ' + msg(40,.t.) && same error, use MISC_ERROR
  19. ? '5 : ' + msg()       && close the NONEXIST file, which was never opened
  20.  
  21. sysn = .f.             && won't use SYSN anymore, will use SYSTEM.MSG
  22.  
  23. ? '6a: '+ msg(42,.f.)  && 42 is a bad record in SYSTEM.MSG: unbalanced quotes
  24. ? '6b: '+ msg(42)      && same error, use MISC_ERROR
  25.  
  26. ? '7a: '+ msg(44,.f.)  && no record 44 in SYSTEM.MSG
  27. ? '7b: '+ msg(44)      && same error, use MISC_ERROR
  28. ?
  29.  
  30. msg()                  && now close the file (always do this)
  31. quit                   && and quit
  32. * EOP: DEMO.PRG
  33.  
  34.  
  35. ***
  36. * Nantucket's MISC_ERROR(), modified to return the error string and not quit
  37. * Note: DO NOT use this function in a real program, since it will
  38. *       short-circuit the true misc_error() function and cause
  39. *       unpredictable damage!
  40. ***
  41.  
  42. FUNCTION misc_error
  43. PARAMETERS name, line, info, model
  44. return "Proc " + M->name + " line " + LTRIM(STR(M->line)) + ", " + M->info
  45. *
  46.