home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume18 / perl / part22 < prev    next >
Internet Message Format  |  1991-04-16  |  51KB

  1. From: lwall@netlabs.com (Larry Wall)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i040:  perl - The perl programming language, Part22/36
  4. Message-ID: <1991Apr16.185553.1238@sparky.IMD.Sterling.COM>
  5. Date: 16 Apr 91 18:55:53 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: a87d6a98 77409c56 d69ec398 ab5f3451
  8.  
  9. Submitted-by: Larry Wall <lwall@netlabs.com>
  10. Posting-number: Volume 18, Issue 40
  11. Archive-name: perl/part22
  12.  
  13. [There are 36 kits for perl version 4.0.]
  14.  
  15. #! /bin/sh
  16.  
  17. # Make a new directory for the perl sources, cd to it, and run kits 1
  18. # thru 36 through sh.  When all 36 kits have been run, read README.
  19.  
  20. echo "This is perl 4.0 kit 22 (of 36).  If kit 22 is complete, the line"
  21. echo '"'"End of kit 22 (of 36)"'" will echo at the end.'
  22. echo ""
  23. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  24. mkdir eg msdos 2>/dev/null
  25. echo Extracting msdos/config.h
  26. sed >msdos/config.h <<'!STUFFY!FUNK!' -e 's/X//'
  27. X#ifndef config_h
  28. X#define config_h
  29. X/* config.h
  30. X *
  31. X * This file is hand tailored for MS-DOS and MSC 5.1 and 6.00A.
  32. X * Tom Dinger, March 1991.
  33. X */
  34. X
  35. X
  36. X/*
  37. X * BUGGY_MSC5:
  38. X *    This symbol is defined if you are the unfortunate owner of the buggy
  39. X *    Microsoft C compiler version 5.1.  It is used as a conditional to
  40. X *    guard code sections that are known to break this compiler.
  41. X * BUGGY_MSC6:
  42. X *    This symbol is defined if you are the unfortunate owner of the buggy
  43. X *    Microsoft C compiler version 6.0A.  It is used as a conditional to
  44. X *    guard code sections that are known to break this compiler.
  45. X */
  46. X#define BUGGY_MSC5            /**/
  47. X/*#undef BUGGY_MSC6            /**/
  48. X
  49. X
  50. X/* EUNICE
  51. X *    This symbol, if defined, indicates that the program is being compiled
  52. X *    under the EUNICE package under VMS.  The program will need to handle
  53. X *    things like files that don't go away the first time you unlink them,
  54. X *    due to version numbering.  It will also need to compensate for lack
  55. X *    of a respectable link() command.
  56. X */
  57. X/* VMS
  58. X *    This symbol, if defined, indicates that the program is running under
  59. X *    VMS.  It is currently only set in conjunction with the EUNICE symbol.
  60. X */
  61. X/*#undef    EUNICE        /**/
  62. X/*#undef    VMS        /**/
  63. X
  64. X/* ALIGNBYTES
  65. X *    This symbol contains the number of bytes required to align a double.
  66. X *    Usual values are 2, 4, and 8.
  67. X */
  68. X#define ALIGNBYTES 4        /**/
  69. X
  70. X/* BIN
  71. X *    This symbol holds the name of the directory in which the user wants
  72. X *    to put publicly executable images for the package in question.  It
  73. X *    is most often a local directory such as /usr/local/bin.
  74. X */
  75. X#define BIN "/usr/local/bin"             /**/
  76. X
  77. X/* BYTEORDER
  78. X *    This symbol contains an encoding of the order of bytes in a long.
  79. X *    Usual values (in octal) are 01234, 04321, 02143, 03412...
  80. X */
  81. X#define BYTEORDER 0x1234        /**/
  82. X
  83. X/* CPPSTDIN
  84. X *    This symbol contains the first part of the string which will invoke
  85. X *    the C preprocessor on the standard input and produce to standard
  86. X *    output.     Typical value of "cc -E" or "/lib/cpp".
  87. X */
  88. X/* CPPMINUS
  89. X *    This symbol contains the second part of the string which will invoke
  90. X *    the C preprocessor on the standard input and produce to standard
  91. X *    output.  This symbol will have the value "-" if CPPSTDIN needs a minus
  92. X *    to specify standard input, otherwise the value is "".
  93. X */
  94. X/* TODO: doesn't work for MSC -- it's more complicated than this */
  95. X#define CPPSTDIN "cl "
  96. X#define CPPMINUS ""
  97. X
  98. X/* HAS_BCMP
  99. X *    This symbol, if defined, indicates that the bcmp routine is available
  100. X *    to compare blocks of memory.  If undefined, use memcmp.  If that's
  101. X *    not available, roll your own.
  102. X */
  103. X/*#undef    HAS_BCMP        /**/
  104. X
  105. X/* HAS_BCOPY
  106. X *    This symbol, if defined, indicates that the bcopy routine is available
  107. X *    to copy blocks of memory.  Otherwise you should probably use memcpy().
  108. X */
  109. X/*#undef    HAS_BCOPY        /**/
  110. X
  111. X/* HAS_BZERO
  112. X *    This symbol, if defined, indicates that the bzero routine is available
  113. X *    to zero blocks of memory.  Otherwise you should probably use memset()
  114. X *    or roll your own.
  115. X */
  116. X/*#undef    HAS_BZERO        /**/
  117. X
  118. X/* CASTNEGFLOAT
  119. X *    This symbol, if defined, indicates that this C compiler knows how to
  120. X *    cast negative or large floating point numbers to unsigned longs, ints
  121. X *    and shorts.
  122. X */
  123. X/* CASTFLAGS
  124. X *    This symbol contains flags that say what difficulties the compiler
  125. X *    has casting odd floating values to unsigned long:
  126. X *        1 = couldn't cast < 0
  127. X *        2 = couldn't cast >= 0x80000000
  128. X */
  129. X#define    CASTNEGFLOAT    /**/
  130. X#define    CASTFLAGS 0    /**/
  131. X
  132. X/* CHARSPRINTF
  133. X *    This symbol is defined if this system declares "char *sprintf()" in
  134. X *    stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
  135. X *    is up to the package author to declare sprintf correctly based on the
  136. X *    symbol.
  137. X */
  138. X/*#undef    CHARSPRINTF     /**/
  139. X
  140. X/* HAS_CHSIZE
  141. X *    This symbol, if defined, indicates that the chsize routine is available
  142. X *    to truncate files.  You might need a -lx to get this routine.
  143. X */
  144. X#define    HAS_CHSIZE        /**/
  145. X
  146. X/* HAS_CRYPT
  147. X *    This symbol, if defined, indicates that the crypt routine is available
  148. X *    to encrypt passwords and the like.
  149. X */
  150. X/*#undef    HAS_CRYPT        /**/
  151. X
  152. X/* CSH
  153. X *    This symbol, if defined, indicates that the C-shell exists.
  154. X *    If defined, contains the full pathname of csh.
  155. X */
  156. X/*#undef CSH "/usr/bin/csh"        /**/
  157. X
  158. X/* DOSUID
  159. X *    This symbol, if defined, indicates that the C program should
  160. X *    check the script that it is executing for setuid/setgid bits, and
  161. X *    attempt to emulate setuid/setgid on systems that have disabled
  162. X *    setuid #! scripts because the kernel can't do it securely.
  163. X *    It is up to the package designer to make sure that this emulation
  164. X *    is done securely.  Among other things, it should do an fstat on
  165. X *    the script it just opened to make sure it really is a setuid/setgid
  166. X *    script, it should make sure the arguments passed correspond exactly
  167. X *    to the argument on the #! line, and it should not trust any
  168. X *    subprocesses to which it must pass the filename rather than the
  169. X *    file descriptor of the script to be executed.
  170. X */
  171. X/*#undef DOSUID        /**/
  172. X
  173. X/* HAS_DUP2
  174. X *    This symbol, if defined, indicates that the dup2 routine is available
  175. X *    to dup file descriptors.  Otherwise you should use dup().
  176. X */
  177. X#define    HAS_DUP2        /**/
  178. X
  179. X/* HAS_FCHMOD
  180. X *    This symbol, if defined, indicates that the fchmod routine is available
  181. X *    to change mode of opened files.  If unavailable, use chmod().
  182. X */
  183. X/*#undef    HAS_FCHMOD        /**/
  184. X
  185. X/* HAS_FCHOWN
  186. X *    This symbol, if defined, indicates that the fchown routine is available
  187. X *    to change ownership of opened files.  If unavailable, use chown().
  188. X */
  189. X/*#undef    HAS_FCHOWN        /**/
  190. X
  191. X/* HAS_FCNTL
  192. X *    This symbol, if defined, indicates to the C program that
  193. X *    the fcntl() function exists.
  194. X */
  195. X/*#undef    HAS_FCNTL        /**/
  196. X
  197. X/* FLEXFILENAMES
  198. X *    This symbol, if defined, indicates that the system supports filenames
  199. X *    longer than 14 characters.
  200. X */
  201. X/*#undef    FLEXFILENAMES        /**/
  202. X
  203. X/* HAS_FLOCK
  204. X *    This symbol, if defined, indicates that the flock() routine is
  205. X *    available to do file locking.
  206. X */
  207. X/*#undef    HAS_FLOCK        /**/
  208. X
  209. X/* HAS_GETGROUPS
  210. X *    This symbol, if defined, indicates that the getgroups() routine is
  211. X *    available to get the list of process groups.  If unavailable, multiple
  212. X *    groups are probably not supported.
  213. X */
  214. X/*#undef    HAS_GETGROUPS        /**/
  215. X
  216. X/* HAS_GETHOSTENT
  217. X *    This symbol, if defined, indicates that the gethostent() routine is
  218. X *    available to lookup host names in some data base or other.
  219. X */
  220. X/*#undef    HAS_GETHOSTENT        /**/
  221. X
  222. X/* HAS_GETPGRP
  223. X *    This symbol, if defined, indicates that the getpgrp() routine is
  224. X *    available to get the current process group.
  225. X */
  226. X/*#undef    HAS_GETPGRP        /**/
  227. X
  228. X/* HAS_GETPGRP2
  229. X *    This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
  230. X *    routine is available to get the current process group.
  231. X */
  232. X/*#undef    HAS_GETPGRP2        /**/
  233. X
  234. X/* HAS_GETPRIORITY
  235. X *    This symbol, if defined, indicates that the getpriority() routine is
  236. X *    available to get a process's priority.
  237. X */
  238. X/*#undef    HAS_GETPRIORITY        /**/
  239. X
  240. X/* HAS_HTONS
  241. X *    This symbol, if defined, indicates that the htons routine (and friends)
  242. X *    are available to do network order byte swapping.
  243. X */
  244. X/* HAS_HTONL
  245. X *    This symbol, if defined, indicates that the htonl routine (and friends)
  246. X *    are available to do network order byte swapping.
  247. X */
  248. X/* HAS_NTOHS
  249. X *    This symbol, if defined, indicates that the ntohs routine (and friends)
  250. X *    are available to do network order byte swapping.
  251. X */
  252. X/* HAS_NTOHL
  253. X *    This symbol, if defined, indicates that the ntohl routine (and friends)
  254. X *    are available to do network order byte swapping.
  255. X */
  256. X/*#undef    HAS_HTONS    /**/
  257. X/*#undef    HAS_HTONL    /**/
  258. X/*#undef    HAS_NTOHS    /**/
  259. X/*#undef    HAS_NTOHL    /**/
  260. X
  261. X/* index
  262. X *    This preprocessor symbol is defined, along with rindex, if the system
  263. X *    uses the strchr and strrchr routines instead.
  264. X */
  265. X/* rindex
  266. X *    This preprocessor symbol is defined, along with index, if the system
  267. X *    uses the strchr and strrchr routines instead.
  268. X */
  269. X#define    index strchr    /* cultural */
  270. X#define    rindex strrchr    /*  differences? */
  271. X
  272. X/* HAS_KILLPG
  273. X *    This symbol, if defined, indicates that the killpg routine is available
  274. X *    to kill process groups.  If unavailable, you probably should use kill
  275. X *    with a negative process number.
  276. X */
  277. X/*#undef    HAS_KILLPG        /**/
  278. X
  279. X/* HAS_LSTAT
  280. X *    This symbol, if defined, indicates that the lstat() routine is
  281. X *    available to stat symbolic links.
  282. X */
  283. X/*#undef    HAS_LSTAT        /**/
  284. X
  285. X/* HAS_MEMCMP
  286. X *    This symbol, if defined, indicates that the memcmp routine is available
  287. X *    to compare blocks of memory.  If undefined, roll your own.
  288. X */
  289. X#define    HAS_MEMCMP        /**/
  290. X
  291. X/* HAS_MEMCPY
  292. X *    This symbol, if defined, indicates that the memcpy routine is available
  293. X *    to copy blocks of memory.  Otherwise you should probably use bcopy().
  294. X *    If neither is defined, roll your own.
  295. X */
  296. X#define    HAS_MEMCPY        /**/
  297. X
  298. X/* HAS_MKDIR
  299. X *    This symbol, if defined, indicates that the mkdir routine is available
  300. X *    to create directories.  Otherwise you should fork off a new process to
  301. X *    exec /bin/mkdir.
  302. X */
  303. X#define    HAS_MKDIR        /**/
  304. X
  305. X/* HAS_MSG
  306. X *    This symbol, if defined, indicates that the entire msg*(2) library is
  307. X *    supported.
  308. X */
  309. X/*#undef    HAS_MSG        /**/
  310. X
  311. X/* HAS_MSGCTL
  312. X *    This symbol, if defined, indicates that the msgctl() routine is
  313. X *    available to stat symbolic links.
  314. X */
  315. X/*#undef    HAS_MSGCTL        /**/
  316. X
  317. X/* HAS_MSGGET
  318. X *    This symbol, if defined, indicates that the msgget() routine is
  319. X *    available to stat symbolic links.
  320. X */
  321. X/*#undef    HAS_MSGGET        /**/
  322. X
  323. X/* HAS_MSGRCV
  324. X *    This symbol, if defined, indicates that the msgrcv() routine is
  325. X *    available to stat symbolic links.
  326. X */
  327. X/*#undef    HAS_MSGRCV        /**/
  328. X
  329. X/* HAS_MSGSND
  330. X *    This symbol, if defined, indicates that the msgsnd() routine is
  331. X *    available to stat symbolic links.
  332. X */
  333. X/*#undef    HAS_MSGSND        /**/
  334. X
  335. X/* HAS_NDBM
  336. X *    This symbol, if defined, indicates that ndbm.h exists and should
  337. X *    be included.
  338. X */
  339. X/*#undef    HAS_NDBM        /**/
  340. X
  341. X/* HAS_ODBM
  342. X *    This symbol, if defined, indicates that dbm.h exists and should
  343. X *    be included.
  344. X */
  345. X/*#undef    HAS_ODBM        /**/
  346. X
  347. X/* HAS_OPEN3
  348. X *    This manifest constant lets the C program know that the three
  349. X *    argument form of open(2) is available.
  350. X */
  351. X#define    HAS_OPEN3        /**/
  352. X
  353. X/* HAS_READDIR
  354. X *    This symbol, if defined, indicates that the readdir routine is available
  355. X *    from the C library to read directories.
  356. X */
  357. X#define    HAS_READDIR        /**/
  358. X
  359. X/* HAS_RENAME
  360. X *    This symbol, if defined, indicates that the rename routine is available
  361. X *    to rename files.  Otherwise you should do the unlink(), link(), unlink()
  362. X *    trick.
  363. X */
  364. X#define    HAS_RENAME        /**/
  365. X
  366. X/* HAS_RMDIR
  367. X *    This symbol, if defined, indicates that the rmdir routine is available
  368. X *    to remove directories.  Otherwise you should fork off a new process to
  369. X *    exec /bin/rmdir.
  370. X */
  371. X#define    HAS_RMDIR        /**/
  372. X
  373. X/* HAS_SELECT
  374. X *    This symbol, if defined, indicates that the select() subroutine
  375. X *    exists.
  376. X */
  377. X/*#undef    HAS_SELECT    /**/
  378. X
  379. X/* HAS_SEM
  380. X *    This symbol, if defined, indicates that the entire sem*(2) library is
  381. X *    supported.
  382. X */
  383. X/*#undef    HAS_SEM        /**/
  384. X
  385. X/* HAS_SEMCTL
  386. X *    This symbol, if defined, indicates that the semctl() routine is
  387. X *    available to stat symbolic links.
  388. X */
  389. X/*#undef    HAS_SEMCTL        /**/
  390. X
  391. X/* HAS_SEMGET
  392. X *    This symbol, if defined, indicates that the semget() routine is
  393. X *    available to stat symbolic links.
  394. X */
  395. X/*#undef    HAS_SEMGET        /**/
  396. X
  397. X/* HAS_SEMOP
  398. X *    This symbol, if defined, indicates that the semop() routine is
  399. X *    available to stat symbolic links.
  400. X */
  401. X/*#undef    HAS_SEMOP        /**/
  402. X
  403. X/* HAS_SETEGID
  404. X *    This symbol, if defined, indicates that the setegid routine is available
  405. X *    to change the effective gid of the current program.
  406. X */
  407. X/*#undef    HAS_SETEGID        /**/
  408. X
  409. X/* HAS_SETEUID
  410. X *    This symbol, if defined, indicates that the seteuid routine is available
  411. X *    to change the effective uid of the current program.
  412. X */
  413. X/*#undef    HAS_SETEUID        /**/
  414. X
  415. X/* HAS_SETPGRP
  416. X *    This symbol, if defined, indicates that the setpgrp() routine is
  417. X *    available to set the current process group.
  418. X */
  419. X/*#undef    HAS_SETPGRP        /**/
  420. X
  421. X/* HAS_SETPGRP2
  422. X *    This symbol, if defined, indicates that the setpgrp2() (as in DG/UX)
  423. X *    routine is available to set the current process group.
  424. X */
  425. X/*#undef    HAS_SETPGRP2        /**/
  426. X
  427. X/* HAS_SETPRIORITY
  428. X *    This symbol, if defined, indicates that the setpriority() routine is
  429. X *    available to set a process's priority.
  430. X */
  431. X/*#undef    HAS_SETPRIORITY        /**/
  432. X
  433. X/* HAS_SETREGID
  434. X *    This symbol, if defined, indicates that the setregid routine is
  435. X *    available to change the real and effective gid of the current program.
  436. X */
  437. X/* HAS_SETRESGID
  438. X *    This symbol, if defined, indicates that the setresgid routine is
  439. X *    available to change the real, effective and saved gid of the current
  440. X *    program.
  441. X */
  442. X/*#undef    HAS_SETREGID        /**/
  443. X/*#undef    HAS_SETRESGID        /**/
  444. X
  445. X/* HAS_SETREUID
  446. X *    This symbol, if defined, indicates that the setreuid routine is
  447. X *    available to change the real and effective uid of the current program.
  448. X */
  449. X/* HAS_SETRESUID
  450. X *    This symbol, if defined, indicates that the setresuid routine is
  451. X *    available to change the real, effective and saved uid of the current
  452. X *    program.
  453. X */
  454. X/*#undef    HAS_SETREUID        /**/
  455. X/*#undef    HAS_SETRESUID        /**/
  456. X
  457. X/* HAS_SETRGID
  458. X *    This symbol, if defined, indicates that the setrgid routine is available
  459. X *    to change the real gid of the current program.
  460. X */
  461. X/*#undef    HAS_SETRGID        /**/
  462. X
  463. X/* HAS_SETRUID
  464. X *    This symbol, if defined, indicates that the setruid routine is available
  465. X *    to change the real uid of the current program.
  466. X */
  467. X/*#undef    HAS_SETRUID        /**/
  468. X
  469. X/* HAS_SHM
  470. X *    This symbol, if defined, indicates that the entire shm*(2) library is
  471. X *    supported.
  472. X */
  473. X/*#undef    HAS_SHM        /**/
  474. X
  475. X/* HAS_SHMAT
  476. X *    This symbol, if defined, indicates that the shmat() routine is
  477. X *    available to stat symbolic links.
  478. X */
  479. X/*#undef    HAS_SHMAT        /**/
  480. X
  481. X/* HAS_SHMCTL
  482. X *    This symbol, if defined, indicates that the shmctl() routine is
  483. X *    available to stat symbolic links.
  484. X */
  485. X/*#undef    HAS_SHMCTL        /**/
  486. X
  487. X/* HAS_SHMDT
  488. X *    This symbol, if defined, indicates that the shmdt() routine is
  489. X *    available to stat symbolic links.
  490. X */
  491. X/*#undef    HAS_SHMDT        /**/
  492. X
  493. X/* HAS_SHMGET
  494. X *    This symbol, if defined, indicates that the shmget() routine is
  495. X *    available to stat symbolic links.
  496. X */
  497. X/*#undef    HAS_SHMGET        /**/
  498. X
  499. X/* HAS_SOCKET
  500. X *    This symbol, if defined, indicates that the BSD socket interface is
  501. X *    supported.
  502. X */
  503. X/* HAS_SOCKETPAIR
  504. X *    This symbol, if defined, indicates that the BSD socketpair call is
  505. X *    supported.
  506. X */
  507. X/* OLDSOCKET
  508. X *    This symbol, if defined, indicates that the 4.1c BSD socket interface
  509. X *    is supported instead of the 4.2/4.3 BSD socket interface.
  510. X */
  511. X/*#undef    HAS_SOCKET        /**/
  512. X
  513. X/*#undef    HAS_SOCKETPAIR    /**/
  514. X
  515. X/*#undef    OLDSOCKET    /**/
  516. X
  517. X/* STATBLOCKS
  518. X *    This symbol is defined if this system has a stat structure declaring
  519. X *    st_blksize and st_blocks.
  520. X */
  521. X/*#undef    STATBLOCKS     /**/
  522. X
  523. X/* STDSTDIO
  524. X *    This symbol is defined if this system has a FILE structure declaring
  525. X *    _ptr and _cnt in stdio.h.
  526. X *
  527. X *    NOTE: [Tom Dinger, 23 February 1991] You also need the _filbuf()
  528. X *    function, usually referred to by the getc() macro in stdio.h.
  529. X */
  530. X#define    STDSTDIO     /**/
  531. X
  532. X/* STRUCTCOPY
  533. X *    This symbol, if defined, indicates that this C compiler knows how
  534. X *    to copy structures.  If undefined, you'll need to use a block copy
  535. X *    routine of some sort instead.
  536. X */
  537. X#define    STRUCTCOPY    /**/
  538. X
  539. X/* HAS_STRERROR
  540. X *    This symbol, if defined, indicates that the strerror() routine is
  541. X *    available to translate error numbers to strings.
  542. X */
  543. X#define    HAS_STRERROR        /**/
  544. X
  545. X/* HAS_SYMLINK
  546. X *    This symbol, if defined, indicates that the symlink routine is available
  547. X *    to create symbolic links.
  548. X */
  549. X/*#undef    HAS_SYMLINK        /**/
  550. X
  551. X/* HAS_SYSCALL
  552. X *    This symbol, if defined, indicates that the syscall routine is available
  553. X *    to call arbitrary system calls.  If undefined, that's tough.
  554. X */
  555. X/*#undef    HAS_SYSCALL        /**/
  556. X
  557. X/* HAS_TRUNCATE
  558. X *    This symbol, if defined, indicates that the truncate routine is
  559. X *    available to truncate files.
  560. X */
  561. X/*#undef    HAS_TRUNCATE        /**/
  562. X
  563. X/* HAS_VFORK
  564. X *    This symbol, if defined, indicates that vfork() exists.
  565. X */
  566. X/*#undef    HAS_VFORK    /**/
  567. X
  568. X/* VOIDSIG
  569. X *    This symbol is defined if this system declares "void (*signal())()" in
  570. X *    signal.h.  The old way was to declare it as "int (*signal())()".  It
  571. X *    is up to the package author to declare things correctly based on the
  572. X *    symbol.
  573. X */
  574. X/* TO_SIGNAL
  575. X *    This symbol's value is either "void" or "int", corresponding to the
  576. X *    appropriate return "type" of a signal handler.  Thus, one can declare
  577. X *    a signal handler using "TO_SIGNAL (*handler())()", and define the
  578. X *    handler using "TO_SIGNAL handler(sig)".
  579. X */
  580. X#define    VOIDSIG     /**/
  581. X#define    TO_SIGNAL    int     /**/
  582. X
  583. X/* HASVOLATILE
  584. X *    This symbol, if defined, indicates that this C compiler knows about
  585. X *    the volatile declaration.
  586. X */
  587. X/*#undef    HASVOLATILE    /**/
  588. X
  589. X/* HAS_VPRINTF
  590. X *    This symbol, if defined, indicates that the vprintf routine is available
  591. X *    to printf with a pointer to an argument list.  If unavailable, you
  592. X *    may need to write your own, probably in terms of _doprnt().
  593. X */
  594. X/* CHARVSPRINTF
  595. X *    This symbol is defined if this system has vsprintf() returning type
  596. X *    (char*).  The trend seems to be to declare it as "int vsprintf()".  It
  597. X *    is up to the package author to declare vsprintf correctly based on the
  598. X *    symbol.
  599. X */
  600. X#define    HAS_VPRINTF    /**/
  601. X/*#undef    CHARVSPRINTF     /**/
  602. X
  603. X/* HAS_WAIT4
  604. X *    This symbol, if defined, indicates that wait4() exists.
  605. X */
  606. X/*#undef    HAS_WAIT4    /**/
  607. X
  608. X/* HAS_WAITPID
  609. X *    This symbol, if defined, indicates that waitpid() exists.
  610. X */
  611. X/*#undef    HAS_WAITPID    /**/
  612. X
  613. X/* GIDTYPE
  614. X *    This symbol has a value like gid_t, int, ushort, or whatever type is
  615. X *    used to declare group ids in the kernel.
  616. X */
  617. X#define GIDTYPE int        /**/
  618. X
  619. X/* I_FCNTL
  620. X *    This manifest constant tells the C program to include <fcntl.h>.
  621. X */
  622. X#define    I_FCNTL    /**/
  623. X
  624. X/* I_GRP
  625. X *    This symbol, if defined, indicates to the C program that it should
  626. X *    include grp.h.
  627. X */
  628. X/*#undef    I_GRP        /**/
  629. X
  630. X/* I_NETINET_IN
  631. X *    This symbol, if defined, indicates to the C program that it should
  632. X *    include netinet/in.h.
  633. X */
  634. X/* I_SYS_IN
  635. X *    This symbol, if defined, indicates to the C program that it should
  636. X *    include sys/in.h.
  637. X */
  638. X/*#undef    I_NETINET_IN        /**/
  639. X/*#undef    I_SYS_IN        /**/
  640. X
  641. X/* I_PWD
  642. X *    This symbol, if defined, indicates to the C program that it should
  643. X *    include pwd.h.
  644. X */
  645. X/* PWQUOTA
  646. X *    This symbol, if defined, indicates to the C program that struct passwd
  647. X *    contains pw_quota.
  648. X */
  649. X/* PWAGE
  650. X *    This symbol, if defined, indicates to the C program that struct passwd
  651. X *    contains pw_age.
  652. X */
  653. X/* PWCHANGE
  654. X *    This symbol, if defined, indicates to the C program that struct passwd
  655. X *    contains pw_change.
  656. X */
  657. X/* PWCLASS
  658. X *    This symbol, if defined, indicates to the C program that struct passwd
  659. X *    contains pw_class.
  660. X */
  661. X/* PWEXPIRE
  662. X *    This symbol, if defined, indicates to the C program that struct passwd
  663. X *    contains pw_expire.
  664. X */
  665. X/* PWCOMMENT
  666. X *    This symbol, if defined, indicates to the C program that struct passwd
  667. X *    contains pw_comment.
  668. X */
  669. X/*#undef    I_PWD        /**/
  670. X/*#undef    PWQUOTA        /**/
  671. X/*#undef    PWAGE        /**/
  672. X/*#undef    PWCHANGE    /**/
  673. X/*#undef    PWCLASS        /**/
  674. X/*#undef    PWEXPIRE    /**/
  675. X/*#undef    PWCOMMENT    /**/
  676. X
  677. X/* I_SYS_FILE
  678. X *    This manifest constant tells the C program to include <sys/file.h>.
  679. X */
  680. X/*#undef    I_SYS_FILE    /**/
  681. X
  682. X/* I_SYSIOCTL
  683. X *    This symbol, if defined, indicates that sys/ioctl.h exists and should
  684. X *    be included.
  685. X */
  686. X/*#undef    I_SYSIOCTL        /**/
  687. X
  688. X/* I_TIME
  689. X *    This symbol is defined if the program should include <time.h>.
  690. X */
  691. X/* I_SYS_TIME
  692. X *    This symbol is defined if the program should include <sys/time.h>.
  693. X */
  694. X/* SYSTIMEKERNEL
  695. X *    This symbol is defined if the program should include <sys/time.h>
  696. X *    with KERNEL defined.
  697. X */
  698. X/* I_SYS_SELECT
  699. X *    This symbol is defined if the program should include <sys/select.h>.
  700. X */
  701. X#define    I_TIME         /**/
  702. X/*#undef    I_SYS_TIME     /**/
  703. X/*#undef    SYSTIMEKERNEL     /**/
  704. X/*#undef    I_SYS_SELECT     /**/
  705. X
  706. X/* I_UTIME
  707. X *    This symbol, if defined, indicates to the C program that it should
  708. X *    include utime.h.
  709. X */
  710. X/*#undef    I_UTIME        /**/
  711. X
  712. X/* I_VARARGS
  713. X *    This symbol, if defined, indicates to the C program that it should
  714. X *    include varargs.h.
  715. X */
  716. X#define    I_VARARGS        /**/
  717. X
  718. X/* I_VFORK
  719. X *    This symbol, if defined, indicates to the C program that it should
  720. X *    include vfork.h.
  721. X */
  722. X/*#undef    I_VFORK        /**/
  723. X
  724. X/* INTSIZE
  725. X *    This symbol contains the size of an int, so that the C preprocessor
  726. X *    can make decisions based on it.
  727. X */
  728. X#define INTSIZE 2        /**/
  729. X
  730. X/* I_DIRENT
  731. X *    This symbol, if defined, indicates that the program should use the
  732. X *    P1003-style directory routines, and include <dirent.h>.
  733. X */
  734. X/* I_SYS_DIR
  735. X *    This symbol, if defined, indicates that the program should use the
  736. X *    directory functions by including <sys/dir.h>.
  737. X */
  738. X/* I_NDIR
  739. X *    This symbol, if defined, indicates that the program should include the
  740. X *    system's version of ndir.h, rather than the one with this package.
  741. X */
  742. X/* I_SYS_NDIR
  743. X *    This symbol, if defined, indicates that the program should include the
  744. X *    system's version of sys/ndir.h, rather than the one with this package.
  745. X */
  746. X/* I_MY_DIR
  747. X *    This symbol, if defined, indicates that the program should compile
  748. X *    the ndir.c code provided with the package.
  749. X */
  750. X/* DIRNAMLEN
  751. X *    This symbol, if defined, indicates to the C program that the length
  752. X *    of directory entry names is provided by a d_namlen field.  Otherwise
  753. X *    you need to do strlen() on the d_name field.
  754. X */
  755. X/*#undef    I_DIRENT    /**/
  756. X#define    I_SYS_DIR    /**/
  757. X/*#undef    I_NDIR        /**/
  758. X/*#undef    I_SYS_NDIR    /**/
  759. X/*#undef    I_MY_DIR    /**/
  760. X/*#undef    DIRNAMLEN    /**/
  761. X
  762. X
  763. X/* RANDBITS
  764. X *    This symbol contains the number of bits of random number the rand()
  765. X *    function produces.  Usual values are 15, 16, and 31.
  766. X */
  767. X#define RANDBITS 31        /**/
  768. X
  769. X/* SCRIPTDIR
  770. X *    This symbol holds the name of the directory in which the user wants
  771. X *    to put publicly executable scripts for the package in question.  It
  772. X *    is often a directory that is mounted across diverse architectures.
  773. X */
  774. X#define SCRIPTDIR "C:/bin/perl"             /**/
  775. X
  776. X/* SIG_NAME
  777. X *    This symbol contains an list of signal names in order.
  778. X *
  779. X *    Note: This list is specific for Microsoft C 5.1 and 6.0, which only
  780. X *    support SIGINT, SIGFPE, SIGILL, SIGSEGV, and SIGABRT on
  781. X *    DOS 3.x, but in addition defines SIGTERM, SIGBREAK, SIGUSR1,
  782. X *    SIGUSR2, and SIGUSR3.
  783. X */
  784. X#define SIG_NAME \
  785. X "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL",\
  786. X "BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","TSTP","CONT",\
  787. X "USR3","BREAK","ABRT"        /**/
  788. X
  789. X/* STDCHAR
  790. X *    This symbol is defined to be the type of char used in stdio.h.
  791. X *    It has the values "unsigned char" or "char".
  792. X */
  793. X#define STDCHAR char    /**/
  794. X
  795. X/* UIDTYPE
  796. X *    This symbol has a value like uid_t, int, ushort, or whatever type is
  797. X *    used to declare user ids in the kernel.
  798. X */
  799. X#define UIDTYPE int        /**/
  800. X
  801. X/* VOIDHAVE
  802. X *    This symbol indicates how much support of the void type is given by this
  803. X *    compiler.  What various bits mean:
  804. X *
  805. X *        1 = supports declaration of void
  806. X *        2 = supports arrays of pointers to functions returning void
  807. X *        4 = supports comparisons between pointers to void functions and
  808. X *            addresses of void functions
  809. X *
  810. X *    The package designer should define VOIDWANT to indicate the requirements
  811. X *    of the package.  This can be done either by #defining VOIDWANT before
  812. X *    including config.h, or by defining voidwant in Myinit.U.  If the level
  813. X *    of void support necessary is not present, config.h defines void to "int",
  814. X *    VOID to the empty string, and VOIDP to "char *".
  815. X */
  816. X/* void
  817. X *    This symbol is used for void casts.  On implementations which support
  818. X *    void appropriately, its value is "void".  Otherwise, its value maps
  819. X *    to "int".
  820. X */
  821. X/* VOID
  822. X *    This symbol's value is "void" if the implementation supports void
  823. X *    appropriately.  Otherwise, its value is the empty string.  The primary
  824. X *    use of this symbol is in specifying void parameter lists for function
  825. X *    prototypes.
  826. X */
  827. X/* VOIDP
  828. X *    This symbol is used for casting generic pointers.  On implementations
  829. X *    which support void appropriately, its value is "void *".  Otherwise,
  830. X *    its value is "char *".
  831. X */
  832. X#ifndef VOIDWANT
  833. X#define VOIDWANT 1
  834. X#endif
  835. X#define VOIDHAVE 1
  836. X#if (VOIDHAVE & VOIDWANT) != VOIDWANT
  837. X#define void int        /* is void to be avoided? */
  838. X#define VOID
  839. X#define VOIDP (char *)
  840. X#define M_VOID        /* Xenix strikes again */
  841. X#else
  842. X#define VOID void
  843. X#define VOIDP (void *)
  844. X#endif
  845. X
  846. X/* PRIVLIB
  847. X *    This symbol contains the name of the private library for this package.
  848. X *    The library is private in the sense that it needn't be in anyone's
  849. X *    execution path, but it should be accessible by the world.  The program
  850. X *    should be prepared to do ~ expansion.
  851. X */
  852. X#define PRIVLIB "/usr/local/lib/perl"        /**/
  853. X
  854. X/*
  855. X * BINARY:
  856. X *    This symbol is defined if you run under an operating system that
  857. X *    distinguishes between binary and text files.  If so the function
  858. X *    setmode will be used to set the file into binary mode.
  859. X */
  860. X#define BINARY
  861. X
  862. X#define S_ISUID 0
  863. X#define S_ISGID 0
  864. X
  865. X/* For MSC5.1, toke.c "runs out of heap space" unless CRIPPLED_CC is
  866. X * defined.
  867. X */
  868. X#if defined(BUGGY_MSC5) || defined(BUGGY_MSC6)
  869. X#define        CRIPPLED_CC        /**/
  870. X#endif
  871. X
  872. X/* MSC (5.1 and 6.0) doesn't know about S_IFBLK or S_IFIFO -- these are
  873. X * normally found in sys/stat.h
  874. X */
  875. X#define S_IFBLK    (S_IFDIR | S_IFCHR)
  876. X#define    S_IFIFO    0010000
  877. X
  878. X/* Define SUFFIX to get special DOS suffix-replacement code */
  879. X#define SUFFIX                /**/
  880. X
  881. X/* Add this for the DOS-specific chdir() function */
  882. X#define chdir perl_chdir
  883. X
  884. X#endif
  885. !STUFFY!FUNK!
  886. echo Extracting perly.y
  887. sed >perly.y <<'!STUFFY!FUNK!' -e 's/X//'
  888. X/* $Header: perly.y,v 4.0 91/03/20 01:38:40 lwall Locked $
  889. X *
  890. X *    Copyright (c) 1989, Larry Wall
  891. X *
  892. X *    You may distribute under the terms of the GNU General Public License
  893. X *    as specified in the README file that comes with the perl 3.0 kit.
  894. X *
  895. X * $Log:    perly.y,v $
  896. X * Revision 4.0  91/03/20  01:38:40  lwall
  897. X * 4.0 baseline.
  898. X * 
  899. X */
  900. X
  901. X%{
  902. X#include "INTERN.h"
  903. X#include "perl.h"
  904. X
  905. XSTAB *scrstab;
  906. XARG *arg4;    /* rarely used arguments to make_op() */
  907. XARG *arg5;
  908. X
  909. X%}
  910. X
  911. X%start prog
  912. X
  913. X%union {
  914. X    int    ival;
  915. X    char *cval;
  916. X    ARG *arg;
  917. X    CMD *cmdval;
  918. X    struct compcmd compval;
  919. X    STAB *stabval;
  920. X    FCMD *formval;
  921. X}
  922. X
  923. X%token <cval> WORD
  924. X%token <ival> APPEND OPEN SSELECT LOOPEX
  925. X%token <ival> USING FORMAT DO SHIFT PUSH POP LVALFUN
  926. X%token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE SPLIT FLIST
  927. X%token <ival> FOR FILOP FILOP2 FILOP3 FILOP4 FILOP22 FILOP25
  928. X%token <ival> FUNC0 FUNC1 FUNC2 FUNC2x FUNC3 FUNC4 FUNC5 HSHFUN HSHFUN3
  929. X%token <ival> FLIST2 SUB FILETEST LOCAL DELETE
  930. X%token <ival> RELOP EQOP MULOP ADDOP PACKAGE AMPER
  931. X%token <formval> FORMLIST
  932. X%token <stabval> REG ARYLEN ARY HSH STAR
  933. X%token <arg> SUBST PATTERN
  934. X%token <arg> RSTRING TRANS
  935. X
  936. X%type <ival> prog decl format remember
  937. X%type <cmdval> block lineseq line loop cond sideff nexpr else
  938. X%type <arg> expr sexpr cexpr csexpr term handle aryword hshword
  939. X%type <arg> texpr listop bareword
  940. X%type <cval> label
  941. X%type <compval> compblock
  942. X
  943. X%nonassoc <ival> LISTOP
  944. X%left ','
  945. X%right '='
  946. X%right '?' ':'
  947. X%nonassoc DOTDOT
  948. X%left OROR
  949. X%left ANDAND
  950. X%left '|' '^'
  951. X%left '&'
  952. X%nonassoc EQOP
  953. X%nonassoc RELOP
  954. X%nonassoc <ival> UNIOP
  955. X%nonassoc FILETEST
  956. X%left LS RS
  957. X%left ADDOP
  958. X%left MULOP
  959. X%left MATCH NMATCH 
  960. X%right '!' '~' UMINUS
  961. X%right POW
  962. X%nonassoc INC DEC
  963. X%left '('
  964. X
  965. X%% /* RULES */
  966. X
  967. Xprog    :    /* NULL */
  968. X        {
  969. X#if defined(YYDEBUG) && defined(DEBUGGING)
  970. X            yydebug = (debug & 1);
  971. X#endif
  972. X        }
  973. X    /*CONTINUED*/    lineseq
  974. X            { if (in_eval)
  975. X                eval_root = block_head($2);
  976. X                else
  977. X                main_root = block_head($2); }
  978. X    ;
  979. X
  980. Xcompblock:    block CONTINUE block
  981. X            { $$.comp_true = $1; $$.comp_alt = $3; }
  982. X    |    block else
  983. X            { $$.comp_true = $1; $$.comp_alt = $2; }
  984. X    ;
  985. X
  986. Xelse    :    /* NULL */
  987. X            { $$ = Nullcmd; }
  988. X    |    ELSE block
  989. X            { $$ = $2; }
  990. X    |    ELSIF '(' expr ')' compblock
  991. X            { cmdline = $1;
  992. X                $$ = make_ccmd(C_ELSIF,$3,$5); }
  993. X    ;
  994. X
  995. Xblock    :    '{' remember lineseq '}'
  996. X            { $$ = block_head($3);
  997. X              if (savestack->ary_fill > $2)
  998. X                restorelist($2); }
  999. X    ;
  1000. X
  1001. Xremember:    /* NULL */    /* in case they push a package name */
  1002. X            { $$ = savestack->ary_fill; }
  1003. X    ;
  1004. X
  1005. Xlineseq    :    /* NULL */
  1006. X            { $$ = Nullcmd; }
  1007. X    |    lineseq line
  1008. X            { $$ = append_line($1,$2); }
  1009. X    ;
  1010. X
  1011. Xline    :    decl
  1012. X            { $$ = Nullcmd; }
  1013. X    |    label cond
  1014. X            { $$ = add_label($1,$2); }
  1015. X    |    loop    /* loops add their own labels */
  1016. X    |    label ';'
  1017. X            { if ($1 != Nullch) {
  1018. X                  $$ = add_label($1, make_acmd(C_EXPR, Nullstab,
  1019. X                  Nullarg, Nullarg) );
  1020. X                }
  1021. X                else {
  1022. X                  $$ = Nullcmd;
  1023. X                  cmdline = NOLINE;
  1024. X                } }
  1025. X    |    label sideff ';'
  1026. X            { $$ = add_label($1,$2); }
  1027. X    ;
  1028. X
  1029. Xsideff    :    error
  1030. X            { $$ = Nullcmd; }
  1031. X    |    expr
  1032. X            { $$ = make_acmd(C_EXPR, Nullstab, $1, Nullarg); }
  1033. X    |    expr IF expr
  1034. X            { $$ = addcond(
  1035. X                   make_acmd(C_EXPR, Nullstab, Nullarg, $1), $3); }
  1036. X    |    expr UNLESS expr
  1037. X            { $$ = addcond(invert(
  1038. X                   make_acmd(C_EXPR, Nullstab, Nullarg, $1)), $3); }
  1039. X    |    expr WHILE expr
  1040. X            { $$ = addloop(
  1041. X                   make_acmd(C_EXPR, Nullstab, Nullarg, $1), $3); }
  1042. X    |    expr UNTIL expr
  1043. X            { $$ = addloop(invert(
  1044. X                   make_acmd(C_EXPR, Nullstab, Nullarg, $1)), $3); }
  1045. X    ;
  1046. X
  1047. Xcond    :    IF '(' expr ')' compblock
  1048. X            { cmdline = $1;
  1049. X                $$ = make_icmd(C_IF,$3,$5); }
  1050. X    |    UNLESS '(' expr ')' compblock
  1051. X            { cmdline = $1;
  1052. X                $$ = invert(make_icmd(C_IF,$3,$5)); }
  1053. X    |    IF block compblock
  1054. X            { cmdline = $1;
  1055. X                $$ = make_ccmd(C_IF,cmd_to_arg($2),$3); }
  1056. X    |    UNLESS block compblock
  1057. X            { cmdline = $1;
  1058. X                $$ = invert(make_ccmd(C_IF,cmd_to_arg($2),$3)); }
  1059. X    ;
  1060. X
  1061. Xloop    :    label WHILE '(' texpr ')' compblock
  1062. X            { cmdline = $2;
  1063. X                $$ = wopt(add_label($1,
  1064. X                make_ccmd(C_WHILE,$4,$6) )); }
  1065. X    |    label UNTIL '(' expr ')' compblock
  1066. X            { cmdline = $2;
  1067. X                $$ = wopt(add_label($1,
  1068. X                invert(make_ccmd(C_WHILE,$4,$6)) )); }
  1069. X    |    label WHILE block compblock
  1070. X            { cmdline = $2;
  1071. X                $$ = wopt(add_label($1,
  1072. X                make_ccmd(C_WHILE, cmd_to_arg($3),$4) )); }
  1073. X    |    label UNTIL block compblock
  1074. X            { cmdline = $2;
  1075. X                $$ = wopt(add_label($1,
  1076. X                invert(make_ccmd(C_WHILE, cmd_to_arg($3),$4)) )); }
  1077. X    |    label FOR REG '(' expr ')' compblock
  1078. X            { cmdline = $2;
  1079. X                /*
  1080. X                 * The following gobbledygook catches EXPRs that
  1081. X                 * aren't explicit array refs and translates
  1082. X                 *        foreach VAR (EXPR) {
  1083. X                 * into
  1084. X                 *        @ary = EXPR;
  1085. X                 *        foreach VAR (@ary) {
  1086. X                 * where @ary is a hidden array made by genstab().
  1087. X                 * (Note that @ary may become a local array if
  1088. X                 * it is determined that it might be called
  1089. X                 * recursively.  See cmd_tosave().)
  1090. X                 */
  1091. X                if ($5->arg_type != O_ARRAY) {
  1092. X                scrstab = aadd(genstab());
  1093. X                $$ = append_line(
  1094. X                    make_acmd(C_EXPR, Nullstab,
  1095. X                      l(make_op(O_ASSIGN,2,
  1096. X                    listish(make_op(O_ARRAY, 1,
  1097. X                      stab2arg(A_STAB,scrstab),
  1098. X                      Nullarg,Nullarg )),
  1099. X                    listish(make_list($5)),
  1100. X                    Nullarg)),
  1101. X                      Nullarg),
  1102. X                    wopt(over($3,add_label($1,
  1103. X                      make_ccmd(C_WHILE,
  1104. X                    make_op(O_ARRAY, 1,
  1105. X                      stab2arg(A_STAB,scrstab),
  1106. X                      Nullarg,Nullarg ),
  1107. X                    $7)))));
  1108. X                $$->c_line = $2;
  1109. X                $$->c_head->c_line = $2;
  1110. X                }
  1111. X                else {
  1112. X                $$ = wopt(over($3,add_label($1,
  1113. X                make_ccmd(C_WHILE,$5,$7) )));
  1114. X                }
  1115. X            }
  1116. X    |    label FOR '(' expr ')' compblock
  1117. X            { cmdline = $2;
  1118. X                if ($4->arg_type != O_ARRAY) {
  1119. X                scrstab = aadd(genstab());
  1120. X                $$ = append_line(
  1121. X                    make_acmd(C_EXPR, Nullstab,
  1122. X                      l(make_op(O_ASSIGN,2,
  1123. X                    listish(make_op(O_ARRAY, 1,
  1124. X                      stab2arg(A_STAB,scrstab),
  1125. X                      Nullarg,Nullarg )),
  1126. X                    listish(make_list($4)),
  1127. X                    Nullarg)),
  1128. X                      Nullarg),
  1129. X                    wopt(over(defstab,add_label($1,
  1130. X                      make_ccmd(C_WHILE,
  1131. X                    make_op(O_ARRAY, 1,
  1132. X                      stab2arg(A_STAB,scrstab),
  1133. X                      Nullarg,Nullarg ),
  1134. X                    $6)))));
  1135. X                $$->c_line = $2;
  1136. X                $$->c_head->c_line = $2;
  1137. X                }
  1138. X                else {    /* lisp, anyone? */
  1139. X                $$ = wopt(over(defstab,add_label($1,
  1140. X                make_ccmd(C_WHILE,$4,$6) )));
  1141. X                }
  1142. X            }
  1143. X    |    label FOR '(' nexpr ';' texpr ';' nexpr ')' block
  1144. X            /* basically fake up an initialize-while lineseq */
  1145. X            {   yyval.compval.comp_true = $10;
  1146. X                yyval.compval.comp_alt = $8;
  1147. X                cmdline = $2;
  1148. X                $$ = append_line($4,wopt(add_label($1,
  1149. X                make_ccmd(C_WHILE,$6,yyval.compval) ))); }
  1150. X    |    label compblock    /* a block is a loop that happens once */
  1151. X            { $$ = add_label($1,make_ccmd(C_BLOCK,Nullarg,$2)); }
  1152. X    ;
  1153. X
  1154. Xnexpr    :    /* NULL */
  1155. X            { $$ = Nullcmd; }
  1156. X    |    sideff
  1157. X    ;
  1158. X
  1159. Xtexpr    :    /* NULL means true */
  1160. X            { (void)scanstr("1"); $$ = yylval.arg; }
  1161. X    |    expr
  1162. X    ;
  1163. X
  1164. Xlabel    :    /* empty */
  1165. X            { $$ = Nullch; }
  1166. X    |    WORD ':'
  1167. X    ;
  1168. X
  1169. Xdecl    :    format
  1170. X            { $$ = 0; }
  1171. X    |    subrout
  1172. X            { $$ = 0; }
  1173. X    |    package
  1174. X            { $$ = 0; }
  1175. X    ;
  1176. X
  1177. Xformat    :    FORMAT WORD '=' FORMLIST
  1178. X            { if (strEQ($2,"stdout"))
  1179. X                make_form(stabent("STDOUT",TRUE),$4);
  1180. X              else if (strEQ($2,"stderr"))
  1181. X                make_form(stabent("STDERR",TRUE),$4);
  1182. X              else
  1183. X                make_form(stabent($2,TRUE),$4);
  1184. X              Safefree($2); $2 = Nullch; }
  1185. X    |    FORMAT '=' FORMLIST
  1186. X            { make_form(stabent("STDOUT",TRUE),$3); }
  1187. X    ;
  1188. X
  1189. Xsubrout    :    SUB WORD block
  1190. X            { make_sub($2,$3); }
  1191. X    ;
  1192. X
  1193. Xpackage :    PACKAGE WORD ';'
  1194. X            { char tmpbuf[256];
  1195. X              STAB *tmpstab;
  1196. X
  1197. X              savehptr(&curstash);
  1198. X              saveitem(curstname);
  1199. X              str_set(curstname,$2);
  1200. X              sprintf(tmpbuf,"'_%s",$2);
  1201. X              tmpstab = stabent(tmpbuf,TRUE);
  1202. X              if (!stab_xhash(tmpstab))
  1203. X                  stab_xhash(tmpstab) = hnew(0);
  1204. X              curstash = stab_xhash(tmpstab);
  1205. X              if (!curstash->tbl_name)
  1206. X                  curstash->tbl_name = savestr($2);
  1207. X              curstash->tbl_coeffsize = 0;
  1208. X              Safefree($2); $2 = Nullch;
  1209. X              cmdline = NOLINE;
  1210. X            }
  1211. X    ;
  1212. X
  1213. Xcexpr    :    ',' expr
  1214. X            { $$ = $2; }
  1215. X    ;
  1216. X
  1217. Xexpr    :    expr ',' sexpr
  1218. X            { $$ = make_op(O_COMMA, 2, $1, $3, Nullarg); }
  1219. X    |    sexpr
  1220. X    ;
  1221. X
  1222. Xcsexpr    :    ',' sexpr
  1223. X            { $$ = $2; }
  1224. X    ;
  1225. X
  1226. Xsexpr    :    sexpr '=' sexpr
  1227. X            {   $1 = listish($1);
  1228. X                if ($1->arg_type == O_ASSIGN && $1->arg_len == 1)
  1229. X                $1->arg_type = O_ITEM;    /* a local() */
  1230. X                if ($1->arg_type == O_LIST)
  1231. X                $3 = listish($3);
  1232. X                $$ = l(make_op(O_ASSIGN, 2, $1, $3, Nullarg)); }
  1233. X    |    sexpr POW '=' sexpr
  1234. X            { $$ = l(make_op(O_POW, 2, $1, $4, Nullarg)); }
  1235. X    |    sexpr MULOP '=' sexpr
  1236. X            { $$ = l(make_op($2, 2, $1, $4, Nullarg)); }
  1237. X    |    sexpr ADDOP '=' sexpr
  1238. X            { $$ = rcatmaybe(l(make_op($2, 2, $1, $4, Nullarg)));}
  1239. X    |    sexpr LS '=' sexpr
  1240. X            { $$ = l(make_op(O_LEFT_SHIFT, 2, $1, $4, Nullarg)); }
  1241. X    |    sexpr RS '=' sexpr
  1242. X            { $$ = l(make_op(O_RIGHT_SHIFT, 2, $1, $4, Nullarg)); }
  1243. X    |    sexpr '&' '=' sexpr
  1244. X            { $$ = l(make_op(O_BIT_AND, 2, $1, $4, Nullarg)); }
  1245. X    |    sexpr '^' '=' sexpr
  1246. X            { $$ = l(make_op(O_XOR, 2, $1, $4, Nullarg)); }
  1247. X    |    sexpr '|' '=' sexpr
  1248. X            { $$ = l(make_op(O_BIT_OR, 2, $1, $4, Nullarg)); }
  1249. X
  1250. X
  1251. X    |    sexpr POW sexpr
  1252. X            { $$ = make_op(O_POW, 2, $1, $3, Nullarg); }
  1253. X    |    sexpr MULOP sexpr
  1254. X            { if ($2 == O_REPEAT)
  1255. X                  $1 = listish($1);
  1256. X                $$ = make_op($2, 2, $1, $3, Nullarg);
  1257. X                if ($2 == O_REPEAT) {
  1258. X                if ($$[1].arg_type != A_EXPR ||
  1259. X                  $$[1].arg_ptr.arg_arg->arg_type != O_LIST)
  1260. X                    $$[1].arg_flags &= ~AF_ARYOK;
  1261. X                } }
  1262. X    |    sexpr ADDOP sexpr
  1263. X            { $$ = make_op($2, 2, $1, $3, Nullarg); }
  1264. X    |    sexpr LS sexpr
  1265. X            { $$ = make_op(O_LEFT_SHIFT, 2, $1, $3, Nullarg); }
  1266. X    |    sexpr RS sexpr
  1267. X            { $$ = make_op(O_RIGHT_SHIFT, 2, $1, $3, Nullarg); }
  1268. X    |    sexpr RELOP sexpr
  1269. X            { $$ = make_op($2, 2, $1, $3, Nullarg); }
  1270. X    |    sexpr EQOP sexpr
  1271. X            { $$ = make_op($2, 2, $1, $3, Nullarg); }
  1272. X    |    sexpr '&' sexpr
  1273. X            { $$ = make_op(O_BIT_AND, 2, $1, $3, Nullarg); }
  1274. X    |    sexpr '^' sexpr
  1275. X            { $$ = make_op(O_XOR, 2, $1, $3, Nullarg); }
  1276. X    |    sexpr '|' sexpr
  1277. X            { $$ = make_op(O_BIT_OR, 2, $1, $3, Nullarg); }
  1278. X    |    sexpr DOTDOT sexpr
  1279. X            { arg4 = Nullarg;
  1280. X              $$ = make_op(O_F_OR_R, 4, $1, $3, Nullarg); }
  1281. X    |    sexpr ANDAND sexpr
  1282. X            { $$ = make_op(O_AND, 2, $1, $3, Nullarg); }
  1283. X    |    sexpr OROR sexpr
  1284. X            { $$ = make_op(O_OR, 2, $1, $3, Nullarg); }
  1285. X    |    sexpr '?' sexpr ':' sexpr
  1286. X            { $$ = make_op(O_COND_EXPR, 3, $1, $3, $5); }
  1287. X    |    sexpr MATCH sexpr
  1288. X            { $$ = mod_match(O_MATCH, $1, $3); }
  1289. X    |    sexpr NMATCH sexpr
  1290. X            { $$ = mod_match(O_NMATCH, $1, $3); }
  1291. X    |    term
  1292. X            { $$ = $1; }
  1293. X    ;
  1294. X
  1295. Xterm    :    '-' term %prec UMINUS
  1296. X            { $$ = make_op(O_NEGATE, 1, $2, Nullarg, Nullarg); }
  1297. X    |    '+' term %prec UMINUS
  1298. X            { $$ = $2; }
  1299. X    |    '!' term
  1300. X            { $$ = make_op(O_NOT, 1, $2, Nullarg, Nullarg); }
  1301. X    |    '~' term
  1302. X            { $$ = make_op(O_COMPLEMENT, 1, $2, Nullarg, Nullarg);}
  1303. X    |    term INC
  1304. X            { $$ = addflags(1, AF_POST|AF_UP,
  1305. X                l(make_op(O_ITEM,1,$1,Nullarg,Nullarg))); }
  1306. X    |    term DEC
  1307. X            { $$ = addflags(1, AF_POST,
  1308. X                l(make_op(O_ITEM,1,$1,Nullarg,Nullarg))); }
  1309. X    |    INC term
  1310. X            { $$ = addflags(1, AF_PRE|AF_UP,
  1311. X                l(make_op(O_ITEM,1,$2,Nullarg,Nullarg))); }
  1312. X    |    DEC term
  1313. X            { $$ = addflags(1, AF_PRE,
  1314. X                l(make_op(O_ITEM,1,$2,Nullarg,Nullarg))); }
  1315. X    |    FILETEST WORD
  1316. X            { opargs[$1] = 0;    /* force it special */
  1317. X                $$ = make_op($1, 1,
  1318. X                stab2arg(A_STAB,stabent($2,TRUE)),
  1319. X                Nullarg, Nullarg);
  1320. X            }
  1321. X    |    FILETEST sexpr
  1322. X            { opargs[$1] = 1;
  1323. X                $$ = make_op($1, 1, $2, Nullarg, Nullarg); }
  1324. X    |    FILETEST
  1325. X            { opargs[$1] = ($1 != O_FTTTY);
  1326. X                $$ = make_op($1, 1,
  1327. X                stab2arg(A_STAB,
  1328. X                  $1 == O_FTTTY?stabent("STDIN",TRUE):defstab),
  1329. X                Nullarg, Nullarg); }
  1330. X    |    LOCAL '(' expr ')'
  1331. X            { $$ = l(localize(make_op(O_ASSIGN, 1,
  1332. X                localize(listish(make_list($3))),
  1333. X                Nullarg,Nullarg))); }
  1334. X    |    '(' expr ',' ')'
  1335. X            { $$ = make_list($2); }
  1336. X    |    '(' expr ')'
  1337. X            { $$ = make_list($2); }
  1338. X    |    '(' ')'
  1339. X            { $$ = make_list(Nullarg); }
  1340. X    |    DO sexpr    %prec FILETEST
  1341. X            { $$ = make_op(O_DOFILE,2,$2,Nullarg,Nullarg);
  1342. X              allstabs = TRUE;}
  1343. X    |    DO block    %prec '('
  1344. X            { $$ = cmd_to_arg($2); }
  1345. X    |    REG    %prec '('
  1346. X            { $$ = stab2arg(A_STAB,$1); }
  1347. X    |    STAR    %prec '('
  1348. X            { $$ = stab2arg(A_STAR,$1); }
  1349. X    |    REG '[' expr ']'    %prec '('
  1350. X            { $$ = make_op(O_AELEM, 2,
  1351. X                stab2arg(A_STAB,aadd($1)), $3, Nullarg); }
  1352. X    |    HSH     %prec '('
  1353. X            { $$ = make_op(O_HASH, 1,
  1354. X                stab2arg(A_STAB,$1),
  1355. X                Nullarg, Nullarg); }
  1356. X    |    ARY     %prec '('
  1357. X            { $$ = make_op(O_ARRAY, 1,
  1358. X                stab2arg(A_STAB,$1),
  1359. X                Nullarg, Nullarg); }
  1360. X    |    REG '{' expr '}'    %prec '('
  1361. X            { $$ = make_op(O_HELEM, 2,
  1362. X                stab2arg(A_STAB,hadd($1)),
  1363. X                jmaybe($3),
  1364. X                Nullarg); }
  1365. X    |    '(' expr ')' '[' expr ']'    %prec '('
  1366. X            { $$ = make_op(O_LSLICE, 3,
  1367. X                Nullarg,
  1368. X                listish(make_list($5)),
  1369. X                listish(make_list($2))); }
  1370. X    |    '(' ')' '[' expr ']'    %prec '('
  1371. X            { $$ = make_op(O_LSLICE, 3,
  1372. X                Nullarg,
  1373. X                listish(make_list($4)),
  1374. X                Nullarg); }
  1375. X    |    ARY '[' expr ']'    %prec '('
  1376. X            { $$ = make_op(O_ASLICE, 2,
  1377. X                stab2arg(A_STAB,aadd($1)),
  1378. X                listish(make_list($3)),
  1379. X                Nullarg); }
  1380. X    |    ARY '{' expr '}'    %prec '('
  1381. X            { $$ = make_op(O_HSLICE, 2,
  1382. X                stab2arg(A_STAB,hadd($1)),
  1383. X                listish(make_list($3)),
  1384. X                Nullarg); }
  1385. X    |    DELETE REG '{' expr '}'    %prec '('
  1386. X            { $$ = make_op(O_DELETE, 2,
  1387. X                stab2arg(A_STAB,hadd($2)),
  1388. X                jmaybe($4),
  1389. X                Nullarg); }
  1390. X    |    ARYLEN    %prec '('
  1391. X            { $$ = stab2arg(A_ARYLEN,$1); }
  1392. X    |    RSTRING    %prec '('
  1393. X            { $$ = $1; }
  1394. X    |    PATTERN    %prec '('
  1395. X            { $$ = $1; }
  1396. X    |    SUBST    %prec '('
  1397. X            { $$ = $1; }
  1398. X    |    TRANS    %prec '('
  1399. X            { $$ = $1; }
  1400. X    |    DO WORD '(' expr ')'
  1401. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1402. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1403. X                make_list($4),
  1404. X                Nullarg); Safefree($2); $2 = Nullch;
  1405. X                $$->arg_flags |= AF_DEPR; }
  1406. X    |    AMPER WORD '(' expr ')'
  1407. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1408. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1409. X                make_list($4),
  1410. X                Nullarg); Safefree($2); $2 = Nullch; }
  1411. X    |    DO WORD '(' ')'
  1412. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1413. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1414. X                make_list(Nullarg),
  1415. X                Nullarg);
  1416. X                $$->arg_flags |= AF_DEPR; }
  1417. X    |    AMPER WORD '(' ')'
  1418. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1419. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1420. X                make_list(Nullarg),
  1421. X                Nullarg); }
  1422. X    |    AMPER WORD
  1423. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1424. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1425. X                Nullarg,
  1426. X                Nullarg); }
  1427. X    |    DO REG '(' expr ')'
  1428. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1429. X                stab2arg(A_STAB,$2),
  1430. X                make_list($4),
  1431. X                Nullarg);
  1432. X                $$->arg_flags |= AF_DEPR; }
  1433. X    |    AMPER REG '(' expr ')'
  1434. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1435. X                stab2arg(A_STAB,$2),
  1436. X                make_list($4),
  1437. X                Nullarg); }
  1438. X    |    DO REG '(' ')'
  1439. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1440. X                stab2arg(A_STAB,$2),
  1441. X                make_list(Nullarg),
  1442. X                Nullarg);
  1443. X                $$->arg_flags |= AF_DEPR; }
  1444. X    |    AMPER REG '(' ')'
  1445. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1446. X                stab2arg(A_STAB,$2),
  1447. X                make_list(Nullarg),
  1448. X                Nullarg); }
  1449. X    |    AMPER REG
  1450. X            { $$ = make_op((perldb ? O_DBSUBR : O_SUBR), 2,
  1451. X                stab2arg(A_STAB,$2),
  1452. X                Nullarg,
  1453. X                Nullarg); }
  1454. X    |    LOOPEX
  1455. X            { $$ = make_op($1,0,Nullarg,Nullarg,Nullarg); }
  1456. X    |    LOOPEX WORD
  1457. X            { $$ = make_op($1,1,cval_to_arg($2),
  1458. X                Nullarg,Nullarg); }
  1459. X    |    UNIOP
  1460. X            { $$ = make_op($1,0,Nullarg,Nullarg,Nullarg); }
  1461. X    |    UNIOP sexpr
  1462. X            { $$ = make_op($1,1,$2,Nullarg,Nullarg); }
  1463. X    |    SSELECT
  1464. X            { $$ = make_op(O_SELECT, 0, Nullarg, Nullarg, Nullarg);}
  1465. X    |    SSELECT '(' handle ')'
  1466. X            { $$ = make_op(O_SELECT, 1, $3, Nullarg, Nullarg); }
  1467. X    |    SSELECT '(' sexpr csexpr csexpr csexpr ')'
  1468. X            { arg4 = $6;
  1469. X              $$ = make_op(O_SSELECT, 4, $3, $4, $5); }
  1470. X    |    OPEN WORD    %prec '('
  1471. X            { $$ = make_op(O_OPEN, 2,
  1472. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1473. X                stab2arg(A_STAB,stabent($2,TRUE)),
  1474. X                Nullarg); }
  1475. X    |    OPEN '(' WORD ')'
  1476. X            { $$ = make_op(O_OPEN, 2,
  1477. X                stab2arg(A_WORD,stabent($3,TRUE)),
  1478. X                stab2arg(A_STAB,stabent($3,TRUE)),
  1479. X                Nullarg); }
  1480. X    |    OPEN '(' handle cexpr ')'
  1481. X            { $$ = make_op(O_OPEN, 2,
  1482. X                $3,
  1483. X                $4, Nullarg); }
  1484. X    |    FILOP '(' handle ')'
  1485. X            { $$ = make_op($1, 1,
  1486. X                $3,
  1487. X                Nullarg, Nullarg); }
  1488. X    |    FILOP WORD
  1489. X            { $$ = make_op($1, 1,
  1490. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1491. X                Nullarg, Nullarg);
  1492. X              Safefree($2); $2 = Nullch; }
  1493. X    |    FILOP REG
  1494. X            { $$ = make_op($1, 1,
  1495. X                stab2arg(A_STAB,$2),
  1496. X                Nullarg, Nullarg); }
  1497. X    |    FILOP '(' ')'
  1498. X            { $$ = make_op($1, 1,
  1499. X                stab2arg(A_WORD,Nullstab),
  1500. X                Nullarg, Nullarg); }
  1501. X    |    FILOP    %prec '('
  1502. X            { $$ = make_op($1, 0,
  1503. X                Nullarg, Nullarg, Nullarg); }
  1504. X    |    FILOP2 '(' handle cexpr ')'
  1505. X            { $$ = make_op($1, 2, $3, $4, Nullarg); }
  1506. X    |    FILOP3 '(' handle csexpr cexpr ')'
  1507. X            { $$ = make_op($1, 3, $3, $4, make_list($5)); }
  1508. X    |    FILOP22 '(' handle ',' handle ')'
  1509. X            { $$ = make_op($1, 2, $3, $5, Nullarg); }
  1510. X    |    FILOP4 '(' handle csexpr csexpr cexpr ')'
  1511. X            { arg4 = $6; $$ = make_op($1, 4, $3, $4, $5); }
  1512. X    |    FILOP25 '(' handle ',' handle csexpr csexpr cexpr ')'
  1513. X            { arg4 = $7; arg5 = $8;
  1514. X              $$ = make_op($1, 5, $3, $5, $6); }
  1515. X    |    PUSH '(' aryword cexpr ')'
  1516. X            { $$ = make_op($1, 2,
  1517. X                $3,
  1518. X                make_list($4),
  1519. X                Nullarg); }
  1520. X    |    POP aryword    %prec '('
  1521. X            { $$ = make_op(O_POP, 1, $2, Nullarg, Nullarg); }
  1522. X    |    POP '(' aryword ')'
  1523. X            { $$ = make_op(O_POP, 1, $3, Nullarg, Nullarg); }
  1524. X    |    SHIFT aryword    %prec '('
  1525. X            { $$ = make_op(O_SHIFT, 1, $2, Nullarg, Nullarg); }
  1526. X    |    SHIFT '(' aryword ')'
  1527. X            { $$ = make_op(O_SHIFT, 1, $3, Nullarg, Nullarg); }
  1528. X    |    SHIFT    %prec '('
  1529. X            { $$ = make_op(O_SHIFT, 1,
  1530. X                stab2arg(A_STAB,
  1531. X                  aadd(stabent(subline ? "_" : "ARGV", TRUE))),
  1532. X                Nullarg, Nullarg); }
  1533. X    |    SPLIT    %prec '('
  1534. X            {   static char p[]="/\\s+/";
  1535. X                char *oldend = bufend;
  1536. X                ARG *oldarg = yylval.arg;
  1537. X                
  1538. X                bufend=p+5;
  1539. X                (void)scanpat(p);
  1540. X                bufend=oldend;
  1541. X                $$ = make_split(defstab,yylval.arg,Nullarg);
  1542. X                yylval.arg = oldarg; }
  1543. X    |    SPLIT '(' sexpr csexpr csexpr ')'
  1544. X            { $$ = mod_match(O_MATCH, $4,
  1545. X              make_split(defstab,$3,$5));}
  1546. X    |    SPLIT '(' sexpr csexpr ')'
  1547. X            { $$ = mod_match(O_MATCH, $4,
  1548. X              make_split(defstab,$3,Nullarg) ); }
  1549. X    |    SPLIT '(' sexpr ')'
  1550. X            { $$ = mod_match(O_MATCH,
  1551. X                stab2arg(A_STAB,defstab),
  1552. X                make_split(defstab,$3,Nullarg) ); }
  1553. X    |    FLIST2 '(' sexpr cexpr ')'
  1554. X            { $$ = make_op($1, 2,
  1555. X                $3,
  1556. X                listish(make_list($4)),
  1557. X                Nullarg); }
  1558. X    |    FLIST '(' expr ')'
  1559. X            { $$ = make_op($1, 1,
  1560. X                make_list($3),
  1561. X                Nullarg,
  1562. X                Nullarg); }
  1563. X    |    LVALFUN sexpr    %prec '('
  1564. X            { $$ = l(make_op($1, 1, fixl($1,$2),
  1565. X                Nullarg, Nullarg)); }
  1566. X    |    LVALFUN
  1567. X            { $$ = l(make_op($1, 1,
  1568. X                stab2arg(A_STAB,defstab),
  1569. X                Nullarg, Nullarg)); }
  1570. X    |    FUNC0
  1571. X            { $$ = make_op($1, 0, Nullarg, Nullarg, Nullarg); }
  1572. X    |    FUNC0 '(' ')'
  1573. X            { $$ = make_op($1, 0, Nullarg, Nullarg, Nullarg); }
  1574. X    |    FUNC1 '(' ')'
  1575. X            { $$ = make_op($1, 0, Nullarg, Nullarg, Nullarg); }
  1576. X    |    FUNC1 '(' expr ')'
  1577. X            { $$ = make_op($1, 1, $3, Nullarg, Nullarg); }
  1578. X    |    FUNC2 '(' sexpr cexpr ')'
  1579. X            { $$ = make_op($1, 2, $3, $4, Nullarg);
  1580. X                if ($1 == O_INDEX && $$[2].arg_type == A_SINGLE)
  1581. X                fbmcompile($$[2].arg_ptr.arg_str,0); }
  1582. X    |    FUNC2x '(' sexpr csexpr ')'
  1583. X            { $$ = make_op($1, 2, $3, $4, Nullarg);
  1584. X                if ($1 == O_INDEX && $$[2].arg_type == A_SINGLE)
  1585. X                fbmcompile($$[2].arg_ptr.arg_str,0); }
  1586. X    |    FUNC2x '(' sexpr csexpr cexpr ')'
  1587. X            { $$ = make_op($1, 3, $3, $4, $5);
  1588. X                if ($1 == O_INDEX && $$[2].arg_type == A_SINGLE)
  1589. X                fbmcompile($$[2].arg_ptr.arg_str,0); }
  1590. X    |    FUNC3 '(' sexpr csexpr cexpr ')'
  1591. X            { $$ = make_op($1, 3, $3, $4, $5); }
  1592. X    |    FUNC4 '(' sexpr csexpr csexpr cexpr ')'
  1593. X            { arg4 = $6;
  1594. X              $$ = make_op($1, 4, $3, $4, $5); }
  1595. X    |    FUNC5 '(' sexpr csexpr csexpr csexpr cexpr ')'
  1596. X            { arg4 = $6; arg5 = $7;
  1597. X              $$ = make_op($1, 5, $3, $4, $5); }
  1598. X    |    HSHFUN '(' hshword ')'
  1599. X            { $$ = make_op($1, 1,
  1600. X                $3,
  1601. X                Nullarg,
  1602. X                Nullarg); }
  1603. X    |    HSHFUN hshword
  1604. X            { $$ = make_op($1, 1,
  1605. X                $2,
  1606. X                Nullarg,
  1607. X                Nullarg); }
  1608. X    |    HSHFUN3 '(' hshword csexpr cexpr ')'
  1609. X            { $$ = make_op($1, 3, $3, $4, $5); }
  1610. X    |    bareword
  1611. X    |    listop
  1612. X    ;
  1613. X
  1614. Xlistop    :    LISTOP
  1615. X            { $$ = make_op($1,2,
  1616. X                stab2arg(A_WORD,Nullstab),
  1617. X                stab2arg(A_STAB,defstab),
  1618. X                Nullarg); }
  1619. X    |    LISTOP expr
  1620. X            { $$ = make_op($1,2,
  1621. X                stab2arg(A_WORD,Nullstab),
  1622. X                maybelistish($1,make_list($2)),
  1623. X                Nullarg); }
  1624. X    |    LISTOP WORD
  1625. X            { $$ = make_op($1,2,
  1626. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1627. X                stab2arg(A_STAB,defstab),
  1628. X                Nullarg); }
  1629. X    |    LISTOP WORD expr
  1630. X            { $$ = make_op($1,2,
  1631. X                stab2arg(A_WORD,stabent($2,TRUE)),
  1632. X                maybelistish($1,make_list($3)),
  1633. X                Nullarg); Safefree($2); $2 = Nullch; }
  1634. X    |    LISTOP REG expr
  1635. X            { $$ = make_op($1,2,
  1636. X                stab2arg(A_STAB,$2),
  1637. X                maybelistish($1,make_list($3)),
  1638. X                Nullarg); }
  1639. X    ;
  1640. X
  1641. Xhandle    :    WORD
  1642. X            { $$ = stab2arg(A_WORD,stabent($1,TRUE));
  1643. X              Safefree($1); $1 = Nullch;}
  1644. X    |    sexpr
  1645. X    ;
  1646. X
  1647. Xaryword    :    WORD
  1648. X            { $$ = stab2arg(A_WORD,aadd(stabent($1,TRUE)));
  1649. X                Safefree($1); $1 = Nullch; }
  1650. X    |    ARY
  1651. X            { $$ = stab2arg(A_STAB,$1); }
  1652. X    ;
  1653. X
  1654. Xhshword    :    WORD
  1655. X            { $$ = stab2arg(A_WORD,hadd(stabent($1,TRUE)));
  1656. X                Safefree($1); $1 = Nullch; }
  1657. X    |    HSH
  1658. X            { $$ = stab2arg(A_STAB,$1); }
  1659. X    ;
  1660. X
  1661. X/*
  1662. X * NOTE:  The following entry must stay at the end of the file so that
  1663. X * reduce/reduce conflicts resolve to it only if it's the only option.
  1664. X */
  1665. X
  1666. Xbareword:    WORD
  1667. X            { char *s;
  1668. X                $$ = op_new(1);
  1669. X                $$->arg_type = O_ITEM;
  1670. X                $$[1].arg_type = A_SINGLE;
  1671. X                $$[1].arg_ptr.arg_str = str_make($1,0);
  1672. X                for (s = $1; *s && islower(*s); s++) ;
  1673. X                if (dowarn && !*s)
  1674. X                warn(
  1675. X                  "\"%s\" may clash with future reserved word",
  1676. X                  $1 );
  1677. X            }
  1678. X
  1679. X%% /* PROGRAM */
  1680. !STUFFY!FUNK!
  1681. echo Extracting eg/findtar
  1682. sed >eg/findtar <<'!STUFFY!FUNK!' -e 's/X//'
  1683. X#!/usr/bin/perl
  1684. X
  1685. X# $Header: findtar,v 4.0 91/03/20 01:09:48 lwall Locked $
  1686. X
  1687. X# findtar takes find-style arguments and spits out a tarfile on stdout.
  1688. X# It won't work unless your find supports -ls and your tar the I flag.
  1689. X
  1690. X$args = join(' ',@ARGV);
  1691. Xopen(find,"/usr/bin/find $args -ls |") || die "Can't run find for you.";
  1692. X
  1693. Xopen(tar,"| /bin/tar cIf - -") || die "Can't run tar for you: $!";
  1694. X
  1695. Xwhile (<find>) {
  1696. X    @x = split(' ');
  1697. X    if ($x[2] =~ /^d/) { print tar '-d ';}
  1698. X    print tar $x[10],"\n";
  1699. X}
  1700. !STUFFY!FUNK!
  1701. echo " "
  1702. echo "End of kit 22 (of 36)"
  1703. cat /dev/null >kit22isdone
  1704. run=''
  1705. config=''
  1706. for iskit in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36; do
  1707.     if test -f kit${iskit}isdone; then
  1708.     run="$run $iskit"
  1709.     else
  1710.     todo="$todo $iskit"
  1711.     fi
  1712. done
  1713. case $todo in
  1714.     '')
  1715.     echo "You have run all your kits.  Please read README and then type Configure."
  1716.     for combo in *:AA; do
  1717.         if test -f "$combo"; then
  1718.         realfile=`basename $combo :AA`
  1719.         cat $realfile:[A-Z][A-Z] >$realfile
  1720.         rm -rf $realfile:[A-Z][A-Z]
  1721.         fi
  1722.     done
  1723.     rm -rf kit*isdone
  1724.     chmod 755 Configure
  1725.     ;;
  1726.     *)  echo "You have run$run."
  1727.     echo "You still need to run$todo."
  1728.     ;;
  1729. esac
  1730. : Someone might mail this, so...
  1731. exit
  1732.  
  1733. exit 0 # Just in case...
  1734. -- 
  1735. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1736. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1737. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1738. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1739.