Enlightenment CVS committal Author : mej Project : eterm Module : libast
Dir : eterm/libast/src Modified Files: Makefile.am debug.c str.c Added Files: mbuff.c Log Message: Tue Dec 14 17:51:20 2004 Michael Jennings (mej) More work from my vacation. Turned the string class into both an interface and an implementation, and created a new multipurpose buffer class (untested) for arbitrary text/binary data. (Think "strings with embedded newlines" if that helps.) Now, if someone were so inclined, (s)he could create a LibAST implementation of the "str" interface based on glib strings, or QStrings, or whatever with almost no changes to the code using the libast string API (once the function calls like spif_str_new() are replaced with macro calls like SPIF_STR_NEW()). A UTF-8-based string implementation is forthcoming. ---------------------------------------------------------------------- =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- Makefile.am 26 Oct 2004 16:06:50 -0000 1.14 +++ Makefile.am 15 Dec 2004 00:00:22 -0000 1.15 @@ -4,9 +4,9 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/$(PACKAGE) -libast_la_SOURCES = \ - array.c builtin_hashes.c conf.c debug.c dlinked_list.c file.c \ - linked_list.c mem.c msgs.c obj.c objpair.c options.c regexp.c \ - socket.c str.c strings.c snprintf.c tok.c url.c +libast_la_SOURCES = \ + array.c builtin_hashes.c conf.c debug.c dlinked_list.c file.c \ + linked_list.c mbuff.c mem.c msgs.c obj.c objpair.c options.c \ + regexp.c socket.c str.c strings.c snprintf.c tok.c url.c libast_la_LDFLAGS = -version-info 2:1:0 =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/debug.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- debug.c 23 Jul 2004 21:38:39 -0000 1.13 +++ debug.c 15 Dec 2004 00:00:22 -0000 1.14 @@ -28,11 +28,11 @@ * This file contains all non-cpp-based debugging functionality. * * @author Michael Jennings <[EMAIL PROTECTED]> - * $Revision: 1.13 $ - * $Date: 2004/07/23 21:38:39 $ + * $Revision: 1.14 $ + * $Date: 2004/12/15 00:00:22 $ */ -static const char __attribute__((unused)) cvs_ident[] = "$Id: debug.c,v 1.13 2004/07/23 21:38:39 mej Exp $"; +static const char __attribute__((unused)) cvs_ident[] = "$Id: debug.c,v 1.14 2004/12/15 00:00:22 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -152,7 +152,7 @@ */ /** - * @mainpage LibAST 0.6 Documentation + * @mainpage LibAST 0.6.1 Documentation * * This document describes the various features and capabilities * offered by LibAST, the Library of Assorted Spiffy Things. As its =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/str.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- str.c 23 Jul 2004 21:38:39 -0000 1.31 +++ str.c 15 Dec 2004 00:00:22 -0000 1.32 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char __attribute__((unused)) cvs_ident[] = "$Id: str.c,v 1.31 2004/07/23 21:38:39 mej Exp $"; +static const char __attribute__((unused)) cvs_ident[] = "$Id: str.c,v 1.32 2004/12/15 00:00:22 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -30,18 +30,60 @@ #include <libast_internal.h> /* *INDENT-OFF* */ -static SPIF_CONST_TYPE(class) s_class = { - SPIF_DECL_CLASSNAME(str), - (spif_func_t) spif_str_new, - (spif_func_t) spif_str_init, - (spif_func_t) spif_str_done, - (spif_func_t) spif_str_del, - (spif_func_t) spif_str_show, - (spif_func_t) spif_str_comp, - (spif_func_t) spif_str_dup, - (spif_func_t) spif_str_type +static SPIF_CONST_TYPE(strclass) s_class = { + { + SPIF_DECL_CLASSNAME(str), + (spif_func_t) spif_str_new, + (spif_func_t) spif_str_init, + (spif_func_t) spif_str_done, + (spif_func_t) spif_str_del, + (spif_func_t) spif_str_show, + (spif_func_t) spif_str_comp, + (spif_func_t) spif_str_dup, + (spif_func_t) spif_str_type + }, + (spif_func_t) spif_str_new_from_ptr, + (spif_func_t) spif_str_new_from_buff, + (spif_func_t) spif_str_new_from_fp, + (spif_func_t) spif_str_new_from_fd, + (spif_func_t) spif_str_new_from_num, + (spif_func_t) spif_str_init_from_ptr, + (spif_func_t) spif_str_init_from_buff, + (spif_func_t) spif_str_init_from_fp, + (spif_func_t) spif_str_init_from_fd, + (spif_func_t) spif_str_init_from_num, + (spif_func_t) spif_str_append, + (spif_func_t) spif_str_append_char, + (spif_func_t) spif_str_append_from_ptr, + (spif_func_t) spif_str_casecmp, + (spif_func_t) spif_str_casecmp_with_ptr, + (spif_func_t) spif_str_clear, + (spif_func_t) spif_str_cmp, + (spif_func_t) spif_str_cmp_with_ptr, + (spif_func_t) spif_str_downcase, + (spif_func_t) spif_str_find, + (spif_func_t) spif_str_find_from_ptr, + (spif_func_t) spif_str_index, + (spif_func_t) spif_str_ncasecmp, + (spif_func_t) spif_str_ncasecmp_with_ptr, + (spif_func_t) spif_str_ncmp, + (spif_func_t) spif_str_ncmp_with_ptr, + (spif_func_t) spif_str_prepend, + (spif_func_t) spif_str_prepend_char, + (spif_func_t) spif_str_prepend_from_ptr, + (spif_func_t) spif_str_reverse, + (spif_func_t) spif_str_rindex, + (spif_func_t) spif_str_splice, + (spif_func_t) spif_str_splice_from_ptr, + (spif_func_t) spif_str_substr, + (spif_func_t) spif_str_substr_to_ptr, + (spif_func_t) spif_str_to_float, + (spif_func_t) spif_str_to_num, + (spif_func_t) spif_str_trim, + (spif_func_t) spif_str_upcase }; -SPIF_TYPE(class) SPIF_CLASS_VAR(str) = &s_class; +SPIF_TYPE(class) SPIF_CLASS_VAR(str) = SPIF_CAST(class) &s_class; +SPIF_TYPE(strclass) SPIF_STRCLASS_VAR(str) = &s_class; /* *INDENT-ON* */ const size_t buff_inc = 4096; @@ -129,7 +171,7 @@ { ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); self->s = SPIF_NULL_TYPE(charptr); self->len = 0; self->size = 0; @@ -142,7 +184,7 @@ ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); REQUIRE_RVAL((old != SPIF_NULL_TYPE(charptr)), spif_str_init(self)); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); self->len = strlen(SPIF_CONST_CAST_C(char *) old); self->size = self->len + 1; self->s = SPIF_CAST(charptr) MALLOC(self->size); @@ -155,7 +197,7 @@ { ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); self->size = size; if (buff != SPIF_NULL_TYPE(charptr)) { self->len = strnlen(SPIF_CONST_CAST_C(char *) buff, size); @@ -181,7 +223,7 @@ ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); ASSERT_RVAL((fp != SPIF_NULL_TYPE_C(FILE *)), FALSE); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); self->size = buff_inc; self->len = 0; self->s = SPIF_CAST(charptr) MALLOC(self->size); @@ -213,7 +255,7 @@ ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); ASSERT_RVAL((fd >= 0), FALSE); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); self->size = buff_inc; self->len = 0; self->s = SPIF_CAST(charptr) MALLOC(self->size); @@ -237,7 +279,7 @@ ASSERT_RVAL(!SPIF_STR_ISNULL(self), FALSE); /* ***NOT NEEDED*** spif_obj_init(SPIF_OBJ(self)); */ - spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS_VAR(str)); + spif_obj_set_class(SPIF_OBJ(self), SPIF_CLASS(SPIF_STRCLASS_VAR(str))); snprintf(SPIF_CHARPTR_C(buff), sizeof(buff), "%ld", num); self->len = strlen(SPIF_CHARPTR_C(buff)); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs