示例#1
0
文件: input_output.py 项目: 8l/pycket
def open_outfile(w_str, mode):
    s = extract_path(w_str)
    return values.W_FileOutputPort(sio.open_file_as_stream(s, mode=mode))
示例#2
0
文件: input_output.py 项目: 8l/pycket
def do_has_custom_write(v):
    return values.w_false

def shutdown(env):
    # called before the interpreter exits
    stdout_port.flush()

############################ Values and Parameters

expose_val("eof", values.eof_object)

current_print_param = values_parameter.W_Parameter(standard_printer)
expose_val("current-print", current_print_param)

# line buffer stdout
stdout_port = values.W_FileOutputPort(sio.fdopen_as_stream(1, "w", buffering=1))
stderr_port = values.W_FileOutputPort(sio.fdopen_as_stream(2, "w", buffering=1))
stdin_port = values.W_FileInputPort(sio.fdopen_as_stream(0, "r"))
current_out_param = values_parameter.W_Parameter(stdout_port)
current_error_param = values_parameter.W_Parameter(stderr_port)
current_in_param = values_parameter.W_Parameter(stdin_port)

expose_val("current-output-port", current_out_param)
expose_val("current-error-port", current_error_param)
expose_val("current-input-port", current_in_param)

print_graph_param = values_parameter.W_Parameter(values.w_false)
print_struct_param = values_parameter.W_Parameter(values.w_false)
print_box_param = values_parameter.W_Parameter(values.w_false)
print_vector_length_param = values_parameter.W_Parameter(values.w_false)
print_hash_table_param = values_parameter.W_Parameter(values.w_false)