pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.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: pike_types.c,v 1.334 2008/05/14 16:02:04 grubba Exp $ + || $Id: pike_types.c,v 1.335 2008/05/17 22:48:32 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:90:   PMOD_EXPORT struct pike_type *program_type_string;   PMOD_EXPORT struct pike_type *array_type_string;   PMOD_EXPORT struct pike_type *multiset_type_string;   PMOD_EXPORT struct pike_type *mapping_type_string;   PMOD_EXPORT struct pike_type *type_type_string;   PMOD_EXPORT struct pike_type *mixed_type_string;   PMOD_EXPORT struct pike_type *void_type_string;   PMOD_EXPORT struct pike_type *zero_type_string;   PMOD_EXPORT struct pike_type *any_type_string;   PMOD_EXPORT struct pike_type *weak_type_string; /* array|mapping|multiset|function */ + struct pike_type *sscanf_type_string; + struct pike_type *sscanf_76_type_string;      #ifdef DO_PIKE_CLEANUP   struct pike_type_location *all_pike_type_locations = NULL;   #endif /* DO_PIKE_CLEANUP */      static struct pike_type *a_markers[10], *b_markers[10];      static struct program *implements_a;   static struct program *implements_b;   static int implements_mode;
pike.git/src/pike_types.c:6694:    /* Not a callable. */    break;    }       return res;   }      /* NOTE: fun_type loses a reference. */   struct pike_type *new_check_call(struct pike_string *fun_name,    struct pike_type *fun_type, -  node *args, INT32 *argno) +  node *args, INT32 *argno, INT32 flags)   {    struct compilation *c = THIS_COMPILATION;    struct pike_type *tmp = NULL;    struct pike_type *res = NULL;    struct svalue *sval = NULL; -  int flags = 0; +        CHECK_COMPILER();       debug_malloc_touch(fun_type);    -  while (args && (args->token == F_ARG_LIST) && fun_type) { -  fun_type = new_check_call(fun_name, fun_type, CAR(args), argno); +  while (args && +  ((args->token == F_ARG_LIST) || (args->token == F_LVALUE_LIST)) && +  fun_type) { +  if (args->token == F_LVALUE_LIST) flags |= CALL_ARG_LVALUE; +  fun_type = new_check_call(fun_name, fun_type, CAR(args), argno, flags);    debug_malloc_touch(fun_type);    args = CDR(args);    }       if (!args || !fun_type) {    debug_malloc_touch(fun_type);    return fun_type;    }       (*argno)++;
pike.git/src/pike_types.c:6816:   #endif /* PIKE_DEBUG */       return res;    } else if ((res = low_new_check_call(fun_type, args->type, flags, sval))) {    /* OK. */   #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " OK.\n");    }   #endif /* PIKE_DEBUG */ -  if (c->lex.pragmas & ID_STRICT_TYPES) { +  if ((c->lex.pragmas & ID_STRICT_TYPES) && +  /* FIXME: Strict types not supported for lvalues yet. */ +  !(flags & CALL_ARG_LVALUE)){    if (!(tmp = low_new_check_call(fun_type, args->type,    flags|CALL_STRICT, sval))) {    yywarning("Type mismatch in argument %d to %S.",    *argno, fun_name);    if ((tmp = get_first_arg_type(fun_type, 0))) {    yytype_error(NULL, tmp, args->type, YYTE_IS_WARNING);    free_type(tmp);    } else {    yytype_error(NULL, NULL, args->type, YYTE_IS_WARNING);    }
pike.git/src/pike_types.c:7759:    array_type_string = CONSTTYPE(tArray);    multiset_type_string = CONSTTYPE(tMultiset);    mapping_type_string = CONSTTYPE(tMapping);    function_type_string = CONSTTYPE(tFunction);    type_type_string = CONSTTYPE(tType(tMix));    void_type_string = CONSTTYPE(tVoid);    zero_type_string = CONSTTYPE(tZero);    any_type_string = CONSTTYPE(tOr(tVoid,tMix));    weak_type_string = CONSTTYPE(tOr4(tArray,tMultiset,tMapping,    tFuncV(tNone,tZero,tOr(tMix,tVoid)))); +  sscanf_type_string = CONSTTYPE(tFuncV(tStr tAttr("sscanf_format", tStr), +  tAttr("sscanf_args", tMix), tIntPos)); +  sscanf_76_type_string = CONSTTYPE(tFuncV(tStr tAttr("sscanf_76_format", tStr), +  tAttr("sscanf_args", tMix), tIntPos));    /* add_ref(weak_type_string); *//* LEAK */      #ifdef PIKE_DEBUG    pike_type_gc_callback = add_gc_callback(gc_mark_external_types, NULL, NULL);   #endif   }      void cleanup_pike_types(void)   {   #ifdef DO_PIKE_CLEANUP
pike.git/src/pike_types.c:7809:    free_type(mixed_type_string);    mixed_type_string = NULL;    free_type(void_type_string);    void_type_string = NULL;    free_type(zero_type_string);    zero_type_string = NULL;    free_type(any_type_string);    any_type_string = NULL;    free_type(weak_type_string);    weak_type_string = NULL; -  +  free_type(sscanf_type_string); +  sscanf_type_string = NULL; +  free_type(sscanf_76_type_string); +  sscanf_76_type_string = NULL;   #ifdef PIKE_DEBUG    remove_callback(pike_type_gc_callback);   #endif   }      void cleanup_pike_type_table(void)   {    /* Free the hashtable here. */    if (pike_type_hash) {    free(pike_type_hash);