| |
| /pliant/language/ui/console1.pli |
| |
| 1 |
# Copyright Hubert Tonneau hubert.tonneau@pliant.cx | |
| 2 |
# | |
| 3 |
# This program is free software; you can redistribute it and/or | |
| 4 |
# modify it under the terms of the GNU General Public License version 2 | |
| 5 |
# as published by the Free Software Foundation. | |
| 6 |
# | |
| 7 |
# This program is distributed in the hope that it will be useful, | |
| 8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 |
# GNU General Public License for more details. | |
| 11 |
# | |
| 12 |
# You should have received a copy of the GNU General Public License | |
| 13 |
# version 2 along with this program; if not, write to the Free Software | |
| 14 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 15 |
| |
| 16 |
scope "/pliant/language/" "/pliant/install/" | |
| 17 |
module "/pliant/install/ring2.pli" | |
| 18 |
| |
| 19 |
| |
| 20 |
if os_api="linux" and default_charset_is_utf8 | |
| 21 |
function switch_to_UTF8 parameter filehandle | |
| 22 |
arg Address parameter ; arg Int filehandle | |
| 23 |
console character:27+"%G" | |
| 24 |
switch_to_UTF8 null 0 | |
| 25 |
gvar DelayedAction da | |
| 26 |
da function :> the_function switch_to_UTF8 Address Int | |
| 27 |
pliant_restore_actions append addressof:da | |
| 28 |
| |
| 29 |
| |
| 30 |
constant to_index (the_function '. to string' Universal Str -> Str):generic_index | |
| 31 |
| |
| 32 |
function to_string data options function -> string | |
| 33 |
arg Universal data ; arg Str options ; arg Function function ; arg Str string | |
| 34 |
indirect | |
| 35 |
| |
| 36 |
function console_universal u f | |
| 37 |
arg Universal u ; arg Function f | |
| 38 |
console (to_string u "con" f) | |
| 39 |
| |
| 40 |
meta console e | |
| 41 |
strong_definition | |
| 42 |
for (var Int i) 0 e:size-1 | |
| 43 |
if e:i:ident="eol" | |
| 44 |
e add (instruction (the_function console Str) (argument constant Str "[lf]")) | |
| 45 |
else | |
| 46 |
e:i compile ? | |
| 47 |
var Pointer:Type type :> e:i:result:type:real_data_type | |
| 48 |
e:i cast type ? | |
| 49 |
var Pointer:Function function :> type get_generic_method to_index | |
| 50 |
if addressof:function=null or addressof:function=addressof:(the_function '. to string' Universal Str -> Str) | |
| 51 |
return | |
| 52 |
e suckup e:i | |
| 53 |
e add (instruction (the_function console_universal Universal Function) e:i:result (argument mapped_constant Function function)) | |
| 54 |
e set_void_result | |
| 55 |
| |
| 56 |
export console | |
| |