~dexter/parrot-pkg/maverick

« back to all changes in this revision

Viewing changes to src/multidispatch.c

  • Committer: Piotr Roszatycki
  • Date: 2011-01-11 14:34:28 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: piotr.roszatycki@gmail.com-20110111143428-s7pa7qz38m61o4tw
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
Copyright (C) 2003-2010, Parrot Foundation.
3
 
$Id: multidispatch.c 48790 2010-09-04 20:06:03Z plobsing $
4
3
 
5
4
=head1 NAME
6
5
 
401
400
        STRING *type_name = VTABLE_get_string_keyed_int(interp, type_list, i);
402
401
        INTVAL  type;
403
402
 
404
 
        if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
 
403
        if (STRING_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
405
404
            type = enum_type_PMC;
406
 
        else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "STRING")))
 
405
        else if (STRING_equal(interp, type_name, CONST_STRING(interp, "STRING")))
407
406
            type = enum_type_STRING;
408
 
        else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
 
407
        else if (STRING_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
409
408
            type = enum_type_INTVAL;
410
 
        else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
 
409
        else if (STRING_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
411
410
            type = enum_type_FLOATVAL;
412
411
        else
413
412
            type = Parrot_pmc_get_type_str(interp, type_name);
727
726
        {
728
727
            STRING *s1, *s2;
729
728
            if (type_sig < 0)
730
 
                s1 = Parrot_get_datatype_name(interp, type_sig);
 
729
                s1 = Parrot_dt_get_datatype_name(interp, type_sig);
731
730
            else
732
731
                s1 = interp->vtables[type_sig]->whoami;
733
732
 
734
733
            if (type_call < 0)
735
 
                s2 = Parrot_get_datatype_name(interp, type_call);
 
734
                s2 = Parrot_dt_get_datatype_name(interp, type_call);
736
735
            else
737
736
                s2 = interp->vtables[type_call]->whoami;
738
737
 
944
943
    PMC        *multi_sub = Parrot_ns_get_global(interp, ns, sub_name);
945
944
 
946
945
    if (PMC_IS_NULL(multi_sub)) {
947
 
        multi_sub = Parrot_pmc_new_constant(interp, enum_class_MultiSub);
 
946
        multi_sub = Parrot_pmc_new(interp, enum_class_MultiSub);
948
947
        Parrot_ns_set_global(interp, ns, sub_name, multi_sub);
949
948
    }
950
949
 
1070
1069
        STRING   *ns_name   = mmd_info[i].ns_name;
1071
1070
 
1072
1071
        /* Create an NCI sub for the C function */
1073
 
        PMC    *sub_obj       = Parrot_pmc_new_constant(interp, enum_class_NCI);
 
1072
        PMC    *sub_obj       = Parrot_pmc_new(interp, enum_class_NCI);
1074
1073
 
1075
1074
        VTABLE_set_pointer_keyed_str(interp, sub_obj, short_sig,
1076
1075
                                     F2DPTR(func_ptr));
1146
1145
    if (name)
1147
1146
        strcpy((char *)(type_ids + num_values), name);
1148
1147
 
1149
 
    key = Parrot_str_new(interp, (char *)type_ids, id_size);
 
1148
    key = Parrot_str_new_init(interp, (char *)type_ids, id_size,
 
1149
            Parrot_binary_encoding_ptr, 0);
1150
1150
    mem_gc_free(interp, type_ids);
1151
1151
 
1152
1152
    return key;
1248
1248
    if (name)
1249
1249
        strcpy((char *)(type_ids + num_types), name);
1250
1250
 
1251
 
    key = Parrot_str_new(interp, (char *)type_ids, id_size);
 
1251
    key = Parrot_str_new_init(interp, (char *)type_ids, id_size,
 
1252
            Parrot_binary_encoding_ptr, 0);
1252
1253
 
1253
1254
    mem_gc_free(interp, type_ids);
1254
1255
    return key;
1369
1370
 * Local variables:
1370
1371
 *   c-file-style: "parrot"
1371
1372
 * End:
1372
 
 * vim: expandtab shiftwidth=4:
 
1373
 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
1373
1374
 */