Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

new_string.h

Go to the documentation of this file.
00001 #ifndef string_TYPE
00002 #define string_TYPE
00003 
00004 /*
00005  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
00006  *      For copying and distribution information, see the file
00007  *      "mit-copyright.h".
00008  *
00009  *      Modified for jwgc by Daniel Henninger.
00010  */
00011 
00012 #include "mit-copyright.h"
00013 
00014 #include <string.h>
00015 
00016 typedef char *string;
00017 
00018 /*
00019  *    int string_Length(string s):
00020  *        Effects: Returns the number of non-null characters in s.
00021  */
00022 
00023 #define string_Length(s) strlen(s)
00024 
00025 /*
00026  *    int string_Eq(string a, b):
00027  *        Effects: Returns true iff strings a & b are equal.  I.e., have the
00028  *                 same character contents.
00029  */
00030 
00031 #define string_Eq(a,b) (!strcmp(a,b))
00032 
00033 /*
00034  *    int string_Neq(string a, b):
00035  *        Effects: Returns true iff strings a & b are not equal.
00036  */
00037 
00038 #define string_Neq(a,b) (strcmp(a,b))
00039 
00040 /*
00041  *    string string_CreateFromData(char *data, int length):
00042  *        Requires: data[0], data[1], ..., data[length-1] != 0
00043  *        Effects: Takes the first length characters at data and
00044  *                 creates a string containing them.  The returned string
00045  *                 is on the heap & must be freed eventually.
00046  *                 I.e., if passed "foobar" and 3, it would return
00047  *                 string_Copy("foo").
00048  */
00049 
00050 extern string string__CreateFromData();
00051 #define string_CreateFromData(data,length)  string__CreateFromData(data,length)
00052 
00053 /*
00054  *    string string_Copy(string s):
00055  *        Effects: Returns a copy of s on the heap.  The copy must be
00056  *                 freed eventually.
00057  */
00058 
00059 extern string string__Copy(/* string s */);
00060 #define string_Copy(data)  string__Copy(data)
00061 
00062 /*
00063  *    string string_Concat(string a, b):
00064  *        Effects: Returns a string equal to a concatenated to b.
00065  *                 The returned string is on the heap and must be
00066  *                 freed eventually.  I.e., given "abc" and "def",
00067  *                 returns string_Copy("abcdef").
00068  */
00069 
00070 extern string string__Concat(/* string a, b */);
00071 #define string_Concat(a,b)  string__Concat(a,b)
00072     
00073 /*
00074  *    string string_Concat2(string a, b):
00075  *        Modifies: a
00076  *        Requires: a is on the heap, b does not point into a.
00077  *        Effects: Equivalent to:
00078  *                     string temp;
00079  *                     temp = string_Concat(a,b);
00080  *                     free(a);
00081  *                     return(temp);
00082  *                 only faster.  I.e., uses realloc instead of malloc+bcopy.
00083  */
00084 
00085 extern string string__Concat2(/* string a, b */);
00086 #define string_Concat2(a,b)  string__Concat2(a,b)
00087 
00088 /*
00089  *    string string_Downcase(string s):
00090  *        Modifies: s
00091  *        Effects: Modifies s by changing every uppercase character in s
00092  *                 to the corresponding lowercase character.  Nothing else
00093  *                 is changed.  I.e., "FoObAr19." is changed to "foobar19.".
00094  *                 S is returned as a convenience.
00095  */
00096 
00097 extern string string_Downcase();
00098 
00099 /*
00100  *    string string_Upcase(string s):
00101  *        Modifies: s
00102  *        Effects: Modifies s by changing every lowercase character in s
00103  *                 to the corresponding uppercase character.  Nothing else
00104  *                 is changed.  I.e., "FoObAr19." is changed to "FOOBAR19.".
00105  *                 S is returned as a convenience.
00106  */
00107 
00108 extern string string_Upcase();
00109 
00110 #endif


Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo
Source Perspective by Fisheye