#NEWLINE# @ expose ( 'call-with-output-file' , [ values . W_Object , values . W_Object , default ( values . W_Symbol , w_binary_sym ) , default ( values . W_Symbol , w_error_sym ) ] , simple = False ) #NEWLINE# def call_with_output_file( s , proc , mode , exists , env , cont ) : #NEWLINE# #INDENT# m = '' #NEWLINE# if ( exists is w_append_sym ) : #NEWLINE# #INDENT# m += 'a' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( exists is w_truncate_sym ) or w_truncate_replace_sym ) : #NEWLINE# #INDENT# m += 'w' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise SchemeException ( ( 'mode not yet supported: %s' % exists . tostring ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( mode is not w_text_sym ) : #NEWLINE# #INDENT# m += 'b' #NEWLINE# #UNINDENT# port = open_outfile ( s , m ) #NEWLINE# return proc . call ( [ port ] , env , close_cont ( port , env , cont ) )