home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk22
/
dir04
/
f014410.re_
/
f014410.re
Wrap
Text File
|
1996-04-02
|
7KB
|
203 lines
/*----------------------------------------------------------------------+
| |
| Copyright (1995) Bentley Systems, Inc., All rights reserved. |
| |
| "MicroStation" is a registered trademark and "MDL" and "MicroCSL" |
| are trademarks of Bentley Systems, Inc. |
| |
| Limited permission is hereby granted to reproduce and modify this |
| copyrighted material provided that the resulting code is used only |
| in conjunction with Bentley Systems products under the terms of the |
| license agreement provided therein, and that this notice is retained |
| in its entirety in any such reproduction or modification. |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| $Logfile: J:/mdl/examples/doc/output.mcv $
| $Workfile: output.mc $
| $Revision: 5.2 $
| $Date: 20 Jun 1995 08:49:48 $
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| output.mc - examples for the mdlOutput_ functions. |
| |
| This file is intended as an adjunct to the MDL manual to |
| illustrate MDL built-in function calling conventions and parameter |
| values. While it can be compiled, it does NOT, on its own, |
| constitute a workable MDL example. |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| Include Files |
| |
+----------------------------------------------------------------------*/
#include <mdl.h> /* system include files */
#include <stdarg.h>
#include <tcb.h>
/*----------------------------------------------------------------------+
| |
| Function declarations |
| |
+----------------------------------------------------------------------*/
void messagePrintf (char *, ...) ;
/*----------------------------------------------------------------------+
| |
| name outputU |
| |
| author BSI 9/90 |
| |
| This function illustrates use of the output functions that |
| display messages regardless of whether messages are inhibited. |
| |
+----------------------------------------------------------------------*/
cmdName void outputU
(
)
{
mdlOutput_errorU ("UNINHIBITED ERROR");
mdlOutput_promptU ("UNINHIBITED PROMPT");
mdlOutput_messageU ("UNINHIBITED MESSAGE");
mdlOutput_statusU ("UNINHIBITED STATUS");
mdlOutput_commandU ("UNINHIBITED COMMAND");
mdlOutput_keyinU ("UNINHIBITED KEYIN");
}
/*----------------------------------------------------------------------+
| |
| name output |
| |
| author BSI 9/90 |
| |
| This function illustrates use of the output functions that |
| are affected by whether the messages are inhibited. |
| |
+----------------------------------------------------------------------*/
cmdName void output
(
)
{
mdlOutput_error ("ERROR");
mdlOutput_prompt ("PROMPT");
mdlOutput_message ("MESSAGE");
mdlOutput_status ("STATUS");
mdlOutput_command ("COMMAND");
mdlOutput_keyin ("KEYIN");
}
/*----------------------------------------------------------------------+
| |
| name messages |
| |
| author BSI 9/90 |
| |
| This function toggles the messages-inhibit bit in the TCB. |
| |
+----------------------------------------------------------------------*/
cmdName messages
(
void
)
{
tcb->control.inh_msg ^= 1;
if (tcb->control.inh_msg)
mdlOutput_statusU ("Status messages are inhibited.");
else
mdlOutput_statusU ("Status messages are not inhibited.");
}
/*----------------------------------------------------------------------+
| |
| name errors |
| |
| author BSI 9/90 |
| |
| This function toggles the error-inhibit bit in the TCB. |
| |
+----------------------------------------------------------------------*/
cmdName errors
(
void
)
{
tcb->control.inh_err ^= 1;
if (tcb->control.inh_err)
mdlOutput_statusU ("Error messages are inhibited.");
else
mdlOutput_statusU ("Error messages are not inhibited.");
}
/*----------------------------------------------------------------------+
| |
| name testPrintf |
| |
| author BSI 9/90 |
| |
| This function illustrates mdlOutput_printf. mdlOutput_printf |
| is like printf, except that it also takes a paramter that |
| specifies a field in the MicroStation Command Window. |
| |
+----------------------------------------------------------------------*/
cmdName testPrintf
(
char *echoP
)
{
mdlOutput_printf (MSG_STATUS, "Testing testPrintf");
mdlOutput_printf (MSG_MESSAGE, "ECHOED: \"%s\"", echoP);
}
/*----------------------------------------------------------------------+
| |
| name callMessage |
| |
| author BSI 9/90 |
| |
| This command just calls messagePrintf. |
| |
+----------------------------------------------------------------------*/
cmdName callMessage
(
void
)
{
messagePrintf ("INT %d DOUBLE %g STRING %s", 100, 200., "Hello");
}
/*----------------------------------------------------------------------+
| |
| name messagePrintf |
| |
| author BSI 9/90 |
| |
| This function illustrates the use of mdlOutput_vprintf. |
| mdlOutput_vprintf is like vprintf, except that it also takes |
| a paramter that specifies a field in the MicroStation Command |
| Window. |
| |
| messagePrintf is essentially a printf that always displays |
| messages to the the message field of the Command Window. |
| |
+----------------------------------------------------------------------*/
Private void messagePrintf
(
char *formatP,
...
)
{
va_list ap;
/* Make ap point to the first named argument. */
va_start (ap, formatP);
mdlOutput_vprintf (MSG_MESSAGE, formatP, ap);
va_end (ap);
}