1 /* $Header: arg.h,v 3.0.1.3 90/02/28 16:21:55 lwall Locked $
3 * Copyright (c) 1989, Larry Wall
5 * You may distribute under the terms of the GNU General Public License
6 * as specified in the README file that comes with the perl 3.0 kit.
9 * Revision 3.0.1.3 90/02/28 16:21:55 lwall
10 * patch9: added pipe function
12 * Revision 3.0.1.2 89/12/21 19:13:14 lwall
13 * patch7: send() didn't allow a TO argument
15 * Revision 3.0.1.1 89/10/26 23:02:35 lwall
16 * patch1: reverse didn't work
18 * Revision 3.0 89/10/18 15:08:27 lwall
38 #define O_LEFT_SHIFT 15
39 #define O_RIGHT_SHIFT 16
51 #define O_COND_EXPR 28
55 #define O_COMPLEMENT 32
97 #define O_LOCALTIME 74
125 #define O_UNSHIFT 102
129 #define O_FTEREAD 106
130 #define O_FTEWRITE 107
131 #define O_FTEEXEC 108
132 #define O_FTEOWNED 109
133 #define O_FTRREAD 110
134 #define O_FTRWRITE 111
135 #define O_FTREXEC 112
136 #define O_FTROWNED 113
143 #define O_SYMLINK 120
154 #define O_FTBINARY 131
170 #define O_GETPPID 147
171 #define O_GETPGRP 148
172 #define O_SETPGRP 149
173 #define O_GETPRIORITY 150
174 #define O_SETPRIORITY 151
184 #define O_DBMOPEN 161
185 #define O_DBMCLOSE 162
188 #define O_LASLICE 165
189 #define O_LHSLICE 166
193 #define O_AASSIGN 170
194 #define O_SASSIGN 171
196 #define O_REVERSE 173
200 #define O_CONNECT 177
205 #define O_SSELECT 182
206 #define O_SOCKETPAIR 183
208 #define O_DEFINED 185
210 #define O_READLINK 187
219 #define O_GHBYNAME 196
220 #define O_GHBYADDR 197
221 #define O_GHOSTENT 198
222 #define O_SHOSTENT 199
223 #define O_EHOSTENT 200
224 #define O_GSBYNAME 201
225 #define O_GSBYPORT 202
226 #define O_GSERVENT 203
227 #define O_SSERVENT 204
228 #define O_ESERVENT 205
229 #define O_GPBYNAME 206
230 #define O_GPBYNUMBER 207
231 #define O_GPROTOENT 208
232 #define O_SPROTOENT 209
233 #define O_EPROTOENT 210
234 #define O_GNBYNAME 211
235 #define O_GNBYADDR 212
236 #define O_GNETENT 213
237 #define O_SNETENT 214
238 #define O_ENETENT 215
251 #define O_SHUTDOWN 228
252 #define O_OPENDIR 229
253 #define O_READDIR 230
254 #define O_TELLDIR 231
255 #define O_SEEKDIR 232
256 #define O_REWINDDIR 233
257 #define O_CLOSEDIR 234
258 #define O_GETLOGIN 235
259 #define O_SYSCALL 236
260 #define O_GSOCKOPT 237
261 #define O_SSOCKOPT 238
262 #define O_GETSOCKNAME 239
263 #define O_GETPEERNAME 240
267 extern char *opname[];
532 #define A_LARYSTAB 17
535 #define A_WANTARRAY 20
538 #define A_DONT 32 /* or this into type to suppress evaluation */
541 extern char *argname[];
570 extern bool hoistable[];
609 union argptr arg_ptr;
614 unsigned char arg_type;
615 unsigned char arg_flags;
618 #define AF_ARYOK 1 /* op can handle multiple values here */
619 #define AF_POST 2 /* post *crement this item */
620 #define AF_PRE 4 /* pre *crement this item */
621 #define AF_UP 8 /* increment rather than decrement */
622 #define AF_COMMON 16 /* left and right have symbols in common */
623 #define AF_UNUSED 32 /* */
624 #define AF_LISTISH 64 /* turn into list if important */
625 #define AF_LOCAL 128 /* list of local variables */
628 * Most of the ARG pointers are used as pointers to arrays of ARG. When
629 * so used, the 0th element is special, and represents the operator to
630 * use on the list of arguments following. The arg_len in the 0th element
631 * gives the maximum argument number, and the arg_str is used to store
632 * the return value in a more-or-less static location. Sorry it's not
633 * re-entrant (yet), but it sure makes it efficient. The arg_type of the
634 * 0th element is an operator (O_*) rather than an argument type (A_*).
637 #define Nullarg Null(ARG*)
640 EXT char opargs[MAXO+1];
642 #define A(e1,e2,e3) (e1+(e2<<2)+(e3<<4))
643 char opargs[MAXO+1] = {
646 A(0,0,0), /* ITEM2 */
647 A(0,0,0), /* ITEM3 */
648 A(1,1,0), /* CONCAT */
649 A(1,0,0), /* MATCH */
650 A(1,0,0), /* NMATCH */
651 A(1,0,0), /* SUBST */
652 A(1,0,0), /* NSUBST */
653 A(1,1,0), /* ASSIGN */
654 A(1,1,0), /* MULTIPLY */
655 A(1,1,0), /* DIVIDE */
656 A(1,1,0), /* MODULO */
658 A(1,1,0), /* SUBTRACT */
659 A(1,1,0), /* LEFT_SHIFT */
660 A(1,1,0), /* RIGHT_SHIFT */
667 A(1,1,0), /* BIT_AND */
669 A(1,1,0), /* BIT_OR */
672 A(1,0,0), /* COND_EXPR */
673 A(1,1,0), /* COMMA */
674 A(1,0,0), /* NEGATE */
676 A(1,0,0), /* COMPLEMENT */
677 A(1,0,0), /* WRITE */
679 A(1,0,0), /* TRANS */
680 A(1,0,0), /* NTRANS */
681 A(1,0,0), /* CLOSE */
682 A(0,0,0), /* ARRAY */
684 A(0,0,0), /* LARRAY */
685 A(0,0,0), /* LHASH */
688 A(0,0,0), /* SHIFT */
689 A(1,0,1), /* SPLIT */
690 A(1,0,0), /* LENGTH */
691 A(3,0,0), /* SPRINTF */
692 A(1,1,1), /* SUBSTR */
701 A(1,3,0), /* PRINT */
702 A(1,0,0), /* CHDIR */
705 A(1,0,0), /* RESET */
707 A(1,0,0), /* SELECT */
715 A(1,1,0), /* INDEX */
717 A(0,0,0), /* TIMES */
718 A(1,0,0), /* LOCALTIME */
719 A(1,0,0), /* GMTIME */
721 A(1,1,0), /* CRYPT */
726 A(1,3,0), /* PRINTF */
728 A(1,0,0), /* SLEEP */
732 A(0,0,0), /* VALUES */
737 A(1,3,0), /* SYSTEM */
740 A(0,3,0), /* CHMOD */
741 A(0,3,0), /* CHOWN */
743 A(1,1,0), /* RENAME */
744 A(0,3,0), /* UNLINK */
745 A(1,0,0), /* UMASK */
746 A(0,3,0), /* UNSHIFT */
748 A(1,1,0), /* REPEAT */
750 A(1,0,0), /* FTEREAD */
751 A(1,0,0), /* FTEWRITE */
752 A(1,0,0), /* FTEEXEC */
753 A(1,0,0), /* FTEOWNED */
754 A(1,0,0), /* FTRREAD */
755 A(1,0,0), /* FTRWRITE */
756 A(1,0,0), /* FTREXEC */
757 A(1,0,0), /* FTROWNED */
759 A(1,0,0), /* FTZERO */
760 A(1,0,0), /* FTSIZE */
761 A(1,0,0), /* FTFILE */
762 A(1,0,0), /* FTDIR */
763 A(1,0,0), /* FTLINK */
764 A(1,1,0), /* SYMLINK */
765 A(1,0,0), /* FTPIPE */
766 A(1,0,0), /* FTSOCK */
767 A(1,0,0), /* FTBLK */
768 A(1,0,0), /* FTCHR */
769 A(1,0,0), /* FTSUID */
770 A(1,0,0), /* FTSGID */
771 A(1,0,0), /* FTSVTX */
772 A(1,0,0), /* FTTTY */
773 A(1,0,0), /* DOFILE */
774 A(1,0,0), /* FTTEXT */
775 A(1,0,0), /* FTBINARY */
776 A(0,3,0), /* UTIME */
779 A(0,1,0), /* DELETE */
780 A(1,0,0), /* STUDY */
781 A(1,1,0), /* ATAN2 */
785 A(1,0,0), /* SRAND */
787 A(0,3,0), /* RETURN */
789 A(1,1,0), /* MKDIR */
790 A(1,0,0), /* RMDIR */
791 A(0,0,0), /* GETPPID */
792 A(1,0,0), /* GETPGRP */
793 A(1,1,0), /* SETPGRP */
794 A(1,1,0), /* GETPRIORITY */
795 A(1,1,1), /* SETPRIORITY */
796 A(1,0,0), /* CHROOT */
797 A(1,1,1), /* IOCTL */
798 A(1,1,1), /* FCNTL */
799 A(1,1,0), /* FLOCK */
800 A(1,1,0), /* RINDEX */
802 A(1,1,0), /* UNPACK */
805 A(1,1,1), /* DBMOPEN */
806 A(1,0,0), /* DBMCLOSE */
807 A(0,3,0), /* ASLICE */
808 A(0,3,0), /* HSLICE */
809 A(0,3,0), /* LASLICE */
810 A(0,3,0), /* LHSLICE */
811 A(1,0,0), /* F_OR_R */
812 A(1,1,0), /* RANGE */
814 A(3,3,0), /* AASSIGN */
815 A(0,0,0), /* SASSIGN */
817 A(0,3,0), /* REVERSE */
818 A(1,0,0), /* ADDROF */
819 A(1,1,1), /* SOCKET */
821 A(1,1,0), /* CONNECT */
822 A(1,1,0), /* LISTEN */
823 A(1,1,0), /* ACCEPT */
826 A(1,1,1), /* SSELECT */
827 A(1,1,1), /* SOCKETPAIR */
828 A(0,3,0), /* DBSUBR */
829 A(1,0,0), /* DEFINED */
830 A(1,0,0), /* UNDEF */
831 A(1,0,0), /* READLINK */
832 A(1,0,0), /* LSTAT */
833 A(0,1,0), /* AELEM */
834 A(0,1,0), /* HELEM */
835 A(0,1,0), /* LAELEM */
836 A(0,1,0), /* LHELEM */
837 A(1,0,0), /* LOCAL */
839 A(1,0,0), /* FILENO */
840 A(1,0,0), /* GHBYNAME */
841 A(1,1,0), /* GHBYADDR */
842 A(0,0,0), /* GHOSTENT */
843 A(1,0,0), /* SHOSTENT */
844 A(0,0,0), /* EHOSTENT */
845 A(1,1,0), /* GSBYNAME */
846 A(1,1,0), /* GSBYPORT */
847 A(0,0,0), /* GSERVENT */
848 A(1,0,0), /* SSERVENT */
849 A(0,0,0), /* ESERVENT */
850 A(1,0,0), /* GPBYNAME */
851 A(1,0,0), /* GPBYNUMBER */
852 A(0,0,0), /* GPROTOENT */
853 A(1,0,0), /* SPROTOENT */
854 A(0,0,0), /* EPROTOENT */
855 A(1,0,0), /* GNBYNAME */
856 A(1,1,0), /* GNBYADDR */
857 A(0,0,0), /* GNETENT */
858 A(1,0,0), /* SNETENT */
859 A(0,0,0), /* ENETENT */
862 A(1,0,0), /* GPWNAM */
863 A(1,0,0), /* GPWUID */
864 A(0,0,0), /* GPWENT */
865 A(0,0,0), /* SPWENT */
866 A(0,0,0), /* EPWENT */
867 A(1,0,0), /* GGRNAM */
868 A(1,0,0), /* GGRGID */
869 A(0,0,0), /* GGRENT */
870 A(0,0,0), /* SGRENT */
871 A(0,0,0), /* EGRENT */
872 A(1,1,0), /* SHUTDOWN */
873 A(1,1,0), /* OPENDIR */
874 A(1,0,0), /* READDIR */
875 A(1,0,0), /* TELLDIR */
876 A(1,1,0), /* SEEKDIR */
877 A(1,0,0), /* REWINDDIR */
878 A(1,0,0), /* CLOSEDIR */
879 A(0,0,0), /* GETLOGIN */
880 A(1,3,0), /* SYSCALL */
881 A(1,1,1), /* GSOCKOPT */
882 A(1,1,1), /* SSOCKOPT */
883 A(1,0,0), /* GETSOCKNAME */
884 A(1,0,0), /* GETPEERNAME */