home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk22
/
dir04
/
f014480.re_
/
f014480.re
Wrap
Text File
|
1996-04-02
|
5KB
|
147 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/tutorial.mcv $
| $Workfile: tutorial.mc $
| $Revision: 5.2 $
| $Date: 20 Jun 1995 08:49:44 $
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| tutorial.mc - examples for the mdltutorial_ 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 <userfnc.h>
#include <msinputq.h>
/*----------------------------------------------------------------------+
| |
| Function declarations |
| |
+----------------------------------------------------------------------*/
void receiveMessage (), monitorQueue ();
/*----------------------------------------------------------------------+
| |
| name main |
| |
| author BSI 9/90 |
| |
+----------------------------------------------------------------------*/
main ()
{
if (mdlTutorial_load ("sample") != SUCCESS)
/* mdlTutorial_load displays an error message */
exit (1);
/* Install some MDL input user functions. */
mdlInput_setMonitorFunction (MONITOR_ALL, monitorQueue);
mdlInput_setFunction (INPUT_MESSAGE_RECEIVED, receiveMessage);
}
/*----------------------------------------------------------------------+
| |
| name monitorQueue |
| |
| author BSI 9/90 |
| |
| monitorQueue is an example of a input-monitor user function. |
| See userInput_monitor in the MDL documentation for more |
| information. |
| |
+----------------------------------------------------------------------*/
Private int monitorQueue
(
Inputq_element *queueElementP
)
{
/* If this is a tutorial keyin, redirect it to this application
instead of letting MicroStation handle it. */
if (queueElementP->hdr.cmdtype == TUTKEYIN)
strcpy (queueElementP->hdr.taskId, mdlSystem_getCurrTaskID ());
return INPUT_ACCEPT;
}
/*----------------------------------------------------------------------+
| |
| name receiveMessage |
| |
| author BSI 9/90 |
| |
| This is a input-receive user function. See userInput_receive |
| in the MDL manual for more information. |
| |
| This function receives the messages that monitorQueue |
| redirects to this application. |
| |
| This functions justs echos the tutorial keyin to an output |
| field. It is assumed that fields 1-3 are input fields and |
| field 4-6 are output fields. |
| |
+----------------------------------------------------------------------*/
Private int receiveMessage
(
Inputq_element *queueElementP
)
{
char buffer [80];
strcpy (buffer, "OUTPUT ");
strcat (buffer, queueElementP->u.tutkeyin.keyin);
mdlTutorial_output (queueElementP->hdr.uc_fno_value+3, buffer,
strlen (buffer));
}
/*----------------------------------------------------------------------+
| |
| name chooseField |
| |
| author BSI 9/90 |
| |
+----------------------------------------------------------------------*/
cmdName chooseField
(
char *fieldP
)
{
int fieldNumber;
if ((sscanf (fieldP, "%d", &fieldNumber) != 1) ||
(fieldNumber < -2 || fieldNumber > 3))
{
mdlOutput_error ("Expected a field number between -1 and 3.");
return;
}
/* Select the desited field and draw the box. */
mdlTutorial_positionInputField (fieldNumber, 1);
}