PageRenderTime 21ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/exec/low_level/exec_output_stream_win32.e

http://github.com/tybor/Liberty
Specman e | 137 lines | 94 code | 20 blank | 23 comment | 2 complexity | eacce277b9dfeeb80d5530eafdd45d6c MD5 | raw file
  1-- This file is part of a Liberty Eiffel library.
  2-- See the full copyright at the end.
  3--
  4class EXEC_OUTPUT_STREAM_WIN32
  5
  6inherit
  7   TERMINAL_OUTPUT_STREAM
  8      redefine
  9         can_put_character
 10      end
 11
 12insert
 13   EXEC_STREAM
 14
 15create {PROCESS}
 16   make
 17
 18feature {ANY}
 19   is_connected: BOOLEAN
 20
 21   can_put_character (c: CHARACTER): BOOLEAN
 22      do
 23         Result := not process.is_finished
 24      end
 25
 26   disconnect
 27      do
 28         is_connected := False
 29         basic_exec_close(handle)
 30      end
 31
 32feature {FILTER}
 33   filtered_put_character (c: CHARACTER)
 34      do
 35         basic_exec_put_character(handle, c)
 36         if c = '%N' then
 37            filtered_flush
 38         end
 39      end
 40
 41   filtered_flush
 42      do
 43         basic_exec_flush(handle)
 44      end
 45
 46   filtered_descriptor: INTEGER
 47      do
 48         std_error.put_string("EXEC_OUTPUT_STREAM_WIN32.filtered_stream_pointer has been called!%N")
 49         crash
 50      end
 51
 52   filtered_has_descriptor: BOOLEAN False
 53
 54   filtered_stream_pointer: POINTER
 55      do
 56         std_error.put_string("EXEC_OUTPUT_STREAM_WIN32.filtered_stream_pointer has been called!%N")
 57         crash
 58      end
 59
 60   filtered_has_stream_pointer: BOOLEAN False
 61
 62feature {PROCESS}
 63   make (a_process: like process)
 64      require
 65         a_process /= Void
 66         process /= Void implies process = a_process
 67      do
 68         process := a_process
 69         create_pipe
 70         is_connected := pipe.is_not_null
 71         if is_connected then
 72            handle := basic_exec_get_out_handle(pipe)
 73         end
 74      end
 75
 76   process: PROCESS
 77
 78feature {}
 79   handle: POINTER
 80
 81   basic_exec_get_out_handle (a_pipe: POINTER): POINTER
 82      external "plug_in"
 83      alias "{
 84         location: "${sys}/plugins"
 85         module_name: "exec"
 86         feature_name: "basic_exec_win32_get_out_handle"
 87         }"
 88      end
 89
 90   basic_exec_put_character (handle_: POINTER; c: CHARACTER)
 91      external "plug_in"
 92      alias "{
 93         location: "${sys}/plugins"
 94         module_name: "exec"
 95         feature_name: "basic_exec_win32_put_character"
 96         }"
 97      end
 98
 99   basic_exec_flush (handle_: POINTER)
100      external "plug_in"
101      alias "{
102         location: "${sys}/plugins"
103         module_name: "exec"
104         feature_name: "basic_exec_win32_flush"
105         }"
106      end
107
108   basic_exec_close (handle_: POINTER)
109      external "plug_in"
110      alias "{
111         location: "${sys}/plugins"
112         module_name: "exec"
113         feature_name: "basic_exec_win32_close"
114         }"
115      end
116
117end -- class EXEC_OUTPUT_STREAM_WIN32
118--
119-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
120--
121-- Permission is hereby granted, free of charge, to any person obtaining a copy
122-- of this software and associated documentation files (the "Software"), to deal
123-- in the Software without restriction, including without limitation the rights
124-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125-- copies of the Software, and to permit persons to whom the Software is
126-- furnished to do so, subject to the following conditions:
127--
128-- The above copyright notice and this permission notice shall be included in
129-- all copies or substantial portions of the Software.
130--
131-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
137-- THE SOFTWARE.