⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deparse.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 5 页
字号:
		$scope_st = $s if !defined($scope_st) || $s < $scope_st;		$scope_en = $e if !defined($scope_en) || $e > $scope_en;		return ($scope_st, $scope_en);	    }	    elsif (is_state($o)) {		my $c = $o->cop_seq;		$scope_st = $c if !defined($scope_st) || $c < $scope_st;		$scope_en = $c if !defined($scope_en) || $c > $scope_en;		return ($scope_st, $scope_en);	    }	    elsif ($o->flags & OPf_KIDS) {		unshift (@queue, $o);	    }	}    }    return ($scope_st, $scope_en);}# Returns a list of subs which should be inserted before the COPsub cop_subs {    my ($self, $op, $out_seq) = @_;    my $seq = $op->cop_seq;    # If we have nephews, then our sequence number indicates    # the cop_seq of the end of some sort of scope.    if (class($op->sibling) ne "NULL" && $op->sibling->flags & OPf_KIDS	and my $nseq = $self->find_scope_st($op->sibling) ) {	$seq = $nseq;    }    $seq = $out_seq if defined($out_seq) && $out_seq < $seq;    return $self->seq_subs($seq);}sub seq_subs {    my ($self, $seq) = @_;    my @text;#push @text, "# ($seq)\n";    return "" if !defined $seq;    while (scalar(@{$self->{'subs_todo'}})	   and $seq > $self->{'subs_todo'}[0][0]) {	push @text, $self->next_todo;    }    return @text;}# Notice how subs and formats are inserted between statements here;# also $[ assignments and pragmas.sub pp_nextstate {    my $self = shift;    my($op, $cx) = @_;    $self->{'curcop'} = $op;    my @text;    push @text, $self->cop_subs($op);    push @text, $op->label . ": " if $op->label;    my $stash = $op->stashpv;    if ($stash ne $self->{'curstash'}) {	push @text, "package $stash;\n";	$self->{'curstash'} = $stash;    }    if ($self->{'arybase'} != $op->arybase) {	push @text, '$[ = '. $op->arybase .";\n";	$self->{'arybase'} = $op->arybase;    }    my $warnings = $op->warnings;    my $warning_bits;    if ($warnings->isa("B::SPECIAL") && $$warnings == 4) {	$warning_bits = $warnings::Bits{"all"} & WARN_MASK;    }    elsif ($warnings->isa("B::SPECIAL") && $$warnings == 5) {        $warning_bits = $warnings::NONE;    }    elsif ($warnings->isa("B::SPECIAL")) {	$warning_bits = undef;    }    else {	$warning_bits = $warnings->PV & WARN_MASK;    }    if (defined ($warning_bits) and       !defined($self->{warnings}) || $self->{'warnings'} ne $warning_bits) {	push @text, declare_warnings($self->{'warnings'}, $warning_bits);	$self->{'warnings'} = $warning_bits;    }    if ($self->{'hints'} != $op->hints) {	push @text, declare_hints($self->{'hints'}, $op->hints);	$self->{'hints'} = $op->hints;    }    # hack to check that the hint hash hasn't changed    if ($] > 5.009 &&	"@{[sort %{$self->{'hinthash'} || {}}]}"	ne "@{[sort %{$op->hints_hash->HASH || {}}]}") {	push @text, declare_hinthash($self->{'hinthash'}, $op->hints_hash->HASH, $self->{indent_size});	$self->{'hinthash'} = $op->hints_hash->HASH;    }    # This should go after of any branches that add statements, to    # increase the chances that it refers to the same line it did in    # the original program.    if ($self->{'linenums'}) {	push @text, "\f#line " . $op->line .	  ' "' . $op->file, qq'"\n';    }    return join("", @text);}sub declare_warnings {    my ($from, $to) = @_;    if (($to & WARN_MASK) eq (warnings::bits("all") & WARN_MASK)) {	return "use warnings;\n";    }    elsif (($to & WARN_MASK) eq ("\0"x length($to) & WARN_MASK)) {	return "no warnings;\n";    }    return "BEGIN {\${^WARNING_BITS} = ".perlstring($to)."}\n";}sub declare_hints {    my ($from, $to) = @_;    my $use = $to   & ~$from;    my $no  = $from & ~$to;    my $decls = "";    for my $pragma (hint_pragmas($use)) {	$decls .= "use $pragma;\n";    }    for my $pragma (hint_pragmas($no)) {        $decls .= "no $pragma;\n";    }    return $decls;}# Internal implementation hints that the core sets automatically, so don't need# (or want) to be passed back to the usermy %ignored_hints = (    'open<' => 1,    'open>' => 1,    'v_string' => 1,    );sub declare_hinthash {    my ($from, $to, $indent) = @_;    my @decls;    for my $key (keys %$to) {	next if $ignored_hints{$key};	if (!defined $from->{$key} or $from->{$key} ne $to->{$key}) {	    push @decls, qq(\$^H{'$key'} = q($to->{$key}););	}    }    for my $key (keys %$from) {	next if $ignored_hints{$key};	if (!exists $to->{$key}) {	    push @decls, qq(delete \$^H{'$key'};);	}    }    @decls or return '';    return join("\n" . (" " x $indent), "BEGIN {", @decls) . "\n}\n";}sub hint_pragmas {    my ($bits) = @_;    my @pragmas;    push @pragmas, "integer" if $bits & 0x1;    push @pragmas, "strict 'refs'" if $bits & 0x2;    push @pragmas, "bytes" if $bits & 0x8;    return @pragmas;}sub pp_dbstate { pp_nextstate(@_) }sub pp_setstate { pp_nextstate(@_) }sub pp_unstack { return "" } # see also leaveloopsub baseop {    my $self = shift;    my($op, $cx, $name) = @_;    return $name;}sub pp_stub {    my $self = shift;    my($op, $cx, $name) = @_;    if ($cx >= 1) {	return "()";    }    else {	return "();";    }}sub pp_wantarray { baseop(@_, "wantarray") }sub pp_fork { baseop(@_, "fork") }sub pp_wait { maybe_targmy(@_, \&baseop, "wait") }sub pp_getppid { maybe_targmy(@_, \&baseop, "getppid") }sub pp_time { maybe_targmy(@_, \&baseop, "time") }sub pp_tms { baseop(@_, "times") }sub pp_ghostent { baseop(@_, "gethostent") }sub pp_gnetent { baseop(@_, "getnetent") }sub pp_gprotoent { baseop(@_, "getprotoent") }sub pp_gservent { baseop(@_, "getservent") }sub pp_ehostent { baseop(@_, "endhostent") }sub pp_enetent { baseop(@_, "endnetent") }sub pp_eprotoent { baseop(@_, "endprotoent") }sub pp_eservent { baseop(@_, "endservent") }sub pp_gpwent { baseop(@_, "getpwent") }sub pp_spwent { baseop(@_, "setpwent") }sub pp_epwent { baseop(@_, "endpwent") }sub pp_ggrent { baseop(@_, "getgrent") }sub pp_sgrent { baseop(@_, "setgrent") }sub pp_egrent { baseop(@_, "endgrent") }sub pp_getlogin { baseop(@_, "getlogin") }sub POSTFIX () { 1 }# I couldn't think of a good short name, but this is the category of# symbolic unary operators with interesting precedencesub pfixop {    my $self = shift;    my($op, $cx, $name, $prec, $flags) = (@_, 0);    my $kid = $op->first;    $kid = $self->deparse($kid, $prec);    return $self->maybe_parens(($flags & POSTFIX) ? "$kid$name" : "$name$kid",			       $cx, $prec);}sub pp_preinc { pfixop(@_, "++", 23) }sub pp_predec { pfixop(@_, "--", 23) }sub pp_postinc { maybe_targmy(@_, \&pfixop, "++", 23, POSTFIX) }sub pp_postdec { maybe_targmy(@_, \&pfixop, "--", 23, POSTFIX) }sub pp_i_preinc { pfixop(@_, "++", 23) }sub pp_i_predec { pfixop(@_, "--", 23) }sub pp_i_postinc { maybe_targmy(@_, \&pfixop, "++", 23, POSTFIX) }sub pp_i_postdec { maybe_targmy(@_, \&pfixop, "--", 23, POSTFIX) }sub pp_complement { maybe_targmy(@_, \&pfixop, "~", 21) }sub pp_negate { maybe_targmy(@_, \&real_negate) }sub real_negate {    my $self = shift;    my($op, $cx) = @_;    if ($op->first->name =~ /^(i_)?negate$/) {	# avoid --$x	$self->pfixop($op, $cx, "-", 21.5);    } else {	$self->pfixop($op, $cx, "-", 21);	    }}sub pp_i_negate { pp_negate(@_) }sub pp_not {    my $self = shift;    my($op, $cx) = @_;    if ($cx <= 4) {	$self->pfixop($op, $cx, "not ", 4);    } else {	$self->pfixop($op, $cx, "!", 21);	    }}sub unop {    my $self = shift;    my($op, $cx, $name) = @_;    my $kid;    if ($op->flags & OPf_KIDS) {	$kid = $op->first;	if (defined prototype("CORE::$name")	   && prototype("CORE::$name") =~ /^;?\*/	   && $kid->name eq "rv2gv") {	    $kid = $kid->first;	}	return $self->maybe_parens_unop($name, $kid, $cx);    } else {	return $name .  ($op->flags & OPf_SPECIAL ? "()" : "");    }}sub pp_chop { maybe_targmy(@_, \&unop, "chop") }sub pp_chomp { maybe_targmy(@_, \&unop, "chomp") }sub pp_schop { maybe_targmy(@_, \&unop, "chop") }sub pp_schomp { maybe_targmy(@_, \&unop, "chomp") }sub pp_defined { unop(@_, "defined") }sub pp_undef { unop(@_, "undef") }sub pp_study { unop(@_, "study") }sub pp_ref { unop(@_, "ref") }sub pp_pos { maybe_local(@_, unop(@_, "pos")) }sub pp_sin { maybe_targmy(@_, \&unop, "sin") }sub pp_cos { maybe_targmy(@_, \&unop, "cos") }sub pp_rand { maybe_targmy(@_, \&unop, "rand") }sub pp_srand { unop(@_, "srand") }sub pp_exp { maybe_targmy(@_, \&unop, "exp") }sub pp_log { maybe_targmy(@_, \&unop, "log") }sub pp_sqrt { maybe_targmy(@_, \&unop, "sqrt") }sub pp_int { maybe_targmy(@_, \&unop, "int") }sub pp_hex { maybe_targmy(@_, \&unop, "hex") }sub pp_oct { maybe_targmy(@_, \&unop, "oct") }sub pp_abs { maybe_targmy(@_, \&unop, "abs") }sub pp_length { maybe_targmy(@_, \&unop, "length") }sub pp_ord { maybe_targmy(@_, \&unop, "ord") }sub pp_chr { maybe_targmy(@_, \&unop, "chr") }sub pp_each { unop(@_, "each") }sub pp_values { unop(@_, "values") }sub pp_keys { unop(@_, "keys") }sub pp_pop { unop(@_, "pop") }sub pp_shift { unop(@_, "shift") }sub pp_caller { unop(@_, "caller") }sub pp_reset { unop(@_, "reset") }sub pp_exit { unop(@_, "exit") }sub pp_prototype { unop(@_, "prototype") }sub pp_close { unop(@_, "close") }sub pp_fileno { unop(@_, "fileno") }sub pp_umask { unop(@_, "umask") }sub pp_untie { unop(@_, "untie") }sub pp_tied { unop(@_, "tied") }sub pp_dbmclose { unop(@_, "dbmclose") }sub pp_getc { unop(@_, "getc") }sub pp_eof { unop(@_, "eof") }sub pp_tell { unop(@_, "tell") }sub pp_getsockname { unop(@_, "getsockname") }sub pp_getpeername { unop(@_, "getpeername") }sub pp_chdir { maybe_targmy(@_, \&unop, "chdir") }sub pp_chroot { maybe_targmy(@_, \&unop, "chroot") }sub pp_readlink { unop(@_, "readlink") }sub pp_rmdir { maybe_targmy(@_, \&unop, "rmdir") }sub pp_readdir { unop(@_, "readdir") }sub pp_telldir { unop(@_, "telldir") }sub pp_rewinddir { unop(@_, "rewinddir") }sub pp_closedir { unop(@_, "closedir") }sub pp_getpgrp { maybe_targmy(@_, \&unop, "getpgrp") }sub pp_localtime { unop(@_, "localtime") }sub pp_gmtime { unop(@_, "gmtime") }sub pp_alarm { unop(@_, "alarm") }sub pp_sleep { maybe_targmy(@_, \&unop, "sleep") }sub pp_dofile { unop(@_, "do") }sub pp_entereval { unop(@_, "eval") }sub pp_ghbyname { unop(@_, "gethostbyname") }sub pp_gnbyname { unop(@_, "getnetbyname") }sub pp_gpbyname { unop(@_, "getprotobyname") }sub pp_shostent { unop(@_, "sethostent") }sub pp_snetent { unop(@_, "setnetent") }sub pp_sprotoent { unop(@_, "setprotoent") }sub pp_sservent { unop(@_, "setservent") }sub pp_gpwnam { unop(@_, "getpwnam") }sub pp_gpwuid { unop(@_, "getpwuid") }sub pp_ggrnam { unop(@_, "getgrnam") }sub pp_ggrgid { unop(@_, "getgrgid") }sub pp_lock { unop(@_, "lock") }sub pp_continue { unop(@_, "continue"); }sub pp_break {    my ($self, $op) = @_;    return "" if $op->flags & OPf_SPECIAL;    unop(@_, "break");}sub givwhen {    my $self = shift;    my($op, $cx, $givwhen) = @_;    my $enterop = $op->first;    my ($head, $block);    if ($enterop->flags & OPf_SPECIAL) {	$head = "default";	$block = $self->deparse($enterop->first, 0);    }    else {	my $cond = $enterop->first;	my $cond_str = $self->deparse($cond, 1);	$head = "$givwhen ($cond_str)";	$block = $self->deparse($cond->sibling, 0);    }    return "$head {\n".	"\t$block\n".	"\b}\cK";}sub pp_leavegiven { givwhen(@_, "given"); }sub pp_leavewhen  { givwhen(@_, "when"); }sub pp_exists {    my $self = shift;    my($op, $cx) = @_;    my $arg;    if ($op->private & OPpEXISTS_SUB) {	# Checking for the existence of a subroutine	return $self->maybe_parens_func("exists",				$self->pp_rv2cv($op->first, 16), $cx, 16);    }    if ($op->flags & OPf_SPECIAL) {	# Array element, not hash element	return $self->maybe_parens_func("exists",				$self->pp_aelem($op->first, 16), $cx, 16);    }    return $self->maybe_parens_func("exists", $self->pp_helem($op->first, 16),				    $cx, 16);}sub pp_delete {    my $self = shift;    my($op, $cx) = @_;    my $arg;    if ($op->private & OPpSLICE) {	if ($op->flags & OPf_SPECIAL) {	    # Deleting from an array, not a hash	    return $self->maybe_parens_func("delete",					$self->pp_aslice($op->first, 16),					$cx, 16);	}	return $self->maybe_parens_func("delete",					$self->pp_hslice($op->first, 16),					$cx, 16);    } else {	if ($op->flags & OPf_SPECIAL) {	    # Deleting from an array, not a hash	    return $self->maybe_parens_func("delete",					$self->pp_aelem($op->first, 16),					$cx, 16);	}	return $self->maybe_parens_func("delete",					$self->pp_helem($op->first, 16),					$cx, 16);    }}sub pp_require {    my $self = shift;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -