|
Main Page Data Structures File List Globals
convert_to_string.c File ReferenceComverts composite datatypes into strings.
More...
#include "white_interface.h"
Go to the source code of this file.
Detailed Description
Comverts composite datatypes into strings.
This block receives move and button messages, and converts them to text strings. The text string is made up from the fields of the original datatype, separated by commas. The first part of the string identifies the datatype that it is representing, so that it can be re-constructed by convert_from_string.c
Definition in file convert_to_string.c.
Function Documentation
|
VCC Init function.
This function runs when the VCC simulation is first started.
Definition at line 68 of file convert_to_string.c.
|
|
VCC Run function.
This runs whenever a message arrives at the convert_to_string block's move_in or button_in port.
Definition at line 77 of file convert_to_string.c.
References sprintf.
00078 {
00079 button b_input;
00080 move m_input;
00081 char str[30];
00082
00083
00084 if (button_in_Enabled())
00085 {
00086 b_input = *button_in_Value();
00087
00088
00089 sprintf(str, "button,%d,%d", b_input.player, b_input.button_no);
00090 out_Post(str);
00091 }
00092
00093
00094 if (move_in_Enabled())
00095 {
00096 m_input = *move_in_Value();
00097
00098 sprintf(str, "move,%d,%d,%d,%d,%d", m_input.player, m_input.x1,
00099 m_input.y1, m_input.x2, m_input.y2);
00100 out_Post(str);
00101 }
00102 }
|
int sprintf |
( |
char * |
s, |
|
|
const char * |
cntrl_string, |
|
|
... |
|
|
) |
|
|
|
C standard library function.
Outputs a string according to the supplied control string. -
Parameters:
-
s |
A pointer to the destination string. |
cntrl_string |
A pointer to the control string |
-
Returns:
-
An integer error code.
Referenced by poin_entry_Run. |
|
|