_________________________
12 dd
DH: mm struct{
int a;
char b;
m1 struct {
int c;
int d;
};
m2 struct {
int e;
int f;
};
}
2 dfdkk
df
dd
}
1
LOCAL_PARAM: ssi_struct {
ref = 0;
header = {
req = 0xa;
};
}
DH: mm struct{
int a;
char b;
m1 struct {
int c;
int d;
};
}
____________________________________
####
sub get_record_from_file {
my $filein = shift;
my $regex = shift;
my $pos = shift
open FILEIN, "<$filein" or die "!$\n";
seek(FILEIN, $pos, 0);
my $in_block = 0;
my $last = "}";
my @array = {};
foreach my $line () {
if ($line =~ /$regex/) {
$in_block = 1;
}
if ($in_block) {
push @array, $line;
}
if ($line =~ m/$last$/) {
$in_block = 0;
}
}
$pos = tell FILEIN;
return (\@array, $pos);
}
$record = get_record_from_file("input.txt","DH:",0);
####
sub get_record_from_file {
my $filein = shift;
my $regex = shift;
my $pos = shift
open FILEIN, "<$filein" or die "!$\n";
seek(FILEIN, $pos, 0);
my $in_block = 0;
my $last = "}";
my @array = {};
foreach my $line () {
if ($line =~ /$regex/) {
$in_block = 1;
}
if ($in_block) {
push @array, $line;
}
if ($line =~ m/$last$/) {
$in_block = 0;
last;
}
}
$pos = tell FILEIN;
return (\@array, $pos);
}
my $curpos = 0;
($record,$curpos) = get_record_from_file("input.txt","DH:",$curpos);