Pipe::Pipe(int size) { func("Pipe::Pipe(%i)",size); pipesize = size; buffer = calloc(pipesize, 1); if(!buffer) error("FATAL: can't allocate %i bytes buffer for audio Pipe: %s", pipesize, strerror(errno)); bufferEnd=(char*)buffer+size; end=start=buffer; // set default types to simple bytes set_input_type("copy_byte"); set_output_type("copy_byte"); // set blocking timeout (ttl) defaults /* default blocking time is 50 millisecs * check read() and write() methods for implementation */ read_blocking = false; read_blocking_time = 50000; write_blocking = false; write_blocking_time = 50000; _thread_init(); sleep_time = 150; /* defaults to 150 microsecs */ //unlock(); }
void tm_frame_rep::interactive (object fun, scheme_tree p) { ASSERT (is_tuple (p), "tuple expected"); if (N(p) == 0) { string ret= object_to_string (call (fun)); if (ret != "" && ret != "<unspecified>" && ret != "#<unspecified>") set_message (verbatim (ret), "interactive command"); } else if (get_preference ("interactive questions") == "popup" || is_aux_buffer (get_current_buffer_safe ())) { int i, n= N(p); array<string> prompts (n); for (i=0; i<n; i++) prompts[i]= get_prompt (p, i); command cb= dialogue_command (get_server(), fun, p); widget wid= inputs_list_widget (cb, prompts); for (i=0; i<n; i++) { widget input_wid= get_form_field (wid, i); set_input_type (input_wid, get_type (p, i)); array<string> proposals= get_proposals (p, i); int j, k= N(proposals); if (k > 0) set_string_input (input_wid, proposals[0]); for (j=0; j<k; j++) add_input_proposal (input_wid, proposals[j]); } string title= translate ("Enter data"); if (ends (prompts[0], "?")) title= translate ("Question"); dialogue_start (title, wid); send_keyboard_focus (get_form_field (dialogue_wid, 0)); } else { if (concrete_window () -> get_interactive_mode ()) beep (); else { command interactive_cmd= tm_new<interactive_command_rep> (this, concrete_window (), fun, p); interactive_cmd (); } } }
/** * Sets the input types and returns the output type. For instance, * a sum aggregator when summing integers will return an integer, and when * summing doubles will return doubles. * * Default implementation assumes there is ony one input, and output * type is the same as input type. */ virtual flex_type_enum set_input_types(const std::vector<flex_type_enum>& types) { DASSERT_TRUE(types.size() == 1); return set_input_type(types[0]); }