--AD October 16, 1995
*/
-static IV
-constant(char *name)
-{
- errno = 0;
- switch (*(name++)) {
- case '_':
- if (strEQ(name, "S_IFMT")) /* Yes, on name _S_IFMT return S_IFMT. */
-#ifdef S_IFMT
- return S_IFMT;
-#else
- goto not_there;
+#define PERL_constant_NOTFOUND 1
+#define PERL_constant_NOTDEF 2
+#define PERL_constant_ISIV 3
+#define PERL_constant_ISNV 4
+#define PERL_constant_ISPV 5
+#define PERL_constant_ISPVN 6
+#define PERL_constant_ISUV 7
+
+#ifndef NVTYPE
+typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
#endif
- break;
- case 'F':
- if (*name == '_') {
- name++;
- if (strEQ(name, "ALLOCSP"))
-#ifdef F_ALLOCSP
- return F_ALLOCSP;
+
+static int
+constant_5 (const char *name, IV *iv_return) {
+ /* Names all of length 5. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ FEXCL FSYNC O_RAW */
+ /* Offset 2 gives the best switch position. */
+ switch (name[2]) {
+ case 'R':
+ if (memEQ(name, "O_RAW", 5)) {
+ /* ^ */
+#ifdef O_RAW
+ *iv_return = O_RAW;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ALLOCSP64"))
-#ifdef F_ALLOCSP64
- return F_ALLOCSP64;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "FEXCL", 5)) {
+ /* ^ */
+#ifdef FEXCL
+ *iv_return = FEXCL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "COMPAT"))
-#ifdef F_COMPAT
- return F_COMPAT;
+ }
+ break;
+ case 'Y':
+ if (memEQ(name, "FSYNC", 5)) {
+ /* ^ */
+#ifdef FSYNC
+ *iv_return = FSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DUP2FD"))
-#ifdef F_DUP2FD
- return F_DUP2FD;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_6 (const char *name, IV *iv_return) {
+ /* Names all of length 6. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ FASYNC FCREAT FDEFER FDSYNC FRSYNC FTRUNC O_EXCL O_RDWR O_RSRC O_SYNC
+ O_TEXT */
+ /* Offset 3 gives the best switch position. */
+ switch (name[3]) {
+ case 'D':
+ if (memEQ(name, "O_RDWR", 6)) {
+ /* ^ */
+#ifdef O_RDWR
+ *iv_return = O_RDWR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DUPFD"))
-#ifdef F_DUPFD
- return F_DUPFD;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "FCREAT", 6)) {
+ /* ^ */
+#ifdef FCREAT
+ *iv_return = FCREAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EXLCK"))
-#ifdef F_EXLCK
- return F_EXLCK;
+ }
+ if (memEQ(name, "O_TEXT", 6)) {
+ /* ^ */
+#ifdef O_TEXT
+ *iv_return = O_TEXT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "FREESP"))
-#ifdef F_FREESP
- return F_FREESP;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "FDEFER", 6)) {
+ /* ^ */
+#ifdef FDEFER
+ *iv_return = FDEFER;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "FREESP64"))
-#ifdef F_FREESP64
- return F_FREESP64;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "O_RSRC", 6)) {
+ /* ^ */
+#ifdef O_RSRC
+ *iv_return = O_RSRC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "FSYNC"))
-#ifdef F_FSYNC
- return F_FSYNC;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "FTRUNC", 6)) {
+ /* ^ */
+#ifdef FTRUNC
+ *iv_return = FTRUNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "FSYNC64"))
-#ifdef F_FSYNC64
- return F_FSYNC64;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "O_EXCL", 6)) {
+ /* ^ */
+#ifdef O_EXCL
+ *iv_return = O_EXCL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "GETFD"))
-#ifdef F_GETFD
- return F_GETFD;
+ }
+ break;
+ case 'Y':
+ if (memEQ(name, "FASYNC", 6)) {
+ /* ^ */
+#ifdef FASYNC
+ *iv_return = FASYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "GETFL"))
-#ifdef F_GETFL
- return F_GETFL;
+ }
+ if (memEQ(name, "FDSYNC", 6)) {
+ /* ^ */
+#ifdef FDSYNC
+ *iv_return = FDSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "GETLK"))
-#ifdef F_GETLK
- return F_GETLK;
+ }
+ if (memEQ(name, "FRSYNC", 6)) {
+ /* ^ */
+#ifdef FRSYNC
+ *iv_return = FRSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "GETLK64"))
-#ifdef F_GETLK64
- return F_GETLK64;
+ }
+ if (memEQ(name, "O_SYNC", 6)) {
+ /* ^ */
+#ifdef O_SYNC
+ *iv_return = O_SYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "GETOWN"))
-#ifdef F_GETOWN
- return F_GETOWN;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_7 (const char *name, IV *iv_return) {
+ /* Names all of length 7. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ FAPPEND FNDELAY F_DUPFD F_EXLCK F_FSYNC F_GETFD F_GETFL F_GETLK F_NODNY
+ F_POSIX F_RDACC F_RDDNY F_RDLCK F_RWACC F_RWDNY F_SETFD F_SETFL F_SETLK
+ F_SHARE F_SHLCK F_UNLCK F_WRACC F_WRDNY F_WRLCK LOCK_EX LOCK_NB LOCK_SH
+ LOCK_UN O_ALIAS O_ASYNC O_CREAT O_DEFER O_DSYNC O_RSYNC O_TRUNC S_ENFMT
+ S_IEXEC S_IFBLK S_IFCHR S_IFDIR S_IFIFO S_IFLNK S_IFREG S_IFWHT S_IREAD
+ S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISTXT S_ISUID
+ S_ISVTX S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR _S_IFMT */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'A':
+ if (memEQ(name, "F_RDACC", 7)) {
+ /* ^ */
+#ifdef F_RDACC
+ *iv_return = F_RDACC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NODNY"))
-#ifdef F_NODNY
- return F_NODNY;
+ }
+ if (memEQ(name, "F_RWACC", 7)) {
+ /* ^ */
+#ifdef F_RWACC
+ *iv_return = F_RWACC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "POSIX"))
-#ifdef F_POSIX
- return F_POSIX;
+ }
+ if (memEQ(name, "F_SHARE", 7)) {
+ /* ^ */
+#ifdef F_SHARE
+ *iv_return = F_SHARE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RDACC"))
-#ifdef F_RDACC
- return F_RDACC;
+ }
+ if (memEQ(name, "F_WRACC", 7)) {
+ /* ^ */
+#ifdef F_WRACC
+ *iv_return = F_WRACC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RDDNY"))
-#ifdef F_RDDNY
- return F_RDDNY;
+ }
+ break;
+ case 'B':
+ if (memEQ(name, "S_IFBLK", 7)) {
+ /* ^ */
+#ifdef S_IFBLK
+ *iv_return = S_IFBLK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RDLCK"))
-#ifdef F_RDLCK
- return F_RDLCK;
+ }
+ break;
+ case 'C':
+ if (memEQ(name, "S_IFCHR", 7)) {
+ /* ^ */
+#ifdef S_IFCHR
+ *iv_return = S_IFCHR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RWACC"))
-#ifdef F_RWACC
- return F_RWACC;
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "F_NODNY", 7)) {
+ /* ^ */
+#ifdef F_NODNY
+ *iv_return = F_NODNY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RWDNY"))
-#ifdef F_RWDNY
- return F_RWDNY;
+ }
+ if (memEQ(name, "F_RDDNY", 7)) {
+ /* ^ */
+#ifdef F_RDDNY
+ *iv_return = F_RDDNY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETFD"))
-#ifdef F_SETFD
- return F_SETFD;
+ }
+ if (memEQ(name, "F_RWDNY", 7)) {
+ /* ^ */
+#ifdef F_RWDNY
+ *iv_return = F_RWDNY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETFL"))
-#ifdef F_SETFL
- return F_SETFL;
+ }
+ if (memEQ(name, "F_WRDNY", 7)) {
+ /* ^ */
+#ifdef F_WRDNY
+ *iv_return = F_WRDNY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETLK"))
-#ifdef F_SETLK
- return F_SETLK;
+ }
+ if (memEQ(name, "S_IFDIR", 7)) {
+ /* ^ */
+#ifdef S_IFDIR
+ *iv_return = S_IFDIR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETLK64"))
-#ifdef F_SETLK64
- return F_SETLK64;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "FAPPEND", 7)) {
+ /* ^ */
+#ifdef FAPPEND
+ *iv_return = FAPPEND;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETLKW"))
-#ifdef F_SETLKW
- return F_SETLKW;
+ }
+ if (memEQ(name, "O_CREAT", 7)) {
+ /* ^ */
+#ifdef O_CREAT
+ *iv_return = O_CREAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETLKW64"))
-#ifdef F_SETLKW64
- return F_SETLKW64;
+ }
+ if (memEQ(name, "S_IREAD", 7)) {
+ /* ^ */
+#ifdef S_IREAD
+ *iv_return = S_IREAD;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SETOWN"))
-#ifdef F_SETOWN
- return F_SETOWN;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "O_DEFER", 7)) {
+ /* ^ */
+#ifdef O_DEFER
+ *iv_return = O_DEFER;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SHARE"))
-#ifdef F_SHARE
- return F_SHARE;
+ }
+ if (memEQ(name, "S_ENFMT", 7)) {
+ /* ^ */
+#ifdef S_ENFMT
+ *iv_return = S_ENFMT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SHLCK"))
-#ifdef F_SHLCK
- return F_SHLCK;
+ }
+ if (memEQ(name, "_S_IFMT", 7)) {
+ /* ^ */
+#ifdef S_IFMT
+ *iv_return = S_IFMT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "UNLCK"))
-#ifdef F_UNLCK
- return F_UNLCK;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "S_IRGRP", 7)) {
+ /* ^ */
+#ifdef S_IRGRP
+ *iv_return = S_IRGRP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "UNSHARE"))
-#ifdef F_UNSHARE
- return F_UNSHARE;
+ }
+ if (memEQ(name, "S_ISGID", 7)) {
+ /* ^ */
+#ifdef S_ISGID
+ *iv_return = S_ISGID;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "WRACC"))
-#ifdef F_WRACC
- return F_WRACC;
+ }
+ if (memEQ(name, "S_IWGRP", 7)) {
+ /* ^ */
+#ifdef S_IWGRP
+ *iv_return = S_IWGRP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "WRDNY"))
-#ifdef F_WRDNY
- return F_WRDNY;
+ }
+ if (memEQ(name, "S_IXGRP", 7)) {
+ /* ^ */
+#ifdef S_IXGRP
+ *iv_return = S_IXGRP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "WRLCK"))
-#ifdef F_WRLCK
- return F_WRLCK;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "O_ALIAS", 7)) {
+ /* ^ */
+#ifdef O_ALIAS
+ *iv_return = O_ALIAS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- errno = EINVAL;
- return 0;
- }
- if (strEQ(name, "APPEND"))
-#ifdef FAPPEND
- return FAPPEND;
+ }
+ if (memEQ(name, "S_IFIFO", 7)) {
+ /* ^ */
+#ifdef S_IFIFO
+ *iv_return = S_IFIFO;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ASYNC"))
-#ifdef FASYNC
- return FASYNC;
+ }
+ break;
+ case 'L':
+ if (memEQ(name, "FNDELAY", 7)) {
+ /* ^ */
+#ifdef FNDELAY
+ *iv_return = FNDELAY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "CREAT"))
-#ifdef FCREAT
- return FCREAT;
+ }
+ if (memEQ(name, "F_EXLCK", 7)) {
+ /* ^ */
+#ifdef F_EXLCK
+ *iv_return = F_EXLCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "D_CLOEXEC"))
-#ifdef FD_CLOEXEC
- return FD_CLOEXEC;
+ }
+ if (memEQ(name, "F_RDLCK", 7)) {
+ /* ^ */
+#ifdef F_RDLCK
+ *iv_return = F_RDLCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DEFER"))
-#ifdef FDEFER
- return FDEFER;
+ }
+ if (memEQ(name, "F_SHLCK", 7)) {
+ /* ^ */
+#ifdef F_SHLCK
+ *iv_return = F_SHLCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DSYNC"))
-#ifdef FDSYNC
- return FDSYNC;
+ }
+ if (memEQ(name, "F_UNLCK", 7)) {
+ /* ^ */
+#ifdef F_UNLCK
+ *iv_return = F_UNLCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EXCL"))
-#ifdef FEXCL
- return FEXCL;
+ }
+ if (memEQ(name, "F_WRLCK", 7)) {
+ /* ^ */
+#ifdef F_WRLCK
+ *iv_return = F_WRLCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "LARGEFILE"))
-#ifdef FLARGEFILE
- return FLARGEFILE;
+ }
+ if (memEQ(name, "S_IFLNK", 7)) {
+ /* ^ */
+#ifdef S_IFLNK
+ *iv_return = S_IFLNK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NDELAY"))
-#ifdef FNDELAY
- return FNDELAY;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "S_IROTH", 7)) {
+ /* ^ */
+#ifdef S_IROTH
+ *iv_return = S_IROTH;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NONBLOCK"))
-#ifdef FNONBLOCK
- return FNONBLOCK;
+ }
+ if (memEQ(name, "S_IWOTH", 7)) {
+ /* ^ */
+#ifdef S_IWOTH
+ *iv_return = S_IWOTH;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RSYNC"))
-#ifdef FRSYNC
- return FRSYNC;
+ }
+ if (memEQ(name, "S_IXOTH", 7)) {
+ /* ^ */
+#ifdef S_IXOTH
+ *iv_return = S_IXOTH;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SYNC"))
-#ifdef FSYNC
- return FSYNC;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "F_DUPFD", 7)) {
+ /* ^ */
+#ifdef F_DUPFD
+ *iv_return = F_DUPFD;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TRUNC"))
-#ifdef FTRUNC
- return FTRUNC;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "S_IFREG", 7)) {
+ /* ^ */
+#ifdef S_IFREG
+ *iv_return = S_IFREG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'L':
- if (strnEQ(name, "OCK_", 4)) {
- /* We support flock() on systems which don't have it, so
- always supply the constants. */
- name += 4;
- if (strEQ(name, "SH"))
-#ifdef LOCK_SH
- return LOCK_SH;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "F_POSIX", 7)) {
+ /* ^ */
+#ifdef F_POSIX
+ *iv_return = F_POSIX;
+ return PERL_constant_ISIV;
#else
- return 1;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EX"))
-#ifdef LOCK_EX
- return LOCK_EX;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "F_GETFD", 7)) {
+ /* ^ */
+#ifdef F_GETFD
+ *iv_return = F_GETFD;
+ return PERL_constant_ISIV;
#else
- return 2;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NB"))
-#ifdef LOCK_NB
- return LOCK_NB;
+ }
+ if (memEQ(name, "F_GETFL", 7)) {
+ /* ^ */
+#ifdef F_GETFL
+ *iv_return = F_GETFL;
+ return PERL_constant_ISIV;
#else
- return 4;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "UN"))
-#ifdef LOCK_UN
- return LOCK_UN;
+ }
+ if (memEQ(name, "F_GETLK", 7)) {
+ /* ^ */
+#ifdef F_GETLK
+ *iv_return = F_GETLK;
+ return PERL_constant_ISIV;
#else
- return 8;
+ return PERL_constant_NOTDEF;
#endif
- } else
- goto not_there;
- break;
- case 'O':
- if (name[0] == '_') {
- name++;
- if (strEQ(name, "ACCMODE"))
-#ifdef O_ACCMODE
- return O_ACCMODE;
+ }
+ if (memEQ(name, "F_SETFD", 7)) {
+ /* ^ */
+#ifdef F_SETFD
+ *iv_return = F_SETFD;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "APPEND"))
-#ifdef O_APPEND
- return O_APPEND;
+ }
+ if (memEQ(name, "F_SETFL", 7)) {
+ /* ^ */
+#ifdef F_SETFL
+ *iv_return = F_SETFL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ASYNC"))
-#ifdef O_ASYNC
- return O_ASYNC;
+ }
+ if (memEQ(name, "F_SETLK", 7)) {
+ /* ^ */
+#ifdef F_SETLK
+ *iv_return = F_SETLK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "BINARY"))
-#ifdef O_BINARY
- return O_BINARY;
+ }
+ if (memEQ(name, "S_ISTXT", 7)) {
+ /* ^ */
+#ifdef S_ISTXT
+ *iv_return = S_ISTXT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "CREAT"))
-#ifdef O_CREAT
- return O_CREAT;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "O_TRUNC", 7)) {
+ /* ^ */
+#ifdef O_TRUNC
+ *iv_return = O_TRUNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DEFER"))
-#ifdef O_DEFER
- return O_DEFER;
+ }
+ if (memEQ(name, "S_IRUSR", 7)) {
+ /* ^ */
+#ifdef S_IRUSR
+ *iv_return = S_IRUSR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DIRECT"))
-#ifdef O_DIRECT
- return O_DIRECT;
+ }
+ if (memEQ(name, "S_ISUID", 7)) {
+ /* ^ */
+#ifdef S_ISUID
+ *iv_return = S_ISUID;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DIRECTORY"))
-#ifdef O_DIRECTORY
- return O_DIRECTORY;
+ }
+ if (memEQ(name, "S_IWUSR", 7)) {
+ /* ^ */
+#ifdef S_IWUSR
+ *iv_return = S_IWUSR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "DSYNC"))
-#ifdef O_DSYNC
- return O_DSYNC;
+ }
+ if (memEQ(name, "S_IXUSR", 7)) {
+ /* ^ */
+#ifdef S_IXUSR
+ *iv_return = S_IXUSR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EXCL"))
-#ifdef O_EXCL
- return O_EXCL;
+ }
+ break;
+ case 'V':
+ if (memEQ(name, "S_ISVTX", 7)) {
+ /* ^ */
+#ifdef S_ISVTX
+ *iv_return = S_ISVTX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EXLOCK"))
-#ifdef O_EXLOCK
- return O_EXLOCK;
+ }
+ break;
+ case 'W':
+ if (memEQ(name, "S_IFWHT", 7)) {
+ /* ^ */
+#ifdef S_IFWHT
+ *iv_return = S_IFWHT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "LARGEFILE"))
-#ifdef O_LARGEFILE
- return O_LARGEFILE;
+ }
+ if (memEQ(name, "S_IRWXG", 7)) {
+ /* ^ */
+#ifdef S_IRWXG
+ *iv_return = S_IRWXG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NDELAY"))
-#ifdef O_NDELAY
- return O_NDELAY;
+ }
+ if (memEQ(name, "S_IRWXO", 7)) {
+ /* ^ */
+#ifdef S_IRWXO
+ *iv_return = S_IRWXO;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NOCTTY"))
-#ifdef O_NOCTTY
- return O_NOCTTY;
+ }
+ if (memEQ(name, "S_IRWXU", 7)) {
+ /* ^ */
+#ifdef S_IRWXU
+ *iv_return = S_IRWXU;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NOFOLLOW"))
-#ifdef O_NOFOLLOW
- return O_NOFOLLOW;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "S_IEXEC", 7)) {
+ /* ^ */
+#ifdef S_IEXEC
+ *iv_return = S_IEXEC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NOINHERIT"))
-#ifdef O_NOINHERIT
- return O_NOINHERIT;
+ }
+ break;
+ case 'Y':
+ if (memEQ(name, "F_FSYNC", 7)) {
+ /* ^ */
+#ifdef F_FSYNC
+ *iv_return = F_FSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "NONBLOCK"))
-#ifdef O_NONBLOCK
- return O_NONBLOCK;
+ }
+ if (memEQ(name, "O_ASYNC", 7)) {
+ /* ^ */
+#ifdef O_ASYNC
+ *iv_return = O_ASYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RANDOM"))
-#ifdef O_RANDOM
- return O_RANDOM;
+ }
+ if (memEQ(name, "O_DSYNC", 7)) {
+ /* ^ */
+#ifdef O_DSYNC
+ *iv_return = O_DSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RAW"))
-#ifdef O_RAW
- return O_RAW;
+ }
+ if (memEQ(name, "O_RSYNC", 7)) {
+ /* ^ */
+#ifdef O_RSYNC
+ *iv_return = O_RSYNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RDONLY"))
-#ifdef O_RDONLY
- return O_RDONLY;
+ }
+ break;
+ case '_':
+ if (memEQ(name, "LOCK_EX", 7)) {
+ /* ^ */
+#ifdef LOCK_EX
+ *iv_return = LOCK_EX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 2;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "RDWR"))
-#ifdef O_RDWR
- return O_RDWR;
+ }
+ if (memEQ(name, "LOCK_NB", 7)) {
+ /* ^ */
+#ifdef LOCK_NB
+ *iv_return = LOCK_NB;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 4;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "RSYNC"))
-#ifdef O_RSYNC
- return O_RSYNC;
+ }
+ if (memEQ(name, "LOCK_SH", 7)) {
+ /* ^ */
+#ifdef LOCK_SH
+ *iv_return = LOCK_SH;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 1;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "SEQUENTIAL"))
-#ifdef O_SEQUENTIAL
- return O_SEQUENTIAL;
+ }
+ if (memEQ(name, "LOCK_UN", 7)) {
+ /* ^ */
+#ifdef LOCK_UN
+ *iv_return = LOCK_UN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 8;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "SHLOCK"))
-#ifdef O_SHLOCK
- return O_SHLOCK;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_8 (const char *name, IV *iv_return) {
+ /* Names all of length 8. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ F_COMPAT F_DUP2FD F_FREESP F_GETOWN F_SETLKW F_SETOWN O_APPEND O_BINARY
+ O_DIRECT O_EXLOCK O_NDELAY O_NOCTTY O_RANDOM O_RDONLY O_SHLOCK O_WRONLY
+ SEEK_CUR SEEK_END SEEK_SET S_IFSOCK S_IWRITE */
+ /* Offset 3 gives the best switch position. */
+ switch (name[3]) {
+ case 'A':
+ if (memEQ(name, "O_RANDOM", 8)) {
+ /* ^ */
+#ifdef O_RANDOM
+ *iv_return = O_RANDOM;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SYNC"))
-#ifdef O_SYNC
- return O_SYNC;
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "O_NDELAY", 8)) {
+ /* ^ */
+#ifdef O_NDELAY
+ *iv_return = O_NDELAY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TEMPORARY"))
-#ifdef O_TEMPORARY
- return O_TEMPORARY;
+ }
+ if (memEQ(name, "O_RDONLY", 8)) {
+ /* ^ */
+#ifdef O_RDONLY
+ *iv_return = O_RDONLY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TEXT"))
-#ifdef O_TEXT
- return O_TEXT;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "F_GETOWN", 8)) {
+ /* ^ */
+#ifdef F_GETOWN
+ *iv_return = F_GETOWN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TRUNC"))
-#ifdef O_TRUNC
- return O_TRUNC;
+ }
+ if (memEQ(name, "F_SETLKW", 8)) {
+ /* ^ */
+#ifdef F_SETLKW
+ *iv_return = F_SETLKW;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "WRONLY"))
-#ifdef O_WRONLY
- return O_WRONLY;
+ }
+ if (memEQ(name, "F_SETOWN", 8)) {
+ /* ^ */
+#ifdef F_SETOWN
+ *iv_return = F_SETOWN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ALIAS"))
-#ifdef O_ALIAS
- return O_ALIAS;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "S_IFSOCK", 8)) {
+ /* ^ */
+#ifdef S_IFSOCK
+ *iv_return = S_IFSOCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "RSRC"))
-#ifdef O_RSRC
- return O_RSRC;
+ }
+ break;
+ case 'H':
+ if (memEQ(name, "O_SHLOCK", 8)) {
+ /* ^ */
+#ifdef O_SHLOCK
+ *iv_return = O_SHLOCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- } else
- goto not_there;
- break;
- case 'S':
- switch (*(name++)) {
- case '_':
- if (strEQ(name, "ISUID"))
-#ifdef S_ISUID
- return S_ISUID;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "O_BINARY", 8)) {
+ /* ^ */
+#ifdef O_BINARY
+ *iv_return = O_BINARY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ISGID"))
-#ifdef S_ISGID
- return S_ISGID;
+ }
+ if (memEQ(name, "O_DIRECT", 8)) {
+ /* ^ */
+#ifdef O_DIRECT
+ *iv_return = O_DIRECT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ISVTX"))
-#ifdef S_ISVTX
- return S_ISVTX;
+ }
+ break;
+ case 'K':
+ if (memEQ(name, "SEEK_CUR", 8)) {
+ /* ^ */
+#ifdef SEEK_CUR
+ *iv_return = SEEK_CUR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 1;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "ISTXT"))
-#ifdef S_ISTXT
- return S_ISTXT;
+ }
+ if (memEQ(name, "SEEK_END", 8)) {
+ /* ^ */
+#ifdef SEEK_END
+ *iv_return = SEEK_END;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 2;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "IFREG"))
-#ifdef S_IFREG
- return S_IFREG;
+ }
+ if (memEQ(name, "SEEK_SET", 8)) {
+ /* ^ */
+#ifdef SEEK_SET
+ *iv_return = SEEK_SET;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 0;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "IFDIR"))
-#ifdef S_IFDIR
- return S_IFDIR;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "F_COMPAT", 8)) {
+ /* ^ */
+#ifdef F_COMPAT
+ *iv_return = F_COMPAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFLNK"))
-#ifdef S_IFLNK
- return S_IFLNK;
+ }
+ if (memEQ(name, "O_NOCTTY", 8)) {
+ /* ^ */
+#ifdef O_NOCTTY
+ *iv_return = O_NOCTTY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFSOCK"))
-#ifdef S_IFSOCK
- return S_IFSOCK;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "O_APPEND", 8)) {
+ /* ^ */
+#ifdef O_APPEND
+ *iv_return = O_APPEND;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFBLK"))
-#ifdef S_IFBLK
- return S_IFBLK;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "F_FREESP", 8)) {
+ /* ^ */
+#ifdef F_FREESP
+ *iv_return = F_FREESP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFCHR"))
-#ifdef S_IFCHR
- return S_IFCHR;
+ }
+ if (memEQ(name, "O_WRONLY", 8)) {
+ /* ^ */
+#ifdef O_WRONLY
+ *iv_return = O_WRONLY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFIFO"))
-#ifdef S_IFIFO
- return S_IFIFO;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "F_DUP2FD", 8)) {
+ /* ^ */
+#ifdef F_DUP2FD
+ *iv_return = F_DUP2FD;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IFWHT"))
-#ifdef S_IFWHT
- return S_IFWHT;
+ }
+ break;
+ case 'W':
+ if (memEQ(name, "S_IWRITE", 8)) {
+ /* ^ */
+#ifdef S_IWRITE
+ *iv_return = S_IWRITE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "ENFMT"))
-#ifdef S_ENFMT
- return S_ENFMT;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "O_EXLOCK", 8)) {
+ /* ^ */
+#ifdef O_EXLOCK
+ *iv_return = O_EXLOCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IRUSR"))
-#ifdef S_IRUSR
- return S_IRUSR;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_9 (const char *name, IV *iv_return) {
+ /* Names all of length 9. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ FNONBLOCK F_ALLOCSP F_FSYNC64 F_GETLK64 F_SETLK64 F_UNSHARE O_ACCMODE */
+ /* Offset 2 gives the best switch position. */
+ switch (name[2]) {
+ case 'A':
+ if (memEQ(name, "F_ALLOCSP", 9)) {
+ /* ^ */
+#ifdef F_ALLOCSP
+ *iv_return = F_ALLOCSP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IWUSR"))
-#ifdef S_IWUSR
- return S_IWUSR;
+ }
+ if (memEQ(name, "O_ACCMODE", 9)) {
+ /* ^ */
+#ifdef O_ACCMODE
+ *iv_return = O_ACCMODE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IXUSR"))
-#ifdef S_IXUSR
- return S_IXUSR;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "F_FSYNC64", 9)) {
+ /* ^ */
+#ifdef F_FSYNC64
+ *iv_return = F_FSYNC64;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IRWXU"))
-#ifdef S_IRWXU
- return S_IRWXU;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "F_GETLK64", 9)) {
+ /* ^ */
+#ifdef F_GETLK64
+ *iv_return = F_GETLK64;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IRGRP"))
-#ifdef S_IRGRP
- return S_IRGRP;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "FNONBLOCK", 9)) {
+ /* ^ */
+#ifdef FNONBLOCK
+ *iv_return = FNONBLOCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IWGRP"))
-#ifdef S_IWGRP
- return S_IWGRP;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "F_SETLK64", 9)) {
+ /* ^ */
+#ifdef F_SETLK64
+ *iv_return = F_SETLK64;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IXGRP"))
-#ifdef S_IXGRP
- return S_IXGRP;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "F_UNSHARE", 9)) {
+ /* ^ */
+#ifdef F_UNSHARE
+ *iv_return = F_UNSHARE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IRWXG"))
-#ifdef S_IRWXG
- return S_IRWXG;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_10 (const char *name, IV *iv_return) {
+ /* Names all of length 10. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ FD_CLOEXEC FLARGEFILE F_FREESP64 F_SETLKW64 O_NOFOLLOW O_NONBLOCK */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'E':
+ if (memEQ(name, "F_FREESP64", 10)) {
+ /* ^ */
+#ifdef F_FREESP64
+ *iv_return = F_FREESP64;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IROTH"))
-#ifdef S_IROTH
- return S_IROTH;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "O_NOFOLLOW", 10)) {
+ /* ^ */
+#ifdef O_NOFOLLOW
+ *iv_return = O_NOFOLLOW;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IWOTH"))
-#ifdef S_IWOTH
- return S_IWOTH;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "FLARGEFILE", 10)) {
+ /* ^ */
+#ifdef FLARGEFILE
+ *iv_return = FLARGEFILE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IXOTH"))
-#ifdef S_IXOTH
- return S_IXOTH;
+ }
+ break;
+ case 'L':
+ if (memEQ(name, "FD_CLOEXEC", 10)) {
+ /* ^ */
+#ifdef FD_CLOEXEC
+ *iv_return = FD_CLOEXEC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IRWXO"))
-#ifdef S_IRWXO
- return S_IRWXO;
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "O_NONBLOCK", 10)) {
+ /* ^ */
+#ifdef O_NONBLOCK
+ *iv_return = O_NONBLOCK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IREAD"))
-#ifdef S_IREAD
- return S_IREAD;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "F_SETLKW64", 10)) {
+ /* ^ */
+#ifdef F_SETLKW64
+ *iv_return = F_SETLKW64;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IWRITE"))
-#ifdef S_IWRITE
- return S_IWRITE;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_11 (const char *name, IV *iv_return) {
+ /* Names all of length 11. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ F_ALLOCSP64 O_DIRECTORY O_LARGEFILE O_NOINHERIT O_TEMPORARY */
+ /* Offset 5 gives the best switch position. */
+ switch (name[5]) {
+ case 'E':
+ if (memEQ(name, "O_DIRECTORY", 11)) {
+ /* ^ */
+#ifdef O_DIRECTORY
+ *iv_return = O_DIRECTORY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IEXEC"))
-#ifdef S_IEXEC
- return S_IEXEC;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "O_LARGEFILE", 11)) {
+ /* ^ */
+#ifdef O_LARGEFILE
+ *iv_return = O_LARGEFILE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'E':
- if (strEQ(name, "EK_CUR"))
-#ifdef SEEK_CUR
- return SEEK_CUR;
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "O_NOINHERIT", 11)) {
+ /* ^ */
+#ifdef O_NOINHERIT
+ *iv_return = O_NOINHERIT;
+ return PERL_constant_ISIV;
#else
- return 1;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EK_END"))
-#ifdef SEEK_END
- return SEEK_END;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "F_ALLOCSP64", 11)) {
+ /* ^ */
+#ifdef F_ALLOCSP64
+ *iv_return = F_ALLOCSP64;
+ return PERL_constant_ISIV;
#else
- return 2;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "EK_SET"))
-#ifdef SEEK_SET
- return SEEK_SET;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "O_TEMPORARY", 11)) {
+ /* ^ */
+#ifdef O_TEMPORARY
+ *iv_return = O_TEMPORARY;
+ return PERL_constant_ISIV;
#else
- return 0;
+ return PERL_constant_NOTDEF;
#endif
- break;
- }
}
- errno = EINVAL;
- return 0;
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant (const char *name, STRLEN len, IV *iv_return) {
+ /* Initially switch on the length of the name. */
+ /* When generated this function returned values for the list of names given
+ in this section of perl code. Rather than manually editing these functions
+ to add or remove constants, which would result in this comment and section
+ of code becoming inaccurate, we recommend that you edit this section of
+ code, and use it to regenerate a new set of constant functions which you
+ then use to replace the originals.
+
+ Regenerate these constant functions by feeding this entire source file to
+ perl -x
-not_there:
- errno = ENOENT;
- return 0;
+#!perl -w
+use ExtUtils::Constant qw (constant_types C_constant XS_constant);
+
+my $types = {IV => 1};
+my @names = (qw(FAPPEND FASYNC FCREAT FDEFER FDSYNC FD_CLOEXEC FEXCL FLARGEFILE
+ FNDELAY FNONBLOCK FRSYNC FSYNC FTRUNC F_ALLOCSP F_ALLOCSP64
+ F_COMPAT F_DUP2FD F_DUPFD F_EXLCK F_FREESP F_FREESP64 F_FSYNC
+ F_FSYNC64 F_GETFD F_GETFL F_GETLK F_GETLK64 F_GETOWN F_NODNY
+ F_POSIX F_RDACC F_RDDNY F_RDLCK F_RWACC F_RWDNY F_SETFD F_SETFL
+ F_SETLK F_SETLK64 F_SETLKW F_SETLKW64 F_SETOWN F_SHARE F_SHLCK
+ F_UNLCK F_UNSHARE F_WRACC F_WRDNY F_WRLCK O_ACCMODE O_ALIAS
+ O_APPEND O_ASYNC O_BINARY O_CREAT O_DEFER O_DIRECT O_DIRECTORY
+ O_DSYNC O_EXCL O_EXLOCK O_LARGEFILE O_NDELAY O_NOCTTY O_NOFOLLOW
+ O_NOINHERIT O_NONBLOCK O_RANDOM O_RAW O_RDONLY O_RDWR O_RSRC
+ O_RSYNC O_SEQUENTIAL O_SHLOCK O_SYNC O_TEMPORARY O_TEXT O_TRUNC
+ O_WRONLY S_ENFMT S_IEXEC S_IFBLK S_IFCHR S_IFDIR S_IFIFO S_IFLNK
+ S_IFREG S_IFSOCK S_IFWHT S_IREAD S_IRGRP S_IROTH S_IRUSR S_IRWXG
+ S_IRWXO S_IRWXU S_ISGID S_ISTXT S_ISUID S_ISVTX S_IWGRP S_IWOTH
+ S_IWRITE S_IWUSR S_IXGRP S_IXOTH S_IXUSR),
+ {name=>"LOCK_EX", type=>"IV", default=>["IV", "2"]},
+ {name=>"LOCK_NB", type=>"IV", default=>["IV", "4"]},
+ {name=>"LOCK_SH", type=>"IV", default=>["IV", "1"]},
+ {name=>"LOCK_UN", type=>"IV", default=>["IV", "8"]},
+ {name=>"SEEK_CUR", type=>"IV", default=>["IV", "1"]},
+ {name=>"SEEK_END", type=>"IV", default=>["IV", "2"]},
+ {name=>"SEEK_SET", type=>"IV", default=>["IV", "0"]},
+ {name=>"_S_IFMT", type=>"IV", macro=>"S_IFMT", value=>"S_IFMT"});
+
+print constant_types(); # macro defs
+foreach (C_constant ("Fcntl", 'constant', 'IV', $types, undef, undef, @names) ) {
+ print $_, "\n"; # C constant subs
}
+print "#### XS Section:\n";
+print XS_constant ("Fcntl", $types);
+__END__
+ */
+ switch (len) {
+ case 5:
+ return constant_5 (name, iv_return);
+ break;
+ case 6:
+ return constant_6 (name, iv_return);
+ break;
+ case 7:
+ return constant_7 (name, iv_return);
+ break;
+ case 8:
+ return constant_8 (name, iv_return);
+ break;
+ case 9:
+ return constant_9 (name, iv_return);
+ break;
+ case 10:
+ return constant_10 (name, iv_return);
+ break;
+ case 11:
+ return constant_11 (name, iv_return);
+ break;
+ case 12:
+ if (memEQ(name, "O_SEQUENTIAL", 12)) {
+#ifdef O_SEQUENTIAL
+ *iv_return = O_SEQUENTIAL;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
MODULE = Fcntl PACKAGE = Fcntl
-IV
-constant(name)
- char * name
-
+void
+constant(sv)
+ PREINIT:
+#ifdef dXSTARG
+ dXSTARG; /* Faster if we have it. */
+#else
+ dTARGET;
+#endif
+ STRLEN len;
+ int type;
+ IV iv;
+ /* NV nv; Uncomment this if you need to return NVs */
+ /* const char *pv; Uncomment this if you need to return PVs */
+ INPUT:
+ SV * sv;
+ const char * s = SvPV(sv, len);
+ PPCODE:
+ /* Change this to constant(s, len, &iv, &nv);
+ if you need to return both NVs and IVs */
+ type = constant(s, len, &iv);
+ /* Return 1 or 2 items. First is error message, or undef if no error.
+ Second, if present, is found value */
+ switch (type) {
+ case PERL_constant_NOTFOUND:
+ sv = sv_2mortal(newSVpvf("%s is not a valid Fcntl macro", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_NOTDEF:
+ sv = sv_2mortal(newSVpvf(
+ "Your vendor has not defined Fcntl macro %s, used", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_ISIV:
+ EXTEND(SP, 1);
+ PUSHs(&PL_sv_undef);
+ PUSHi(iv);
+ break;
+ /* Uncomment this if you need to return UVs
+ case PERL_constant_ISUV:
+ EXTEND(SP, 1);
+ PUSHs(&PL_sv_undef);
+ PUSHu((UV)iv);
+ break; */
+ default:
+ sv = sv_2mortal(newSVpvf(
+ "Unexpected return type %d while processing Fcntl macro %s used",
+ type, s));
+ PUSHs(sv);
+ }
return -1;
}
-static double
-constant(char *name, int arg)
-{
- errno = 0;
- switch (*name) {
- case 'A':
- if (strEQ(name, "AF_802"))
-#ifdef AF_802
- return AF_802;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "AF_APPLETALK"))
-#ifdef AF_APPLETALK
- return AF_APPLETALK;
-#else
- goto not_there;
+#define PERL_constant_NOTFOUND 1
+#define PERL_constant_NOTDEF 2
+#define PERL_constant_ISIV 3
+#define PERL_constant_ISNV 4
+#define PERL_constant_ISPV 5
+#define PERL_constant_ISPVN 6
+#define PERL_constant_ISUV 7
+
+#ifndef NVTYPE
+typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
#endif
- if (strEQ(name, "AF_CCITT"))
-#ifdef AF_CCITT
- return AF_CCITT;
+
+static int
+constant_5 (const char *name, IV *iv_return) {
+ /* Names all of length 5. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_NS PF_NS */
+ /* Offset 0 gives the best switch position. */
+ switch (name[0]) {
+ case 'A':
+ if (memEQ(name, "AF_NS", 5)) {
+ /* ^ */
+#ifdef AF_NS
+ *iv_return = AF_NS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_CHAOS"))
-#ifdef AF_CHAOS
- return AF_CHAOS;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "PF_NS", 5)) {
+ /* ^ */
+#ifdef PF_NS
+ *iv_return = PF_NS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_DATAKIT"))
-#ifdef AF_DATAKIT
- return AF_DATAKIT;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_6 (const char *name, IV *iv_return) {
+ /* Names all of length 6. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_802 AF_DLI AF_LAT AF_MAX AF_NBS AF_NIT AF_OSI AF_PUP AF_SNA AF_X25
+ PF_802 PF_DLI PF_LAT PF_MAX PF_NBS PF_NIT PF_OSI PF_PUP PF_SNA PF_X25 */
+ /* Offset 3 gives the best switch position. */
+ switch (name[3]) {
+ case '8':
+ if (memEQ(name, "AF_802", 6)) {
+ /* ^ */
+#ifdef AF_802
+ *iv_return = AF_802;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_DECnet"))
-#ifdef AF_DECnet
- return AF_DECnet;
+ }
+ if (memEQ(name, "PF_802", 6)) {
+ /* ^ */
+#ifdef PF_802
+ *iv_return = PF_802;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_DLI"))
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "AF_DLI", 6)) {
+ /* ^ */
#ifdef AF_DLI
- return AF_DLI;
+ *iv_return = AF_DLI;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_ECMA"))
-#ifdef AF_ECMA
- return AF_ECMA;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "AF_GOSIP"))
-#ifdef AF_GOSIP
- return AF_GOSIP;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "AF_HYLINK"))
-#ifdef AF_HYLINK
- return AF_HYLINK;
+ }
+ if (memEQ(name, "PF_DLI", 6)) {
+ /* ^ */
+#ifdef PF_DLI
+ *iv_return = PF_DLI;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_IMPLINK"))
-#ifdef AF_IMPLINK
- return AF_IMPLINK;
+ }
+ break;
+ case 'L':
+ if (memEQ(name, "AF_LAT", 6)) {
+ /* ^ */
+#ifdef AF_LAT
+ *iv_return = AF_LAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_INET"))
-#ifdef AF_INET
- return AF_INET;
+ }
+ if (memEQ(name, "PF_LAT", 6)) {
+ /* ^ */
+#ifdef PF_LAT
+ *iv_return = PF_LAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_LAT"))
-#ifdef AF_LAT
- return AF_LAT;
+ }
+ break;
+ case 'M':
+ if (memEQ(name, "AF_MAX", 6)) {
+ /* ^ */
+#ifdef AF_MAX
+ *iv_return = AF_MAX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_MAX"))
-#ifdef AF_MAX
- return AF_MAX;
+ }
+ if (memEQ(name, "PF_MAX", 6)) {
+ /* ^ */
+#ifdef PF_MAX
+ *iv_return = PF_MAX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_NBS"))
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "AF_NBS", 6)) {
+ /* ^ */
#ifdef AF_NBS
- return AF_NBS;
+ *iv_return = AF_NBS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_NIT"))
+ }
+ if (memEQ(name, "AF_NIT", 6)) {
+ /* ^ */
#ifdef AF_NIT
- return AF_NIT;
+ *iv_return = AF_NIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_NS"))
-#ifdef AF_NS
- return AF_NS;
+ }
+ if (memEQ(name, "PF_NBS", 6)) {
+ /* ^ */
+#ifdef PF_NBS
+ *iv_return = PF_NBS;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ if (memEQ(name, "PF_NIT", 6)) {
+ /* ^ */
+#ifdef PF_NIT
+ *iv_return = PF_NIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_OSI"))
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "AF_OSI", 6)) {
+ /* ^ */
#ifdef AF_OSI
- return AF_OSI;
+ *iv_return = AF_OSI;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_OSINET"))
-#ifdef AF_OSINET
- return AF_OSINET;
+ }
+ if (memEQ(name, "PF_OSI", 6)) {
+ /* ^ */
+#ifdef PF_OSI
+ *iv_return = PF_OSI;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_PUP"))
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "AF_PUP", 6)) {
+ /* ^ */
#ifdef AF_PUP
- return AF_PUP;
+ *iv_return = AF_PUP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_SNA"))
-#ifdef AF_SNA
- return AF_SNA;
+ }
+ if (memEQ(name, "PF_PUP", 6)) {
+ /* ^ */
+#ifdef PF_PUP
+ *iv_return = PF_PUP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_UNIX"))
-#ifdef AF_UNIX
- return AF_UNIX;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "AF_SNA", 6)) {
+ /* ^ */
+#ifdef AF_SNA
+ *iv_return = AF_SNA;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_UNSPEC"))
-#ifdef AF_UNSPEC
- return AF_UNSPEC;
+ }
+ if (memEQ(name, "PF_SNA", 6)) {
+ /* ^ */
+#ifdef PF_SNA
+ *iv_return = PF_SNA;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "AF_X25"))
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "AF_X25", 6)) {
+ /* ^ */
#ifdef AF_X25
- return AF_X25;
-#else
- goto not_there;
-#endif
- break;
- case 'B':
- break;
- case 'C':
- break;
- case 'D':
- break;
- case 'E':
- break;
- case 'F':
- break;
- case 'G':
- break;
- case 'H':
- break;
- case 'I':
- if (strEQ(name, "IOV_MAX"))
-#ifdef IOV_MAX
- return IOV_MAX;
+ *iv_return = AF_X25;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "IPPROTO_TCP"))
-#ifdef IPPROTO_TCP
- return IPPROTO_TCP;
-#else
- goto not_there;
-#endif
- break;
- case 'J':
- break;
- case 'K':
- break;
- case 'L':
- break;
- case 'M':
- if (strEQ(name, "MSG_BCAST"))
-#ifdef MSG_BCAST
- return MSG_BCAST;
+ }
+ if (memEQ(name, "PF_X25", 6)) {
+ /* ^ */
+#ifdef PF_X25
+ *iv_return = PF_X25;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_CTLFLAGS"))
-#ifdef MSG_CTLFLAGS
- return MSG_CTLFLAGS;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_7 (const char *name, IV *iv_return) {
+ /* Names all of length 7. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_ECMA AF_INET AF_UNIX IOV_MAX MSG_EOF MSG_EOR MSG_FIN MSG_OOB MSG_RST
+ MSG_SYN MSG_URG PF_ECMA PF_INET PF_UNIX SHUT_RD SHUT_WR SO_TYPE */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'C':
+ if (memEQ(name, "AF_ECMA", 7)) {
+ /* ^ */
+#ifdef AF_ECMA
+ *iv_return = AF_ECMA;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_CTLIGNORE"))
-#ifdef MSG_CTLIGNORE
- return MSG_CTLIGNORE;
+ }
+ if (memEQ(name, "PF_ECMA", 7)) {
+ /* ^ */
+#ifdef PF_ECMA
+ *iv_return = PF_ECMA;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_CTRUNC"))
-#if defined(MSG_TRUNC) || defined(HAS_MSG_CTRUNC) /* might be an enum */
- return MSG_CTRUNC;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "MSG_EOF", 7)) {
+ /* ^ */
+#ifdef MSG_EOF
+ *iv_return = MSG_EOF;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_DONTROUTE"))
-#if defined(MSG_DONTROUTE) || defined(HAS_MSG_DONTROUTE) /* might be an enum */
- return MSG_DONTROUTE;
+ }
+ if (memEQ(name, "MSG_EOR", 7)) {
+ /* ^ */
+#ifdef MSG_EOR
+ *iv_return = MSG_EOR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_DONTWAIT"))
-#ifdef MSG_DONTWAIT
- return MSG_DONTWAIT;
+ }
+ break;
+ case 'F':
+ if (memEQ(name, "MSG_FIN", 7)) {
+ /* ^ */
+#ifdef MSG_FIN
+ *iv_return = MSG_FIN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_EOF"))
-#ifdef MSG_EOF
- return MSG_EOF;
+ }
+ break;
+ case 'M':
+ if (memEQ(name, "IOV_MAX", 7)) {
+ /* ^ */
+#ifdef IOV_MAX
+ *iv_return = IOV_MAX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_EOR"))
-#ifdef MSG_EOR
- return MSG_EOR;
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "AF_INET", 7)) {
+ /* ^ */
+#ifdef AF_INET
+ *iv_return = AF_INET;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_ERRQUEUE"))
-#ifdef MSG_ERRQUEUE
- return MSG_ERRQUEUE;
+ }
+ if (memEQ(name, "AF_UNIX", 7)) {
+ /* ^ */
+#ifdef AF_UNIX
+ *iv_return = AF_UNIX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_FIN"))
-#ifdef MSG_FIN
- return MSG_FIN;
+ }
+ if (memEQ(name, "PF_INET", 7)) {
+ /* ^ */
+#ifdef PF_INET
+ *iv_return = PF_INET;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_MAXIOVLEN"))
-#ifdef MSG_MAXIOVLEN
- return MSG_MAXIOVLEN;
+ }
+ if (memEQ(name, "PF_UNIX", 7)) {
+ /* ^ */
+#ifdef PF_UNIX
+ *iv_return = PF_UNIX;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_MCAST"))
-#ifdef MSG_MCAST
- return MSG_MCAST;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "MSG_OOB", 7)) {
+ /* ^ */
+#if defined(MSG_OOB) || defined(HAS_MSG_OOB) /* might be an enum */
+ *iv_return = MSG_OOB;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_NOSIGNAL"))
-#ifdef MSG_NOSIGNAL
- return MSG_NOSIGNAL;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "MSG_RST", 7)) {
+ /* ^ */
+#ifdef MSG_RST
+ *iv_return = MSG_RST;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_OOB"))
-#if defined(MSG_OOB) || defined(HAS_MSG_OOB) /* might be an enum */
- return MSG_OOB;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "MSG_SYN", 7)) {
+ /* ^ */
+#ifdef MSG_SYN
+ *iv_return = MSG_SYN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_PEEK"))
-#if defined(MSG_PEEK) || defined(HAS_MSG_PEEK) /* might be an enum */
- return MSG_PEEK;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "MSG_URG", 7)) {
+ /* ^ */
+#ifdef MSG_URG
+ *iv_return = MSG_URG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_PROXY"))
-#if defined(MSG_PROXY) || defined(HAS_MSG_PROXY) /* might be an enum */
- return MSG_PROXY;
+ }
+ break;
+ case 'Y':
+ if (memEQ(name, "SO_TYPE", 7)) {
+ /* ^ */
+#ifdef SO_TYPE
+ *iv_return = SO_TYPE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_RST"))
-#ifdef MSG_RST
- return MSG_RST;
+ }
+ break;
+ case '_':
+ if (memEQ(name, "SHUT_RD", 7)) {
+ /* ^ */
+#ifdef SHUT_RD
+ *iv_return = SHUT_RD;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 0;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "MSG_SYN"))
-#ifdef MSG_SYN
- return MSG_SYN;
+ }
+ if (memEQ(name, "SHUT_WR", 7)) {
+ /* ^ */
+#ifdef SHUT_WR
+ *iv_return = SHUT_WR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 1;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "MSG_TRUNC"))
-#ifdef MSG_TRUNC
- return MSG_TRUNC;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_8 (const char *name, IV *iv_return) {
+ /* Names all of length 8. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_CCITT AF_CHAOS AF_GOSIP MSG_PEEK PF_CCITT PF_CHAOS PF_GOSIP SOCK_RAW
+ SOCK_RDM SO_DEBUG SO_ERROR */
+ /* Offset 7 gives the best switch position. */
+ switch (name[7]) {
+ case 'G':
+ if (memEQ(name, "SO_DEBUG", 8)) {
+ /* ^ */
+#ifdef SO_DEBUG
+ *iv_return = SO_DEBUG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "MSG_WAITALL"))
-#ifdef MSG_WAITALL
- return MSG_WAITALL;
+ }
+ break;
+ case 'K':
+ if (memEQ(name, "MSG_PEEK", 8)) {
+ /* ^ */
+#if defined(MSG_PEEK) || defined(HAS_MSG_PEEK) /* might be an enum */
+ *iv_return = MSG_PEEK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'N':
- break;
- case 'O':
- break;
- case 'P':
- if (strEQ(name, "PF_802"))
-#ifdef PF_802
- return PF_802;
+ }
+ break;
+ case 'M':
+ if (memEQ(name, "SOCK_RDM", 8)) {
+ /* ^ */
+#ifdef SOCK_RDM
+ *iv_return = SOCK_RDM;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_APPLETALK"))
-#ifdef PF_APPLETALK
- return PF_APPLETALK;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "AF_GOSIP", 8)) {
+ /* ^ */
+#ifdef AF_GOSIP
+ *iv_return = AF_GOSIP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_CCITT"))
-#ifdef PF_CCITT
- return PF_CCITT;
+ }
+ if (memEQ(name, "PF_GOSIP", 8)) {
+ /* ^ */
+#ifdef PF_GOSIP
+ *iv_return = PF_GOSIP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_CHAOS"))
-#ifdef PF_CHAOS
- return PF_CHAOS;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "SO_ERROR", 8)) {
+ /* ^ */
+#ifdef SO_ERROR
+ *iv_return = SO_ERROR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_DATAKIT"))
-#ifdef PF_DATAKIT
- return PF_DATAKIT;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "AF_CHAOS", 8)) {
+ /* ^ */
+#ifdef AF_CHAOS
+ *iv_return = AF_CHAOS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_DECnet"))
-#ifdef PF_DECnet
- return PF_DECnet;
+ }
+ if (memEQ(name, "PF_CHAOS", 8)) {
+ /* ^ */
+#ifdef PF_CHAOS
+ *iv_return = PF_CHAOS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_DLI"))
-#ifdef PF_DLI
- return PF_DLI;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "AF_CCITT", 8)) {
+ /* ^ */
+#ifdef AF_CCITT
+ *iv_return = AF_CCITT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_ECMA"))
-#ifdef PF_ECMA
- return PF_ECMA;
+ }
+ if (memEQ(name, "PF_CCITT", 8)) {
+ /* ^ */
+#ifdef PF_CCITT
+ *iv_return = PF_CCITT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_GOSIP"))
-#ifdef PF_GOSIP
- return PF_GOSIP;
+ }
+ break;
+ case 'W':
+ if (memEQ(name, "SOCK_RAW", 8)) {
+ /* ^ */
+#ifdef SOCK_RAW
+ *iv_return = SOCK_RAW;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_HYLINK"))
-#ifdef PF_HYLINK
- return PF_HYLINK;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_9 (const char *name, IV *iv_return) {
+ /* Names all of length 9. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_DECnet AF_HYLINK AF_OSINET AF_UNSPEC MSG_BCAST MSG_MCAST MSG_PROXY
+ MSG_TRUNC PF_DECnet PF_HYLINK PF_OSINET PF_UNSPEC SCM_CREDS SHUT_RDWR
+ SOMAXCONN SO_LINGER SO_RCVBUF SO_SNDBUF TCP_MAXRT */
+ /* Offset 6 gives the best switch position. */
+ switch (name[6]) {
+ case 'A':
+ if (memEQ(name, "MSG_BCAST", 9)) {
+ /* ^ */
+#ifdef MSG_BCAST
+ *iv_return = MSG_BCAST;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_IMPLINK"))
-#ifdef PF_IMPLINK
- return PF_IMPLINK;
+ }
+ if (memEQ(name, "MSG_MCAST", 9)) {
+ /* ^ */
+#ifdef MSG_MCAST
+ *iv_return = MSG_MCAST;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_INET"))
-#ifdef PF_INET
- return PF_INET;
+ }
+ break;
+ case 'B':
+ if (memEQ(name, "SO_RCVBUF", 9)) {
+ /* ^ */
+#ifdef SO_RCVBUF
+ *iv_return = SO_RCVBUF;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_LAT"))
-#ifdef PF_LAT
- return PF_LAT;
+ }
+ if (memEQ(name, "SO_SNDBUF", 9)) {
+ /* ^ */
+#ifdef SO_SNDBUF
+ *iv_return = SO_SNDBUF;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_MAX"))
-#ifdef PF_MAX
- return PF_MAX;
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "SHUT_RDWR", 9)) {
+ /* ^ */
+#ifdef SHUT_RDWR
+ *iv_return = SHUT_RDWR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ *iv_return = 2;
+ return PERL_constant_ISIV;
#endif
- if (strEQ(name, "PF_NBS"))
-#ifdef PF_NBS
- return PF_NBS;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "SCM_CREDS", 9)) {
+ /* ^ */
+#ifdef SCM_CREDS
+ *iv_return = SCM_CREDS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_NIT"))
-#ifdef PF_NIT
- return PF_NIT;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "SO_LINGER", 9)) {
+ /* ^ */
+#ifdef SO_LINGER
+ *iv_return = SO_LINGER;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_NS"))
-#ifdef PF_NS
- return PF_NS;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "AF_HYLINK", 9)) {
+ /* ^ */
+#ifdef AF_HYLINK
+ *iv_return = AF_HYLINK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_OSI"))
-#ifdef PF_OSI
- return PF_OSI;
+ }
+ if (memEQ(name, "PF_HYLINK", 9)) {
+ /* ^ */
+#ifdef PF_HYLINK
+ *iv_return = PF_HYLINK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_OSINET"))
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "AF_OSINET", 9)) {
+ /* ^ */
+#ifdef AF_OSINET
+ *iv_return = AF_OSINET;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ if (memEQ(name, "PF_OSINET", 9)) {
+ /* ^ */
#ifdef PF_OSINET
- return PF_OSINET;
+ *iv_return = PF_OSINET;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_PUP"))
-#ifdef PF_PUP
- return PF_PUP;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "MSG_PROXY", 9)) {
+ /* ^ */
+#if defined(MSG_PROXY) || defined(HAS_MSG_PROXY) /* might be an enum */
+ *iv_return = MSG_PROXY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_SNA"))
-#ifdef PF_SNA
- return PF_SNA;
+ }
+ if (memEQ(name, "SOMAXCONN", 9)) {
+ /* ^ */
+#ifdef SOMAXCONN
+ *iv_return = SOMAXCONN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_UNIX"))
-#ifdef PF_UNIX
- return PF_UNIX;
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "AF_UNSPEC", 9)) {
+ /* ^ */
+#ifdef AF_UNSPEC
+ *iv_return = AF_UNSPEC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_UNSPEC"))
+ }
+ if (memEQ(name, "PF_UNSPEC", 9)) {
+ /* ^ */
#ifdef PF_UNSPEC
- return PF_UNSPEC;
+ *iv_return = PF_UNSPEC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "PF_X25"))
-#ifdef PF_X25
- return PF_X25;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "MSG_TRUNC", 9)) {
+ /* ^ */
+#ifdef MSG_TRUNC
+ *iv_return = MSG_TRUNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'Q':
- break;
- case 'R':
- break;
- case 'S':
- if (strEQ(name, "SCM_CONNECT"))
-#ifdef SCM_CONNECT
- return SCM_CONNECT;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "TCP_MAXRT", 9)) {
+ /* ^ */
+#ifdef TCP_MAXRT
+ *iv_return = TCP_MAXRT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SCM_CREDENTIALS"))
-#ifdef SCM_CREDENTIALS
- return SCM_CREDENTIALS;
+ }
+ break;
+ case 'n':
+ if (memEQ(name, "AF_DECnet", 9)) {
+ /* ^ */
+#ifdef AF_DECnet
+ *iv_return = AF_DECnet;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SCM_CREDS"))
-#ifdef SCM_CREDS
- return SCM_CREDS;
+ }
+ if (memEQ(name, "PF_DECnet", 9)) {
+ /* ^ */
+#ifdef PF_DECnet
+ *iv_return = PF_DECnet;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SCM_RIGHTS"))
-#if defined(SCM_RIGHTS) || defined(HAS_SCM_RIGHTS) /* might be an enum */
- return SCM_RIGHTS;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_10 (const char *name, IV *iv_return) {
+ /* Names all of length 10. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_DATAKIT AF_IMPLINK MSG_CTRUNC PF_DATAKIT PF_IMPLINK SCM_RIGHTS
+ SOCK_DGRAM SOL_SOCKET TCP_MAXSEG TCP_STDURG UIO_MAXIOV */
+ /* Offset 6 gives the best switch position. */
+ switch (name[6]) {
+ case 'A':
+ if (memEQ(name, "AF_DATAKIT", 10)) {
+ /* ^ */
+#ifdef AF_DATAKIT
+ *iv_return = AF_DATAKIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SCM_TIMESTAMP"))
-#ifdef SCM_TIMESTAMP
- return SCM_TIMESTAMP;
+ }
+ if (memEQ(name, "PF_DATAKIT", 10)) {
+ /* ^ */
+#ifdef PF_DATAKIT
+ *iv_return = PF_DATAKIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SHUT_RD"))
-#ifdef SHUT_RD
- return SHUT_RD;
+ }
+ break;
+ case 'C':
+ if (memEQ(name, "SOL_SOCKET", 10)) {
+ /* ^ */
+#ifdef SOL_SOCKET
+ *iv_return = SOL_SOCKET;
+ return PERL_constant_ISIV;
#else
- return 0;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SHUT_RDWR"))
-#ifdef SHUT_RDWR
- return SHUT_RDWR;
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "TCP_STDURG", 10)) {
+ /* ^ */
+#ifdef TCP_STDURG
+ *iv_return = TCP_STDURG;
+ return PERL_constant_ISIV;
#else
- return 2;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SHUT_WR"))
-#ifdef SHUT_WR
- return SHUT_WR;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "SCM_RIGHTS", 10)) {
+ /* ^ */
+#if defined(SCM_RIGHTS) || defined(HAS_SCM_RIGHTS) /* might be an enum */
+ *iv_return = SCM_RIGHTS;
+ return PERL_constant_ISIV;
#else
- return 1;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOCK_DGRAM"))
+ }
+ if (memEQ(name, "SOCK_DGRAM", 10)) {
+ /* ^ */
#ifdef SOCK_DGRAM
- return SOCK_DGRAM;
+ *iv_return = SOCK_DGRAM;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOCK_RAW"))
-#ifdef SOCK_RAW
- return SOCK_RAW;
+ }
+ break;
+ case 'L':
+ if (memEQ(name, "AF_IMPLINK", 10)) {
+ /* ^ */
+#ifdef AF_IMPLINK
+ *iv_return = AF_IMPLINK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOCK_RDM"))
-#ifdef SOCK_RDM
- return SOCK_RDM;
+ }
+ if (memEQ(name, "PF_IMPLINK", 10)) {
+ /* ^ */
+#ifdef PF_IMPLINK
+ *iv_return = PF_IMPLINK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOCK_SEQPACKET"))
-#ifdef SOCK_SEQPACKET
- return SOCK_SEQPACKET;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "MSG_CTRUNC", 10)) {
+ /* ^ */
+#if defined(MSG_CTRUNC) || defined(HAS_MSG_CTRUNC) /* might be an enum */
+ *iv_return = MSG_CTRUNC;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOCK_STREAM"))
-#ifdef SOCK_STREAM
- return SOCK_STREAM;
+ }
+ break;
+ case 'X':
+ if (memEQ(name, "TCP_MAXSEG", 10)) {
+ /* ^ */
+#ifdef TCP_MAXSEG
+ *iv_return = TCP_MAXSEG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOL_SOCKET"))
-#ifdef SOL_SOCKET
- return SOL_SOCKET;
+ }
+ if (memEQ(name, "UIO_MAXIOV", 10)) {
+ /* ^ */
+#ifdef UIO_MAXIOV
+ *iv_return = UIO_MAXIOV;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SOMAXCONN"))
-#ifdef SOMAXCONN
- return SOMAXCONN;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_11 (const char *name, IV *iv_return) {
+ /* Names all of length 11. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ IPPROTO_TCP MSG_WAITALL SCM_CONNECT SOCK_STREAM SO_RCVLOWAT SO_RCVTIMEO
+ SO_SNDLOWAT SO_SNDTIMEO TCP_NODELAY */
+ /* Offset 7 gives the best switch position. */
+ switch (name[7]) {
+ case 'E':
+ if (memEQ(name, "TCP_NODELAY", 11)) {
+ /* ^ */
+#ifdef TCP_NODELAY
+ *iv_return = TCP_NODELAY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_ACCEPTCONN"))
-#ifdef SO_ACCEPTCONN
- return SO_ACCEPTCONN;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "SO_RCVTIMEO", 11)) {
+ /* ^ */
+#ifdef SO_RCVTIMEO
+ *iv_return = SO_RCVTIMEO;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_BROADCAST"))
-#ifdef SO_BROADCAST
- return SO_BROADCAST;
+ }
+ if (memEQ(name, "SO_SNDTIMEO", 11)) {
+ /* ^ */
+#ifdef SO_SNDTIMEO
+ *iv_return = SO_SNDTIMEO;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_DEBUG"))
-#ifdef SO_DEBUG
- return SO_DEBUG;
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "SCM_CONNECT", 11)) {
+ /* ^ */
+#ifdef SCM_CONNECT
+ *iv_return = SCM_CONNECT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_DONTLINGER"))
-#ifdef SO_DONTLINGER
- return SO_DONTLINGER;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "SO_RCVLOWAT", 11)) {
+ /* ^ */
+#ifdef SO_RCVLOWAT
+ *iv_return = SO_RCVLOWAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_DONTROUTE"))
-#ifdef SO_DONTROUTE
- return SO_DONTROUTE;
+ }
+ if (memEQ(name, "SO_SNDLOWAT", 11)) {
+ /* ^ */
+#ifdef SO_SNDLOWAT
+ *iv_return = SO_SNDLOWAT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_ERROR"))
-#ifdef SO_ERROR
- return SO_ERROR;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "SOCK_STREAM", 11)) {
+ /* ^ */
+#ifdef SOCK_STREAM
+ *iv_return = SOCK_STREAM;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_KEEPALIVE"))
-#ifdef SO_KEEPALIVE
- return SO_KEEPALIVE;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "MSG_WAITALL", 11)) {
+ /* ^ */
+#ifdef MSG_WAITALL
+ *iv_return = MSG_WAITALL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_LINGER"))
-#ifdef SO_LINGER
- return SO_LINGER;
+ }
+ break;
+ case '_':
+ if (memEQ(name, "IPPROTO_TCP", 11)) {
+ /* ^ */
+#ifdef IPPROTO_TCP
+ *iv_return = IPPROTO_TCP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_OOBINLINE"))
-#ifdef SO_OOBINLINE
- return SO_OOBINLINE;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_12 (const char *name, IV *iv_return) {
+ /* Names all of length 12. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ AF_APPLETALK MSG_CTLFLAGS MSG_DONTWAIT MSG_ERRQUEUE MSG_NOSIGNAL
+ PF_APPLETALK SO_BROADCAST SO_DONTROUTE SO_KEEPALIVE SO_OOBINLINE
+ SO_REUSEADDR SO_REUSEPORT */
+ /* Offset 10 gives the best switch position. */
+ switch (name[10]) {
+ case 'A':
+ if (memEQ(name, "MSG_NOSIGNAL", 12)) {
+ /* ^ */
+#ifdef MSG_NOSIGNAL
+ *iv_return = MSG_NOSIGNAL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_RCVBUF"))
-#ifdef SO_RCVBUF
- return SO_RCVBUF;
+ }
+ break;
+ case 'D':
+ if (memEQ(name, "SO_REUSEADDR", 12)) {
+ /* ^ */
+#ifdef SO_REUSEADDR
+ *iv_return = SO_REUSEADDR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_RCVLOWAT"))
-#ifdef SO_RCVLOWAT
- return SO_RCVLOWAT;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "MSG_CTLFLAGS", 12)) {
+ /* ^ */
+#ifdef MSG_CTLFLAGS
+ *iv_return = MSG_CTLFLAGS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_RCVTIMEO"))
-#ifdef SO_RCVTIMEO
- return SO_RCVTIMEO;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "MSG_DONTWAIT", 12)) {
+ /* ^ */
+#ifdef MSG_DONTWAIT
+ *iv_return = MSG_DONTWAIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_REUSEADDR"))
-#ifdef SO_REUSEADDR
- return SO_REUSEADDR;
+ }
+ break;
+ case 'L':
+ if (memEQ(name, "AF_APPLETALK", 12)) {
+ /* ^ */
+#ifdef AF_APPLETALK
+ *iv_return = AF_APPLETALK;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ if (memEQ(name, "PF_APPLETALK", 12)) {
+ /* ^ */
+#ifdef PF_APPLETALK
+ *iv_return = PF_APPLETALK;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "SO_OOBINLINE", 12)) {
+ /* ^ */
+#ifdef SO_OOBINLINE
+ *iv_return = SO_OOBINLINE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_REUSEPORT"))
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "SO_REUSEPORT", 12)) {
+ /* ^ */
#ifdef SO_REUSEPORT
- return SO_REUSEPORT;
+ *iv_return = SO_REUSEPORT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_SNDBUF"))
-#ifdef SO_SNDBUF
- return SO_SNDBUF;
+ }
+ break;
+ case 'S':
+ if (memEQ(name, "SO_BROADCAST", 12)) {
+ /* ^ */
+#ifdef SO_BROADCAST
+ *iv_return = SO_BROADCAST;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_SNDLOWAT"))
-#ifdef SO_SNDLOWAT
- return SO_SNDLOWAT;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "SO_DONTROUTE", 12)) {
+ /* ^ */
+#ifdef SO_DONTROUTE
+ *iv_return = SO_DONTROUTE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_SNDTIMEO"))
-#ifdef SO_SNDTIMEO
- return SO_SNDTIMEO;
+ }
+ break;
+ case 'U':
+ if (memEQ(name, "MSG_ERRQUEUE", 12)) {
+ /* ^ */
+#ifdef MSG_ERRQUEUE
+ *iv_return = MSG_ERRQUEUE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_TYPE"))
-#ifdef SO_TYPE
- return SO_TYPE;
+ }
+ break;
+ case 'V':
+ if (memEQ(name, "SO_KEEPALIVE", 12)) {
+ /* ^ */
+#ifdef SO_KEEPALIVE
+ *iv_return = SO_KEEPALIVE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "SO_USELOOPBACK"))
-#ifdef SO_USELOOPBACK
- return SO_USELOOPBACK;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_13 (const char *name, IV *iv_return) {
+ /* Names all of length 13. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ MSG_CTLIGNORE MSG_DONTROUTE MSG_MAXIOVLEN SCM_TIMESTAMP SO_ACCEPTCONN
+ SO_DONTLINGER TCP_KEEPALIVE */
+ /* Offset 5 gives the best switch position. */
+ switch (name[5]) {
+ case 'A':
+ if (memEQ(name, "MSG_MAXIOVLEN", 13)) {
+ /* ^ */
+#ifdef MSG_MAXIOVLEN
+ *iv_return = MSG_MAXIOVLEN;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 'C':
+ if (memEQ(name, "SO_ACCEPTCONN", 13)) {
+ /* ^ */
+#ifdef SO_ACCEPTCONN
+ *iv_return = SO_ACCEPTCONN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'T':
- if (strEQ(name, "TCP_KEEPALIVE"))
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "TCP_KEEPALIVE", 13)) {
+ /* ^ */
#ifdef TCP_KEEPALIVE
- return TCP_KEEPALIVE;
+ *iv_return = TCP_KEEPALIVE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TCP_MAXRT"))
-#ifdef TCP_MAXRT
- return TCP_MAXRT;
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "SCM_TIMESTAMP", 13)) {
+ /* ^ */
+#ifdef SCM_TIMESTAMP
+ *iv_return = SCM_TIMESTAMP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TCP_MAXSEG"))
-#ifdef TCP_MAXSEG
- return TCP_MAXSEG;
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "SO_DONTLINGER", 13)) {
+ /* ^ */
+#ifdef SO_DONTLINGER
+ *iv_return = SO_DONTLINGER;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TCP_NODELAY"))
-#ifdef TCP_NODELAY
- return TCP_NODELAY;
+ }
+ break;
+ case 'O':
+ if (memEQ(name, "MSG_DONTROUTE", 13)) {
+ /* ^ */
+#if defined(MSG_DONTROUTE) || defined(HAS_MSG_DONTROUTE) /* might be an enum */
+ *iv_return = MSG_DONTROUTE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- if (strEQ(name, "TCP_STDURG"))
-#ifdef TCP_STDURG
- return TCP_STDURG;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "MSG_CTLIGNORE", 13)) {
+ /* ^ */
+#ifdef MSG_CTLIGNORE
+ *iv_return = MSG_CTLIGNORE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- break;
- case 'U':
- if (strEQ(name, "UIO_MAXIOV"))
-#ifdef UIO_MAXIOV
- return UIO_MAXIOV;
-#else
- goto not_there;
-#endif
- break;
- case 'V':
- break;
- case 'W':
- break;
- case 'X':
- break;
- case 'Y':
- break;
- case 'Z':
- break;
- }
- errno = EINVAL;
- return 0;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_14 (const char *name, IV *iv_return) {
+ /* Names all of length 14. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ SOCK_SEQPACKET SO_USELOOPBACK */
+ /* Offset 8 gives the best switch position. */
+ switch (name[8]) {
+ case 'O':
+ if (memEQ(name, "SO_USELOOPBACK", 14)) {
+ /* ^ */
+#ifdef SO_USELOOPBACK
+ *iv_return = SO_USELOOPBACK;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "SOCK_SEQPACKET", 14)) {
+ /* ^ */
+#ifdef SOCK_SEQPACKET
+ *iv_return = SOCK_SEQPACKET;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant (const char *name, STRLEN len, IV *iv_return) {
+ /* Initially switch on the length of the name. */
+ /* When generated this function returned values for the list of names given
+ in this section of perl code. Rather than manually editing these functions
+ to add or remove constants, which would result in this comment and section
+ of code becoming inaccurate, we recommend that you edit this section of
+ code, and use it to regenerate a new set of constant functions which you
+ then use to replace the originals.
-not_there:
- errno = ENOENT;
- return 0;
+ Regenerate these constant functions by feeding this entire source file to
+ perl -x
+
+#!perl -w
+use ExtUtils::Constant qw (constant_types C_constant XS_constant);
+
+my $types = {IV => 1};
+my @names = (qw(AF_802 AF_APPLETALK AF_CCITT AF_CHAOS AF_DATAKIT AF_DECnet
+ AF_DLI AF_ECMA AF_GOSIP AF_HYLINK AF_IMPLINK AF_INET AF_LAT
+ AF_MAX AF_NBS AF_NIT AF_NS AF_OSI AF_OSINET AF_PUP AF_SNA
+ AF_UNIX AF_UNSPEC AF_X25 IOV_MAX IPPROTO_TCP MSG_BCAST
+ MSG_CTLFLAGS MSG_CTLIGNORE MSG_DONTWAIT MSG_EOF MSG_EOR
+ MSG_ERRQUEUE MSG_FIN MSG_MAXIOVLEN MSG_MCAST MSG_NOSIGNAL
+ MSG_RST MSG_SYN MSG_TRUNC MSG_WAITALL PF_802 PF_APPLETALK
+ PF_CCITT PF_CHAOS PF_DATAKIT PF_DECnet PF_DLI PF_ECMA PF_GOSIP
+ PF_HYLINK PF_IMPLINK PF_INET PF_LAT PF_MAX PF_NBS PF_NIT PF_NS
+ PF_OSI PF_OSINET PF_PUP PF_SNA PF_UNIX PF_UNSPEC PF_X25
+ SCM_CONNECT SCM_CREDENTIALS SCM_CREDS SCM_TIMESTAMP SOCK_DGRAM
+ SOCK_RAW SOCK_RDM SOCK_SEQPACKET SOCK_STREAM SOL_SOCKET
+ SOMAXCONN SO_ACCEPTCONN SO_BROADCAST SO_DEBUG SO_DONTLINGER
+ SO_DONTROUTE SO_ERROR SO_KEEPALIVE SO_LINGER SO_OOBINLINE
+ SO_RCVBUF SO_RCVLOWAT SO_RCVTIMEO SO_REUSEADDR SO_REUSEPORT
+ SO_SNDBUF SO_SNDLOWAT SO_SNDTIMEO SO_TYPE SO_USELOOPBACK
+ TCP_KEEPALIVE TCP_MAXRT TCP_MAXSEG TCP_NODELAY TCP_STDURG
+ UIO_MAXIOV MSG_URG),
+ {name=>"MSG_CTRUNC", type=>"IV", macro=>["#if defined(MSG_CTRUNC) || defined(HAS_MSG_CTRUNC) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"MSG_DONTROUTE", type=>"IV", macro=>["#if defined(MSG_DONTROUTE) || defined(HAS_MSG_DONTROUTE) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"MSG_OOB", type=>"IV", macro=>["#if defined(MSG_OOB) || defined(HAS_MSG_OOB) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"MSG_PEEK", type=>"IV", macro=>["#if defined(MSG_PEEK) || defined(HAS_MSG_PEEK) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"MSG_PROXY", type=>"IV", macro=>["#if defined(MSG_PROXY) || defined(HAS_MSG_PROXY) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"SCM_RIGHTS", type=>"IV", macro=>["#if defined(SCM_RIGHTS) || defined(HAS_SCM_RIGHTS) /* might be an enum *" . "/\n", "#endif\n"]},
+ {name=>"SHUT_RD", type=>"IV", default=>["IV", "0"]},
+ {name=>"SHUT_RDWR", type=>"IV", default=>["IV", "2"]},
+ {name=>"SHUT_WR", type=>"IV", default=>["IV", "1"]});
+
+print constant_types(); # macro defs
+foreach (C_constant ("Socket", 'constant', 'IV', $types, undef, undef, @names) ) {
+ print $_, "\n"; # C constant subs
}
+print "#### XS Section:\n";
+print XS_constant ("Socket", $types);
+__END__
+ */
+ switch (len) {
+ case 5:
+ return constant_5 (name, iv_return);
+ break;
+ case 6:
+ return constant_6 (name, iv_return);
+ break;
+ case 7:
+ return constant_7 (name, iv_return);
+ break;
+ case 8:
+ return constant_8 (name, iv_return);
+ break;
+ case 9:
+ return constant_9 (name, iv_return);
+ break;
+ case 10:
+ return constant_10 (name, iv_return);
+ break;
+ case 11:
+ return constant_11 (name, iv_return);
+ break;
+ case 12:
+ return constant_12 (name, iv_return);
+ break;
+ case 13:
+ return constant_13 (name, iv_return);
+ break;
+ case 14:
+ return constant_14 (name, iv_return);
+ break;
+ case 15:
+ if (memEQ(name, "SCM_CREDENTIALS", 15)) {
+#ifdef SCM_CREDENTIALS
+ *iv_return = SCM_CREDENTIALS;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
-MODULE = Socket PACKAGE = Socket
-double
-constant(name,arg)
- char * name
- int arg
+MODULE = Socket PACKAGE = Socket
+void
+constant(sv)
+ PREINIT:
+#ifdef dXSTARG
+ dXSTARG; /* Faster if we have it. */
+#else
+ dTARGET;
+#endif
+ STRLEN len;
+ int type;
+ IV iv;
+ /* NV nv; Uncomment this if you need to return NVs */
+ /* const char *pv; Uncomment this if you need to return PVs */
+ INPUT:
+ SV * sv;
+ const char * s = SvPV(sv, len);
+ PPCODE:
+ /* Change this to constant(s, len, &iv, &nv);
+ if you need to return both NVs and IVs */
+ type = constant(s, len, &iv);
+ /* Return 1 or 2 items. First is error message, or undef if no error.
+ Second, if present, is found value */
+ switch (type) {
+ case PERL_constant_NOTFOUND:
+ sv = sv_2mortal(newSVpvf("%s is not a valid Socket macro", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_NOTDEF:
+ sv = sv_2mortal(newSVpvf(
+ "Your vendor has not defined Socket macro %s, used", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_ISIV:
+ EXTEND(SP, 1);
+ PUSHs(&PL_sv_undef);
+ PUSHi(iv);
+ break;
+ /* Uncomment this if you need to return UVs
+ case PERL_constant_ISUV:
+ EXTEND(SP, 1);
+ PUSHs(&PL_sv_undef);
+ PUSHu((UV)iv);
+ break; */
+ default:
+ sv = sv_2mortal(newSVpvf(
+ "Unexpected return type %d while processing Socket macro %s used",
+ type, s));
+ PUSHs(sv);
+ }
void
inet_aton(host)
#include <syslog.h>
#endif
-static double
-constant_LOG_NO(char *name, int len)
-{
- switch (name[6 + 0]) {
- case 'T':
- if (strEQ(name + 6, "TICE")) { /* "LOG_NO" removed */
-#ifdef LOG_NOTICE
- return LOG_NOTICE;
-#else
- goto not_there;
-#endif
- }
- case 'W':
- if (strEQ(name + 6, "WAIT")) { /* "LOG_NO" removed */
-#ifdef LOG_NOWAIT
- return LOG_NOWAIT;
+#define PERL_constant_NOTFOUND 1
+#define PERL_constant_NOTDEF 2
+#define PERL_constant_ISIV 3
+#define PERL_constant_ISNV 4
+#define PERL_constant_ISPV 5
+#define PERL_constant_ISPVN 6
+#define PERL_constant_ISUV 7
+
+#ifndef NVTYPE
+typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
+#endif
+
+static int
+constant_7 (const char *name, IV *iv_return) {
+ /* Names all of length 7. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ LOG_ERR LOG_FTP LOG_LPR LOG_PID */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'E':
+ if (memEQ(name, "LOG_ERR", 7)) {
+ /* ^ */
+#ifdef LOG_ERR
+ *iv_return = LOG_ERR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_NOTICE) || !defined(LOG_NOWAIT)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_N(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'D':
- if (strEQ(name + 5, "DELAY")) { /* "LOG_N" removed */
-#ifdef LOG_NDELAY
- return LOG_NDELAY;
-#else
- goto not_there;
-#endif
- }
- case 'E':
- if (strEQ(name + 5, "EWS")) { /* "LOG_N" removed */
-#ifdef LOG_NEWS
- return LOG_NEWS;
-#else
- goto not_there;
-#endif
- }
- case 'F':
- if (strEQ(name + 5, "FACILITIES")) { /* "LOG_N" removed */
-#ifdef LOG_NFACILITIES
- return LOG_NFACILITIES;
+ break;
+ case 'F':
+ if (memEQ(name, "LOG_FTP", 7)) {
+ /* ^ */
+#ifdef LOG_FTP
+ *iv_return = LOG_FTP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'O':
- return constant_LOG_NO(name, len);
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_NDELAY) || !defined(LOG_NEWS) || !defined(LOG_NFACILITIES)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_P(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'E':
- if (strEQ(name + 5, "ERROR")) { /* "LOG_P" removed */
-#ifdef LOG_PERROR
- return LOG_PERROR;
+ break;
+ case 'L':
+ if (memEQ(name, "LOG_LPR", 7)) {
+ /* ^ */
+#ifdef LOG_LPR
+ *iv_return = LOG_LPR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'I':
- if (strEQ(name + 5, "ID")) { /* "LOG_P" removed */
+ }
+ break;
+ case 'P':
+ if (memEQ(name, "LOG_PID", 7)) {
+ /* ^ */
#ifdef LOG_PID
- return LOG_PID;
+ *iv_return = LOG_PID;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'R':
- if (strEQ(name + 5, "RIMASK")) { /* "LOG_P" removed */
-#ifdef LOG_PRIMASK
- return LOG_PRIMASK;
-#else
- goto not_there;
-#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_PERROR) || !defined(LOG_PID) || !defined(LOG_PRIMASK)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
+ break;
+ }
+ return PERL_constant_NOTFOUND;
}
-static double
-constant_LOG_AU(char *name, int len)
-{
- if (6 + 2 > len ) {
- errno = EINVAL;
- return 0;
- }
- switch (name[6 + 2]) {
- case '\0':
- if (strEQ(name + 6, "TH")) { /* "LOG_AU" removed */
-#ifdef LOG_AUTH
- return LOG_AUTH;
+static int
+constant_8 (const char *name, IV *iv_return) {
+ /* Names all of length 8. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ LOG_AUTH LOG_CONS LOG_CRIT LOG_CRON LOG_INFO LOG_KERN LOG_LFMT LOG_MAIL
+ LOG_NEWS LOG_USER LOG_UUCP */
+ /* Offset 6 gives the best switch position. */
+ switch (name[6]) {
+ case 'C':
+ if (memEQ(name, "LOG_UUCP", 8)) {
+ /* ^ */
+#ifdef LOG_UUCP
+ *iv_return = LOG_UUCP;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'P':
- if (strEQ(name + 6, "THPRIV")) { /* "LOG_AU" removed */
-#ifdef LOG_AUTHPRIV
- return LOG_AUTHPRIV;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "LOG_USER", 8)) {
+ /* ^ */
+#ifdef LOG_USER
+ *iv_return = LOG_USER;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_AUTH) || !defined(LOG_AUTHPRIV)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_A(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'L':
- if (strEQ(name + 5, "LERT")) { /* "LOG_A" removed */
-#ifdef LOG_ALERT
- return LOG_ALERT;
+ break;
+ case 'F':
+ if (memEQ(name, "LOG_INFO", 8)) {
+ /* ^ */
+#ifdef LOG_INFO
+ *iv_return = LOG_INFO;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'U':
- return constant_LOG_AU(name, len);
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_ALERT)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_CR(char *name, int len)
-{
- switch (name[6 + 0]) {
- case 'I':
- if (strEQ(name + 6, "IT")) { /* "LOG_CR" removed */
+ break;
+ case 'I':
+ if (memEQ(name, "LOG_CRIT", 8)) {
+ /* ^ */
#ifdef LOG_CRIT
- return LOG_CRIT;
+ *iv_return = LOG_CRIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'O':
- if (strEQ(name + 6, "ON")) { /* "LOG_CR" removed */
-#ifdef LOG_CRON
- return LOG_CRON;
+ }
+ if (memEQ(name, "LOG_MAIL", 8)) {
+ /* ^ */
+#ifdef LOG_MAIL
+ *iv_return = LOG_MAIL;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_CRIT) || !defined(LOG_CRON)
-not_there:
- errno = ENOENT;
- return 0;
+ break;
+ case 'M':
+ if (memEQ(name, "LOG_LFMT", 8)) {
+ /* ^ */
+#ifdef LOG_LFMT
+ *iv_return = LOG_LFMT;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
#endif
-}
-
-static double
-constant_LOG_C(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'O':
- if (strEQ(name + 5, "ONS")) { /* "LOG_C" removed */
+ }
+ break;
+ case 'N':
+ if (memEQ(name, "LOG_CONS", 8)) {
+ /* ^ */
#ifdef LOG_CONS
- return LOG_CONS;
+ *iv_return = LOG_CONS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'R':
- return constant_LOG_CR(name, len);
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_CONS)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_D(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'A':
- if (strEQ(name + 5, "AEMON")) { /* "LOG_D" removed */
-#ifdef LOG_DAEMON
- return LOG_DAEMON;
+ break;
+ case 'O':
+ if (memEQ(name, "LOG_CRON", 8)) {
+ /* ^ */
+#ifdef LOG_CRON
+ *iv_return = LOG_CRON;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'E':
- if (strEQ(name + 5, "EBUG")) { /* "LOG_D" removed */
-#ifdef LOG_DEBUG
- return LOG_DEBUG;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "LOG_KERN", 8)) {
+ /* ^ */
+#ifdef LOG_KERN
+ *iv_return = LOG_KERN;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_DAEMON) || !defined(LOG_DEBUG)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_U(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'S':
- if (strEQ(name + 5, "SER")) { /* "LOG_U" removed */
-#ifdef LOG_USER
- return LOG_USER;
+ break;
+ case 'T':
+ if (memEQ(name, "LOG_AUTH", 8)) {
+ /* ^ */
+#ifdef LOG_AUTH
+ *iv_return = LOG_AUTH;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'U':
- if (strEQ(name + 5, "UCP")) { /* "LOG_U" removed */
-#ifdef LOG_UUCP
- return LOG_UUCP;
+ }
+ break;
+ case 'W':
+ if (memEQ(name, "LOG_NEWS", 8)) {
+ /* ^ */
+#ifdef LOG_NEWS
+ *iv_return = LOG_NEWS;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_USER) || !defined(LOG_UUCP)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
+ break;
+ }
+ return PERL_constant_NOTFOUND;
}
-static double
-constant_LOG_E(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'M':
- if (strEQ(name + 5, "MERG")) { /* "LOG_E" removed */
-#ifdef LOG_EMERG
- return LOG_EMERG;
-#else
- goto not_there;
-#endif
- }
- case 'R':
- if (strEQ(name + 5, "RR")) { /* "LOG_E" removed */
-#ifdef LOG_ERR
- return LOG_ERR;
+static int
+constant_9 (const char *name, IV *iv_return) {
+ /* Names all of length 9. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ LOG_ALERT LOG_DEBUG LOG_EMERG */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'A':
+ if (memEQ(name, "LOG_ALERT", 9)) {
+ /* ^ */
+#ifdef LOG_ALERT
+ *iv_return = LOG_ALERT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_EMERG) || !defined(LOG_ERR)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_F(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'A':
- if (strEQ(name + 5, "ACMASK")) { /* "LOG_F" removed */
-#ifdef LOG_FACMASK
- return LOG_FACMASK;
+ break;
+ case 'D':
+ if (memEQ(name, "LOG_DEBUG", 9)) {
+ /* ^ */
+#ifdef LOG_DEBUG
+ *iv_return = LOG_DEBUG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'T':
- if (strEQ(name + 5, "TP")) { /* "LOG_F" removed */
-#ifdef LOG_FTP
- return LOG_FTP;
+ }
+ break;
+ case 'E':
+ if (memEQ(name, "LOG_EMERG", 9)) {
+ /* ^ */
+#ifdef LOG_EMERG
+ *iv_return = LOG_EMERG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_FACMASK) || !defined(LOG_FTP)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
+ break;
+ }
+ return PERL_constant_NOTFOUND;
}
-static double
-constant_LOG_LO(char *name, int len)
-{
- if (6 + 3 >= len ) {
- errno = EINVAL;
- return 0;
- }
- switch (name[6 + 3]) {
- case '0':
- if (strEQ(name + 6, "CAL0")) { /* "LOG_LO" removed */
+static int
+constant_10 (const char *name, IV *iv_return) {
+ /* Names all of length 10. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ LOG_DAEMON LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4
+ LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_NDELAY LOG_NOTICE LOG_NOWAIT
+ LOG_ODELAY LOG_PERROR LOG_SYSLOG */
+ /* Offset 9 gives the best switch position. */
+ switch (name[9]) {
+ case '0':
+ if (memEQ(name, "LOG_LOCAL0", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL0
- return LOG_LOCAL0;
+ *iv_return = LOG_LOCAL0;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '1':
- if (strEQ(name + 6, "CAL1")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '1':
+ if (memEQ(name, "LOG_LOCAL1", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL1
- return LOG_LOCAL1;
+ *iv_return = LOG_LOCAL1;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '2':
- if (strEQ(name + 6, "CAL2")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '2':
+ if (memEQ(name, "LOG_LOCAL2", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL2
- return LOG_LOCAL2;
+ *iv_return = LOG_LOCAL2;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '3':
- if (strEQ(name + 6, "CAL3")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '3':
+ if (memEQ(name, "LOG_LOCAL3", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL3
- return LOG_LOCAL3;
+ *iv_return = LOG_LOCAL3;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '4':
- if (strEQ(name + 6, "CAL4")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '4':
+ if (memEQ(name, "LOG_LOCAL4", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL4
- return LOG_LOCAL4;
+ *iv_return = LOG_LOCAL4;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '5':
- if (strEQ(name + 6, "CAL5")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '5':
+ if (memEQ(name, "LOG_LOCAL5", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL5
- return LOG_LOCAL5;
+ *iv_return = LOG_LOCAL5;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '6':
- if (strEQ(name + 6, "CAL6")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '6':
+ if (memEQ(name, "LOG_LOCAL6", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL6
- return LOG_LOCAL6;
+ *iv_return = LOG_LOCAL6;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case '7':
- if (strEQ(name + 6, "CAL7")) { /* "LOG_LO" removed */
+ }
+ break;
+ case '7':
+ if (memEQ(name, "LOG_LOCAL7", 10)) {
+ /* ^ */
#ifdef LOG_LOCAL7
- return LOG_LOCAL7;
+ *iv_return = LOG_LOCAL7;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_LOCAL0) || !defined(LOG_LOCAL1) || !defined(LOG_LOCAL2) || !defined(LOG_LOCAL3) || !defined(LOG_LOCAL4) || !defined(LOG_LOCAL5) || !defined(LOG_LOCAL6) || !defined(LOG_LOCAL7)
-not_there:
- errno = ENOENT;
- return 0;
-#endif
-}
-
-static double
-constant_LOG_L(char *name, int len)
-{
- switch (name[5 + 0]) {
- case 'F':
- if (strEQ(name + 5, "FMT")) { /* "LOG_L" removed */
-#ifdef LOG_LFMT
- return LOG_LFMT;
+ break;
+ case 'E':
+ if (memEQ(name, "LOG_NOTICE", 10)) {
+ /* ^ */
+#ifdef LOG_NOTICE
+ *iv_return = LOG_NOTICE;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'O':
- return constant_LOG_LO(name, len);
- case 'P':
- if (strEQ(name + 5, "PR")) { /* "LOG_L" removed */
-#ifdef LOG_LPR
- return LOG_LPR;
+ }
+ break;
+ case 'G':
+ if (memEQ(name, "LOG_SYSLOG", 10)) {
+ /* ^ */
+#ifdef LOG_SYSLOG
+ *iv_return = LOG_SYSLOG;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
-
-#if !defined(LOG_LFMT) || !defined(LOG_LPR)
-not_there:
- errno = ENOENT;
- return 0;
+ break;
+ case 'N':
+ if (memEQ(name, "LOG_DAEMON", 10)) {
+ /* ^ */
+#ifdef LOG_DAEMON
+ *iv_return = LOG_DAEMON;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
#endif
-}
-
-static double
-constant(char *name, int len)
-{
- errno = 0;
- if (0 + 4 >= len ) {
- errno = EINVAL;
- return 0;
- }
- switch (name[0 + 4]) {
- case 'A':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_A(name, len);
- case 'C':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_C(name, len);
- case 'D':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_D(name, len);
- case 'E':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_E(name, len);
- case 'F':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_F(name, len);
- case 'I':
- if (strEQ(name + 0, "LOG_INFO")) { /* "" removed */
-#ifdef LOG_INFO
- return LOG_INFO;
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "LOG_PERROR", 10)) {
+ /* ^ */
+#ifdef LOG_PERROR
+ *iv_return = LOG_PERROR;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'K':
- if (strEQ(name + 0, "LOG_KERN")) { /* "" removed */
-#ifdef LOG_KERN
- return LOG_KERN;
+ }
+ break;
+ case 'T':
+ if (memEQ(name, "LOG_NOWAIT", 10)) {
+ /* ^ */
+#ifdef LOG_NOWAIT
+ *iv_return = LOG_NOWAIT;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'L':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_L(name, len);
- case 'M':
- if (strEQ(name + 0, "LOG_MAIL")) { /* "" removed */
-#ifdef LOG_MAIL
- return LOG_MAIL;
+ }
+ break;
+ case 'Y':
+ if (memEQ(name, "LOG_NDELAY", 10)) {
+ /* ^ */
+#ifdef LOG_NDELAY
+ *iv_return = LOG_NDELAY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'N':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_N(name, len);
- case 'O':
- if (strEQ(name + 0, "LOG_ODELAY")) { /* "" removed */
+ }
+ if (memEQ(name, "LOG_ODELAY", 10)) {
+ /* ^ */
#ifdef LOG_ODELAY
- return LOG_ODELAY;
+ *iv_return = LOG_ODELAY;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'P':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_P(name, len);
- case 'S':
- if (strEQ(name + 0, "LOG_SYSLOG")) { /* "" removed */
-#ifdef LOG_SYSLOG
- return LOG_SYSLOG;
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
+static int
+constant_11 (const char *name, IV *iv_return) {
+ /* Names all of length 11. */
+ /* When generated this function returned values for the list of names given
+ here. However, subsequent manual editing may have added or removed some.
+ LOG_FACMASK LOG_PRIMASK LOG_WARNING */
+ /* Offset 6 gives the best switch position. */
+ switch (name[6]) {
+ case 'C':
+ if (memEQ(name, "LOG_FACMASK", 11)) {
+ /* ^ */
+#ifdef LOG_FACMASK
+ *iv_return = LOG_FACMASK;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 'I':
+ if (memEQ(name, "LOG_PRIMASK", 11)) {
+ /* ^ */
+#ifdef LOG_PRIMASK
+ *iv_return = LOG_PRIMASK;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
- case 'U':
- if (!strnEQ(name + 0,"LOG_", 4))
- break;
- return constant_LOG_U(name, len);
- case 'W':
- if (strEQ(name + 0, "LOG_WARNING")) { /* "" removed */
+ }
+ break;
+ case 'R':
+ if (memEQ(name, "LOG_WARNING", 11)) {
+ /* ^ */
#ifdef LOG_WARNING
- return LOG_WARNING;
+ *iv_return = LOG_WARNING;
+ return PERL_constant_ISIV;
#else
- goto not_there;
+ return PERL_constant_NOTDEF;
#endif
- }
}
- errno = EINVAL;
- return 0;
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
-#if !defined(LOG_INFO) || !defined(LOG_KERN) || !defined(LOG_MAIL) || !defined(LOG_ODELAY) || !defined(LOG_SYSLOG) || !defined(LOG_WARNING)
-not_there:
- errno = ENOENT;
- return 0;
+static int
+constant (const char *name, STRLEN len, IV *iv_return) {
+ /* Initially switch on the length of the name. */
+ /* When generated this function returned values for the list of names given
+ in this section of perl code. Rather than manually editing these functions
+ to add or remove constants, which would result in this comment and section
+ of code becoming inaccurate, we recommend that you edit this section of
+ code, and use it to regenerate a new set of constant functions which you
+ then use to replace the originals.
+
+ Regenerate these constant functions by feeding this entire source file to
+ perl -x
+
+#!perl -w
+use ExtUtils::Constant qw (constant_types C_constant XS_constant);
+
+my $types = {IV => 1};
+my @names = (qw(LOG_ALERT LOG_AUTH LOG_AUTHPRIV LOG_CONS LOG_CRIT LOG_CRON
+ LOG_DAEMON LOG_DEBUG LOG_EMERG LOG_ERR LOG_FACMASK LOG_FTP
+ LOG_INFO LOG_KERN LOG_LFMT LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2
+ LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR
+ LOG_MAIL LOG_NDELAY LOG_NEWS LOG_NFACILITIES LOG_NOTICE
+ LOG_NOWAIT LOG_ODELAY LOG_PERROR LOG_PID LOG_PRIMASK LOG_SYSLOG
+ LOG_USER LOG_UUCP LOG_WARNING));
+
+print constant_types(); # macro defs
+foreach (C_constant ("Sys::Syslog", 'constant', 'IV', $types, undef, undef, @names) ) {
+ print $_, "\n"; # C constant subs
+}
+print "#### XS Section:\n";
+print XS_constant ("Sys::Syslog", $types);
+__END__
+ */
+
+ switch (len) {
+ case 7:
+ return constant_7 (name, iv_return);
+ break;
+ case 8:
+ return constant_8 (name, iv_return);
+ break;
+ case 9:
+ return constant_9 (name, iv_return);
+ break;
+ case 10:
+ return constant_10 (name, iv_return);
+ break;
+ case 11:
+ return constant_11 (name, iv_return);
+ break;
+ case 12:
+ if (memEQ(name, "LOG_AUTHPRIV", 12)) {
+#ifdef LOG_AUTHPRIV
+ *iv_return = LOG_AUTHPRIV;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 15:
+ if (memEQ(name, "LOG_NFACILITIES", 15)) {
+#ifdef LOG_NFACILITIES
+ *iv_return = LOG_NFACILITIES;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
#endif
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
}
-
MODULE = Sys::Syslog PACKAGE = Sys::Syslog
char *
RETVAL
-double
+void
constant(sv)
PREINIT:
+#ifdef dXSTARG
+ dXSTARG; /* Faster if we have it. */
+#else
+ dTARGET;
+#endif
STRLEN len;
+ int type;
+ IV iv;
+ /* NV nv; Uncomment this if you need to return NVs */
+ /* const char *pv; Uncomment this if you need to return PVs */
INPUT:
- SV * sv
- char * s = SvPV(sv, len);
- CODE:
- RETVAL = constant(s,len);
- OUTPUT:
- RETVAL
-
+ SV * sv;
+ const char * s = SvPV(sv, len);
+ PPCODE:
+ /* Change this to constant(s, len, &iv, &nv);
+ if you need to return both NVs and IVs */
+ type = constant(s, len, &iv);
+ /* Return 1 or 2 items. First is error message, or undef if no error.
+ Second, if present, is found value */
+ switch (type) {
+ case PERL_constant_NOTFOUND:
+ sv = sv_2mortal(newSVpvf("%s is not a valid Sys::Syslog macro", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_NOTDEF:
+ sv = sv_2mortal(newSVpvf(
+ "Your vendor has not defined Sys::Syslog macro %s used", s));
+ PUSHs(sv);
+ break;
+ case PERL_constant_ISIV:
+ EXTEND(SP, 1);
+ PUSHs(&PL_sv_undef);
+ PUSHi(iv);
+ break;
+ default:
+ sv = sv_2mortal(newSVpvf(
+ "Unexpected return type %d while processing Sys::Syslog macro %s used",
+ type, s));
+ PUSHs(sv);
+ }