lxr-commits Mailing List for LXR Cross Referencer (Page 4)
Brought to you by:
ajlittoz
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(13) |
Oct
(11) |
Nov
(19) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(14) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
(8) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
(2) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(26) |
Jul
(83) |
Aug
(4) |
Sep
(4) |
Oct
(9) |
Nov
|
Dec
(17) |
2005 |
Jan
(1) |
Feb
(71) |
Mar
(1) |
Apr
(3) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(1) |
Nov
(6) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(35) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(30) |
Apr
(55) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2013 |
Jan
(35) |
Feb
|
Mar
(7) |
Apr
(12) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(32) |
Oct
|
Nov
(45) |
Dec
(18) |
2014 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(2) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(4) |
Dec
|
From: Andre-Littoz <ajl...@us...> - 2013-11-17 08:57:30
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13605/lib/LXR Modified Files: Index.pm Log Message: Index.pm, Index/*: common unique id management Provide a common manually-managed unique record numbering for all DB engines as it proved faster than the built-in mechanisms because of a reduced number of COMMITs. Each DB interface can be individually reverted to built-in if preferred. Index: Index.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Index.pm 8 Nov 2013 18:14:03 -0000 1.26 +++ Index.pm 17 Nov 2013 08:57:26 -0000 1.27 @@ -42,6 +42,9 @@ # are able to detect DB has change and can synchronise to a fresh # new DB. +my ($filenum, $symnum, $typenum); # Counters for unique record id +my ($fileini, $symini, $typeini); # user management + =head2 C<new ($dbname)> @@ -134,7 +137,14 @@ # differs from one DB engine to another. my $prefix = $config->{'dbprefix'}; - # 'files_insert' mandatory but involves auto-increment + if (!exists($index->{'files_insert'})) { + $index->{'files_insert'} = + $index->{dbh}->prepare + ( "insert into ${prefix}files" + . ' (filename, revision, fileid)' + . ' values (?, ?, ?)' + ); + } if (!exists($index->{'files_select'})) { $index->{'files_select'} = $index->{dbh}->prepare @@ -155,7 +165,14 @@ ); } - # 'symbols_insert' mandatory but involves auto-increment + if (!exists($index->{'symbols_insert'})) { + $index->{'symbols_insert'} = + $index->{dbh}->prepare + ( "insert into ${prefix}symbols" + . ' (symname, symid, symcount)' + . ' values (?, ?, 0)' + ); + } if (!exists($index->{'symbols_byname'})) { $index->{'symbols_byname'} = $index->{dbh}->prepare @@ -364,7 +381,14 @@ ); } - # 'langtypes_insert' mandatory but involves auto-increment + if (!exists($index->{'langtypes_insert'})) { + $index->{'langtypes_insert'} = + $index->{dbh}->prepare + ( "insert into ${prefix}langtypes" + . ' (typeid, langid, declaration)' + . ' values (?, ?, ?)' + ); + } if (!exists($index->{'langtypes_select'})) { $index->{'langtypes_select'} = $index->{dbh}->prepare @@ -393,6 +417,62 @@ return $index; } +=head2 C<uniquecountersinit ($prefix)> + +C<uniquecountersinit> initialises the unique counters for +file, symbol and type ids. + +I<This is a C<new> extension method for derived object usage.> + +=over + +=item 1 C<$prefix> + +a I<string> containing the database table prefix + +=back + +Several database engines have better performance using cached counters +for fields with C<unique> attributes unstead of the built-in features. +It comes from the fact that the used (incremented) value is not written +back immediately to disk (fewer commits). + +This trick is valid because e write to the DB only at I<genxref> time +and DB loading is B<single thread>. + +B<CAUTION!> + +=over + +B<Don't forget to write the final values to the DB before disconnecting. +See C<uniquecounterssave>.> + +=back + +=cut + +sub uniquecountersinit { + my ($self, $prefix) = @_; + + $self->{'filenum_lastval'} = + $self->{dbh}->prepare("select fid from ${prefix}filenum"); + $self->{'filenum_lastval'}->execute(); + $fileini = $filenum = $self->{'filenum_lastval'}->fetchrow_array(); + $self->{'filenum_lastval'} = undef; + + $self->{'symnum_lastval'} = + $self->{dbh}->prepare("select sid from ${prefix}symnum"); + $self->{'symnum_lastval'}->execute(); + $symini = $symnum = $self->{'symnum_lastval'}->fetchrow_array(); + $self->{'symnum_lastval'} = undef; + + $self->{'typenum_lastval'} = + $self->{dbh}->prepare("select tid from ${prefix}typenum"); + $self->{'typenum_lastval'}->execute(); + $typeini = $typenum = $self->{'typenum_lastval'}->fetchrow_array(); + $self->{'typenum_lastval'} = undef; +} + # # Generic implementation of this interface @@ -463,11 +543,10 @@ $fileid = $self->fileidifexists(@_); unless ($fileid) { - $self->{'files_insert'}->execute(@_); - $self->{'files_select'}->execute(@_); - ($fileid) = $self->{'files_select'}->fetchrow_array(); + $fileid = ++$filenum; + $self->{'files_insert'}->execute(@_, $fileid); $self->{'status_insert'}->execute($fileid, 0); -# opt $self->{'files_select'}->finish(); +# $self->commit; # $files{"$filename\t$revision"} = $fileid; } return $fileid; @@ -1152,10 +1231,9 @@ $self->{'symbols_byname'}->execute($symname); ($symid, $symcount) = $self->{'symbols_byname'}->fetchrow_array(); unless ($symid) { - $self->{'symbols_insert'}->execute($symname); - # Get the id of the new symbol - $self->{'symbols_byname'}->execute($symname); - ($symid, $symcount) = $self->{'symbols_byname'}->fetchrow_array(); + $symid = ++$symnum; + $symcount = 0; + $self->{'symbols_insert'}->execute($symname, $symid); } $symcache{$symname} = $symid; $cntcache{$symname} = -$symcount; @@ -1247,46 +1325,18 @@ sub decid { # my ($self, $lang, $string) = @_; my $self = shift @_; - my $id; + my $declid; $self->{'langtypes_select'}->execute(@_); - ($id) = $self->{'langtypes_select'}->fetchrow_array(); - unless (defined($id)) { - $self->{'langtypes_insert'}->execute(@_); - $self->{'langtypes_select'}->execute(@_); - ($id) = $self->{'langtypes_select'}->fetchrow_array(); + ($declid) = $self->{'langtypes_select'}->fetchrow_array(); +# opt $self->{'langtypes_select'}->finish(); + unless (defined($declid)) { + $declid = ++$typenum; + $self->{'langtypes_insert'}->execute($declid, @_); } # opt $self->{'langtypes_select'}->finish(); - return $id; -} - -=head2 C<deccount ()> - -C<deccount> retrieves the number of type declarations in the database. - -It is used as a check to see if the database has been initialised. -The previous mechanism based on a package variable in F<Generic.pm> -proved not reliable with C<--allurls> implementation. - -B<Requires:> - -=over - -=item * C<langtypes_count> - -=back - -=cut - -sub deccount { - my $self = shift @_; - my $dcount; - - $self->{'langtypes_count'}->execute(); - ($dcount) = $self->{'langtypes_count'}->fetchrow_array(); - $self->{'langtypes_count'}->finish(); - return $dcount; + return $declid; } =head2 C<commit ()> @@ -1524,7 +1574,7 @@ =item * C<delete_usages> -=item * C<delete_symbolss> +=item * C<delete_symbols> =item * C<delete_releases> @@ -1606,6 +1656,135 @@ $self->{'purge_all'}->execute(); } +=head2 C<uniquecountersreset ($force)> + +C<uniquecountersreset> restarts the counters from 0. + +=over + +=item 1 C<$force> + +an I<integer> used to force the C<$>I<xxx>C<ini> variables + +If different from 0, this forces C<uniquecounterssave> to write +the reset values to the DB if immediately called after this method. + +It is better to call the method a second time with argument 0 to +avoid any unforeseen side-effects, though there should be none. + +=back + +=cut + +sub uniquecountersreset { + my ($force) = @_; + $filenum = 0; + $symnum = 0; + $typenum = 0; + $fileini = $force; + $symini = $force; + $typeini = $force; +} + +=head2 C<uniquecounterssave ()> + +C<uniquecounterssave> stores in the DB the current values of the +file, symbol and type counters for later sessions. + +=cut + +sub uniquecounterssave { + my ($self + , $filenum, $symnum, $typenum + , $fileini, $symini, $typeini + ) = @_; + + $self->{dbh}{'AutoCommit'} = 0; + my $prefix = $self->{'config'}{'dbprefix'}; + if ($filenum != $fileini) { + my $fnnv = + $self->{dbh}->prepare + ( "update ${prefix}filenum" + . ' set fid = ?' + . ' where rcd = 0' + ); + $fnnv->execute($filenum); + $fnnv = undef; + } + if ($symnum != $symini) { + my $snnv = + $self->{dbh}->prepare + ( "update ${prefix}symnum" + . ' set sid = ?' + . ' where rcd = 0' + ); + $snnv->execute($symnum); + $snnv = undef; + } + if ($typenum != $typeini) { + my $tnnv = + $self->{dbh}->prepare + ( "update ${prefix}typenum" + . ' set tid = ?' + . ' where rcd = 0' + ); + $tnnv->execute($typenum); + $tnnv = undef; + } +} + +=head2 C<dropuniversalqueries ()> + +C<dropuniversalqueries> deactivates all "universal" query statement +to prevent annoying "Disconnect invalidates xx active statement handles ..." +messages from disturbing the end user. +Derived instances are responsible for killing their own queries. + +Most are probably overkill since C<execure> or C<fetchrow_array> may +already have disactivated the statement. + +Must be called before C<final_cleanup> before disconnecting. + +=cut + +sub dropuniversalqueries { + my ($self) = @_; + + # Kill the universal statement handles (specific modules + # are responsible for their own additions). + $self->{'files_insert'} = undef; + $self->{'files_select'} = undef; + $self->{'allfiles_select'} = undef; + $self->{'symbols_insert'} = undef; + $self->{'symbols_byname'} = undef; + $self->{'symbols_byid'} = undef; + $self->{'symbols_setref'} = undef; + $self->{'related_symbols_select'} = undef; + $self->{'delete_symbols'} = undef; + $self->{'definitions_insert'} = undef; + $self->{'definitions_select'} = undef; + $self->{'delete_file_definitions'} = undef; + $self->{'delete_definitions'} = undef; + $self->{'releases_insert'} = undef; + $self->{'releases_select'} = undef; + $self->{'delete_one_release'} = undef; + $self->{'delete_releases'} = undef; + $self->{'status_insert'} = undef; + $self->{'status_select'} = undef; + $self->{'status_update'} = undef; + $self->{'status_timestamp'} = undef; + $self->{'status_update_timestamp'} = undef; + $self->{'delete_unused_status'} = undef; + $self->{'usages_insert'} = undef; + $self->{'usages_select'} = undef; + $self->{'delete_file_usages'} = undef; + $self->{'delete_usages'} = undef; + $self->{'langtypes_insert'} = undef; + $self->{'langtypes_select'} = undef; + $self->{'langtypes_count'} = undef; + $self->{'purge_all'} = undef; +} + =head2 C<final_cleanup ()> C<final_cleanup> allows to execute last-minute actions on the database @@ -1619,11 +1798,7 @@ my ($self) = @_; $self->commit(); - $self->{'files_select'} = undef; - $self->{'releases_select'} = undef; - $self->{'status_select'} = undef; - $self->{'langtypes_select'} = undef; - $self->{'symbols_byname'} = undef; + $self->dropuniversalqueries(); $self->{dbh}->disconnect() or die "Disconnect failed: $DBI::errstr"; } |
From: Andre-Littoz <ajl...@us...> - 2013-11-12 19:45:16
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15634 Modified Files: diff Log Message: diff: fix for inconsistency between code and user's manual Manual says reference version is displayed in right pane and version compared to in left pane. Modified code to behave like manual says. At the same time, changed (obscure) names of variables to something more meaningful as algorithm is otherwise quite difficult to follow. Index: diff =================================================================== RCS file: /cvsroot/lxr/lxr/diff,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- diff 8 Nov 2013 14:22:25 -0000 1.33 +++ diff 12 Nov 2013 19:45:13 -0000 1.34 @@ -156,10 +156,10 @@ values and user is requested to choose another version. On second entry, both current values (I<var_name>C<=>...) and -remembered values (C<~>I<var_name>C<=>...) are present in the +remembered values (C<~>I~<var_name>C<=>...) are present in the query arguments. -The latter values designate the reference version (in the left pane); -the former values the "new" version (in the right pane). +The latter values designate the reference version (in the right pane); +the former values the "new" version (in the left pane). With these two file descriptions, processing can be done. The file name in C<$pathname> has been nominally transformed by the @@ -223,11 +223,11 @@ my ($diffv) = grep(m/v=/, @dargs); $diffv =~ s/v=//; - unless ($files->isfile($origname, $releaseid)) { - print("<p class='error'>*** $origname does not exist in version $releaseid ***</p>\n"); + unless ($files->isfile($origname, $diffv)) { + print("<p class='error'>*** $origname does not exist in version $diffv ***</p>\n"); return; } - unless ($files->isfile($diffname, $diffv)) { + unless ($files->isfile($diffname, $releaseid)) { print("<p class='error'>*** $diffname does not exist in version $releaseid ***</p>\n"); return; } @@ -235,43 +235,53 @@ # fflush; # realfilename may create a temporary file # which should be released when no longer needed - my $origtemp = $files->realfilename($origname, $releaseid); - my $difftemp = $files->realfilename($diffname, $diffv); + my $origtemp = $files->realfilename($origname, $diffv); + my $difftemp = $files->realfilename($diffname, $releaseid); $ENV{'PATH'} = '/usr/local/bin:/usr/bin:/bin:/usr/sbin'; unless (open(DIFF, '-|')) { open(STDERR, '>&STDOUT'); - exec('diff', '-U0', $origtemp, $difftemp); + exec('diff', '-U0', $difftemp, $origtemp); die "*** Diff subprocess died unexpectedly: $!\n"; } - my ($os, $ol, $ns, $nl, $ms, $ml, $bo, $ofs, $dir, %orig, %new, %chg); + my ($leftstart, $leftlen); # What is replaced in left file + my ($rightstart, $rightlen); # What replaces in tight file + my $facing; # Number of facing lines + my $rightxcess; # Running count of lines in excess at right + my $leftorg; # Final real line number at left + my $dir; # Change indicator + my %chg; # All change indicators + my $blanks; # Number of blanks lines to keep abreast + my (%leftblanks, %rightblanks); while (<DIFF>) { - if (($os, $ol, $ns, $nl) = /@@ -(\d+)(?:,(\d+)|) \+(\d+)(?:,(\d+)|) @@/) { - $os++ if $ol eq '0'; - $ns++ if $nl eq '0'; - $ol = 1 unless defined($ol); - $nl = 1 unless defined($nl); + if (($leftstart, $leftlen, $rightstart, $rightlen) + = m/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/ + ) { + $leftstart++ if $leftlen eq '0'; + $rightstart++ if $rightlen eq '0'; + $leftlen = 1 unless defined($leftlen); + $rightlen = 1 unless defined($rightlen); - $bo = $os + $ofs; - if ($ol < $nl) { - $ofs += $nl - $ol; + $leftorg = $leftstart + $rightxcess; + if ($leftlen < $rightlen) { + $rightxcess += $rightlen - $leftlen; - $dir = '>>'; - $ms = $nl - $ol; - $ml = $ol; - $orig{ $os + $ol } = $ms; + $dir = '>>'; + $blanks = $rightlen - $leftlen; + $facing = $leftlen; + $leftblanks{$leftstart + $leftlen} = $blanks; } else { - $dir = '<<'; - $ms = $ol - $nl; - $ml = $nl; - $new{ $ns + $nl } = $ms; + $dir = '<<'; + $blanks = $leftlen - $rightlen; + $facing = $rightlen; + $rightblanks{$rightstart + $rightlen} = $blanks; } - foreach (0 .. $ml - 1) { - $chg{ $bo + $_ } = '!!'; + foreach (0 .. $facing - 1) { + $chg{ $leftorg + $_ } = '!!'; } - foreach (0 .. $ms - 1) { - $chg{ $bo + $ml + $_ } = $dir; + foreach (0 .. $blanks - 1) { + $chg{ $leftorg + $facing + $_ } = $dir; } } @@ -280,11 +290,15 @@ # Print a descriptive title and tell exactly what versions # are compared (dump the variable value sets) + my @linkargs = grep {m/(.*?)=(.*)/; $config->variable($1) ne $2;} @dargs; + map (s/(.*?)=/!$1=/, @linkargs); print ( "<h1>Diff markup</h1>\n" , '<h2>between ' - , fileref ( $origname + , fileref ( $diffname , 'diff-fref' - , $origname + , $diffname + , undef + , @linkargs ) , ' <small>(' ); @@ -292,21 +306,14 @@ for my $var ($config->allvariables) { next if exists($config->{'variables'}{$var}{'when'}) && !eval($config->varexpand($config->{'variables'}{$var}{'when'})); - my ($varval) = grep(m/$var=/, @dargs); - $varval =~ s/$var=//; - push (@fctx, $config->vardescription($var).': '.$varval); + push (@fctx, $config->vardescription($var).': '.$config->variable($var)); } print ( join(', ', @fctx) , ')</small><br>' , ' and ' - ); - my @linkargs = grep {m/(.*?)=(.*)/; $config->variable($1) ne $2;} @dargs; - map (s/(.*?)=/!$1=/, @linkargs); - print ( fileref ( $diffname + , fileref ( $origname , 'diff-fref' - , $diffname - , undef - , @linkargs + , $origname ) , ' <small>(' ); @@ -314,7 +321,9 @@ for my $var ($config->allvariables) { next if exists($config->{'variables'}{$var}{'when'}) && !eval($config->varexpand($config->{'variables'}{$var}{'when'})); - push (@fctx, $config->vardescription($var).': '.$config->variable($var)); + my ($varval) = grep(m/$var=/, @dargs); + $varval =~ s/$var=//; + push (@fctx, $config->vardescription($var).': '.$varval); } print ( join(', ', @fctx) , ")</small></h2><hr>\n" @@ -330,22 +339,22 @@ $config->variable($1, $2); } } - my $orig = ''; - markupfile($origh, sub { $orig .= shift }); + my $rightfile; + markupfile($origh, sub { $rightfile .= shift }); # Restore original environment while ((my $var, my $val) = each %oldvars) { $config->variable($var, $val); } %oldvars = {}; - my $len = $. + $ofs; $origh->close; $files->releaserealfilename($origtemp); $pathname = $diffname; my $diffh = FileHandle->new($difftemp); - my $new = ''; - markupfile($diffh, sub { $new .= shift }); + my $leftfile; + markupfile($diffh, sub { $leftfile .= shift }); + my $len = $. + $rightxcess; # Total lines displayed $diffh->close; $files->releaserealfilename($difftemp); @@ -354,41 +363,39 @@ # Output both versions side by side my $i; $i = 1; - $orig =~ s/^/"\n" x ($orig{$i++})/mge; + $leftfile =~ s/^/"\n" x ($leftblanks{$i++})/mge; $i = 1; - $new =~ s/^/"\n" x ($new{$i++})/mge; + $rightfile =~ s/^/"\n" x ($rightblanks{$i++})/mge; - my @orig = split(/\n/, $orig); - my @new = split(/\n/, $new); + my @leftlines = split(/\n/, $leftfile); + my @rightlines = split(/\n/, $rightfile); my $leftwidth = $$HTTP{'param'}{'_diffleftwidth'} || $config->{'diffleftwidth'} || 50; print("<pre class=\"filecontent\">\n"); foreach $i (0 .. $len) { - my $o = htmljust($orig[$i], $leftwidth); - my $n = $new[$i]; + my $l = htmljust($leftlines[$i], $leftwidth); + my $r = $rightlines[$i]; my $diffmark = ' '; if ($chg{ $i + 1 }) { $diffmark = '<span class="diff-mark">' . $chg{ $i + 1 } . "</span>"; if ('<<' eq $chg{ $i + 1 }) { - $o =~ s|</a> |</a> <span class="diff-left">|; + $l =~ s|</a> |</a> <span class="diff-left">|; } if ('>>' eq $chg{ $i + 1 }) { - $n =~ s|</a> |</a> <span class="diff-right">|; + $r =~ s|</a> |</a> <span class="diff-right">|; } if ('!!' eq $chg{ $i + 1 }) { - $o =~ s|</a> |</a> <span class="diff-both">|; - $n =~ s|</a> |</a> <span class="diff-both">|; + $l =~ s|</a> |</a> <span class="diff-both">|; + $r =~ s|</a> |</a> <span class="diff-both">|; } - $o .= '</span>'; - $n .= '</span>'; + $l .= '</span>'; + $r .= '</span>'; } - #print("$o <span class=\"diff-mark\">", - # ($chg{$i+1} || " "), "</span> $n\n"); - print "$o $diffmark $n\n"; + print "$l $diffmark $r\n"; } print("</pre>\n"); |
From: Andre-Littoz <ajl...@us...> - 2013-11-09 19:37:14
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12456/lib/LXR Modified Files: Common.pm Log Message: Common.pm: HTTP headers forgotten When sub fatal was modified to be able to print to screen before full HTTP initialisation, sending minimal HTTP headers was forgotten. Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- Common.pm 8 Nov 2013 18:14:03 -0000 1.107 +++ Common.pm 9 Nov 2013 19:37:11 -0000 1.108 @@ -196,6 +196,7 @@ # If HTTP is not yet initialised, emit a minimal set of headers if ($wwwdebug) { if (!$HTTP_inited) { + httpminimal(); print '<html><head><title>LXR Fatal Error!</title>', "\n"; print '<base href="', $HTTP->{'host_access'}, $HTTP->{'script_path'}, "/\">\n"; # Next line in the hope situation is not too bad |
From: Andre-Littoz <ajl...@us...> - 2013-11-09 10:07:41
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10254/lib/LXR/Lang Modified Files: Generic.pm Log Message: Generic.pm: type description initialisation in several databases Previous fix was faulty: it replaced text with the DB index. The second database would get id from first instead of text and replace again with its own ids. The ids are now stored in a new sub-hash. Index: Generic.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Generic.pm,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- Generic.pm 8 Nov 2013 18:18:54 -0000 1.47 +++ Generic.pm 9 Nov 2013 10:07:37 -0000 1.48 @@ -135,8 +135,8 @@ saving the overhead of processing the config file each time. However, The mapping between I<ctags> tags and their human readable -counterpart is stored in every database for every language. The mapping is then -replaced by the index of the table in the DB. +counterpart is stored in every database for every language. +The mapping, as a table index in the DB, is keptin a new I<hash> C<'typeid'>. =cut @@ -191,7 +191,7 @@ $typemap = $langdesc->{'typemap'}; $langid = $langdesc->{'langid'}; while (($type, $tdescr) = each %$typemap) { - $typemap->{$type} = $index->decid($langid, $tdescr); + $langdesc->{'typeid'}{$type} = $index->decid($langid, $tdescr); } } } |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 18:18:57
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15801/lib/LXR/Lang Modified Files: Generic.pm Log Message: Index.pm, Lang/Generic.pm, Common.pm, genxref: make sure the human-readable type description is initialised in every database (Important for genxref, does not really matter for browsing) Parser tables are cached after first instantiation while they are written if needed into DB. Under --allurls genxref connects to new DB and, though parser initialisation is called again, the loaded cache prevents from writing the types in the new DB. A running DB counter is created. Whenever, its value is different from the cached one, writing types table is forced. (Note: something went wrong with last CVS commit, forcing to resubmit for Generic.pm) Index: Generic.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Generic.pm,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- Generic.pm 8 Nov 2013 18:14:03 -0000 1.46 +++ Generic.pm 8 Nov 2013 18:18:54 -0000 1.47 @@ -114,11 +114,28 @@ Internal function (not method!) C<read_config> reads in language descriptions from configuration file. -This is only executed once, saving the overhead of processing the -config file each time. +Sets in global variable C<$config_contents> a reference to a I<hash> +equivalent to the configuration file. +The diffrences are: -The mapping between I<ctags> tags and their human readable counterpart -is stored in the database for every language. The mapping is then +=over + +=item 1 Keywords are uppercased is language is case-insensitive. + +=item 1 Keywords are stored in a I<hash> instead of an array to +speed up later retrieval (avoiding linear search and its quadratic +average time) + +=item 1 Human-readable text for type is replaced by a record-id +in the database where text is recorded. + +=back + +Loading the file and transformung if is only executed once, +saving the overhead of processing the config file each time. + +However, The mapping between I<ctags> tags and their human readable +counterpart is stored in every database for every language. The mapping is then replaced by the index of the table in the DB. =cut @@ -127,21 +144,54 @@ open(CONF, $config->{'genericconf'}) or die 'Can\'t open ' . $config->{'genericconf'} . ", $!"; - local ($/) = undef; - - my $config_contents = <CONF>; - $config_contents =~ m/(.*)/s; - $config_contents = $1; #untaint it - $generic_config = eval("\n#line 1 \"generic.conf\"\n" . $config_contents); - die($@) if $@; - close CONF; + my $todo = !defined($generic_config); + if ($todo) { + local ($/) = undef; + my $config_contents = <CONF>; + $config_contents =~ m/(.*)/s; + $config_contents = $1; #untaint it + $generic_config = eval("\n#line 1 \"generic.conf\"\n" . $config_contents); + die($@) if $@; + close CONF; + } - # Setup the ctags to declid mapping my $langmap = $generic_config->{'langmap'}; + my $langdesc; # Language description hash + my $typemap; # Language type letter/text table + my $type; # Letter for type + my $tdescr; # Human-readable type + my $langid; # Language code + foreach my $lang (keys %$langmap) { - my $typemap = $langmap->{$lang}{'typemap'}; - foreach my $type (keys %$typemap) { - $typemap->{$type} = $index->decid($langmap->{$lang}{'langid'}, $typemap->{$type}); + if ($todo) { + $langdesc = $langmap->{$lang}; # Dereference + # Transform the 'reserved' keyword list to speed up lookup + my $insensitive = 0; + if (exists($langdesc->{'flags'})) { + foreach (@{$langdesc->{'flags'}}) { + if ($_ eq 'case_insensitive') { + $insensitive = 1; + last; + } + } + } + if (exists($langdesc->{'reserved'})) { + my @kwl = @{$langdesc->{'reserved'}}; + $langdesc->{'reserved'} = {}; + foreach (@kwl) { + if ($insensitive) { + $langdesc->{'reserved'}{uc($_)} = 1; + } else { + $langdesc->{'reserved'}{$_} = 1; + } + } + } + } + # Setup the ctags to declid mapping + $typemap = $langdesc->{'typemap'}; + $langid = $langdesc->{'langid'}; + while (($type, $tdescr) = each %$typemap) { + $typemap->{$type} = $index->decid($langid, $tdescr); } } } |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 18:14:06
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15032 Modified Files: genxref Log Message: Index.pm, Lang/Generic.pm, Common.pm, genxref: make sure the human-readable type description is initialised in every database (Important for genxref, does not really matter for browsing) Parser tables are cached after first instantiation while they are written if needed into DB. Under --allurls genxref connects to new DB and, though parser initialisation is called again, the loaded cache prevents from writing the types in the new DB. A running DB counter is created. Whenever, its value is different from the cached one, writing types table is forced. Index: genxref =================================================================== RCS file: /cvsroot/lxr/lxr/genxref,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- genxref 24 Sep 2013 15:21:36 -0000 1.67 +++ genxref 8 Nov 2013 18:14:03 -0000 1.68 @@ -402,14 +402,11 @@ . " - Can't run${VTnorm}\n"; } - $files = LXR::Files->new ( $config->{'sourceroot'} - , $config->{'sourceparams'} - ); + $files = LXR::Files->new($config); die "${VTred}Can't create file access object ${VTnorm}" . $config->{'sourceroot'} if !defined($files); - $index = LXR::Index->new ( $config->{'dbname'} - , $config->{'dbprefix'} - ); + $LXR::Index::database_id++; # Changing database + $index = LXR::Index->new($config); die "${VTred}Can't create Index ${VTnorm}" . $config->{'dbname'} if !defined($index); |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 14:22:28
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32081 Modified Files: diff ident search showconfig Log Message: Common.pm, consequently diff, indent, search, showconfig, Config.pm, Template.pm, CVS.pm, GIT.pm, Mercurial.pm, Subversion.pm, Generic.pm Uniformised error handling through warn and die after making sure HTTP headers are alway sent before printing anything. Since something is (nearly) always printed on screen, there is no longer need, except in exceptional circumstances to check error log files. Index: diff =================================================================== RCS file: /cvsroot/lxr/lxr/diff,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- diff 24 Sep 2013 08:14:36 -0000 1.32 +++ diff 8 Nov 2013 14:22:25 -0000 1.33 @@ -241,8 +241,7 @@ unless (open(DIFF, '-|')) { open(STDERR, '>&STDOUT'); exec('diff', '-U0', $origtemp, $difftemp); - print STDERR "*** Diff subprocess died unexpextedly: $!\n"; - exit; + die "*** Diff subprocess died unexpectedly: $!\n"; } my ($os, $ol, $ns, $nl, $ms, $ml, $bo, $ofs, $dir, %orig, %new, %chg); Index: ident =================================================================== RCS file: /cvsroot/lxr/lxr/ident,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ident 24 Sep 2013 08:43:06 -0000 1.38 +++ ident 8 Nov 2013 14:22:25 -0000 1.39 @@ -551,10 +551,10 @@ $templ = gettemplate ( 'htmlident' , $errorsig - , "<h2 class\"error\">Identifier search not available without 'htmlident' template</h2>\n" + , '' ); - if ($templ =~ m/^$errorsig/) { - die "'htmlident' template not configured"; + if ($templ =~ m/^$errorsig/) { + die "Identifier search not available without 'htmlident' template\n"; } print( Index: search =================================================================== RCS file: /cvsroot/lxr/lxr/search,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- search 24 Sep 2013 08:43:06 -0000 1.51 +++ search 8 Nov 2013 14:22:25 -0000 1.52 @@ -193,7 +193,7 @@ # The pattern to search for ." -y -n '$searchtext' 2>&1 |" ) - || print(STDERR "Glimpse subprocess died unexpextedly: $!\n"); + or die "Glimpse subprocess died unexpextedly: $!\n"; my $numlines = 0; my @glimpselines = (); @@ -524,10 +524,10 @@ $templ = gettemplate ( 'htmlsearch' , $errorsig - , "<h2 class\"error\">Free-text search not available without 'htmlsearch' template</h2>\n" + , '' ); if ($templ =~ m/^$errorsig/) { - die "'htmlsearch' template not configured"; + die "Free-text search not available without 'htmlsearch' template\n"; } my $searchtext = $HTTP->{'param'}{'_string'}; @@ -544,32 +544,29 @@ } elsif ($config->{'swishbin'} && $config->{'swishdir'}) { @results = swishsearch($searchtext, $filetext, $advanced, $casesensitive); } else { - warning('No freetext search engine configured.'); + warn "No freetext search engine configured.\n"; } } elsif ($filetext ne '') { my $FILELISTING; if ($config->{'swishdir'} && $config->{'swishbin'}) { unless ($FILELISTING = IO::File->new($config->{'swishdir'} . "/$releaseid.filenames")) { - &warning( - "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " - . $config->{'swishdir'} - . "/$releaseid.filenames."); + warn "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " + . $config->{'swishdir'} + . "/$releaseid.filenames\n"; return; } } elsif ($config->{'glimpsedir'} && $config->{'glimpsebin'}) { unless ($FILELISTING = IO::File->new($config->{'glimpsedir'} . '/' . $releaseid . "/.glimpse_filenames")) { - &warning( - "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " - . $config->{'glimpsedir'} - . "/$releaseid/.glimpse_filenames."); + warn "Version '$releaseid' has not been indexed and is unavailable for searching\n" + . 'Could not open ' + . $config->{'glimpsedir'} + . "/$releaseid/.glimpse_filenames\n"; return; } } else { - warning( - 'Freetext search engine required for file search, and no freetext search engine is configured' - ); + warn "Freetext search engine required for file search, and no freetext search engine is configured\n"; return; } my $sourceroot = $config->{'sourceroot'} . '/' . $releaseid . '/'; @@ -619,12 +616,12 @@ || $config->{'swishbin'} && $config->{'swishbin'} =~ m!^(.*/)?true$! ) { - print "<h2 class='error'>Free-text search disabled by configuration file!</h2>\n"; + warn "Free-text search disabled by configuration file!\n"; } else { &search; } } else { - print "<h2 class='error'>Free-text search not available with VCSs!</h2>\n"; + warn "Free-text search not available with VCSs!\n"; } makefooter('search'); Index: showconfig =================================================================== RCS file: /cvsroot/lxr/lxr/showconfig,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- showconfig 24 Sep 2013 08:39:05 -0000 1.3 +++ showconfig 8 Nov 2013 14:22:25 -0000 1.4 @@ -331,7 +331,7 @@ , '' ); if ($templ =~ m/^$errorsig/) { - die "'htmlconfig' template not configured"; + die "Can't display configuration without 'htmlconfig' template\n"; } print expandtemplate ( $templ |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 13:26:24
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28304/lib/LXR/Lang Modified Files: Generic.pm Log Message: Generic.pm: fix incorrect language-insensitive keyword detection Index: Generic.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Generic.pm,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- Generic.pm 24 Sep 2013 15:35:38 -0000 1.43 +++ Generic.pm 8 Nov 2013 13:26:21 -0000 1.44 @@ -476,7 +476,10 @@ &LXR::SimpleParse::requeuefrag($source); # Reconstruct the highlighted fragment - $$frag = ( $self->isreserved($dirname) + my $dictname = $dirname; + $dictname =~ s/\s+//; # for C #directives + $dictname = uc($dirname) if $$self{'case_insensitive'}; + $$frag = ( $self->isreserved($dictname) ? "<span class='reserved'>$dirname</span>" : $dirname ) |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 12:32:40
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25193 Modified Files: source Log Message: source: cosmetic change to source text Index: source =================================================================== RCS file: /cvsroot/lxr/lxr/source,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- source 24 Sep 2013 08:54:19 -0000 1.66 +++ source 8 Nov 2013 12:32:37 -0000 1.67 @@ -860,14 +860,13 @@ if ($fileh) { if ($raw) { print($fileh->getlines ); - } - # elsif ($node =~ /README$/) { + # } elsif ($node =~ /README$/) { # print("<pre>", # markupstring($fileh, $node, $index), # FIXME # "</pre>"); - # } - else { + # } + } else { # Check for a discrepancy between file and database states if (!$index->filetimestamp ( $pathname @@ -904,8 +903,7 @@ markupfile($fileh, $outfun); &$outfun("</pre>\n"); } - } - else { + } else { print( "<p class=\"error\">\n<i>The file $pathname does not exist.</i>\n</p>\n" ); |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 09:15:41
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12547/lib/LXR Modified Files: Lang.pm Log Message: Lang.pm: category family feature Categories are processed based on their name prefix. They are tagged with a CSS class equal to their full name. Index: Lang.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang.pm,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- Lang.pm 24 Sep 2013 07:36:09 -0000 1.52 +++ Lang.pm 8 Nov 2013 09:15:38 -0000 1.53 @@ -210,7 +210,7 @@ a I<string> to mark -=item 1 C<$dir> +=item 1 C<$css> a I<string> containing the CSS class @@ -248,9 +248,8 @@ =cut sub processcomment { - my ($self, $frag) = @_; - - multilinetwist($frag, 'comment'); + shift @_; + goto &multilinetwist; } @@ -271,9 +270,34 @@ =cut sub processstring { - my ($self, $frag) = @_; + shift @_; + goto &multilinetwist; +} - multilinetwist($frag, 'string'); + +=head2 C<processextra ($frag, $kind)> + +Method C<processextra> marks the fragment as language specific. + +=over + +=item 1 C<$frag> + +a I<string> to mark + +=item 1 C<$kind> + +a I<string> containing the CSS class + +=back + +Uses function C<multilinetwist>. + +=cut + +sub processextra { + shift @_; + goto &multilinetwist; } # |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 09:06:30
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11637/lib/LXR/Lang Modified Files: Make.pm Log Message: Make.pm: minor code improvement Index: Make.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Make.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Make.pm 21 Sep 2013 12:54:53 -0000 1.3 +++ Make.pm 8 Nov 2013 09:06:26 -0000 1.4 @@ -66,7 +66,6 @@ my ($self, $frag, $dir) = @_; my $source = $$frag; - my $dirname; # uses directive name and spacing my $file; # language include file my $path; # OS include file my $target = '[s-]?include\s+'; # directive pattern @@ -80,9 +79,8 @@ # Guard against syntax error or variant # Advance past keyword, so that parsing may continue without loop. $source =~ s/^(\S+)//; # Erase keyword - $dirname = $1; - if (length($dirname) > 0) { - $$frag .= "<span class='reserved'>$dirname</span>"; + if (length($1) > 0) { + $$frag .= "<span class='reserved'>$1</span>"; } &LXR::SimpleParse::requeuefrag($source); return; @@ -92,14 +90,9 @@ # Following are only for whitespace separators. $target = '\s+'; - $dirname = $1; $file = $2; - $path = $file; - $$frag .= ( $self->isreserved($dirname) - ? "<span class='reserved'>$dirname</span>" - : $dirname - ); + $$frag .= "<span class='reserved'>$1</span>"; # Check start of comment if ('#' eq substr($file, 0, 1)) { |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 09:04:31
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11350/lib/LXR/Lang Modified Files: Cobol.pm HTML.pm Pascal.pm Log Message: Cobol.pm, HTML.pm, Pascal.pm: fix incorrect language-insensitive keyword detection Index: Cobol.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Cobol.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Cobol.pm 21 Sep 2013 12:54:53 -0000 1.5 +++ Cobol.pm 8 Nov 2013 09:04:27 -0000 1.6 @@ -44,7 +44,7 @@ $1. ( $2 eq '' ? $2 - : ( $self->isreserved($2) + : ( $self->isreserved(uc($2)) ? "<span class='reserved'>$2</span>" : ( $index->issymbol(uc($2), $$self{'releaseid'}) ? join($2, @{$$self{'itag'}}) Index: HTML.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/HTML.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HTML.pm 21 Sep 2013 12:54:53 -0000 1.2 +++ HTML.pm 8 Nov 2013 09:04:27 -0000 1.3 @@ -85,7 +85,7 @@ # Advance past keyword, so that parsing may continue without loop. $source =~ s/^(\w+)//; # Erase keyword $dirname = $1; - $$frag = ( $self->isreserved($dirname) + $$frag = ( $self->isreserved(uc($dirname)) ? "<span class='reserved'>$dirname</span>" : $dirname ); @@ -103,7 +103,7 @@ $path =~ s/"/"/ig; $path =~ s/'/'/ig; - $$frag = ( $self->isreserved($dirname) + $$frag = ( $self->isreserved(uc($dirname)) ? "<span class='reserved'>$dirname</span>" : $dirname ) Index: Pascal.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/Pascal.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Pascal.pm 21 Sep 2013 12:54:53 -0000 1.4 +++ Pascal.pm 8 Nov 2013 09:04:27 -0000 1.5 @@ -110,6 +110,7 @@ my $source = $$frag; my $dirname; # uses directive name and spacing + my $dictname; my $file; # language include file my $path; # OS include file my $link; # link to include file @@ -138,7 +139,8 @@ $dirname = $1; $file = $2; $path = $file; - $$frag .= ( $self->isreserved($dirname) + ($dictname = $dirname) =~ s/\s//g; + $$frag .= ( $self->isreserved(uc($dictname)) ? "<span class='reserved'>$dirname</span>" : $dirname ); |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 08:59:53
|
Update of /cvsroot/lxr/lxr/lib/LXR/Lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10882/lib/LXR/Lang Modified Files: C.pm Log Message: C.pm: fix for bug #247 (newline suppression) Returning unused portion of #include fragment was forgotten Index: C.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang/C.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- C.pm 21 Sep 2013 12:54:53 -0000 1.13 +++ C.pm 8 Nov 2013 08:59:50 -0000 1.14 @@ -80,7 +80,8 @@ . $spacer . $lsep . $link - . $rsep; + . $rsep + . $source; } 1; |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 08:38:22
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9634/lib/LXR Modified Files: Markup.pm Log Message: Markup.pm: adapt to SimpleParse.pm and category family feature To minimise number of calls to nextfrag, SimplaParser parser no longer returns independent empty lines block; they are now a prefix to other fragments. They must then be detached in order not to be classified in the following category. Fragments fall into category families based on the prefix (comment, string, extra) returned by nextfrag. The only difference is CSS decoration. Index: Markup.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Markup.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Markup.pm 21 Sep 2013 12:54:52 -0000 1.9 +++ Markup.pm 8 Nov 2013 08:38:19 -0000 1.10 @@ -86,7 +86,10 @@ # Look for identifiers and create links with identifier search query. # TODO: Is there a performance problem with this? $string =~ s/(^|\s)([a-zA-Z_~][a-zA-Z0-9_]*)\b/ - $1.(is_linkworthy($2) ? &idref($2, '', $2) : $2)/ge; + $1. ( is_linkworthy($2) && $index->issymbol($2, $releaseid) + ? &idref($2, '', $2) + : $2 + )/ge; # HTMLify the special characters we marked earlier, # but not the ones in the recently added xref html links. @@ -108,7 +111,7 @@ $string =~ s/(<)(.*@.*)(>)/$1<a class='offshore' href=\"mailto:$2\">$2<\/a>$3/g; # HTMLify file names, assuming file is in the directory defined by $virtp. - $string =~ s{\b(([\w\-_\/]+\.(c|h|cc|cp|hpp|cpp|java))|README)\b} + $string =~ s{\b([\w\-_\/]+\.\w{1,5}|README)\b} {fileref($1, '', $virtp . $1);}ge; return ($string); @@ -158,7 +161,7 @@ return ( 5 < length($string) && ( 0 <= index($string, '_') - || $string =~ m/.[A-Z]/ + || $string =~ m/^.[a-zA-Z]/ ) && 0 > index($string, 'README') # && defined($xref{$string}) FIXME @@ -217,7 +220,6 @@ $_[0] =~ s/\0&/&/g; $_[0] =~ s/\0</</g; $_[0] =~ s/\0>/>/g; - $_[0] =~ s/\xFF//g; # Remove start of line markers } @@ -302,37 +304,49 @@ my @itag = &idref($itagtarget, 'fid', $itagtarget) =~ m/^(.*)$itagtarget(.*)$itagtarget(.*)$/; my $lang = LXR::Lang->new($pathname, $releaseid, @itag); + my ($btype, $frag, $ofrag); if ($lang) { # Source code file if $lang is defined, meaning a parser has been found my $language = $lang->{'ltype'}; # To get back to the key to lookup the tabwidth. &LXR::SimpleParse::init($fileh, ${$config->{'filetype'}{$language}}[3], $lang->parsespec); - my ($btype, $frag) = &LXR::SimpleParse::nextfrag; + ($btype, $frag) = &LXR::SimpleParse::nextfrag; &$outfun(join($line++, @ltag)) if defined($frag); # Loop until nextfrag returns no more fragments while (defined($frag)) { + $frag =~ s/^(\n*)//; # remove initial empty lines + $ofrag = $1; &markspecials($frag); # guard against HTML special characters # Process every fragment according to its category - if ($btype eq 'comment') { - # Comment - &freetextmarkup($frag); # Convert mail adresses to mailto: - $lang->processcomment(\$frag); - } elsif ($btype eq 'string') { - # String - $lang->processstring(\$frag); - } elsif ($btype eq 'include') { - # Include directive - $lang->processinclude(\$frag, $dir); + if ($btype) { + if ( 'comment' eq substr($btype, 0, 7)) { + # Comment + &freetextmarkup($frag); # Convert mail adresses to mailto: + $lang->processcomment(\$frag, $btype); + } elsif ( 'string' eq substr($btype, 0, 6)) { + # String + $lang->processstring(\$frag, $btype); + } elsif ( 'include' eq $btype) { + # Include directive + $lang->processinclude(\$frag, $dir); + } elsif ( 'extra' eq substr($btype, 0, 5)) { + # Language specific + $lang->processextra(\$frag, $btype); + } else { + # Unknown category + # TODO: create a processunknown method + $lang->processcode(\$frag); + } } else { # Code $lang->processcode(\$frag); } &htmlquote($frag); - my $ofrag = $frag; + $ofrag .= $frag; ($btype, $frag) = &LXR::SimpleParse::nextfrag; |
From: Andre-Littoz <ajl...@us...> - 2013-11-08 08:27:27
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9031/lib/LXR Modified Files: SimpleParse.pm Log Message: SimpleParse.pm: fix parsing inaccuracies and try to optimise for speed (though not perfect to keep parsing correctness) Index: SimpleParse.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/SimpleParse.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- SimpleParse.pm 21 Sep 2013 12:54:52 -0000 1.22 +++ SimpleParse.pm 8 Nov 2013 08:27:24 -0000 1.23 @@ -42,20 +42,23 @@ &untabify &init &nextfrag + $dountab ); # Global module variables -my $fileh; # File handle -my @frags; # Fragments in queue -my @bodyid; # Array of body type ids -my @open; # Fragment opening delimiters -my @term; # Fragment closing delimiters -my @stay; # Fragment maintaining current context -my $split; # Fragmentation regexp -my $open; # Fragment opening regexp -my $continue; # Fragment maintaining current context for "no category" -my $tabwidth; # Tab width +my $fileh; # File handle +my @frags; # Fragments in queue +my $next; # Current fragment +my @bodyid; # Array of body type ids +my @open; # Fragment opening delimiters +my @term; # Fragment closing delimiters +my @stay; # Fragment maintaining current context +my $split; # Fragmentation regexp +my $open; # Fragment opening regexp +my $continue; # Fragment maintaining current context for "no category" +my $tabwidth; # Tab width +our $dountab; # Untabify flag (in nextfrag) =head2 C<init ($fileh, $tabhint, @blksep)> @@ -89,18 +92,19 @@ my @blksep; @frags = (); + $next = undef; @bodyid = (); @open = (); @term = (); @stay = (); $split = ''; $open = ''; - $continue = ''; - $tabwidth = 8; + $continue = undef; + $dountab = 1; my $tabhint; ($fileh, $tabhint, @blksep) = @_; - $tabwidth = $tabhint // $tabwidth; + $tabwidth = $tabhint // 8; # Consider every specification in the order given foreach my $s (@blksep) { @@ -108,45 +112,23 @@ my $k = (keys(%$s))[0]; if ($k eq 'atom') { # special case for uncategorised fragments $continue = $$s{$k}; - } - else { + } else { # Value is itself a reference to an array - my $v = @$s{$k}; + my $v = $$s{$k}; push (@bodyid, $k); # Category name push (@open, $$v[0]); # Open delimiter - if (defined($$v[1])) { - push (@term, $$v[1]); # Closing delimiter - } else { - push (@term, undef); - } - if (defined($$v[2])) { - push (@stay, $$v[2]); # Locking pattern - } else { - push (@stay, ''); - } + push (@term, $$v[1]); # Closing delimiter + push (@stay, $$v[2]); # Locking pattern } } - # Replace the anchors with a Start_of_Line marker - # The markers are removed by sub markupfile before - # emiting HTML code - foreach (@open) { - $_ =~ s/^\^/\xFF/; - } - foreach (@term) { - $_ =~ s/^\^/\xFF/; - } - foreach (@stay) { - $_ =~ s/^\^/\xFF/; - } - $continue =~ s/^\^/\xFF/; - # Create the regexps to find any opening delimiter foreach (@open) { - $open .= "^($_)\$|"; + $open .= "($_)|"; $split .= "$_|"; } chop($open); # Remove the last (extraneous) bar + $open = '^[\xFF\n]*(?:'.$open.')$'; # Set the anchors chop($split); # Remove the last (extraneous) bar } @@ -179,8 +161,8 @@ sub untabify { my $t = $_[1] || 8; - $_[0] =~ s/^(\t+)/(' ' x ($t * length($1)))/ge; # Optimize for common case. - $_[0] =~ s/([^\t]*)\t/$1.(' ' x ($t - (length($1) % $t)))/ge; + $_[0] =~ s/^(\t+)/(' ' x ($t * length($1)))/geo; # Optimize for common case. + $_[0] =~ s/([^\t]*)\t/$1.(' ' x ($t - (length($1) % $t)))/geo; return ($_[0]); } @@ -235,46 +217,42 @@ my $frag = undef; # output buffer my $term = undef; # closing delim pattern my $stay = $continue; # lock pattern - my $line = ''; # line buffer + my $change = $split; # delimiter introducing a category change # These initial values set the state for the "anonymous" # default category (i.e. code). It is switched to another # state if $next (the following characters to process) # begins with a starting delimiter. + my $line; # line buffer + my $opos; # position of this delimiter + my $spos; # position of a (conflicting?) "stay" delimimter # print "nextfrag called\n"; while (1) { + $next = shift(@frags) if !defined($next); # read one more line if we have processed # all of the previously read line - if ($#frags < 0) { + if (!$next) { $line = $fileh->getline; + # Exit loop on EOF returning the currently assembled region + # or an undefined pair + last if !defined($line); # Interpret an Emacs-style tab specification - if ( $. <= 2 # Line # 1? - && $line =~ m/^.*-[*]-.*?[ \t;]tab-width:[ \t]*([0-9]+).*-[*]-/ + if ( $. <= 2 # Line # 1 or 2? + && $line =~ m/^.*-\*-.*?[ \t;]tab-width:[ \t]*([0-9]+).*-\*-/o ) { if ($1) { # make sure there really is a non-zero tabwidth $tabwidth = $1; } } - # &untabify($line, $tabwidth); # We inline this for performance. - # Optimize for common case. - if (defined($line)) { - $line =~ s/^(\t+)/' ' x ($tabwidth * length($1))/ge; - $line =~ s/([^\t]*)\t/$1.(' ' x ($tabwidth - (length($1) % $tabwidth)))/ge; - - $frags[0] = "\xFF" . $line; # Add SOL marker + # Optimize for common case. + if ($dountab) { + $line =~ s/^(\t+)/' ' x ($tabwidth * length($1))/geo; + $line =~ s/([^\t]*)\t/$1.(' ' x ($tabwidth - (length($1) % $tabwidth)))/geo; } - } - -# Exit loop on EOF returning the currently assembled region -# or an undefined pair - last if $#frags < 0; - - # skip empty fragments - if ($frags[0] eq '') { - shift(@frags); + $next = "\xFF" . $line; # Add SOL marker } # If the specification defines a locking pattern (in $stay), @@ -282,135 +260,99 @@ # only if the "stay" atom is located inside the present category. # The test below is rather complicated because we rely on # pattern matching, not LR parsing. -# 1- See if there is a "stay" atom in the line. +# 1- See if there is a terminator (either the closing delimiter +# if defined or any opening delimiter) in the line. +# If none, the whole line is made of a single category. +# Otherwise, note its position. +# 2- Loop on the presence of a "stay" atom in the line. # If none, leave the loop. -# 2- Check the terminator (either the closing delimiter if -# defined or any opening delimiter). # 3- If the "stay" atom is located after (i.e. at the right of) # the closing delimiter, leave the loop. # 4- The part up to and including the "stay" atom is shifted -# into the candidate fragment. +# into the candidate fragment and the position of the +# terminator is updated for the next iteration of the +# inner loop. # The process is repeated until there is no more "stay" atoms # in the correct range. # check for "stay" atoms - my $next = shift(@frags); - if ($stay ne '') { - while ($next =~ m/$stay/) { - # Compute the position of the "stay" atom - $next =~ m/^(.*?)($stay)/s; - my $spos = undef; - if (defined($2)) { - $spos = length($1) || 0; - } - my $opos = undef; + if (defined($stay)) { # Look for "term" or any "open delim" if not defined - my $change = $term // $split; - if ($next =~ m/$change/) { + $opos = undef; + while ( !defined($opos) + && $next =~ m/$change/ + ) { # Compute the position of the "end" delimiter - $next =~ m/^(.*?)($change)/s; - if (defined($2)) { - $opos = length($1) || 0 ; + $opos = $-[0]; + while ($next =~ m/$stay/) { + # Compute the end position of the "stay" atom + $spos = $+[0]; + # Compare positions and make decision + last if $-[0] > $opos; + # There is a "stay" atom, shift it into fragment + $frag .= substr($next, 0, $spos); + $next = substr($next, $spos); + $opos -= $spos; + if ($opos <= 0) { + $opos = undef; + last; } } - # Compare positions and make decision - last if (defined($opos) && ($spos > $opos)); - # There is a "stay" atom, shift it into fragment - $next =~ s/^(.*?)($stay)//s; - $frag .= $1 . $2; } } # Have we already started a region? - if (defined($frag)) { + if ( defined($frag) # something in output buffer? + && $frag !~ m/^[\xFF\n]*$/o # not just newlines? + ) { # We already have something in the buffer. # Is it a named category? # Add to output buffer till we find a closing delimiter. # Remember that "stay" constructs have been processed above. if (defined($btype) && defined($term)) { - if ($next =~ m/$term/) { # A close delim in this fragment? - # Next instruction group is 5.8 compatible but does - # not allow capture parenthesis in regexps - # $next =~ m/^(.*?)($term)(.*)/s; - # if ($3 ne '') { - # unshift(@frags, $3); # Requeue last part - # } - # $frag .= $1 . $2; - # This group contains 5.10 features and removes the - # above mentioned limitation - $next =~ m/^(?'HEAD'.*?$term)(?'TAIL'.*)/s; - if ($+{'TAIL'} ne '') { - unshift(@frags, $+{'TAIL'}); # Requeue last part - } - $frag .= $+{'HEAD'}; - # End of group - last; # We are done, terminator met + if ($next =~ m/$term/) { # A close delim in this fragment? + $frag .= substr($next, 0, $+[0]); + $next = substr($next, $+[0]); + last; # We are done, terminator met } # An anonymous region is in the buffer (it defaults to "code"). # This default region is left on any opening delimiter. } else { - if ($next =~ m/^($split)/) { - unshift(@frags, $next); # requeue block -# print "encountered open token while btype was $btype\n"; + # Split at delimiter + if ($next =~ s/^(.*?)($split)//) { # An open delim in this fragment? + unshift(@frags, $next) if $next ne ''; # Requeue last part + $frag .= $1; # Stuff part before delim + $next = $2; # Delimiter last; } - if ($next =~ m/$split/) { # An open delim in this fragment? - # Next instruction group is 5.8 compatible but does - # not allow capture parenthesis in regexps - # $next =~ m/^(.*?)($split)(.*)/s; - # if ($3 ne '') { - # unshift(@frags, $3); # Requeue last part - # } - # unshift(@frags, $2); # Requeue open delimiter - # $next = $1 - # This group contains 5.10 features and removes the - # above mentioned limitation - $next =~ m/^(?'HEAD'.*?)(?'OPEN'$split)(?'TAIL'.*)/s; - if ($+{'TAIL'} ne '') { - unshift(@frags, $+{'TAIL'}); # Requeue last part - } - unshift(@frags, $+{'OPEN'}); # Requeue open delimiter - $next = $+{'HEAD'} - # End of group - } } - $frag .= $next; + $frag .= $next; # Full fragment (no delim) + $next = undef; } else { # This begins a new region (output buffer empty). # Stuff the sequence up to any opening delimiter or the complete # input line if there is no delimiter in range. -# print "start of new fragment\n"; - if ($next =~ m/$split/) { # An open delim in this fragment? - # Next instruction group is 5.8 compatible but does - # not allow capture parenthesis in regexps - # $next =~ m/^(.*?)($split)(.*)/s; # Split fragment at first - # if ($3 ne '') { - # unshift(@frags, $3); # Requeue last part - # } - # if ($1 ne '') { # Choose which frag to process - # unshift(@frags, $2); # Queue delimiter - # $frag = $1; - # } else { - # $frag = $2; - # This group contains 5.10 features and removes the - # above mentioned limitation - $next =~ m/^(?'HEAD'.*?)(?'OPEN'$split)(?'TAIL'.*)/s; # Split fragment at first - if ($+{'TAIL'} ne '') { - unshift(@frags, $+{'TAIL'}); # Requeue last part - } - if ($+{'HEAD'} ne '') { # Choose which frag to process - unshift(@frags, $+{'OPEN'}); # Queue delimiter - $frag = $+{'HEAD'}; +# print "start of new fragment\n"; + if ($next =~ s/^(.*?)($split)//) { # An open delim in this fragment? + if ($1 ne '') { # Anything before the delim? + unshift(@frags, $next) if $next ne ''; # Requeue last part + $next = $2; # Delimiter + $frag .= $1; # Stuff part before delim + last if $frag !~ m/^[\xFF\n]*$/o; + $frag .= $next; # Fragment was "empty" + $next = undef; } else { - $frag = $+{'OPEN'}; + $frag .= $2; + $next = undef if $next eq ''; } - # End of group - } else { # Full fragment (no delim) - $frag = $next; + } else { # Full fragment (no delim) + $frag .= $next; + $next = undef; } # Find the blocktype of the current block - if (defined($frag) && (@_ = $frag =~ m/$open/)) { -# print "hit:$frag\n"; +# if (defined($frag) && (@_ = $frag =~ m/$open/)) { + if (@_ = $frag =~ m/$open/) { +# print "hit:$frag\n"; # grep in a scalar context returns the number of times # EXPR evaluates to true, which is this case will be # the index of the first defined element in @_. @@ -422,14 +364,18 @@ last; } else { # Set the category characteristics for further parsing - $term = $term[$btype]; - $stay = $stay[$btype]; - } + $term = $term[$btype]; + if ('CODE' eq ref($term)) { + $term = eval(&$term()); + } + $stay = $stay[$btype]; + $change = $term // $split; + } } } } $btype = $bodyid[$btype] if defined($btype); - + $frag =~ s/\xFF//go; # Remove start of line markers return ($btype, $frag); } @@ -466,9 +412,8 @@ =cut sub requeuefrag { - my $frag = shift; - - unshift(@frags, $frag); # Requeue fragment + unshift(@frags, $next) if defined($next); # Requeue fragment + $next = $_[0]; } 1; |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 19:39:25
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22060/lib/LXR Modified Files: Index.pm Log Message: Index.pm & Index/*: nex Index initialisation and synchronisation of specific drivers; optimisation for speed (fewer transactions and commits) Index: Index.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- Index.pm 21 Sep 2013 12:54:52 -0000 1.24 +++ Index.pm 7 Nov 2013 19:39:22 -0000 1.25 @@ -74,7 +74,7 @@ =cut -# NOTE; +# NOTE: # Some Perl statements below are commented out as '# opt'. # This is meant to decrease the number of calls to DBI methods, # in this case finish() since we know the previous fetch_array() @@ -90,41 +90,44 @@ # only once and do not contribute to the running time behaviour. sub new { - my ($self, $dbname, $prefix) = @_; + my ($self, $config) = @_; my $index; %files = (); %symcache = (); %cntcache = (); - if (!defined($prefix)) { - $prefix = 'lxr_'; + if (!defined($config->{'dbprefix'})) { + $config->{'dbprefix'} = 'lxr_'; } - if ($dbname =~ m/^DBI:/i) { - if ($dbname =~ m/^dbi:mysql:/i) { + if ($config->{'dbname'} =~ m/^DBI:(\w+):/i) { + my $dbname = uc($1); + if ('MYSQL' eq $dbname) { require LXR::Index::Mysql; - $index = LXR::Index::Mysql->new($dbname, $prefix); - } elsif ($dbname =~ m/^dbi:Pg:/i) { + $index = LXR::Index::Mysql->new($config); + } elsif ('PG' eq $dbname) { require LXR::Index::Postgres; - $index = LXR::Index::Postgres->new($dbname, $prefix); - } elsif ($dbname =~ m/^dbi:SQLite:/i) { + $index = LXR::Index::Postgres->new($config); + } elsif ('SQLITE' eq $dbname) { require LXR::Index::SQLite; - $index = LXR::Index::SQLite->new($dbname, $prefix); - } elsif ($dbname =~ m/^dbi:oracle:/i) { + $index = LXR::Index::SQLite->new($config); + } elsif ('ORACLE' eq $dbname) { require LXR::Index::Oracle; - $index = LXR::Index::Oracle->new($dbname, $prefix); + $index = LXR::Index::Oracle->new($config); } else { - die "Can't find database, $dbname"; + die 'Can\'t find database ' . $config->{'dbname'}; } } else { - die "Can't find database, $dbname"; + die 'Can\'t find database ' . $config->{'dbname'}; } + $index->{'config'} = $config; # Common syntax transactions # Care is taken not to replace specific syntax transactions which # are usually related to auto-increment numbering where syntax # differs from one DB engine to another. + my $prefix = $config->{'dbprefix'}; # 'files_insert' mandatory but involves auto-increment if (!exists($index->{'files_select'})) { @@ -435,11 +438,12 @@ =cut sub fileidifexists { - my ($self, $filename, $revision) = @_; +# Reminder: my ($self, $filename, $revision) = @_; + my $self = shift @_; my $fileid; # unless (defined($fileid = $files{"$filename\t$revision"})) { - $self->{'files_select'}->execute($filename, $revision); + $self->{'files_select'}->execute(@_); ($fileid) = $self->{'files_select'}->fetchrow_array(); # opt $self->{'files_select'}->finish(); # $files{"$filename\t$revision"} = $fileid; @@ -448,13 +452,14 @@ } sub fileid { - my ($self, $filename, $revision) = @_; +# Reminder: my ($self, $filename, $revision) = @_; + my $self = shift @_; my $fileid; - $fileid = $self->fileidifexists($filename, $revision); + $fileid = $self->fileidifexists(@_); unless ($fileid) { - $self->{'files_insert'}->execute($filename, $revision); - $self->{'files_select'}->execute($filename, $revision); + $self->{'files_insert'}->execute(@_); + $self->{'files_select'}->execute(@_); ($fileid) = $self->{'files_select'}->fetchrow_array(); $self->{'status_insert'}->execute($fileid, 0); # opt $self->{'files_select'}->finish(); @@ -513,7 +518,7 @@ =cut sub nextfile { - my ($self) = @_; + my $self = shift @_; return $self->{'allfiles_select'}->fetchrow_array(); # opt $self->{'files_select'}->finish(); @@ -561,13 +566,14 @@ =cut sub setfilerelease { - my ($self, $fileid, $releaseid) = @_; +# my ($self, $fileid, $releaseid) = @_; + my $self = shift @_; - $self->{'releases_select'}->execute($fileid + 0, $releaseid); + $self->{'releases_select'}->execute(@_); my ($fid) = $self->{'releases_select'}->fetchrow_array(); # opt $self->{'releases_select'}->finish(); unless ($fid) { - $self->{'releases_insert'}->execute($fileid + 0, $releaseid); + $self->{'releases_insert'}->execute(@_); } } @@ -599,9 +605,10 @@ =cut sub removerelease { - my ($self, $fid, $releaseid) = @_; +# my ($self, $fid, $releaseid) = @_; + my $self = shift @_; - $self->{'delete_one_release'}->execute($fid, $releaseid); + $self->{'delete_one_release'}->execute(@_); } =head2 C<fileindexed ($fileid)> @@ -801,10 +808,11 @@ =cut sub filetimestamp { - my ($self, $filename, $revision) = @_; +# my ($self, $filename, $revision) = @_; + my $self = shift @_; my ($fileid, $timestamp); - $fileid = $self->fileidifexists($filename, $revision); + $fileid = $self->fileidifexists(@_); if (defined($fileid)) { $self->{'status_timestamp'}->execute($fileid); $timestamp = $self->{'status_timestamp'}->fetchrow_array(); @@ -841,10 +849,11 @@ =cut sub symdeclarations { - my ($self, $symname, $releaseid) = @_; +# my ($self, $symname, $releaseid) = @_; + my $self = shift @_; my (@ret, @row); - $self->{'definitions_select'}->execute($symname, $releaseid); + $self->{'definitions_select'}->execute(@_); while (@row = $self->{'definitions_select'}->fetchrow_array) { $row[3] &&= $self->symname($row[3]); # convert the relsym symid push(@ret, [@row]); @@ -916,9 +925,9 @@ $cntcache{$relsym} += 1; } } -die "Symbol cache not initialised for sym $symname\n" if (!defined($symcache{$symname})); -die "Symbol cache not initialised for rel $relsym\n" - if (defined($relsym) && !defined($symcache{$relsym})); +# die "Symbol cache not initialised for sym $symname\n" if (!defined($symcache{$symname})); +# die "Symbol cache not initialised for rel $relsym\n" +# if (defined($relsym) && !defined($symcache{$relsym})); } =head2 C<symreferences ($symname, $releaseid)> @@ -949,10 +958,11 @@ =cut sub symreferences { - my ($self, $symname, $releaseid) = @_; +# my ($self, $symname, $releaseid) = @_; + my $self = shift @_; my (@ret, @row); - $self->{'usages_select'}->execute($symname, $releaseid); + $self->{'usages_select'}->execute(@_); while (@row = $self->{'usages_select'}->fetchrow_array) { push(@ret, [@row]); } @@ -1028,14 +1038,14 @@ } else { $cntcache{$symname} += 1; } -die "Symbol cache not initialised for $symname\n" if (!defined($symcache{$symname})); +# die "Symbol cache not initialised for $symname\n" if (!defined($symcache{$symname})); } =head2 C<issymbol ($symname, $releaseid)> C<issymbol> returns I<true> (1) for an existing symbol in a given release according to the DB, -0 otherwise. +I<false> (0) otherwise. =over @@ -1172,10 +1182,11 @@ =cut sub symname { - my ($self, $symid) = @_; +# my ($self, $symid) = @_; + my $self = shift @_; my $symname; - $self->{'symbols_byid'}->execute($symid + 0); + $self->{'symbols_byid'}->execute(@_); ($symname) = $self->{'symbols_byid'}->fetchrow_array(); return $symname; @@ -1229,14 +1240,15 @@ =cut sub decid { - my ($self, $lang, $string) = @_; +# my ($self, $lang, $string) = @_; + my $self = shift @_; my $id; - $self->{'langtypes_select'}->execute($lang, $string); + $self->{'langtypes_select'}->execute(@_); ($id) = $self->{'langtypes_select'}->fetchrow_array(); unless (defined($id)) { - $self->{'langtypes_insert'}->execute($lang, $string); - $self->{'langtypes_select'}->execute($lang, $string); + $self->{'langtypes_insert'}->execute(@_); + $self->{'langtypes_select'}->execute(@_); ($id) = $self->{'langtypes_select'}->fetchrow_array(); } # opt $self->{'langtypes_select'}->finish(); @@ -1263,7 +1275,7 @@ =cut sub deccount { - my ($self) = @_; + my $self = shift @_; my $dcount; $self->{'langtypes_count'}->execute(); @@ -1281,7 +1293,7 @@ =cut sub commit { - my ($self) = @_; + my $self = shift @_; $self->{dbh}->commit; } @@ -1294,7 +1306,7 @@ =cut sub forcecommit { - my ($self) = @_; + my $self = shift @_; my $oldcommitmode = $self->{dbh}{'AutoCommit'}; $self->{dbh}{'AutoCommit'} = 0; @@ -1443,25 +1455,25 @@ $self->{dbh}{'AutoCommit'} = 0; $self->{dbh}->commit; - $self->{'related_symbols_select'}->execute($fid); - while (($symid, $symcount, $symname) - = $self->{'related_symbols_select'}->fetchrow_array() - ) { - if (!exists($symcache{$symname})) { - $symcache{$symname} = $symid; - $cntcache{$symname} = $symcount; - } else { - if ($cntcache{$symname} < 0) { - $cntcache{$symname} = -$cntcache{$symname}; -die "Inconsistent symbol reference count for $symname" - if $symcount != $cntcache{$symname}; - } - } - $cntcache{$symname} = $symcount - 1 - if $cntcache{$symname} > 0; - } -# opt $self->{'related_symbols_select'}->finish(); - $self->flushcache(1); +# $self->{'related_symbols_select'}->execute($fid); +# while (($symid, $symcount, $symname) +# = $self->{'related_symbols_select'}->fetchrow_array() +# ) { +# if (!exists($symcache{$symname})) { +# $symcache{$symname} = $symid; +# $cntcache{$symname} = $symcount; +# } else { +# if ($cntcache{$symname} < 0) { +# $cntcache{$symname} = -$cntcache{$symname}; +# die "Inconsistent symbol reference count for $symname" +# if $symcount != $cntcache{$symname}; +# } +# } +# $cntcache{$symname} = $symcount - 1 +# if $cntcache{$symname} > 0; +# } +# # opt $self->{'related_symbols_select'}->finish(); +# $self->flushcache(1); $self->{'delete_file_definitions'}->execute($fid); $self->{'delete_file_usages'}->execute($fid); $self->{dbh}->commit; |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 17:58:51
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15141/lib/LXR Modified Files: Common.pm Files.pm Log Message: Commin.pm, Files.pm & Files/*: new initialisation interface to Files family and config object cached internally Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- Common.pm 24 Sep 2013 07:36:09 -0000 1.104 +++ Common.pm 7 Nov 2013 17:58:48 -0000 1.105 @@ -846,9 +846,7 @@ delete $HTTP->{'param'}{$param}; } - $files = LXR::Files->new( $config->{'sourceroot'} - , $config->{'sourceparams'} - ); + $files = LXR::Files->new($config); die 'Can\'t create Files for ' . $config->{'sourceroot'} if !defined($files); $index = LXR::Index->new( $config->{'dbname'} Index: Files.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Files.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Files.pm 21 Sep 2013 12:54:52 -0000 1.23 +++ Files.pm 7 Nov 2013 17:58:48 -0000 1.24 @@ -34,60 +34,63 @@ use LXR::Common; -=head2 C<new ($srcroot, $params)> +=head2 C<new ($config)> C<new> is Files object constructor. It dispatches to the specific constructor based on its first argument. =over -=item 1 C<$srcroot> +=item 1 C<$config> -a I<string> containing the repository type (as optional prefix:) -and its location in the file system +a I<reference> to the I<hash> containing configuration parameters for this +tree -=item 1 C<$params> +=over -an optional I<hash> reference from lxr.conf used to pass extra information -to the real constructor +B<Note:> + +=item Perl threads are rather restrictive on the kind of data in +shared variables; it is thus better not to rely on "global" variables +and store a pointer to "global" data inside the object. + +=back =back =cut sub new { - my ( $self, $srcroot, $params ) = @_; + my ( $self, $config ) = @_; my $files; - if ( $srcroot =~ /^CVS:(.*)/i ) { + $config->{'sourceroot'} =~ m/^(\w+):/; + my $container = uc($1); + if ('CVS' eq $container) { require LXR::Files::CVS; - $srcroot = $1; - $files = LXR::Files::CVS->new($srcroot); + $files = LXR::Files::CVS->new($config); } - elsif ( $srcroot =~ /^git:(.*)/i ) { + elsif ('GIT' eq $container) { require LXR::Files::GIT; - $srcroot = $1; - $files = LXR::Files::GIT->new($srcroot, $params); + $files = LXR::Files::GIT->new($config); } - elsif ( $srcroot =~ /^svn:(.*)/i ) { + elsif ('SVN' eq $container) { require LXR::Files::Subversion; - $srcroot = $1; - $files = LXR::Files::Subversion->new($srcroot, $params); + $files = LXR::Files::Subversion->new($config); } - elsif ( $srcroot =~ /^hg:(.*)/i ) { + elsif ('HG' eq $container) { require LXR::Files::Mercurial; - $srcroot = $1; - $files = LXR::Files::Mercurial->new($srcroot, $params); + $files = LXR::Files::Mercurial->new($config); } - elsif ( $srcroot =~ /^bk:(.*)/i ) { + elsif ('BK' eq $container) { require LXR::Files::BK; - $srcroot = $1; - $files = LXR::Files::BK->new($srcroot, $params); + $files = LXR::Files::BK->new($config); } else { require LXR::Files::Plain; - $files = LXR::Files::Plain->new($srcroot); + $files = LXR::Files::Plain->new($config); } + $files->{'config'} = $config; return $files; } @@ -556,7 +559,7 @@ $fileh = $self->getfilehandle ($filename, $releaseid); return undef unless defined($fileh); - $tmp = $config->{'tmpdir'} + $tmp = $self->{'config'}{'tmpdir'} . '/lxrtmp.' . time . '.' . $$ @@ -602,7 +605,7 @@ sub releaserealfilename { my ($self, $filename) = @_; - my $td = $config->{'tmpdir'}; + my $td = $self->{'config'}{'tmpdir'}; if ($filename =~ m!^$td/lxrtmp\.\d+\.\d+\.\d+$!) { unlink($filename); } @@ -657,10 +660,10 @@ my ($self, $path, $node) = @_; return 1 if substr($node, 0, 1) eq '.'; # ignore "dot" dirs - foreach my $ignoredir (@{$config->{'ignoredirs'}}) { + foreach my $ignoredir (@{$self->{'config'}{'ignoredirs'}}) { return 1 if $node eq $ignoredir; } - foreach my $ignoredir (@{$config->{'filterdirs'}}) { + foreach my $ignoredir (@{$self->{'config'}{'filterdirs'}}) { return 1 if ($path.$node) =~ $ignoredir; } return 0; @@ -712,9 +715,9 @@ sub _ignorefiles { my ($self, $path, $node) = @_; - my $ignorepat = $config->{'ignorefiles'}; + my $ignorepat = $self->{'config'}{'ignorefiles'}; return 1 if $node =~ m/$ignorepat/; - foreach my $filterfile (@{$config->{'filterfiles'}}) { + foreach my $filterfile (@{$self->{'config'}{'filterfiles'}}) { return 1 if ($path.$node) =~ $filterfile; } return 0; |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 17:45:44
|
Update of /cvsroot/lxr/lxr/templates In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14308/templates Modified Files: datastorage.conf.part lxr.conf lxrkernel.conf tree-server1.conf.part tree-server2.conf.part Log Message: Various templates/*.conf[.part]: add validation filter in user answers Index: datastorage.conf.part =================================================================== RCS file: /cvsroot/lxr/lxr/templates/datastorage.conf.part,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- datastorage.conf.part 3 Sep 2013 08:45:11 -0000 1.2 +++ datastorage.conf.part 7 Nov 2013 17:45:41 -0000 1.3 @@ -24,7 +24,7 @@ #- ----- MySQL ----- #@m: #@ IF !%_globaldb% -#@ ASK,DB_name --- Database name?; -2 +#@ ASK,DB_name --- Database name?; -2; ^\w+$,invalid characters in name #@ ENDIF , 'dbname' => 'dbi:mysql:dbname=%DB_name%' #- @@ -35,14 +35,17 @@ #- ----- PostgreSQL ----- #@p: #@ IF !%_globaldb% -#@ ASK,DB_name --- Database name?; -2 +#@ ASK,DB_name --- Database name?; -2; ^\w+$,invalid characters in name #@ ENDIF , 'dbname' => 'dbi:Pg:dbname=%DB_name%;host=localhost' #- #- ----- SQLite ----- #@s: #@ IF !%_globaldb% -#@ ASK,DB_name --- Database file? (e.g. /home/myself/storage.db); -2 +#@ ASK,DB_name --- Database file? (e.g. /home/myself/storage.db); -2\ + #@ ; ^/,absolute file path required + #@ , [^/]$,must be a file +#@ CANONR,DB_name ',\' #@ ENDIF , 'dbname' => 'dbi:SQLite:dbname=%DB_name%' #@ENDC %_dbengine% @@ -50,8 +53,9 @@ #- #@IF %_dbengine% ne "s" #@ IF !%_dbuser% -#@ ASK,DB_tree_user --- DB user name?; -1; ; lxr +#@ ASK,DB_tree_user --- DB user name?; -1; ^\w+$,invalid characters in name; lxr #@ ASK,DB_tree_password --- DB password?; -1; ; lxrpw +#@ CANONR,DB_tree_password ',\' , 'dbuser' => '%DB_tree_user%' , 'dbpass' => '%DB_tree_password%' @@ -59,8 +63,9 @@ #@ ELSEIF !%_globaldb% #@ ASK,C Do you want to override the global '%DB_user%' user name?; 2; yes,no; Y,N #@ IF %C% eq "Y" -#@ ASK,DB_tree_user --- DB user name?; -1; ; lxr +#@ ASK,DB_tree_user --- DB user name?; -1; ^\w+$,invalid characters in name; lxr #@ ASK,DB_tree_password --- DB password?; -1; ; lxrpw +#@ CANONR,DB_tree_password ',\' , 'dbuser' => '%DB_tree_user%' , 'dbpass' => '%DB_tree_password%' @@ -75,7 +80,7 @@ #- #- #@IF !%_dbprefix% -#@ ASK,DB_tbl_prefix --- DB table prefix?; -1; ; lxr_ +#@ ASK,DB_tbl_prefix --- DB table prefix?; -1; ^\w+$,invalid characters in name; lxr_ , 'dbprefix' => '%DB_tbl_prefix%' #- @@ -83,7 +88,7 @@ #@ ASK,C Do you want to override the global '%DB_global_prefix%' table prefix?; 2; yes,no; Y,N #@ IF %C% eq "Y" -#@ ASK,DB_tbl_prefix --- DB table prefix?; -1; ; lxr_ +#@ ASK,DB_tbl_prefix --- DB table prefix?; -1; ^\w+$,invalid characters in name; lxr_ , 'dbprefix' => '%DB_tbl_prefix%' #@ ELSE # If you need multiple lxr configurations in one database, set different table Index: lxr.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/lxr.conf,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- lxr.conf 3 Sep 2013 08:45:12 -0000 1.58 +++ lxr.conf 7 Nov 2013 17:45:41 -0000 1.59 @@ -20,6 +20,8 @@ #- updated for web server config. -- ajl 2013/01/20 #- updated for change in LCL statements-- ajl 2013/04/28 #- updated for more common factoring -- ajl 2013/05/13 +#- updated for new parameters -- ajl 2013/09/28 +#- added answer validition criteria -- ajl 2013/11/06 ( ################################ @@ -46,6 +48,7 @@ #- Title for this tree to display in page header area #- if you aren't satisfied with the default #@ASK --- Caption in page header? (e.g. Project XYZZY displayed by LXR); -2 +#@CANONR ',\' 'caption' => '%A%' #@ADD tree-server2.conf.part @@ -68,7 +71,10 @@ #- The names of the version directories must match the values for the Version #- variable (see the version selection subsection). #@ MSG A source directory contains one sub-directory for every version. -#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2 +#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => '%A%' #- #- - Case No. 2: CVS repository @@ -77,7 +83,10 @@ #- followed by the path to the repository. Note this must be file accessible - remote #- server access does NOT work. #@ MSG A CVS repository is a directory containing ,v files -#@ ASK --- CVS repository? (e.g. /home/myself/project-CVS); -2 +#@ ASK --- CVS repository? (e.g. /home/myself/project-CVS); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => 'cvs:%A%' #- #- - Case No. 3: GIT repository @@ -87,7 +96,10 @@ #- directories. #@ MSG A Git repository is a directory containing objects, refs, index, ... subdirectories. #@ MSG It is usually named .git in some user directory and is thus not visible. -#@ ASK,GITrepo --- Git repository? (e.g. /home/myself/project-git/.git); -2 +#@ ASK,GITrepo --- Git repository? (e.g. /home/myself/project-git/.git); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => 'git:%GITrepo%' #- #- Any parameters to the source access method should be specified below. @@ -113,7 +125,10 @@ #@ MSG A Subversion repository is a directory containing a database for #@ MSG the source-tree. The present backend implementation in LXR limits #@ MSG access to local repositories. -#@ ASK --- Subversion repository? (e.g. /home/myself/project-svn); -2 +#@ ASK --- Subversion repository? (e.g. /home/myself/project-svn); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => 'svn:%A%' #- #- Any parameters to the source access method should be specified below. @@ -139,7 +154,10 @@ #@ MSG A Mercurial repository is a directory containing a database for #@ MSG the source-tree. The present backend implementation in LXR limits #@ MSG access to local repositories. -#@ ASK --- Mercurial repository? (e.g. /home/myself/project-hg); -2 +#@ ASK --- Mercurial repository? (e.g. /home/myself/project-hg); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => 'hg:%A%' #- #- Any parameters to the source access method should be specified below. @@ -166,14 +184,19 @@ #@ MSG BitKeeper is proprietary software. The BK management routines are more or less #@ MSG in their 2005 state. This interface has not been tested for many years. #@ MSG There is absolutely no guarantee on BK operation. -#@ ASK --- BK repository? (e.g. /home/myself/project-BK); -2 +#@ ASK --- BK repository? (e.g. /home/myself/project-BK); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => 'bk:%A%' #- #- Any parameters to the source access method should be specified below. #- , 'sourceparams' => #@ MSG BK needs a read/write temporary directory. -#@ ASK --- BK temporary directory? (e.g. /home/myself/BKtemp); -2 +#@ ASK --- BK temporary directory? (e.g. /home/myself/BKtemp); -2\ + #@ ; ^/,absolute file path required +#@ CANONR ',\' { 'cachepath' => '%A%' } #@ENDC #- - End of tree storage - - @@ -183,6 +206,7 @@ #- # Or if you want automatic version insertion #- , 'sourcerootname' => '$v' #@ASK Name to display for the path root? (e.g. Project or $v for version); -1; ; $v +#@CANONR ',\' , 'sourcerootname' => '%A%' # Version selection subsection # @@ -194,6 +218,7 @@ # Define typed variable "v". { 'v' => #@ASK Label for version selection menu? ; -1; ; Version +#@CANONR ',\' { 'name' => '%A%' # This is the list of versions to index. #- @@ -207,12 +232,16 @@ #- #- - Case No. 1: versions stored in a file #@R: -#@ ASK --- Version file? (absolute path or relative to LXR root dir.); -2 +#@ ASK --- Version file? (absolute path or relative to LXR root dir.); -2\ + #@ ; [^/]$,file required +#@ CANONR ',\' , 'range' => [ readfile('%A%') ] #- #- - Case No. 2: versions given explicitly in a list #@L: , 'range' => [qw( +#@ ASK --- Version name? ; -2 + %A% #@ KEEPON --- Version name? (hit return to stop) %A% #@ ENDK @@ -240,7 +269,7 @@ #- , 'range' => sub { opendir (my $dh, $LXR::Common::config->{'sourceroot'}) - || die "can't open source root directory: $!"; + or die "can\'t open source root directory: $!"; my @dirs = grep { m/^[^.]/ # Discard invisible items && -d "$LXR::Common::config->{'sourceroot'}/$_" @@ -263,7 +292,7 @@ ##### The following #U lines may be uncommented if you prefer ##### the static list gathered by ./genxref --allversions #U my $vfn = $LXR::Common::config->{'virtroot'}; - #U $vfn =~ s|([^-a-zA-Z0-9.\@_])|sprintf("%%%02X", ord($1))|ge; + #U $vfn =~ s|([^-a-zA-Z0-9.\@_])|sprintf('%%%02X', ord($1))|ge; #U $vfn = 'custom.d/CVS' . $vfn; #U if (-f $vfn) { #U return readfile($vfn); @@ -287,17 +316,17 @@ { my $some_dir; ##### You can comment out one of the following blocks ##### if you want to limit the set of versions - $some_dir = "%GITrepo%/refs/tags"; - opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!"; + $some_dir = '%GITrepo%/refs/tags'; + opendir (DIR, $some_dir) or die "can\'t opendir $some_dir: $!"; my @files = grep { -f "$some_dir/$_" } readdir (DIR); closedir DIR; ##### Add more $some_dir = "%GITrepo%/refs/heads"; - opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!"; + opendir (DIR, $some_dir) or die "can\'t opendir $some_dir: $!"; my @files = grep { -f "$some_dir/$_" } readdir (DIR); closedir DIR; ##### End of enumeration - unshift (@files, "HEAD"); + unshift (@files, 'HEAD'); return sort @files; } # @@ -309,7 +338,7 @@ # my $kernel = new Linux::KernelSort; # # my $some_dir = "/path/to/linux-2.6/.git/refs/tags"; - # opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!"; + # opendir (DIR, $some_dir) or die "cannot opendir $some_dir: $!"; # my @files = grep { -f "$some_dir/$_" } readdir (DIR); # closedir DIR; # # Linus's tags all have a leading "v" @@ -362,7 +391,7 @@ ##### You may comment some of the following lines to limit the ##### number of displayed revisions, provided at least one is ##### left active. If you keep only allbranches, uncomment the - ##### 'tip' line to guarantee at least one revision is + ##### \'tip\' line to guarantee at least one revision is ##### reachable. ( $files->allbranches() , $files->alltags () @@ -393,6 +422,7 @@ #@ ASK --- Default displayed version is first in 'range'?; 1; yes,no; Y,N #@ IF "%A%" eq 'N' #@ ASK,N --- Default version name?; -2 +#@ CANONR ',\' , 'default' => '%N%' #@ ELSE # The default version to display @@ -441,6 +471,8 @@ #@ ON first , 'incprefix' => [qw( #@ ENDON +#@ CANONR /+ , , /*, / +#@ CANON /+$,,^/*,/ %A% #@ ON epilog )] Index: lxrkernel.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/lxrkernel.conf,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- lxrkernel.conf 3 Sep 2013 08:45:12 -0000 1.10 +++ lxrkernel.conf 7 Nov 2013 17:45:41 -0000 1.11 @@ -60,6 +60,7 @@ #- updated to use LCL statements -- ajl 2012/11/30 #- updated for web server config. -- ajl 2013/01/20 #- updated for more common factoring -- ajl 2013/05/13 +#- added answer validition criteria -- ajl 2013/11/06 ( ################################ @@ -89,7 +90,8 @@ #- Title for this tree to display in page header area #- if you aren't satisfied with the default #@ASK --- Caption in page header?; -1; ; Linux kernel cross-references - , 'caption' => '%A%' +#@CANONR ',\' + 'caption' => '%A%' #@ADD tree-server2.conf.part # Tree location subsection # @@ -108,7 +110,10 @@ #- The names of the version directories must match the values for the Version #- variable (see the version selection subsection). #@ MSG A source directory contains one sub-directory for every version. -#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2 +#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2\ + #@ ; ^/,absolute file path required +#@ CANON /+$,,^/+,/ +#@ CANONR ',\' , 'sourceroot' => '%A%' #- #@Y: @@ -145,6 +150,7 @@ { 'v' => #@ASK Label for version selection menu? ; -1; ; Version +#@CANONR ',\' { 'name' => '%A%' #@MSG Versions are retrieved from file %LXRconfdir%/version_list.txt #@MSG They are collected into this file by script kernel-vars-grab.sh @@ -156,6 +162,7 @@ #@ ASK --- Default displayed version is first in 'range'?; 1; yes,no; Y,N #@ IF "%A%" eq 'N' #@ ASK,N --- Default version name?; -2 +#@ CANONR ',\' , 'default' => '%N%' #@ ELSE # The default version to display @@ -165,6 +172,7 @@ } , 'a' => #@ASK Label for architecture selection menu? ; -1; ; Architecture +#@CANONR ',\' { 'name' => '%A%' , 'range' => [ readfile('%LXRconfdir%/arch_list.txt') ] , 'default' => 'x86' Index: tree-server1.conf.part =================================================================== RCS file: /cvsroot/lxr/lxr/templates/tree-server1.conf.part,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tree-server1.conf.part 3 Sep 2013 08:45:12 -0000 1.1 +++ tree-server1.conf.part 7 Nov 2013 17:45:41 -0000 1.2 @@ -49,15 +49,28 @@ #@IF 'H' eq "%_routing%" #@ LOG Configuring individual host name or IP (as http://...) #@ MSG Remember: they must be unique! -#@ ASK,hostname --- Host name?; -2 +#@ ASK,hostname --- Host name?\ + #@ ; ^(?i:https?:)?//,not an HTTP URL; -2\ + #@ , //[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$,invalid characters in URL +#- The trailing comma below is not an error, it defines an empty string +# CANON,hostname /$, , 'host_names' => [ '%hostname%' -#@ KEEPON --- Alias name ? (hit return to stop) +#@ KEEPON --- Alias name ? (hit return to stop):; -3\ + #@ ; ^(?i:https??:)?//,not an HTTP URL\ + #@ , //[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$,invalid characters in URL +#@ ON none + # Put here aliases for host name, such as + # , '//%treeid%.localhost' + # , 'http://%treeid%.mycomputer.outside.domain:12345' +#@ ENDON +# @CANON /$, , '%A%' #@ ENDK ] , #@ELSEIF 'P' eq "%_routing%" -#@ ASK,treeid --- Prefix for host name?; -2 +#@ ASK,treeid --- Prefix for host name?; -2\ + #@ ; ^[\w-]+(?:\.[\w-]+)*$,invalid characters in name 'host_names' => [ '%scheme%//%treeid%.%hostname%' #@ ARRAY schemealiases,S hostaliases,A portaliases,P #@ ON none @@ -92,19 +105,24 @@ #- - a) Routing through section path #@ELSEIF 'S' eq "%_routing%" #@ MSG All section paths must be unique! -#@ ASK,virtroot --- Full virtual root? (e.g. /section/project/title); -2 +#@ ASK,virtroot --- Full virtual root? (e.g. /section/project/title)\ + #@ ; -2; ^[^']+$,quotes not allowed +#@ CANON,virtroot /+$,,^/*,/ #- - b) Routing through extraction from section path #@ELSEIF 'E' eq "%_routing%" #@ IF 'b' eq "%_virtrootpolicy%" #@ MSG The tree needs to be uniquely identified as e.g. %virtrootbase%/the_tree -#@ ASK,treeid --- Tree designation for URL? (e.g. the_tree); -2 +#@ ASK,treeid --- Tree designation for URL? (e.g. the_tree); -2\ + #@ ; ^[\w-.$*]+$,invalid characters in name #@ DEFINE virtroot="%virtrootbase%/%treeid%" #@ ELSEIF 'c' eq "%_virtrootpolicy%" #@ REMIND The custom multiple trees management method must contain #@ REMIND at least the server section name %virtrootbase% and a unique #@ REMIND tree designation (in an order compatible with the URL magic #@ REMIND in the server configuration files). -#@ ASK,virtroot --- Full virtual root? (e.g. %virtrootbase%/something); -2 +#@ ASK,virtroot --- Full virtual root? (e.g. %virtrootbase%/something); -2\ +#@ CANON,virtroot /+$,,^/*,/ + #@ ; ^[^']+$,quotes not allowed #@ ELSE #@ ERROR Unknown multiple trees management choice! #@ ERROR If you did not tamper with context file, @@ -118,7 +136,10 @@ #@ DEFINE virtroot="%virtrootbase%" #@ MSG You previously defined the virtual root as %virtroot% #@ ELSE -#@ ASK,virtroot --- Virtual root? (i.e. URL part after host); -1; ; %virtrootbase% +#@ ASK,virtroot --- Virtual root? (i.e. URL part after host); -1\ + #@ ; ^[^']+$,quotes not allowed\ + #@ ; %virtrootbase% +#@ CANON,virtroot /+$,,^/*,/ #@ ENDIF #@ ELSE #@ DEFINE virtroot='' Index: tree-server2.conf.part =================================================================== RCS file: /cvsroot/lxr/lxr/templates/tree-server2.conf.part,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tree-server2.conf.part 3 Sep 2013 08:45:12 -0000 1.1 +++ tree-server2.conf.part 7 Nov 2013 17:45:41 -0000 1.2 @@ -24,17 +24,24 @@ # trees are managed by LXR # , 'shortcaption' => 'Tree' #@ELSE -#@ ASK Do you want a speed switch button for this tree ?; 1; yes, no; Y, N +#@ ASK Do you want a speed switch button for this tree ?\ + #@ ; 1; yes, no; Y, N #@ IF "%A%" eq 'Y' #@ IF %treeid% -#@ ASK --- Short title for button? (e.g. XYZZY); -1; ; %treeid% +#@ ASK --- Short title for button? (e.g. XYZZY); -1\ + #@ ; ^[^']+$,quotes not allowed\ + #@ ; %treeid% #@ ELSE -#@ ASK --- Short title for button? (e.g. XYZZY); -2 +#@ ASK --- Short title for button? (e.g. XYZZY); -2\ + #@ ; ^[^']+$,quotes not allowed +#- Prevent possible XSS attacks +#@ CANONR <,<,>,> #@ ENDIF , 'shortcaption' => '%A%' #@ ENDIF #@ IF 'A' eq "%_routing%" -#@ ASK,treeid --- Tree identification in URL? (e.g. the-tree); -2 +#@ ASK,treeid --- Tree identification in URL? (e.g. the-tree)\ + #@ ; -2; ^[\w-]+(?:\.[\w-]+)*$,invalid characters in name , 'treename' => '%treeid%' #@ ENDIF @@ -43,7 +50,8 @@ #@ASK Do you need a specific encoding for this tree ?; 2; yes, no; Y, N #@IF "%A%" eq 'Y' -#@ ASK --- Encoding name? (e.g. iso-8859-1); -2 +#@ ASK --- Encoding name? (e.g. iso-8859-1)\ + #@ ; -2; ^[\w-]+$,invalid characters in name # Character encoding (overrides default) , 'encoding' => '%A%' #@ENDIF |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 17:38:39
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13894/scripts Modified Files: ContextMgr.pm configure-lxr.pl Log Message: scripts/ContextMgr.pm & configure-lxr.pl: add answer validation filters (see QuestionAnswer.pm) Index: ContextMgr.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/ContextMgr.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ContextMgr.pm 2 Sep 2013 16:37:36 -0000 1.4 +++ ContextMgr.pm 7 Nov 2013 17:38:36 -0000 1.5 @@ -409,14 +409,14 @@ $dbname = get_user_choice ( 'Name of global SQLite database file? (e.g. /home/myself/SQL-databases/lxr' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } else { $dbname = get_user_choice ( 'Name of global database?' , -1 - , [] + , [ '^\w+$', 'invalid characters in name' ] , [ 'lxr' ] ); } @@ -461,7 +461,7 @@ $dbuser = get_user_choice ( '--- DB user name?' , -1 - , [] + , [ '^\w+$', 'invalid characters in name' ] , [ 'lxr' ] ); $dbpass = get_user_choice @@ -486,7 +486,7 @@ $dbprefix = get_user_choice ( '--- Common table prefix?' , -1 - , [] + , [ '^\w+$', 'invalid characters in prefix' ] , [ 'lxr_' ] ); }else { @@ -600,23 +600,25 @@ $primaryhost = get_user_choice ( '--- Host name or IP?' , ('H' ne $treematch) ? -1 : -2 - , [ ] + , [ '^(?i:https?:)?//', 'not an HTTP URL' + , '//[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$', 'invalid characters in URL' + ] , ('H' ne $treematch) ? [ '//localhost' ] : [ ] ); - $primaryhost =~ m!^(https?:)?//([^:]+)(?::(\d+))?!; + $primaryhost =~ m!^([^/]+)?//([^:]+?)(?::(\d+))?/?!; $scheme = $1; $hostname = $2; $port = $3; $scheme = 'http:' if !defined($1); $port = 80 if 'http:' eq $scheme && !defined($3); $port = 443 if 'https:' eq $1 && !defined($3); - if (!defined($hostname)) { - print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; - $primaryhost = undef; - next; - } +# if (!defined($hostname)) { +# print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; +# $primaryhost = undef; +# next; +# } } my $aliashost; @schemealiases = (); @@ -625,19 +627,21 @@ while ('' ne ($aliashost = get_user_choice ( '--- Alias name or IP?' , -3 - , [ ] + , [ '^(?i:https?:)?//', 'not an HTTP URL' + , '//[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$' + , 'invalid characters in URL' ] , [ ] ) ) ) {; - $aliashost =~ m!^(https?:)?//([^:]+)(?::(\d+))?!; + $aliashost =~ m!^([^/]+)?//([^:]+?)(?::(\d+))?/?!; my $aliasscheme = $1; my $aliasname = $2; my $aliasport = $3; - if (!defined($aliasname)) { - print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; - next; - } +# if (!defined($aliasname)) { +# print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; +# next; +# } $aliasscheme = 'http:' if !defined($1); $aliasport = 80 if 'http:' eq $aliasscheme && !defined($3); $aliasport = 443 if 'https:' eq $1 && !defined($3); @@ -662,9 +666,10 @@ $virtrootbase = get_user_choice ( 'URL section name for LXR in your server?' , -1 - , [ ] + , [ '^[^\']+$', 'quotes not allowed' ] , [ '/lxr' ] ); + $virtrootbase =~ s:/+$::; # Ensure no ending slash $virtrootbase =~ s:^/*:/:; # Ensure a starting slash if ( 'E' ne $treematch && 'N' ne $treematch Index: configure-lxr.pl =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/configure-lxr.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- configure-lxr.pl 2 Sep 2013 16:29:03 -0000 1.14 +++ configure-lxr.pl 7 Nov 2013 17:38:36 -0000 1.15 @@ -460,22 +460,22 @@ ); if ($search eq '%glimpse%') { $markers{'%glimpse%'} = get_user_choice - ( "--- Location? (e.g. /usr/share/glimpse-dir/glimpse)" + ( '--- Location? (e.g. /usr/share/glimpse-dir/glimpse)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); $markers{'%glimpseindex%'} = get_user_choice ( '--- Location of indexer? (e.g. /usr/share/glimpse-dir/glimpseindex)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } else { $markers{'%swish%'} = get_user_choice - ( "--- Location? (e.g. /usr/share/swish-dir/swish-e)" + ( '--- Location? (e.g. /usr/share/swish-dir/swish-e)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } @@ -492,7 +492,7 @@ $markers{'%glimpsedirbase%'} = get_user_choice ( '--- Directory for glimpse databases?' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } @@ -500,7 +500,7 @@ $markers{'%swishdirbase%'} = get_user_choice ( '--- Directory for swish-e databases?' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); if ( !defined($markers{'%glimpse%'}) |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:44:25
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10560/scripts Modified Files: LCLInterpreter.pm Log Message: scripts/LCLInterpreter.pm: new features Rearchitecturing: interpreter isolated in its own sub (main loop now only dispatches) parse_statement can now handle multi-line statements New commands and upgrades to some others to benefit from new possibilities in QuestionAnswer.pm Interpretation globally more consistent and reliable Index: LCLInterpreter.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/LCLInterpreter.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LCLInterpreter.pm 2 Sep 2013 16:46:00 -0000 1.3 +++ LCLInterpreter.pm 7 Nov 2013 16:44:21 -0000 1.4 @@ -42,7 +42,7 @@ ############################################################## # -# LXR Control Language Interpreter +# LXR Configuration Language Interpreter # ############################################################## @@ -70,13 +70,11 @@ # intervening whitespace. If more than one label is needed, repeat the # construct without intervening whitespace. [...1209 lines suppressed...] + my $start_block = qr/^${comstart}\@(?:w+:)*\s*${begin}\s/i; my $end_block = qr/^${comstart}\@\s*${end}\b/i; my $nesting = 0; @@ -1071,12 +1191,12 @@ $#choices = -1; $#answers = -1; - ($qtext, $qdeft, $choices, $answer) = split(/;/, shift); + ($qtext, $qdeft, $choices, $answer) = split(/(?<!\\);/, shift); if (defined($choices)) { - @choices = map({s/^\s*(.*)\s*$/$1/; $_} split(/,/, $choices)); + @choices = map({s/^\s*(.*)\s*$/$1/; $_} split(/(?<!\\),/, $choices)); } if (defined($answer)) { - @answers = map({s/^\s*(.*)\s*$/$1/; $_} split(/,/, $answer)); + @answers = map({s/^\s*(.*)\s*$/$1/; $_} split(/(?<!\\),/, $answer)); } $answer = get_user_choice ( $qtext |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:35:55
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10092/scripts Modified Files: QuestionAnswer.pm Log Message: scripts/QuestionAnswer.pm: add validation filter to answers returned after open question Index: QuestionAnswer.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/QuestionAnswer.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- QuestionAnswer.pm 2 Sep 2013 17:06:03 -0000 1.3 +++ QuestionAnswer.pm 7 Nov 2013 16:35:52 -0000 1.4 @@ -72,13 +72,15 @@ # -1, open question with default answer # 0, closed question, no default answer # >0, closed question, default answer number (first is 1) -# - $choices: ref to array of choice strings +# - $choices: ref to array of choice strings or optional validation +# pairs for dft < 0 # - $answers: ref to normalised answers -# $choices and $answers must have same number of strings. +# $choices and $answers must have same number of strings for dft >= 0. # Both may be omitted if $default < 0. sub get_user_choice { my ($question, $default, $choices, $answers) = @_; my @pats; + my @choices; my @opendefault; # Build the patterns associated with answers @@ -95,27 +97,27 @@ exit 2; } @pats = find_unique_prefix ($choices); - @$choices = map(lc, @$choices); + @choices = map(lc, @$choices); + # Uppercase default answer + $choices[$default] = $VTgreen . uc($$choices[$default]); } + # Check open-with-default case if ($default == -2) { if (defined($answers)) { - @opendefault[0] = $VTgreen . $$answers[0]; - $choices = \@opendefault; + @choices[0] = $VTgreen . $$answers[0]; } else { print "${VTred}FATAL:${VTnorm} no default choice for \"$question\"!\n"; exit 2; } } - # Uppercase default answer - if ($default > -1) { - $$choices[$default] = $VTgreen . uc($$choices[$default]); - } + # Get answer from user and return a normalised one +QLOOP: while (1) { print $question; - if (defined($choices) && @$choices) { - print " [${VTyellow}", join("${VTnorm}/${VTyellow}", @$choices), "${VTnorm}]"; + if (@choices) { + print " [${VTyellow}", join("${VTnorm}/${VTyellow}", @choices), "${VTnorm}]"; } print " ${VTslow}${VTyellow}>${VTnorm} "; my $userentry = <STDIN>; @@ -135,6 +137,17 @@ } # If open question, return free text if ($default < -1) { + if (defined($choices)) { # Any constraint check? + my ($chk, $msg, $i); + for ($i = 0; $i < $#$choices; $i++) { + $chk = $$choices[$i]; + $msg = $$choices[++$i]; + if ($userentry !~ m/$chk/) { + print "${VTred}ERROR:${VTnorm} $msg, try again ...\n"; + next QLOOP; + } + } + } return $userentry; } # Closed question: find which choice |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:32:43
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9875/scripts Modified Files: VTescape.pm Log Message: scripts/VTescape.pm: implement new ANSI escape functions to easily drive a VT terminal Index: VTescape.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/VTescape.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VTescape.pm 24 Sep 2013 15:24:07 -0000 1.2 +++ VTescape.pm 7 Nov 2013 16:32:40 -0000 1.3 @@ -35,8 +35,9 @@ $VTred $VTyellow $VTgreen $VTcyan $VTblue $VTmagenta $VTblack $VTwhite VTCUU VTCUD VTCUF VTCUB VTCNL VTCPL VTCHA VTCUP - VTDL VTDSR VTED VTEL VTHVP VTICH VTIL VTRCP - VTSCP VTSD VTSSR VTSU + VTDCH VTDL VTDSR VTECH VTED VTEL VTHVP VTICH + VTIL VTRCP VTRM VTSCP VTSD VTSM VTSSR VTSU + VTprRM VTprRSM VTprSM VTprSVM ); # Some ANSI escape sequences to highlight error messages in output @@ -140,7 +141,7 @@ my $n = shift; $n = 0 if $n > 2; return $CSI - . ($n>0 ? $n : '') + . ($n ? $n : '') . 'K'; } @@ -160,6 +161,14 @@ . 'M'; } +# DCH = Delete CHaracters +sub VTDCH { + my $n = shift; + return $CSI + . ($n>1 ? $n : '') + . 'P'; +} + # SU = Scroll Up sub VTSU { my $n = shift; @@ -176,12 +185,44 @@ . 'T'; } +# ECH = Erase CHaracters +sub VTECH { + my $n = shift; + return $CSI + . ($n>1 ? $n : '') + . 'X'; +} + # HVP = Horizontal and Vertical Position (= CUP) sub VTHVP { my ($row, $col) = @_; return $CSI . $row . ';' . $col . 'f'; } +# SM = Set Mode +sub VTSM { + return '' if 0 >= scalar(@_); + return $CSI . join(';', @_) . 'h'; +} + +# prSM = private Set Mode +sub VTprSM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'h'; +} + +# SM = Reset Mode +sub VTRM { + return '' if 0 >= scalar(@_); + return $CSI . join(';', @_) . 'l'; +} + +# prRM = private Reset Mode +sub VTprRM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'l'; +} + # DSR = Device Status Report # Returns: (row, column) of cursor current position # @@ -220,6 +261,18 @@ return $CSI . 's'; } +# prRSM = private ReStore Mode +sub VTprRSM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'r'; +} + +# prSVM = private SaVe Mode +sub VTprSVM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 's'; +} + # RCP = Restore Cursor Position sub VTRCP { return $CSI . 'u'; |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:17:57
|
Update of /cvsroot/lxr/html/prototype/LxrConf In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8718/prototype/LxrConf Modified Files: lxrconfglobparms.shtml lxrconftreeparms.shtml Log Message: Fixes, new 2.0 features, new tip for '500 Internal Server Error' Index: lxrconfglobparms.shtml =================================================================== RCS file: /cvsroot/lxr/html/prototype/LxrConf/lxrconfglobparms.shtml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- lxrconfglobparms.shtml 18 Mar 2013 08:46:34 -0000 1.5 +++ lxrconfglobparms.shtml 7 Nov 2013 16:17:53 -0000 1.6 @@ -29,7 +29,8 @@ the following list meets general agreement: </p> <pre class="example"> -{ 'tmpdir' => <em>directory_for_temporary_files</em> +{ 'routing' => <em>where_to_find_treename_in_URL</em> # 2.0+ +, 'tmpdir' => <em>directory_for_temporary_files</em> , 'glimpsebin' => <em>path_to_glimpse</em> , 'glimpseindex' => <em>path_to_glimpseindex</em> , 'glimpsedirbase' => <em>root_for_glimpse_indexes</em> # 1.0+ @@ -39,6 +40,7 @@ , 'ectagsbin' => <em>path_to_ctags</em> , 'ectagsconf' => <em>path_to_ectags.conf</em> , 'cvspath' => <em>possible_directories_for_cvs_tools</em> +, 'magicmime' => <em>path_to_magic_numbers_file</em> # 2.0+ , 'host_names' => <em>list_of_host_names</em> Index: lxrconftreeparms.shtml =================================================================== RCS file: /cvsroot/lxr/html/prototype/LxrConf/lxrconftreeparms.shtml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- lxrconftreeparms.shtml 3 Jan 2013 11:07:04 -0000 1.7 +++ lxrconftreeparms.shtml 7 Nov 2013 16:17:53 -0000 1.8 @@ -33,6 +33,7 @@ <pre class="example"> { 'baseurl' => <em>access_URL</em> # deprecated 0.11+ , 'baseurl_aliases'=> <em>URL_aliases</em> # deprecated 0.11+ +, 'treename' => <em>treename_for_argument_routing</em> # 2.0+ , 'virtroot' => <em>URL_without_hostname_part</em> , 'caption' => <em>header_title</em> # 0.10+ , 'shortcaption' => <em>tree_button_title</em> # 0.11+ |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:17:56
|
Update of /cvsroot/lxr/html/fr/Tips In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8718/fr/Tips Modified Files: tipkernel.shtml tips.shtml Added Files: tiperror500.shtml Log Message: Fixes, new 2.0 features, new tip for '500 Internal Server Error' --- NEW FILE: tiperror500.shtml --- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <!--#set var="pageLang" value="fr" --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Language" content="<!--#echo var="pageLang" -->"> <title>Réparation Erreur 500 LXR</title> <link rel="stylesheet" type="text/css" href="/backstore/LXRweb.css"> <link rel="icon" type="image/x-icon" href="/backstore/LXRlogo2.ico"> </head> <body> <!--#set var="pageHeaderTitle" value="Réparation de l'erreur 500 sans reconfiguration" --> <!--#set var="homePageHeader" value="0" --> <!--#include virtual="/backstore/header.shtml" --> <p class="comment"> Vous avez peiné sur la configuration de LXR pour votre projet monumental qui a demandé à <em>genxref</em> des douzaines d'heures d'indexation et quand vous lacncez votre navigateur vous vous retrouvez face à <code>500 Internal server error</code> qui se moque narquoisement de vous. </p> <p class="normal"> <strong class="caution">NE PANIQUEZ PAS!</strong> Ceci peut être corrigé en une poignée de secondes. </p> <h2>Contexte</h2> <ul> <li class="normal"> Votre serveur web est <strong>Apache 2.2</strong>. </li> <li class="normal"> La version de <strong>LXR</strong> est <strong>1.1 ou supérieur</strong>. </li> <li class="normal"> You avez utilisé l'<strong>assistant de configuration</strong>. </li> </ul> <h2>Cause</h2> <p class="normal"> Vous avez négligé l'importance de la question </p> <pre class="shell"> Is your Apache version 2.4 or higher? [YES/no] > </pre> <p class="normal"> est appuyé sur "retour" parce que la réponse par défaut convenait à la plupart des questions précédentes. Pour votre défense, cette question d'apparence anodine est noyée parmi d'autres. </p> <h2>Conséquence</h2> <p class="normal"> Un fichier <em>.htaccess</em> contenant des directives de configuration reconnues par <strong>Apache 2.4</strong> ou supérieur a été écrit dans votre <em>répertoire racine de LXR</em>. <strong>Apache 2.2</strong> se termine en erreur quand il rencontre ces directives. </p> <h2>Solution</h2> <div class="boxed"> <p class="normal"> <span class="caution">Attention!</span> Si vous avez personnalisé un fichier xxx<em>-lxrserver.conf</em>, <em>apache2-require.pl</em> ou <em>lxr.css</em>, sauvegardez-les avant de commencer afin de pouvoir les recharcher sans repasser par leur personnalisation. </p> </div> Relancez une configuration bidon avec l'assistant: <pre class="shell"> $ <kbd>./scripts/configure-lxr.pl --conf-out=bidon --script-out=bidon.sh</kbd> </pre> <ul> <li class="normal">Acceptez les réponses par défaut aux questions initiales</li> <li class="normal">Nommez un répertoire arbitraire pour les moteur de recherche en plein texte (il n'a pas besoin d'exister) </li> <li class= "normal"><strong>Répondez <code class="error">NO</code> au numéro de version d'<em>Apache</em></strong> </li> </ul> <pre class="shell"> WARNING: output configuration file test has an unusual extension! Configure for single/multiple trees? [S/m] > Do you intend to add other trees later? [yes/NO] > Server type? [dedicated/SHARED] > --- Host name or IP? [//localhost] > --- Alias name or IP? > URL section name for LXR in your server? [/lxr] > Database engine? [MYSQL/oracle/postgres/sqlite] > --- Directory for glimpse databases? > <kbd>/g</kbd> Is your Apache version 2.4 or higher? [YES/no] > <kbd>n</kbd> --- Use 'buttons-and-menus' instead of 'link' interface? [YES/no] > </pre> <p class="comment"> Arrivé à ce point, tous les fichiers de configuration de serveur ont été copiés dans <em>custom.d/</em> et <em>.htaccess</em> a été remplacé par une nouvelle copie. </p> <p class="normal"> Vous pouvez alors soit abandonner le reste de la configuration en tapant <em>ctl+</em>C (^C), soit continuer, acceptant les réponses par défaut et donnant des noms arbitraires de répartoire, fichier ou version (qui n'ont pas besoin d'exister) aux questions ouvertes. </p> <p class="normal"> Effacez les fichiers <em>bidon</em>, <em>bidon.ctxt</em> et <em>bidon.sh</em> de <em>custom.d</em>. </p> <p class="comment">C'est fait. Relancez votre navigateur.</p> <!--#include virtual="/backstore/footer.shtml" --> Index: tipkernel.shtml =================================================================== RCS file: /cvsroot/lxr/html/fr/Tips/tipkernel.shtml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- tipkernel.shtml 23 Sep 2012 16:48:10 -0000 1.7 +++ tipkernel.shtml 7 Nov 2013 16:17:53 -0000 1.8 @@ -193,7 +193,7 @@ Prenons le cas <em>arm</em> comme exemple. L'implémentation Linux-arm doit prendre en compte les variantes <em>machine</em> et <em>plateforme</em>. -Deux nouvelles variantes sont alors créées: +Deux nouvelles variables sont alors créées: </p> <div class="boxed"> <pre class="example"> Index: tips.shtml =================================================================== RCS file: /cvsroot/lxr/html/fr/Tips/tips.shtml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tips.shtml 31 Oct 2012 10:14:08 -0000 1.4 +++ tips.shtml 7 Nov 2013 16:17:53 -0000 1.5 @@ -42,6 +42,11 @@ cette astuce vous épargne la peine d'installer un moteur de recherche. </p> </li> + <li><a href="tiperror500.shtml">Réparation de <em>500 Internal Server Error</em> sans reconfiguration</a> + <p class="comment"> +Corrigez la configuration de LXR sans reconfigurer vos arbres ni les réindexer. + </p> + </li> </ul> <!--#include virtual="/backstore/footer.shtml" --> |
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:17:55
|
Update of /cvsroot/lxr/html/en In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8718/en Modified Files: bugsandlimits.shtml index.shtml newfeatures.shtml troubleshooting.shtml Log Message: Fixes, new 2.0 features, new tip for '500 Internal Server Error' Index: bugsandlimits.shtml =================================================================== RCS file: /cvsroot/lxr/html/en/bugsandlimits.shtml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- bugsandlimits.shtml 19 Apr 2013 12:23:55 -0000 1.14 +++ bugsandlimits.shtml 7 Nov 2013 16:17:52 -0000 1.15 @@ -20,6 +20,47 @@ </p> <h2>Known bugs</h2> <ul> + <li>Ubuntu + <ul> + <li>Apache web server + <p class="normal"> +A configuration file is dependent upon <em>mod_version</em> Apache module +but Ubuntu Apache (reported at least for Ubuntu 12.04 LTS) +does not load the module by default. +To enable it run the following command: + </p> +<pre class="shell"> +$ <kbd>sudo a2enmod version</kbd> +</pre> + <p class="normal"> +and restart the server. + </p> + </li> + <li>Templates not found (weird screen) + <p class="normal"> +When LXR scripts are launched, +the current working directory is not set to the <em>LXR root directory</em>. +OS-relative file paths in <em>lxr.conf</em> cannot be correctly resolved. + </p> + <p class="normal"> +To fix the problem, +edit <em>custom.d/lxr.conf</em>, "HTML subsection", +and add the OS-absolute path of the LXR root directory +in front of all HTML template designations. +When done, +copy the modified file to its final destination as usual. + </p> + <p class="comment caution"> +DO NOT CHANGE parameters <code>'stylesheet'</code> and +<code>'alternate_stylesheet'</code> +which are not file paths but HTML references. + </p> + <p class="comment"> +This bug may also be Apache specific. + </p> + </li> + </ul> + </li> <li>Release 1.1.0 <ul> <li class="normal"> Index: index.shtml =================================================================== RCS file: /cvsroot/lxr/html/en/index.shtml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- index.shtml 26 Jan 2013 09:44:19 -0000 1.9 +++ index.shtml 7 Nov 2013 16:17:52 -0000 1.10 @@ -80,12 +80,13 @@ <p class="normal"> This is a step-by-step <em>How to install LXR</em> guide for the latest release. -Follow these links for previous releases: -<a href="0-11-InstallSteps/0-11-install.shtml">0.11</a>, -<a href="InstallSteps/install.shtml">0.9.x and 0.10.x</a>. -For older releases, -read <em>INSTALL</em> file that ships with the software. </p> + <ul>Follow these links for previous releases: + <li><a href="0-11-InstallSteps/0-11-install.shtml">0.11</a></li> + <li><a href="InstallSteps/install.shtml">0.9.x and 0.10.x</a></li> + <li>Older releases, +read <em>INSTALL</em> file that ships with the software</li> + </ul> </li> <li> <a href="advancedconfig.shtml"> @@ -141,53 +142,53 @@ Release numbering scheme </a> </li> - <li>Demo: the LXR tree cross-referenced by LXR itself - <p class="comment"> -Releases 0.9.8 to 1.1 can be displayed and compared. - </p> - <p class="comment"> + <li><a href="styles.shtml"> + Typographical conventions + </a> + of this site + </li> + <li><a href="logos.shtml"> + Candidate logos + </a> + </li> + </ul> + + <h2>Demo: the LXR tree cross-referenced by LXR itself</h2> + <p class="comment"> +Releases 0.9.8 to 1.2.0 can be displayed and compared. + </p> + <p class="comment"> This demo exhibits two tree-variants: - </p> - <ul> - <li> + </p> + <ul> + <li> <a href="/lxr/source/">"classical" plain files tree</a> containing several released versions - </li> - <li> + </li> + <li> <a href="/cvs/source">CVS repository tree</a> containing all development history - <p class="normal"> + <p class="normal"> Due to SourceForge restrictions, it is only a snapshot. The date when it was taken is shown as the path root. - </p> - </li> - </ul> - <p class="normal"> -Notes: </p> - <p class="comment"> + </li> + </ul> + <p class="normal"> +Notes: + </p> + <p class="comment"> Since SourceForge's Perl is 5.8.8, LXR engines 1.0 and higher cannot be used. You will not see the latest improvements and features. - </p> - <p class="comment"> + </p> + <p class="comment"> SourceForge has a complex configuration where some support tools are removed from web servers to improve security. Consequently, some LXR features do not work as expected (<em>e.g.</em> annotations in file display under CVS). - </p> - </li> - <li><a href="styles.shtml"> - Typographical conventions - </a> - of this site - </li> - <li><a href="logos.shtml"> - Candidate logos - </a> - </li> - </ul> + </p> <h2>Download and summary information</h2> <p class=normal> Index: newfeatures.shtml =================================================================== RCS file: /cvsroot/lxr/html/en/newfeatures.shtml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- newfeatures.shtml 14 Mar 2013 18:21:53 -0000 1.14 +++ newfeatures.shtml 7 Nov 2013 16:17:52 -0000 1.15 @@ -15,6 +15,64 @@ <!--#set var="homePageHeader" value="0" --> <!--#include virtual="/backstore/header.shtml" --> <ul> + <li><strong>Release 2.0</strong> + <ul> + <li class="classics"><del><em>genxref</em> goes parallel</del> + <p class="normal"> +Careful optimisation of current code dwindles the interest of multi-thread technology. +Multi-thread code is more complex and needs sophisticated database table locking strategy. +Experiments have shown this added complexity brings little gain on big projects +and slightly longer indexing times on small projects. + </p> + <p class="normal"> +However, this work uncovered very subtle bugs, or rather inaccuracies, +in the parser. + </p> + <p class="comment"> +As a net result, <em>genxref</em> performance is now x1.5 over release 1.2.0. +Indexing times are shortened by 33%. + </p> + </li> + <li class="classics">Multiple-trees context + <p class="normal"> +Tree designation in URL moved into <code>PATH_INFO</code> instead of +<code>SERVER_NAME</code> or <code>SCRIPT_NAME</code>. + </p> + <p class="comment"> +This is a new possibility, you do not need to modify your present trees. +This designation variant offers simpler and more robust web server configuration. +Adding or removing a tree is consequently only a matter of editing +<em>lxr.conf</em> without reconfiguring the web server. + </p> + </li> + <li class="classics">Better HTTP initialisation + <p class="normal"> +Printing a message on screen under catastrophic events during +initialisation now possible, avoiding the disturbing "blank screen" situation. + </p> + </li> + <li class="classics">Better error handling + <p class="normal"> +<em>Browsing</em>: errors and warnings are also printed on screen, +reducing the necessity to read them from the server log files. + </p> + <p class="normal"> +<em>Configuration</em>: most user data is now checked against expected format +thus detecting early some trivial mistakes. + </p> + </li> + <li class="classics">Experimental support of +<strong>Nginx</strong>, <strong>Cherokee</strong> +and <strong>thttpd</strong> web servers + </li> + <li class="classics"><em>User's Manual</em> updated + </li> + <li class="classics"><em>Developer's Manual</em> available + </li> + <li class="classics">Bug fixes + </li> + </ul> + </li> <li><strong>Release 1.2</strong> <ul> <li class="classics">Generic parser include feature rearchitectured Index: troubleshooting.shtml =================================================================== RCS file: /cvsroot/lxr/html/en/troubleshooting.shtml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- troubleshooting.shtml 23 Sep 2012 16:48:10 -0000 1.4 +++ troubleshooting.shtml 7 Nov 2013 16:17:52 -0000 1.5 @@ -129,6 +129,17 @@ <em>lighttpd-lxrserver.conf</em>. </p> </li> + <li><code class="error"><strong>500 Internal Server Error</strong></code> + <p class="normal"> +<strong>Apache</strong> <em>.htaccess</em> file contains +2.4 directives while your server is level 2.2, +leading to directive rejection and server abort. + </p> + <p class="comment"> +This is usually caused by an erroneous answer during configuration. +See <a href="Tips/tiperror500.shtml">this tip</a> for a fix. + </p> + </li> <li><code class="error"><strong>The directory/file <em>xxx</em> does not exist</strong></code> <p class="normal"> If the directory or file does not exist in this version; @@ -193,6 +204,10 @@ </ul> <h2>Errors entered in web-server log</h2> + <p class="comment"> +Starting with release 2.0, +these errors are also displayed on screen. + </p> <ul> <li><code class="error"><strong>Warning: template <em>xxx</em> does not exist</strong></code> <p class="normal"> |