Fwd: scintilla
| From: | Andrei Zmievski | Date: | Sun, 17 Dec 2006 21:36:06 +0000 |
| Subject: | Fwd: scintilla | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-3559@lists.php.net to get a copy of this message | ||
So it doesn't get lost.
-Andrei
Begin forwarded message:
From: "Pablo Dall'Oglio" <pablo@dalloglio.net> Date: November 4, 2006 10:22:09 AM PST To: Andrei Zmievski <andrei@gravitonic.com> Subject: scintilla Hi Andrei, I finally got scintilla compiled on my ubuntu. Now I started to port Tulip Editor to php-gtk2. I needed get_cur_line() method but it was not working so I adapted the code of scintilla from php-gtk1. It worked fine, but I'm not a C programmer, Could you tell me if this code is terrible or is a candidate for CVS ? If yes, it will be my first contribution to the project :-) A very humble contribution... best regards Pablo static PHP_METHOD(GtkScintilla, get_cur_line) {long length, line_pos; char *text; gchar *cp_ret; gsize cp_len; zend_bool free_result; NOT_STATIC_METHOD();if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return;GtkScintilla *scintilla = GTK_SCINTILLA(PHPG_GOBJECT(this_ptr));length = gtk_scintilla_line_length(scintilla,gtk_scintilla_line_from_position(scintilla, gtk_scintilla_get_current_pos(scintilla))) + 1;text = (char *)emalloc(length); line_pos = gtk_scintilla_get_cur_line(scintilla, length, text); cp_ret = phpg_from_utf8(text, strlen(text), &cp_len,&free_result TSRMLS_CC);if (cp_ret) { RETVAL_STRINGL((char *)cp_ret, cp_len, 1); } else { php_error(E_WARNING, "%s::%s(): could not convert return value from UTF-8", get_active_class_name(NULL TSRMLS_CC),get_active_function_name(TSRMLS_C));} if (free_result) g_free(cp_ret);} --:: Pablo Dall'Oglio :: www.dalloglio.net