Index: src/file.c ================================================================== --- src/file.c +++ src/file.c @@ -23,10 +23,11 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include #include "stream.h" @@ -169,5 +170,42 @@ .size = sizeof(CFWFile), .ctor = ctor, .dtor = dtor }; CFWClass *cfw_file = &class; + +static CFWFile cfw_stdin_ = { + .stream = { + .obj = { + .cls = &class, + .ref_cnt = INT_MAX + }, + .ops = &stream_ops + }, + .fd = 0, + .eof = false +}; +static CFWFile cfw_stdout_ = { + .stream = { + .obj = { + .cls = &class, + .ref_cnt = INT_MAX + }, + .ops = &stream_ops + }, + .fd = 1, + .eof = false +}; +static CFWFile cfw_stderr_ = { + .stream = { + .obj = { + .cls = &class, + .ref_cnt = INT_MAX + }, + .ops = &stream_ops + }, + .fd = 2, + .eof = false +}; +CFWFile *cfw_stdin = &cfw_stdin_; +CFWFile *cfw_stdout = &cfw_stdout_; +CFWFile *cfw_stderr = &cfw_stderr_; Index: src/file.h ================================================================== --- src/file.h +++ src/file.h @@ -31,6 +31,10 @@ typedef struct CFWFile CFWFile; extern CFWClass *cfw_file; +extern CFWFile *cfw_stdin; +extern CFWFile *cfw_stdout; +extern CFWFile *cfw_stderr; + #endif