make_56_interwork.pl

来自「source of perl for linux application,」· PL 代码 · 共 52 行

PL
52
字号
#!/usr/bin/perl -wuse strict;use Config;use Storable qw(freeze thaw);# Lilliput decreed that eggs should be eaten small end first.# Belfuscu welcomed the rebels who wanted to eat big end first.my $kingdom = $Config{byteorder} =~ /23/ ? "Lillput" : "Belfuscu";my $frozen = freeze  ["This file was written with $Storable::VERSION on perl $]",   "$kingdom was correct", (~0 ^ (~0 >> 1) ^ 2),   "The End"];my $ivsize = $Config{ivsize} || $Config{longsize};my $storesize = unpack 'xxC', $frozen;my $storebyteorder = unpack "xxxA$storesize", $frozen;if ($Config{byteorder} eq $storebyteorder) {  my $ivtype = $Config{ivtype} || 'long';  print <<"EOM";You only need to run this generator program where Config.pm's byteorder stringis not the same length as the size of IVs.This length difference should only happen on perl 5.6.x configured with IVs aslong long on Unix, OS/2 or any platform that runs the Configure stript (ie notMS Windows)This is perl $], sizeof(long) is $Config{longsize}, IVs are '$ivtype', sizeof(IV) is $ivsize,byteorder is '$Config{byteorder}', Storable $Storable::VERSION writes a byteorder of '$storebyteorder'EOM  exit; # Grr '}my ($i, $l, $p, $n) = unpack "xxxx${storesize}CCCC", $frozen;print <<"EOM";# byteorder	 '$storebyteorder'# sizeof(int)	 $i# sizeof(long)	 $l# sizeof(char *) $p# sizeof(NV)	 $nEOMmy $uu = pack 'u', $frozen;printf "begin %3o $kingdom,$i,$l,$p,$n\n", ord 'A';print $uu;print "\nend\n\n";

⌨️ 快捷键说明

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