forked from Astrabit-ST/ModShot-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Speak2Erase
committed
May 3, 2022
1 parent
ed12ab7
commit c3d8ac9
Showing
10 changed files
with
263 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef BINDING_MRI_WIN32_H | ||
#define BINDING_MRI_WIN32_H | ||
|
||
|
||
#include <windows.h> | ||
#include "win-consoleutils.h" | ||
|
||
// Attempts to set $stdout and $stdin accordingly on Windows. Only | ||
// called when debug mode is on, since that's when the console | ||
// should be active. | ||
void configureWindowsStreams() { | ||
const int stdoutFD = getStdFD(STD_OUTPUT_HANDLE); | ||
|
||
// Configure $stdout | ||
if (stdoutFD >= 0) { | ||
VALUE winStdout = rb_funcall(rb_cIO, rb_intern("new"), 2, | ||
INT2NUM(stdoutFD), rb_str_new_cstr("w+")); | ||
|
||
rb_gv_set("stdout", winStdout); | ||
} | ||
|
||
const int stdinFD = getStdFD(STD_INPUT_HANDLE); | ||
|
||
// Configure $stdin | ||
if (stdinFD >= 0) { | ||
VALUE winStdin = rb_funcall(rb_cIO, rb_intern("new"), 2, | ||
INT2NUM(stdinFD), rb_str_new_cstr("r")); | ||
|
||
rb_gv_set("stdin", winStdin); | ||
} | ||
|
||
const int stderrFD = getStdFD(STD_ERROR_HANDLE); | ||
|
||
// Configure $stderr | ||
if (stderrFD >= 0) { | ||
VALUE winStderr = rb_funcall(rb_cIO, rb_intern("new"), 2, | ||
INT2NUM(stderrFD), rb_str_new_cstr("w+")); | ||
|
||
rb_gv_set("stderr", winStderr); | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.