From: Andy Dougherty Date: Thu, 25 May 1995 11:49:37 +0000 (+1200) Subject: perl5.001 patch.1h: [re-organisations and patch description] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e340f36c2347f9c2737d0b92322eee7b2ec0640;p=p5sagit%2Fp5-mst-13.2.git perl5.001 patch.1h: [re-organisations and patch description] [editor's note: individual patches have been split from this combined patch] --- diff --git a/c2ph.doc b/c2ph.doc deleted file mode 100644 index 0c3eaee..0000000 --- a/c2ph.doc +++ /dev/null @@ -1,191 +0,0 @@ -Article 484 of comp.lang.perl: -Xref: netlabs comp.lang.perl:484 comp.lang.c:983 alt.sources:134 -Path: netlabs!psinntp!iggy.GW.Vitalink.COM!lll-winken!sun-barr!cronkite.Central.Sun.COM!spdev!texsun!convex!tchrist -From: tchrist@convex.com (Tom Christiansen) -Newsgroups: comp.lang.perl,comp.lang.c,alt.sources -Subject: pstruct -- a C structure formatter; AKA c2ph, a C to perl header translator -Keywords: C perl tranlator -Message-ID: <1991Jul25.081021.8104@convex.com> -Date: 25 Jul 91 08:10:21 GMT -Sender: usenet@convex.com (news access account) -Followup-To: comp.lang.perl -Organization: CONVEX Computer Corporation, Richardson, Tx., USA -Lines: 1208 -Nntp-Posting-Host: pixel.convex.com - -Once upon a time, I wrote a program called pstruct. It was a perl -program that tried to parse out C structures and display their member -offsets for you. This was especially useful for people looking at -binary dumps or poking around the kernel. - -Pstruct was not a pretty program. Neither was it particularly robust. -The problem, you see, was that the C compiler was much better at parsing -C than I could ever hope to be. - -So I got smart: I decided to be lazy and let the C compiler parse the C, -which would spit out debugger stabs for me to read. These were much -easier to parse. It's still not a pretty program, but at least it's more -robust. - -Pstruct takes any .c or .h files, or preferably .s ones, since that's -the format it is going to massage them into anyway, and spits out -listings like this: - -struct tty { - int tty.t_locker 000 4 - int tty.t_mutex_index 004 4 - struct tty * tty.t_tp_virt 008 4 - struct clist tty.t_rawq 00c 20 - int tty.t_rawq.c_cc 00c 4 - int tty.t_rawq.c_cmax 010 4 - int tty.t_rawq.c_cfx 014 4 - int tty.t_rawq.c_clx 018 4 - struct tty * tty.t_rawq.c_tp_cpu 01c 4 - struct tty * tty.t_rawq.c_tp_iop 020 4 - unsigned char * tty.t_rawq.c_buf_cpu 024 4 - unsigned char * tty.t_rawq.c_buf_iop 028 4 - struct clist tty.t_canq 02c 20 - int tty.t_canq.c_cc 02c 4 - int tty.t_canq.c_cmax 030 4 - int tty.t_canq.c_cfx 034 4 - int tty.t_canq.c_clx 038 4 - struct tty * tty.t_canq.c_tp_cpu 03c 4 - struct tty * tty.t_canq.c_tp_iop 040 4 - unsigned char * tty.t_canq.c_buf_cpu 044 4 - unsigned char * tty.t_canq.c_buf_iop 048 4 - struct clist tty.t_outq 04c 20 - int tty.t_outq.c_cc 04c 4 - int tty.t_outq.c_cmax 050 4 - int tty.t_outq.c_cfx 054 4 - int tty.t_outq.c_clx 058 4 - struct tty * tty.t_outq.c_tp_cpu 05c 4 - struct tty * tty.t_outq.c_tp_iop 060 4 - unsigned char * tty.t_outq.c_buf_cpu 064 4 - unsigned char * tty.t_outq.c_buf_iop 068 4 - (*int)() tty.t_oproc_cpu 06c 4 - (*int)() tty.t_oproc_iop 070 4 - (*int)() tty.t_stopproc_cpu 074 4 - (*int)() tty.t_stopproc_iop 078 4 - struct thread * tty.t_rsel 07c 4 - - etc. - - -Actually, this was generated by a particular set of options. You can control -the formatting of each column, whether you prefer wide or fat, hex or decimal, -leading zeroes or whatever. - -All you need to be able to use this is a C compiler than generates -BSD/GCC-style stabs. The -g option on native BSD compilers and GCC -should get this for you. - -To learn more, just type a bogus option, like -\?, and a long usage message -will be provided. There are a fair number of possibilities. - -If you're only a C programmer, than this is the end of the message for you. -You can quit right now, and if you care to, save off the source and run it -when you feel like it. Or not. - - - -But if you're a perl programmer, then for you I have something much more -wondrous than just a structure offset printer. - -You see, if you call pstruct by its other incybernation, c2ph, you have a code -generator that translates C code into perl code! Well, structure and union -declarations at least, but that's quite a bit. - -Prior to this point, anyone programming in perl who wanted to interact -with C programs, like the kernel, was forced to guess the layouts of the C -strutures, and then hardwire these into his program. Of course, when you -took your wonderfully to a system where the sgtty structure was laid out -differently, you program broke. Which is a shame. - -We've had Larry's h2ph translator, which helped, but that only works on -cpp symbols, not real C, which was also very much needed. What I offer -you is a symbolic way of getting at all the C structures. I've couched -them in terms of packages and functions. Consider the following program: - - #!/usr/local/bin/perl - - require 'syscall.ph'; - require 'sys/time.ph'; - require 'sys/resource.ph'; - - $ru = "\0" x &rusage'sizeof(); - - syscall(&SYS_getrusage, &RUSAGE_SELF, $ru) && die "getrusage: $!"; - - @ru = unpack($t = &rusage'typedef(), $ru); - - $utime = $ru[ &rusage'ru_utime + &timeval'tv_sec ] - + ($ru[ &rusage'ru_utime + &timeval'tv_usec ]) / 1e6; - - $stime = $ru[ &rusage'ru_stime + &timeval'tv_sec ] - + ($ru[ &rusage'ru_stime + &timeval'tv_usec ]) / 1e6; - - printf "you have used %8.3fs+%8.3fu seconds.\n", $utime, $stime; - - -As you see, the name of the package is the name of the structure. Regular -fields are just their own names. Plus the follwoing accessor functions are -provided for your convenience: - - struct This takes no arguments, and is merely the number of first-level - elements in the structure. You would use this for indexing - into arrays of structures, perhaps like this - - - $usec = $u[ &user'u_utimer - + (&ITIMER_VIRTUAL * &itimerval'struct) - + &itimerval'it_value - + &timeval'tv_usec - ]; - - sizeof Returns the bytes in the structure, or the member if - you pass it an argument, such as - - &rusage'sizeof(&rusage'ru_utime) - - typedef This is the perl format definition for passing to pack and - unpack. If you ask for the typedef of a nothing, you get - the whole structure, otherwise you get that of the member - you ask for. Padding is taken care of, as is the magic to - guarantee that a union is unpacked into all its aliases. - Bitfields are not quite yet supported however. - - offsetof This function is the byte offset into the array of that - member. You may wish to use this for indexing directly - into the packed structure with vec() if you're too lazy - to unpack it. - - typeof Not to be confused with the typedef accessor function, this - one returns the C type of that field. This would allow - you to print out a nice structured pretty print of some - structure without knoning anything about it beforehand. - No args to this one is a noop. Someday I'll post such - a thing to dump out your u structure for you. - - -The way I see this being used is like basically this: - - % h2ph /usr/lib/perl/tmp.ph - % c2ph some_include_file.h >> /usr/lib/perl/tmp.ph - % install - -It's a little tricker with c2ph because you have to get the includes right. -I can't know this for your system, but it's not usually too terribly difficult. - -The code isn't pretty as I mentioned -- I never thought it would be a 1000- -line program when I started, or I might not have begun. :-) But I would have -been less cavalier in how the parts of the program communicated with each -other, etc. It might also have helped if I didn't have to divine the makeup -of the stabs on the fly, and then account for micro differences between my -compiler and gcc. - -Anyway, here it is. Should run on perl v4 or greater. Maybe less. - - ---tom - - diff --git a/hints/bsdi_bsdos.sh b/hints/bsdos.sh similarity index 100% rename from hints/bsdi_bsdos.sh rename to hints/bsdos.sh diff --git a/os2/Makefile.SH b/os2/Makefile.SH deleted file mode 100644 index 78c1218..0000000 --- a/os2/Makefile.SH +++ /dev/null @@ -1,54 +0,0 @@ -# This file is read by Makefile.SH to produce rules for $(perllib) -# We insert perl5.def since I do not know how to generate it yet. - -$spitshell >>Makefile <<'!NO!SUBS!' -$(perllib): perl.imp perl.dll perl5.def - emximp -o $(perllib) perl.imp - -perl.imp: perl5.def - emximp -o perl.imp perl5.def - -perl.dll: $(obj) perl5.def perl$(O) - $(LD) $(LDDLFLAGS) -o $@ perl$(O) $(obj) -lsocket perl5.def - -perl5.def: perl.linkexp - echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@ - echo DESCRIPTION "'Perl interpreter, export autogenerated'" >>$@ - echo STACKSIZE 32768 >>$@ - echo CODE LOADONCALL >>$@ - echo DATA LOADONCALL NONSHARED MULTIPLE >>$@ - echo EXPORTS >>$@ - echo ' "ctermid"' >>$@ - echo ' "ttyname"' >>$@ - cat perl.linkexp >>$@ - -# grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@ - - -# We assume here that perl is available somewhere ... - -perl.exports: perl.exp EXTERN.h perl.h - (echo '#include "EXTERN.h"'; echo '#include "perl.h"' ; \ - echo '#include "perl.exp"') | \ - $(CC) -DEMBED -E - | \ - awk '{if ($$2 == "") print $$1}' | sort | uniq > $@ - -# perl -ne 'print if (/^#!/ .. /^#\s/) && s/^(\w+) *$$/$$1/' > $@ - -perl.linkexp: perl.exports perl.map - cat perl.exports perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp - -perl.map: $(obj) perl$(O) miniperlmain$(O) - $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o dummy.exe miniperlmain$(O) perl$(O) $(obj) -lsocket -lm -Zmap -Zlinker /map - awk '{if ($$3 == "") print $$2}' perl.map - rm dummy.exe dummy.map - -depend: os2ish.h - -os2.c: os2/os2.c os2ish.h - cp $< $@ - -os2ish.h: os2/os2ish.h - cp $< $@ - -!NO!SUBS! diff --git a/pod/PerlDoc/Functions.pm.POSIX b/pod/PerlDoc/Functions.pm.POSIX deleted file mode 100644 index 5e2b435..0000000 --- a/pod/PerlDoc/Functions.pm.POSIX +++ /dev/null @@ -1,215 +0,0 @@ -POSIX::_exit POSIX terminate a process -POSIX::abort POSIX generate a fault -POSIX::abs POSIX integer absolute value -POSIX::access POSIX determine accessibility of file -POSIX::acos POSIX trigonometric functions -POSIX::alarm POSIX schedule signal after specified time -POSIX::asctime POSIX convert date and time -POSIX::asin POSIX trigonometric functions -POSIX::assert POSIX program verification -POSIX::atan2 POSIX trigonometric functions -POSIX::atan POSIX trigonometric functions -POSIX::atof POSIX convert string to double-precision number -POSIX::atoi POSIX convert string to integer -POSIX::atol POSIX convert string to integer -POSIX::bsearch POSIX binary search a sorted table -POSIX::calloc POSIX memory allocator -POSIX::ceil POSIX round to integral value in floating-point or integer format -POSIX::chdir POSIX change current working directory -POSIX::chmod POSIX change mode of file -POSIX::chown POSIX change owner and group of a file -POSIX::clearerr POSIX stream status inquiries -POSIX::clock POSIX report CPU time used -POSIX::close POSIX delete a descriptor -POSIX::closedir POSIX directory operations -POSIX::cos POSIX trigonometric functions -POSIX::cosh POSIX hyperbolic functions -POSIX::creat POSIX create a new file -POSIX::ctermid POSIX generate filename for terminal -POSIX::ctime POSIX convert date and time -POSIX::cuserid POSIX get character login name of the user -POSIX::dup2 POSIX duplicate a descriptor -POSIX::dup POSIX duplicate a descriptor -POSIX::errno POSIX system error messages -POSIX::execl POSIX execute a file -POSIX::execle POSIX execute a file -POSIX::execlp POSIX execute a file -POSIX::execv POSIX execute a file -POSIX::execve POSIX execute a file -POSIX::execvp POSIX execute a file -POSIX::exit POSIX terminate a process after performing cleanup -POSIX::exp POSIX exponential, logarithm, power -POSIX::fabs POSIX appendix and related miscellaneous functions for IEEE arithmetic -POSIX::fclose POSIX close or flush a stream -POSIX::fcntl POSIX file control -POSIX::fdopen POSIX open a stream -POSIX::feof POSIX stream status inquiries -POSIX::ferror POSIX stream status inquiries -POSIX::fflush POSIX close or flush a stream -POSIX::fgetc POSIX get character or integer from stream -POSIX::fgets POSIX get a string from a stream -POSIX::fileno POSIX stream status inquiries -POSIX::floor POSIX round to integral value in floating-point or integer format -POSIX::fmod POSIX appendix and related miscellaneous functions for IEEE arithmetic -POSIX::fopen POSIX open a stream -POSIX::fork POSIX create a new process -POSIX::fpathconf POSIX query file system related limits and options -POSIX::fprintf POSIX formatted output conversion -POSIX::fputc POSIX put character or word on a stream -POSIX::fputs POSIX put a string on a stream -POSIX::fread POSIX buffered binary input/output -POSIX::free POSIX memory allocator -POSIX::freopen POSIX open a stream -POSIX::frexp POSIX traditional UNIX functions -POSIX::fscanf POSIX formatted input conversion -POSIX::fseek POSIX reposition a stream -POSIX::fstat POSIX get file status -POSIX::ftell POSIX reposition a stream -POSIX::fwrite POSIX buffered binary input/output -POSIX::getc POSIX get character or integer from stream -POSIX::getchar POSIX get character or integer from stream -POSIX::getcwd POSIX get pathname of current working directory -POSIX::getegid POSIX get group identity -POSIX::getenv POSIX return value for environment name -POSIX::geteuid POSIX get user identity -POSIX::getgid POSIX get group identity -POSIX::getgrgid POSIX get group file entry -POSIX::getgrnam POSIX get group file entry -POSIX::getgroups POSIX get or set supplementary group IDs -POSIX::getlogin POSIX get login name -POSIX::getpgrp POSIX return or set the process group of a process -POSIX::getpid POSIX get process identification -POSIX::getppid POSIX get process identification -POSIX::getpwnam POSIX get password file entry -POSIX::getpwuid POSIX get password file entry -POSIX::gets POSIX get a string from a stream -POSIX::getuid POSIX get user identity -POSIX::gmtime POSIX convert date and time -POSIX::isalnum POSIX character classification and conversion macros and functions -POSIX::isalpha POSIX character classification and conversion macros and functions -POSIX::isatty POSIX find name of a terminal -POSIX::iscntrl POSIX character classification and conversion macros and functions -POSIX::isdigit POSIX character classification and conversion macros and functions -POSIX::isgraph POSIX character classification and conversion macros and functions -POSIX::islower POSIX character classification and conversion macros and functions -POSIX::isprint POSIX character classification and conversion macros and functions -POSIX::ispunct POSIX character classification and conversion macros and functions -POSIX::isspace POSIX character classification and conversion macros and functions -POSIX::isupper POSIX character classification and conversion macros and functions -POSIX::isxdigit POSIX character classification and conversion macros and functions -POSIX::kill POSIX send a signal to a process or a group of processes -POSIX::ldexp POSIX traditional UNIX functions -POSIX::link POSIX make a hard link to a file -POSIX::localeconv POSIX get numeric and monetary formatting conventions -POSIX::localtime POSIX convert date and time -POSIX::log10 POSIX exponential, logarithm, power -POSIX::log POSIX exponential, logarithm, power -POSIX::longjmp POSIX non-local goto -POSIX::lseek POSIX move read/write pointer -POSIX::malloc POSIX memory allocator -POSIX::mblen POSIX multibyte character handling -POSIX::mbstowcs POSIX multibyte character handling -POSIX::mbtowc POSIX multibyte character handling -POSIX::memchr POSIX memory operations -POSIX::memcmp POSIX memory operations -POSIX::memcpy POSIX memory operations -POSIX::memset POSIX memory operations -POSIX::mkdir POSIX make a directory file -POSIX::mkfifo POSIX make a special file -POSIX::modf POSIX traditional UNIX functions -POSIX::nice POSIX change nice value of a process -POSIX::open POSIX open or create a file for reading or writing -POSIX::opendir POSIX directory operations -POSIX::pathconf POSIX query file system related limits and options -POSIX::pause POSIX stop until signal -POSIX::perror POSIX system error messages -POSIX::pipe POSIX create an interprocess communication channel -POSIX::pow POSIX exponential, logarithm, power -POSIX::pow POSIX multiple precision integer arithmetic -POSIX::printf POSIX formatted output conversion -POSIX::putc POSIX put character or word on a stream -POSIX::putchar POSIX put character or word on a stream -POSIX::puts POSIX put a string on a stream -POSIX::qsort POSIX quicker sort -POSIX::rand POSIX simple random number generator -POSIX::read POSIX read input -POSIX::readdir POSIX directory operations -POSIX::realloc POSIX memory allocator -POSIX::rename POSIX change the name of a file -POSIX::rewind POSIX reposition a stream -POSIX::rewinddir POSIX directory operations -POSIX::rmdir POSIX remove a directory file -POSIX::scanf POSIX formatted input conversion -POSIX::setbuf POSIX assign buffering to a stream -POSIX::setgid POSIX set user and group ID -POSIX::setjmp POSIX non-local goto -POSIX::setlocale POSIX set international environment -POSIX::setpgid POSIX set process group ID for job control -POSIX::setsid POSIX create session and set process group ID -POSIX::setuid POSIX set user and group ID -POSIX::setvbuf POSIX assign buffering to a stream -POSIX::sigaction POSIX examine and change signal action -POSIX::siglongjmp POSIX non-local goto -POSIX::sigpending POSIX examine pending signals -POSIX::sigprocmask POSIX examine and change blocked signals -POSIX::sigsetjmp POSIX non-local goto -POSIX::sigsuspend POSIX automatically release blocked signals and wait for interrupt -POSIX::sin POSIX trigonometric functions -POSIX::sinh POSIX hyperbolic functions -POSIX::sleep POSIX suspend execution for interval -POSIX::sprintf POSIX formatted output conversion -POSIX::sqrt POSIX cube root, square root -POSIX::srand POSIX simple random number generator -POSIX::sscanf POSIX formatted input conversion -POSIX::stat POSIX get file status -POSIX::strcat POSIX string operations -POSIX::strchr POSIX string operations -POSIX::strcmp POSIX string operations -POSIX::strcoll POSIX compare or transform strings using collating information -POSIX::strcpy POSIX string operations -POSIX::strcspn POSIX string operations -POSIX::strftime POSIX convert date and time -POSIX::strlen POSIX string operations -POSIX::strncat POSIX string operations -POSIX::strncmp POSIX string operations -POSIX::strncpy POSIX string operations -POSIX::strpbrk POSIX string operations -POSIX::strrchr POSIX string operations -POSIX::strspn POSIX string operations -POSIX::strstr POSIX string operations -POSIX::strtod POSIX convert string to double-precision number -POSIX::strtok POSIX string operations -POSIX::strtol POSIX convert string to integer -POSIX::strxfrm POSIX compare or transform strings using collating information -POSIX::sysconf POSIX query system related limits, values, options -POSIX::system POSIX issue a shell command -POSIX::tan POSIX trigonometric functions -POSIX::tanh POSIX hyperbolic functions -POSIX::tcdrain POSIX get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID -POSIX::tcflow POSIX get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID -POSIX::tcflush POSIX get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID -POSIX::tcgetpgrp POSIX get, set foreground process group ID -POSIX::tcsendbreak POSIX get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID -POSIX::tcsetpgrp POSIX get, set foreground process group ID -POSIX::tell POSIX move read/write pointer -POSIX::time POSIX get date and time -POSIX::times POSIX get process times -POSIX::tmpfile POSIX create a temporary file -POSIX::tmpnam POSIX create a name for a temporary file -POSIX::tolower POSIX character classification and conversion macros and functions -POSIX::toupper POSIX character classification and conversion macros and functions -POSIX::ttyname POSIX find name of a terminal -POSIX::tzset POSIX convert date and time -POSIX::umask POSIX set file creation mode mask -POSIX::uname POSIX get information about current system -POSIX::ungetc POSIX push character back into input stream -POSIX::unlink POSIX remove directory entry -POSIX::utime POSIX set file times -POSIX::vfprintf POSIX print formatted output of a varargs argument list -POSIX::vprintf POSIX print formatted output of a varargs argument list -POSIX::vsprintf POSIX print formatted output of a varargs argument list -POSIX::wait POSIX wait for process to terminate or stop, examine returned status -POSIX::waitpid POSIX wait for process to terminate or stop, examine returned status -POSIX::wcstombs POSIX multibyte character handling -POSIX::wctomb POSIX multibyte character handling -POSIX::write POSIX write output diff --git a/pod/pod2text b/pod/pod2text.PL similarity index 100% rename from pod/pod2text rename to pod/pod2text.PL diff --git a/c2ph.PL b/utils/c2ph.PL similarity index 100% rename from c2ph.PL rename to utils/c2ph.PL diff --git a/h2ph.PL b/utils/h2ph.PL similarity index 100% rename from h2ph.PL rename to utils/h2ph.PL diff --git a/h2xs.PL b/utils/h2xs.PL similarity index 100% rename from h2xs.PL rename to utils/h2xs.PL diff --git a/perldoc.PL b/utils/perldoc.PL similarity index 100% rename from perldoc.PL rename to utils/perldoc.PL diff --git a/pl2pm b/utils/pl2pm.PL similarity index 100% rename from pl2pm rename to utils/pl2pm.PL