mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
let the past begone in cvs land. welcome to igit igit!
This commit is contained in:
commit
4e601cf1c7
509 changed files with 77963 additions and 0 deletions
12
world/drivers/README
Normal file
12
world/drivers/README
Normal file
|
@ -0,0 +1,12 @@
|
|||
There is no psyclpc directory! Because psyclpc is a
|
||||
derivate of LDMUD and thus uses the ldmud/ subdirectory.
|
||||
|
||||
We are working to make psyced work with pike.
|
||||
Then again. Can't find the time.
|
||||
|
||||
psyced can run with amylaar up to a certain point.
|
||||
Not to be recommended.
|
||||
|
||||
MudOS and Nemesis drivers are currently not doing their job,
|
||||
but you can give it a try to work on it.
|
||||
|
13
world/drivers/amylaar/include/driver.h
Normal file
13
world/drivers/amylaar/include/driver.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#define _INCLUDE_DRIVER_H
|
||||
|
||||
// for debug outputs
|
||||
#define DRIVER_TYPE "amylaar"
|
||||
|
||||
// amylaar has closures
|
||||
#define DRIVER_HAS_CLOSURES
|
||||
|
||||
// amylaar introduced those ugly but runtime-effective closures
|
||||
#define DRIVER_HAS_LAMBDA_CLOSURES
|
||||
|
||||
// amylaar provides "compile_object" in master.c
|
||||
#define DRIVER_HAS_RENAMED_CLONES
|
54
world/drivers/amylaar/include/interface.h
Normal file
54
world/drivers/amylaar/include/interface.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#define _INCLUDE_INTERFACE_H
|
||||
|
||||
#define AMYLAAR
|
||||
|
||||
// manual change here.. hmmm
|
||||
#define DRIVER_VERSION "LPMUD/3.2.1.125"
|
||||
|
||||
// driver abstraction kit -- abstraction layer from driver details
|
||||
|
||||
#define next_input_to(CALLBACK) input_to(CALLBACK);
|
||||
|
||||
#pragma combine_strings
|
||||
#pragma verbose_errors
|
||||
|
||||
#if __EFUN_DEFINED__(strstr)
|
||||
// rexxism: is small an abbreviation of big?
|
||||
# define abbrev(SMALL, BIG) (strstr(BIG, SMALL) == 0)
|
||||
// the same thing at the tail of the string
|
||||
# define trail(SMALL, BIG) (strstr(BIG, SMALL, -strlen(SMALL)) != -1)
|
||||
#else
|
||||
# define abbrev(SMALL, BIG) (SMALL == BIG[0..strlen(SMALL)-1])
|
||||
# define trail(SMALL, BIG) (SMALL == BIG[<strlen(SMALL)..])
|
||||
#endif
|
||||
|
||||
// generic string replacer
|
||||
#define prereplace(s) (" "+s+" ")
|
||||
#define replace(s, o, n) implode(explode(s, o), n)
|
||||
#define postreplace(s) (s = s[1..<2])
|
||||
|
||||
// let's use index() for strings and arrays
|
||||
// to avoid confusion with mapping-member semantics
|
||||
//
|
||||
#define index member
|
||||
#define rindex rmember
|
||||
|
||||
#define send_udp(host, port, msg) send_imp(host, port, msg)
|
||||
#define query_udp_port query_imp_port
|
||||
|
||||
// compare strings ignoring case
|
||||
#define stricmp(one, two) (lower_case(one) != lower_case(two))
|
||||
|
||||
#define clonep(ob) (objectp(ob) && member(file_name(ob), '#') >= 0)
|
||||
|
||||
#define o2s(ob) to_string(ob)
|
||||
|
||||
// object to (relative) http URL conversion macros
|
||||
#define object2url(ob) replace( to_string(ob), "#", "," )
|
||||
#define url2object(ob) replace( to_string(ob), ",", "#" )
|
||||
|
||||
// varargs introduced in 3.2.1@132
|
||||
#define varargs
|
||||
|
||||
#define AMOUNT_SOCKETS sizeof(users())
|
||||
|
1
world/drivers/amylaar/library/classic.i
Normal file
1
world/drivers/amylaar/library/classic.i
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/library/classic.i"
|
1
world/drivers/amylaar/library/library.c
Normal file
1
world/drivers/amylaar/library/library.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/library/library.c"
|
1
world/drivers/amylaar/library/living.i
Normal file
1
world/drivers/amylaar/library/living.i
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/library/living.i"
|
1
world/drivers/amylaar/master/classic.i
Normal file
1
world/drivers/amylaar/master/classic.i
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/master/classic.i"
|
1
world/drivers/amylaar/master/master.i
Normal file
1
world/drivers/amylaar/master/master.i
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/master/master.i"
|
1
world/drivers/amylaar/master/psycmuve.i
Normal file
1
world/drivers/amylaar/master/psycmuve.i
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../ldmud/master/psycmuve.i"
|
17
world/drivers/amylaar/sys/driver_hook.h
Normal file
17
world/drivers/amylaar/sys/driver_hook.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#define H_MOVE_OBJECT0 0
|
||||
#define H_MOVE_OBJECT1 1
|
||||
#define H_LOAD_UIDS 2
|
||||
#define H_CLONE_UIDS 3
|
||||
#define H_CREATE_SUPER 4
|
||||
#define H_CREATE_OB 5
|
||||
#define H_CREATE_CLONE 6
|
||||
#define H_RESET 7
|
||||
#define H_CLEAN_UP 8
|
||||
#define H_MODIFY_COMMAND 9
|
||||
#define H_NOTIFY_FAIL 10
|
||||
#define H_NO_IPC_SLOT 11
|
||||
#define H_INCLUDE_DIRS 12
|
||||
#define H_TELNET_NEG 13
|
||||
#define H_NOECHO 14
|
||||
#define H_ERQ_STOP 15
|
||||
#define H_MODIFY_COMMAND_FNAME 16
|
43
world/drivers/amylaar/sys/erq.h
Normal file
43
world/drivers/amylaar/sys/erq.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* external request demon interface definitions */
|
||||
#ifndef ERQ_H
|
||||
#define ERQ_H
|
||||
|
||||
/* servive request types */
|
||||
|
||||
#define ERQ_RLOOKUP 0
|
||||
#define ERQ_EXECUTE 1
|
||||
#define ERQ_FORK 2
|
||||
#define ERQ_AUTH 3
|
||||
#define ERQ_SPAWN 4
|
||||
#define ERQ_SEND 5
|
||||
#define ERQ_KILL 6
|
||||
#define ERQ_OPEN_UDP 7
|
||||
#define ERQ_OPEN_TCP 8
|
||||
#define ERQ_LISTEN 9
|
||||
|
||||
/* answers from ERQ_EXECUTE / ERQ_FORK */
|
||||
|
||||
#define ERQ_OK 0
|
||||
#define ERQ_SIGNALED 1
|
||||
#define ERQ_E_NOTFOUND 2 /* process not found by wait */
|
||||
#define ERQ_E_UNKNOWN 3 /* unknown exit condition from wait() */
|
||||
#define ERQ_E_ARGLENGTH 4
|
||||
#define ERQ_E_ARGFORMAT 5
|
||||
#define ERQ_E_ARGNUMBER 6
|
||||
#define ERQ_E_ILLEGAL 7
|
||||
#define ERQ_E_PATHLEN 8
|
||||
#define ERQ_E_FORKFAIL 9
|
||||
#define ERQ_E_TICKET 11
|
||||
#define ERQ_E_INCOMPLETE 12
|
||||
#define ERQ_E_WOULDBLOCK 13
|
||||
#define ERQ_E_PIPE 14
|
||||
#define ERQ_STDOUT 15
|
||||
#define ERQ_STDERR 16
|
||||
#define ERQ_EXITED 17
|
||||
#define ERQ_E_NSLOTS 18
|
||||
|
||||
/* reserved handles */
|
||||
|
||||
#define ERQ_HANDLE_RLOOKUP (-1)
|
||||
|
||||
#endif /* ERQ_H */
|
129
world/drivers/amylaar/sys/errno.h
Normal file
129
world/drivers/amylaar/sys/errno.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* these are the linux values.. */
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
22
world/drivers/amylaar/sys/functionlist.h
Normal file
22
world/drivers/amylaar/sys/functionlist.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef FUNCTIONLIST_H
|
||||
#define FUNCTIONLIST_H
|
||||
|
||||
#include "/sys/lpctypes.h"
|
||||
|
||||
#define RETURN_FUNCTION_NAME 0x01
|
||||
#define RETURN_FUNCTION_FLAGS 0x02
|
||||
#define RETURN_FUNCTION_TYPE 0x04
|
||||
#define RETURN_FUNCTION_NUMARG 0x08
|
||||
#define RETURN_FUNCTION_ARGTYPE 0x10 /* not implemented */
|
||||
|
||||
#define NAME_INHERITED 0x80000000 /* Defined by inheritance */
|
||||
#define TYPE_MOD_STATIC 0x40000000 /* Static function or variable */
|
||||
#define TYPE_MOD_NO_MASK 0x20000000 /* The nomask => not redefineable */
|
||||
#define TYPE_MOD_PRIVATE 0x10000000 /* Can't be inherited */
|
||||
#define TYPE_MOD_PUBLIC 0x08000000 /* Force inherit through private */
|
||||
#define TYPE_MOD_VARARGS 0x04000000 /* Used for type checking */
|
||||
#define TYPE_MOD_PROTECTED 0x01000000 /* cannot be called externally */
|
||||
#define NAME_HIDDEN 0x00000800 /* Not visible for inheritance */
|
||||
#define NAME_UNDEFINED 0x00000200 /* Not defined yet */
|
||||
|
||||
#endif /* FUNCTIONLIST_H */
|
45
world/drivers/amylaar/sys/lpctypes.h
Normal file
45
world/drivers/amylaar/sys/lpctypes.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef LPCTYPES_H
|
||||
#define LPCTYPES_H
|
||||
|
||||
/* compile time types, from functionlist() */
|
||||
|
||||
#define TYPE_UNKNOWN 0 /* This type must be casted */
|
||||
#define TYPE_NUMBER 1
|
||||
#define TYPE_STRING 2
|
||||
#define TYPE_VOID 3
|
||||
#define TYPE_OBJECT 4
|
||||
#define TYPE_MAPPING 5
|
||||
#define TYPE_FLOAT 6
|
||||
#define TYPE_ANY 7 /* Will match any type */
|
||||
#define TYPE_SPACE 8
|
||||
#define TYPE_CLOSURE 9
|
||||
#define TYPE_SYMBOL 10
|
||||
#define TYPE_QUOTED_ARRAY 11
|
||||
#define TYPE_TERM 12
|
||||
|
||||
#define TYPE_MOD_POINTER 0x0040 /* Pointer to a basic type */
|
||||
|
||||
/* runtime types, from typeof() */
|
||||
|
||||
#define T_INVALID 0x0
|
||||
#define T_LVALUE 0x1
|
||||
#define T_NUMBER 0x2
|
||||
#define T_STRING 0x3
|
||||
#define T_POINTER 0x4
|
||||
#define T_OBJECT 0x5
|
||||
#define T_MAPPING 0x6
|
||||
#define T_FLOAT 0x7
|
||||
#define T_CLOSURE 0x8
|
||||
#define T_SYMBOL 0x9
|
||||
#define T_QUOTED_ARRAY 0xa
|
||||
|
||||
#define CLOSURE_IS_LFUN(x) (((x)&~1) == 0)
|
||||
#define CLOSURE_IS_IDENTIFIER(x) ((x) == 2)
|
||||
#define CLOSURE_IS_BOUND_LAMBDA(x) ((x) == 4)
|
||||
#define CLOSURE_IS_LAMBDA(x) ((x) == 5)
|
||||
#define CLOSURE_IS_UNBOUND_LAMBDA(x) ((x) == 6)
|
||||
#define CLOSURE_IS_SIMUL_EFUN(x) (((x) & 0xf800) == 0xf800)
|
||||
#define CLOSURE_IS_EFUN(x) (((x) & 0xf800) == 0xf000)
|
||||
#define CLOSURE_IS_OPERATOR(x) (((x) & 0xf800) == 0xe800)
|
||||
|
||||
#endif /* LPCTYPES_H */
|
5
world/drivers/amylaar/sys/sent.h
Normal file
5
world/drivers/amylaar/sys/sent.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#define SENT_PLAIN 0
|
||||
#define SENT_SHORT_VERB 1
|
||||
#define SENT_NO_SPACE 2
|
||||
#define SENT_NO_VERB 3
|
||||
#define SENT_MARKER 4
|
10
world/drivers/amylaar/sys/wizlist.h
Normal file
10
world/drivers/amylaar/sys/wizlist.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef WIZLIST_H
|
||||
#define WIZLIST_H
|
||||
#define WL_NAME 0
|
||||
#define WL_COMMANDS 1
|
||||
#define WL_EVAL_COST 2
|
||||
#define WL_HEART_BEATS 3
|
||||
#define WL_CALL_OUT 4 /* unimplemented */
|
||||
#define WL_ARRAY_TOTAL 5
|
||||
#define WL_EXTRA 6
|
||||
#endif /* WIZLIST_H */
|
43
world/drivers/ldmud/include/driver.h
Normal file
43
world/drivers/ldmud/include/driver.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
// $Id: driver.h,v 1.10 2007/05/07 20:20:42 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
#ifndef _INCLUDE_DRIVER_H
|
||||
#define _INCLUDE_DRIVER_H
|
||||
|
||||
// for debug outputs
|
||||
#ifdef __psyclpc__
|
||||
# define DRIVER_TYPE "psyclpc"
|
||||
#else
|
||||
# define DRIVER_TYPE "ldmud"
|
||||
#endif
|
||||
|
||||
// this driver has closures
|
||||
#define DRIVER_HAS_CLOSURES
|
||||
|
||||
// amylaar-style runtime closures
|
||||
#define DRIVER_HAS_LAMBDA_CLOSURES
|
||||
|
||||
// mudos-style readable closures
|
||||
#define DRIVER_HAS_INLINE_CLOSURES
|
||||
|
||||
// amylaar provides "compile_object" in master.c
|
||||
#define DRIVER_HAS_RENAMED_CLONES
|
||||
|
||||
// the function(&var) syntax
|
||||
#define DRIVER_HAS_CALL_BY_REFERENCE
|
||||
|
||||
// macros to see if a protocol port is available
|
||||
//#define HAS_PORT(PORT, PATH) (defined(PATH) && defined(PORT) && PORT - 0)
|
||||
#ifdef __TLS__
|
||||
# define HAS_TLS_PORT(PORT) (defined(PORT) && PORT - 0)
|
||||
#else
|
||||
# define HAS_TLS_PORT(PORT) 0
|
||||
#endif
|
||||
|
||||
#ifdef SIMUL_EFUN_FILE
|
||||
#undef SIMUL_EFUN_FILE
|
||||
#endif
|
||||
#define SIMUL_EFUN_FILE DRIVER_PATH "library/library.c"
|
||||
//#ifndef SPARE_SIMUL_EFUN_FILE
|
||||
//#define SPARE_SIMUL_EFUN_FILE "obj/spare_library"
|
||||
//#endif
|
||||
|
||||
#endif
|
142
world/drivers/ldmud/include/interface.h
Normal file
142
world/drivers/ldmud/include/interface.h
Normal file
|
@ -0,0 +1,142 @@
|
|||
// $Id: interface.h,v 1.51 2008/04/09 16:49:23 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
#define _INCLUDE_INTERFACE_H
|
||||
|
||||
// let's stay compatible for a while
|
||||
// -> if we want to do so, we got to check for the LDMUD version. 3.2.9 doesn't
|
||||
// get it.
|
||||
//#if __VERSION_MAJOR__ == 3 && __VERSION_MINOR__ > 2
|
||||
# define SAVE_FORMAT 0
|
||||
//#endif
|
||||
|
||||
#ifdef __psyclpc__
|
||||
# define DRIVER_VERSION "psyclpc/" __VERSION__
|
||||
#else
|
||||
# define DRIVER_VERSION "ldmud/" __VERSION__
|
||||
#endif
|
||||
|
||||
// driver abstraction kit -- abstraction layer from driver details
|
||||
|
||||
#pragma combine_strings
|
||||
#if DEBUG > 0
|
||||
# pragma verbose_errors
|
||||
//#else
|
||||
//# pragma no_verbose_errors
|
||||
#endif
|
||||
|
||||
// [-1] vs [<1] syntax kludge
|
||||
#define char_from_end(WHAT, NUMBER) WHAT[< NUMBER]
|
||||
#define slice_from_end(WHAT,FROM,TO) WHAT[FROM ..< TO]
|
||||
|
||||
#define next_input_to(CALLBACK) input_to(CALLBACK, INPUT_IGNORE_BANG)
|
||||
|
||||
#if __EFUN_DEFINED__(strstr)
|
||||
// rexxism: is small an abbreviation of big?
|
||||
# define abbrev(SMALL, BIG) (strstr(BIG, SMALL) == 0)
|
||||
// the same thing at the tail of the string
|
||||
# define trail(SMALL, BIG) (strstr(BIG, SMALL, -strlen(SMALL)) != -1)
|
||||
#else
|
||||
# define abbrev(SMALL, BIG) (SMALL == BIG[0..strlen(SMALL)-1])
|
||||
# define trail(SMALL, BIG) (SMALL == BIG[<strlen(SMALL)..])
|
||||
#endif
|
||||
|
||||
// generic string replacer
|
||||
#define replace(s, o, n) implode(explode(s, o), n)
|
||||
// these are historic, from the days when explode() used to
|
||||
// throw away delimiters at the edge of the string
|
||||
//#define prereplace(s) (" "+s+" ")
|
||||
//#define postreplace(s) (s = s[1..<2])
|
||||
//
|
||||
// backward compat -- useful when writing multi-driver code
|
||||
#define prereplace(s) (s)
|
||||
#define postreplace(s) (s)
|
||||
|
||||
// let's use index() for strings and arrays
|
||||
// to avoid confusion with mapping-member semantics
|
||||
//
|
||||
#define index member
|
||||
#define rindex rmember
|
||||
|
||||
// old stuff
|
||||
#if ! __EFUN_DEFINED__(send_udp)
|
||||
# define send_udp(host, port, msg) send_imp(host, port, msg)
|
||||
#endif
|
||||
#if ! __EFUN_DEFINED__(query_udp_port)
|
||||
# define query_udp_port query_imp_port
|
||||
#endif
|
||||
|
||||
// compare strings ignoring case
|
||||
#define stricmp(one, two) (lower_case(one) != lower_case(two))
|
||||
|
||||
#define legal_keyword(WORD) (!regmatch(WORD, "[^_0-9A-Za-z]"))
|
||||
|
||||
#if ! __EFUN_DEFINED__(clonep)
|
||||
# define clonep(ob) (objectp(ob) && member(file_name(ob), '#') >= 0)
|
||||
#endif
|
||||
|
||||
// to_string behaves differently with ldmud.. sigh
|
||||
#define o2s(any) ((objectp(any)?"/":"")+to_string(any))
|
||||
|
||||
// object to http URL (without http://host:port) conversion macros
|
||||
#define object2url(ob) replace( stringp(ob)?ob:("/"+to_string(ob)), "#", "," )
|
||||
#define url2object(ob) replace( ob, ",", "#" )
|
||||
|
||||
#define file_name(ob) object_name(ob)
|
||||
|
||||
// see net/library for verbose version of this function
|
||||
#if 1
|
||||
# define is_formal(n) ((index(n,':')!=-1||index(n,'.')!=-1) && n)
|
||||
#else
|
||||
# define is_formal(n) ((index(n,':')!=-1||index(n,'@')!=-1) && n)
|
||||
#endif
|
||||
#define lower_uniform(n) (is_formal(n) && lower_case(n))
|
||||
|
||||
// nosave? static? volatile. only for variables, not methods!
|
||||
// another nice word for the opposite of persistent would be "shed"
|
||||
#define volatile nosave
|
||||
|
||||
// every lpc dialect has its own foreach syntax. aint that cute?
|
||||
#define each(ITERATOR, LIST) foreach(ITERATOR : LIST)
|
||||
#define mapeach(KEY, VALUE, MAPPING) foreach(KEY, VALUE : MAPPING)
|
||||
|
||||
#define array(TYPE) TYPE *
|
||||
|
||||
// the simple concept of the caller isn't so simple in lpc
|
||||
#define caller (extern_call() ? previous_object() : this_object())
|
||||
|
||||
// a pike compatible closure syntax.. using a macro.. ain't that smarty?
|
||||
#define CLOSURE(args, tcontext, context, code) function mixed args code
|
||||
|
||||
// pike's varargs syntax requires me to do some tricks here
|
||||
#define vaclosure closure
|
||||
#define vamapping mapping
|
||||
#define vastring string
|
||||
#define vaobject object
|
||||
#define vamixed mixed
|
||||
#define vaint int
|
||||
|
||||
#if __EFUN_DEFINED__(convert_charset)
|
||||
# ifdef TRANSLIT // TRANSLIT has no effect whatsoever. grrr!
|
||||
# define iconv(s, FROM, TO) (s = convert_charset(s, FROM, TO +"//TRANSLIT"))
|
||||
# else
|
||||
# define iconv(s, FROM, TO) { \
|
||||
string itmp; \
|
||||
if (catch(itmp = convert_charset(s, FROM, TO); nolog)) {\
|
||||
P1(("catch! iconv %O %O in %O\n", FROM, TO, ME)) \
|
||||
} else s = itmp; \
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
# define iconv(s, FROM, TO)
|
||||
# define convert_charset(s, FROM, TO) (s)
|
||||
#endif
|
||||
|
||||
#define AMOUNT_SOCKETS sizeof(users())
|
||||
|
||||
#ifdef DEBUG
|
||||
# if DEBUG > 0
|
||||
// enables you to output useful things like in your P1() etc.
|
||||
# define DEBUG_TRACE debug_info(DINFO_TRACE, DIT_STR_CURRENT)
|
||||
# else
|
||||
# define DEBUG_TRACE "(DEBUG_TRACE disabled: DEBUG level below 1)"
|
||||
# endif
|
||||
#endif
|
35
world/drivers/ldmud/library/attic.c
Normal file
35
world/drivers/ldmud/library/attic.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
// attic:
|
||||
|
||||
#if 0
|
||||
|
||||
void shout(string s) {
|
||||
filter_array(users(), lambda(({'u}),({#'&&,
|
||||
({#'environment, 'u}),
|
||||
({#'!=, 'u, ({#'this_player})}),
|
||||
({#'tell_object, 'u, to_string(s)})
|
||||
})));
|
||||
}
|
||||
|
||||
/*
|
||||
* Function name: all_environment
|
||||
* Description: Gives an array of all containers which an object is in, i.e.
|
||||
* match in matchbox in bigbox in chest in room, would for the
|
||||
* match give: matchbox, bigbox, chest, room
|
||||
* Arguments: ob: The object
|
||||
* Returns: The array of containers.
|
||||
*/
|
||||
public object *
|
||||
all_environment(object ob)
|
||||
{
|
||||
object *r;
|
||||
|
||||
if (!ob || !environment(ob)) return 0;
|
||||
if (!environment(environment(ob)))
|
||||
return ({ environment(ob) });
|
||||
r = ({ ob = environment(ob) });
|
||||
while (environment(ob))
|
||||
r = r + ({ ob = environment(ob) });
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
93
world/drivers/ldmud/library/classic.i
Normal file
93
world/drivers/ldmud/library/classic.i
Normal file
|
@ -0,0 +1,93 @@
|
|||
// $Id: classic.i,v 1.4 2007/09/05 11:04:25 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
/*
|
||||
* This is a mudlib file. Copy it to /obj/simul_efun.c, or
|
||||
* wherever the get_simul_efun() in master.c says.
|
||||
* The functions defined in this file should only be replacements of efuns
|
||||
* no longer supported. Don't use these functions any longer, use the
|
||||
* replacement instead.
|
||||
*/
|
||||
|
||||
#include DRIVER_PATH "sys/erq.h"
|
||||
|
||||
#pragma strong_types
|
||||
#pragma save_types
|
||||
|
||||
int file_time(string path)
|
||||
{
|
||||
mixed *vec;
|
||||
|
||||
PROTECT("FILE_TIME")
|
||||
|
||||
set_this_object(previous_object());
|
||||
if (sizeof(vec=get_dir(path,4))) return vec[0];
|
||||
}
|
||||
|
||||
#ifdef __EFUN_DEFINED(snoop)__
|
||||
mixed snoop(mixed snoopee) {
|
||||
# if 0
|
||||
int result;
|
||||
|
||||
if (snoopee && query_snoop(snoopee)) {
|
||||
write("Busy.\n");
|
||||
return 0;
|
||||
}
|
||||
result = snoopee ? efun::snoop(this_player(), snoopee)
|
||||
: efun::snoop(this_player());
|
||||
switch (result) {
|
||||
case -1:
|
||||
write("Busy.\n");
|
||||
case 0:
|
||||
write("Failed.\n");
|
||||
case 1:
|
||||
write("Ok.\n");
|
||||
}
|
||||
if (result > 0) return snoopee;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
string query_host_name() { return __HOST_NAME__; }
|
||||
|
||||
#if 0 // ndef NO_MAPPINGS
|
||||
mapping m_delete(mapping m, mixed key) {
|
||||
return efun::m_delete(copy_mapping(m), key);
|
||||
}
|
||||
|
||||
nomask void set_this_player() {}
|
||||
|
||||
void shout(string s) {
|
||||
filter_array(users(), lambda(({'u}),({#'&&,
|
||||
({#'environment, 'u}),
|
||||
({#'!=, 'u, ({#'this_player})}),
|
||||
({#'tell_object, 'u, to_string(s)})
|
||||
})));
|
||||
}
|
||||
|
||||
/*
|
||||
* Function name: all_environment
|
||||
* Description: Gives an array of all containers which an object is in, i.e.
|
||||
* match in matchbox in bigbox in chest in room, would for the
|
||||
* match give: matchbox, bigbox, chest, room
|
||||
* Arguments: ob: The object
|
||||
* Returns: The array of containers.
|
||||
*/
|
||||
public object *
|
||||
all_environment(object ob)
|
||||
{
|
||||
object *r;
|
||||
|
||||
if (!ob || !environment(ob)) return 0;
|
||||
if (!environment(environment(ob)))
|
||||
return ({ environment(ob) });
|
||||
r = ({ ob = environment(ob) });
|
||||
while (environment(ob))
|
||||
r = r + ({ ob = environment(ob) });
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
string version() { return __VERSION__; }
|
||||
|
124
world/drivers/ldmud/library/library.c
Normal file
124
world/drivers/ldmud/library/library.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
// $Id: library.c,v 1.43 2007/10/08 07:27:59 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
#ifndef __PIKE__
|
||||
|
||||
#include "/local/config.h"
|
||||
#include "/local/hosts.h"
|
||||
//#include NET_PATH "include/proto.h"
|
||||
#include NET_PATH "include/net.h"
|
||||
#include DRIVER_PATH "include/driver.h"
|
||||
#include <sandbox.h>
|
||||
|
||||
#include <driver.h>
|
||||
|
||||
#ifdef PRO_PATH
|
||||
inherit PRO_PATH "library2";
|
||||
inherit PRO_PATH "http/library2";
|
||||
#else
|
||||
# ifdef SANDBOX
|
||||
inherit NET_PATH "library/sandbox";
|
||||
# endif
|
||||
inherit NET_PATH "library/base64";
|
||||
inherit NET_PATH "library/dns";
|
||||
inherit NET_PATH "library/htbasics";
|
||||
inherit NET_PATH "library/json";
|
||||
inherit NET_PATH "library/profiles";
|
||||
# ifdef JABBER_PATH // supposed to change
|
||||
inherit NET_PATH "library/sasl";
|
||||
# endif
|
||||
inherit NET_PATH "library/share";
|
||||
inherit NET_PATH "library/signature";
|
||||
# ifdef __TLS__
|
||||
inherit NET_PATH "library/tls";
|
||||
# endif
|
||||
inherit NET_PATH "library/text";
|
||||
inherit NET_PATH "library/time";
|
||||
inherit NET_PATH "library/url";
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
||||
|
||||
// the system master object
|
||||
volatile object master;
|
||||
|
||||
volatile int shutdown_in_progress = 0;
|
||||
|
||||
volatile string logpath;
|
||||
|
||||
#ifndef __PIKE__
|
||||
|
||||
#ifdef MUD
|
||||
# include "/include/auto.h"
|
||||
# include "/sys/library.c"
|
||||
#endif
|
||||
|
||||
#include NET_PATH "library/admin.c"
|
||||
#ifndef PRO_PATH
|
||||
# include NET_PATH "library/legal.c"
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
||||
|
||||
// added sprintf-support -lynx
|
||||
//
|
||||
// if the driver has no varargs support,
|
||||
// "varargs" should be defined as empty string (see interface.h)
|
||||
//
|
||||
#ifdef varargs
|
||||
void log_file(string file,string str,
|
||||
vamixed a,vamixed b,vamixed c,vamixed d,
|
||||
vamixed e,vamixed f,vamixed g,vamixed h)
|
||||
#else
|
||||
void log_file(string file, string str, varargs mixed* args) // proto.h!
|
||||
#endif
|
||||
{
|
||||
#if 0 //def COMPAT_FLAG
|
||||
// if (sizeof(regexp(({file}), "/")) || file[0] == '.' || strlen(file) > 30 )
|
||||
if (file[0] == '/' || strstr(file, "..") >= 0) {
|
||||
write("Illegal file name to log_file("+file+")\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
PROTECT("LOG_FILE")
|
||||
#ifdef varargs
|
||||
if (a) str = sprintf(str, a,b,c,d,e,f,g,h);
|
||||
#else
|
||||
if (args && sizeof(args)) str = apply(#'sprintf, str, args);
|
||||
#endif
|
||||
#if defined(MUD) && __EFUN_DEFINED__(set_this_object)
|
||||
// we don't need this type of security in a regular psyced
|
||||
if (previous_object()) set_this_object(previous_object());
|
||||
#endif
|
||||
#ifdef SLAVE
|
||||
unless (logpath) {
|
||||
logpath = "/log/"+ __HOST_IP_NUMBER__ +"-"+ query_udp_port() +"/";
|
||||
mkdir(logpath);
|
||||
mkdir(logpath + "place");
|
||||
}
|
||||
write_file(logpath + file +".log", str);
|
||||
#else
|
||||
write_file("/log/"+ file +".log", str);
|
||||
#endif
|
||||
D3( debug_message(file +"## "+ str) );
|
||||
//#ifdef PSYC_SYNCHRONIZE
|
||||
// synchro_report("_notice_system_psyced", str,
|
||||
// ([ "_file": file ]) );
|
||||
//#endif
|
||||
}
|
||||
|
||||
#ifndef __PIKE__
|
||||
|
||||
#include "classic.i"
|
||||
#ifdef USE_LIVING
|
||||
# include "living.i"
|
||||
#endif
|
||||
|
||||
#include NET_PATH "library.i"
|
||||
|
||||
#ifdef PRO_PATH
|
||||
# include PRO_PATH "library.i"
|
||||
#else
|
||||
# include NET_PATH "library/library2.i"
|
||||
#endif
|
||||
|
||||
#endif //PIKE
|
152
world/drivers/ldmud/library/living.i
Normal file
152
world/drivers/ldmud/library/living.i
Normal file
|
@ -0,0 +1,152 @@
|
|||
// $Id: living.i,v 1.16 2007/09/18 09:49:17 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// i shouldnt be using this old code for finding people..
|
||||
// then again does it really harm?
|
||||
// at least we throw out the living() lpmud things..
|
||||
// why does it do the recursive call_out? just because of eval_cost?
|
||||
// then we dont need that either..
|
||||
//
|
||||
// no, we don't need the whole cleaning thing, and we don't need
|
||||
// the ability to handle several objects by the same living_name
|
||||
// either. time to get rid of living.i for psyced. -lynX 2005
|
||||
//
|
||||
// instead, we could use availability here.
|
||||
|
||||
#define living(O) objectp(O)
|
||||
|
||||
#ifdef USE_LIVING
|
||||
#define TIME_CLEAN_LIVING 60 * 60 * 4
|
||||
volatile mapping living_name_m;
|
||||
#endif
|
||||
volatile mapping name_living_m;
|
||||
|
||||
void start_simul_efun() {
|
||||
PROTECT("START_SIMUL_EFUN")
|
||||
|
||||
name_living_m = ([]);
|
||||
#ifdef USE_LIVING
|
||||
living_name_m = ([]);
|
||||
if (find_call_out("clean_simul_efun") < 0)
|
||||
call_out("clean_simul_efun", TIME_CLEAN_LIVING / 2);
|
||||
this_object()->start_simul_efun_dr();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_LIVING
|
||||
static void clean_name_living_m(string *keys, int left) {
|
||||
int i, j;
|
||||
mixed a;
|
||||
|
||||
PROTECT("CLEAN_NAME_LIVING")
|
||||
if (left) {
|
||||
if (pointerp(a = name_living_m[keys[--left]]) && member(a, 0)>= 0) {
|
||||
i = sizeof(a);
|
||||
do {
|
||||
if (a[--i])
|
||||
a[<++j] = a[i];
|
||||
} while (i);
|
||||
name_living_m[keys[left]] = a = j > 1 ? a[<j..] : a[<1];
|
||||
}
|
||||
if (!a)
|
||||
efun::m_delete(name_living_m, keys[left]);
|
||||
call_out("clean_name_living_m", 1, keys, left);
|
||||
} else {
|
||||
// apparently no problem.. this stuff seems to be working
|
||||
P2(("clean_name_living_m ended with %O people\n",
|
||||
sizeof(name_living_m)))
|
||||
}
|
||||
}
|
||||
|
||||
static void clean_simul_efun() {
|
||||
PROTECT("CLEAN_SIMUL_EFUN")
|
||||
/* There might be destructed objects as keys. */
|
||||
//
|
||||
// actually there never should.. so it should be okay to turn off
|
||||
// the whole clean_simul_efun() thing -lynX 2005
|
||||
|
||||
m_indices(living_name_m);
|
||||
remove_call_out("clean_simul_efun");
|
||||
PT(("clean_name_living_m started for %O people\n", sizeof(name_living_m)))
|
||||
if (find_call_out("clean_name_living_m") < 0) {
|
||||
call_out(
|
||||
"clean_name_living_m",
|
||||
1,
|
||||
m_indices(name_living_m),
|
||||
sizeof(name_living_m)
|
||||
);
|
||||
}
|
||||
call_out("clean_simul_efun", TIME_CLEAN_LIVING);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* disable symbol_function('set_living_name, SIMUL_EFUN_OBJECT) */
|
||||
void register_person(string name, object o) {
|
||||
string old;
|
||||
mixed a;
|
||||
int i;
|
||||
|
||||
PROTECT("SET_LIVING_NAME") // do we need that for protected sefuns?
|
||||
#ifdef USE_LIVING
|
||||
if (old = living_name_m[o]) {
|
||||
if (pointerp(a = name_living_m[old])) {
|
||||
a[member(a, o)] = 0;
|
||||
} else {
|
||||
efun::m_delete(name_living_m, old);
|
||||
}
|
||||
}
|
||||
living_name_m[o] = name;
|
||||
if (a = name_living_m[name]) {
|
||||
if (!pointerp(a)) {
|
||||
name_living_m[name] = ({a, o});
|
||||
return;
|
||||
}
|
||||
/* Try to reallocate entry from destructed object */
|
||||
if ((i = member(a, 0)) >= 0) {
|
||||
a[i] = o;
|
||||
return;
|
||||
}
|
||||
name_living_m[name] = a + ({o});
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
name_living_m[name] = o;
|
||||
}
|
||||
|
||||
// was: find_living()
|
||||
// .... the lowercazed optimization actually doesn't
|
||||
// help, there is hardly a use for it.. so it may disappear again.
|
||||
varargs object find_person(string name, int lowercazed) {
|
||||
mixed *a, r;
|
||||
int i;
|
||||
|
||||
if (!lowercazed) name = lower_case(name);
|
||||
r = name_living_m[name];
|
||||
#ifdef USE_LIVING
|
||||
if (pointerp(r)) {
|
||||
if ( !living(r = (a = r)[0])) {
|
||||
for (i = sizeof(a); --i;) {
|
||||
if (living(a[<i])) {
|
||||
r = a[<i];
|
||||
a[<i] = a[0];
|
||||
return a[0] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
return living(r) && r;
|
||||
#else
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
int amount_people() { return sizeof(name_living_m); }
|
||||
object* objects_people() {
|
||||
PROTECT("OBJECTS_PEOPLE")
|
||||
#ifdef USE_LIVING
|
||||
return m_indices(living_name_m);
|
||||
#else
|
||||
return m_values(name_living_m);
|
||||
#endif
|
||||
}
|
||||
|
72
world/drivers/ldmud/master/classic.i
Normal file
72
world/drivers/ldmud/master/classic.i
Normal file
|
@ -0,0 +1,72 @@
|
|||
// $Id: classic.i,v 1.28 2007/07/20 16:42:27 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// this used to be the place for lpmud master object code which hasn't
|
||||
// been changed for psyced purposes. but everything has changed.
|
||||
|
||||
#include DRIVER_PATH "include/driver.h"
|
||||
#include DRIVER_PATH "sys/wizlist.h"
|
||||
// #include DRIVER_PATH "sys/functionlist.h"
|
||||
#include DRIVER_PATH "sys/erq.h"
|
||||
|
||||
//#ifdef __COMPAT_MODE__
|
||||
//# define COMPAT_FLAG
|
||||
//#endif
|
||||
|
||||
#if !defined(COMPAT_FLAG) && !defined(NO_NATIVE_MODE) && \
|
||||
!__EFUN_DEFINED__(creator) && __EFUN_DEFINED__(geteuid)
|
||||
#define NATIVE_MODE
|
||||
#echo Driver compiled in historically so-called native mode. Bad.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is the LPmud master object, used from version 3.0.
|
||||
* It is the second object loaded after void.c.
|
||||
* Everything written with 'write()' at startup will be printed on
|
||||
* stdout.
|
||||
* 1. reset() will be called first.
|
||||
* 2. flag() will be called once for every argument to the flag -f
|
||||
* supplied to 'parse'.
|
||||
* 3. epilog() will be called.
|
||||
* 4. The system will enter multiuser mode, and enable log in.
|
||||
*/
|
||||
|
||||
/* amylaar: allow to change simul_efun_file without editing patchlevel.h */
|
||||
#ifndef SIMUL_EFUN_FILE
|
||||
#echo master/classic.i: encountered undefined SIMUL_EFUN_FILE
|
||||
#define SIMUL_EFUN_FILE "obj/library"
|
||||
#endif
|
||||
|
||||
//#ifndef SPARE_SIMUL_EFUN_FILE
|
||||
//#define SPARE_SIMUL_EFUN_FILE "obj/spare_library"
|
||||
//#endif
|
||||
/*
|
||||
* Give a path to a simul_efun file. Observe that it is a string returned,
|
||||
* not an object. But the object has to be loaded here. Return 0 if this
|
||||
* feature isn't wanted.
|
||||
*/
|
||||
string get_simul_efun() {
|
||||
string fname;
|
||||
string error;
|
||||
|
||||
fname = SIMUL_EFUN_FILE ;
|
||||
if (error = catch(fname->start_simul_efun())) {
|
||||
write("Failed to load " + fname + "\n");
|
||||
write("error message :"+error+"\n");
|
||||
#ifdef SPARE_SIMUL_EFUN_FILE
|
||||
fname = SPARE_SIMUL_EFUN_FILE;
|
||||
if (error = catch(fname->start_simul_efun())) {
|
||||
write("Failed to load " + fname + "\n");
|
||||
write("error message :"+error+"\n");
|
||||
shutdown();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
P2(("System library: %s\n", fname))
|
||||
return fname;
|
||||
}
|
||||
|
||||
void dangling_lfun_closure() {
|
||||
raise_error("dangling lfun closure\n");
|
||||
}
|
||||
|
574
world/drivers/ldmud/master/master.c
Normal file
574
world/drivers/ldmud/master/master.c
Normal file
|
@ -0,0 +1,574 @@
|
|||
// $Id: master.c,v 1.61 2008/03/11 16:15:15 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
#ifdef INIT_FILE
|
||||
#undef INIT_FILE
|
||||
#endif
|
||||
#define INIT_FILE "/local/init.ls"
|
||||
|
||||
// protos
|
||||
mixed valid_read(string path, string eff_user, string call, object caller);
|
||||
mixed valid_write(string path, string eff_user, string call, object caller);
|
||||
|
||||
// bei amylaar und ldmud braucht master.c den absoluten pfad..
|
||||
#include "/local/config.h"
|
||||
#include NET_PATH "include/net.h"
|
||||
#include DRIVER_PATH "sys/driver_hook.h"
|
||||
#include DRIVER_PATH "sys/debug_message.h"
|
||||
|
||||
// go fetch the rest of the master object code
|
||||
#ifdef PRO_PATH
|
||||
inherit PRO_PATH "master";
|
||||
#else
|
||||
# include DRIVER_PATH "master/psycmuve.i"
|
||||
#endif
|
||||
#include DRIVER_PATH "master/classic.i"
|
||||
|
||||
/* Since the normal operation mode of psyced is not to have any
|
||||
* access by "wizards" all of the security functions of LPMUD are
|
||||
* disabled by the following dummy functions
|
||||
*/
|
||||
|
||||
int valid_exec(string name, object ob, object obfrom) {
|
||||
// switch(name) {
|
||||
// case "secure/login.c":
|
||||
// case "obj/master.c":
|
||||
#ifdef SANDBOX // sucks here. i'd love to use uids, but we get a $%!!"
|
||||
// program name string
|
||||
#ifndef __COMPAT_MODE__
|
||||
if (name[0] == '/') name = name[1..];
|
||||
#endif
|
||||
if (abbrev(name, "users/")) return 0;
|
||||
#endif
|
||||
if (!interactive(ob)) {
|
||||
return 1;
|
||||
}
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
mixed valid_write(string path, string eff_user, string call, object callo) {
|
||||
P4(("valid_write(%O,%O,%O,%O)\n", path,eff_user,call,caller))
|
||||
#ifdef SANDBOX
|
||||
int i;
|
||||
|
||||
if (stringp(eff_user)) {
|
||||
if (eff_user[0] == '/') {
|
||||
return 1;
|
||||
} else if (eff_user[0] == '@') {
|
||||
string file = eff_user[1..];
|
||||
|
||||
PT((">> %O %O\n", path[12..], file));
|
||||
return abbrev(DATA_PATH "place/", path) && path[12..] == file;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
mixed valid_read(string path, string eff_user, string call, object callo) {
|
||||
P4(("valid_read(%O,%O,%O,%O)\n", path,eff_user,call,caller))
|
||||
#ifdef SANDBOX
|
||||
int i;
|
||||
|
||||
if (stringp(eff_user)) {
|
||||
if (eff_user[0] == '/') {
|
||||
return 1;
|
||||
} else if (eff_user[0] == '@') {
|
||||
string file = eff_user[1..];
|
||||
|
||||
PT((">> %O %O\n", path[12..], file));
|
||||
return abbrev(DATA_PATH "place/", path) && path[12..] == file;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
mixed privilege_violation(string op, mixed who, mixed arg3, mixed arg4) {
|
||||
P4(("privilege %s(%O,%O) granted to %O\n", op,arg3,arg4,who))
|
||||
#ifdef SANDBOX
|
||||
unless(objectp(who)) {
|
||||
P0(("¶¶ master: privilege_violation(%O, %O, %O) from !obj %O\n", op, arg3, arg4, who));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stringp(geteuid(who)) && geteuid(who)[0] == '/') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
string *include_dirs() {
|
||||
return ({
|
||||
#ifdef PRO_PATH
|
||||
PRO_PATH "include/",
|
||||
#endif
|
||||
#ifdef NET_PATH
|
||||
NET_PATH "include/",
|
||||
#endif
|
||||
#ifdef DRIVER_PATH
|
||||
DRIVER_PATH "include/",
|
||||
DRIVER_PATH "sys/", // this should be faded out TODO
|
||||
DRIVER_PATH,
|
||||
#else
|
||||
"/sys/",
|
||||
#endif
|
||||
"/include/"
|
||||
});
|
||||
}
|
||||
|
||||
#if 0
|
||||
void log_error(string file, string err, int warn) {
|
||||
debug_message(S("\n\n\n\n\n%O %O in %O\n", warn ? "WARNING" : "ERROR",
|
||||
err, file), 1+2+4);
|
||||
}
|
||||
#endif
|
||||
|
||||
void runtime_error(string error, string program,
|
||||
string current_object, int line) {
|
||||
string msg;
|
||||
|
||||
if (program && current_object) {
|
||||
msg = sprintf("EXCEPTION in %s:%d (%s):\n\t%s",
|
||||
program, line, current_object, error);
|
||||
debug_message(msg, DMSG_STDERR | DMSG_LOGFILE); // | DMSG_STAMP);
|
||||
//, DMSG_STDOUT | DMSG_STDERR | DMSG_LOGFILE | DMSG_STAMP);
|
||||
// DMSG_DEFAULT: /* log to stdout and .debug.log */
|
||||
|
||||
// it's on old mud tradition to show the error to the current player
|
||||
// but in psycworld these are protocols of potentially very delicate
|
||||
// syntaxes, so let's be kind and not break them.
|
||||
#if DEBUG > 0
|
||||
// let's tell the object about it,
|
||||
// hoping that it will not recurse into a further error -lynX
|
||||
// obviously i forgot master can be interactive itself!
|
||||
if (this_interactive() && this_interactive() != ME)
|
||||
this_interactive()->runtime_error(error, program, current_object, line, msg);
|
||||
#endif
|
||||
#if 0
|
||||
} else {
|
||||
// the else case isn't interesting as the driver puts a comment
|
||||
// about it into the debug log anyway. looks like this:
|
||||
// "Object 'psyc:...' the closure was bound to has been destructed"
|
||||
// "No program to trace."
|
||||
// and happens when an outgoing connection has been made for a circuit
|
||||
// that has been destroyed in the meantime.. like by shutdown()
|
||||
// i don't think we can avoid such a circumstance really, so consider
|
||||
// it a regular behaviour - a warning message, but nothing's wrong really.
|
||||
// i mean.. we don't want to wait for connections to establish while we
|
||||
// are shutting down.. do we?
|
||||
msg = "EXCEPTION: "+ error;
|
||||
debug_message(msg, DMSG_LOGFILE | DMSG_STAMP);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void disconnect(object ob, string remaining) {
|
||||
string host = query_ip_name(ob);
|
||||
string name = object_name(ob);
|
||||
|
||||
PT(("disconnected: %O from %O%s\n", ob, host,
|
||||
remaining && strlen(remaining) ?
|
||||
" with "+ strlen(remaining) +" bytes remaining" : ""))
|
||||
// happens when first clone fails
|
||||
unless (ob && objectp(ob) && ob != ME) return;
|
||||
unless (ob->disconnected(remaining)) {
|
||||
// disconnected() must return true when the
|
||||
// socket disconnection was expected and is no
|
||||
// cause for concern. if we got here, it is.
|
||||
//
|
||||
// 'remaining' is empty in most cases, still
|
||||
// we don't output 'remaining' on console
|
||||
// as it occasionally triggers a utf8 conversion error
|
||||
// instead we drop this into a logfile
|
||||
SIMUL_EFUN_FILE -> log_file("DISC", "%O %O %O\n",
|
||||
name, host, remaining);
|
||||
}
|
||||
}
|
||||
|
||||
// even though the name of the function is weird, this is the
|
||||
// place where UDP messages arrive
|
||||
//
|
||||
// how to multiplex InterMUD and PSYC on the same udp port:
|
||||
// PSYC UDP packets always start with ".\n", just forward them to
|
||||
// the PSYC UDP server daemon.
|
||||
//
|
||||
volatile object psycd;
|
||||
#ifdef SPYC_PATH
|
||||
volatile object spycd;
|
||||
#endif
|
||||
#ifdef SIP_PATH
|
||||
volatile object sipd;
|
||||
#endif
|
||||
|
||||
void receive_udp(string host, string msg, int port) {
|
||||
if (strlen(msg) > 1 && msg[1] == '\n') switch(msg[0]) {
|
||||
#ifdef SPYC_PATH
|
||||
case '|':
|
||||
unless (spycd) {
|
||||
spycd = SPYC_PATH "udp" -> load();
|
||||
PT(("SPYC UDP daemon created.\n"))
|
||||
unless (spycd) return;
|
||||
}
|
||||
spycd -> parseUDP(host, port, msg);
|
||||
return;
|
||||
#endif
|
||||
case '.':
|
||||
unless (psycd) {
|
||||
psycd = PSYC_PATH "udp" -> load();
|
||||
PT(("PSYC UDP daemon created.\n"))
|
||||
unless (psycd) return;
|
||||
}
|
||||
psycd -> parseUDP (host,port,msg);
|
||||
return;
|
||||
}
|
||||
#ifdef SIP_PATH
|
||||
string mc, rcpt;
|
||||
|
||||
if (abbrev("SIP", msg) ||
|
||||
sscanf(msg, "%s sip:%s", mc, rcpt) == 2) {
|
||||
unless (sipd) {
|
||||
sipd = SIP_PATH "udp" -> load();
|
||||
PT(("SIP UDP daemon created.\n"))
|
||||
unless (sipd) return;
|
||||
}
|
||||
sipd -> parseUDP (host, port, msg, mc, rcpt);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
P1(("Caught unknown UDP packet from %s:%d\n", host,port))
|
||||
P2(("Content: %O\n", msg))
|
||||
SIMUL_EFUN_FILE -> log_file("UDP", "[%s] %s:%d %O\n", ctime(), host, port, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef __LDMUD__
|
||||
// older versions may still need this..
|
||||
void receive_imp(string host, string msg, int port) {
|
||||
receive_udp(string host, string msg, int port);
|
||||
}
|
||||
#endif
|
||||
|
||||
// this master function is called at the end of the shutdown procedure
|
||||
void notify_shutdown(string crash_reason) {
|
||||
object o;
|
||||
int i;
|
||||
|
||||
P3(("notify_shutdown(%O) from %O\n", crash_reason, previous_object()))
|
||||
if (previous_object() && previous_object() != this_object())
|
||||
return;
|
||||
#if DEBUG > 0
|
||||
if (crash_reason) PP(("CRASH! %O\n", crash_reason));
|
||||
#endif
|
||||
SIMUL_EFUN_FILE -> log_file("LOGON", "[%s] _ SERVER SHUTDOWN (%O)\n", ctime(), crash_reason);
|
||||
#ifdef DEBUG_LOG
|
||||
SIMUL_EFUN_FILE -> log_file(DEBUG_LOG, "[%s] _ SERVER SHUTDOWN (%O)\n", ctime(), crash_reason);
|
||||
#endif
|
||||
// walk thru the shutdown path a third time in case this is a
|
||||
// shutdown by kill -1 process.
|
||||
SIMUL_EFUN_FILE -> server_shutdown(4404, 2);
|
||||
// save_wiz_file();
|
||||
}
|
||||
|
||||
// called when memory gets low or something like that.. never seen this happen
|
||||
void slow_shut_down(int minutes) {
|
||||
SIMUL_EFUN_FILE -> shout(0, "_notice_broadcast_shutdown_panic",
|
||||
"Server is slowly running out of memory. Restart imminent.");
|
||||
SIMUL_EFUN_FILE -> server_shutdown(1, 0);
|
||||
}
|
||||
|
||||
// called by driver at shutdown for every user
|
||||
// but *after* all network sockets have been shut
|
||||
// so its mostly useless
|
||||
void remove_player(object victim) {
|
||||
if (victim) {
|
||||
// this message is normal for psyc circuits
|
||||
// they need to be available til the bitter end
|
||||
P2(("%O found still alive after reboot()\n", victim))
|
||||
//catch(victim->reboot()); .. pointless to try again
|
||||
}
|
||||
// if (victim) destruct(victim);
|
||||
}
|
||||
|
||||
/* This should be called when everything else is done,
|
||||
* but standard drivers do not provide that, and its not worth a patch
|
||||
*/
|
||||
void preload_done() {
|
||||
#ifdef MASTER_LINK
|
||||
D1( D("Loading master link.\n"); )
|
||||
(PSYC_PATH "active") -> connect(MASTER_LINK);
|
||||
#endif
|
||||
#if DEBUG > 1
|
||||
D("Loading done. Dumping objects.\n");
|
||||
debug_info(5, "objects", "/log/objects.dump");
|
||||
#else
|
||||
// D("Starting service.\n");
|
||||
#endif
|
||||
SIMUL_EFUN_FILE -> log_file("LOGON", "[%s] ^ SERVER START\n", ctime());
|
||||
#ifdef DEBUG_LOG
|
||||
SIMUL_EFUN_FILE -> log_file(DEBUG_LOG,"[%s] ^ SERVER START\n",ctime());
|
||||
#endif
|
||||
#ifdef HALT
|
||||
shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
mixed current_time;
|
||||
|
||||
string *epilog(int eflag) {
|
||||
if (eflag) return ({});
|
||||
|
||||
//#if __VERSION_MINOR__ > 2
|
||||
// as long as the driver doesn't provide it
|
||||
// we have to call it ourselves *before* preloading
|
||||
// which means that all involved compilations will have wrong times
|
||||
preload_done();
|
||||
//#endif
|
||||
D1( D("Preloading from " INIT_FILE "\n"); )
|
||||
#ifndef BROKEN_RUSAGE
|
||||
D1( current_time = rusage(); )
|
||||
D1( current_time = current_time[0] + current_time[1]; )
|
||||
#endif
|
||||
return explode(read_file(INIT_FILE), "\n");
|
||||
}
|
||||
|
||||
void preload(string file) {
|
||||
D1( int last_time; )
|
||||
|
||||
if (strlen(file) && file[0] != '#') {
|
||||
if (file[0..1] == "./") file = file[2..];
|
||||
D1( last_time = current_time; )
|
||||
P1(("Loading: %s", file))
|
||||
// call_other(file, "");
|
||||
call_other(file, "load");
|
||||
#ifndef BROKEN_RUSAGE
|
||||
D1( current_time = rusage(); )
|
||||
D1( current_time = current_time[0] + current_time[1]; )
|
||||
#endif
|
||||
P1((" %.2f\n", (current_time - last_time)/1000.))
|
||||
}
|
||||
}
|
||||
|
||||
void inaugurate_master(int arg)
|
||||
{
|
||||
if (!arg) {
|
||||
if (previous_object() && previous_object() != this_object())
|
||||
return;
|
||||
}
|
||||
#if 0 // enable_telnet is better for what we want
|
||||
set_driver_hook(H_TELNET_NEG, "telnet_negotiation");
|
||||
#endif
|
||||
|
||||
#ifndef SANDBOX
|
||||
set_driver_hook(H_LOAD_UIDS, (: "/" :));
|
||||
set_driver_hook(H_CLONE_UIDS, (: "/" :));
|
||||
#else
|
||||
set_driver_hook(
|
||||
H_LOAD_UIDS,
|
||||
function string (string obn) {
|
||||
//string bp = program_name(obn), mp;
|
||||
string bp = program_name(find_object(obn)), mp, t;
|
||||
array(string) path;
|
||||
|
||||
#ifndef __COMPAT_MODE__
|
||||
if (bp[0] == '/') bp = bp[1..];
|
||||
#endif
|
||||
path = explode(bp, "/");
|
||||
path = sizeof(path) > 1 ? path[..<2] : ({ "/" });
|
||||
mp = path[0];
|
||||
|
||||
switch (mp) {
|
||||
case "place":
|
||||
return "/place";
|
||||
case "user":
|
||||
sscanf(bp, "%!s/%s.c", t);
|
||||
return "@" + t;
|
||||
case "net":
|
||||
if (sizeof(path) > 2) switch (path[1]) {
|
||||
case "library":
|
||||
return "/library";
|
||||
case "d":
|
||||
return "/daemon";
|
||||
}
|
||||
return "/system";
|
||||
case "drivers":
|
||||
if (abbrev("world/drivers/ldmud/master", bp)) {
|
||||
return "/master";
|
||||
}
|
||||
if (abbrev("world/drivers/ldmud/library", bp)) {
|
||||
return "/library";
|
||||
}
|
||||
}
|
||||
return "/else";
|
||||
});
|
||||
set_driver_hook(H_CLONE_UIDS,
|
||||
function array(string) (object bp, string new) {
|
||||
return ({ getuid(bp), geteuid(bp) });
|
||||
});
|
||||
#endif
|
||||
set_driver_hook(H_INCLUDE_DIRS, include_dirs());
|
||||
#ifdef SUPER_XMLRPC
|
||||
// such superfancy driver hacks make psyced less portable to muds :(
|
||||
set_driver_hook(H_DEFAULT_METHOD, function int (mixed res,
|
||||
object ob,
|
||||
string fun,
|
||||
varargs mixed *args) {
|
||||
if (program_name(ob) == NET_PATH "http/xmlrpc.c"[1..] && fun != "__INIT") {
|
||||
res = ob->request(fun, args[..<2], args[<1]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
// we use create() even if we are in compat mode -lynX 2004
|
||||
set_driver_hook(H_CREATE_SUPER, "create");
|
||||
set_driver_hook(H_CREATE_OB, "create");
|
||||
set_driver_hook(H_CREATE_CLONE, "create");
|
||||
|
||||
set_driver_hook(H_RESET, "reset");
|
||||
set_driver_hook(H_CLEAN_UP, "clean_up");
|
||||
|
||||
//set_driver_hook(H_MODIFY_COMMAND_FNAME, "modify_command");
|
||||
|
||||
// actually this should never be spit out.. we must realize we
|
||||
// are about to run out of sockets before it actually happens
|
||||
// and take action! TODO
|
||||
set_driver_hook(H_NO_IPC_SLOT, ".\n\n_failure_exhausted_sockets\n.\n\n");
|
||||
|
||||
//set_driver_hook(H_NOTIFY_FAIL, "_failure_broken_parser\n.\n\n");
|
||||
set_driver_hook(H_NOTIFY_FAIL,
|
||||
unbound_lambda(({ 'entered_command, 'cmd_giver }),
|
||||
({ #'?, ({ #'=, 'cl, ({ #'symbol_function, "internalError",
|
||||
({ #'this_object }) }) }),
|
||||
({ #'funcall, 'cl, 'entered_command }),
|
||||
({ #'write, "Huh?\n" })
|
||||
})));
|
||||
|
||||
#ifdef H_DEFAULT_PROMPT
|
||||
set_driver_hook(H_DEFAULT_PROMPT, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
string get_master_uid() { return "/master"; }
|
||||
|
||||
string get_bb_uid() { return "undefined"; }
|
||||
|
||||
#ifdef __EFUN_DEFINED(shadow)__
|
||||
/*
|
||||
* The master object is asked if it is ok to shadow object ob. Use
|
||||
* previous_object() to find out who is asking.
|
||||
*
|
||||
* In this example, we allow shadowing as long as the victim object
|
||||
* hasn't denied it with a query_prevent_shadow() returning 1.
|
||||
*/
|
||||
int query_allow_shadow(object ob) {
|
||||
#ifdef SANDBOX
|
||||
unless (stringp(geteuid(previous_object()))
|
||||
&& geteuid(previous_object())[0] == '/') {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return !ob->query_prevent_shadow(previous_object());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __EFUN_DEFINED(snoop)__
|
||||
int valid_query_snoop(object wiz) {
|
||||
// return this_player()->query_level() >= 22;
|
||||
# ifdef SANDBOX
|
||||
unless (stringp(geteuid(previous_object()))
|
||||
&& geteuid(previous_object())[0] == '/') {
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
mixed prepare_destruct(object ob) {
|
||||
//object super; // we don't use environment() in psyced
|
||||
//mixed *errors;
|
||||
//int i;
|
||||
object sh, next;
|
||||
|
||||
#if 6 * 7 != 42 || 6 * 9 == 42
|
||||
# echo master.c detected a preprocessor error.
|
||||
return "Preprocessor error";
|
||||
#endif
|
||||
|
||||
#ifdef SANDBOX
|
||||
unless (previous_object() == ob
|
||||
|| stringp(geteuid(previous_object()))
|
||||
&& geteuid(previous_object())[0] == '/') {
|
||||
return sprintf("INVALID DESTRUCT: %O tried to destruct %O\n",
|
||||
previous_object(), ob);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __EFUN_DEFINED(shadow)__
|
||||
if (!query_shadowing(ob)) for (sh = shadow(ob, 0); sh; sh = next) {
|
||||
next = shadow(sh, 0);
|
||||
funcall(bind_lambda(#'unshadow, sh)); /* avoid deep recursion */
|
||||
destruct(sh);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPMENT
|
||||
// tricky trade-off: catch is costy to have for each and every destruct
|
||||
// but to have objects which can no longer be /reload'ed is impractical
|
||||
// too. ok, if it happens on a non-development-server you need to reboot.
|
||||
catch(ob->remove());
|
||||
#else
|
||||
ob->remove(); // popular lfun to notify destruction..
|
||||
#endif
|
||||
|
||||
return 0; /* success */
|
||||
}
|
||||
|
||||
/*
|
||||
sys/debug_message.h
|
||||
* To test a new function xx in object yy, do
|
||||
* psyclpc -f "<file> <method> <args>"
|
||||
*/
|
||||
protected void flag(string str) {
|
||||
string file;
|
||||
mixed rc;
|
||||
|
||||
#ifndef _flag_execute_test_performance
|
||||
debug_message("-f called with \""+ str +"\"\n", DMSG_STAMP);
|
||||
if (sscanf(str, "%s %s", file, str) == 2)
|
||||
catch(rc = call_direct(file, explode(str, " ")...));
|
||||
else
|
||||
catch(rc = call_direct(str, "load"));
|
||||
debug_message(sprintf("-f result: %O\n", rc), DMSG_STAMP);
|
||||
#else
|
||||
string a = "_what_ever";
|
||||
rc = 99999;
|
||||
# ifdef _execute_test_performance_regmatch
|
||||
debug_message("performance test: regmatch\n");
|
||||
for (int j=rc; j; j--)
|
||||
rc = regmatch(a, "[^_0-9A-Za-z]");
|
||||
# endif
|
||||
# ifdef _execute_test_performance_loopmatch
|
||||
debug_message("performance test: heavy code\n");
|
||||
for (int j=rc; j; j--)
|
||||
for (int i=strlen(a)-1; i>=0; i--)
|
||||
unless (a[i] == '_' ||
|
||||
(a[i] >= 'a' && a[i] <= 'z') ||
|
||||
(a[i] >= '0' && a[i] <= '9') ||
|
||||
(a[i] >= 'A' && a[i] <= 'Z'))
|
||||
rc = -1;
|
||||
# endif
|
||||
#endif
|
||||
shutdown();
|
||||
}
|
398
world/drivers/ldmud/master/psycmuve.i
Normal file
398
world/drivers/ldmud/master/psycmuve.i
Normal file
|
@ -0,0 +1,398 @@
|
|||
// $Id: psycmuve.i,v 1.113 2008/01/30 17:22:41 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// this file contains the glue between LDMUD and psyced to
|
||||
// connect the socket ports to appropriately named objects.
|
||||
//
|
||||
#include NET_PATH "include/services.h"
|
||||
#include DRIVER_PATH "include/driver.h"
|
||||
#include CONFIG_PATH "config.h"
|
||||
|
||||
volatile int shutdown_in_progress = 0;
|
||||
|
||||
// not part of the master/driver API.. this is called from the library
|
||||
void notify_shutdown_first(int progress) {
|
||||
P3(("%O notify_shutdown_first(%O)\n", ME, progress))
|
||||
shutdown_in_progress = progress;
|
||||
}
|
||||
|
||||
#ifndef UID2NICK
|
||||
# ifdef _userid_nick_mapping
|
||||
# define UID2NICK(uid) ([ _userid_nick_mapping ])[uid]
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function is called every time a TCP connection is established.
|
||||
* It dispatches the ports to the protocol implementations.
|
||||
* input_to() can't be called from here.
|
||||
*
|
||||
* uid is only passed if USE_AUTHLOCAL is built into the driver.
|
||||
*/
|
||||
object connect(int uid) {
|
||||
int peerport;
|
||||
mixed arg, t;
|
||||
|
||||
D2(if (uid) D("connected on port "+query_mud_port()+" by uid "+uid+"\n");)
|
||||
#ifndef H_DEFAULT_PROMPT
|
||||
set_prompt("");
|
||||
#endif
|
||||
|
||||
if (shutdown_in_progress) {
|
||||
PT(("shutdown_in_progress(%O): putting connection from %O on hold\n",
|
||||
shutdown_in_progress, query_ip_name(ME)))
|
||||
// put the connection on hold to avoid further reconnects
|
||||
return clone_object(NET_PATH "utility/onhold");
|
||||
}
|
||||
|
||||
// we dont want the telnet machine most of the time
|
||||
// but disabling and re-enabling it for telnet doesn't work
|
||||
switch(query_mud_port()) {
|
||||
|
||||
#if HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
||||
case PSYCS_PORT: // inofficial & temporary
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
#endif // fall thru
|
||||
#if HAS_PORT(PSYC_PORT, PSYC_PATH)
|
||||
case PSYC_PORT:
|
||||
#endif
|
||||
#if HAS_PORT(PSYC_PORT, PSYC_PATH) || HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
||||
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
|
||||
arg = ME;
|
||||
query_ip_number(&arg);
|
||||
// this assumes network byte order provided by driver
|
||||
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
|
||||
if (peerport < 0) peerport = 65536 + peerport;
|
||||
// no support for non-AF_INET nets yet
|
||||
if (peerport == PSYC_SERVICE) peerport = 0;
|
||||
# else
|
||||
// as long as the object names don't collide, this is okay too
|
||||
peerport = 65536 + random(9999999);
|
||||
# endif
|
||||
# ifdef DRIVER_HAS_RENAMED_CLONES
|
||||
t = "S:psyc:"+query_ip_number();
|
||||
// tcp peerports cannot be connected to, so we use minus
|
||||
if (peerport) t += ":-"+peerport;
|
||||
# else
|
||||
t = clone_object(PSYC_PATH "server");
|
||||
# endif
|
||||
// the psyc backend distinguishes listen ports from peers using minus
|
||||
D3(D(S("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport));)
|
||||
return t -> load(query_ip_number(), -peerport);
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(SPYCS_PORT, SPYC_PATH)
|
||||
case SPYCS_PORT: // inofficial & temporary
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
#endif // fall thru
|
||||
#if HAS_PORT(SPYC_PORT, SPYC_PATH)
|
||||
case SPYC_PORT:
|
||||
#endif
|
||||
#if HAS_PORT(SPYC_PORT, SPYC_PATH) || HAS_PORT(SPYCS_PORT, SPYC_PATH)
|
||||
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
|
||||
arg = ME;
|
||||
query_ip_number(&arg);
|
||||
// this assumes network byte order provided by driver
|
||||
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
|
||||
if (peerport < 0) peerport = 65536 + peerport;
|
||||
// no support for non-AF_INET nets yet
|
||||
if (peerport == SPYC_SERVICE) peerport = 0;
|
||||
# else
|
||||
// as long as the object names don't collide, this is okay too
|
||||
peerport = 65536 + random(9999999);
|
||||
# endif
|
||||
# ifdef DRIVER_HAS_RENAMED_CLONES
|
||||
t = "S:psyc:"+query_ip_number();
|
||||
// tcp peerports cannot be connected to, so we use minus
|
||||
if (peerport) t += ":-"+peerport;
|
||||
# else
|
||||
t = clone_object(SPYC_PATH "server");
|
||||
# endif
|
||||
// the psyc backend distinguishes listen ports from peers using minus
|
||||
D3(D(S("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport));)
|
||||
return t -> load(query_ip_number(), -peerport);
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(POP3S_PORT, POP3_PATH)
|
||||
case POP3S_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(POP3_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(POP3_PORT, POP3_PATH)
|
||||
case POP3_PORT:
|
||||
return clone_object(POP3_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(SMTPS_PORT, NNTP_PATH)
|
||||
case SMTPS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(SMTP_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(SMTP_PORT, SMTP_PATH)
|
||||
case SMTP_PORT:
|
||||
return clone_object(SMTP_PATH "server");
|
||||
#endif
|
||||
|
||||
// heldensagas little http app
|
||||
#if HAS_PORT(SHT_PORT, SHT_PATH)
|
||||
case SHT_PORT:
|
||||
return clone_object(SHT_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(NNTPS_PORT, NNTP_PATH)
|
||||
case NNTPS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(NNTP_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(NNTP_PORT, NNTP_PATH)
|
||||
case NNTP_PORT:
|
||||
return clone_object(NNTP_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(JABBERS_PORT, JABBER_PATH)
|
||||
case JABBERS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(JABBER_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(JABBER_PORT, JABBER_PATH)
|
||||
case JABBER_PORT:
|
||||
# if __EFUN_DEFINED__(enable_telnet)
|
||||
enable_telnet(0); // are you sure!???
|
||||
# endif
|
||||
return clone_object(JABBER_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(JABBER_S2S_PORT, JABBER_PATH)
|
||||
case JABBER_S2S_PORT:
|
||||
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
|
||||
arg = ME;
|
||||
query_ip_number(&arg);
|
||||
// this assumes network byte order provided by driver
|
||||
peerport = pointerp(arg) ? (arg[2]*256 + arg[3]) : 0;
|
||||
if (peerport < 0) peerport = 65536 + peerport;
|
||||
if (peerport == JABBER_S2S_SERVICE) peerport = 0;
|
||||
# else
|
||||
// as long as the object names don't collide, this is okay too
|
||||
peerport = 65536 + random(9999999);
|
||||
# endif
|
||||
# if __EFUN_DEFINED__(enable_telnet)
|
||||
enable_telnet(0);
|
||||
# endif
|
||||
t = "S:xmpp:"+query_ip_number();
|
||||
// it's just an object name, but let's be consequent minus peerport
|
||||
if (peerport) t += ":-"+peerport;
|
||||
# ifdef _flag_log_sockets_XMPP
|
||||
SIMUL_EFUN_FILE -> log_file("RAW_XMPP", "\n\n%O: %O -> load(%O, %O)",
|
||||
ME, t,
|
||||
# ifdef _flag_log_hosts
|
||||
query_ip_number(),
|
||||
# else
|
||||
"?",
|
||||
# endif
|
||||
-peerport);
|
||||
# endif
|
||||
P3(("%O -> load(%O, %O)\n", t, query_ip_number(), -peerport))
|
||||
return t -> load(query_ip_number(), -peerport);
|
||||
#endif
|
||||
#if 0 //__EFUN_DEFINED__(enable_binary)
|
||||
// work in progress
|
||||
case 8888:
|
||||
enable_binary();
|
||||
enable_telnet(0);
|
||||
return clone_object(NET_PATH "socks/protocol");
|
||||
case 1935:
|
||||
enable_binary();
|
||||
enable_telnet(0);
|
||||
return clone_object(NET_PATH "rtmp/protocol");
|
||||
#endif
|
||||
#if HAS_PORT(IRCS_PORT, IRC_PATH)
|
||||
case IRCS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(IRC_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(IRC_PORT, IRC_PATH)
|
||||
case IRC_PORT:
|
||||
# if 0 // __EFUN_DEFINED__(enable_telnet)
|
||||
enable_telnet(0); // shouldn't harm.. but it does!!!
|
||||
# endif
|
||||
return clone_object(IRC_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(APPLET_PORT, APPLET_PATH)
|
||||
case APPLET_PORT:
|
||||
# if __EFUN_DEFINED__(enable_telnet)
|
||||
// enable_telnet(0);
|
||||
# endif
|
||||
return clone_object(APPLET_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(TELNETS_PORT, TELNET_PATH)
|
||||
case TELNETS_PORT:
|
||||
return clone_object(TELNET_PATH "sslserver");
|
||||
#endif
|
||||
#if HAS_PORT(TELNET_PORT, TELNET_PATH)
|
||||
case TELNET_PORT:
|
||||
// set_prompt("> ");
|
||||
t = clone_object(TELNET_PATH "server");
|
||||
# ifdef UID2NICK
|
||||
if (uid && (arg = UID2NICK(uid))) {
|
||||
t -> sName(arg);
|
||||
}
|
||||
# endif
|
||||
return t;
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(HTTPS_PORT, HTTP_PATH)
|
||||
case HTTPS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
// should it return 0 in a tls_error case?
|
||||
D1( if (t < 0) PP(( "TLS(%O) on %O: %O\n", t, query_mud_port(), tls_error(t) )); )
|
||||
D2( else if (t > 0) PP(( "Setting up TLS connection in the background.\n" )); )
|
||||
D2( else PP(( "Oh yeah, I'm initializing an https session!\n" )); )
|
||||
return clone_object(HTTP_PATH "server");
|
||||
#endif
|
||||
#if HAS_PORT(HTTP_PORT, HTTP_PATH)
|
||||
case HTTP_PORT:
|
||||
return clone_object(HTTP_PATH "server");
|
||||
#endif
|
||||
|
||||
#if HAS_PORT(MUDS_PORT, MUD_PATH)
|
||||
case MUDS_PORT:
|
||||
t = tls_init_connection(this_object());
|
||||
if (t < 0) PP(( "TLS on %O: %O\n",
|
||||
query_mud_port(), tls_error(t) ));
|
||||
return clone_object(MUD_PATH "login");
|
||||
#endif
|
||||
#if HAS_PORT(MUD_PORT, MUD_PATH)
|
||||
default:
|
||||
// if you want to multiplex psyced with an LPMUD game
|
||||
// set_prompt("> ");
|
||||
return clone_object(MUD_PATH "login");
|
||||
#endif
|
||||
}
|
||||
|
||||
PP(("Received connection on port %O which isn't configured.\n",
|
||||
query_mud_port()));
|
||||
return (object)0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRIVER_HAS_RENAMED_CLONES
|
||||
// named clones -lynx
|
||||
object compile_object(string file) {
|
||||
string path, name;
|
||||
object rob;
|
||||
|
||||
# ifdef PSYC_PATH
|
||||
if (abbrev("S:psyc:", file)) {
|
||||
rob = clone_object(PSYC_PATH "server");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
if (abbrev("psyc:", file)) {
|
||||
rob = clone_object(PSYC_PATH "active");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
# endif
|
||||
# ifdef SPYC_PATH
|
||||
if (abbrev("S:psyc:", file)) {
|
||||
rob = clone_object(SPYC_PATH "server");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
if (abbrev("psyc:", file)) {
|
||||
rob = clone_object(SPYC_PATH "active");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
# endif
|
||||
# ifdef HTTP_PATH
|
||||
// match both http:/ and https:/ objects ;D
|
||||
if (abbrev("http", file)) {
|
||||
rob = clone_object(HTTP_PATH "fetch");
|
||||
if (rob) rob->fetch(file[..<3]);
|
||||
return rob;
|
||||
}
|
||||
if (abbrev("xmlrpc:", file)) {
|
||||
rob = clone_object(HTTP_PATH "xmlrpc");
|
||||
if (rob) rob->fetch("http://" + file[7..<3]);
|
||||
return rob;
|
||||
}
|
||||
# endif
|
||||
if (sscanf(file, "%s#%s.c", path, name) && name != "") {
|
||||
// my function in simul_efun
|
||||
unless (name = SIMUL_EFUN_FILE->legal_name(name)) return (object)0;
|
||||
|
||||
rob = clone_object(path);
|
||||
rob -> sName(name);
|
||||
D2(if (rob) PP(("NAMED CLONE: %O becomes %s of %s\n",
|
||||
rob, name, path));)
|
||||
return rob;
|
||||
}
|
||||
if (sscanf(file, "place/%s.c", name) && name != "") {
|
||||
#ifdef SANDBOX
|
||||
string t;
|
||||
#endif
|
||||
// my function in simul_efun
|
||||
unless (name = SIMUL_EFUN_FILE->legal_name(name)) return (object)0;
|
||||
|
||||
#ifdef SANDBOX
|
||||
if (file_size(t = USER_PATH + name + ".c") != -1) {
|
||||
rob = t -> sName(name);
|
||||
D2(if (rob) PP(("USER PLACE loaded: %O becomes %O\n", rob, file));)
|
||||
} else {
|
||||
#endif
|
||||
#ifdef _flag_disable_places_arbitrary
|
||||
P2(("WARN: cloned places disabled by #define %O\n", file))
|
||||
return (object)0;
|
||||
#else
|
||||
#ifdef _path_archetype_place_default
|
||||
rob = clone_object(_path_archetype_place_default);
|
||||
#else
|
||||
rob = clone_object(NET_PATH "place/default");
|
||||
#endif
|
||||
rob -> sName(name);
|
||||
D2(if (rob) PP(("PLACE CLONED: %O becomes %O\n", rob, file));)
|
||||
#endif
|
||||
#ifdef SANDBOX
|
||||
}
|
||||
#endif
|
||||
return rob;
|
||||
}
|
||||
if (sscanf(file, "%s/text.c", path) && path != "") {
|
||||
rob = clone_object(NET_PATH "text");
|
||||
rob -> sPath(path);
|
||||
D2(if (rob) PP(("DB CLONED: %O becomes %s/text\n", rob, path));)
|
||||
return rob;
|
||||
}
|
||||
# ifdef JABBER_PATH
|
||||
if (abbrev("S:xmpp:", file)) {
|
||||
rob = clone_object(JABBER_PATH "gateway");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
if (abbrev("C:xmpp:", file)) {
|
||||
rob = clone_object(JABBER_PATH "active");
|
||||
D2(if (rob) PP(("NAMED CLONE: %O => %s\n", rob, file));)
|
||||
return rob;
|
||||
}
|
||||
# endif
|
||||
P0(("WARN: could not create %O\n", file))
|
||||
return (object)0;
|
||||
}
|
||||
#endif
|
||||
|
11
world/drivers/ldmud/sys/comm.h
Normal file
11
world/drivers/ldmud/sys/comm.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef LPC_COMM_H_
|
||||
#define LPC_COMM_H_
|
||||
|
||||
/* Mode values recognized by the efun get_combine_charset()
|
||||
* and get_connection_charset() */
|
||||
|
||||
#define CHARSET_VECTOR 0 /* Return the charset as bitvector array */
|
||||
#define CHARSET_STRING 1 /* Return the charset as string */
|
||||
#define CHARSET_QUOTE_IAC 2 /* Return the status of the IAC quoting */
|
||||
|
||||
#endif /* LPC_COMM_H_ */
|
50
world/drivers/ldmud/sys/commands.h
Normal file
50
world/drivers/ldmud/sys/commands.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef LPC_COMMANDS_H_
|
||||
#define LPC_COMMANDS_H_
|
||||
|
||||
/* Flags accepted by add_action(fun, verb, flag).
|
||||
* (Below, VERB is what the player enters).
|
||||
* Negative flag values allow VERB to be just the first -<flag>
|
||||
* characters of <verb> (abbreviated verb).
|
||||
*/
|
||||
|
||||
#define AA_VERB 0 /* VERB must be <verb> */
|
||||
#define AA_SHORT 1 /* VERB must start with <verb>,
|
||||
* args do not include extra characters */
|
||||
#define AA_NOSPACE 2 /* VERB must start with <verb>,
|
||||
* args and verb do include extra characters */
|
||||
#define AA_IMM_ARGS 3 /* VERB must start with <verb>,
|
||||
* args do include extra characters */
|
||||
|
||||
/* Bitflags accepted by query_actions(object ob, int mask)
|
||||
*/
|
||||
|
||||
#define QA_VERB 1
|
||||
#define QA_TYPE 2
|
||||
#define QA_SHORT_VERB 4
|
||||
#define QA_OBJECT 8
|
||||
#define QA_FUNCTION 16
|
||||
|
||||
|
||||
/* Indices in the arrays returned from command_stack()
|
||||
*/
|
||||
|
||||
#define CMD_VERB 0
|
||||
#define CMD_TEXT 1
|
||||
#define CMD_ORIGIN 2
|
||||
#define CMD_PLAYER 3
|
||||
#define CMD_FAIL 4
|
||||
#define CMD_FAILOBJ 5
|
||||
|
||||
#define CMD_SIZE 6
|
||||
|
||||
|
||||
/* Indices into the subarrays returned from match_command()
|
||||
*/
|
||||
#define CMDM_VERB 0
|
||||
#define CMDM_ARG 1
|
||||
#define CMDM_OBJECT 2
|
||||
#define CMDM_FUN 3
|
||||
|
||||
#define CMDM_SIZE 4
|
||||
|
||||
#endif /* LPC_COMMANDS_H_ */
|
240
world/drivers/ldmud/sys/debug_info.h
Normal file
240
world/drivers/ldmud/sys/debug_info.h
Normal file
|
@ -0,0 +1,240 @@
|
|||
#ifndef LPC_DEBUG_INFO_H_
|
||||
#define LPC_DEBUG_INFO_H_ 1
|
||||
|
||||
/* Request values for efun debug_info().
|
||||
*/
|
||||
|
||||
#define DINFO_OBJECT 0 /* Print information about an object */
|
||||
#define DINFO_MEMORY 1 /* Print memory usage of an object */
|
||||
#define DINFO_OBJLIST 2 /* Return an object from the global list */
|
||||
#define DINFO_MALLOC 3 /* Print the information from the 'malloc' cmd */
|
||||
#define DINFO_STATUS 4 /* Return the 'status' information */
|
||||
#define DINFO_DUMP 5 /* Dump some special information into files */
|
||||
#define DINFO_DATA 6 /* Return internal information */
|
||||
#define DINFO_TRACE 7 /* Return the current call trace */
|
||||
|
||||
/* Sub-request values for debug_info(DINFO_DATA) */
|
||||
|
||||
#define DID_STATUS 0 /* Return the 'status' and 'status tables' information */
|
||||
#define DID_SWAP 1 /* Return the 'status swap' information */
|
||||
#define DID_MEMORY 2 /* Return the 'status malloc' information */
|
||||
|
||||
/* Sub-request values for debug_info(DINFO_TRACE) */
|
||||
|
||||
#define DIT_CURRENT 0 /* Return the current call chain as an array */
|
||||
#define DIT_ERROR 1 /* Return the last error call chain as an array */
|
||||
#define DIT_UNCAUGHT_ERROR 2 /* Return the last uncaught error call chain */
|
||||
#define DIT_STR_CURRENT 3 /* Return the current call chain as a string */
|
||||
|
||||
/* Indices into the array resulting from debug_info(DINFO_DATA, DID_STATUS)
|
||||
*/
|
||||
|
||||
#define DID_ST_ACTIONS 0
|
||||
#define DID_ST_ACTIONS_SIZE 1
|
||||
#define DID_ST_SHADOWS 2
|
||||
#define DID_ST_SHADOWS_SIZE 3
|
||||
|
||||
#define DID_ST_OBJECTS 4
|
||||
#define DID_ST_OBJECTS_SIZE 5
|
||||
#define DID_ST_OBJECTS_SWAPPED 6
|
||||
#define DID_ST_OBJECTS_SWAP_SIZE 7
|
||||
#define DID_ST_OBJECTS_LIST 8
|
||||
#define DID_ST_OBJECTS_NEWLY_DEST 9
|
||||
#define DID_ST_OBJECTS_DESTRUCTED 10
|
||||
#define DID_ST_OBJECTS_PROCESSED 11
|
||||
#define DID_ST_OBJECTS_AVG_PROC 12
|
||||
|
||||
#define DID_ST_OTABLE 13
|
||||
#define DID_ST_OTABLE_SLOTS 14
|
||||
#define DID_ST_OTABLE_SIZE 15
|
||||
|
||||
#define DID_ST_HBEAT_OBJS 16
|
||||
#define DID_ST_HBEAT_CALLS 17
|
||||
#define DID_ST_HBEAT_CALLS_TOTAL 18
|
||||
#define DID_ST_HBEAT_SLOTS 19
|
||||
#define DID_ST_HBEAT_SIZE 20
|
||||
#define DID_ST_HBEAT_PROCESSED 21
|
||||
#define DID_ST_HBEAT_AVG_PROC 22
|
||||
|
||||
#define DID_ST_CALLOUTS 23
|
||||
#define DID_ST_CALLOUT_SIZE 24
|
||||
|
||||
#define DID_ST_ARRAYS 25
|
||||
#define DID_ST_ARRAYS_SIZE 26
|
||||
|
||||
#define DID_ST_MAPPINGS 27
|
||||
#define DID_ST_MAPPINGS_SIZE 28
|
||||
#define DID_ST_HYBRID_MAPPINGS 51
|
||||
#define DID_ST_HASH_MAPPINGS 54
|
||||
|
||||
#define DID_ST_STRUCTS 29
|
||||
#define DID_ST_STRUCTS_SIZE 30
|
||||
#define DID_ST_STRUCT_TYPES 31
|
||||
#define DID_ST_STRUCT_TYPES_SIZE 32
|
||||
|
||||
#define DID_ST_PROGS 33
|
||||
#define DID_ST_PROGS_SIZE 34
|
||||
|
||||
#define DID_ST_PROGS_SWAPPED 35
|
||||
#define DID_ST_PROGS_SWAP_SIZE 36
|
||||
|
||||
#define DID_ST_USER_RESERVE 37
|
||||
#define DID_ST_MASTER_RESERVE 38
|
||||
#define DID_ST_SYSTEM_RESERVE 39
|
||||
|
||||
#define DID_ST_ADD_MESSAGE 40
|
||||
#define DID_ST_PACKETS 41
|
||||
#define DID_ST_PACKET_SIZE 42
|
||||
#define DID_ST_PACKETS_IN 43
|
||||
#define DID_ST_PACKET_SIZE_IN 44
|
||||
|
||||
#define DID_ST_APPLY 45
|
||||
#define DID_ST_APPLY_HITS 46
|
||||
|
||||
#define DID_ST_STRINGS 47
|
||||
#define DID_ST_STRING_SIZE 48
|
||||
#define DID_ST_STR_TABLE_SIZE 49
|
||||
#define DID_ST_STR_OVERHEAD 50
|
||||
#define DID_ST_UNTABLED 52
|
||||
#define DID_ST_UNTABLED_SIZE 53
|
||||
#define DID_ST_UNUSED54 54 /* UNUSED */
|
||||
#define DID_ST_UNUSED55 55 /* UNUSED */
|
||||
#define DID_ST_TABLED 56
|
||||
#define DID_ST_TABLED_SIZE 57
|
||||
#define DID_ST_STR_SEARCHES 58
|
||||
#define DID_ST_STR_SEARCHLEN 59
|
||||
#define DID_ST_STR_SEARCHES_BYVALUE 60
|
||||
#define DID_ST_STR_SEARCHLEN_BYVALUE 61
|
||||
#define DID_ST_STR_CHAINS 62
|
||||
#define DID_ST_STR_ADDED 63
|
||||
#define DID_ST_STR_DELETED 64
|
||||
#define DID_ST_STR_COLLISIONS 65
|
||||
#define DID_ST_STR_FOUND 66
|
||||
#define DID_ST_STR_FOUND_BYVALUE 67
|
||||
|
||||
#define DID_ST_RX_CACHED 68
|
||||
#define DID_ST_RX_TABLE 69
|
||||
#define DID_ST_RX_TABLE_SIZE 70
|
||||
#define DID_ST_RX_REQUESTS 71
|
||||
#define DID_ST_RX_REQ_FOUND 72
|
||||
#define DID_ST_RX_REQ_COLL 73
|
||||
|
||||
#define DID_ST_MB_FILE 74
|
||||
#define DID_ST_MB_SWAP 75
|
||||
|
||||
#define DID_ST_BOOT_TIME 76
|
||||
|
||||
#define DID_STATUS_MAX 77 /* Total number of entries */
|
||||
|
||||
|
||||
/* Indices into the array resulting from debug_info(DINFO_DATA, DID_SWAP)
|
||||
*/
|
||||
|
||||
#define DID_SW_PROGS 0
|
||||
#define DID_SW_PROG_SIZE 1
|
||||
#define DID_SW_PROG_UNSWAPPED 2
|
||||
#define DID_SW_PROG_U_SIZE 3
|
||||
#define DID_SW_VARS 4
|
||||
#define DID_SW_VAR_SIZE 5
|
||||
#define DID_SW_FREE 6
|
||||
#define DID_SW_FREE_SIZE 7
|
||||
#define DID_SW_FILE_SIZE 8
|
||||
#define DID_SW_REUSED 9
|
||||
#define DID_SW_SEARCHES 10
|
||||
#define DID_SW_SEARCH_LEN 11
|
||||
#define DID_SW_F_SEARCHES 12
|
||||
#define DID_SW_F_SEARCH_LEN 13
|
||||
#define DID_SW_COMPACT 14
|
||||
#define DID_SW_RECYCLE_FREE 15
|
||||
|
||||
#define DID_SWAP_MAX 16
|
||||
|
||||
|
||||
/* Indices into the array resulting from debug_info(DINFO_DATA, DID_MEMORY)
|
||||
*/
|
||||
|
||||
#define DID_MEM_NAME 0
|
||||
#define DID_MEM_SBRK 1
|
||||
#define DID_MEM_SBRK_SIZE 2
|
||||
#define DID_MEM_LARGE 3
|
||||
#define DID_MEM_LARGE_SIZE 4
|
||||
#define DID_MEM_MMAP (DID_MEM_LARGE)
|
||||
#define DID_MEM_MMAP_SIZE (DID_MEM_LARGE_SIZE)
|
||||
#define DID_MEM_LFREE 5
|
||||
#define DID_MEM_FREE_CHUNKS (DID_MEM_LFREE)
|
||||
#define DID_MEM_LFREE_SIZE 6
|
||||
#define DID_MEM_LWASTED 7
|
||||
#define DID_MEM_LWASTED_SIZE 8
|
||||
#define DID_MEM_KEEP_COST (DID_MEM_LWASTED_SIZE)
|
||||
#define DID_MEM_CHUNK 9
|
||||
#define DID_MEM_CHUNK_SIZE 10
|
||||
#define DID_MEM_SLAB (DID_MEM_CHUNK)
|
||||
#define DID_MEM_SLAB_SIZE (DID_MEM_CHUNK_SIZE)
|
||||
#define DID_MEM_MAX_ALLOCATED (DID_MEM_CHUNK_SIZE)
|
||||
#define DID_MEM_SMALL 11
|
||||
#define DID_MEM_SMALL_SIZE 12
|
||||
#define DID_MEM_SFREE 13
|
||||
#define DID_MEM_SFREE_SIZE 14
|
||||
#define DID_MEM_FFREE (DID_MEM_SFREE)
|
||||
#define DID_MEM_FFREE_SIZE (DID_MEM_SFREE_SIZE)
|
||||
#define DID_MEM_SWASTED 15
|
||||
#define DID_MEM_SWASTED_SIZE 16
|
||||
#define DID_MEM_SMALL_OVERHEAD_SIZE (DID_MEM_SWASTED_SIZE)
|
||||
#define DID_MEM_MINC_CALLS 17
|
||||
#define DID_MEM_MINC_SUCCESS 19
|
||||
#define DID_MEM_MINC_SIZE 19
|
||||
#define DID_MEM_PERM 20
|
||||
#define DID_MEM_PERM_SIZE 21
|
||||
#define DID_MEM_CLIB 22
|
||||
#define DID_MEM_CLIB_SIZE 23
|
||||
#define DID_MEM_OVERHEAD 24
|
||||
#define DID_MEM_ALLOCATED 25
|
||||
#define DID_MEM_USED 26
|
||||
#define DID_MEM_TOTAL_UNUSED 27
|
||||
#define DID_MEM_DEFRAG_CALLS 28
|
||||
#define DID_MEM_DEFRAG_CALLS_REQ 29
|
||||
#define DID_MEM_SLAB_FREE (DID_MEM_DEFRAG_CALLS)
|
||||
#define DID_MEM_SLAB_FREE_SIZE (DID_MEM_DEFRAG_CALLS_REQ)
|
||||
#define DID_MEM_DEFRAG_REQ_SUCCESS 30
|
||||
#define DID_MEM_DEFRAG_BLOCKS_INSPECTED 31
|
||||
#define DID_MEM_DEFRAG_BLOCKS_MERGED 32
|
||||
#define DID_MEM_DEFRAG_BLOCKS_RESULT 33
|
||||
#define DID_MEM_AVL_NODES 34
|
||||
#define DID_MEM_EXT_STATISTICS 35
|
||||
|
||||
#define DID_MEMORY_MAX 36
|
||||
|
||||
/* Indices into the subarrays of DID_MEM_EXT_STATISTICS (if given) */
|
||||
|
||||
#define DID_MEM_ES_MAX_ALLOC 0
|
||||
#define DID_MEM_ES_CUR_ALLOC 1
|
||||
#define DID_MEM_ES_MAX_FREE 2
|
||||
#define DID_MEM_ES_CUR_FREE 3
|
||||
#define DID_MEM_ES_AVG_XALLOC 4
|
||||
#define DID_MEM_ES_AVG_XFREE 5
|
||||
#define DID_MEM_ES_FULL_SLABS 6
|
||||
#define DID_MEM_ES_FREE_SLABS 7
|
||||
#define DID_MEM_ES_TOTAL_SLABS 8
|
||||
|
||||
#define DID_MEM_ES_MAX 9
|
||||
|
||||
/* Indices into the subarrays resulting from debug_info(DINFO_TRACE, 0)
|
||||
*/
|
||||
|
||||
#define TRACE_TYPE 0
|
||||
#define TRACE_NAME 1
|
||||
#define TRACE_PROGRAM 2
|
||||
#define TRACE_OBJECT 3
|
||||
#define TRACE_LOC 4
|
||||
|
||||
#define TRACE_MAX 5
|
||||
|
||||
/* Values for entry TRACE_TYPE */
|
||||
|
||||
#define TRACE_TYPE_SYMBOL 0
|
||||
#define TRACE_TYPE_SEFUN 1
|
||||
#define TRACE_TYPE_EFUN 2
|
||||
#define TRACE_TYPE_LAMBDA 3
|
||||
#define TRACE_TYPE_LFUN 4
|
||||
|
||||
#endif /* LPC_DEBUG_INFO_H_ */
|
18
world/drivers/ldmud/sys/debug_message.h
Normal file
18
world/drivers/ldmud/sys/debug_message.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef LPC_DEBUG_MESSAGE_H_
|
||||
#define LPC_DEBUG_MESSAGE_H_ 1
|
||||
|
||||
/* Definitions and macros for the debug_message() */
|
||||
|
||||
#define DMSG_DEFAULT 0 /* log to stdout and .debug.log */
|
||||
#define DMSG_STDOUT (1 << 0) /* log to stdout */
|
||||
#define DMSG_STDERR (1 << 1) /* log to stderr */
|
||||
#define DMSG_LOGFILE (1 << 2) /* log to .debug.log */
|
||||
|
||||
#define DMSG_STAMP (1 << 3) /* Prepend the timestamp */
|
||||
|
||||
/* Derived macros */
|
||||
|
||||
#define DMSG_TARGET (DMSG_STDOUT|DMSG_STDERR|DMSG_LOGFILE)
|
||||
/* Mask for all target bitflags */
|
||||
|
||||
#endif /* LPC_DEBUG_MESSAGE_H_ */
|
35
world/drivers/ldmud/sys/driver_hook.h
Normal file
35
world/drivers/ldmud/sys/driver_hook.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef LPC_DRIVER_HOOK_H_
|
||||
#define LPC_DRIVER_HOOK_H_ 1
|
||||
|
||||
/* --- Driver Hooks ---
|
||||
*/
|
||||
|
||||
#define H_MOVE_OBJECT0 0
|
||||
#define H_MOVE_OBJECT1 1
|
||||
#define H_LOAD_UIDS 2
|
||||
#define H_CLONE_UIDS 3
|
||||
#define H_CREATE_SUPER 4
|
||||
#define H_CREATE_OB 5
|
||||
#define H_CREATE_CLONE 6
|
||||
#define H_RESET 7
|
||||
#define H_CLEAN_UP 8
|
||||
#define H_MODIFY_COMMAND 9
|
||||
#define H_NOTIFY_FAIL 10
|
||||
#define H_NO_IPC_SLOT 11
|
||||
#define H_INCLUDE_DIRS 12
|
||||
#define H_TELNET_NEG 13
|
||||
#define H_NOECHO 14
|
||||
#define H_ERQ_STOP 15
|
||||
#define H_MODIFY_COMMAND_FNAME 16
|
||||
#define H_COMMAND 17
|
||||
#define H_SEND_NOTIFY_FAIL 18
|
||||
#define H_AUTO_INCLUDE 19
|
||||
#define H_DEFAULT_METHOD 20
|
||||
#define H_DEFAULT_PROMPT 21
|
||||
#define H_PRINT_PROMPT 22
|
||||
#define H_REGEXP_PACKAGE 23
|
||||
|
||||
#define NUM_DRIVER_HOOKS 24 /* Number of hooks */
|
||||
|
||||
#endif /* LPC_DRIVER_HOOK_ */
|
||||
|
59
world/drivers/ldmud/sys/erq.h
Normal file
59
world/drivers/ldmud/sys/erq.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* external request demon interface definitions */
|
||||
|
||||
#ifndef LPC__ERQ_H__
|
||||
#define LPC__ERQ_H__ 1
|
||||
|
||||
/* servive request types */
|
||||
|
||||
#define ERQ_RLOOKUP 0 /* Lookup ip -> name */
|
||||
#define ERQ_EXECUTE 1 /* Execute a program */
|
||||
#define ERQ_FORK 2 /* Fork a program */
|
||||
#define ERQ_AUTH 3 /* Connect to a remote authd */
|
||||
#define ERQ_SPAWN 4 /* Spawn a program */
|
||||
#define ERQ_SEND 5 /* Send data to a program or connection */
|
||||
#define ERQ_KILL 6 /* Kill a program or connection */
|
||||
#define ERQ_OPEN_UDP 7 /* Open a UDP socket */
|
||||
#define ERQ_OPEN_TCP 8 /* Open a TCP connection */
|
||||
#define ERQ_LISTEN 9 /* Open a TCP accept-socket */
|
||||
#define ERQ_ACCEPT 10 /* Accept a connection from a accept-socket */
|
||||
#define ERQ_LOOKUP 11 /* Lookup name -> ip */
|
||||
|
||||
#ifdef __IPV6__
|
||||
#define ERQ_RLOOKUPV6 12 /* Lookup name/ip6 */
|
||||
#endif
|
||||
|
||||
/* Additional service request type flags evaluated by efun send_erq().
|
||||
* The ERQ itself won't get to see it.
|
||||
*/
|
||||
|
||||
#define ERQ_CB_STRING (1 << 31) /* Callback closure takes a string arg */
|
||||
|
||||
|
||||
/* answers from ERQ_EXECUTE / ERQ_FORK */
|
||||
|
||||
#define ERQ_OK 0
|
||||
#define ERQ_SIGNALED 1
|
||||
#define ERQ_E_NOTFOUND 2 /* process not found by wait */
|
||||
#define ERQ_E_UNKNOWN 3 /* unknown exit condition from wait() */
|
||||
#define ERQ_E_ARGLENGTH 4
|
||||
#define ERQ_E_ARGFORMAT 5
|
||||
#define ERQ_E_ARGNUMBER 6
|
||||
#define ERQ_E_ILLEGAL 7
|
||||
#define ERQ_E_PATHLEN 8
|
||||
#define ERQ_E_FORKFAIL 9
|
||||
#define ERQ_E_TICKET 11
|
||||
#define ERQ_E_INCOMPLETE 12
|
||||
#define ERQ_E_WOULDBLOCK 13
|
||||
#define ERQ_E_PIPE 14
|
||||
#define ERQ_STDOUT 15 /* Normal data received */
|
||||
#define ERQ_STDERR 16
|
||||
#define ERQ_EXITED 17 /* Connection closed on EOF */
|
||||
#define ERQ_E_NSLOTS 18
|
||||
|
||||
/* reserved handles */
|
||||
|
||||
#define ERQ_HANDLE_RLOOKUP (-1)
|
||||
#define ERQ_HANDLE_KEEP_HANDLE (-2)
|
||||
#define ERQ_HANDLE_RLOOKUPV6 (-3)
|
||||
|
||||
#endif /* LPC__ERQ_H__ */
|
129
world/drivers/ldmud/sys/errno.h
Normal file
129
world/drivers/ldmud/sys/errno.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* these are the linux values.. */
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
29
world/drivers/ldmud/sys/files.h
Normal file
29
world/drivers/ldmud/sys/files.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef LPC_FILES_H_
|
||||
#define LPC_FILES_H_ 1
|
||||
|
||||
/* Definitions and macros for the various file efuns */
|
||||
|
||||
/* Special return values of file_size() and the size part of get_dir().
|
||||
*/
|
||||
|
||||
#define FSIZE_NOFILE -1 /* File doesn't exist or is not readable */
|
||||
#define FSIZE_DIR -2 /* The file is actually a directory */
|
||||
|
||||
|
||||
/* Flag values for get_dir().
|
||||
*/
|
||||
|
||||
#define GETDIR_EMPTY (0) /* return an empty array (not very useful) */
|
||||
#define GETDIR_NAMES (0x01) /* return the filenames */
|
||||
#define GETDIR_SIZES (0x02) /* return the file sizes */
|
||||
#define GETDIR_DATES (0x04) /* return the dates of last modification */
|
||||
/* (0x08) unused */
|
||||
#define GETDIR_ACCESS (0x40) /* return the dates of last access */
|
||||
#define GETDIR_MODES (0x80) /* return the file mode */
|
||||
|
||||
#define GETDIR_PATH (0x10) /* with _NAMES: add the path to the filenames */
|
||||
#define GETDIR_UNSORTED (0x20) /* return the results unsorted */
|
||||
|
||||
#define GETDIR_ALL (0xDF) /* return all */
|
||||
|
||||
#endif /* LPC_FILES_H_ */
|
69
world/drivers/ldmud/sys/functionlist.h
Normal file
69
world/drivers/ldmud/sys/functionlist.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
#ifndef LPC_FUNCTIONLIST_H
|
||||
#define LPC_FUNCTIONLIST_H
|
||||
|
||||
#ifndef __DRIVER_SOURCE__
|
||||
#include "lpctypes.h"
|
||||
|
||||
#define NAME_INHERITED 0x80000000 /* Defined by inheritance */
|
||||
#define TYPE_MOD_STATIC 0x40000000 /* Static function or variable */
|
||||
#define TYPE_MOD_NO_MASK 0x20000000 /* The nomask => not redefineable */
|
||||
#define TYPE_MOD_PRIVATE 0x10000000 /* Can't be inherited */
|
||||
#define TYPE_MOD_PUBLIC 0x08000000 /* Force inherit through private */
|
||||
#define TYPE_MOD_VARARGS 0x04000000 /* Used for type checking */
|
||||
#define TYPE_MOD_VIRTUAL 0x02000000 /* can be re- and cross- defined */
|
||||
#define TYPE_MOD_PROTECTED 0x01000000 /* cannot be called externally */
|
||||
#define TYPE_MOD_XVARARGS 0x00800000 /* accepts optional arguments */
|
||||
#define TYPE_MOD_NOSAVE TYPE_MOD_STATIC /* vars: can't be saved */
|
||||
/* Internally TYPE_MOD_NOSAVE is 0x00400000, but that never leaves
|
||||
* the compiler.
|
||||
*/
|
||||
#define NAME_CROSS_DEFINED 0x00080000 /* function defined from other program */
|
||||
#if defined(__LPC_STRUCTS__) || defined(USE_STRUCTS)
|
||||
#define NAME_HIDDEN 0x00020000 /* Not visible for inheritance */
|
||||
#define NAME_PROTOTYPE 0x00010000 /* Defined by a prototype only */
|
||||
#define NAME_UNDEFINED 0x00008000 /* Not defined yet */
|
||||
#define NAME_TYPES_LOST 0x00004000 /* inherited, no save_types */
|
||||
#else /* !USE_STRUCTS */
|
||||
#define NAME_HIDDEN 0x00000800 /* Not visible for inheritance */
|
||||
#define NAME_PROTOTYPE 0x00000400 /* Defined by a prototype only */
|
||||
#define NAME_UNDEFINED 0x00000200 /* Not defined yet */
|
||||
#define NAME_TYPES_LOST 0x00000100 /* inherited, no save_types */
|
||||
#endif /* USE_STRUCTS */
|
||||
|
||||
#endif /* !__DRIVER_SOURCE__ */
|
||||
|
||||
|
||||
/* Return value flag types for functionlist() and variable_list() */
|
||||
|
||||
#define RETURN_FUNCTION_NAME 0x01
|
||||
#define RETURN_FUNCTION_FLAGS 0x02
|
||||
#define RETURN_FUNCTION_TYPE 0x04
|
||||
|
||||
|
||||
/* Additional return value flag types for functionlist() */
|
||||
|
||||
#define RETURN_FUNCTION_NUMARG 0x08
|
||||
#define RETURN_FUNCTION_ARGTYPE 0x10 /* not implemented */
|
||||
|
||||
|
||||
/* Additional return value flag types for variable_list() */
|
||||
|
||||
#define RETURN_VARIABLE_VALUE 0x08
|
||||
|
||||
|
||||
/* Masks of the flag unions allowed for various efuns: */
|
||||
#define RETURN_FUNCTION_MASK 0x0f /* functionlist() */
|
||||
#define RETURN_VARIABLE_MASK 0x0f /* variable_list() */
|
||||
|
||||
/* Return value flag types for function_exists() */
|
||||
|
||||
#define FEXISTS_PROGNAME (0)
|
||||
#define FEXISTS_FILENAME (1)
|
||||
#define FEXISTS_LINENO (2)
|
||||
#define FEXISTS_NUMARG (3)
|
||||
#define FEXISTS_TYPE (4)
|
||||
#define FEXISTS_FLAGS (5)
|
||||
|
||||
#define FEXISTS_ALL (3)
|
||||
|
||||
#endif /* LPC_FUNCTIONLIST_H */
|
26
world/drivers/ldmud/sys/idn.h
Normal file
26
world/drivers/ldmud/sys/idn.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef LPC_IDN_H_
|
||||
#define LPC_IDN_H_ 1
|
||||
|
||||
/* --- IDNA Constants ---
|
||||
*/
|
||||
|
||||
/* idna_stringprep() profiles. */
|
||||
|
||||
#define STRINGPREP_NAMEPREP 1
|
||||
#define STRINGPREP_SASLPREP 2
|
||||
#define STRINGPREP_PLAIN 3
|
||||
#define STRINGPREP_TRACE 4
|
||||
#define STRINGPREP_KERBEROS5 5
|
||||
#define STRINGPREP_XMPP_NODEPREP 6
|
||||
#define STRINGPREP_XMPP_RESOURCEPREP 7
|
||||
#define STRINGPREP_ISCSI 8
|
||||
|
||||
/* idna_stringprep() flags */
|
||||
|
||||
#define STRINGPREP_NO_NFKC_FLAG (1<<0)
|
||||
#define STRINGPREP_NO_BIDI_FLAG (1<<1)
|
||||
#define STRINGPREP_NO_UNASSIGNED_FLAG (1<<2)
|
||||
|
||||
#define STRINGPREP_FLAG_MAX (1<<2)
|
||||
|
||||
#endif
|
9
world/drivers/ldmud/sys/include_list.h
Normal file
9
world/drivers/ldmud/sys/include_list.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef LPC_INCLUDE_LIST_H
|
||||
#define LPC_INCLUDE_LIST_H
|
||||
|
||||
/* Return value flag types for include_list() */
|
||||
|
||||
#define INCLIST_FLAT 0x00
|
||||
#define INCLIST_TREE 0x01
|
||||
|
||||
#endif /* LPC_INCLUDE_LIST_H */
|
10
world/drivers/ldmud/sys/inherit_list.h
Normal file
10
world/drivers/ldmud/sys/inherit_list.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef LPC_INHERIT_LIST_H
|
||||
#define LPC_INHERIT_LIST_H
|
||||
|
||||
/* Return value flag types for inherit_list() */
|
||||
|
||||
#define INHLIST_FLAT 0x00
|
||||
#define INHLIST_TREE 0x01
|
||||
#define INHLIST_TAG_VIRTUAL 0x02
|
||||
|
||||
#endif /* LPC_INHERIT_LIST_H */
|
18
world/drivers/ldmud/sys/input_to.h
Normal file
18
world/drivers/ldmud/sys/input_to.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef LPC_INPUT_TO_H_
|
||||
#define LPC_INPUT_TO_H_
|
||||
|
||||
/* Mode values recognized by the efun input_to() */
|
||||
|
||||
#define INPUT_NOECHO 1 /* Don't echo the next line typed */
|
||||
#define INPUT_CHARMODE 2 /* Switch into/out of charmode */
|
||||
#define INPUT_PROMPT 4 /* Use a custom prompt */
|
||||
#define INPUT_NO_TELNET 8 /* Switch into/out of charmode on the driver
|
||||
* side only.
|
||||
*/
|
||||
#define INPUT_APPEND 16 /* Append the input_to to the list of already
|
||||
* pending input_to's.
|
||||
*/
|
||||
/* #define INPUT_BINARY 32 -- nice, but noone has coded it */
|
||||
#define INPUT_IGNORE_BANG 128 /* Disallow the '!' escape */
|
||||
|
||||
#endif /* LPC_INPUT_TO_H_ */
|
68
world/drivers/ldmud/sys/lpctypes.h
Normal file
68
world/drivers/ldmud/sys/lpctypes.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef LPC_LPCTYPES_H
|
||||
#define LPC_LPCTYPES_H
|
||||
|
||||
/* compile time types, from functionlist() */
|
||||
|
||||
#define TYPE_UNKNOWN 0 /* This type must be casted */
|
||||
#define TYPE_NUMBER 1
|
||||
#define TYPE_STRING 2
|
||||
#define TYPE_VOID 3
|
||||
#define TYPE_OBJECT 4
|
||||
#define TYPE_MAPPING 5
|
||||
#define TYPE_FLOAT 6
|
||||
#define TYPE_ANY 7 /* Will match any type */
|
||||
#define TYPE_CLOSURE 8
|
||||
#define TYPE_SYMBOL 9
|
||||
#define TYPE_QUOTED_ARRAY 10
|
||||
#if defined(USE_STRUCTS) || defined(__LPC_STRUCTS__)
|
||||
#define TYPE_STRUCT 11
|
||||
#endif
|
||||
|
||||
#define TYPE_MOD_POINTER 0x0040 /* Pointer to a basic type */
|
||||
|
||||
/* runtime types, from typeof() */
|
||||
|
||||
#define T_INVALID 0x0
|
||||
#define T_LVALUE 0x1
|
||||
#define T_NUMBER 0x2
|
||||
#define T_STRING 0x3
|
||||
#define T_POINTER 0x4
|
||||
#define T_OBJECT 0x5
|
||||
#define T_MAPPING 0x6
|
||||
#define T_FLOAT 0x7
|
||||
#define T_CLOSURE 0x8
|
||||
#define T_SYMBOL 0x9
|
||||
#define T_QUOTED_ARRAY 0xa
|
||||
#if defined(USE_STRUCTS) || defined(__LPC_STRUCTS__)
|
||||
#define T_STRUCT 0xb
|
||||
#endif
|
||||
|
||||
/* Closure types, stored as secondary type info */
|
||||
|
||||
#ifndef __DRIVER_SOURCE__
|
||||
|
||||
#define CLOSURE_LFUN 0 /* lfun in an object */
|
||||
/* Code 1: currently unused, used to be CLOSURE_ALIEN_LFUN */
|
||||
#define CLOSURE_IDENTIFIER 2 /* variable in this object */
|
||||
#define CLOSURE_PRELIMINARY 3
|
||||
/* Efun closure used in a static initialization */
|
||||
#define CLOSURE_BOUND_LAMBDA 4 /* Bound unbound-lambda closure */
|
||||
#define CLOSURE_LAMBDA 5 /* normal lambda closure */
|
||||
#define CLOSURE_UNBOUND_LAMBDA 6 /* unbound lambda closure. */
|
||||
|
||||
#define CLOSURE_OPERATOR (0xe800)
|
||||
#define CLOSURE_EFUN (0xf000)
|
||||
#define CLOSURE_SIMUL_EFUN (0xf800)
|
||||
|
||||
#define CLOSURE_IS_LFUN(x) (((x)&~1) == 0)
|
||||
#define CLOSURE_IS_IDENTIFIER(x) ((x) == CLOSURE_IDENTIFIER)
|
||||
#define CLOSURE_IS_BOUND_LAMBDA(x) ((x) == CLOSURE_BOUND_LAMBDA)
|
||||
#define CLOSURE_IS_LAMBDA(x) ((x) == CLOSURE_LAMBDA)
|
||||
#define CLOSURE_IS_UNBOUND_LAMBDA(x) ((x) == CLOSURE_UNBOUND_LAMBDA)
|
||||
#define CLOSURE_IS_SIMUL_EFUN(x) (((x) & 0xf800) == CLOSURE_SIMUL_EFUN)
|
||||
#define CLOSURE_IS_EFUN(x) (((x) & 0xf800) == CLOSURE_EFUN)
|
||||
#define CLOSURE_IS_OPERATOR(x) (((x) & 0xf800) == CLOSURE_OPERATOR)
|
||||
|
||||
#endif /* __DRIVER_SOURCE__ */
|
||||
|
||||
#endif /* LPC_LPCTYPES_H */
|
83
world/drivers/ldmud/sys/objectinfo.h
Normal file
83
world/drivers/ldmud/sys/objectinfo.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
#ifndef LPC_OBJECTINFO_H_
|
||||
#define LPC_OBJECTINFO_H_
|
||||
|
||||
/* Definition of argument values for object_info() and
|
||||
* of the indices in the corresponding result arrays.
|
||||
*/
|
||||
|
||||
/* Possible types of information requested from object_info()
|
||||
*/
|
||||
#define OINFO_BASIC 0
|
||||
#define OINFO_POSITION 1
|
||||
#define OINFO_MEMORY 2
|
||||
|
||||
|
||||
/* Indices in the array resulting from OINFO_BASIC
|
||||
*/
|
||||
|
||||
#define OIB_HEART_BEAT 0
|
||||
#define OIB_IS_WIZARD 1
|
||||
#define OIB_ENABLE_COMMANDS 2
|
||||
#define OIB_CLONE 3
|
||||
#define OIB_DESTRUCTED 4
|
||||
#define OIB_SWAPPED 5
|
||||
#define OIB_ONCE_INTERACTIVE 6
|
||||
#define OIB_RESET_STATE 7
|
||||
#define OIB_WILL_CLEAN_UP 8
|
||||
#define OIB_LAMBDA_REFERENCED 9
|
||||
#define OIB_SHADOW 10
|
||||
#define OIB_REPLACED 11
|
||||
#define OIB_TOTAL_LIGHT 12
|
||||
#define OIB_NEXT_RESET 13
|
||||
#define OIB_TIME_OF_REF 14
|
||||
#define OIB_REF 15
|
||||
#define OIB_GIGATICKS 16
|
||||
#define OIB_TICKS 17
|
||||
#define OIB_SWAP_NUM 18
|
||||
#define OIB_PROG_SWAPPED 19
|
||||
#define OIB_VAR_SWAPPED 20
|
||||
#define OIB_NAME 21
|
||||
#define OIB_LOAD_NAME 22
|
||||
#define OIB_NEXT_ALL 23
|
||||
#define OIB_PREV_ALL 24
|
||||
#define OIB_NEXT_CLEANUP 25
|
||||
|
||||
#define OIB_MAX 26 /* Number of OIB_ result elements */
|
||||
|
||||
|
||||
/* Indices in the array resulting from OINFO_POSITION
|
||||
*/
|
||||
#define OIP_NEXT 0
|
||||
#define OIP_PREV 1
|
||||
#define OIP_POS 2
|
||||
|
||||
#define OIP_MAX 3 /* Number of OIP_ result elements */
|
||||
|
||||
|
||||
/* Indices in the array resulting from OINFO_MEMORY
|
||||
*/
|
||||
#define OIM_REF 0
|
||||
#define OIM_NAME 1
|
||||
#define OIM_PROG_SIZE 2
|
||||
#define OIM_NUM_FUNCTIONS 3
|
||||
#define OIM_SIZE_FUNCTIONS 4
|
||||
#define OIM_NUM_VARIABLES 5
|
||||
#define OIM_SIZE_VARIABLES 6
|
||||
#define OIM_NUM_STRINGS 7
|
||||
#define OIM_SIZE_STRINGS 8
|
||||
#define OIM_SIZE_STRINGS_DATA 9
|
||||
#define OIM_SIZE_STRINGS_TOTAL 10
|
||||
#define OIM_NUM_INHERITED 11
|
||||
#define OIM_SIZE_INHERITED 12
|
||||
#define OIM_TOTAL_SIZE 13
|
||||
#define OIM_DATA_SIZE 14
|
||||
#define OIM_TOTAL_DATA_SIZE 15
|
||||
#define OIM_NO_INHERIT 16
|
||||
#define OIM_NO_CLONE 17
|
||||
#define OIM_NO_SHADOW 18
|
||||
#define OIM_NUM_INCLUDES 19
|
||||
#define OIM_SHARE_VARIABLES 20
|
||||
|
||||
#define OIM_MAX 21 /* Number of OIM_ result elements */
|
||||
|
||||
#endif /* LPC_OBJECTINFO_H_ */
|
23
world/drivers/ldmud/sys/pgsql.h
Normal file
23
world/drivers/ldmud/sys/pgsql.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef _PGSQL_H
|
||||
#define _PGSQL_H
|
||||
|
||||
/* Definitions for the PostgreSQL efuns */
|
||||
|
||||
#define PGRES_EMPTY_QUERY 0 /* Unimplemented */
|
||||
#define PGRES_COMMAND_OK 1
|
||||
#define PGRES_TUPLES_OK 2
|
||||
#define PGRES_COPY_OUT 3 /* Unimplemented */
|
||||
#define PGRES_COPY_IN 4 /* Unimplemented */
|
||||
#define PGRES_BAD_RESPONSE 5
|
||||
#define PGRES_NONFATAL_ERROR 6
|
||||
#define PGRES_FATAL_ERROR 7
|
||||
#define PGRES_NOTICE 99
|
||||
|
||||
#define PGCONN_SUCCESS 100
|
||||
#define PGCONN_FAILED 101
|
||||
#define PGCONN_ABORTED 102
|
||||
|
||||
#define PG_RESULT_ARRAY 0
|
||||
#define PG_RESULT_MAP 1
|
||||
|
||||
#endif
|
43
world/drivers/ldmud/sys/regexp.h
Normal file
43
world/drivers/ldmud/sys/regexp.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef LPC_REGEXP_H_
|
||||
#define LPC_REGEXP_H_ 1
|
||||
|
||||
/* Definitions of regexp option values */
|
||||
|
||||
/* Not really an RE option, but used in conjunction with some RE functions: */
|
||||
|
||||
#define RE_GLOBAL 0x0001 /* Apply RE globally (if possible) */
|
||||
|
||||
/* Options supported by the old regexp package: */
|
||||
|
||||
#define RE_EXCOMPATIBLE 0x0002 /* RE is compatible with ex */
|
||||
|
||||
/* Options supported by the PCRE regexp package: */
|
||||
|
||||
#define RE_CASELESS 0x0004
|
||||
#define RE_MULTILINE 0x0008
|
||||
#define RE_DOTALL 0x0010
|
||||
#define RE_EXTENDED 0x0020
|
||||
#define RE_ANCHORED 0x0040
|
||||
#define RE_DOLLAR_ENDONLY 0x0080
|
||||
#define RE_NOTBOL 0x0100
|
||||
#define RE_NOTEOL 0x0200
|
||||
#define RE_UNGREEDY 0x0400
|
||||
#define RE_NOTEMPTY 0x0800
|
||||
#define RE_UTF8 0x1000
|
||||
|
||||
/* Options specific for regmatch(): */
|
||||
|
||||
#define RE_MATCH_SUBS 0x00100000 /* Return matched subexpressions */
|
||||
|
||||
/* Options specific for regexplode(): */
|
||||
|
||||
#define RE_OMIT_DELIM 0x00100000 /* Omit the delimiters */
|
||||
|
||||
/* Regexp package selection options: */
|
||||
|
||||
#define RE_TRADITIONAL 0x04000000
|
||||
#define RE_PCRE 0x02000000
|
||||
|
||||
#define RE_PACKAGE_MASK (RE_TRADITIONAL | RE_PCRE)
|
||||
|
||||
#endif /* LPC_REGEXP_H_ */
|
24
world/drivers/ldmud/sys/rtlimits.h
Normal file
24
world/drivers/ldmud/sys/rtlimits.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef LPC_RTLIMITS_H_
|
||||
#define LPC_RTLIMITS_H_
|
||||
|
||||
/* Runtime limit index/tag values */
|
||||
|
||||
#define LIMIT_EVAL (0)
|
||||
#define LIMIT_ARRAY (1)
|
||||
#define LIMIT_MAPPING (2)
|
||||
#define LIMIT_MAPPING_KEYS LIMIT_MAPPING
|
||||
#define LIMIT_MAPPING_SIZE (3)
|
||||
#define LIMIT_BYTE (4)
|
||||
#define LIMIT_FILE (5)
|
||||
#define LIMIT_CALLOUTS (6)
|
||||
#define LIMIT_COST (7)
|
||||
|
||||
#define LIMIT_MAX (8) /* Number of recognized limits */
|
||||
|
||||
/* Special limit values */
|
||||
|
||||
#define LIMIT_UNLIMITED 0 /* No limit */
|
||||
#define LIMIT_KEEP (-1) /* Keep the old limit setting */
|
||||
#define LIMIT_DEFAULT (-2) /* Use the default setting */
|
||||
|
||||
#endif /* LPC_RTLIMITS_H_ */
|
10
world/drivers/ldmud/sys/sent.h
Normal file
10
world/drivers/ldmud/sys/sent.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef LPC_SENT_H_
|
||||
#define LPC_SENT_H_
|
||||
|
||||
#define SENT_PLAIN 0
|
||||
#define SENT_SHORT_VERB 1
|
||||
#define SENT_NO_SPACE 2
|
||||
#define SENT_NO_VERB 3
|
||||
#define SENT_MARKER 4
|
||||
|
||||
#endif
|
10
world/drivers/ldmud/sys/strings.h
Normal file
10
world/drivers/ldmud/sys/strings.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef LPC_STRINGS_H_
|
||||
#define LPC_STRINGS_H_ 1
|
||||
|
||||
/* 'where' argument values for trim() */
|
||||
|
||||
#define TRIM_LEFT 0x01
|
||||
#define TRIM_RIGHT 0x02
|
||||
#define TRIM_BOTH (TRIM_LEFT|TRIM_RIGHT)
|
||||
|
||||
#endif /* LPC_STRINGS_H_ */
|
38
world/drivers/ldmud/sys/struct_info.h
Normal file
38
world/drivers/ldmud/sys/struct_info.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef LPC_STRUCTINFO_H_
|
||||
#define LPC_STRUCTINFO_H_
|
||||
|
||||
#ifndef __DRIVER_SOURCE__
|
||||
#include "lpctypes.h"
|
||||
#endif
|
||||
|
||||
/* Definition of argument values for struct_info() and
|
||||
* of the indices in the corresponding result arrays.
|
||||
*/
|
||||
|
||||
/* Possible types of information requested from struct_info()
|
||||
*/
|
||||
#define SINFO_FLAT 0
|
||||
#define SINFO_NESTED 1
|
||||
|
||||
|
||||
/* Indices in the result array
|
||||
*/
|
||||
|
||||
#define SI_NAME 0
|
||||
#define SI_PROG_NAME 1
|
||||
#define SI_PROG_ID 2
|
||||
#define SI_BASE 3
|
||||
#define SI_MEMBER 4
|
||||
|
||||
#define SI_MAX 5 /* Min Number of SI_ result elements */
|
||||
|
||||
/* Indices in the SI_MEMBER arrays
|
||||
*/
|
||||
|
||||
#define SIM_NAME 0
|
||||
#define SIM_TYPE 1
|
||||
#define SIM_EXTRA 2
|
||||
|
||||
#define SIM_MAX 3 /* Number of SIM_ elements */
|
||||
|
||||
#endif /* LPC_STRUCTINFO_H_ */
|
217
world/drivers/ldmud/sys/telnet.h
Normal file
217
world/drivers/ldmud/sys/telnet.h
Normal file
|
@ -0,0 +1,217 @@
|
|||
#ifndef TELNET_H__
|
||||
#define TELNET_H__ 1
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)telnet.h 5.7 (Berkeley) 11/14/89
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for the TELNET protocol.
|
||||
*/
|
||||
#define IAC 255 /* interpret as command: */
|
||||
#define DONT 254 /* you are not to use option */
|
||||
#define DO 253 /* please, you use option */
|
||||
#define WONT 252 /* I won't use option */
|
||||
#define WILL 251 /* I will use option */
|
||||
#define SB 250 /* interpret as subnegotiation */
|
||||
#define GA 249 /* you may reverse the line */
|
||||
#define EL 248 /* erase the current line */
|
||||
#define EC 247 /* erase the current character */
|
||||
#define AYT 246 /* are you there */
|
||||
#define AO 245 /* abort output--but let prog finish */
|
||||
#define IP 244 /* interrupt process--permanently */
|
||||
#define BREAK 243 /* break */
|
||||
#define DM 242 /* data mark--for connect. cleaning */
|
||||
#define NOP 241 /* nop */
|
||||
#define SE 240 /* end sub negotiation */
|
||||
#define EOR 239 /* end of record (transparent mode) */
|
||||
#define ABORT 238 /* Abort process */
|
||||
#define SUSP 237 /* Suspend process */
|
||||
#define xEOF 236 /* End of file: EOF is already used... */
|
||||
|
||||
#define SYNCH 242 /* for telfunc calls */
|
||||
|
||||
#ifdef __DRIVER_SOURCE__
|
||||
|
||||
#ifdef TELCMDS
|
||||
char *telcmds[] = {
|
||||
"EOF", "SUSP", "ABORT", "EOR",
|
||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
|
||||
};
|
||||
#define TELCMD_FIRST xEOF
|
||||
#define TELCMD_LAST IAC
|
||||
#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
|
||||
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
|
||||
#endif
|
||||
|
||||
#endif /* __DRIVER_SOURCE__ */
|
||||
|
||||
/* telnet options */
|
||||
#define TELOPT_BINARY 0 /* 8-bit data path */
|
||||
#define TELOPT_ECHO 1 /* echo */
|
||||
#define TELOPT_RCP 2 /* prepare to reconnect */
|
||||
#define TELOPT_SGA 3 /* suppress go ahead */
|
||||
#define TELOPT_NAMS 4 /* approximate message size */
|
||||
#define TELOPT_STATUS 5 /* give status */
|
||||
#define TELOPT_TM 6 /* timing mark */
|
||||
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
|
||||
#define TELOPT_NAOL 8 /* negotiate about output line width */
|
||||
#define TELOPT_NAOP 9 /* negotiate about output page size */
|
||||
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
|
||||
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
|
||||
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
|
||||
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
|
||||
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
|
||||
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
|
||||
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
|
||||
#define TELOPT_XASCII 17 /* extended ascic character set */
|
||||
#define TELOPT_LOGOUT 18 /* force logout */
|
||||
#define TELOPT_BM 19 /* byte macro */
|
||||
#define TELOPT_DET 20 /* data entry terminal */
|
||||
#define TELOPT_SUPDUP 21 /* supdup protocol */
|
||||
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
|
||||
#define TELOPT_SNDLOC 23 /* send location */
|
||||
#define TELOPT_TTYPE 24 /* terminal type */
|
||||
#define TELOPT_EOR 25 /* end or record */
|
||||
#define TELOPT_TUID 26 /* TACACS user identification */
|
||||
#define TELOPT_OUTMRK 27 /* output marking */
|
||||
#define TELOPT_TTYLOC 28 /* terminal location number */
|
||||
#define TELOPT_3270REGIME 29 /* 3270 regime */
|
||||
#define TELOPT_X3PAD 30 /* X.3 PAD */
|
||||
#define TELOPT_NAWS 31 /* window size */
|
||||
#define TELOPT_TSPEED 32 /* terminal speed */
|
||||
#define TELOPT_LFLOW 33 /* remote flow control */
|
||||
#define TELOPT_LINEMODE 34 /* Linemode option */
|
||||
#define TELOPT_XDISPLOC 35 /* X Display Location */
|
||||
#define TELOPT_ENVIRON 36 /* Environment opt for Port ID */
|
||||
#define TELOPT_AUTHENTICATION 37 /* authentication */
|
||||
#define TELOPT_ENCRYPT 38 /* authentication */
|
||||
#define TELOPT_NEWENV 39 /* Environment opt for Port ID */
|
||||
#define TELOPT_STARTTLS 46 /* Transport Layer Security */
|
||||
|
||||
/* Inofficial, mud specific telnet options */
|
||||
#define TELOPT_COMPRESS 85 /* Mud Compression Protocol, v.1 */
|
||||
#define TELOPT_COMPRESS2 86 /* Mud Compression Protocol, v.2 */
|
||||
#define TELOPT_MSP 90 /* Mud Sound Protocol */
|
||||
#define TELOPT_MXP 91 /* Mud Extension Protocol */
|
||||
#define TELOPT_EXOPL 255 /* extended-options-list */
|
||||
|
||||
#define NTELOPTS 256 /* was: (1+TELOPT_NEWENV) */
|
||||
|
||||
#ifdef __DRIVER_SOURCE__
|
||||
|
||||
#ifdef TELOPTS
|
||||
char *telopts[NTELOPTS]
|
||||
= { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD"
|
||||
, "NAME", "STATUS", "TIMING MARK", "RCTE"
|
||||
, "NAOL", "NAOP", "NAOCRD", "NAOHTS"
|
||||
, "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD"
|
||||
, "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO"
|
||||
, "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION"
|
||||
, "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING"
|
||||
, "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS"
|
||||
, "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC"
|
||||
, "ENVIRON", "AUTH", "ENCRYPT", "NEWENV"
|
||||
, "TELOPT 40", "TELOPT 41", "TELOPT 42", "TELOPT 43"
|
||||
, "TELOPT 44", "TELOPT 45", "STARTTLS", "TELOPT 47"
|
||||
, "TELOPT 48", "TELOPT 49", "TELOPT 50", "TELOPT 51"
|
||||
, "TELOPT 52", "TELOPT 53", "TELOPT 54", "TELOPT 55"
|
||||
, "TELOPT 56", "TELOPT 57", "TELOPT 58", "TELOPT 59"
|
||||
, "TELOPT 60", "TELOPT 61", "TELOPT 62", "TELOPT 63"
|
||||
, "TELOPT 64", "TELOPT 65", "TELOPT 66", "TELOPT 67"
|
||||
, "TELOPT 68", "TELOPT 69", "TELOPT 70", "TELOPT 71"
|
||||
, "TELOPT 72", "TELOPT 73", "TELOPT 74", "TELOPT 75"
|
||||
, "TELOPT 76", "TELOPT 77", "TELOPT 78", "TELOPT 79"
|
||||
, "TELOPT 80", "TELOPT 81", "TELOPT 82", "TELOPT 83"
|
||||
, "TELOPT 84", "MUD COMPRESS", "MUD COMPRESS2", "TELOPT 87"
|
||||
, "TELOPT 88", "TELOPT 89", "MUD SOUND", "MUD EXTENSION"
|
||||
};
|
||||
#define TELOPT_FIRST TELOPT_BINARY
|
||||
#define TELOPT_LAST TELOPT_MXP
|
||||
#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
|
||||
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
|
||||
#endif
|
||||
|
||||
#endif /* __DRIVER_SOURCE__ */
|
||||
|
||||
/* sub-option qualifiers */
|
||||
#define TELQUAL_IS 0 /* option is... */
|
||||
#define TELQUAL_SEND 1 /* send option */
|
||||
|
||||
/*
|
||||
* LINEMODE suboptions
|
||||
*/
|
||||
|
||||
#define LM_MODE 1
|
||||
#define LM_FORWARDMASK 2
|
||||
#define LM_SLC 3
|
||||
|
||||
#define MODE_EDIT 0x01
|
||||
#define MODE_TRAPSIG 0x02
|
||||
#define MODE_ACK 0x04
|
||||
|
||||
#define MODE_MASK (MODE_EDIT|MODE_TRAPSIG|MODE_ACK)
|
||||
|
||||
/* Not part of protocol, but needed to simplify things... */
|
||||
#define MODE_FLOW 0x0100
|
||||
#define MODE_ECHO 0x0200
|
||||
#define MODE_INBIN 0x0400
|
||||
#define MODE_OUTBIN 0x0800
|
||||
#define MODE_FORCE 0x1000
|
||||
|
||||
#define SLC_SYNCH 1
|
||||
#define SLC_BRK 2
|
||||
#define SLC_IP 3
|
||||
#define SLC_AO 4
|
||||
#define SLC_AYT 5
|
||||
#define SLC_EOR 6
|
||||
#define SLC_ABORT 7
|
||||
#define SLC_EOF 8
|
||||
#define SLC_SUSP 9
|
||||
#define SLC_EC 10
|
||||
#define SLC_EL 11
|
||||
#define SLC_EW 12
|
||||
#define SLC_RP 13
|
||||
#define SLC_LNEXT 14
|
||||
#define SLC_XON 15
|
||||
#define SLC_XOFF 16
|
||||
#define SLC_FORW1 17
|
||||
#define SLC_FORW2 18
|
||||
|
||||
#define NSLC 18
|
||||
|
||||
#define SLC_NAMES "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
|
||||
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
|
||||
"LNEXT", "XON", "XOFF", "FORW1", "FORW2"
|
||||
|
||||
#define SLC_NOSUPPORT 0
|
||||
#define SLC_CANTCHANGE 1
|
||||
#define SLC_VARIABLE 2
|
||||
#define SLC_DEFAULT 3
|
||||
#define SLC_LEVELBITS 0x03
|
||||
|
||||
#define SLC_FUNC 0
|
||||
#define SLC_FLAGS 1
|
||||
#define SLC_VALUE 2
|
||||
|
||||
#define SLC_ACK 0x80
|
||||
#define SLC_FLUSHIN 0x40
|
||||
#define SLC_FLUSHOUT 0x20
|
||||
|
||||
#endif /* TELNET_H__ */
|
18
world/drivers/ldmud/sys/time.h
Normal file
18
world/drivers/ldmud/sys/time.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef LPC_TIME_H_
|
||||
#define LPC_TIME_H_ 1
|
||||
|
||||
/* Indices into the array returned from gmtime() and localtime(). */
|
||||
|
||||
#define TM_SEC 0 /* Seconds (0..59) */
|
||||
#define TM_MIN 1 /* Minutes (0..59) */
|
||||
#define TM_HOUR 2 /* Hours (0..23) */
|
||||
#define TM_MDAY 3 /* Day of the month (1..31) */
|
||||
#define TM_MON 4 /* Month of the year (0..11) */
|
||||
#define TM_YEAR 5 /* Year (e.g. 2001) */
|
||||
#define TM_WDAY 6 /* Day of the week (Sunday = 0) */
|
||||
#define TM_YDAY 7 /* Day of the year (0..365) */
|
||||
#define TM_ISDST 8 /* TRUE: Daylight saving time */
|
||||
|
||||
#define TM_MAX 9 /* Number of entries in the array */
|
||||
|
||||
#endif /* LPC_TIME_H_ */
|
87
world/drivers/ldmud/sys/tls.h
Normal file
87
world/drivers/ldmud/sys/tls.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
#ifndef LPC_TLS_H
|
||||
#define LPC_TLS_H
|
||||
|
||||
/* Field indices for the result of tls_query_connection_info() */
|
||||
|
||||
#define TLS_CIPHER 0
|
||||
#define TLS_COMP 1
|
||||
#define TLS_KX 2
|
||||
#define TLS_MAC 3
|
||||
#define TLS_PROT 4
|
||||
#define TLS_SESSION 5
|
||||
|
||||
#define TLS_INFO_MAX 6 /* Total number of result fields */
|
||||
|
||||
/* Interpretation of the cipher information */
|
||||
|
||||
#define TLS_CIPHER_TABLE ({ \
|
||||
"TLS_CIPHER_NONE", \
|
||||
"TLS_CIPHER_NULL", \
|
||||
"TLS_CIPHER_ARCFOUR_128", \
|
||||
"TLS_CIPHER_3DES_CBC", \
|
||||
"TLS_CIPHER_RIJNDAEL_128_CBC", \
|
||||
"TLS_CIPHER_RIJNDAEL_256_CBC", \
|
||||
"TLS_CIPHER_ARCFOUR_40" \
|
||||
})
|
||||
|
||||
#define TLS_CIPHER_NAME(x) TLS_CIPHER_TABLE[(x)]
|
||||
|
||||
/* Interpretation of the key-exchange information */
|
||||
|
||||
#define TLS_KX_TABLE ({ \
|
||||
"TLS_KX_NONE", \
|
||||
"TLS_KX_RSA", \
|
||||
"TLS_KX_DHE_DSS", \
|
||||
"TLS_KX_DHE_RSA", \
|
||||
"TLS_KX_ANON_DH", \
|
||||
"TLS_KX_SRP", \
|
||||
"TLS_KX_RSA_EXPORT", \
|
||||
"TLS_KX_SRP_RSA", \
|
||||
"TLS_KX_SRP_DSS" \
|
||||
})
|
||||
|
||||
#define TLS_KX_NAME(x) TLS_KX_TABLE[(x)]
|
||||
|
||||
/* Interpretation of the MAC information */
|
||||
|
||||
#define TLS_MAC_TABLE ({ \
|
||||
"TLS_MAC_NONE", \
|
||||
"TLS_MAC_NULL", \
|
||||
"TLS_MAC_MD5", \
|
||||
"TLS_MAC_SHA" \
|
||||
})
|
||||
|
||||
#define TLS_MAC_NAME(x) TLS_MAC_TABLE[(x)]
|
||||
|
||||
/* Interpretation of the compression information */
|
||||
|
||||
#define TLS_COMP_TABLE ({ \
|
||||
"TLS_COMP_NONE", \
|
||||
"TLS_COMP_NULL", \
|
||||
"TLS_COMP_ZLIB", \
|
||||
"TLS_COMP_LZO" \
|
||||
})
|
||||
|
||||
#define TLS_COMP_NAME(x) TLS_COMP_TABLE[(x)]
|
||||
|
||||
/* Interpretation of the protocol information */
|
||||
|
||||
#define TLS_PROT_TABLE ({ \
|
||||
"TLS_PROT_NONE", \
|
||||
"TLS_PROT_SSL3", \
|
||||
"TLS_PROT_TLS1" \
|
||||
})
|
||||
|
||||
#define TLS_PROT_NAME(x) TLS_PROT_TABLE[(x)]
|
||||
|
||||
/* Recognized hash() algorithms (not all may be supported at runtime) */
|
||||
|
||||
#define TLS_HASH_SHA1 (1)
|
||||
#define TLS_HASH_SHA224 (2)
|
||||
#define TLS_HASH_SHA256 (3)
|
||||
#define TLS_HASH_SHA384 (4)
|
||||
#define TLS_HASH_SHA512 (5)
|
||||
#define TLS_HASH_MD5 (6)
|
||||
#define TLS_HASH_RIPEMD160 (7)
|
||||
|
||||
#endif /* LPC_TLS_H */
|
18
world/drivers/ldmud/sys/trace.h
Normal file
18
world/drivers/ldmud/sys/trace.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef LPC_TRACE_H_
|
||||
#define LPC_TRACE_H_
|
||||
|
||||
/* Argument values for the trace() efun.
|
||||
*/
|
||||
|
||||
#define TRACE_NOTHING 0 /* Stop tracing */
|
||||
|
||||
#define TRACE_CALL 1 /* Trace all lfun calls */
|
||||
#define TRACE_CALL_OTHER 2 /* Trace inter-object calls */
|
||||
#define TRACE_RETURN 4 /* Trace function returns */
|
||||
#define TRACE_ARGS 8 /* Print function arguments and results */
|
||||
#define TRACE_EXEC 16 /* Trace all executed instructions */
|
||||
#define TRACE_HEART_BEAT 32 /* Trace heartbeat code */
|
||||
#define TRACE_APPLY 64 /* Trace (internal) applies */
|
||||
#define TRACE_OBJNAME 128 /* Print the object names */
|
||||
|
||||
#endif /* LPC_TRACE_H_ */
|
22
world/drivers/ldmud/sys/wizlist.h
Normal file
22
world/drivers/ldmud/sys/wizlist.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef LPC_WIZLIST_H_
|
||||
#define LPC_WIZLIST_H_ 1
|
||||
|
||||
/* Indices returned by wizlist_info()
|
||||
*/
|
||||
|
||||
#define WL_NAME 0 /* Wizard name */
|
||||
#define WL_COMMANDS 1 /* Number of commands executed */
|
||||
#define WL_COST 2 /* Weighted evalcost spent on this wizard */
|
||||
#define WL_GIGACOST 3 /* Weighted giga-evalcost spent on this wizard */
|
||||
#define WL_TOTAL_COST 4 /* Total evalcost spent on this wizard */
|
||||
#define WL_TOTAL_GIGACOST 5 /* Total giga-evalcost spent on this wizard */
|
||||
#define WL_HEART_BEATS 6 /* Heartbeats spent on this wizard */
|
||||
#define WL_CALL_OUT 7 /* unimplemented */
|
||||
#define WL_ARRAY_TOTAL 8 /* Arrays accounted for */
|
||||
#define WL_MAPPING_TOTAL 9 /* Mappings accounted for */
|
||||
#define WL_STRUCT_TOTAL 10 /* Struct elements accounted for */
|
||||
#define WL_EXTRA 11 /* Extra Wizinfo, if set */
|
||||
|
||||
#define WL_SIZE 12 /* Number of entries */
|
||||
|
||||
#endif /* LPC_WIZLIST_H_ */
|
14
world/drivers/library.c
Normal file
14
world/drivers/library.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This shouldn't get called, the master should name its library.c directly */
|
||||
|
||||
#include <net.h>
|
||||
|
||||
#ifdef DRIVER_HAS_BROKEN_INCLUDE
|
||||
# ifdef MUDOS
|
||||
# include "/drivers/mudos/library/library.c"
|
||||
# else
|
||||
# include <library.c>
|
||||
# endif
|
||||
#else
|
||||
# include DRIVER_PATH "library/library.c"
|
||||
#endif
|
||||
|
23
world/drivers/master.c
Normal file
23
world/drivers/master.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* This shouldn't get called, the driver should call its master.c directly */
|
||||
|
||||
#ifdef MUDOS
|
||||
# include <net.h>
|
||||
# include <services.h>
|
||||
#else
|
||||
/* bei amylaar und ldmud braucht master.c den absoluten pfad.. */
|
||||
# include "/local/config.h"
|
||||
# include NET_PATH "include/net.h"
|
||||
# include NET_PATH "include/services.h"
|
||||
# include DRIVER_PATH "include/driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef DRIVER_HAS_BROKEN_INCLUDE
|
||||
# ifdef MUDOS
|
||||
# include "/drivers/mudos/master/master.c"
|
||||
# else
|
||||
# include <master.c>
|
||||
# endif
|
||||
#else
|
||||
# include DRIVER_PATH "master/master.c"
|
||||
#endif
|
||||
|
4
world/drivers/mudos/MUDOS_TODO
Normal file
4
world/drivers/mudos/MUDOS_TODO
Normal file
|
@ -0,0 +1,4 @@
|
|||
- unless (checkVar(&key, &value)) return;
|
||||
- psyc/library
|
||||
|
||||
|
17
world/drivers/mudos/include/driver.h
Normal file
17
world/drivers/mudos/include/driver.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#define _INCLUDE_DRIVER_H
|
||||
|
||||
// for debug outputs
|
||||
#define DRIVER_TYPE "MudOS"
|
||||
|
||||
// amylaar has closures
|
||||
#define DRIVER_HAS_CLOSURES
|
||||
|
||||
// mudos provides "compile_object" in master.c, too!!
|
||||
#define DRIVER_HAS_RENAMED_CLONES
|
||||
|
||||
// MudOS is unable to #include NET_PATH "something.i"
|
||||
#define DRIVER_HAS_BROKEN_INCLUDE
|
||||
|
||||
// MudOS socket interface
|
||||
#define DRIVER_HAS_SOCKET
|
||||
|
131
world/drivers/mudos/include/errno.h
Normal file
131
world/drivers/mudos/include/errno.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
// mudos provides no errno function :-(
|
||||
|
||||
/* these are the linux values.. */
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
65
world/drivers/mudos/include/interface.h
Normal file
65
world/drivers/mudos/include/interface.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#define _INCLUDE_INTERFACE_H
|
||||
|
||||
// driver abstraction kit -- abstraction layer from driver details
|
||||
|
||||
// generic string replacer
|
||||
#define prereplace(s) (" "+s+" ")
|
||||
#define replace(s, o, n) implode(explode(s, o), n)
|
||||
#define postreplace(s) (s = s[1..<2])
|
||||
|
||||
// let's use index() for strings and arrays
|
||||
// to avoid confusion with mapping-member semantics
|
||||
// in fact, with mudos we cant use member()
|
||||
//
|
||||
#define index strsrch
|
||||
//efine rindex TODO
|
||||
|
||||
// amylaar provides strstr() to find a string in an other string
|
||||
// in mudos this is done using strsrch
|
||||
#define strstr strsrch
|
||||
|
||||
// rexxism: is small an abbreviation of big?
|
||||
#define abbrev(SMALL, BIG) (strstr(BIG, SMALL) == 0)
|
||||
// the same thing at the tail of the string
|
||||
#define trail(SMALL, BIG) (strstr(BIG, SMALL, -strlen(SMALL)) != -1)
|
||||
|
||||
// the way i use member is usually to see if a key is defined
|
||||
// in a mapping, so here goes:
|
||||
//
|
||||
#define member(map, key) (!undefinedp(map[key]))
|
||||
|
||||
// compare strings ignoring case
|
||||
#define stricmp(one, two) (lower_case(one) != lower_case(two))
|
||||
|
||||
// amylaar mappings have other efun names than mudos (why?)
|
||||
#define m_delete map_delete
|
||||
#define m_indices keys
|
||||
#define mappingp mapp
|
||||
#define walk_mapping map_mapping
|
||||
|
||||
// debugging disabled for now :-(
|
||||
#define D(text)
|
||||
|
||||
// efuns mudos doesn't support
|
||||
#define regreplace(str, patt, repl, f) \
|
||||
...
|
||||
|
||||
#pragma save_binary
|
||||
// #pragma warnings
|
||||
#pragma optimize all
|
||||
|
||||
#if DEBUG > 1
|
||||
# pragma error_context
|
||||
#endif
|
||||
|
||||
// this is said to work, but doesn't
|
||||
// #pragma no_save_types
|
||||
// #pragma no_strict_types
|
||||
|
||||
// MudOS doesnt have this:
|
||||
#define __EFUN_DEFINED__(whatever) 0
|
||||
|
||||
// every lpc dialect has its own foreach syntax. aint that cute?
|
||||
#define each(ITERATOR, LIST) foreach(ITERATOR in LIST)
|
||||
#define mapeach(KEY, VALUE, MAPPING) foreach(KEY, VALUE in MAPPING)
|
||||
|
14
world/drivers/mudos/master/library.i
Normal file
14
world/drivers/mudos/master/library.i
Normal file
|
@ -0,0 +1,14 @@
|
|||
// TBD
|
||||
|
||||
send_udp(host, port, msg) {
|
||||
D("cannot send_udp\n");
|
||||
}
|
||||
|
||||
query_udp_port() {
|
||||
return 4404;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cat(string file) { write(read_file(file)); }
|
||||
|
19
world/drivers/mudos/master/master.i
Normal file
19
world/drivers/mudos/master/master.i
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "/obj/mudos/master2.i"
|
||||
|
||||
// disabled in main.c
|
||||
static void crash(string error, object command_giver, object current_object) {
|
||||
#ifndef DEBUG
|
||||
log_file("CRASH", MUD_NAME + " crashed on: " + ctime(time()) +
|
||||
", error: " + error + "\n");
|
||||
if (command_giver)
|
||||
log_file("CRASH",
|
||||
"this_player: " + file_name(command_giver) + "\n");
|
||||
if (current_object)
|
||||
log_file("CRASH",
|
||||
"this_object: " + file_name(current_object) + "\n");
|
||||
#endif
|
||||
// users() -> pr("_notice_announce_crash", "System is crashing.\n");
|
||||
}
|
||||
|
||||
// void error_handler( mapping error, int caught ) {
|
||||
|
62
world/drivers/mudos/master/master2.i
Normal file
62
world/drivers/mudos/master/master2.i
Normal file
|
@ -0,0 +1,62 @@
|
|||
// vim:syntax=lpc
|
||||
//
|
||||
// Function name: update_file
|
||||
// Description: reads in a file, ignoring lines that begin with '#'
|
||||
// Arguements: file: a string that shows what file to read in.
|
||||
// Return: Array of nonblank lines that don't begin with '#'
|
||||
// Note: must be declared static (else a security hole)
|
||||
|
||||
static string *
|
||||
update_file(string file)
|
||||
{
|
||||
string *arr;
|
||||
string str;
|
||||
int i;
|
||||
|
||||
str = read_file(file);
|
||||
if (!str) {
|
||||
return ({});
|
||||
}
|
||||
arr = explode(str, "\n");
|
||||
for (i = 0; i < sizeof(arr); i++) {
|
||||
if (arr[i][0] == '#') {
|
||||
arr[i] = 0;
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
// Function name: epilog
|
||||
// Return: List of files to preload
|
||||
|
||||
string *
|
||||
epilog(int load_empty)
|
||||
{
|
||||
string *items;
|
||||
|
||||
items = update_file(INIT_FILE);
|
||||
return items;
|
||||
}
|
||||
|
||||
// preload an object
|
||||
|
||||
void
|
||||
preload(string file)
|
||||
{
|
||||
int t1;
|
||||
string err;
|
||||
|
||||
if (file_size(file + ".c") == -1)
|
||||
return;
|
||||
|
||||
t1 = time();
|
||||
write("Preloading : " + file + "...");
|
||||
err = catch(call_other(file, "??"));
|
||||
if (err != 0) {
|
||||
write("\nError " + err + " when loading " + file + "\n");
|
||||
} else {
|
||||
t1 = time() - t1;
|
||||
write("(" + t1/60 + "." + t1 % 60 + ")\n");
|
||||
}
|
||||
}
|
||||
|
146
world/drivers/mudos/patches/Config.MudOS
Normal file
146
world/drivers/mudos/patches/Config.MudOS
Normal file
|
@ -0,0 +1,146 @@
|
|||
###############################################################################
|
||||
# Customizable runtime config file for MudOS v21 #
|
||||
###############################################################################
|
||||
# NOTE: All paths specified here are relative to the mudlib directory except #
|
||||
# for mudlib directory, and binary directory. #
|
||||
# Lines beginning with a # or a newline are ignored. #
|
||||
###############################################################################
|
||||
|
||||
# name of this mud
|
||||
name : psyced
|
||||
|
||||
# port number to accept users on
|
||||
port number : 2000
|
||||
|
||||
# the address server is an external program that lets the mud translate
|
||||
# internet names to numbers (and vice versa). select an unused port.
|
||||
address server ip : localhost
|
||||
address server port : 27374
|
||||
|
||||
# absolute pathname of mudlib
|
||||
mudlib directory : /ve/world
|
||||
|
||||
# absolute pathname of driver/config dir
|
||||
binary directory : /ve/bin
|
||||
|
||||
# debug.log and author/domain stats are stored here
|
||||
log directory : /log
|
||||
|
||||
# the directories which are searched by #include <...>
|
||||
# for multiple dirs, separate each path with a ':'
|
||||
include directories : /net/include:/pro/include:/drivers/mudos/include
|
||||
|
||||
# Directory to save binaries in. (if BINARIES is defined)
|
||||
save binaries directory : /bytecode
|
||||
|
||||
# the file which defines the master object
|
||||
master file : /obj/master
|
||||
|
||||
# the file where all global simulated efuns are defined.
|
||||
simulated efun file : /obj/library
|
||||
|
||||
# file to swap out objects; not used if time to swap is 0
|
||||
swap file : /log/mudos.swap
|
||||
|
||||
# alternate debug.log file name (assumed to be in specified 'log directory')
|
||||
debug log file : debug.log
|
||||
|
||||
# This is an include file which is automatically #include'd in all objects
|
||||
global include file : <auto.h>
|
||||
|
||||
# if an object is left alone for a certain time, then the
|
||||
# function clean_up will be called. This function can do anything,
|
||||
# like destructing the object. If the function isn't defined by the
|
||||
# object, then nothing will happen.
|
||||
# This time should be substantially longer than the swapping time.
|
||||
time to clean up : 1200
|
||||
|
||||
# How long time until an unused object is swapped out.
|
||||
# Machine with too many players and too little memory: 900 (15 minutes)
|
||||
# Machine with few players and lot of memory: 10000
|
||||
# Machine with infinite memory: 0 (never swap).
|
||||
time to swap : 600
|
||||
|
||||
# How many seconds until an object is reset again.
|
||||
time to reset : 1800
|
||||
|
||||
# Maximum number of bits in a bit field. They are stored in printable
|
||||
# strings, 6 bits per byte.
|
||||
maximum bits in a bitfield : 1200
|
||||
|
||||
# Max number of local variables in a function.
|
||||
maximum local variables : 30
|
||||
|
||||
# Maximum amount of "eval cost" per thread - execution is halted when
|
||||
# it is exceeded.
|
||||
maximum evaluation cost : 500000
|
||||
|
||||
# This is the maximum array size allowed for one single array.
|
||||
maximum array size : 15000
|
||||
|
||||
# This is the maximum allowed size of a variable of type 'buffer'.
|
||||
maximum buffer size : 400000
|
||||
|
||||
# Max size for a mapping
|
||||
maximum mapping size : 15000
|
||||
|
||||
# Max inherit chain size
|
||||
inherit chain size : 30
|
||||
|
||||
# maximum length of a string variable
|
||||
maximum string length : 200000
|
||||
|
||||
# Max size of a file allowed to be read by 'read_file()'.
|
||||
maximum read file size : 200000
|
||||
|
||||
# max number of bytes you allow to be read and written with read_bytes
|
||||
# and write_bytes
|
||||
maximum byte transfer : 10000
|
||||
|
||||
# Reserve an extra memory area from malloc(), to free when we run out
|
||||
# of memory and allow the mudlib to shutdown.
|
||||
# If this value is 0, no area will be reserved.
|
||||
reserved size : 0
|
||||
|
||||
# Define the size of the shared string hash table. This number should
|
||||
# a prime, probably between 1000 and 30000; if you set it to about 1/5
|
||||
# of the number of distinct strings you have, you will get a hit ratio
|
||||
# (number of comparisons to find a string) very close to 1, as found strings
|
||||
# are automatically moved to the head of a hash chain. You will never
|
||||
# need more, and you will still get good results with a smaller table.
|
||||
hash table size : 7001
|
||||
|
||||
# Object hash table size.
|
||||
# Define this like you did with the strings; probably set to about 1/4 of
|
||||
# the number of objects in a game, as the distribution of accesses to
|
||||
# objects is somewhat more uniform than that of strings.
|
||||
object table size : 1501
|
||||
|
||||
# default no-matching-action message
|
||||
default fail message : Oops.
|
||||
|
||||
# default message when error() occurs (optional)
|
||||
default error message : Ooops.
|
||||
|
||||
###############################################################################
|
||||
# The following aren't currently used or implemented (yet) #
|
||||
###############################################################################
|
||||
|
||||
# maximum number of users in the game (unused currently)
|
||||
maximum users : 1000
|
||||
|
||||
# Define the maximum stack size of the stack machine. This stack will also
|
||||
# contain all local variables and arguments. (unused currently)
|
||||
evaluator stack size : 1000
|
||||
|
||||
# Define the size of the compiler stack. This defines how complex
|
||||
# expressions the compiler can parse. (unused currently)
|
||||
compiler stack size : 200
|
||||
|
||||
# Define the maximum call depth for functions. (unused currently)
|
||||
maximum call depth : 30
|
||||
|
||||
# There is a hash table for living objects, used by find_living().
|
||||
# (unused currently)
|
||||
living hash table size : 100
|
||||
|
10
world/drivers/nemesis/nememul.i
Normal file
10
world/drivers/nemesis/nememul.i
Normal file
|
@ -0,0 +1,10 @@
|
|||
// This is just to emulate some historic Nemesis efuns
|
||||
// used only when in MUD mode
|
||||
|
||||
// simplification - has to check ONCE_INTERACTIVE TODO
|
||||
int userp(object u) {
|
||||
if (!u) u = this_player();
|
||||
if (objectp(u)) return interactive(u);
|
||||
return 0;
|
||||
}
|
||||
|
25
world/drivers/pike/include/driver.h
Normal file
25
world/drivers/pike/include/driver.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
// $Id: driver.h,v 1.1 2007/09/16 20:02:12 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
#ifndef _INCLUDE_DRIVER_H
|
||||
#define _INCLUDE_DRIVER_H
|
||||
|
||||
// for debug outputs
|
||||
#define DRIVER_TYPE "pike"
|
||||
|
||||
// the following ifdefs are prototypical
|
||||
|
||||
// this driver has closures
|
||||
#define DRIVER_HAS_CLOSURES
|
||||
|
||||
// amylaar-style runtime closures
|
||||
#undef DRIVER_HAS_LAMBDA_CLOSURES
|
||||
|
||||
// mudos-style readable closures
|
||||
#define DRIVER_HAS_INLINE_CLOSURES
|
||||
|
||||
// amylaar provides "compile_object" in master.c
|
||||
#undef DRIVER_HAS_RENAMED_CLONES
|
||||
|
||||
// the function(&var) syntax
|
||||
#define DRIVER_HAS_CALL_BY_REFERENCE
|
||||
|
||||
#endif
|
142
world/drivers/pike/include/interface.h
Normal file
142
world/drivers/pike/include/interface.h
Normal file
|
@ -0,0 +1,142 @@
|
|||
// $Id: interface.h,v 1.31 2008/04/09 16:49:23 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
// several things in here do not look like they were optimized for pike.. TODO
|
||||
|
||||
#define _INCLUDE_INTERFACE_H
|
||||
|
||||
#define DRIVER_VERSION ("pike/"+ __VERSION__)
|
||||
|
||||
// driver abstraction kit -- abstraction layer from driver details
|
||||
|
||||
// [-1] vs [<1] syntax kludge
|
||||
#define char_from_end(WHAT, NUMBER) WHAT[- NUMBER]
|
||||
#define slice_from_end(WHAT,FROM,TO) WHAT[FROM .. sizeof(WHAT)-TO]
|
||||
|
||||
// pike also provides search() says eMBee....
|
||||
#define abbrev(SMALL, BIG) (SMALL == BIG[0..sizeof(SMALL)-1])
|
||||
#define trail(SMALL, BIG) (SMALL == BIG[sizeof(BIG)-sizeof(SMALL) ..])
|
||||
|
||||
// is it this simple? let's try
|
||||
#define strstr search
|
||||
#define raise_error(ERROR) throw(ERROR)
|
||||
#define shutdown() exit(0)
|
||||
#define clone_object(XXX) XXX()
|
||||
#define named_clone(XXX, NAME) XXX()->sName(NAME)
|
||||
#define file_name(OBJECT) to_string(OBJECT)
|
||||
#define copy(WHATEVER) copy_value(WHATEVER)
|
||||
#define find_object(XXX) ((object) XXX)
|
||||
#define m_indices indices
|
||||
#define m_values values
|
||||
|
||||
// generic string replacer
|
||||
//#define replace(s, o, n) implode(explode(s, o), n)
|
||||
// exists as a system function in pike with exact same arguments, phew!
|
||||
|
||||
// backward compat -- useful when writing multi-driver code
|
||||
#define prereplace(s) (s)
|
||||
#define postreplace(s) (s)
|
||||
|
||||
// let's use index() for strings and arrays
|
||||
// to avoid confusion with mapping-member semantics
|
||||
//
|
||||
#define index(STRING, CHAR) member(STRING, CHAR)
|
||||
#define rindex(STRING, CHAR) rmember(STRING, CHAR)
|
||||
//
|
||||
// but pike doesn't have member, it's called has_index()
|
||||
// we keep on using index() and member() in all languages
|
||||
#define member(HAYSTACK, NEEDLE) has_index(HAYSTACK, NEEDLE)
|
||||
// you might also want to have a look on has_value(). well. maybe not.
|
||||
|
||||
// strlen() is obsolet/deprecated in pike, sizeof() is suggested.
|
||||
// well, i suggest we keep on using strlen() for strings, as we never know what
|
||||
// other languages are popping up that psyced has to be ported to.
|
||||
#define strlen(str) sizeof(str)
|
||||
|
||||
// pike doesn't know previous_object. but we can emulate it.
|
||||
#define previous_object() function_object(backtrace()[-2][2])
|
||||
|
||||
// compare strings ignoring case
|
||||
#define stricmp(one, two) (lower_case(one) != lower_case(two))
|
||||
|
||||
// implode & explode are operator operations in pike.
|
||||
#define implode(what, with) ((what) * (with))
|
||||
#define explode(what, with) ((what) / (with))
|
||||
|
||||
// brilliant. exactly the same interface. saga did a good job! :)
|
||||
#define dns_resolve Protocols.DNS.async_host_to_ip
|
||||
#define dns_rresolve Protocols.DNS.async_ip_to_host
|
||||
|
||||
// this is useless really, since programs will never run as objects (?)
|
||||
//#define clonep(ob) (!programp(ob))
|
||||
// so we have to rewrite some stuff..
|
||||
// none of our objects supports isClone()
|
||||
// this is just a first approach to the problem
|
||||
#define clonep(ob) (ob->isClone())
|
||||
|
||||
// all of this object naming stuff won't work unless we name our clones
|
||||
// at creation time.. so plenty to be done here
|
||||
//
|
||||
// to_string behaves differently with ldmud.. sigh
|
||||
#define o2s(any) ((objectp(any)?"/":"")+sprintf("%O",any))
|
||||
// object to http URL (without http://host:port) conversion macros
|
||||
#define object2url(ob) replace( stringp(ob)?ob:("/"+sprintf("%O",ob)), "#", "," )
|
||||
#define url2object(ob) replace( ob, ",", "#" )
|
||||
|
||||
// nosave? static? volatile. no idea if pike has something like this
|
||||
#define volatile static
|
||||
|
||||
// every lpc dialect has its own foreach syntax. aint that cute?
|
||||
#define each(ITEM, LIST) foreach(LIST; ; ITEM)
|
||||
#define mapeach(KEY, VALUE, MAPPING) foreach(MAPPING; KEY; VALUE)
|
||||
|
||||
#define pointerp arrayp
|
||||
|
||||
// thoughts on closures in lpc and pike.
|
||||
//
|
||||
// the new context closure syntax of ldmud looks either like this:
|
||||
// int x=5;
|
||||
// closure cl = function int : (int x) { return x++; };
|
||||
//
|
||||
// or even mudossish like this:
|
||||
// int x=5;
|
||||
// closure cl = (: return x++; :);
|
||||
//
|
||||
// while this is pike instead:
|
||||
// int x=5;
|
||||
// function factory(int y) { return lambda() { return y++; }; };
|
||||
// function cl = factory(x);
|
||||
//
|
||||
// are you sure we cannot return a function without naming it factory first?
|
||||
|
||||
#define CLOSURE(args, tcontext, context, code) lambda tcontext { return lambda args code; } context
|
||||
|
||||
// typical usage:
|
||||
// int x=5;
|
||||
// function f = CLOSURE((int y), (int x), (x), { return x * y; });
|
||||
|
||||
#define virtual
|
||||
#define closure function
|
||||
|
||||
// pike's varargs syntax requires me to do some tricks here
|
||||
#define varargs
|
||||
#define vaclosure function|void
|
||||
#define vamapping mapping|void
|
||||
#define vaobject object|void
|
||||
#define vastring string|void
|
||||
#define vamixed mixed|void
|
||||
#define vaint int|void
|
||||
|
||||
#define to_string(XXX) ((string) XXX)
|
||||
#define to_int(XXX) ((int) XXX)
|
||||
|
||||
// TODO *** stuff that needs to be solved better *** //
|
||||
#define interactive(ME) ME
|
||||
//#define find_service(NAME) 0
|
||||
//#define find_person(NAME) find_object(NAME)
|
||||
#define query_udp_port() 4404
|
||||
#define T(METHODTODO, DEFAULTTEXT) DEFAULTTEXT
|
||||
#define OSTYPE "TODO"
|
||||
#define MACHTYPE "TODO"
|
||||
|
||||
// leaving out a number here crashes pike.. amazing
|
||||
#define DEBUG 1
|
||||
#define DEVELOPMENT
|
Loading…
Add table
Add a link
Reference in a new issue