| 1 | /* $Header: d:/cvsroot/tads/tads3/TCHOSTSI.H,v 1.2 1999/05/17 02:52:27 MJRoberts Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. |
| 5 | * |
| 6 | * Please see the accompanying license file, LICENSE.TXT, for information |
| 7 | * on using and copying this software. |
| 8 | */ |
| 9 | /* |
| 10 | Name |
| 11 | tchostsi.h - stdio implementation of host interface |
| 12 | Function |
| 13 | |
| 14 | Notes |
| 15 | |
| 16 | Modified |
| 17 | 04/22/99 MJRoberts - Creation |
| 18 | */ |
| 19 | |
| 20 | #ifndef TCHOSTSI_H |
| 21 | #define TCHOSTSI_H |
| 22 | |
| 23 | #include "t3std.h" |
| 24 | #include "tchost.h" |
| 25 | #include "osifcnet.h" |
| 26 | |
| 27 | |
| 28 | /* ------------------------------------------------------------------------ */ |
| 29 | /* |
| 30 | * stdio host interface |
| 31 | */ |
| 32 | class CTcHostIfcStdio: public CTcHostIfc |
| 33 | { |
| 34 | public: |
| 35 | CTcHostIfcStdio() |
| 36 | { |
| 37 | /* by default, show progress messages */ |
| 38 | show_progress_ = TRUE; |
| 39 | |
| 40 | /* there's no status prefix string yet */ |
| 41 | status_prefix_ = 0; |
| 42 | } |
| 43 | |
| 44 | ~CTcHostIfcStdio() |
| 45 | { |
| 46 | /* free our status prefix string */ |
| 47 | lib_free_str(status_prefix_); |
| 48 | } |
| 49 | |
| 50 | /* set the status message prefix string */ |
| 51 | void set_status_prefix(const char *str) |
| 52 | { |
| 53 | /* delete any former prefix string */ |
| 54 | lib_free_str(status_prefix_); |
| 55 | |
| 56 | /* store a copy of the string */ |
| 57 | status_prefix_ = lib_copy_str(str); |
| 58 | } |
| 59 | |
| 60 | /* display information messages */ |
| 61 | void v_print_msg(const char *msg, va_list args); |
| 62 | |
| 63 | /* display a process step message */ |
| 64 | void v_print_step(const char *msg, va_list args); |
| 65 | |
| 66 | /* display error messages */ |
| 67 | void v_print_err(const char *msg, va_list args); |
| 68 | |
| 69 | /* turn status (step) messages on/off */ |
| 70 | void set_show_progress(int flag) { show_progress_ = flag; } |
| 71 | |
| 72 | protected: |
| 73 | /* |
| 74 | * internal display routine - formats the message, converts it to |
| 75 | * the console character set and displays the result on the standard |
| 76 | * output |
| 77 | */ |
| 78 | void v_printf(const char *msg, va_list args); |
| 79 | |
| 80 | /* flag: show progress (step) messages */ |
| 81 | int show_progress_; |
| 82 | |
| 83 | /* status prefix message */ |
| 84 | char *status_prefix_; |
| 85 | }; |
| 86 | |
| 87 | #endif /* TCHOSTSI_H */ |