1
0
Fork 0
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:
PSYC 2009-01-26 20:21:29 +01:00
commit 4e601cf1c7
509 changed files with 77963 additions and 0 deletions

View file

@ -0,0 +1,4 @@
- unless (checkVar(&key, &value)) return;
- psyc/library

View 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

View 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 */

View 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)

View 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)); }

View 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 ) {

View 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");
}
}

View 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