home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / FACETV.ZIP / SCRENMSG.CPP < prev    next >
C/C++ Source or Header  |  1994-01-04  |  2KB  |  69 lines

  1. /************************************************************************
  2. **
  3. ** @(#)screnmsg.cpp    08/10/93    Chris Ahlstrom
  4. **
  5. **    Tentative interface between Turbo Vision and user functions.
  6. ** This interface will allow the user to write functions without much
  7. ** regard to how Turbo Vision works.
  8. **
  9. **    For now, we set up an interface that duplicates console I/O.
  10. ** However, we add some parameters that are not necessary for console
  11. ** I/O, but will be necessary for Turbo Vision I/O.
  12. **
  13. **    Note that we want this routine to be calleable *and* *linkable*
  14. ** from a C++ ** *or* a C program.  So, we want the screenmsg() function
  15. ** to be "C", and the tvScreenmsg() function to be C++.
  16. **
  17. *************************************************************************/
  18.  
  19. #define SCRENMSG_cpp
  20.  
  21. #include <alloc.h>
  22. #include <conio.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26.  
  27. #include "tvscreen.h"
  28.  
  29.  
  30. /************************************************************************
  31. ** tvScreenmsg()
  32. **
  33. **    This will be the primary interface for writing to the screen
  34. ** in a TurboVision application
  35. **
  36. **    If the text is to be displayed (use_io is true), then the output
  37. ** goes to the system console if the handle is NULL.  Otherwise, it is
  38. ** assumed that the handle refered to a TWindowScreen pointer, and
  39. ** the string goes to that window.
  40. **
  41. *************************************************************************/
  42.  
  43. int
  44. tvScreenmsg
  45. (
  46.     int use_io,                // whether to ignore output
  47.     void *handle,            // bogus for now
  48.     char *string            // string to display
  49. )
  50. {
  51.     int err = 0;
  52.  
  53.     if (use_io)                // use the I/O
  54.     {
  55.     if (handle == NULL)        // use console I/O
  56.     {
  57.         doScreenMessage
  58.         (
  59.         (TWindowScreen *) handle,
  60.         "%%Programmer error: tried to use console I/O"
  61.         "in tvScreenmsg()... here's message anyway:\n"
  62.         );
  63.         err = 1;
  64.     }
  65.     doScreenMessage((TWindowScreen *) handle, string);
  66.     }
  67.     return err;                // return any error code
  68. }
  69.