16
16
17
17
our @typedfsmap : shared;
18
18
19
- my $q = Thread::Queue-> new();
19
+ $q = Thread::Queue-> new();
20
20
21
- our $qtypdfs = Thread::Queue-> new();
21
+ $qtypdfs = Thread::Queue-> new();
22
22
23
23
my @sharedarr ;
24
24
my @sharedarrcommon : shared;
@@ -675,7 +675,7 @@ sub waitforid {
675
675
my $execmainregshared = eval { # use re qw(Debug EXECUTE);
676
676
" (?(DEFINE)$mainregexdefs )\\ G(?&cprogram)" };
677
677
sub execmain {
678
- use re qw( Debug EXECUTE) ;
678
+ # use re qw(Debug EXECUTE);
679
679
$regexstr = $_ [0];
680
680
$regex = qr {$_ [0]} sxx ;
681
681
$subject = $_ [1];
@@ -755,13 +755,12 @@ sub waitforid {
755
755
$silent = 0;
756
756
# CORE::print("$index - working - " . Dumper(\%typdefshash). "\n");
757
757
$silent = 1;
758
- $nfilescopesrequested = scalar ($item [2]);
759
- $nextpos = scalar ($item [3]);
760
- $ntimes = scalar ($item [4]);
758
+ $nextpos = scalar ($item [2]);
761
759
my $ntyps = scalar ($item [0]);
762
760
# lock $typedefidentifiersvector;
763
761
$typedefidentifiersvector = [$ntyps ? %{$qtypdfs -> peek($ntyps - 1)} : {}]; # [{}];
764
762
CORE::print (Dumper(\@{$typedefidentifiersvector }));
763
+ # CORE::print ("$start\n");
765
764
=begin
766
765
for my $i (0..$ntyps) {
767
766
my $elem = $qtypdfs->peek($i);
@@ -794,7 +793,7 @@ sub waitforid {
794
793
# eval { updateavailidents($identstoidmap) };
795
794
796
795
797
- pos ( $subject ) = $start ;
796
+ $currposlast = $start ;
798
797
799
798
# CORE::print "$subject\n";
800
799
@@ -844,45 +843,52 @@ sub waitforid {
844
843
# $silent =0;
845
844
# CORE::print ("begin " . Dumper(\$typedefidentifiersvector));
846
845
# $silent =1;
846
+ =begin
847
847
my $currposlast = $start;
848
- for my $i (0..$ntimes ) {
849
-
850
- tryagain:
851
- pos ($subject ) = $currposlast ;
852
- while (scalar (@{$typedefidentifiersvector }) != 1) {
853
- pop @{$typedefidentifiersvector };
848
+ my $i = 0;
849
+ while(1) {
850
+ CORE::print ("pos is to after " . $+[0] . "\n");
851
+ if ($i++ >= $ntimes) {
852
+ last unless ($currposlast < $lastpos);
853
+ CORE::print ("pos is last $lastpos\n to pos " . $currposlast . "\n");
854
+ goto tryagain_begin
854
855
}
855
- @flags = ();
856
- @matches = ();
857
- @savedcallouts = () ;
858
- $recording = 0 ;
859
- if (!( $subject =~ $regex )) {
860
- if ( $tryingagainlocal ) {
861
- lock ( $tryingagain ) ;
862
- if ( $tryingagain ) {
863
- sleep (100000 );
864
- }
865
- CORE:: print ( " 4 failed near " . pos ( $subject ) . " - start - $start \n " );
866
-
867
- $tryingagainlocal = $tryingagain = 1 ;
868
- $silent = 0;
869
- # CORE::print (Dump(\@{$typedefidentifiersvector}) );
870
- CORE:: print (Dumper(\@{ $typedefidentifiersvector }));
871
- $silent = 1;
872
- CORE:: print ( " retrying... " ) ;
873
-
874
- $regex = eval { use re qw( Debug EXECUTE ) ; qr { $regexstr } sxx ; } ;
875
- }
876
- $tryingagainlocal = 1 ;
877
- # CORE::print("currposlast" . $currposlast . "\n");
878
- goto tryagain
856
+ =cut
857
+ tryagain:
858
+ pos ( $subject ) = $currposlast ;
859
+ @flags = () ;
860
+ @matches = ();
861
+ @savedcallouts = ();
862
+ $recording = 0 ;
863
+ if (!( $subject =~ $regex ) || $+ [0] < $nextpos ) {
864
+ CORE:: print ( " fail " . $+ [0] . " __ " . $nextpos . " \n " );
865
+ if ( $tryingagainlocal ) {
866
+ lock ( $tryingagain );
867
+ if ( $tryingagain ) {
868
+ sleep (100000) ;
869
+ }
870
+ CORE::print (" 4 failed near " . pos ( $subject ) . " - start - $start \n " );
871
+
872
+ $tryingagainlocal = $tryingagain = 1;
873
+ $silent = 0 ;
874
+ # CORE::print (Dump(\@{$typedefidentifiersvector}));
875
+ CORE:: print (Dumper(\@{ $typedefidentifiersvector })) ;
876
+ $silent = 1;
877
+ CORE:: print ( " retrying... " ) ;
878
+
879
+ $regex = eval { use re qw( Debug EXECUTE ) ; qr { $regexstr } sxx ; };
879
880
}
880
- # CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n") ;
881
- # pos($subject) = $+[0]
882
- $currposlast = $+ [0]
881
+ $tryingagainlocal = 1 ;
882
+ # CORE::print("currposlast" . $currposlast . "\n");
883
+ goto tryagain
883
884
}
885
+ # CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n");
886
+ # pos($subject) = $+[0]
887
+ # CORE::print ("pos is to pos " . $+[0] . "\n");
888
+ $currposlast = $+ [0];
889
+ # }
884
890
# $currposlast = $+[0]
885
- CORE::print (Dumper(\@{$typedefidentifiersvector }));
891
+ # CORE::print (Dumper(\@{$typedefidentifiersvector}));
886
892
}
887
893
888
894
# CORE::print("==========succes=============\n $&\n==========endsuccess=============\n");
@@ -960,7 +966,45 @@ sub waitforid {
960
966
961
967
my $initseqlight = $fasterlightregexfilecontent ;
962
968
963
- my $initseqlight = " (?(DEFINE)$fasterlightregexfilecontent )" ;
969
+ sub push_decl {
970
+ my $lastposend = $_ [0];
971
+ my $possibleidentlocal = $_ [1];
972
+ lock $identstoidmap ;
973
+ if (not exists $identstoidmap -> {$possibleidentlocal }) {
974
+ $identstoidmap -> {$possibleidentlocal } = shared_clone([[$lastposend , 0]])
975
+ }
976
+ else {
977
+ lock (@{$identstoidmap -> {$possibleidentlocal }});
978
+ push @{$identstoidmap -> {$possibleidentlocal }}, shared_clone([$lastposend , 0]);
979
+ }
980
+ }
981
+
982
+ my $initseqlight = qr { (?(DEFINE)$fasterregexfilecontent$fasterlightregexfilecontent )} sxx ;
983
+
984
+ for (1..$maxthreads ) {
985
+ push @threads , threads-> create(\&execmain, $execmainregshared , $subject , $initseq , $_ );
986
+ }
987
+
988
+ push2 \@matches , {};
989
+ push2 \@flags , {" outter" => undef ," opt" => undef , " nonbitfl" => undef };
990
+
991
+ while ($subject =~ m {$initseqlight
992
+ ;\s *+(?&fasterdecls)|(?&parens)(\s *+(?&brackets)\s *+(?&fasterdecls))?+|(?&brackets)|(?&strunus)} sxxg ) {
993
+ }
994
+
995
+ if (!($subject =~ m {\s *+$} sxxg )) {
996
+ exit -1
997
+ }
998
+
999
+ CORE::print (" joinning for real $lastqueuepoint \n " );
1000
+
1001
+ $q -> end();
1002
+
1003
+ $_ -> join for @threads ;
1004
+ exit
1005
+
1006
+ pop2 \@matches ;
1007
+ pop2 \@flags ;
964
1008
965
1009
$delegatetaggables = 1;
966
1010
# sub execmain {
@@ -980,7 +1024,7 @@ sub waitforid {
980
1024
}
981
1025
}
982
1026
}
983
- =cut
1027
+ = cut
984
1028
#push2 \@savedcallouts, [];
985
1029
#++$recording;
986
1030
#push2 \@flags, {"skiptaggedbodies"};
@@ -1103,7 +1147,7 @@ sub waitforid {
1103
1147
#push @typedefidentifiersvectorcopies, { %{$typedefidentifiersvector->[0]} };
1104
1148
++$nfilescopesrequested;
1105
1149
#CORE::print (("lastpos is : " . $lastpos) . "\n");
1106
- $lastqueuepoint = $lastposend ;
1150
+ $lastqueuepoint = $lastpos ;
1107
1151
$ndeclsorbodies = 0;
1108
1152
}
1109
1153
@@ -1226,11 +1270,12 @@ sub waitforid {
1226
1270
}
1227
1271
1228
1272
if ($shouldstorelast) {
1229
- pos ($subject ) = $lastpos ;
1273
+ # pos($subject) = $lastpos;
1230
1274
$lastposend = $lastpos;
1231
1275
++$ndeclsorbodies;
1232
1276
}
1233
1277
}
1278
+ =cut
1234
1279
# pop2 \@savedcallouts, [];
1235
1280
# pop2 \@flags;
1236
1281
# --$recording;
0 commit comments