mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Add paranoia check
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d225c8485b
commit
748d319635
@ -1,7 +1,6 @@
|
||||
2003-02-01 Angus Leeming <leeming@lyx.org>
|
||||
2003-02-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* reLyX/Text/TeX.pm: fix bug 9: reLyX thinks \)* is a starred version
|
||||
of the \) command. (End of math environment.)
|
||||
* reLyX/RelyxTable.pm: add paranoia check that array bounds are valid.
|
||||
|
||||
2003-01-28 Edwin Leuven <e.leuven@uva.nl>
|
||||
|
||||
|
@ -283,8 +283,65 @@ sub parse_cols {
|
||||
}
|
||||
} # end sub done_reading
|
||||
|
||||
# Subroutines to print out the table once it's created
|
||||
sub print_info {
|
||||
# Subroutine to print out the table once it's created
|
||||
&print_info_221(@_);
|
||||
}
|
||||
|
||||
sub write_string {
|
||||
my ($name, $s) = @_;
|
||||
if (!$s) {
|
||||
return '';
|
||||
}
|
||||
return ' ' . $name . '="' . $s . '"';
|
||||
}
|
||||
|
||||
sub write_bool {
|
||||
my ($name, $b) = @_;
|
||||
if (!$b) {
|
||||
return '';
|
||||
}
|
||||
write_string $name, "true";
|
||||
}
|
||||
|
||||
sub write_int {
|
||||
my ($name, $i) = @_;
|
||||
if (!$i) {
|
||||
return '';
|
||||
}
|
||||
write_string $name, $i;
|
||||
}
|
||||
|
||||
sub print_info_221 {
|
||||
# Subroutine to print out the table in \lyxformat 221
|
||||
my $thistable = shift;
|
||||
my $to_print = '';
|
||||
# header line
|
||||
$to_print .= "\n<lyxtabular" .
|
||||
write_int("version", 3) .
|
||||
write_int("rows", $thistable->numrows) .
|
||||
write_int("columns", $thistable->numcols) .
|
||||
">\n";
|
||||
# global longtable options
|
||||
$to_print .= "<features" .
|
||||
write_int ("rotate", 0) .
|
||||
write_bool("islongtable", 0) .
|
||||
write_int ("firstHeadTopDL", 0) .
|
||||
write_int ("firstHeadBottomDL", 0) .
|
||||
write_bool("firstHeadEmpty", 0) .
|
||||
write_int ("headTopDL", 0) .
|
||||
write_int ("headBottomDL", 0) .
|
||||
write_int ("footTopDL", 0) .
|
||||
write_int ("footBottomDL", 0) .
|
||||
write_int ("lastFootTopDL", 0) .
|
||||
write_int ("lastFootBottomDL", 0) .
|
||||
write_bool("lastFootEmpty", 0) .
|
||||
">\n";
|
||||
|
||||
}
|
||||
|
||||
sub print_info_215 {
|
||||
# Subroutine to print out the table in \lyxformat 215
|
||||
# print the header information for this table
|
||||
my $thistable = shift;
|
||||
my $to_print = "";
|
||||
@ -457,7 +514,13 @@ package RelyxTable::Row;
|
||||
$i++;
|
||||
|
||||
# What if it was a multicolumn?
|
||||
$i++ while ${$row->{"cells"}}[$i]->{"multicolumn"} eq "part";
|
||||
# $rcells holds a reference to the array of cells
|
||||
my $rcells = \@{$row->{"cells"}};
|
||||
# Paranoia check that we're not attempting to access beyond the
|
||||
# end of the array in case reLyX failed to parse the number of
|
||||
# columns correctly.
|
||||
$i++ while ($i < @{$rcells} &&
|
||||
${$rcells}[$i]->{"multicolumn"} eq "part");
|
||||
|
||||
$row->{"curr_col"} = $i;
|
||||
} # end of sub nextcol
|
||||
|
Loading…
Reference in New Issue
Block a user