Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

string.h

Go to the documentation of this file.
00001  /*
00002   * plint/data/string.h : strings data structures
00003   * 
00004   * Time-stamp: <2002-12-21 14:26:17 gseba>
00005   * 
00006   * Copyright (C) Sebastian Glita, email: gseba@users.sourceforge.net
00007   * 
00008   * This file is part of plint.
00009   * 
00010   * plint is free software; you can  redistribute it and/or modify it under the
00011   * terms of the  GNU General Public License as published  by the Free Software
00012   * Foundation; either version 2, or (at your option) any later version.
00013   *
00014   * plint  is distributed  in the  hope  that it  will be  useful, but  WITHOUT
00015   * ANY  WARRANTY; without  even  the implied  warranty  of MERCHANTABILITY  or
00016   * FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU  General Public License for
00017   * more details.
00018   * 
00019   * You should  have received a  copy of the  GNU General Public  License along
00020   * with  plint; see  the file  COPYING.  If  not, write  to the  Free Software
00021   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA USA.
00022   *
00023   */
00024 
00025 #ifndef PLINT_DATA_TYPE_H
00026 #error Dont include me directly, but through data/type.h
00027 #endif
00028 
00043 struct _plint_str
00044 {
00045 
00046   size_t n;                             
00047   char * s;                             
00049 #define plint_str_n(__s__) (__s__).n
00050 #define plint_str_s(__s__) (__s__).s
00051 #define plint_str_sn(__s__) plint_str_s(__s__), plint_str_n(__s__)
00052 #define plint_hash_str(__h__, __hi__, __s__) (__s__).s = hash_getstr(__h__, __hi__, &(__s__).n)
00053 
00054 #define PLINT_str_INIT(__s__, __n__) { s:(__s__), n:(__n__) }
00055 #define PLINT_str_INIT_NUL PLINT_str_INIT(0,0)
00056 #define PLINT_str_NEW(__s__, __n__) ((__s__).s = malloc((((__s__).n = (__n__)) + 1) * sizeof(char)))
00057 #define PLINT_str_GROW(__s__, __x__) ((__s__).s = realloc((__s__).s, (((__s__).n __x__) + 1) * sizeof(char)))
00058 #define PLINT_str_EMPTY(__s__) 0[PLINT_str_NEW(__s__, 0)] = '\0'
00059 
00060 };
00061 
00062 
00063 __BEGIN_DECLS
00064 
00065 plint_str_t plint_str_new(char const * STRING, size_t LENGTH);
00066 inline plint_str_t plint_str_cpy(plint_str_t SOURCE);
00067 #define plint_str_dup plint_str_cpy
00068 
00069 int plint_str_equ(plint_str_t LEFT, plint_str_t RIGHT);
00070 int plint_str_neq(plint_str_t LEFT, plint_str_t RIGHT);
00071 
00072 void plint_str_cat(plint_str_t * PLEFT, plint_str_t RIGHT);
00073 plint_str_t plint_str_str(plint_str_t STRING, size_t FROM, size_t TO);
00074 #define plint_str_rev(__s__) plint_str_str(__s__, 0, 1)
00075 int plint_str_id(plint_str_t STRING);
00076 
00077 inline void plint_str_fre(plint_str_t STRING);
00078 
00079 inline plint_str_t plint_ptr_str(plint_ptr_t VALUE);
00080 inline plint_ptr_t plint_str_ptr(plint_str_t STRING);
00081 inline plint_ptr_t plint_str_set(plint_ptr_t VALUE, plint_str_t STRING);
00082 
00083 __END_DECLS
00084 
00085 

Generated on Thu Jan 9 19:02:39 2003 for plint by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002