Algorithm-CP-IZ

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

4
5
6
7
8
9
10
11
12
13
14
15
16
17
        - Add support for cs_Reguar (iZ-C 3.7)
 
0.05  Fri Jul 12 2019
        - Support iZ-C 3.6 APIs
 
0.03  Sun Aug 27 2017
        - Now $iz->restore_context_until can restore values even if $iz->search is called.
 
0.02  Mon Nov 07 2015
        - Change default directories for header and include in Makefile.PL
        - Avoid error "during global destruction."
 
0.01  Mon Oct 12 14:31:13 2015
        - first release;

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
        _ref_int_arrays => {},
        _ref_var_arrays => {},
    }, $class;
}
 
sub DESTROY {
    my $self = shift;
    my $vars = $self->{_vars};
 
    for my $v (@$vars) {
        # we must check existence of variable for global destruction.
        $v->_invalidate if (defined $v);
    }
 
    Algorithm::CP::IZ::cs_end();
    $Instances--;
}
 
sub save_context {
    my $self = shift;
    

ppport.h  view on Meta::CPAN

174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
access to a large part of the Perl API that hasn't been available in
earlier Perl releases. Use
 
    perl ppport.h --list-provided
 
to see which API elements are provided by ppport.h.
 
=item *
 
You should avoid using deprecated parts of the API. For example, using
global Perl variables without the C<PL_> prefix is deprecated. Also,
some API functions used to have a C<perl_> prefix. Using this form is
also deprecated. You can safely use the supported API, as F<ppport.h>
will provide wrappers for older Perl versions.
 
=item *
 
If you use one of a few functions or variables that were not present in
earlier versions of Perl, and that can't be provided using a macro, you
have to explicitly request support for these functions by adding one or
more C<#define>s in your source code before the inclusion of F<ppport.h>.
 
These functions or variables will be marked C<explicit> in the list shown
by C<--list-provided>.
 
Depending on whether you module has a single or multiple files that
use such functions or variables, you want either C<static> or global
variants.
 
For a C<static> function or variable (used only in a single source
file), use:
 
    #define NEED_function
    #define NEED_variable
 
For a global function or variable (used in multiple source files),
use:
 
    #define NEED_function_GLOBAL
    #define NEED_variable_GLOBAL
 
Note that you mustn't have more than one global request for the
same function or variable in your project.
 
    Function / Variable       Static Request               Global Request
    -----------------------------------------------------------------------------------------
    PL_parser                 NEED_PL_parser               NEED_PL_parser_GLOBAL
    PL_signals                NEED_PL_signals              NEED_PL_signals_GLOBAL
    eval_pv()                 NEED_eval_pv                 NEED_eval_pv_GLOBAL
    grok_bin()                NEED_grok_bin                NEED_grok_bin_GLOBAL
    grok_hex()                NEED_grok_hex                NEED_grok_hex_GLOBAL
    grok_number()             NEED_grok_number             NEED_grok_number_GLOBAL

ppport.h  view on Meta::CPAN

593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
PERL_MAGIC_backref|5.007002||p
PERL_MAGIC_bm|5.007002||p
PERL_MAGIC_collxfrm|5.007002||p
PERL_MAGIC_dbfile|5.007002||p
PERL_MAGIC_dbline|5.007002||p
PERL_MAGIC_defelem|5.007002||p
PERL_MAGIC_envelem|5.007002||p
PERL_MAGIC_env|5.007002||p
PERL_MAGIC_ext|5.007002||p
PERL_MAGIC_fm|5.007002||p
PERL_MAGIC_glob|5.019002||p
PERL_MAGIC_isaelem|5.007002||p
PERL_MAGIC_isa|5.007002||p
PERL_MAGIC_mutex|5.019002||p
PERL_MAGIC_nkeys|5.007002||p
PERL_MAGIC_overload_elem|5.019002||p
PERL_MAGIC_overload_table|5.007002||p
PERL_MAGIC_overload|5.019002||p
PERL_MAGIC_pos|5.007002||p
PERL_MAGIC_qr|5.007002||p
PERL_MAGIC_regdata|5.007002||p
PERL_MAGIC_regdatum|5.007002||p
PERL_MAGIC_regex_global|5.007002||p
PERL_MAGIC_shared_scalar|5.007003||p
PERL_MAGIC_shared|5.007003||p
PERL_MAGIC_sigelem|5.007002||p
PERL_MAGIC_sig|5.007002||p
PERL_MAGIC_substr|5.007002||p
PERL_MAGIC_sv|5.007002||p
PERL_MAGIC_taint|5.007002||p
PERL_MAGIC_tiedelem|5.007002||p
PERL_MAGIC_tiedscalar|5.007002||p
PERL_MAGIC_tied|5.007002||p

ppport.h  view on Meta::CPAN

698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
PL_hexdigit|5.005000||p
PL_hints|5.005000||p
PL_in_my_stash|5.019002||p
PL_in_my|5.019002||p
PL_keyword_plugin||5.011002|
PL_last_in_gv|||n
PL_laststatval|5.005000||p
PL_lex_state|5.019002||p
PL_lex_stuff|5.019002||p
PL_linestr|5.019002||p
PL_modglobal||5.005000|n
PL_na|5.004050||pn
PL_no_modify|5.006000||p
PL_ofsgv|||n
PL_opfreehook||5.011000|n
PL_parser|5.009005|5.009005|p
PL_peepp||5.007003|n
PL_perl_destruct_level|5.004050||p
PL_perldb|5.004050||p
PL_ppaddr|5.006000||p
PL_rpeepp||5.013005|n

ppport.h  view on Meta::CPAN

1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
force_next|||
force_strict_version|||
force_version|||
force_word|||
forget_pmop|||
form_nocontext|||vn
form_short_octal_warning|||
form||5.004000|v
fp_dup|||
fprintf_nocontext|||vn
free_global_struct|||
free_tied_hv_pool|||
free_tmps|||
gen_constant_list|||
get_and_check_backslash_N_name|||
get_aux_mg|||
get_av|5.006000||p
get_context||5.006000|n
get_cvn_flags|5.009005||p
get_cvs|5.011000||p
get_cv|5.006000||p

ppport.h  view on Meta::CPAN

1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
get_num|||
get_op_descs||5.005000|
get_op_names||5.005000|
get_opargs|||
get_ppaddr||5.006000|
get_re_arg|||
get_sv|5.006000||p
get_vtbl||5.005030|
getcwd_sv||5.007002|
getenv_len|||
glob_2number|||
glob_assign_glob|||
glob_assign_ref|||
gp_dup|||
gp_free|||
gp_ref|||
grok_bin|5.007003||p
grok_bslash_N|||
grok_bslash_c|||
grok_bslash_o|||
grok_bslash_x|||
grok_hex|5.007003||p
grok_number|5.007002||p

ppport.h  view on Meta::CPAN

1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
ibcmp|||
incline|||
incpush_if_exists|||
incpush_use_sep|||
incpush|||
ingroup|||
init_argv_symbols|||
init_constants|||
init_dbargs|||
init_debugger|||
init_global_struct|||
init_i18nl10n||5.006000|
init_i18nl14n||5.006000|
init_ids|||
init_interp|||
init_main_stash|||
init_perllib|||
init_postdump_symbols|||
init_predump_symbols|||
init_stacks||5.005000|
init_tm||5.007002|

ppport.h  view on Meta::CPAN

1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
magic_regdatum_set|||
magic_scalarpack|||
magic_set_all_env|||
magic_setarylen|||
magic_setcollxfrm|||
magic_setdbline|||
magic_setdefelem|||
magic_setenv|||
magic_sethint|||
magic_setisa|||
magic_setmglob|||
magic_setnkeys|||
magic_setpack|||
magic_setpos|||
magic_setregexp|||
magic_setsig|||
magic_setsubstr|||
magic_settaint|||
magic_setutf8|||
magic_setuvar|||
magic_setvec|||

ppport.h  view on Meta::CPAN

1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
mem_log_common|||n
mess_alloc|||
mess_nocontext|||vn
mess_sv||5.013001|
mess||5.006000|v
method_common|||
mfree||5.007002|n
mg_clear|||
mg_copy|||
mg_dup|||
mg_find_mglob|||
mg_findext|5.013008|5.013008|p
mg_find|||
mg_free_type||5.013006|
mg_free|||
mg_get|||
mg_length||5.005000|
mg_localize|||
mg_magical|||
mg_set|||
mg_size||5.005000|

ppport.h  view on Meta::CPAN

2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
softref2xv|||
sortcv_stacked|||
sortcv_xsub|||
sortcv|||
sortsv_flags||5.009003|
sortsv||5.007003|
space_join_names_mortal|||
ss_dup|||
stack_grow|||
start_force|||
start_glob|||
start_subparse||5.004000|
stdize_locale|||
strEQ|||
strGE|||
strGT|||
strLE|||
strLT|||
strNE|||
str_to_version||5.006000|
strip_return|||

ppport.h  view on Meta::CPAN

2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
sv_insert_flags||5.010001|
sv_insert|||
sv_isa|||
sv_isobject|||
sv_iv||5.005000|
sv_kill_backrefs|||
sv_len_utf8_nomg|||
sv_len_utf8||5.006000|
sv_len|||
sv_magic_portable|5.019003|5.004000|p
sv_magicext_mglob|||
sv_magicext||5.007003|
sv_magic|||
sv_mortalcopy_flags|||
sv_mortalcopy|||
sv_ncmp|||
sv_newmortal|||
sv_newref|||
sv_nolocking||5.007003|
sv_nosharing||5.007003|
sv_nounlocking|||

ppport.h  view on Meta::CPAN

2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
sv_setsv_cow|||
sv_setsv_flags||5.007002|
sv_setsv_mg|5.004050||p
sv_setsv_nomg|5.007002||p
sv_setsv|||
sv_setuv_mg|5.004050||p
sv_setuv|5.004000||p
sv_tainted||5.004000|
sv_taint||5.004000|
sv_true||5.005000|
sv_unglob|||
sv_uni_display||5.007003|
sv_unmagicext|5.013008|5.013008|p
sv_unmagic|||
sv_unref_flags||5.007001|
sv_unref|||
sv_untaint||5.004000|
sv_upgrade|||
sv_usepvn_flags||5.009004|
sv_usepvn_mg|5.004050||p
sv_usepvn|||

ppport.h  view on Meta::CPAN

2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
if (@ARGV) {
  my %seen;
  for (@ARGV) {
    if (-e) {
      if (-f) {
        push @files, $_ unless $seen{$_}++;
      }
      else { warn "'$_' is not a file.\n" }
    }
    else {
      my @new = grep { -f } glob $_
          or warn "'$_' does not exist.\n";
      push @files, grep { !$seen{$_}++ } @new;
    }
  }
}
else {
  eval {
    require File::Find;
    File::Find::find(sub {
      $File::Find::name =~ /($srcext)$/i
          and push @files, $File::Find::name;
    }, '.');
  };
  if ($@) {
    @files = map { glob "*$_" } @srcext;
  }
}
 
if (!@ARGV || $opt{filter}) {
  my(@in, @out);
  my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files;
  for (@files) {
    my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i;
    push @{ $out ? \@out : \@in }, $_;
  }
  if (@ARGV && @out) {
    warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out);
  }
  @files = @in;
}
 
die "No input files given!\n" unless @files;
 
my(%files, %global, %revreplace);
%revreplace = reverse %replace;
my $filename;
my $patch_opened = 0;
 
for $filename (@files) {
  unless (open IN, "<$filename") {
    warn "Unable to read from $filename: $!\n";
    next;
  }

ppport.h  view on Meta::CPAN

3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
      if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) {
        if ($c =~ /\b$func\b/) {
          $file{uses_todo}{$func}++;
        }
      }
    }
  }
 
  while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) {
    if (exists $need{$2}) {
      $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++;
    }
    else { warning("Possibly wrong #define $1 in $filename") }
  }
 
  for (qw(uses needs uses_todo needed_global needed_static)) {
    for $func (keys %{$file{$_}}) {
      push @{$global{$_}{$func}}, $filename;
    }
  }
 
  $files{$filename} = \%file;
}
 
# Globally resolve NEED_'s
my $need;
for $need (keys %{$global{needs}}) {
  if (@{$global{needs}{$need}} > 1) {
    my @targets = @{$global{needs}{$need}};
    my @t = grep $files{$_}{needed_global}{$need}, @targets;
    @targets = @t if @t;
    @t = grep /\.xs$/i, @targets;
    @targets = @t if @t;
    my $target = shift @targets;
    $files{$target}{needs}{$need} = 'global';
    for (@{$global{needs}{$need}}) {
      $files{$_}{needs}{$need} = 'extern' if $_ ne $target;
    }
  }
}
 
for $filename (@files) {
  exists $files{$filename} or next;
 
  info("=== Analyzing $filename ===");

ppport.h  view on Meta::CPAN

3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
    $warnings++;
  }
}
 
for $func (sort keys %{$file{needed_static}}) {
  my $message = '';
  if (not exists $file{uses}{$func}) {
    $message = "No need to define NEED_$func if $func is never used";
  }
  elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
    $message = "No need to define NEED_$func when already needed globally";
  }
  if ($message) {
    diag($message);
    $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
  }
}
 
for $func (sort keys %{$file{needed_global}}) {
  my $message = '';
  if (not exists $global{uses}{$func}) {
    $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
  }
  elsif (exists $file{needs}{$func}) {
    if ($file{needs}{$func} eq 'extern') {
      $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
    }
    elsif ($file{needs}{$func} eq 'static') {
      $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
    }
  }
  if ($message) {
    diag($message);
    $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
  }
}
 
$file{needs_inc_ppport} = keys %{$file{uses}};
 
if ($file{needs_inc_ppport}) {
  my $pp = '';
 
  for $func (sort keys %{$file{needs}}) {
    my $type = $file{needs}{$func};
    next if $type eq 'extern';
    my $suffix = $type eq 'global' ? '_GLOBAL' : '';
    unless (exists $file{"needed_$type"}{$func}) {
      if ($type eq 'global') {
        diag("Files [@{$global{needs}{$func}}] need $func, adding global request");
      }
      else {
        diag("File needs $func, adding static request");
      }
      $pp .= "#define NEED_$func$suffix\n";
    }
  }
 
  if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
    $pp = '';

ppport.h  view on Meta::CPAN

4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
* right after the definition (i.e. at file scope).  The non-threads
 * case below uses it to declare the data as static. */
#define START_MY_CXT
 
#if (PERL_BCDVERSION < 0x5004068)
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
        SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
#else /* >= perl5.004_68 */
#define dMY_CXT_SV \
        SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,             \
                                  sizeof(MY_CXT_KEY)-1, TRUE)
#endif /* < perl5.004_68 */
 
/* This declaration should be used within all functions that use the
 * interpreter-local data. */
#define dMY_CXT \
        dMY_CXT_SV;                                                     \
        my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
 
/* Creates and zeroes the per-interpreter data.

ppport.h  view on Meta::CPAN

6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
#endif
 
#ifndef PERL_MAGIC_envelem
#  define PERL_MAGIC_envelem             'e'
#endif
 
#ifndef PERL_MAGIC_fm
#  define PERL_MAGIC_fm                  'f'
#endif
 
#ifndef PERL_MAGIC_regex_global
#  define PERL_MAGIC_regex_global        'g'
#endif
 
#ifndef PERL_MAGIC_isa
#  define PERL_MAGIC_isa                 'I'
#endif
 
#ifndef PERL_MAGIC_isaelem
#  define PERL_MAGIC_isaelem             'i'
#endif

ppport.h  view on Meta::CPAN

6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
#endif
 
#ifndef PERL_MAGIC_substr
#  define PERL_MAGIC_substr              'x'
#endif
 
#ifndef PERL_MAGIC_defelem
#  define PERL_MAGIC_defelem             'y'
#endif
 
#ifndef PERL_MAGIC_glob
#  define PERL_MAGIC_glob                '*'
#endif
 
#ifndef PERL_MAGIC_arylen
#  define PERL_MAGIC_arylen              '#'
#endif
 
#ifndef PERL_MAGIC_pos
#  define PERL_MAGIC_pos                 '.'
#endif

ppport.h  view on Meta::CPAN

6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
if (SvTYPE(sv) < SVt_PVMG || !SvMAGIC(sv))
    return 0;
mgp = &(SvMAGIC(sv));
for (mg = *mgp; mg; mg = *mgp) {
    const MGVTBL* const virt = mg->mg_virtual;
    if (mg->mg_type == type && virt == vtbl) {
        *mgp = mg->mg_moremagic;
        if (virt && virt->svt_free)
            virt->svt_free(aTHX_ sv, mg);
        if (mg->mg_ptr && mg->mg_type != PERL_MAGIC_regex_global) {
            if (mg->mg_len > 0)
                Safefree(mg->mg_ptr);
            else if (mg->mg_len == HEf_SVKEY) /* Questionable on older perls... */
                SvREFCNT_dec(MUTABLE_SV(mg->mg_ptr));
            else if (mg->mg_type == PERL_MAGIC_utf8)
                Safefree(mg->mg_ptr);
        }
        if (mg->mg_flags & MGf_REFCOUNTED)
            SvREFCNT_dec(mg->mg_obj);
        Safefree(mg);



( run in 0.241 second using v1.01-cache-2.11-cpan-95122f20152 )