Changeset 61abb18
- Timestamp:
- Aug 10, 2008, 10:53:16 AM (16 years ago)
- Branches:
- barnowl_perlaim
- Parents:
- 3dcccba
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r3dcccba r61abb18 2471 2471 { 2472 2472 char *text = owl_strdup(owl_editwin_get_text(e)); 2473 void (*callback)(void *, char *)= owl_editwin_get_callback(e);2473 owl_callback_t callback = owl_editwin_get_callback(e); 2474 2474 void *cbdata = owl_editwin_get_cbdata(e); 2475 2475 -
editwin.c
r3dcccba r61abb18 84 84 } 85 85 86 void owl_editwin_set_command(owl_editwin *e, char *command) { 87 if(e->command) owl_free(e->command); 88 e->command = owl_strdup(command); 89 } 90 91 char *owl_editwin_get_command(owl_editwin *e) { 92 if(e->command) return e->command; 93 return ""; 94 } 95 96 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(void*, char*)) { 86 void owl_editwin_set_callback(owl_editwin *e, owl_callback_t cb, void *cbdata) { 97 87 e->callback = cb; 98 } 99 100 void (*owl_editwin_get_callback(owl_editwin*))(void *cbdata, char *text) { 88 e->cbdata = cbdata; 89 } 90 91 owl_callback_t owl_editwin_get_callback(owl_editwin *e) { 101 92 return e->callback; 102 }103 104 void owl_editwin_set_cbdata(owl_editwin *e, void *data) {105 e->cbdata = data;106 93 } 107 94 … … 112 99 void owl_editwin_do_callback(owl_editwin *e) { 113 100 /* XXX get rid of me */ 114 void (*cb)(void*, char*); 115 cb=owl_editwin_get_callback(e); 101 owl_callback_t cb = owl_editwin_get_callback(e); 116 102 if(!cb) { 117 103 owl_function_error("Internal error: No editwin callback!"); 118 104 } else { 119 105 /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */ 120 cb(e->cbdata, e->text);106 cb(e->cbdata, owl_editwin_get_text(e)); 121 107 } 122 108 } -
functions.c
r3dcccba r61abb18 268 268 owl_global_set_typwin_active(&g); 269 269 270 owl_global_set_buffercommand(&g, line); 271 owl_global_set_buffercallback(&g, &owl_callback_zwrite); 270 owl_global_set_buffercallback(&g, &owl_callback_zwrite, line); 272 271 } 273 272 … … 293 292 owl_global_set_typwin_active(&g); 294 293 295 owl_global_set_buffercommand(&g, "loopwrite"); 296 owl_global_set_buffercallback(&g, &owl_callback_loopwrite); 297 } 298 299 void owl_callback_zwrite(owl_editwin *e) { 300 owl_function_zwrite(owl_editwin_get_command(e), 301 owl_editwin_get_text(e)); 294 owl_global_set_buffercallback(&g, &owl_callback_loopwrite, "loopwrite"); 295 } 296 297 void owl_callback_zwrite(void *cbdata, char *text) { 298 owl_function_zwrite((char *)cbdata, text); 302 299 } 303 300 … … 398 395 } 399 396 400 void owl_callback_loopwrite( owl_editwin *e) {401 owl_function_loopwrite( owl_editwin_get_text(e));397 void owl_callback_loopwrite(void *cbdata, char *text) { 398 owl_function_loopwrite(text); 402 399 } 403 400 -
global.c
rc453ada r61abb18 237 237 } 238 238 239 /* buffercommand */ 240 241 void owl_global_set_buffercommand(owl_global *g, char *command) { 242 owl_editwin_set_command(owl_global_get_typwin(g), command); 243 } 244 245 char *owl_global_get_buffercommand(owl_global *g) { 246 return owl_editwin_get_command(owl_global_get_typwin(g)); 247 } 248 249 void owl_global_set_buffercallback(owl_global *g, void (*cb)(owl_editwin*)) { 250 owl_editwin_set_callback(owl_global_get_typwin(g), cb); 251 } 252 253 void (*owl_global_get_buffercallback(owl_global *g))(owl_editwin*) { 254 return owl_editwin_get_callback(owl_global_get_typwin(g)); 239 /* buffercallback */ 240 241 void owl_global_set_buffercallback(owl_global *g, owl_callback_t cb, char *line) { 242 owl_editwin_set_callback(owl_global_get_typwin(g), cb, line); 255 243 } 256 244 -
owl.h
r3dcccba r61abb18 203 203 204 204 #define LINE 2048 205 206 typedef void (*owl_callback_t)(void *cbdata, char *text); 205 207 206 208 typedef struct _owl_variable { … … 452 454 int echochar; 453 455 454 char *command; 455 void (*callback)(void *, char *); 456 owl_callback_t callback; 456 457 void *cbdata; 457 458 } owl_editwin; -
perlconfig.c
r3dcccba r61abb18 472 472 } 473 473 474 void owl_perlconfig_edit_callback(void *cbdata, char *c_text) ;474 void owl_perlconfig_edit_callback(void *cbdata, char *c_text) 475 475 { 476 476 SV *cb = (SV*)cbdata; … … 479 479 dSP; 480 480 481 e->cbdata = NULL;482 481 if(cb == NULL) { 483 482 owl_function_error("Perl callback is NULL!"); -
perlglue.xs
rb67ab6b r61abb18 166 166 167 167 SvREFCNT_inc(callback); 168 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 169 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 168 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback, callback); 170 169 } 171 170 … … 182 181 183 182 SvREFCNT_inc(callback); 184 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 185 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 183 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback, callback); 186 184 } 187 185 … … 208 206 209 207 SvREFCNT_inc(callback); 210 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 211 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 208 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback, callback); 212 209 } 213 210
Note: See TracChangeset
for help on using the changeset viewer.