pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.519 2003/11/14 10:13:39 mast Exp $ + || $Id: builtin_functions.c,v 1.520 2003/11/14 11:00:44 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.519 2003/11/14 10:13:39 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.520 2003/11/14 11:00:44 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:1637:    *! Throws an error if characters not valid in an UTF8 stream are    *! encountered. Valid characters are in the range 0x00000000 - 0x7fffffff.    *!    *! If @[extended] is 1, characters in the range 0x80000000-0xfffffffff    *! will also be accepted, and encoded using a non-standard UTF8 extension.    *!    *! @seealso    *! @[Locale.Charset.encoder()], @[string_to_unicode()],    *! @[unicode_to_string()], @[utf8_to_string()]    */ - void f_string_to_utf8(INT32 args) + PMOD_EXPORT void f_string_to_utf8(INT32 args)   {    ptrdiff_t len;    struct pike_string *in;    struct pike_string *out;    ptrdiff_t i,j;    int extended = 0;       get_all_args("string_to_utf8", args, "%W", &in);       if (args > 1) {
pike.git/src/builtin_functions.c:5841:    *! }),    *! ({    *! 2    *! })    *! })    *! @}    *!    *! @seealso    *! @[diff()], @[diff_longest_sequence()], @[String.fuzzymatch()]    */ - void f_diff_compare_table(INT32 args) + PMOD_EXPORT void f_diff_compare_table(INT32 args)   {    struct array *a;    struct array *b;    struct array *cmptbl;       get_all_args("diff_compare_table", args, "%a%a", &a, &b);       cmptbl = diff_compare_table(a, b, NULL);       pop_n_elems(args);
pike.git/src/builtin_functions.c:5863:   }      /*! @decl array(int) diff_longest_sequence(array a, array b)    *!    *! Gives the longest sequence of indices in @[b] that have corresponding    *! values in the same order in @[a].    *!    *! @seealso    *! @[diff()], @[diff_compare_table()], @[String.fuzzymatch()]    */ - void f_diff_longest_sequence(INT32 args) + PMOD_EXPORT void f_diff_longest_sequence(INT32 args)   {    struct array *a;    struct array *b;    struct array *seq;    struct array *cmptbl;       get_all_args("diff_longest_sequence", args, "%a%a", &a, &b);       cmptbl = diff_compare_table(a, b, NULL);   
pike.git/src/builtin_functions.c:5895:    *! values in the same order in @[a].    *!    *! This function performs the same operation as @[diff_longest_sequence()],    *! but uses a different algorithm, which in some rare cases might be faster    *! (usually it's slower though).    *!    *! @seealso    *! @[diff_longest_sequence()], @[diff()], @[diff_compare_table()],    *! @[String.fuzzymatch()]    */ - void f_diff_dyn_longest_sequence(INT32 args) + PMOD_EXPORT void f_diff_dyn_longest_sequence(INT32 args)   {    struct array *a;    struct array *b;    struct array *seq;    struct array *cmptbl;       get_all_args("diff_dyn_longest_sequence", args, "%a%a", &a, &b);       cmptbl=diff_compare_table(a, b, NULL);   
pike.git/src/builtin_functions.c:6164:    if(Pike_sp[-args].type > MAX_REF_TYPE)    SIMPLE_BAD_ARG_ERROR("refs", 1,    "array|mapping|multiset|object|"    "function|program|string");       i=Pike_sp[-args].u.refs[0];    pop_n_elems(args);    push_int(i);   }    -  + #ifdef PIKE_DEBUG   /* This function is for debugging *ONLY*    * do not document please. /Hubbe    */   PMOD_EXPORT void f__leak(INT32 args)   {    INT32 i;       if(!args)    SIMPLE_TOO_FEW_ARGS_ERROR("_leak", 1);       if(Pike_sp[-args].type > MAX_REF_TYPE)    SIMPLE_BAD_ARG_ERROR("_leak", 1,    "array|mapping|multiset|object|"    "function|program|string");       add_ref(Pike_sp[-args].u.dummy);    i=Pike_sp[-args].u.refs[0];    pop_n_elems(args);    push_int(i);   } -  + #endif      /*! @decl type _typeof(mixed x)    *!    *! Return the runtime type of @[x].    *!    *! @seealso    *! @[typeof()]    */   PMOD_EXPORT void f__typeof(INT32 args)   {
pike.git/src/builtin_functions.c:6580:   /*! @decl array(mixed) everynth(array(mixed) a, void|int n, @    *! void|int start)    *!    *! Return an array with every @[n]:th element of the array @[a].    *!    *! If @[n] is zero every other element will be returned.    *!    *! @seealso    *! @[splice()], @[`/()]    */ - void f_everynth(INT32 args) + PMOD_EXPORT void f_everynth(INT32 args)   {    INT32 k,n=2;    INT32 start=0;    struct array *a;    struct array *ina;    TYPE_FIELD types;    INT32 size=0;       check_all_args("everynth", args,    BIT_ARRAY, BIT_INT | BIT_VOID, BIT_INT | BIT_VOID , 0);
pike.git/src/builtin_functions.c:7883:    tFunc(tOr(tInt,tVoid),tInt), OPT_EXTERNAL_DEPEND);    ADD_EFUN("gethrtime", f_gethrtime,    tFunc(tOr(tInt,tVoid),tInt), OPT_EXTERNAL_DEPEND);      #ifdef PROFILING    ADD_EFUN("get_profiling_info", f_get_prof_info,    tFunc(tPrg(tObj),tArray), OPT_EXTERNAL_DEPEND);   #endif /* PROFILING */       ADD_EFUN("_refs",f__refs,tFunc(tRef,tInt),OPT_EXTERNAL_DEPEND); + #ifdef PIKE_DEBUG    ADD_EFUN("_leak",f__leak,tFunc(tRef,tInt),OPT_EXTERNAL_DEPEND); -  + #endif    ADD_EFUN("_typeof", f__typeof, tFunc(tSetvar(0, tMix), tType(tVar(0))), 0);       /* class __master    * Used to prototype the master object.    */    start_new_program();    ADD_PROTOTYPE("_main", tFunc(tArr(tStr) tArr(tStr),tVoid), 0);       ADD_PROTOTYPE("cast_to_object", tFunc(tString tString, tObj), 0);    ADD_PROTOTYPE("cast_to_program", tFunc(tStr tStr tOr(tVoid, tObj), tPrg(tObj)), 0);