X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=handy.h;h=ce2631f9d246b31adfad5f8da39d29239ad4245e;hb=a3dfe201291c96fc01babd3d4782d52ba945f2a3;hp=cd949885357190eb2a9f3c004c3fc7f347783002;hpb=8175356b4402d90d1aa6427725992225d7ec9fd1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/handy.h b/handy.h index cd94988..ce2631f 100644 --- a/handy.h +++ b/handy.h @@ -1,6 +1,6 @@ /* handy.h * - * Copyright (c) 1991-1999, Larry Wall + * Copyright (c) 1991-2000, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -19,6 +19,17 @@ #endif #define Null(type) ((type)NULL) + +/* +=for apidoc AmU||Nullch +Null character pointer. + +=for apidoc AmU||Nullsv +Null SV pointer. + +=cut +*/ + #define Nullch Null(char*) #define Nullfp Null(PerlIO*) #define Nullsv Null(SV*) @@ -108,12 +119,21 @@ typedef I16TYPE I16; typedef U16TYPE U16; typedef I32TYPE I32; typedef U32TYPE U32; -typedef I32TYPE I32; -typedef U32TYPE U32; -#ifdef Quad_t +#ifdef PERL_CORE +# ifdef HAS_QUAD +# if QUADKIND == QUAD_IS_INT64_T +# include +# ifdef I_INTTYPES /* e.g. Linux has int64_t without */ +# include +# endif +# endif typedef I64TYPE I64; typedef U64TYPE U64; -#endif +# endif +#endif /* PERL_CORE */ + +/* Mention I8SIZE, U8SIZE, I16SIZE, U16SIZE, I32SIZE, U32SIZE, + I64SIZE, and U64SIZE here so that metaconfig pulls them in. */ #if defined(UINT8_MAX) && defined(INT16_MAX) && defined(INT32_MAX) @@ -164,6 +184,43 @@ typedef U64TYPE U64; #define Ctl(ch) ((ch) & 037) +/* +=for apidoc Am|bool|strNE|char* s1|char* s2 +Test two strings to see if they are different. Returns true or +false. + +=for apidoc Am|bool|strEQ|char* s1|char* s2 +Test two strings to see if they are equal. Returns true or false. + +=for apidoc Am|bool|strLT|char* s1|char* s2 +Test two strings to see if the first, C, is less than the second, +C. Returns true or false. + +=for apidoc Am|bool|strLE|char* s1|char* s2 +Test two strings to see if the first, C, is less than or equal to the +second, C. Returns true or false. + +=for apidoc Am|bool|strGT|char* s1|char* s2 +Test two strings to see if the first, C, is greater than the second, +C. Returns true or false. + +=for apidoc Am|bool|strGE|char* s1|char* s2 +Test two strings to see if the first, C, is greater than or equal to +the second, C. Returns true or false. + +=for apidoc Am|bool|strnNE|char* s1|char* s2|STRLEN len +Test two strings to see if they are different. The C parameter +indicates the number of bytes to compare. Returns true or false. (A +wrapper for C). + +=for apidoc Am|bool|strnEQ|char* s1|char* s2|STRLEN len +Test two strings to see if they are equal. The C parameter indicates +the number of bytes to compare. Returns true or false. (A wrapper for +C). + +=cut +*/ + #define strNE(s1,s2) (strcmp(s1,s2)) #define strEQ(s1,s2) (!strcmp(s1,s2)) #define strLT(s1,s2) (strcmp(s1,s2) < 0) @@ -200,6 +257,39 @@ typedef U64TYPE U64; # endif #endif +/* +=for apidoc Am|bool|isALNUM|char ch +Returns a boolean indicating whether the C C is an ascii alphanumeric +character or digit. + +=for apidoc Am|bool|isALPHA|char ch +Returns a boolean indicating whether the C C is an ascii alphabetic +character. + +=for apidoc Am|bool|isSPACE|char ch +Returns a boolean indicating whether the C C is whitespace. + +=for apidoc Am|bool|isDIGIT|char ch +Returns a boolean indicating whether the C C is an ascii +digit. + +=for apidoc Am|bool|isUPPER|char ch +Returns a boolean indicating whether the C C is an uppercase +character. + +=for apidoc Am|bool|isLOWER|char ch +Returns a boolean indicating whether the C C is a lowercase +character. + +=for apidoc Am|char|toUPPER|char ch +Converts the specified character to uppercase. + +=for apidoc Am|char|toLOWER|char ch +Converts the specified character to lowercase. + +=cut +*/ + #define isALNUM(c) (isALPHA(c) || isDIGIT(c) || (c) == '_') #define isIDFIRST(c) (isALPHA(c) || (c) == '_') #define isALPHA(c) (isUPPER(c) || isLOWER(c)) @@ -388,6 +478,56 @@ typedef U16 line_t; --Andy Dougherty August 1996 */ +/* +=for apidoc Am|SV*|NEWSV|int id|STRLEN len +Creates a new SV. A non-zero C parameter indicates the number of +bytes of preallocated string space the SV should have. An extra byte for a +tailing NUL is also reserved. (SvPOK is not set for the SV even if string +space is allocated.) The reference count for the new SV is set to 1. +C is an integer id between 0 and 1299 (used to identify leaks). + +=for apidoc Am|void|New|int id|void* ptr|int nitems|type +The XSUB-writer's interface to the C C function. + +=for apidoc Am|void|Newc|int id|void* ptr|int nitems|type|cast +The XSUB-writer's interface to the C C function, with +cast. + +=for apidoc Am|void|Newz|int id|void* ptr|int nitems|type +The XSUB-writer's interface to the C C function. The allocated +memory is zeroed with C. + +=for apidoc Am|void|Renew|void* ptr|int nitems|type +The XSUB-writer's interface to the C C function. + +=for apidoc Am|void|Renewc|void* ptr|int nitems|type|cast +The XSUB-writer's interface to the C C function, with +cast. + +=for apidoc Am|void|Safefree|void* src|void* dest|int nitems|type +The XSUB-writer's interface to the C C function. + +=for apidoc Am|void|Move|void* src|void* dest|int nitems|type +The XSUB-writer's interface to the C C function. The C is the +source, C is the destination, C is the number of items, and C is +the type. Can do overlapping moves. See also C. + +=for apidoc Am|void|Copy|void* src|void* dest|int nitems|type +The XSUB-writer's interface to the C C function. The C is the +source, C is the destination, C is the number of items, and C is +the type. May fail on overlapping copies. See also C. + +=for apidoc Am|void|Zero|void* dest|int nitems|type + +The XSUB-writer's interface to the C C function. The C is the +destination, C is the number of items, and C is the type. + +=for apidoc Am|void|StructCopy|type src|type dest|type +This is an architecture-independant macro to copy one structure to another. + +=cut +*/ + #ifndef lint #define NEWSV(x,len) newSV(len)