forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.lcb
More file actions
99 lines (72 loc) · 2.66 KB
/
stream.lcb
File metadata and controls
99 lines (72 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
Copyright (C) 2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
/**
This module specifies the syntax definitions and bindings for
stream input and output operations in modular LiveCode.
*/
module com.livecode.stream
public foreign type Stream binds to "MCStreamTypeInfo"
--
public foreign handler MCStreamExecGetStandardOutput(out Stdout as Stream) returns nothing binds to "<builtin>"
public foreign handler MCStreamExecGetStandardError(out Stderr as Stream) returns nothing binds to "<builtin>"
/**
Summary: Default output stream.
Returns: The default output stream.
Description:
The default output stream for output from the program.
In command-line programs, this is usually used to output the results
of running the program. In CGI programs running on servers, this is
usually used to output the data to be sent to the client.
Tags: IO
*/
syntax DefaultOutputStream is expression
"the" "output" "stream"
begin
MCStreamExecGetStandardOutput(output)
end syntax
/**
Summary: Default error stream.
Returns: The default error stream.
Description:
The default error stream for diagnostic information.
In command-line programs, this is usually used to display error
messages. In server programs, data output through this stream may be
stored in the system log, depending on the server configuration.
Tags: IO
*/
syntax DefaultErrorStream is expression
"the" "error" "stream"
begin
MCStreamExecGetStandardError(output)
end syntax
--
public foreign handler MCStreamExecWriteToStream(in Buffer as Data, in Destination as Stream) returns nothing binds to "<builtin>"
/**
Summary: Write data to a stream.
Buffer: An expression that evaluates to binary data.
Stream: An expression that evaluates to a stream.
Description:
Write some data to a stream. If not all of the data can be written,
fails with an error.
>*Warning:* If the stream is able to accept only part of the data,
>some streams will write that part of the data and discard the rest.
>This may cause loss of data.
Tags: IO
*/
syntax WriteToStream is statement
"write" <Buffer: Expression> "to" <Destination: Expression>
begin
MCStreamExecWriteToStream(Buffer, Destination)
end syntax
--
end module