├── Dependencies ├── insttest ├── testsuite ├── .edrc ├── clone │ ├── README │ └── login.c ├── test_control.c ├── single │ ├── tests │ │ ├── efuns │ │ │ ├── README │ │ │ ├── inh0.c │ │ │ ├── has_errors.c │ │ │ ├── unloaded.c │ │ │ ├── add_light.c │ │ │ ├── inh1.c │ │ │ ├── inh2.c │ │ │ ├── mkdir.c │ │ │ ├── get_dir.c │ │ │ ├── message.c │ │ │ ├── get_char.c │ │ │ ├── break_string.c │ │ │ ├── generate_source.c │ │ │ ├── set_hide.c │ │ │ ├── malloc_status.c │ │ │ ├── file_name.c │ │ │ ├── dumpallobj.c │ │ │ ├── master.c │ │ │ ├── query_load_average.c │ │ │ ├── snoop.c │ │ │ ├── pointerp.c │ │ │ ├── receive.c │ │ │ ├── objectp.c │ │ │ ├── query_idle.c │ │ │ ├── cache_stats.c │ │ │ ├── crc32.c │ │ │ ├── mapp.c │ │ │ ├── mud_status.c │ │ │ ├── query_privs.c │ │ │ ├── get_config.c │ │ │ ├── printf.c │ │ │ ├── query_snoop.c │ │ │ ├── error.c │ │ │ ├── query_snooping.c │ │ │ ├── ctime.c │ │ │ ├── destruct.c │ │ │ ├── random.c │ │ │ ├── set_debug_level.c │ │ │ ├── functionp.c │ │ │ ├── nullp.c │ │ │ ├── opcprof.c │ │ │ ├── notify_fail.c │ │ │ ├── users.c │ │ │ ├── query_ip_name.c │ │ │ ├── query_ip_number.c │ │ │ ├── rm.c │ │ │ ├── rmdir.c │ │ │ ├── living.c │ │ │ ├── file_size.c │ │ │ ├── previous_object.c │ │ │ ├── find_call_out.c │ │ │ ├── allocate_mapping.c │ │ │ ├── clonep.c │ │ │ ├── light.c │ │ │ ├── shutdown.c │ │ │ ├── in_edit.c │ │ │ ├── livings.c │ │ │ ├── badshad.c │ │ │ ├── exec.c │ │ │ ├── keys.c │ │ │ ├── allocate_buffer.c │ │ │ ├── interactive.c │ │ │ ├── values.c │ │ │ ├── input_to.c │ │ │ ├── allocate.c │ │ │ ├── set_privs.c │ │ │ ├── inherit_list.c │ │ │ ├── intp.c │ │ │ ├── goodshad.c │ │ │ ├── children.c │ │ │ ├── cp.c │ │ │ ├── to_int.c │ │ │ ├── sscanf.c │ │ │ ├── sizeof.c │ │ │ ├── member_array.c │ │ │ ├── query_verb.c │ │ │ ├── deep_inherit_list.c │ │ │ ├── map_delete.c │ │ │ ├── function_profile.c │ │ │ ├── to_float.c │ │ │ ├── remove_action.c │ │ │ ├── save_object.c │ │ │ ├── move_object.c │ │ │ ├── find_living.c │ │ │ ├── rename.c │ │ │ ├── clear_bit.c │ │ │ ├── ed.c │ │ │ ├── read_file.c │ │ │ ├── add_action.c │ │ │ ├── disable_commands.c │ │ │ ├── environment.c │ │ │ ├── enable_wizard.c │ │ │ ├── query_ed_mode.c │ │ │ ├── match_path.c │ │ │ ├── present.c │ │ │ ├── talker.c │ │ │ ├── clone_object.c │ │ │ ├── lower_case.c │ │ │ ├── origin.c │ │ │ ├── set_bit.c │ │ │ ├── bind.c │ │ │ ├── find_player.c │ │ │ ├── remove_call_out.c │ │ │ ├── inherits.c │ │ │ ├── set_living_name.c │ │ │ ├── deep_inventory.c │ │ │ ├── function_exists.c │ │ │ ├── implode.c │ │ │ ├── find_object.c │ │ │ ├── all_inventory.c │ │ │ ├── call_stack.c │ │ │ ├── command.c │ │ │ ├── set_light.c │ │ │ ├── call_other.c │ │ │ ├── reg_assoc.c │ │ │ ├── capitalize.c │ │ │ ├── read_bytes.c │ │ │ ├── set_heart_beat.c │ │ │ ├── save_variable.c │ │ │ ├── say.c │ │ │ ├── shadow.c │ │ │ ├── restore_variable.c │ │ │ ├── regexp.c │ │ │ ├── call_out.c │ │ │ ├── restore_object.c │ │ │ └── read_buffer.c │ │ ├── compiler │ │ │ ├── fail │ │ │ │ ├── bad_init.c │ │ │ │ ├── eof_in_comment.c │ │ │ │ ├── missing_endif.c │ │ │ │ ├── missing_type.c │ │ │ │ ├── void_global.c │ │ │ │ ├── predef.c │ │ │ │ ├── undef_class.c │ │ │ │ ├── void_arg.c │ │ │ │ ├── void_arg2.c │ │ │ │ ├── arr_index.c │ │ │ │ ├── bad_break.c │ │ │ │ ├── bad_type_init.c │ │ │ │ ├── eof_in_string.c │ │ │ │ ├── void_local.c │ │ │ │ ├── void_member.c │ │ │ │ ├── bad_continue.c │ │ │ │ ├── bad_param.c │ │ │ │ ├── bad_param2.c │ │ │ │ ├── div_zero3.c │ │ │ │ ├── local_redef.c │ │ │ │ ├── bad_local_init.c │ │ │ │ ├── no_ret_type.c │ │ │ │ ├── bad_foreach.c │ │ │ │ ├── lvar_func.c │ │ │ │ ├── no_such_class.c │ │ │ │ ├── static_local.c │ │ │ │ ├── bad_return.c │ │ │ │ ├── lvar_func2.c │ │ │ │ ├── redef_function.c │ │ │ │ ├── void_for_var.c │ │ │ │ ├── bad_return2.c │ │ │ │ ├── bad_for_init.c │ │ │ │ ├── bad_local_init2.c │ │ │ │ ├── local_redef2.c │ │ │ │ ├── div_zero.c │ │ │ │ ├── mod_zero.c │ │ │ │ ├── class_redef.c │ │ │ │ ├── string_case.c │ │ │ │ ├── two_default.c │ │ │ │ ├── no_member.c │ │ │ │ ├── mixed_case.c │ │ │ │ └── var_to_nonvar.c │ │ │ ├── at_block.c │ │ │ ├── succeed.c │ │ │ └── constant_expr.c │ │ └── operators │ │ │ └── range.c │ ├── inh.c │ ├── void.c │ └── README ├── log │ ├── author_stats │ ├── domain_stats │ └── README ├── include │ ├── command.h │ ├── README │ ├── config.h │ ├── lpctypes.h │ ├── tests.h │ └── globals.h ├── data │ └── README ├── inherit │ ├── README │ ├── clean_up.c │ ├── tests.c │ └── base.c ├── u │ └── README ├── command │ ├── shutdown.c │ ├── README │ ├── rm.c │ ├── ed.c │ ├── say.c │ ├── quit.c │ ├── eval.c │ ├── update.c │ ├── who.c │ ├── codefor.c │ ├── dest.c │ └── tests.c ├── etc │ └── motd └── README ├── Version ├── tmp └── insttest ├── options_incl.h ├── windows ├── step1.bat ├── stepdbg.bat ├── steprel.bat ├── clean.bat ├── configure.h └── README.win32 ├── patchlevel.h ├── SMakefile.pre ├── GNUmakefile.in.pre ├── Makefile.in.pre ├── NMakefile.in.pre ├── Win32 ├── mv.bat ├── rm.bat ├── cp.bat ├── configure.h ├── touch.c └── ar.c ├── amiga ├── socket.c ├── README-gcc ├── make_packages ├── times.h ├── ccdep.h ├── touch.c ├── cstrip.c ├── nsignal.h ├── socket.h ├── signal_rr.c ├── amiga.h └── README ├── mudlib ├── GNUmakefile.pre ├── Makefile.pre ├── SMakefile ├── Makefile ├── GNUmakefile ├── interface.c └── Makefile.master ├── packages ├── GNUmakefile.pre ├── Makefile.pre ├── rd_spec.c ├── external_spec.c ├── moon_spec.c ├── mudlib_stats_spec.c ├── uids_spec.c ├── SMakefile ├── db_spec.c ├── mg.h ├── rd.h ├── README ├── gdbm.h ├── parser_spec.c ├── math_spec.c ├── Makefile.master ├── uids.h ├── mg_spec.c ├── develop_spec.c ├── matrix_spec.c ├── matrix.h ├── sockets_spec.c ├── contrib_spec.c └── db.h ├── ChangeLog.old ├── 0.8.gz ├── 0.9.14.gz ├── 0.9.15.gz ├── 0.9.16.gz ├── 0.9.17.gz ├── 0.9.18.gz ├── 0.9.19.gz ├── 0.9-0.9.13.gz └── ChangeLog.v20.gz ├── edit_source.h ├── efuns_incl.h ├── preprocess.h ├── plainwrapper.c ├── socket_err.h ├── reclaim.h ├── system_libs ├── crc32.h ├── configuration ├── qsort.h ├── spec.h ├── hash.h ├── dumpstat.h ├── sprintf.h ├── interface.h ├── compile_file.h ├── compat ├── Debug │ ├── objects.mk │ ├── mudlib │ │ └── subdir.mk │ ├── compat │ │ ├── subdir.mk │ │ └── simuls │ │ │ └── subdir.mk │ ├── testsuite │ │ ├── subdir.mk │ │ ├── inherit │ │ │ ├── master │ │ │ │ └── subdir.mk │ │ │ └── subdir.mk │ │ ├── clone │ │ │ └── subdir.mk │ │ └── single │ │ │ ├── tests │ │ │ ├── operators │ │ │ │ └── subdir.mk │ │ │ └── compiler │ │ │ │ └── subdir.mk │ │ │ └── subdir.mk │ ├── Win32 │ │ └── subdir.mk │ ├── sources.mk │ ├── amiga │ │ └── subdir.mk │ └── makefile ├── simuls │ ├── apply.c │ ├── dump_socket_status.c │ ├── break_string.c │ ├── process_string.c │ └── tail.c ├── parser_error.c └── fixstatic ├── rc.h ├── parse.h ├── sysmalloc.c ├── Makefile ├── include ├── parser_error.h ├── localtime.h ├── type.h ├── function.h └── origin.h ├── wrappedmalloc.h ├── bsdmalloc.h ├── socket_ctrl.h ├── smalloc.h ├── class.h ├── replace_program.h ├── simul_efun.h ├── master.h ├── otable.h ├── origin.h ├── make_malloc.c ├── lpc_incl.h ├── swap.h ├── port.h ├── binaries.h ├── README.md ├── ccode.h ├── efuns_main.h ├── Copyright ├── debugmalloc.h ├── Artistic.README ├── avltree.h ├── INSTALL ├── crc32.c ├── make_func.h ├── std.h ├── call_out.h ├── buffer.h ├── add_action.h ├── regexp.h ├── network_incl.h ├── backend.h ├── icode.h ├── crypt.h ├── main.h ├── Credits.LPmud ├── file_incl.h ├── configure.h ├── eoperators.h ├── socket_err.c ├── class.c ├── debug.c ├── file.h ├── malloc.h ├── my_malloc.h ├── applies ├── addr_server.h ├── wrappedmalloc.c ├── Platforms ├── generate.h ├── debug.h ├── scratchpad.h ├── function.h └── md.h /Dependencies: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /insttest: -------------------------------------------------------------------------------- 1 | whatever 2 | -------------------------------------------------------------------------------- /testsuite/.edrc: -------------------------------------------------------------------------------- 1 | 148 2 | -------------------------------------------------------------------------------- /testsuite/clone/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Version: -------------------------------------------------------------------------------- 1 | MudOS v22.2 beta 2 | -------------------------------------------------------------------------------- /testsuite/test_control.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/insttest: -------------------------------------------------------------------------------- 1 | whatever 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/inh0.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /options_incl.h: -------------------------------------------------------------------------------- 1 | #include "options.h" 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/has_errors.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /windows/step1.bat: -------------------------------------------------------------------------------- 1 | bison make_func.y 2 |  -------------------------------------------------------------------------------- /testsuite/single/inh.c: -------------------------------------------------------------------------------- 1 | void ifun() { 2 | } 3 | -------------------------------------------------------------------------------- /testsuite/single/void.c: -------------------------------------------------------------------------------- 1 | void dummy() 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /patchlevel.h: -------------------------------------------------------------------------------- 1 | #define PATCH_LEVEL "v22.2b14 by luan" 2 | -------------------------------------------------------------------------------- /testsuite/log/author_stats: -------------------------------------------------------------------------------- 1 | Root 0 0 2 | NONAME 0 0 3 | -------------------------------------------------------------------------------- /SMakefile.pre: -------------------------------------------------------------------------------- 1 | %define SMAKE 2 | 3 | %include "Makefile.master" -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_init.c: -------------------------------------------------------------------------------- 1 | int x += 1; 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/eof_in_comment.c: -------------------------------------------------------------------------------- 1 | /* 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/missing_endif.c: -------------------------------------------------------------------------------- 1 | #if 1 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/missing_type.c: -------------------------------------------------------------------------------- 1 | foo; 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_global.c: -------------------------------------------------------------------------------- 1 | void x; 2 | -------------------------------------------------------------------------------- /GNUmakefile.in.pre: -------------------------------------------------------------------------------- 1 | %define GNU 2 | 3 | %include "Makefile.master" -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/predef.c: -------------------------------------------------------------------------------- 1 | #undef __VERSION__ 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/undef_class.c: -------------------------------------------------------------------------------- 1 | class foo x; 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/unloaded.c: -------------------------------------------------------------------------------- 1 | void create() { 2 | } 3 | -------------------------------------------------------------------------------- /Makefile.in.pre: -------------------------------------------------------------------------------- 1 | %define NORMAL 2 | 3 | %include "Makefile.master" 4 | -------------------------------------------------------------------------------- /NMakefile.in.pre: -------------------------------------------------------------------------------- 1 | %define NMAKE 2 | 3 | %include "Makefile.master" 4 | -------------------------------------------------------------------------------- /Win32/mv.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if "%1" == "-f" shift 3 | move %1 %2 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_arg.c: -------------------------------------------------------------------------------- 1 | void foo(void x) { 2 | } 3 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_arg2.c: -------------------------------------------------------------------------------- 1 | void foo(void, int bar); 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/add_light.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/inh1.c: -------------------------------------------------------------------------------- 1 | inherit "/single/tests/efuns/inh0.c"; 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/inh2.c: -------------------------------------------------------------------------------- 1 | inherit "/single/tests/efuns/inh1.c"; 2 | -------------------------------------------------------------------------------- /amiga/socket.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/amiga/socket.c -------------------------------------------------------------------------------- /testsuite/include/command.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | inherit CLEAN_UP; 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/mkdir.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // later 3 | } 4 | -------------------------------------------------------------------------------- /amiga/README-gcc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/amiga/README-gcc -------------------------------------------------------------------------------- /mudlib/GNUmakefile.pre: -------------------------------------------------------------------------------- 1 | %define GNU 2 | 3 | %include "mudlib/Makefile.master" 4 | 5 | -------------------------------------------------------------------------------- /mudlib/Makefile.pre: -------------------------------------------------------------------------------- 1 | %define NORMAL 2 | 3 | %include "mudlib/Makefile.master" 4 | 5 | -------------------------------------------------------------------------------- /packages/GNUmakefile.pre: -------------------------------------------------------------------------------- 1 | %define GNU 2 | 3 | %include "packages/Makefile.master" 4 | -------------------------------------------------------------------------------- /packages/Makefile.pre: -------------------------------------------------------------------------------- 1 | %define NORMAL 2 | 3 | %include "packages/Makefile.master" 4 | -------------------------------------------------------------------------------- /testsuite/log/domain_stats: -------------------------------------------------------------------------------- 1 | Root 0 0 2 | Backbone 0 0 3 | BACKBONE 0 0 4 | NONAME 0 0 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/arr_index.c: -------------------------------------------------------------------------------- 1 | void foo { 2 | ({ })[1]; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_break.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | break; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_type_init.c: -------------------------------------------------------------------------------- 1 | TYPETEST 2 | 3 | int x = "hi"; 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/eof_in_string.c: -------------------------------------------------------------------------------- 1 | void create() { 2 | " 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_local.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | void x; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_member.c: -------------------------------------------------------------------------------- 1 | class foo { 2 | void x; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/get_dir.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // more later 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/message.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // later 3 | } 4 | 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_continue.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | continue; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_param.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | (: $-1 :); 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_param2.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | (: $1000 :); 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/div_zero3.c: -------------------------------------------------------------------------------- 1 | int foo() { 2 | return 1/0.0; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/local_redef.c: -------------------------------------------------------------------------------- 1 | void foo(int x) { 2 | int x; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/get_char.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // maybe later 3 | } 4 | -------------------------------------------------------------------------------- /ChangeLog.old/0.8.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.8.gz -------------------------------------------------------------------------------- /testsuite/log/README: -------------------------------------------------------------------------------- 1 | This directory contains logfiles produced by the mudlib and the driver. 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_local_init.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | int x += 1; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/no_ret_type.c: -------------------------------------------------------------------------------- 1 | #pragma strict_types 2 | 3 | foo() { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/break_string.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | /* tests later */ 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/generate_source.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // maybe later 3 | } 4 | -------------------------------------------------------------------------------- /ChangeLog.old/0.9.14.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.14.gz -------------------------------------------------------------------------------- /ChangeLog.old/0.9.15.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.15.gz -------------------------------------------------------------------------------- /ChangeLog.old/0.9.16.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.16.gz -------------------------------------------------------------------------------- /ChangeLog.old/0.9.17.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.17.gz -------------------------------------------------------------------------------- /ChangeLog.old/0.9.18.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.18.gz -------------------------------------------------------------------------------- /ChangeLog.old/0.9.19.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9.19.gz -------------------------------------------------------------------------------- /testsuite/data/README: -------------------------------------------------------------------------------- 1 | This directory is to contain the .o files created by the save_object() efun. 2 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_foreach.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | foreach (x in ({})) ; 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/lvar_func.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | int x; 3 | (: x :); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/no_such_class.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | new(class foo); 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/static_local.c: -------------------------------------------------------------------------------- 1 | void main() { 2 | static int x = 5; 3 | } 4 | -------------------------------------------------------------------------------- /ChangeLog.old/0.9-0.9.13.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/0.9-0.9.13.gz -------------------------------------------------------------------------------- /amiga/make_packages: -------------------------------------------------------------------------------- 1 | ; make_packages 2 | stack 40000 3 | cd packages 4 | smake clean 5 | smake 6 | cd / 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_return.c: -------------------------------------------------------------------------------- 1 | TYPETEST 2 | 3 | void foo() { 4 | return 1; 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/lvar_func2.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | int x; 3 | (: x + 1 :); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/redef_function.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | } 3 | 4 | void foo() { 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/void_for_var.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | for (void x = 1; ; ) ; 3 | } 4 | -------------------------------------------------------------------------------- /edit_source.h: -------------------------------------------------------------------------------- 1 | #ifndef EDIT_SOURCE_H 2 | #define EDIT_SOURCE_H 3 | 4 | extern FILE *yyin; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /efuns_incl.h: -------------------------------------------------------------------------------- 1 | #ifndef EFUNS_INCL_H 2 | #define EFUNS_INCL_H 3 | 4 | #include "efun_protos.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /testsuite/inherit/README: -------------------------------------------------------------------------------- 1 | This directory contains files that are typically inherited (rather than 2 | cloned). 3 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_return2.c: -------------------------------------------------------------------------------- 1 | TYPETEST 2 | 3 | int foo() { 4 | return "hi"; 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_hide.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | set_hide(1); 3 | set_hide(0); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/u/README: -------------------------------------------------------------------------------- 1 | This directory contains individual directories for those who will building 2 | the mud. 3 | -------------------------------------------------------------------------------- /ChangeLog.old/ChangeLog.v20.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luanhailiang/mudos/HEAD/ChangeLog.old/ChangeLog.v20.gz -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_for_init.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | for (int x += 1; ; ) ; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/bad_local_init2.c: -------------------------------------------------------------------------------- 1 | TYPETEST 2 | 3 | void foo() { 4 | int x = "hi"; 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/malloc_status.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(stringp(malloc_status())); 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/inherit/clean_up.c: -------------------------------------------------------------------------------- 1 | 2 | int 3 | clean_up(int inh) 4 | { 5 | destruct(this_object()); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/local_redef2.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | int x; 3 | { 4 | int x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/file_name.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(file_name() + ".c" == __FILE__); 3 | } 4 | 5 | -------------------------------------------------------------------------------- /preprocess.h: -------------------------------------------------------------------------------- 1 | #ifndef PREPROCESS_H 2 | #define PREPROCESS_H 3 | 4 | defn_t *lookup_define PROT((char *)); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/div_zero.c: -------------------------------------------------------------------------------- 1 | void foo(mixed x) { 2 | switch(x) { 3 | case 1 / 0: 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/mod_zero.c: -------------------------------------------------------------------------------- 1 | void foo(mixed x) { 2 | switch(x) { 3 | case 1 % 0: 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/dumpallobj.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | dumpallobj(); 3 | dumpallobj("/OBJ_DUMP2"); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/master.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(master()); 3 | ASSERT(objectp(master())); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/command/shutdown.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string arg) 5 | { 6 | shutdown(0); 7 | return 1; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/include/README: -------------------------------------------------------------------------------- 1 | This directory contains files that are included via the #include 2 | preprocessor directive. 3 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/class_redef.c: -------------------------------------------------------------------------------- 1 | class foo { 2 | int x; 3 | } 4 | 5 | class foo { 6 | string y; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_load_average.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(stringp(query_load_average())); 3 | } 4 | 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/snoop.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // maybe when it is possible for arbitrary objects to snoop. 3 | } 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/string_case.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | switch ("hi") { 3 | case "foo".."bar": 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/two_default.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | switch (1) { 3 | default: 4 | default: 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/pointerp.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(pointerp( ({}) )); 3 | ASSERT(!pointerp( ([]) )); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/receive.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(!receive("")); 3 | ASSERT(!receive("recieve_test")); 4 | } 5 | -------------------------------------------------------------------------------- /plainwrapper.c: -------------------------------------------------------------------------------- 1 | #ifdef PEDANTIC 2 | int I_really_could_do_without_warnings_about_ANSI_C_not_allowing_files_with_no_definitions; 3 | #endif 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/no_member.c: -------------------------------------------------------------------------------- 1 | class foo { 2 | int x; 3 | } 4 | 5 | void foo() { 6 | foo y; 7 | y->z; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/objectp.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(objectp(this_object())); 3 | ASSERT(!objectp(0)); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_idle.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | if (this_player()) 3 | ASSERT(intp(query_idle(this_player()))); 4 | } 5 | -------------------------------------------------------------------------------- /Win32/rm.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :loop 3 | if "%1x" == "x" goto end 4 | if "%1" == "-f" shift 5 | del %1 >nul 6 | shift 7 | goto loop 8 | :end 9 | -------------------------------------------------------------------------------- /packages/rd_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | mixed rd_connect(string|void,int|void); 4 | mixed rd_command(int,string,...); 5 | mixed rd_close (int); -------------------------------------------------------------------------------- /socket_err.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_ERR_H 2 | #define SOCKET_ERR_H 3 | /* 4 | * socket_err.h 5 | */ 6 | extern char *error_strings[]; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/mixed_case.c: -------------------------------------------------------------------------------- 1 | void foo(mixed x) { 2 | switch (x) { 3 | case 1: 4 | case "hi": 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/cache_stats.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifdef __CACHE_STATS__ 3 | ASSERT(stringp(cache_stats())); 4 | #endif 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/crc32.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(catch(crc32(0))); 3 | ASSERT(intp(crc32("foobarbazz"))); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/mapp.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(mapp(([]))); 3 | ASSERT(!mapp(0)); 4 | ASSERT(!mapp("foo")); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/mud_status.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(stringp(mud_status())); 3 | ASSERT(stringp(mud_status(1))); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_privs.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifdef __PRIVS__ 3 | ASSERT(query_privs(this_object())); 4 | #endif 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/fail/var_to_nonvar.c: -------------------------------------------------------------------------------- 1 | TYPETEST 2 | 3 | void foo(int x) { 4 | } 5 | 6 | void bar() { 7 | foo( ({ })...); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/get_config.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(get_config(0) == MUD_NAME); 3 | ASSERT(catch(get_config(-1))); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/printf.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | // more complete testing done under sprintf() 3 | printf("Printf test.\n"); 4 | } 5 | -------------------------------------------------------------------------------- /reclaim.h: -------------------------------------------------------------------------------- 1 | #ifndef RECLAIM_H 2 | #define RECLAIM_H 3 | 4 | /* 5 | * reclaim.c 6 | */ 7 | int reclaim_objects PROT((void)); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /system_libs: -------------------------------------------------------------------------------- 1 | -static -lhiredis -lmongoc -lbson -lssl -lcrypto -lresolv -ly -lcrypt -ldl -lnsl -lm -lz -L/usr/lib/mysql -lmysqlclient -lpthread -lc 2 | 3 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_snoop.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_SNOOP__ 3 | ASSERT(query_snoop(this_object()) == 0); 4 | #endif 5 | } 6 | -------------------------------------------------------------------------------- /crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_H 2 | #define CRC32_H 3 | 4 | /* 5 | * crc32.c 6 | */ 7 | UINT32 compute_crc32 PROT((unsigned char *, int)); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /packages/external_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | int external_start(int, string | string *, string | function, string | function, string | function | void); 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/error.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(catch(error("hi")) == "*hi\n"); 3 | ASSERT(catch(error("hi\n")) == "*hi\n"); 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_snooping.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_SNOOP__ 3 | ASSERT(query_snooping(this_object()) == 0); 4 | #endif 5 | } 6 | -------------------------------------------------------------------------------- /configuration: -------------------------------------------------------------------------------- 1 | Machine Linux luan-Lenovo-IdeaPad-Y470 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux Configure version 5 2 | -------------------------------------------------------------------------------- /packages/moon_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | int milli_clock(); 3 | void luan(string); 4 | string hash(string,string); 5 | #ifdef EPOLL 6 | string epoll(); 7 | #endif 8 | -------------------------------------------------------------------------------- /qsort.h: -------------------------------------------------------------------------------- 1 | #ifndef QSORT_H 2 | #define QSORT_H 3 | 4 | /* 5 | * qsort.c 6 | */ 7 | void quickSort PROT((void *, int, int, int (*) ())); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /testsuite/command/README: -------------------------------------------------------------------------------- 1 | This directory is to contain the objects implementing the commands that 2 | interactives can use (movement, building, communication, etc). 3 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/ctime.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string tm = ctime(0); 3 | ASSERT(stringp(tm)); 4 | ASSERT(strsrch(tm, '\n') == -1); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/destruct.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object ob = new(__FILE__); 3 | ASSERT(ob); 4 | destruct(ob); 5 | ASSERT(!ob); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/random.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | for (int i = 0; i < 100; i++) { 3 | ASSERT(random(5) >= 0); 4 | ASSERT(random(5) < 5); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_debug_level.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifdef __DEBUG_MACRO__ 3 | set_debug_level(10); 4 | set_debug_level(0); 5 | #endif 6 | } 7 | -------------------------------------------------------------------------------- /packages/mudlib_stats_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | mapping domain_stats(void | string); 4 | void set_author(string); 5 | mapping author_stats(void | string); 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/functionp.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(!functionp(0)); 3 | ASSERT(!functionp("foo")); 4 | ASSERT(functionp((: do_tests :))); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/nullp.c: -------------------------------------------------------------------------------- 1 | int x; 2 | 3 | void do_tests() { 4 | ASSERT(evaluate( (: nullp($1) :) )); 5 | ASSERT(nullp(x)); 6 | ASSERT(!nullp(1)); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/opcprof.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #if defined(__OPCPROF__) || defined(__OPCPROF_2D__) 3 | opcprof(); 4 | opcprof("/opc"); 5 | #endif 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/notify_fail.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | notify_fail("foo"); 4 | notify_fail((: write("hi!\n") :)); 5 | #endif 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/users.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(arrayp(users())); 3 | if (this_player()) 4 | ASSERT(member_array(this_player(), users()) != -1); 5 | } 6 | -------------------------------------------------------------------------------- /spec.h: -------------------------------------------------------------------------------- 1 | /* This is the correct file to include in efun specification files; e.g. 2 | func_spec.c and packages/anything_spec.c */ 3 | 4 | #define _FUNC_SPEC_ 5 | #include "std.h" 6 | -------------------------------------------------------------------------------- /testsuite/command/rm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string file) 5 | { 6 | // need to call resolve_path() and query_cwd() 7 | rm(file); 8 | return 1; 9 | } 10 | -------------------------------------------------------------------------------- /hash.h: -------------------------------------------------------------------------------- 1 | #ifndef HASH_H 2 | #define HASH_H 3 | 4 | /* 5 | * hash.c 6 | */ 7 | int hashstr PROT((char *, int, int)); 8 | int whashstr PROT((const char *, int)); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /mudlib/SMakefile: -------------------------------------------------------------------------------- 1 | # ****** This Makefile generated by make_func 2 | 3 | .c.o: 4 | $(CC) $(CFLAGS) $< 5 | 6 | OBJ=interface.o 7 | 8 | all: $(OBJ) 9 | 10 | clean: 11 | -delete \#?.o 12 | -------------------------------------------------------------------------------- /windows/stepdbg.bat: -------------------------------------------------------------------------------- 1 | .\windebug\edit_source -configure 2 | .\windebug\edit_source -options -process grammar.y.pre -malloc -build_func_spec "e:\lang\msdev\bin\cl /E /D "DEBUG" " -build_efuns 3 |  -------------------------------------------------------------------------------- /Win32/cp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :loop 3 | if "%1" == "-f" shift 4 | if "%1" == "." shift 5 | if "%1" == ".." shift 6 | if "%1x" == "x" goto end 7 | copy %1 8 | shift 9 | goto loop 10 | :end 11 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_ip_name.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(query_ip_number(this_object()) == 0); 3 | if (this_player()) 4 | ASSERT(stringp(query_ip_number(this_player()))); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_ip_number.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(query_ip_number(this_object()) == 0); 3 | if (this_player()) 4 | ASSERT(stringp(query_ip_number(this_player()))); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/rm.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | write_file("/rm_test", "foo"); 3 | ASSERT(file_size("/rm_test")); 4 | rm("/rm_test"); 5 | ASSERT(file_size("/rm_test") == -1); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/rmdir.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mkdir("/rm_dir"); 3 | ASSERT(file_size("/rm_dir") == -2); 4 | rmdir("/rm_dir"); 5 | ASSERT(file_size("/rm_dir") == -1); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/living.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | if (this_player()) 4 | ASSERT(living(this_player())); 5 | ASSERT(!living(this_object())); 6 | #endif 7 | } 8 | -------------------------------------------------------------------------------- /packages/uids_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | int export_uid(object); 4 | string geteuid(function | object default:F__THIS_OBJECT); 5 | string getuid(object default:F__THIS_OBJECT); 6 | int seteuid(string | int); 7 | -------------------------------------------------------------------------------- /testsuite/inherit/tests.c: -------------------------------------------------------------------------------- 1 | string test_desc; 2 | 3 | void 4 | describe_test(string desc) 5 | { 6 | test_desc = desc; 7 | } 8 | 9 | string 10 | query_test_info() 11 | { 12 | return test_desc; 13 | } 14 | -------------------------------------------------------------------------------- /dumpstat.h: -------------------------------------------------------------------------------- 1 | #ifndef DUMPSTAT_H 2 | #define DUMPSTAT_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * dumpstat.c 8 | */ 9 | int data_size PROT((object_t *)); 10 | void dumpstat PROT((char *)); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /testsuite/single/README: -------------------------------------------------------------------------------- 1 | This directory is for objects that are intended to only have a _single_ 2 | instance (no clones) yet are not typically inherited. This sort of object 3 | includes what are sometimes known as daemons. 4 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/file_size.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string str = "This is a test"; 3 | rm("/test_file"); 4 | write_file("/test_file", str); 5 | ASSERT(file_size("test_file") == strlen(str)); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/previous_object.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object *obs = previous_object(-1); 3 | 4 | for (int i = 0; i < sizeof(obs); i++) { 5 | ASSERT(obs[i] == previous_object(i)); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/SMakefile: -------------------------------------------------------------------------------- 1 | # ****** This Makefile generated by make_func 2 | 3 | .c.o: 4 | $(CC) $(CFLAGS) $< 5 | 6 | OBJ=develop.o matrix.o math.o uids.o sockets.o 7 | 8 | all: $(OBJ) 9 | 10 | clean: 11 | -delete \#?.o 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/find_call_out.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(find_call_out("foo") == -1); 3 | call_out("foo", 10); 4 | ASSERT(find_call_out("foo") == 10); 5 | ASSERT(find_call_out("bar") == -1); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/etc/motd: -------------------------------------------------------------------------------- 1 | The only commands in this little mudlib are: 2 | 3 | dest, update, ed, eval, efun, rm, say, who, quit, and shutdown. 4 | 5 | All of update, dest, ed, and rm require full pathnames as arguments. 6 | 7 | Have fun. 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/allocate_mapping.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mapping m = allocate_mapping(random(1000)); 3 | mixed x, y; 4 | 5 | foreach (x, y in m) { 6 | ASSERT(0); // shouldn't get here 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/clonep.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(!clonep()); 3 | ASSERT(!clonep(this_object())); 4 | ASSERT(clonep(new(__FILE__))); 5 | ASSERT(!clonep( ({ 1, 2 }) )); 6 | ASSERT(!clonep(1)); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/light.c: -------------------------------------------------------------------------------- 1 | void create() { 2 | #ifndef __NO_LIGHT__ 3 | set_light(3); 4 | #endif 5 | } 6 | 7 | void move(object ob) { 8 | #ifndef __NO_ENVIRONMENT__ 9 | move_object(ob); 10 | #endif 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/shutdown.c: -------------------------------------------------------------------------------- 1 | void do_the_nasty_deed() { 2 | shutdown(55); 3 | ASSERT(0); 4 | } 5 | 6 | void do_tests() { 7 | // This one is hard to test :-) 8 | call_out( (: do_the_nasty_deed :), 60); 9 | } 10 | -------------------------------------------------------------------------------- /sprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRINTF_H 2 | #define SPRINTF_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | void svalue_to_string PROT((svalue_t *, outbuffer_t *, int, int, int)); 7 | char *string_print_formatted PROT((char *, int, svalue_t *)); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/in_edit.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __OLD_ED__ 3 | ASSERT(!in_edit(this_object())); 4 | ed_start("/ed_test"); 5 | ASSERT(in_edit(this_object()) == "/ed_test"); 6 | destruct(this_object()); 7 | #endif 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/livings.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | ASSERT(!sizeof(filter(livings(), (: !living($1) :)))); 4 | if (this_player()) 5 | ASSERT(member_array(this_player(), livings()) != -1); 6 | #endif 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/at_block.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mixed *a; 3 | string s = @END 4 | xxx 5 | yyy 6 | END; 7 | ASSERT( s == "xxx\nyyy\n"); 8 | a = @@END 9 | xxx 10 | yyy 11 | END; 12 | ASSERT(sizeof(a) == 2); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/badshad.c: -------------------------------------------------------------------------------- 1 | void create(int arg) { 2 | if (arg) { 3 | #ifndef __NO_SHADOWS__ 4 | ASSERT(catch(shadow(previous_object()))); 5 | destruct(this_object()); 6 | #endif 7 | } 8 | } 9 | 10 | void i_am_bad() { 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/exec.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object tp = this_player(); 3 | 4 | if (tp) { 5 | ASSERT(exec(this_object(), tp)); 6 | ASSERT(userp(this_object())); 7 | ASSERT(exec(tp, this_object())); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/keys.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mapping m = ([ 1 : 2, 3 : 4, 5 : 6 ]); 3 | mixed *k = keys(m); 4 | mixed x, y; 5 | 6 | foreach (x, y in m) { 7 | k -= ({ x }); 8 | } 9 | ASSERT(k == ({})); 10 | } 11 | -------------------------------------------------------------------------------- /amiga/times.h: -------------------------------------------------------------------------------- 1 | #ifndef AMIGA_TIMES_H 2 | #define AMIGA_TIMES_H 3 | 4 | #include 5 | 6 | /* 7 | * handle field name differences in timeval structure 8 | */ 9 | #define tv_sec tv_secs 10 | #define tv_usec tv_micro 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/allocate_buffer.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_BUFFER_TYPE__ 3 | int i = random(100000); 4 | 5 | ASSERT(sizeof(allocate_buffer(i)) == i); 6 | ASSERT(catch(allocate_buffer(-20))); 7 | #endif 8 | } 9 | 10 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/interactive.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | if (this_player()) 3 | ASSERT(interactive(this_player())); 4 | ASSERT(!interactive(this_object())); 5 | ASSERT(sizeof(users()) == sizeof(filter(users(), (: interactive :)))); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/values.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mapping m = ([ 1 : 2, 3 : 4, 5 : 6 ]); 3 | mixed *k = values(m); 4 | mixed x, y; 5 | 6 | foreach (x, y in m) { 7 | k -= ({ y }); 8 | } 9 | ASSERT(k == ({})); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/command/ed.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string file) 5 | { 6 | // need to call resolve_path() and query_cwd() 7 | #ifdef __OLD_ED__ 8 | ed(file); 9 | #else 10 | this_player()->start_ed(file); 11 | #endif 12 | return 1; 13 | } 14 | -------------------------------------------------------------------------------- /windows/steprel.bat: -------------------------------------------------------------------------------- 1 | .\winrel\edit_source -configure 2 | .\winrel\edit_source -options -process grammar.y.pre -malloc -build_func_spec "e:\lang\msdev\bin\cl /E" -build_efuns 3 | 4 | ren efun_protos.h efun_tmp.h 5 | sed -f sed.cmd efun_tmp.h > efun_protos.h 6 | 7 |  -------------------------------------------------------------------------------- /interface.h: -------------------------------------------------------------------------------- 1 | #include "lpc_to_c.h" 2 | 3 | #ifdef LPC_TO_C 4 | typedef struct { 5 | char *fname; 6 | void (**jump_table) (); 7 | string_switch_entry_t **string_switch_tables; 8 | } interface_t; 9 | 10 | extern interface_t *interface[]; 11 | #endif 12 | -------------------------------------------------------------------------------- /mudlib/Makefile: -------------------------------------------------------------------------------- 1 | 2 | OBJ=interface.$(O) 3 | SRC=interface.c 4 | 5 | .c.$(O): 6 | $(CC) $(CFLAGS) -I.. -c $*.c 7 | 8 | all: $(OBJ) 9 | ar rcu mudlib.$(A) $(OBJ) 10 | $(RANLIB) mudlib.$(A) 11 | 12 | clean: 13 | -rm -f *.$(O) 14 | -rm -f mudlib.$(A) 15 | 16 | -------------------------------------------------------------------------------- /testsuite/command/say.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef __NO_ENVIRONMENT__ 4 | #define say(x) shout(x) 5 | #endif 6 | 7 | int main(string arg) 8 | { 9 | say((string)previous_object()->query_name() 10 | + " says: " + arg + "\n"); 11 | return 1; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/input_to.c: -------------------------------------------------------------------------------- 1 | void foo() {} 2 | 3 | void do_tests() { 4 | // We can only set up one input_to, which makes this hard to test 5 | // exhaustively 6 | if (this_player()) 7 | ASSERT(input_to((: foo, "bazz" :), 1, "bar")); 8 | } 9 | -------------------------------------------------------------------------------- /compile_file.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPILE_FILE_H 2 | #define COMPILE_FILE_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | void init_lpc_to_c PROT((void)); 7 | int generate_source PROT((svalue_t *, char *)); 8 | void link_jump_table PROT((program_t *, void **)); 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/allocate.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | for (int i = 0; i < 10; i++) { 3 | ASSERT(sizeof(allocate(i)) == i); 4 | ASSERT(filter(allocate(i), (: $1 :)) == ({})); 5 | } 6 | ASSERT(allocate(0) == ({})); 7 | ASSERT(catch(allocate(-10))); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_privs.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifdef __PRIVS__ 3 | set_privs(this_object(), "foo"); 4 | ASSERT(query_privs(this_object()) == "foo"); 5 | set_privs(this_object(), 0); 6 | ASSERT(query_privs(this_object()) == 0); 7 | #endif 8 | } 9 | -------------------------------------------------------------------------------- /compat/Debug/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := 8 | 9 | -------------------------------------------------------------------------------- /amiga/ccdep.h: -------------------------------------------------------------------------------- 1 | #ifndef AMIGA_CCDEP_H 2 | #define AMIGA_CCDEP_H 3 | 4 | #ifdef LATTICE 5 | /* stuff to make the DICE code happy */ 6 | 7 | #define __stkargs __stdargs 8 | #define __sigfunc void * 9 | #define __geta4 __asm 10 | #define __D0 register __d0 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/inherit_list.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mixed *x; 3 | ASSERT(inherit_list(this_object()) == ({})); 4 | x = inherit_list(load_object("/single/tests/efuns/inh2.c")); 5 | ASSERT(sizeof(x) == 1); 6 | ASSERT(x[0] == "/single/tests/efuns/inh1.c"); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/intp.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(intp(5)); 3 | ASSERT(intp(([])[0])); 4 | ASSERT(!intp( ({}) )); 5 | ASSERT(!intp(([]))); 6 | ASSERT(!intp(this_object())); 7 | destruct(this_object()); 8 | ASSERT(intp(this_object())); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/include/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * if "global include file" is specified in the config file, this header 3 | * file is automatically included by all objects; otherwise, you have to 4 | * #include it manually 5 | */ 6 | #ifndef __CONFIG_H__ 7 | #define __CONFIG_H__ 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/goodshad.c: -------------------------------------------------------------------------------- 1 | void create(int arg) { 2 | #ifndef __NO_SHADOWS__ 3 | if (arg) { 4 | ASSERT(shadow(previous_object())); 5 | ASSERT(catch(shadow(previous_object()))); 6 | } 7 | #endif 8 | } 9 | 10 | object foo() { 11 | return this_object(); 12 | } 13 | -------------------------------------------------------------------------------- /packages/db_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | int db_close(int); 4 | int db_commit(int); 5 | int db_connect(string, string, string|void, int|void); 6 | mixed db_exec(int, string); 7 | mixed *db_fetch(int, int); 8 | int db_rollback(int); 9 | string db_status(void); 10 | int db_affected(int); 11 | -------------------------------------------------------------------------------- /rc.h: -------------------------------------------------------------------------------- 1 | #ifndef RC_H 2 | #define RC_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * rc.c 8 | */ 9 | 10 | void set_defaults PROT((char *)); 11 | int get_config_int PROT((int)); 12 | char *get_config_str PROT((int)); 13 | int get_config_item PROT((svalue_t *, svalue_t *)); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /windows/clean.bat: -------------------------------------------------------------------------------- 1 | del efunction*.h 2 | del efun_d*.c 3 | del efun_p*.h 4 | del func_s*.cpp 5 | del grammar_tab.c 6 | del grammar_tab.h 7 | del grammar.y 8 | del make_f*.c 9 | del malloc.c 10 | del mallocwrapper.c 11 | del opc.h 12 | del opcodes.h 13 | del option_defs.* 14 | del configure.h -------------------------------------------------------------------------------- /packages/mg.h: -------------------------------------------------------------------------------- 1 | #ifndef PACKAGES_MG_H 2 | #define PACKAGES_MG_H 3 | 4 | #define MG_FLAG_EMPTY 0x1 5 | 6 | typedef struct _mg { 7 | int flags; 8 | mongo conn[1]; 9 | } mg_t; 10 | 11 | typedef struct _mg_list 12 | { 13 | int alloc; 14 | int used; 15 | mg_t *mgs; 16 | } mg_list_t; 17 | 18 | 19 | #endif -------------------------------------------------------------------------------- /parse.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSE_H 2 | #define PARSE_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | int parse PROT((char *, svalue_t *, char *, svalue_t *, int)); 7 | char *process_string PROT((char *)); 8 | svalue_t *process_value PROT((char *)); 9 | char *break_string PROT((char *, int, svalue_t *)); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /packages/rd.h: -------------------------------------------------------------------------------- 1 | #ifndef PACKAGES_RD_H 2 | #define PACKAGES_RD_H 3 | 4 | #define RD_FLAG_EMPTY 0x1 5 | 6 | typedef struct _rd { 7 | int flags; 8 | redisContext *conn; 9 | } rd_t; 10 | 11 | typedef struct _rd_list 12 | { 13 | int alloc; 14 | int used; 15 | rd_t *rds; 16 | } rd_list_t; 17 | 18 | 19 | #endif -------------------------------------------------------------------------------- /compat/simuls/apply.c: -------------------------------------------------------------------------------- 1 | /* Like evaluate(), but expand out an array of arguments. No longer necessary 2 | because of the ... syntax */ 3 | 4 | mixed apply(mixed f, mixed *arr...) { 5 | if (sizeof(arr) && arrayp(arr[<1])) 6 | arr = arr[0..<2] + arr[<1]; 7 | 8 | return evaluate(f, arr...); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/children.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object x; 3 | 4 | foreach (x in children(__FILE__)) 5 | if (x != this_object()) destruct(x); 6 | 7 | for (int i = 0; i < 5; i++) 8 | new(__FILE__); 9 | 10 | ASSERT(sizeof(children(__FILE__)) == 6); 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/cp.c: -------------------------------------------------------------------------------- 1 | #define TESTFILE "/testfile" 2 | 3 | void do_tests() { 4 | rm(TESTFILE); 5 | ASSERT(file_size(TESTFILE) == -1); 6 | ASSERT(cp("/single/master.c", TESTFILE)); 7 | ASSERT(file_size(TESTFILE)); 8 | ASSERT(read_file("/single/master.c") == read_file(TESTFILE)); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/to_int.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | int i = 5; 3 | float f = 6.7; 4 | 5 | i = to_int(f); 6 | ASSERT(i == 6); 7 | 8 | i = f; 9 | ASSERT(i == 6); 10 | 11 | i = to_int("7"); 12 | ASSERT(i == 7); 13 | 14 | i = to_int("ajdfj"); 15 | ASSERT(i == 0); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/command/quit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef __NO_ENVIRONMENT__ 4 | #define say(x) shout(x) 5 | #endif 6 | 7 | int 8 | main(string arg) 9 | { 10 | write("Bye.\n"); 11 | say((string)previous_object()->query_name() 12 | + " leaves this reality.\n"); 13 | previous_object()->remove(); 14 | return 1; 15 | } 16 | -------------------------------------------------------------------------------- /sysmalloc.c: -------------------------------------------------------------------------------- 1 | #define IN_MALLOC_WRAPPER 2 | #define NO_OPCODES 3 | #include "std.h" 4 | #include "lpc_incl.h" 5 | #include "simulate.h" 6 | #include "comm.h" 7 | 8 | #ifdef DO_MSTATS 9 | void show_mstats P2(outbuffer_t *, ob, char *, s) { 10 | outbuf_add(ob, "No malloc statistics available with SYSMALLOC\n"); 11 | } 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo MudOS is currently configured to use 'GNUmakefile'. Edit 'build.MudOS' 3 | @echo if this is not what you want. 4 | 5 | .DEFAULT: 6 | @echo MudOS is currently configured to use 'GNUmakefile'. Edit 'build.MudOS' 7 | @echo if this is not what you want. 8 | 9 | nothing: 10 | 11 | which_makefile: 12 | echo MakeIsMake 13 | -------------------------------------------------------------------------------- /mudlib/GNUmakefile: -------------------------------------------------------------------------------- 1 | 2 | OBJ=interface.$(O) 3 | SRC=interface.c 4 | 5 | OBJ=$(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC))) 6 | 7 | $(OBJDIR)/%.o: %.c 8 | $(CC) -I$(OBJDIR) -I.. $(CFLAGS) -o $@ -c $< 9 | 10 | all: $(OBJ) 11 | ar rcu mudlib.$(A) $(OBJ) 12 | $(RANLIB) mudlib.$(A) 13 | 14 | clean: 15 | -rm -f *.$(O) 16 | -rm -f mudlib.$(A) 17 | 18 | -------------------------------------------------------------------------------- /packages/README: -------------------------------------------------------------------------------- 1 | In order to add a package, do the following: 2 | 3 | (1) Pick a name for your package (we will use 'foo' here) 4 | 5 | (2) Put the prototypes for the efuns in foo_spec.c 6 | 7 | (3) implement the efuns in foo.c 8 | 9 | (4) add #define PACKAGE_FOO to options.h or local_options 10 | 11 | (5) do a full recompile (make remake) 12 | 13 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/sscanf.c: -------------------------------------------------------------------------------- 1 | inherit "/inherit/tests"; 2 | 3 | void do_tests() { 4 | string s; 5 | 6 | ASSERT(catch(sscanf("you%", "%s%", s))); 7 | ASSERT(catch(sscanf("you%", "%su%", s))); 8 | sscanf("you%", "%s%%", s); 9 | ASSERT(s == "you"); 10 | sscanf("you%", "%su%%", s); 11 | ASSERT(s == "yo"); 12 | } 13 | -------------------------------------------------------------------------------- /include/parser_error.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSER_ERROR_H 2 | #define PARSER_ERROR_H 3 | 4 | #define ERR_IS_NOT 1 5 | #define ERR_NOT_LIVING 2 6 | #define ERR_NOT_ACCESSIBLE 3 7 | #define ERR_AMBIG 4 8 | #define ERR_ORDINAL 5 9 | #define ERR_ALLOCATED 6 10 | #define ERR_THERE_IS_NO 7 11 | #define ERR_BAD_MULTIPLE 8 12 | #define ERR_MANY_PATHS 9 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /mudlib/interface.c: -------------------------------------------------------------------------------- 1 | #include "../std.h" 2 | #include "../interface.h" 3 | #include "../lpc_to_c.h" 4 | 5 | int SGI_should_be_shot_for_including_stupid_bugs_in_ar___evidentally_Solaris_isnt_so_hot_either___do_all_SYSV_versions_of_ar_die_on_files_with_no_symbols_QUESTION_MARK; 6 | 7 | #ifdef LPC_TO_C 8 | interface_t *interface[] = { 9 | 0 10 | }; 11 | #endif 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/sizeof.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(sizeof(({ 1, 2, 3 })) == 3); 3 | ASSERT(sizeof(allocate(50)) == 50); 4 | ASSERT(sizeof(allocate_mapping(5)) == 0); 5 | ASSERT(sizeof( ([ 1 : 2, 3 : 4 ]) ) == 2); 6 | ASSERT(sizeof("foo") == 3); 7 | ASSERT(sizeof((: sizeof :)) == 0); 8 | ASSERT(sizeof(6) == 0); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/member_array.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | ASSERT(member_array('c', "foo") == -1); 3 | ASSERT(member_array('b', "abar") == 1); 4 | ASSERT(member_array('y', "xyzzy") == 1); 5 | ASSERT(member_array('y', "xyzzy", 2) == 4); 6 | ASSERT(member_array(2, ({ 1, 2, 3 })) == 1); 7 | ASSERT(member_array("foo", ({ 1, "foo", 3 })) == 1); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_verb.c: -------------------------------------------------------------------------------- 1 | #ifndef __NO_ADD_ACTION__ 2 | void func() { 3 | ASSERT(query_verb() == "foo"); 4 | } 5 | #endif 6 | 7 | void do_tests() { 8 | #ifndef __NO_ADD_ACTION__ 9 | object tp; 10 | SAVETP; 11 | enable_commands(); 12 | add_action( (: func :), "foo"); 13 | RESTORETP; 14 | command("foo"); 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/deep_inherit_list.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mixed *x; 3 | 4 | ASSERT(deep_inherit_list(this_object()) == ({ })); 5 | x = deep_inherit_list(load_object("/single/tests/efuns/inh2.c")); 6 | ASSERT(sizeof(x) == 2); 7 | ASSERT(x[0] == "/single/tests/efuns/inh1.c"); 8 | ASSERT(x[1] == "/single/tests/efuns/inh0.c"); 9 | } 10 | -------------------------------------------------------------------------------- /packages/gdbm.h: -------------------------------------------------------------------------------- 1 | #ifndef __db_h 2 | #define __db_h 3 | 4 | int db_exists P2( char *, db, char *, keystr); 5 | int db_query P3( svalue_t *, ret, char *, db, char *, keystr); 6 | int db_store P3( char *, db, char *, keystr, svalue_t *, val); 7 | int db_delete P2( char *, db, char *, keystr); 8 | array_t *db_keys P2( char *, db, char *, pattern); 9 | 10 | #endif /* __db_h */ 11 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/map_delete.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mapping m = ([ 1 : 2, "foo" : 3, this_object() : 5 ]); 3 | 4 | map_delete(m, 1); 5 | ASSERT(undefinedp(m[1])); 6 | map_delete(m, ({})); 7 | map_delete(m, "foo"); 8 | ASSERT(undefinedp(m["foo"])); 9 | map_delete(m, this_object()); 10 | ASSERT(undefinedp(m[this_object()])); 11 | } 12 | -------------------------------------------------------------------------------- /wrappedmalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef WRAPPED_MALLOC_H 2 | #define WRAPPED_MALLOC_H 3 | #ifdef WRAPPEDMALLOC 4 | void *wrappedmalloc PROT((int)); 5 | void *wrappedrealloc PROT((void *, int)); 6 | void *wrappedcalloc PROT((int, int)); 7 | void wrappedfree PROT((void *)); 8 | 9 | void wrappedmalloc_init PROT((void)); 10 | void dump_malloc_data PROT((outbuffer_t *)); 11 | #endif 12 | #endif 13 | -------------------------------------------------------------------------------- /bsdmalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef BSDMALLOC_H 2 | #define BSDMALLOC_H 3 | 4 | #ifdef BSDMALLOC 5 | void *bsdmalloc_malloc PROT((size_t)); 6 | void *bsdmalloc_calloc PROT((size_t, size_t)); 7 | void *bsdmalloc_realloc PROT((void *, size_t)); 8 | void bsdmalloc_free PROT((void *)); 9 | #ifdef DO_MSTATS 10 | void show_mstats PROT((outbuffer_t *, char *)); 11 | #endif 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /packages/parser_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | void parse_init(); 4 | void parse_refresh(); 5 | mixed parse_sentence(string, void | int, void | object *, void | mapping); 6 | void parse_add_rule(string, string); 7 | void parse_remove(string); 8 | void parse_add_synonym(string, string, void | string); 9 | string parse_dump(); 10 | mixed parse_my_rules(object, string, void | int); 11 | -------------------------------------------------------------------------------- /socket_ctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_CTRL_H 2 | #define SOCKET_CTRL_H 3 | 4 | /* 5 | * socket_ctrl.c 6 | */ 7 | int set_socket_nonblocking PROT((int, int)); 8 | int set_socket_owner PROT((int, int)); 9 | int set_socket_async PROT((int, int)); 10 | 11 | #ifdef WIN32 12 | void SocketPerror PROT((char *, char *)); 13 | void CDECL cleanup_sockets PROT((void)); 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/function_profile.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifdef __PROFILE_FUNCTIONS__ 3 | mixed *hmm = function_profile(this_object()); 4 | ASSERT(sizeof(hmm) == 1); 5 | ASSERT(hmm[0]["calls"]); 6 | ASSERT(!undefinedp(hmm[0]["self"])); 7 | ASSERT(!undefinedp(hmm[0]["children"])); 8 | ASSERT(hmm[0]["name"] == "do_tests"); 9 | #endif 10 | } 11 | 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/to_float.c: -------------------------------------------------------------------------------- 1 | inherit "/inherit/tests"; 2 | 3 | void do_tests() { 4 | int i = 5; 5 | float f = 6.7; 6 | 7 | f = to_float(i); 8 | ASSERT(f == 5.0); 9 | 10 | f = i; 11 | ASSERT(f == 5.0); 12 | 13 | f = to_float("1.23"); 14 | ASSERT(f == 1.23); 15 | 16 | f = to_float("ajdfj"); 17 | ASSERT(f == 0.00); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/succeed.c: -------------------------------------------------------------------------------- 1 | #pragma no_strict_types 2 | foo() { } 3 | bar(x) { } 4 | #pragma strict_types 5 | create() { } 6 | 7 | void foo(int); 8 | 9 | ; // only a warning 10 | 11 | int ident; 12 | #define X1 id 13 | #define X2 ent 14 | int paste = X1##X2; 15 | string x = @END 16 | xxx 17 | END; 18 | string * y = @@END 19 | xxx 20 | yyy 21 | zzz 22 | END 23 | ; 24 | 25 | -------------------------------------------------------------------------------- /smalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef SMALLOC_H 2 | #define SMALLOC_H 3 | 4 | #ifdef SMALLOC 5 | void * CDECL smalloc_malloc PROT((size_t)); 6 | void * CDECL smalloc_realloc PROT((void *, size_t)); 7 | void * CDECL smalloc_calloc PROT((size_t, size_t)); 8 | void CDECL smalloc_free PROT((void *)); 9 | #ifdef DO_MSTATS 10 | void show_mstats PROT((outbuffer_t *, char *)); 11 | #endif 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/remove_action.c: -------------------------------------------------------------------------------- 1 | int called = 0; 2 | 3 | void func() { called = 1; } 4 | 5 | void do_tests() { 6 | #ifndef __NO_ADD_ACTION__ 7 | object tp; 8 | 9 | SAVETP; 10 | enable_commands(); 11 | add_action( "func", "bar" ); 12 | ASSERT(remove_action( "func", "bar" )); 13 | RESTORETP; 14 | command("bar"); 15 | ASSERT(!called); 16 | #endif 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/save_object.c: -------------------------------------------------------------------------------- 1 | int x = 0; 2 | #ifndef __SENSIBLE_MODIFIERS__ 3 | static int z = 5; 4 | #else 5 | nosave int z = 5; 6 | #endif 7 | int y = 1; 8 | 9 | void do_tests() { 10 | save_object("/sf"); 11 | ASSERT(read_file("/sf.o") == "#" + __FILE__ + "\ny 1\n"); 12 | save_object("/sf", 1); 13 | ASSERT(read_file("/sf.o") == "#" + __FILE__ + "\nx 0\ny 1\n"); 14 | } 15 | -------------------------------------------------------------------------------- /packages/math_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | float cos(float); 4 | float sin(float); 5 | float tan(float); 6 | float asin(float); 7 | float acos(float); 8 | float atan(float); 9 | float sqrt(float); 10 | float log(float); 11 | float log10(float); 12 | float pow(float, float); 13 | float exp(float); 14 | float floor(float); 15 | float ceil(float); 16 | 17 | -------------------------------------------------------------------------------- /class.h: -------------------------------------------------------------------------------- 1 | #ifndef CLASS_H 2 | #define CLASS_H 3 | 4 | /* It is usually better to include "lpc_incl.h" instead of including this 5 | directly */ 6 | 7 | void dealloc_class PROT((array_t *)); 8 | void free_class PROT((array_t *)); 9 | array_t *allocate_class PROT((class_def_t *, int)); 10 | array_t *allocate_class_by_size PROT((int)); 11 | array_t *allocate_empty_class_by_size PROT((int)); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /include/localtime.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Definitions for localtime() efun 4 | */ 5 | #define LT_SEC 0 6 | #define LT_MIN 1 7 | #define LT_HOUR 2 8 | #define LT_MDAY 3 9 | #define LT_MON 4 10 | #define LT_YEAR 5 11 | #define LT_WDAY 6 12 | #define LT_YDAY 7 13 | #define LT_GMTOFF 8 14 | #define LT_ZONE 9 15 | #define LT_ISDST 10 16 | -------------------------------------------------------------------------------- /include/type.h: -------------------------------------------------------------------------------- 1 | /* /include/type.h */ 2 | 3 | #ifndef _TYPE_H 4 | #define _TYPE_H 5 | 6 | #define INT "int" 7 | #define STRING "string" 8 | #define ARRAY "array" 9 | #define OBJECT "object" 10 | #define MAPPING "mapping" 11 | #define FUNCTION "function" 12 | #define FLOAT "float" 13 | #define BUFFER "buffer" 14 | #define CLASS "class" 15 | #endif 16 | -------------------------------------------------------------------------------- /testsuite/command/eval.c: -------------------------------------------------------------------------------- 1 | int 2 | main(string arg) 3 | { 4 | /* clean up first */ 5 | if (file_size("/tmp_eval_file.c") != -1) 6 | rm ("/tmp_eval_file.c"); 7 | if (find_object("/tmp_eval_file")) 8 | destruct(find_object("/tmp_eval_file")); 9 | 10 | write_file("/tmp_eval_file.c","mixed eval() { "+arg+"; }\n"); 11 | printf("Result = %O\n", "/tmp_eval_file"->eval()); 12 | return 1; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/move_object.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ENVIRONMENT__ 3 | ASSERT(catch(move_object("foo"))); 4 | ASSERT(catch(move_object(__FILE__))); 5 | ASSERT(catch(move_object(this_object()))); 6 | move_object(master()); 7 | ASSERT(environment(this_object()) == master()); 8 | destruct(this_object()); 9 | ASSERT(catch(move_object(master()))); 10 | #endif 11 | } 12 | -------------------------------------------------------------------------------- /packages/Makefile.master: -------------------------------------------------------------------------------- 1 | %include "packages/packages" 2 | 3 | %ifdef GNU 4 | OBJ=$(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC))) 5 | 6 | $(OBJDIR)/%.o: %.c 7 | $(CC) -I$(OBJDIR) -I.. $(CFLAGS) -o $@ -c $< 8 | %else 9 | .c.$(O): 10 | $(CC) $(CFLAGS) -I.. -c $*.c 11 | %endif 12 | 13 | all: $(OBJ) 14 | ar rcu packages.$(A) $(OBJ) 15 | $(RANLIB) packages.$(A) 16 | 17 | clean: 18 | rm -f *.$(O) 19 | rm -f packages.$(A) 20 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/find_living.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | object ob; 4 | object tp; 5 | 6 | ASSERT(!find_living("bar")); 7 | SAVETP; 8 | enable_commands(); 9 | set_living_name("bar"); 10 | ob = find_living("bar"); 11 | disable_commands(); 12 | RESTORETP; 13 | ASSERT(ob == this_object()); 14 | ASSERT(!find_living("bar")); 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/rename.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | write_file("/rename_test", "Hmm."); 3 | rename("/rename_test", "/ren_test"); 4 | ASSERT(file_size("/rename_test") == -1); 5 | ASSERT(read_file("/ren_test") == "Hmm."); 6 | rename("/ren_test", "/single"); 7 | ASSERT(file_size("/ren_test") == -1); 8 | ASSERT(read_file("/single/ren_test") == "Hmm."); 9 | rm("/single/ren_test"); 10 | } 11 | -------------------------------------------------------------------------------- /windows/configure.h: -------------------------------------------------------------------------------- 1 | #define INCL_STDLIB_H 2 | #define INCL_TIME_H 3 | #define INCL_FCNTL_H 4 | #define INCL_DOS_H 5 | #define INCL_SYS_STAT_H 6 | #define INCL_LIMITS_H 7 | #define USE_STRUCT_DIRENT 8 | #define INCL_STDARG_H 9 | #define HAS_MEMMOVE 10 | #define RAND 11 | #define HAS_STRERROR 12 | #define HAS_GETCWD 13 | 14 | #define SIZEOF_INT 4 15 | #define SIZEOF_PTR 4 16 | #define SIZEOF_SHORT 2 17 | #define SIZEOF_FLOAT 4 18 | -------------------------------------------------------------------------------- /Win32/configure.h: -------------------------------------------------------------------------------- 1 | #define INCL_STDLIB_H 2 | #define INCL_TIME_H 3 | #define INCL_FCNTL_H 4 | #define INCL_DOS_H 5 | #define INCL_LIMITS_H 6 | #define USE_STRUCT_DIRENT 7 | #define INCL_SYS_STAT_H 8 | #define INCL_STDARG_H 9 | #define HAS_MEMMOVE 10 | #define RAND 11 | #define HAS_STRERROR 12 | #define HAS_GETCWD 13 | 14 | #define CONST const 15 | #define INLINE 16 | #define UINT32 unsigned long 17 | #define UINT32 unsigned long 18 | -------------------------------------------------------------------------------- /mudlib/Makefile.master: -------------------------------------------------------------------------------- 1 | OBJ=interface.$(O) 2 | SRC=interface.c 3 | 4 | %ifdef GNU 5 | OBJ=$(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC))) 6 | 7 | $(OBJDIR)/%.o: %.c 8 | $(CC) -I$(OBJDIR) -I.. $(CFLAGS) -o $@ -c $< 9 | %else 10 | .c.$(O): 11 | $(CC) $(CFLAGS) -I.. -c $*.c 12 | %endif 13 | 14 | all: $(OBJ) 15 | ar rcu mudlib.$(A) $(OBJ) 16 | $(RANLIB) mudlib.$(A) 17 | 18 | clean: 19 | -rm -f *.$(O) 20 | -rm -f mudlib.$(A) 21 | -------------------------------------------------------------------------------- /testsuite/include/lpctypes.h: -------------------------------------------------------------------------------- 1 | /* /include/type.h */ 2 | 3 | #ifndef _TYPE_H 4 | #define _TYPE_H 5 | 6 | #define INT "int" 7 | #define STRING "string" 8 | #define ARRAY "array" 9 | #define OBJECT "object" 10 | #define MAPPING "mapping" 11 | #define FUNCTION "function" 12 | #define FLOAT "float" 13 | #define BUFFER "buffer" 14 | #define CLASS "class" 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/clear_bit.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string str; 3 | 4 | ASSERT(catch(clear_bit("", 1000000000000))); 5 | ASSERT(catch(clear_bit("", -2))); 6 | 7 | str = "11111"; 8 | str = clear_bit(str, 7); 9 | ASSERT(!test_bit(str, 7)); 10 | str = clear_bit(set_bit(str, 12), 12); 11 | ASSERT(!test_bit(str, 7)); 12 | 13 | ASSERT(str == clear_bit(str, 40)); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/ed.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __OLD_ED__ 3 | ASSERT(catch(ed_cmd("foo"))); 4 | rm("/ed_test"); 5 | write_file("/ed_test", "xyzzy\nxxx"); 6 | ed_start("/ed_test"); 7 | ASSERT(ed_cmd("1s/y/a/g")); 8 | ASSERT(ed_cmd("2s!x!b!")); 9 | ASSERT(catch(ed_start("foo"))); 10 | ASSERT(ed_cmd("x")); 11 | ASSERT(read_file("/ed_test") == "xazza\nbxx\n"); 12 | #endif 13 | } 14 | -------------------------------------------------------------------------------- /compat/simuls/dump_socket_status.c: -------------------------------------------------------------------------------- 1 | string dump_socket_status() { 2 | string ret = @END 3 | Fd State Mode Local Address Remote Address 4 | -- --------- -------- --------------------- --------------------- 5 | END; 6 | 7 | foreach (array item in socket_status()) { 8 | ret += sprintf("%2d %|9s %|8s %-21s %-21s\n", item[0], item[1], item[2], item[3], item[4]); 9 | } 10 | 11 | return ret; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/read_file.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string foo = read_bytes("/testfile"); 3 | string mid = implode(explode(foo, "\n")[99..198], "\n") + "\n"; 4 | 5 | ASSERT(!read_file("/single", 10, 10)); 6 | ASSERT(read_file("/testfile") == foo); 7 | ASSERT(read_file("/testfile", 100, 100) == mid); 8 | ASSERT(!read_file("/does_not_exist")); 9 | ASSERT(!read_file("/testfile", 10000, 1)); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/add_action.c: -------------------------------------------------------------------------------- 1 | int called; 2 | int xverb; 3 | 4 | void do_tests() { 5 | #ifndef __NO_ADD_ACTION__ 6 | object tp; 7 | xverb = called = 0; 8 | SAVETP; 9 | enable_commands(); 10 | add_action( (: called = 1 :), "foo"); 11 | add_action( (: xverb = 1 :), "b", 1); 12 | RESTORETP; 13 | command("foo"); 14 | command("bar"); 15 | ASSERT(called); 16 | ASSERT(xverb); 17 | #endif 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/disable_commands.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | object save_tp = this_player(); 4 | 5 | disable_commands(); 6 | ASSERT(!living(this_object())); 7 | enable_commands(); 8 | ASSERT(living(this_object())); 9 | disable_commands(); 10 | ASSERT(!living(this_object())); 11 | 12 | if (save_tp) 13 | evaluate(bind( (: enable_commands :), save_tp)); 14 | #endif 15 | } 16 | -------------------------------------------------------------------------------- /Win32/touch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) { 8 | int i, handle; 9 | 10 | for (i = 1; i <= argc; i++) { 11 | if (access(argv[i], 0) == -1) { 12 | handle = open(argv[i], _O_RDWR | _O_CREAT, _S_IREAD | _S_IWRITE); 13 | close(handle); 14 | } else { 15 | utime(argv[i], NULL); 16 | } 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /replace_program.h: -------------------------------------------------------------------------------- 1 | #ifndef _REPLACE_PROGRAM_H_ 2 | #define _REPLACE_PROGRAM_H_ 3 | 4 | #include "lpc_incl.h" 5 | 6 | int replace_program_pending PROT((object_t *)); 7 | void replace_programs PROT((void)); 8 | 9 | typedef struct replace_ob_s { 10 | object_t *ob; 11 | program_t *new_prog; 12 | unsigned short var_offset; 13 | struct replace_ob_s *next; 14 | } replace_ob_t; 15 | 16 | extern replace_ob_t *obj_list_replace; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /simul_efun.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMUL_EFUN_H 2 | #define SIMUL_EFUN_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * simul_efun.c 8 | */ 9 | 10 | extern object_t *simul_efun_ob; 11 | extern function_lookup_info_t *simuls; 12 | 13 | void init_simul_efun PROT((char *)); 14 | void set_simul_efun PROT((object_t *)); 15 | int find_simul_efun PROT((char *)); 16 | 17 | #ifdef DEBUGMALLOC_EXTENSIONS 18 | void mark_simuls PROT((void)); 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/environment.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ENVIRONMENT__ 3 | object ob; 4 | 5 | ASSERT(environment() == 0); 6 | ASSERT(environment(this_object()) == 0); 7 | ob = new(__FILE__, 1); 8 | ASSERT(environment(ob) == this_object()); 9 | #endif 10 | } 11 | 12 | void create(int flag) { 13 | #ifndef __NO_ENVIRONMENT__ 14 | if (flag) 15 | move_object(previous_object()); 16 | #endif 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /master.h: -------------------------------------------------------------------------------- 1 | #ifndef MASTER_H 2 | #define MASTER_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* for apply_master_ob */ 7 | #define MASTER_APPROVED(x) (((x)==(svalue_t *)-1) || ((x) && (((x)->type != T_NUMBER) || (x)->u.number))) 8 | 9 | extern object_t *master_ob; 10 | 11 | svalue_t *apply_master_ob PROT((int, int)); 12 | svalue_t *safe_apply_master_ob PROT((int, int)); 13 | void init_master PROT((void)); 14 | void set_master PROT((object_t *)); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /testsuite/command/update.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string file) 5 | { 6 | object obj; 7 | 8 | // need to call resolve_path() and query_cwd() 9 | if (!file) { 10 | #ifndef __NO_ADD_ACTION__ 11 | return notify_fail("update what?\n"); 12 | #else 13 | write("update what?\n"); 14 | return 1; 15 | #endif 16 | } 17 | if (obj = find_object(file)) { 18 | destruct(obj); 19 | } 20 | load_object(file); 21 | return 1; 22 | } 23 | -------------------------------------------------------------------------------- /otable.h: -------------------------------------------------------------------------------- 1 | #ifndef OTABLE_H 2 | #define OTABLE_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * otable.c 8 | */ 9 | void init_otable PROT((void)); 10 | void enter_object_hash PROT((object_t *)); 11 | void enter_object_hash_at_end PROT((object_t *)); 12 | void remove_object_hash PROT((object_t *)); 13 | void remove_precompiled_hashes PROT((char *)); 14 | object_t *lookup_object_hash PROT((char *)); 15 | int show_otable_status PROT((outbuffer_t *, int)); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/enable_wizard.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_WIZARDS__ 3 | disable_wizard(); 4 | ASSERT(!wizardp(this_object())); 5 | enable_wizard(); // fails; not interactive 6 | ASSERT(!wizardp(this_object())); 7 | 8 | evaluate(bind( (: disable_wizard :), this_player())); 9 | ASSERT(!wizardp(this_player())); 10 | evaluate(bind( (: enable_wizard :), this_player())); 11 | ASSERT(wizardp(this_player())); 12 | #endif 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/query_ed_mode.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __OLD_ED__ 3 | ASSERT(query_ed_mode() == -1); 4 | ed_start("/ed_test"); 5 | ASSERT(query_ed_mode() == 0); 6 | ed_cmd("h"); 7 | ASSERT(query_ed_mode() == -2); 8 | ed_cmd(""); 9 | ASSERT(query_ed_mode() == 0); 10 | ed_cmd("2c"); 11 | ASSERT(query_ed_mode() == 2); 12 | ed_cmd("."); 13 | ed_cmd("Q"); 14 | ASSERT(query_ed_mode() == -1); 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/match_path.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mapping m = ([ "foo/" : 1, "bar" : 2, "bazz/foo" : 3, "foo/bar/bazz" : 4]); 3 | 4 | ASSERT(!match_path(m, "kajdfj")); 5 | ASSERT(match_path(m, "bar") == 2); 6 | ASSERT(match_path(m, "bar/") == 2); 7 | ASSERT(match_path(m, "bazz//foo") == 3); 8 | ASSERT(match_path(m, "bazz/foo//") == 3); 9 | ASSERT(match_path(m, "foo/bar") == 1); 10 | ASSERT(match_path(m, "foo/bar/bazz") == 4); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/present.c: -------------------------------------------------------------------------------- 1 | string id; 2 | 3 | int id(string name) { return name == id; } 4 | 5 | void create(string arg) { 6 | #ifndef __NO_ENVIRONMENT__ 7 | id = arg; 8 | if (!arg) { 9 | new(__FILE__, "foo"); 10 | } else { 11 | move_object(previous_object()); 12 | } 13 | #endif 14 | } 15 | 16 | void do_tests() { 17 | #ifndef __NO_ENVIRONMENT__ 18 | ASSERT(present("foo", this_object())); 19 | ASSERT(present("foo")); 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/talker.c: -------------------------------------------------------------------------------- 1 | void create() { 2 | #ifndef __NO_ADD_ACTION__ 3 | enable_commands(); 4 | #endif 5 | } 6 | 7 | void catch_tell(string str) { 8 | } 9 | 10 | void send(string str, mixed x) { 11 | #ifndef __NO_ENVIRONMENT__ 12 | if (x) 13 | say(str, x); 14 | else 15 | say(str); 16 | #else 17 | shout(str); 18 | #endif 19 | } 20 | 21 | void move(object ob) { 22 | #ifndef __NO_ENVIRONMENT__ 23 | move_object(ob); 24 | #endif 25 | } 26 | 27 | -------------------------------------------------------------------------------- /origin.h: -------------------------------------------------------------------------------- 1 | #ifndef ORIGIN_H 2 | #define ORIGIN_H 3 | 4 | enum origin { 5 | ORIGIN_DRIVER = 0x01, 6 | ORIGIN_LOCAL = 0x02, 7 | ORIGIN_CALL_OTHER = 0x04, 8 | ORIGIN_SIMUL_EFUN = 0x08, 9 | ORIGIN_INTERNAL = 0x10, 10 | ORIGIN_EFUN = 0x20, 11 | /* pseudo frames for call_other function pointers and efun pointer */ 12 | ORIGIN_FUNCTION_POINTER = 0x40, 13 | /* anonymous functions */ 14 | ORIGIN_FUNCTIONAL = 0x80 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/clone_object.c: -------------------------------------------------------------------------------- 1 | string my_arg; 2 | 3 | string get_arg() { 4 | return my_arg; 5 | } 6 | 7 | void create(string arg) { 8 | my_arg = arg; 9 | } 10 | 11 | void do_tests() { 12 | object ob; 13 | #ifdef __PACKAGE_UIDS__ 14 | seteuid(0); 15 | ASSERT(catch(new(__FILE__))); 16 | seteuid(getuid(this_object())); 17 | #endif 18 | ASSERT(new(__FILE__)->get_arg() == 0); 19 | ASSERT((string)new(__FILE__, "foo")->get_arg() == "foo"); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/lower_case.c: -------------------------------------------------------------------------------- 1 | #define STR STR1 2 | #define STR1 "this is a test!" 3 | #define STR2 "This is a test!" 4 | #define STR3 "This is A tEst!" 5 | 6 | void do_tests() { 7 | string str; 8 | str = STR1; 9 | ASSERT(lower_case(str) == STR); 10 | ASSERT(str == STR1); 11 | 12 | str = STR2; 13 | ASSERT(lower_case(str) == STR); 14 | ASSERT(str == STR2); 15 | 16 | str = STR3; 17 | ASSERT(lower_case(str) == STR); 18 | ASSERT(str == STR3); 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/origin.c: -------------------------------------------------------------------------------- 1 | void lfun() { 2 | ASSERT(origin() == "local"); 3 | } 4 | 5 | void co() { 6 | ASSERT(origin() == "internal"); 7 | } 8 | 9 | void ef() { 10 | ASSERT(origin() == "efun"); 11 | } 12 | 13 | void do_tests() { 14 | ASSERT(origin() == "call_other"); 15 | lfun(); 16 | call_out("co", 1); 17 | filter( ({ 1 }), "ef"); 18 | ASSERT(evaluate( (: origin :)) == "function pointer"); 19 | ASSERT(evaluate( (: origin() :)) == "functional"); 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/command/who.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string arg) 5 | { 6 | object *list; 7 | int j; 8 | 9 | printf("%-25s idle\n", "name (*edit, +input)"); 10 | printf("-------------------- ----\n"); 11 | for (list = users(), j = 0; j < sizeof(list); j++) { 12 | printf("%-25s %4d\n", (string)list[j]->query_name() + 13 | (in_edit(this_player()) ? "*" : "") + 14 | (in_input(this_player()) ? "+" : ""), 15 | query_idle(this_player()) / 60 16 | ); 17 | } 18 | return 1; 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_bit.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string str; 3 | 4 | ASSERT(catch(set_bit("", 10000000000000))); 5 | ASSERT(catch(set_bit("", -2))); 6 | 7 | str = set_bit("", 100); 8 | ASSERT(test_bit(str, 100)); 9 | for (int i = 0; i < 200; i++) { 10 | if (i != 100) 11 | ASSERT(!test_bit(str, i)); 12 | } 13 | str = " "; 14 | str[0] = 5; 15 | ASSERT(catch(set_bit(str, 1))); 16 | str[0] = 255; 17 | ASSERT(catch(set_bit(str, 1))); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/bind.c: -------------------------------------------------------------------------------- 1 | int glob; 2 | 3 | #define CANT_BIND(f) ASSERT(catch(bind(f, previous_object()))) 4 | #define CAN_BIND(f) ASSERT(bind(f, previous_object())) 5 | 6 | void do_tests() { 7 | CANT_BIND((: do_tests :)); 8 | CANT_BIND((: glob :)); 9 | CANT_BIND((: glob + 1 :)); 10 | CANT_BIND((: do_tests() :)); 11 | CAN_BIND((: $1 + $2 :)); 12 | ASSERT(functionp(bind( (: $1 :), this_object()))); 13 | ASSERT(evaluate(bind( (: $1 + $2 :), this_object()), 3, 4) == 7); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/find_player.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ADD_ACTION__ 3 | object tp; 4 | object o1, o2; 5 | 6 | if (this_player()) { 7 | ASSERT(!find_player("bar")); 8 | SAVETP; 9 | enable_commands(); 10 | set_living_name("bar"); 11 | o1 = find_player("bar"); 12 | exec(this_object(), tp); 13 | o2 = find_player("bar"); 14 | exec(tp, this_object()); 15 | disable_commands(); 16 | RESTORETP; 17 | ASSERT(!o1); 18 | ASSERT(o2 == this_object()); 19 | } 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /make_malloc.c: -------------------------------------------------------------------------------- 1 | /* simple little program to link the right malloc c module to malloc.c */ 2 | /* needs to be a C program so that it can include config.h */ 3 | 4 | #define NO_SOCKETS 5 | #define NO_OPCODES 6 | #include "std.h" 7 | 8 | #if !defined(THE_MALLOC) && !defined(THE_WRAPPER) 9 | int main() { 10 | puts("Memory package and/or malloc wrapper incorrectly specified in options.h\n"); 11 | } 12 | #else 13 | int main() { 14 | unlink("malloc.c"); 15 | unlink("mallocwrapper.c"); 16 | return 0; 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /include/function.h: -------------------------------------------------------------------------------- 1 | /* codes returned by the functionp() efun */ 2 | 3 | #define FP_LOCAL 2 4 | #define FP_EFUN 3 5 | #define FP_SIMUL 4 6 | #define FP_FUNCTIONAL 5 7 | 8 | /* internal use */ 9 | #define FP_G_VAR 6 10 | #define FP_L_VAR 7 11 | #define FP_ANONYMOUS 8 12 | 13 | /* additional flags */ 14 | #define FP_MASK 0x0f 15 | #define FP_HAS_ARGUMENTS 0x10 16 | #define FP_OWNER_DESTED 0x20 17 | #define FP_NOT_BINDABLE 0x40 18 | -------------------------------------------------------------------------------- /lpc_incl.h: -------------------------------------------------------------------------------- 1 | #ifndef LPC_INCL_H 2 | #define LPC_INCL_H 3 | 4 | #include "std.h" 5 | #include "include/function.h" 6 | #include "origin.h" 7 | #include "config.h" 8 | #include "applies.h" 9 | 10 | #include "program.h" 11 | #include "lpc.h" 12 | #include "function.h" 13 | #include "buffer.h" 14 | #include "object.h" 15 | #include "array.h" 16 | #include "mapping.h" 17 | #include "class.h" 18 | 19 | #include "stralloc.h" 20 | #include "simulate.h" 21 | #include "interpret.h" 22 | #include "rc.h" 23 | #include "main.h" 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /swap.h: -------------------------------------------------------------------------------- 1 | #ifndef SWAP_H 2 | #define SWAP_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * swap.c 8 | */ 9 | int swap PROT((object_t *)); 10 | int swap_line_numbers PROT((program_t *)); 11 | void load_ob_from_swap PROT((object_t *)); 12 | void load_line_numbers PROT((program_t *)); 13 | void remove_swap_file PROT((object_t *)); 14 | void unlink_swap_file PROT((void)); 15 | void remove_line_swap PROT((program_t *)); 16 | int locate_in PROT((program_t *)); 17 | int locate_out PROT((program_t *)); 18 | void print_swap_stats PROT((outbuffer_t *)); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/remove_call_out.c: -------------------------------------------------------------------------------- 1 | int called; 2 | 3 | void first_call() { 4 | called = 1; 5 | } 6 | 7 | void third_call() { 8 | ASSERT(!called); 9 | } 10 | 11 | void second_call() { 12 | ASSERT(!called); 13 | call_out( (: first_call :), 0); 14 | remove_call_out(); 15 | call_out( (: third_call :), 1); 16 | } 17 | 18 | void do_tests() { 19 | called = 0; 20 | call_out( "first_call", 0); 21 | call_out( "second_call", 1); 22 | ASSERT(remove_call_out("first_call") != -1); 23 | ASSERT(remove_call_out("foo") == -1); 24 | } 25 | -------------------------------------------------------------------------------- /port.h: -------------------------------------------------------------------------------- 1 | #ifndef PORT_H 2 | #define PORT_H 3 | 4 | /* 5 | * port.c 6 | */ 7 | #ifndef _FUNC_SPEC_ 8 | int random_number PROT((int)); 9 | int get_current_time PROT((void)); 10 | char *time_string PROT((time_t)); 11 | void init_usec_clock PROT((void)); 12 | void get_usec_clock PROT((long *, long *)); 13 | int get_cpu_times PROT((unsigned long *, unsigned long *)); 14 | char *get_current_dir PROT((char *, int)); 15 | #ifdef DRAND48 16 | double drand48 PROT((void)); 17 | #endif 18 | #ifndef HAS_STRERROR 19 | char *port_strerror PROT((int)); 20 | #endif 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/inherits.c: -------------------------------------------------------------------------------- 1 | #define OB2 "/single/tests/efuns/inh2.c" 2 | #define OB1 "/single/tests/efuns/inh1.c" 3 | #define OB0 "/single/tests/efuns/inh0.c" 4 | 5 | void do_tests() { 6 | object ob2 = load_object(OB2); 7 | object ob1 = load_object(OB1); 8 | object ob = load_object(OB0); 9 | 10 | ASSERT(inherits(OB1, ob2)); 11 | ASSERT(inherits(OB0, ob2)); 12 | ASSERT(inherits(OB0, ob1)); 13 | 14 | ASSERT(!inherits(OB2, ob1)); 15 | ASSERT(!inherits(OB2, ob)); 16 | ASSERT(!inherits(OB1, ob)); 17 | ASSERT(!inherits("foo", ob)); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_living_name.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object tp; 3 | #ifndef __NO_ADD_ACTION__ 4 | SAVETP; 5 | enable_commands(); 6 | RESTORETP; 7 | ASSERT(!find_living("foo")); 8 | set_living_name("foo"); 9 | ASSERT(find_living("foo") == this_object()); 10 | disable_commands(); 11 | ASSERT(!find_living("foo")); 12 | enable_commands(); 13 | RESTORETP; 14 | set_living_name("bar"); 15 | ASSERT(!find_living("foo")); 16 | ASSERT(find_living("bar") == this_object()); 17 | destruct(this_object()); 18 | #endif 19 | } 20 | -------------------------------------------------------------------------------- /include/origin.h: -------------------------------------------------------------------------------- 1 | /* codes returned by the origin() efun */ 2 | 3 | #define ORIGIN_BACKEND "driver" /* backwards compat */ 4 | #define ORIGIN_DRIVER "driver" 5 | #define ORIGIN_LOCAL "local" 6 | #define ORIGIN_CALL_OTHER "call_other" 7 | #define ORIGIN_SIMUL_EFUN "simul" 8 | #define ORIGIN_INTERNAL "internal" 9 | #define ORIGIN_EFUN "efun" 10 | /* pseudo frames for call_other function pointers and efun pointer */ 11 | #define ORIGIN_FUNCTION_POINTER "function_pointer" 12 | /* anonymous functions */ 13 | #define ORIGIN_FUNCTIONAL "functional" 14 | -------------------------------------------------------------------------------- /Win32/ar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define MAX_LEN 1024 6 | 7 | int main(int argc, char *argv[]) { 8 | char command[MAX_LEN]; 9 | int i; 10 | 11 | if (strcmp(argv[1], "rcu")) 12 | return -1; 13 | if (!strstr(argv[2], ".lib")) 14 | return -1; 15 | strcpy(command, "lib "); 16 | for (i = 3; i < argc; i++) { 17 | if (!strstr(argv[i], ".obj")) 18 | return -1; 19 | strcat(command, argv[i]); 20 | strcat(command, " "); 21 | } 22 | strcat(command, "/OUT:"); 23 | strcat(command, argv[2]); 24 | system(command); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/deep_inventory.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ENVIRONMENT__ 3 | object ob; 4 | 5 | foreach (ob in deep_inventory(this_object())) 6 | if (ob) 7 | destruct(ob); 8 | new(__FILE__, this_object()); 9 | new(__FILE__, this_object(), 1); 10 | ASSERT(sizeof(deep_inventory(this_object())) == 4); 11 | #endif 12 | } 13 | 14 | void create(object ob, int flag) { 15 | #ifndef __NO_ENVIRONMENT__ 16 | if (ob) move_object(ob); 17 | if (flag) { 18 | new(__FILE__, this_object()); 19 | new(__FILE__, this_object()); 20 | } 21 | #endif 22 | } 23 | -------------------------------------------------------------------------------- /binaries.h: -------------------------------------------------------------------------------- 1 | #ifndef BINARIES_H 2 | #define BINARIES_H 3 | 4 | /* lpc_object_t */ 5 | #include "object.h" 6 | 7 | #include "compiler.h" 8 | 9 | extern char driver_name[]; 10 | 11 | FILE *crdir_fopen PROT((char *)); 12 | void init_binaries PROT((int, char **)); 13 | #ifdef LPC_TO_C 14 | #define load_binary(x, y) int_load_binary(x, y) 15 | program_t *int_load_binary PROT((char *, lpc_object_t *)); 16 | #else 17 | #define load_binary(x, y) int_load_binary(x) 18 | program_t *int_load_binary PROT((char *)); 19 | #endif 20 | void save_binary PROT((program_t *, mem_block_t *, mem_block_t *)); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /testsuite/single/tests/operators/range.c: -------------------------------------------------------------------------------- 1 | #define ARR ({ 1, 2, 3 }) 2 | 3 | void do_tests() { 4 | mixed arr = ({ 1, 2, 3 }); 5 | #ifndef __OLD_RANGE_BEHAVIOR__ 6 | ASSERT(arr[0..-1] == ({})); 7 | ASSERT(ARR[0..-1] == ({})); 8 | ASSERT(same(arr[0..<1], ({1, 2, 3}))); 9 | ASSERT(same(ARR[0..<1], ({1, 2, 3}))); 10 | ASSERT(same(arr[1..<1], ({2, 3}))); 11 | ASSERT(same(ARR[1..<1], ({2, 3}))); 12 | ASSERT(same(arr[0..<2], ({1, 2}))); 13 | ASSERT(same(ARR[0..<2], ({1, 2}))); 14 | ASSERT(same(arr[1..1], ({ 2 }))); 15 | ASSERT(same(ARR[1..1], ({ 2 }))); 16 | #endif 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/function_exists.c: -------------------------------------------------------------------------------- 1 | #ifndef __SENSIBLE_MODIFIERS__ 2 | static 3 | #else 4 | protected 5 | #endif 6 | int stat() { 7 | } 8 | 9 | private int priv() { 10 | } 11 | 12 | void do_tests() { 13 | ASSERT(function_exists("stat", this_object(), 1)); 14 | ASSERT(function_exists("priv", this_object(), 1)); 15 | 16 | ASSERT(!function_exists("stat", this_object())); 17 | ASSERT(!function_exists("priv", this_object())); 18 | 19 | ASSERT(!function_exists("bar", this_object())); 20 | ASSERT(function_exists("do_tests", this_object()) + ".c" == __FILE__); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mudos 2 | ===== 3 | Mar 04 2015: 4 | ``` 5 | add redis support in packages/rd.c 6 | ``` 7 | 8 | Jul 14 2012: 9 | ``` 10 | add mongodb support in packages/mg.c , mongoc-v0.8.1 11 | ``` 12 | 13 | Jul 07 2012: 14 | ``` 15 | change lpc int to long suport 64bit 16 | ``` 17 | 18 | begin of 2011: 19 | ``` 20 | add epoll socket handle to replace select 21 | can compile on 64bit ubuntu 22 | ``` 23 | 24 | Sometime in 2010: 25 | ``` 26 | start compile MudOS v22.2b14 on ubuntu 27 | add efun md5() luan() etc in packages/moon.c 28 | remove command row out put '>' 29 | remove addr_server socket link 30 | ``` -------------------------------------------------------------------------------- /ccode.h: -------------------------------------------------------------------------------- 1 | #ifndef CCODE_H 2 | #define CCODE_H 3 | 4 | /* parse_node_t */ 5 | #include "trees.h" 6 | 7 | #include "program.h" 8 | 9 | void c_start_function PROT((char *)); 10 | void c_end_function PROT((void)); 11 | 12 | void c_generate_inherited_call PROT((int, short)); 13 | void c_generate_final_program PROT((int)); 14 | void c_generate___INIT PROT((void)); 15 | void c_initialize_parser PROT((void)); 16 | void c_uninitialize_parser PROT((void)); 17 | void c_generate_node PROT((parse_node_t *)); 18 | void c_analyze PROT((parse_node_t *)); 19 | void c_generate_inherited_init_call PROT((int, short)); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /efuns_main.h: -------------------------------------------------------------------------------- 1 | #ifndef EFUNS_MAIN_H 2 | #define EFUNS_MAIN_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* These really should be moved somewhere else */ 7 | /* 8 | * efuns_main.c 9 | */ 10 | extern int call_origin; 11 | 12 | int inherits PROT((program_t *, program_t *)); 13 | void add_mapping_pair PROT((mapping_t *, char *, int)); 14 | void add_mapping_string PROT((mapping_t *, char *, char *)); 15 | void add_mapping_object PROT((mapping_t *, char *, object_t *)); 16 | void add_mapping_array PROT((mapping_t *, char *, array_t *)); 17 | void add_mapping_shared_string PROT((mapping_t *, char *, char *)); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/implode.c: -------------------------------------------------------------------------------- 1 | 2 | void do_tests() { 3 | ASSERT(implode( ({ 1, 2, 3 }), "foo") == ""); 4 | ASSERT(implode( ({ "foo", "bar" }), "bazz") == "foobazzbar"); 5 | ASSERT(implode( ({ 1, "foo", "bar" }), "bazz") == "foobazzbar"); 6 | ASSERT(implode( ({ "foo", "bar" }), "") == "foobar"); 7 | 8 | ASSERT(implode( ({ 1, 2, 3 }), (: $1 + $2 :)) == 6); 9 | ASSERT(implode( ({ 1, 2, 3 }), (: $1 + $2 :), "") == "123"); 10 | ASSERT(implode( ({}), (: $1 :), 666) == 666); 11 | ASSERT(implode( ({}), (: $1 :)) == 0); 12 | ASSERT(implode( ({ 555 }), (: $1 + 5 :)) == 555); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/find_object.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | object ob; 3 | 4 | ASSERT(find_object(__FILE__) == this_object()); 5 | ob = find_object("/single/tests/efuns/unloaded"); 6 | if (ob) 7 | destruct(ob); 8 | ASSERT(!find_object("/single/tests/efuns/unloaded")); 9 | ASSERT(ob = find_object("/single/tests/efuns/unloaded", 1)); 10 | ASSERT(file_name(ob) == "/single/tests/efuns/unloaded"); 11 | destruct(ob); 12 | ASSERT(ob = load_object("/single/tests/efuns/unloaded", 1)); 13 | ASSERT(file_name(ob) == "/single/tests/efuns/unloaded"); 14 | ASSERT(!load_object("/foo")); 15 | } 16 | -------------------------------------------------------------------------------- /Copyright: -------------------------------------------------------------------------------- 1 | This game, LPmud, is copyright by Lars Pensj|, 1990, 1991. 2 | 3 | Source code herein refers to the source code, and any executables 4 | created from the same source code. 5 | 6 | All rights reserved. Permission is granted to extend and modify the 7 | source code provided subject to the restriction that the source code may 8 | not be used in any way whatsoever for monetary gain. 9 | 10 | ****** 11 | 12 | The name MudOS is copyright 1991-1992 by Erik Kay, Adam Beeman, Stephan Iannce 13 | and John Garnett. LPmud copyright restrictions still apply. 14 | 15 | In addition, the entire package is copyright 1995 by Tim Hollebeek. 16 | 17 | -------------------------------------------------------------------------------- /debugmalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef DEBUGMALLOC_H 2 | # define DEBUGMALLOC_H 3 | # ifdef DEBUGMALLOC 4 | void *debugmalloc PROT((int, int, char *)); 5 | void *debugrealloc PROT((void *, int, int, char *)); 6 | void *debugcalloc PROT((int, int, int, char *)); 7 | void debugfree PROT((void *)); 8 | 9 | void debugmalloc_init PROT((void)); 10 | void dump_malloc_data PROT((outbuffer_t *)); 11 | 12 | # ifdef DEBUGMALLOC_EXTENSIONS 13 | void set_malloc_mask PROT((int)); 14 | char *dump_debugmalloc PROT((char *, int)); 15 | # endif 16 | # else 17 | /* not DEBUGMALLOC */ 18 | # undef DEBUGMALLOC_EXTENSIONS 19 | # undef CHECK_MEMORY 20 | # endif 21 | #endif 22 | -------------------------------------------------------------------------------- /testsuite/include/tests.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_H 2 | #define TESTS_H 3 | 4 | #define ASSERT(x) if (!(x)) { error(file_name() + ": Check failed.\n"); } 5 | #define ASSERT2(x, r) if (!(x)) { error(file_name() + ":" + r + ", Check failed.\n"); } 6 | 7 | #define SAVETP tp = this_player() 8 | #define RESTORETP { if (tp) evaluate(bind( (: enable_commands :), tp)); else { object youd_never_use_this_as_a_var = new("/single/void"); evaluate(bind( (: enable_commands :), youd_never_use_this_as_a_var)); destruct(youd_never_use_this_as_a_var); } } 9 | 10 | #ifdef __OLD_TYPE_BEHAVIOR__ 11 | #define TYPETEST scream and die 12 | #else 13 | #define TYPETEST 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Artistic.README: -------------------------------------------------------------------------------- 1 | The file "Artistic" is included because a small part of the driver source 2 | is derived from Larry Wall's Perl package (namely the hashing code 3 | used in the mappings implementation). Previously, we used the GNU Copyleft 4 | because the "Artistic" option wasn't then available. Since the "Artistic" 5 | license is more similar to Lars Pensk|'s original Copyright than is the GNU 6 | Copyleft, we have chosen to use Artistic instead of the Copyleft (as 7 | is allowed by the terms Larry Wall sets forth in the Perl 4.036 README). 8 | Where there is any conflict between Lars' copyright and the Artistic license, 9 | Lars' copyright should take precedence. 10 | -------------------------------------------------------------------------------- /avltree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * avltree.h 3 | * 4 | * Written by Paul Vixie 5 | */ 6 | 7 | #ifndef _AVLTREE_H_ 8 | #define _AVLTREE_H_ 9 | 10 | typedef struct tree_s { 11 | struct tree_s *tree_l, *tree_r; /* left & right branches */ 12 | char *tree_p; /* data */ 13 | short tree_b; /* balance information */ 14 | } tree; 15 | 16 | void tree_init PROT((tree **)); 17 | char *tree_srch PROT((tree *, int (*) (), char *)); 18 | void tree_add PROT((tree **, int (*) (), char *, int (*) ())); 19 | int tree_delete PROT((tree **, int (*) (), char *, int (*) ())); 20 | int tree_trav PROT((tree **, int (*) ())); 21 | void tree_mung PROT((tree **, int (*) ())); 22 | 23 | #endif /* _AVLTREE_H_ */ 24 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/all_inventory.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | #ifndef __NO_ENVIRONMENT__ 3 | int s = sizeof(all_inventory(this_object())); 4 | 5 | ASSERT(sizeof(all_inventory()) == s); 6 | 7 | for (int i = 0; i < 5; i++) { 8 | ASSERT(sizeof(all_inventory()) == s + i); 9 | clone_object(file_name()); 10 | } 11 | ASSERT(filter(all_inventory(this_object()), (: !$1->is_all_inv_test() :))); 12 | #endif 13 | } 14 | 15 | int is_all_inv_test() { 16 | return 1; 17 | } 18 | 19 | void 20 | create() { 21 | #ifndef __NO_ENVIRONMENT__ 22 | if (clonep()) { 23 | string s = file_name(); 24 | sscanf(s, "%s#%*d", s); 25 | move_object(s); 26 | } 27 | #endif 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /testsuite/command/codefor.c: -------------------------------------------------------------------------------- 1 | int 2 | main(string a) 3 | { 4 | object ret; 5 | mixed code; 6 | 7 | if (file_size("/tmp_eval_file.c") != -1) 8 | rm ("/tmp_eval_file.c"); 9 | if (find_object("/tmp_eval_file")) 10 | destruct(find_object("/tmp_eval_file")); 11 | 12 | write_file("/tmp_eval_file.c", "mixed eval() { " + a + "; }\n"); 13 | 14 | ret = load_object("/tmp_eval_file"); 15 | 16 | dump_prog(ret, 1, "/CODE_TMP_FILE"); 17 | code = read_file( "/CODE_TMP_FILE"); 18 | rm("/CODE_TMP_FILE"); 19 | rm("/tmp_eval_file.c"); 20 | 21 | code = explode(code, ";;; *** Disassembly ***\n"); 22 | code = code[1]; 23 | write(code[0..strlen(code)-1]); 24 | return 1; 25 | } 26 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/call_stack.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mixed stack, entry; 3 | int n = sizeof(call_stack(0)); 4 | 5 | stack = call_stack(0); 6 | ASSERT(stack[0] == __FILE__); 7 | ASSERT(sizeof(filter(stack, (: stringp :))) == n); 8 | stack = call_stack(1); 9 | ASSERT(stack[0] == this_object()); 10 | ASSERT(sizeof(filter(stack, (: objectp :))) == n); 11 | stack = call_stack(2); 12 | ASSERT(stack[0] == "do_tests"); 13 | ASSERT(sizeof(filter(stack, (: stringp :))) == n); 14 | stack = call_stack(3); 15 | ASSERT(sizeof(filter(stack, (: stringp :))) == n); 16 | ASSERT(catch(call_stack(-100))); 17 | ASSERT(catch(call_stack(4))); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /compat/simuls/break_string.c: -------------------------------------------------------------------------------- 1 | void break_string(string str, int width, mixed indent) { 2 | int indlen; 3 | 4 | if (!stringp(str)) return 0; 5 | if (intp(indent)) { 6 | if (ident < 0) indent = 0; 7 | indlen = indent; 8 | indent = sprintf("%-*' 's", indlen, ""); 9 | } else if (stringp(indent)) { 10 | indlen = strlen(ident); 11 | } else return str; 12 | 13 | if (width < indlen + 1) width = indlen + 1; 14 | str = sprintf("%*-=s", width - indlen, str); 15 | if (!indlen) return str; 16 | 17 | if (str[<1] == '\n') 18 | return indent + replace_string(str[0..<2], "\n", "\n" + indent) + "\n"; 19 | else 20 | return indent + replace_string(str, "\n", "\n" + indent); 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/command.c: -------------------------------------------------------------------------------- 1 | int flag; 2 | 3 | int action() { 4 | flag = 1; 5 | return 1; 6 | } 7 | 8 | void do_tests() { 9 | #ifndef __NO_ADD_ACTION__ 10 | object save_tp = this_player(); 11 | mixed *comms; 12 | 13 | flag = 0; 14 | enable_commands(); 15 | add_action( (: action :), "foo"); 16 | comms = commands(); 17 | disable_commands(); 18 | if (save_tp) 19 | evaluate(bind( (: enable_commands :), save_tp)); 20 | 21 | ASSERT(command("foo")); 22 | ASSERT(sizeof(comms) == 1); 23 | ASSERT(comms[0][0] == "foo"); 24 | ASSERT(comms[0][2] == this_object()); 25 | ASSERT(comms[0][3] == ""); 26 | ASSERT(flag); 27 | destruct(this_object()); 28 | #endif 29 | } 30 | -------------------------------------------------------------------------------- /amiga/touch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * touch.c: 3 | * touch file's timestamp, setting it to the current system time 4 | * 5 | * Requires OS 2.04 (v37) or better 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | int main(int argc, char *argv[]) { 17 | if (argc > 1) { 18 | extern struct Library *DOSBase; 19 | struct DateStamp ds; 20 | 21 | if (DOSBase->lib_Version >= 37) { 22 | while (--argc) { 23 | DateStamp((struct DateStamp *)&ds); 24 | SetFileDate(argv[argc], (struct DateStamp *)&ds); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/uids.h: -------------------------------------------------------------------------------- 1 | /* 2 | * uid.h 3 | * Created by: Erik Kay 4 | * Description: new uid / euid data structures and security 5 | * Modification: 6 | * 11-1-92 - Erik Kay - initial creation 7 | * 94.07.09 - Robocoder - modified to use AVL tree 8 | */ 9 | 10 | #if !defined(_UID_H_) && defined(PACKAGE_UIDS) 11 | #define _UID_H_ 12 | 13 | #include "../std.h" 14 | 15 | typedef struct _uid { 16 | char *name; 17 | } userid_t; 18 | 19 | extern userid_t *backbone_uid; 20 | extern userid_t *root_uid; 21 | 22 | userid_t *add_uid PROT((char *name)); 23 | userid_t *set_root_uid PROT((char *name)); 24 | userid_t *set_backbone_uid PROT((char *name)); 25 | #ifdef DEBUGMALLOC_EXTENSIONS 26 | void mark_all_uid_nodes PROT((void)); 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /testsuite/command/dest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(string arg) 5 | { 6 | object obj; 7 | 8 | if (!arg) { 9 | #ifndef __NO_ADD_ACTION__ 10 | return notify_fail("usage: dest object\n"); 11 | #else 12 | write("usage: dest object\n"); 13 | return 1; 14 | #endif 15 | } 16 | obj = find_object(arg); 17 | #ifndef __NO_ENVIRONMENT__ 18 | if (!obj) { 19 | obj = present(arg); 20 | if (!obj) { 21 | obj = present(arg, environment(previous_object())); 22 | } 23 | } 24 | #endif 25 | if (!obj) { 26 | #ifndef __NO_ADD_ACTION__ 27 | return notify_fail("can't find that.\n"); 28 | #else 29 | write("can't find that.\n"); 30 | return 1; 31 | #endif 32 | } 33 | obj->remove(); 34 | if (obj) { 35 | destruct(obj); 36 | } 37 | return 1; 38 | } 39 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Complete installation instructions are available in major releases 2 | (as opposed to minor releases). The major releases also contain 3 | documentation, etc. 4 | 5 | Short instructions: 6 | 7 | 1) edit options.h to suit your tastes 8 | 2) type: ./build.MudOS 9 | 3) follow the instructions printed on the screen 10 | 4) you will need a runtime config file and a mudlib in order to use the driver. 11 | 5) look at the example config file in this directory (Config.example) 12 | 6) get a MudOS-compatible mudlib. Note that many mudlibs require certain 13 | setting in options.h, so the documentation of the mudlib should be 14 | consulted. Also, note that many mudlibs come prepackaged with a 15 | version of MudOS they are known to work well with. 16 | 7) have fun. 17 | -------------------------------------------------------------------------------- /testsuite/clone/login.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // needs fixed to handle passwords 4 | 5 | #ifdef __INTERACTIVE_CATCH_TELL__ 6 | void catch_tell(string str) { 7 | receive(str); 8 | } 9 | #endif 10 | 11 | void 12 | logon() 13 | { 14 | object user; 15 | 16 | #ifdef __NO_ADD_ACTION__ 17 | set_this_player(this_object()); 18 | #endif 19 | write("Welcome to Lil!\n\n"); 20 | cat("/etc/motd"); 21 | write("\n> "); 22 | #ifdef __PACKAGE_UIDS__ 23 | seteuid(getuid(this_object())); 24 | #endif 25 | user= new("/clone/user"); 26 | user->set_name("stuf" + getoid(user)); 27 | exec(user, this_object()); 28 | user->setup(); 29 | #ifndef __NO_ENVIRONMENT__ 30 | user->move(VOID_OB); 31 | #endif 32 | destruct(this_object()); 33 | } 34 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_light.c: -------------------------------------------------------------------------------- 1 | int light = 0; 2 | 3 | #define CHK ASSERT(light = set_light(0)); 4 | 5 | #ifndef __NO_ENVIRONMENT__ 6 | void move_or_destruct(object ob) { 7 | move_object(new("/single/void")); 8 | } 9 | #endif 10 | 11 | void do_tests() { 12 | object ob; 13 | 14 | #ifndef __NO_LIGHT__ 15 | CHK; 16 | set_light(2); 17 | light += 2; 18 | CHK; 19 | 20 | #ifndef __NO_ENVIRONMENT__ 21 | ob = new(__DIR__ "light"); 22 | ob->move(this_object()); 23 | light += 3; 24 | CHK; 25 | 26 | destruct(ob); 27 | light -= 3; 28 | CHK; 29 | 30 | ob = new(__DIR__ "light"); 31 | move_object(ob); 32 | light += 3; 33 | CHK; 34 | 35 | destruct(ob); 36 | light -= 3; 37 | CHK; 38 | #endif 39 | #endif 40 | } 41 | -------------------------------------------------------------------------------- /crc32.c: -------------------------------------------------------------------------------- 1 | #include "std.h" 2 | #include "crc32.h" 3 | #define NEED_CRC_TABLE 4 | #include "crctab.h" /* see this file for more CRC credits and 5 | * comments */ 6 | 7 | /* compute_crc32: compute a cyclic redundancy code for a buffer 'buf' of a 8 | given length 'len'. This trivial little routine was written by 9 | John Garnett. All of the code in crctab.h (the hard stuff) was written 10 | by others. See the comments in the file (crctab.h) for the credits. 11 | */ 12 | 13 | UINT32 14 | compute_crc32 P2(unsigned char *, buf, int, len) 15 | { 16 | register UINT32 crc = 0xFFFFFFFFL; 17 | register int j; 18 | 19 | j = len; 20 | while (j--) { 21 | /* the UPDC32 macro uses 1st arg only once */ 22 | crc = UPDC32((unsigned int) *buf++, crc); 23 | } 24 | return crc; 25 | } 26 | -------------------------------------------------------------------------------- /make_func.h: -------------------------------------------------------------------------------- 1 | #ifndef MAKE_FUNC_H 2 | #define MAKE_FUNC_H 3 | 4 | #define MAX_FUNC 2048 /* If we need more than this we're in trouble! */ 5 | 6 | #define VOID 1 7 | #define INT 2 8 | #define STRING 3 9 | #define OBJECT 4 10 | #define MAPPING 5 11 | #define MIXED 6 12 | #define UNKNOWN 7 13 | #define FLOAT 8 14 | #define FUNCTION 9 15 | #define BUFFER 10 16 | 17 | extern int num_buff; 18 | extern int op_code, efun_code, efun1_code; 19 | extern char *oper_codes[MAX_FUNC]; 20 | extern char *efun_codes[MAX_FUNC], *efun1_codes[MAX_FUNC]; 21 | extern char *efun_names[MAX_FUNC], *efun1_names[MAX_FUNC]; 22 | extern char *key[MAX_FUNC], *buf[MAX_FUNC]; 23 | 24 | extern int arg_types[400], last_current_type; 25 | 26 | char *ctype PROT((int)); 27 | char *etype PROT((int)); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /std.h: -------------------------------------------------------------------------------- 1 | #ifndef STD_H 2 | #define STD_H 3 | 4 | /* This stuff should be included EVERYWHERE */ 5 | 6 | /* the definition of ARCH */ 7 | #include "arch.h" 8 | 9 | #ifdef EDIT_SOURCE 10 | #define CONST 11 | #define INLINE 12 | #else 13 | /* all options and configuration */ 14 | #include "options_incl.h" 15 | #include "configure.h" 16 | 17 | # ifdef PEDANTIC 18 | # undef INLINE 19 | # define INLINE 20 | # endif 21 | #endif 22 | 23 | #include "portability.h" 24 | #include "macros.h" 25 | #ifndef _FUNC_SPEC_ 26 | # include "std_incl.h" 27 | # include "malloc_incl.h" 28 | # ifndef NO_OPCODES 29 | # include "opcodes.h" 30 | # endif 31 | #endif 32 | #include "debug.h" 33 | 34 | #ifdef WIN32 35 | # define outp outptr 36 | #endif 37 | 38 | #endif 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/call_other.c: -------------------------------------------------------------------------------- 1 | int foo() { return 1; } 2 | 3 | int same(mixed *x, mixed *y) { 4 | for (int i = 0; i < sizeof(x); i++) { 5 | return x[i] == y[i]; 6 | } 7 | } 8 | 9 | int bar(int x) { 10 | return x; 11 | } 12 | 13 | void do_tests() { 14 | ASSERT(file_name()->foo()); 15 | ASSERT(this_object()->foo()); 16 | ASSERT(same((mixed *)({ file_name(), this_object() })->foo(), ({ 1, 1 }))); 17 | 18 | ASSERT(catch(call_other(this_object(), 0))); 19 | ASSERT(call_other(this_object(), "foo")); 20 | ASSERT(call_other(this_object(), ({ "foo", 1 }))); 21 | ASSERT(catch(call_other("foadf", "foo"))); 22 | 23 | ASSERT(undefinedp(this_object()->bazz())); 24 | destruct(this_object()); 25 | ASSERT(undefinedp("/single/master"->valid_bind())); 26 | } 27 | -------------------------------------------------------------------------------- /compat/Debug/mudlib/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../mudlib/interface.c 8 | 9 | OBJS += \ 10 | ./mudlib/interface.o 11 | 12 | C_DEPS += \ 13 | ./mudlib/interface.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | mudlib/%.o: ../mudlib/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C Compiler' 20 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/reg_assoc.c: -------------------------------------------------------------------------------- 1 | int same_array(mixed *x, mixed *y) { 2 | if (!arrayp(x) || !arrayp(y)) return 0; 3 | if (sizeof(x) != sizeof(y)) return 0; 4 | for (int i = 0; i < sizeof(x); i++) { 5 | if (arrayp(x[i])) { 6 | if (!same_array(x[i], y[i])) 7 | return 0; 8 | } else if (x[i] != y[i]) 9 | return 0; 10 | } 11 | return 1; 12 | } 13 | 14 | void do_tests() { 15 | ASSERT(same_array( 16 | reg_assoc("testhahatest", ({ "haha", "te" }), ({ 2, 3 }), 4), 17 | ({ ({ "", "te", "st", "haha", "", "te", "st" }), 18 | ({ 4, 3, 4, 2, 4, 3, 4 }) }))); 19 | ASSERT(catch(reg_assoc("foo", ({ 1 }), ({ 2, 3 })))); 20 | ASSERT(catch(reg_assoc("foo", ({ 1, 2 }), ({ 2, 3 })))); 21 | ASSERT(catch(reg_assoc("foo", ({ "bar", "+" }), ({ 0, 1 })))); 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/capitalize.c: -------------------------------------------------------------------------------- 1 | /* 2 | efun: string capitalize(string); 3 | test author: John Garnett 4 | date: 1993 November 2 5 | */ 6 | 7 | void do_tests() 8 | { 9 | string str1, str2, str3; 10 | 11 | str1 = ""; 12 | str2 = capitalize(str1); 13 | str3 = ""; 14 | ASSERT(str2 == str3); 15 | 16 | str1 = "driver"; 17 | str2 = capitalize(str1); 18 | str3 = "Driver"; 19 | ASSERT(str2 == str3); 20 | ASSERT(str1 == "driver"); 21 | 22 | str1 = "Driver"; 23 | str2 = capitalize(str1); 24 | str3 = "Driver"; 25 | ASSERT(str2 == str3); 26 | ASSERT(str1 == "Driver"); 27 | 28 | str1 = "42driver"; 29 | str2 = capitalize(str1); 30 | str3 = "42driver"; 31 | ASSERT(str2 == str3); 32 | ASSERT(str1 == "42driver"); 33 | } 34 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/read_bytes.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | string foo = read_file("/testfile"); 3 | 4 | ASSERT(!read_bytes("/does_not_exist")); 5 | ASSERT(!read_bytes("/does_not_exist", 1)); 6 | ASSERT(!read_bytes("/does_not_exist", 1, 2)); 7 | 8 | ASSERT(!read_bytes("/testfile", -100000, 10)); 9 | ASSERT(read_bytes("/testfile", -10, 5) == foo[<10..<6]); 10 | ASSERT(read_bytes("/testfile", -10, 0) == foo[<10..]); 11 | ASSERT(read_bytes("/testfile", -10) == foo[<10..]); 12 | ASSERT(read_bytes("/testfile", -10, 100) == foo[<10..]); 13 | ASSERT(read_bytes("/testfile") == foo); 14 | ASSERT(!read_bytes("/testfile", 1000000, 10)); 15 | ASSERT(read_bytes("/testfile", 100, 100) == foo[100..199]); 16 | ASSERT(strlen(read_bytes("/testfile", 100, 100)) == 100); 17 | } 18 | -------------------------------------------------------------------------------- /compat/Debug/compat/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../compat/parser_error.c 8 | 9 | OBJS += \ 10 | ./compat/parser_error.o 11 | 12 | C_DEPS += \ 13 | ./compat/parser_error.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | compat/%.o: ../compat/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C Compiler' 20 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/mg_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | mixed mg_connect(string|void,int|void,string|void,string|void,string|void); 4 | mixed mg_run_command(int,string,mapping); 5 | mixed mg_aggregate(int,string,string,mapping*); 6 | mixed mg_find_one(int,string,mapping|void,mapping|void); 7 | mixed mg_find(int,string,mapping|void,mapping|void,int|void,int|void,int|void); 8 | mixed mg_insert(int,string,mapping); 9 | mixed mg_update(int,string,mapping,mapping,int|void); 10 | mixed mg_remove(int,string,mapping); 11 | mixed mg_count (int,string,string,mapping|void); 12 | mixed mg_reconnect (int); 13 | mixed mg_check_connection (int); 14 | mixed mg_close (int); 15 | 16 | string mg_get_oid(void); 17 | mixed buf_bson_map(buffer); 18 | mixed map_bson_buf(mapping); 19 | mixed bson_buf_find(buffer,string); 20 | mixed cmd_map_bson_buf(string,mapping); 21 | -------------------------------------------------------------------------------- /call_out.h: -------------------------------------------------------------------------------- 1 | #ifndef CALL_OUT_H 2 | #define CALL_OUT_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * call_out.c 8 | */ 9 | void call_out PROT((void)); 10 | void reclaim_call_outs PROT((void)); 11 | #ifdef CALLOUT_HANDLES 12 | int find_call_out_by_handle PROT((int)); 13 | int remove_call_out_by_handle PROT((int)); 14 | int new_call_out PROT((object_t *, svalue_t *, int, int, svalue_t *)); 15 | #else 16 | void new_call_out PROT((object_t *, svalue_t *, int, int, svalue_t *)); 17 | #endif 18 | int remove_call_out PROT((object_t *, char *)); 19 | void remove_all_call_out PROT((object_t *)); 20 | int find_call_out PROT((object_t *, char *)); 21 | array_t *get_all_call_outs PROT((void)); 22 | int print_call_out_usage PROT((outbuffer_t *, int)); 23 | void mark_call_outs PROT((void)); 24 | void reclaim_call_outs PROT((void)); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/test_control.c 8 | 9 | OBJS += \ 10 | ./testsuite/test_control.o 11 | 12 | C_DEPS += \ 13 | ./testsuite/test_control.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | testsuite/%.o: ../testsuite/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C Compiler' 20 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/set_heart_beat.c: -------------------------------------------------------------------------------- 1 | int x; 2 | 3 | void heart_beat() { 4 | x++; 5 | switch (x) { 6 | case 1: 7 | ASSERT(query_heart_beat(this_object()) == 1); 8 | set_heart_beat(2); 9 | ASSERT(query_heart_beat(this_object()) == 2); 10 | break; 11 | case 1: 12 | ASSERT(query_heart_beat(this_object()) == 2); 13 | set_heart_beat(-1); 14 | ASSERT(query_heart_beat(this_object()) == 2); 15 | break; 16 | case 2: 17 | ASSERT(query_heart_beat(this_object()) == 2); 18 | set_heart_beat(0); 19 | ASSERT(query_heart_beat(this_object()) == 0); 20 | break; 21 | default: 22 | ASSERT(0); 23 | } 24 | } 25 | 26 | void do_tests() { 27 | x = 0; 28 | set_heart_beat(0); 29 | ASSERT(!query_heart_beat(this_object())); 30 | set_heart_beat(1); 31 | ASSERT(query_heart_beat(this_object()) == 1); 32 | } 33 | -------------------------------------------------------------------------------- /compat/Debug/Win32/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../Win32/ar.c \ 8 | ../Win32/touch.c 9 | 10 | OBJS += \ 11 | ./Win32/ar.o \ 12 | ./Win32/touch.o 13 | 14 | C_DEPS += \ 15 | ./Win32/ar.d \ 16 | ./Win32/touch.d 17 | 18 | 19 | # Each subdirectory must supply rules for building sources it contributes 20 | Win32/%.o: ../Win32/%.c 21 | @echo 'Building file: $<' 22 | @echo 'Invoking: GCC C Compiler' 23 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 24 | @echo 'Finished building: $<' 25 | @echo ' ' 26 | 27 | 28 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/save_variable.c: -------------------------------------------------------------------------------- 1 | #define IS(x, y) ASSERT2(save_variable(x)==y, sprintf("%O %O", x, save_variable(x))) 2 | 3 | mapping values = 4 | ([ 5 | "\n" : "\"\r\"", 6 | "\"" : "\"\\\"\"", 7 | "\"x\\\n" : "\"\\\"x\\\\\r\"", 8 | -1 : "-1", 9 | 0 : "0", 10 | 1 : "1", 11 | 22 : "22", 12 | 1.2 : "1.200000", 13 | 333 : "333", 14 | ({}) : "({})", 15 | ({ 0 }) : "({0,})" 16 | ]); 17 | 18 | void do_tests() { 19 | mixed x, y; 20 | foreach (x, y in values) { 21 | IS(x, y); 22 | } 23 | 24 | // arrays 25 | foreach (x, y in values) { 26 | IS( ({ x }), "({" + y + ",})"); 27 | IS( ({ x, x }), "({" + y + "," + y + ",})"); 28 | } 29 | 30 | // mappings 31 | foreach (x, y in values) { 32 | IS( ([ 1 : x ]), "([1:" + y + ",])"); 33 | IS( ([ x : x ]), "([" + y + ":" + y + ",])"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /buffer.h: -------------------------------------------------------------------------------- 1 | /* buffer.h by John Garnett, 1993/11/07 */ 2 | 3 | /* It is usually better to include "lpc_incl.h" instead of including this 4 | directly */ 5 | 6 | #ifndef _BUFFER_H_ 7 | #define _BUFFER_H_ 8 | 9 | #ifndef NO_BUFFER_TYPE 10 | typedef struct buffer_s { 11 | /* first two elements of struct must be 'ref' followed by 'size' */ 12 | unsigned short ref; 13 | unsigned int size; 14 | #ifdef DEBUG 15 | unsigned short extra_ref; 16 | #endif 17 | unsigned char item[1]; 18 | } buffer_t; 19 | 20 | /* 21 | * buffer.c 22 | */ 23 | extern buffer_t null_buf; 24 | 25 | INLINE buffer_t *null_buffer PROT((void)); 26 | INLINE void free_buffer PROT((buffer_t *)); 27 | buffer_t *allocate_buffer PROT((int)); 28 | int write_buffer PROT((buffer_t *, int, char *, int)); 29 | char *read_buffer PROT((buffer_t *, int, int, int *)); 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /compat/Debug/sources.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | O_SRCS := 6 | C_SRCS := 7 | S_UPPER_SRCS := 8 | OBJ_SRCS := 9 | ASM_SRCS := 10 | OBJS := 11 | C_DEPS := 12 | EXECUTABLES := 13 | 14 | # Every subdirectory with source files must be described here 15 | SUBDIRS := \ 16 | . \ 17 | testsuite \ 18 | testsuite/single \ 19 | testsuite/single/tests/operators \ 20 | testsuite/single/tests/efuns \ 21 | testsuite/single/tests/compiler \ 22 | testsuite/single/tests/compiler/fail \ 23 | testsuite/inherit \ 24 | testsuite/inherit/master \ 25 | testsuite/command \ 26 | testsuite/clone \ 27 | packages \ 28 | mudlib \ 29 | compat/simuls \ 30 | compat \ 31 | amiga \ 32 | Win32 \ 33 | 34 | -------------------------------------------------------------------------------- /packages/develop_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | mixed debug_info(int, object); 4 | int refs(mixed); 5 | #ifdef DEBUG 6 | mixed *destructed_objects(); 7 | #endif 8 | 9 | /* dump_prog: disassembler... comment out this line if you don't want the 10 | disassembler compiled in. 11 | */ 12 | void dump_prog(object,...); 13 | 14 | #if defined(PROFILING) && defined(HAS_MONCONTROL) 15 | void moncontrol(int); 16 | #endif 17 | 18 | #if (defined(DEBUGMALLOC) && defined(DEBUGMALLOC_EXTENSIONS)) 19 | string debugmalloc(string, int); 20 | void set_malloc_mask(int); 21 | string check_memory(int default: 0); 22 | #endif 23 | 24 | #ifdef TRACE 25 | string traceprefix(string | int); 26 | int trace(int); 27 | #endif 28 | 29 | #if defined(NeXT) && defined(NEXT_MALLOC_DEBUG) 30 | int malloc_check(); 31 | int malloc_debug(int); 32 | #endif 33 | -------------------------------------------------------------------------------- /testsuite/include/globals.h: -------------------------------------------------------------------------------- 1 | // file: globals.h 2 | 3 | #ifdef __SENSIBLE_MODIFIERS__ 4 | #define staticf protected 5 | #define staticv nosave 6 | #else 7 | #define staticf static 8 | #define staticv static 9 | #endif 10 | 11 | #include "tests.h" 12 | 13 | #define SINGLE_DIR "/single" 14 | #define CONFIG_DIR "/etc" 15 | #define LOG_DIR "/log" 16 | 17 | #define VIRTUAL_D "/single/virtual" 18 | 19 | #define LOGIN_OB "/clone/login" 20 | #define USER_OB "/clone/user" 21 | #define VOID_OB "/single/void" 22 | 23 | #define ROOT_UID "Root" 24 | #define BACKBONE_UID "Backbone" 25 | 26 | #define BASE "/inherit/base" 27 | #define OVERRIDES_FILE "/single/simul_efun" 28 | 29 | #define COMMAND_PREFIX "/command/" 30 | 31 | // classes for message() efun. 32 | #define M_STATUS "status" 33 | #define M_SAY "say" 34 | 35 | #define CLEAN_UP "/inherit/clean_up" 36 | -------------------------------------------------------------------------------- /testsuite/inherit/base.c: -------------------------------------------------------------------------------- 1 | // set to 'private static' so that inheritor won't be able to directly 2 | // access this variable and so that save_object() won't save it to the .o file 3 | 4 | private staticv string *ids; 5 | 6 | void 7 | remove() 8 | { 9 | // add code here to prevent unwanted destructions. 10 | // update attributes of the container and the containees. 11 | destruct(this_object()); 12 | } 13 | 14 | #ifndef __NO_ENVIRONMENT__ 15 | int 16 | move(mixed dest) 17 | { 18 | // add code here to prevent disallowed moves (target is full, object 19 | // is immovable, etc.). 20 | move_object(dest); 21 | } 22 | #endif 23 | 24 | void 25 | set_ids(string *arg) 26 | { 27 | // probably want to add some security here. 28 | ids = arg; 29 | } 30 | 31 | int 32 | id(string arg) 33 | { 34 | if (!arg || !ids) { 35 | return 0; 36 | } 37 | return (member_array(arg, ids) != -1); 38 | } 39 | -------------------------------------------------------------------------------- /packages/matrix_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | /* 3 | * Matrix efuns for Jacques' 3d mud etc. 4 | */ 5 | float *id_matrix(); 6 | float *translate(float *, float, float, float); 7 | float *scale(float *, float, float, float); 8 | float *rotate_x(float *, float); 9 | float *rotate_y(float *, float); 10 | float *rotate_z(float *, float); 11 | float *lookat_rotate(float *, float, float, float); 12 | /* for this efun to work again, the compiler needs support for min_arg > 4. */ 13 | /* The problem is that type checking was changed to be done for all 14 | arguments, and a limit of 4 args was imposed. This can probably 15 | be fixed simply by forcing such efuns to check the additional ones, 16 | however this is the only efun affected so the fix is low priority. */ 17 | #if 0 18 | float *lookat_rotate2(float *, float, float, float, float, float, float); 19 | #endif 20 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/say.c: -------------------------------------------------------------------------------- 1 | #ifndef __NO_ENVIRONMENT__ 2 | string err = 0; 3 | string yes = 0; 4 | 5 | #define YES(x) ASSERT2((talker->send(x), yes == x), x); ASSERT2((talker->send("no:" + x, this_object()), !err), err); ASSERT2((talker->send("no:" + x, ({ this_object() })), !err), err) 6 | #define NO(x) ASSERT2((talker->send(x), !err), err) 7 | 8 | void catch_tell(string str) { 9 | if (str[0..2] != "yes") 10 | err = str; 11 | else 12 | yes = str; 13 | } 14 | 15 | void do_tests() { 16 | object tp; 17 | object talker = new(__DIR__ "talker"); 18 | 19 | #ifndef __NO_ADD_ACTION__ 20 | SAVETP; 21 | enable_commands(); 22 | RESTORETP; 23 | #endif 24 | NO("no-noenv"); 25 | talker->move(this_object()); 26 | 27 | YES("yes-inside"); 28 | talker->move(new("/single/void")); 29 | move_object(talker); 30 | YES("yes-outside"); 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/inherit/master/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/inherit/master/valid.c 8 | 9 | OBJS += \ 10 | ./testsuite/inherit/master/valid.o 11 | 12 | C_DEPS += \ 13 | ./testsuite/inherit/master/valid.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | testsuite/inherit/master/%.o: ../testsuite/inherit/master/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C Compiler' 20 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/shadow.c: -------------------------------------------------------------------------------- 1 | object prev; 2 | 3 | void create() { 4 | prev = previous_object(); 5 | } 6 | 7 | nomask void i_am_bad() { 8 | } 9 | 10 | void do_tests() { 11 | object ob; 12 | #ifndef __NO_SHADOWS__ 13 | ASSERT(catch(shadow(this_object()))); 14 | ASSERT(catch(shadow(master()))); 15 | new(__DIR__ "badshad", 1); 16 | 17 | ASSERT(shadow(this_object(), 0) == 0); 18 | ASSERT((object)this_object()->foo() == this_object()); 19 | 20 | ob = new(__DIR__ "goodshad", 1); 21 | ASSERT(shadow(this_object(), 0) == ob); 22 | ASSERT((object)this_object()->foo() == ob); 23 | ASSERT((object)new(__FILE__)->bar() == ob); 24 | 25 | ASSERT(catch(shadow(ob))); 26 | ASSERT(catch(shadow(new(__FILE__)))); 27 | 28 | #endif 29 | } 30 | 31 | object foo() { 32 | printf("%O\n", file_name()); 33 | return this_object(); 34 | } 35 | 36 | object bar() { 37 | return (object)prev->foo(); 38 | } 39 | -------------------------------------------------------------------------------- /add_action.h: -------------------------------------------------------------------------------- 1 | #ifndef ADD_ACTION_H 2 | #define ADD_ACTION_H 1 3 | 4 | #ifndef NO_ADD_ACTION 5 | extern object_t *hashed_living[CFG_LIVING_HASH_SIZE]; 6 | 7 | int parse_command PROT((char *, object_t *)); 8 | void clear_notify PROT((object_t *)); 9 | void stat_living_objects PROT((outbuffer_t *)); 10 | void remove_living_name PROT((object_t *)); 11 | object_t * find_living_object PROT((char *, int)); 12 | void setup_new_commands PROT((object_t *, object_t *)); 13 | #ifndef NO_ENVIRONMENT 14 | void remove_sent PROT((object_t *, object_t *)); 15 | #endif 16 | #else 17 | /* STUBS */ 18 | #define parse_command(x, y) do{}while(0) 19 | #define clear_notify(x) do{}while(0) 20 | #define stat_living_objects(x) do{}while(0) 21 | #define remove_living_name(x) do{}while(0) 22 | #define remove_sent(x, y) do{}while(0) 23 | #define setup_new_commands(x, y) do{}while(0) 24 | #endif 25 | 26 | #endif /* ADD_ACTION_H */ 27 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/clone/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/clone/login.c \ 8 | ../testsuite/clone/user.c 9 | 10 | OBJS += \ 11 | ./testsuite/clone/login.o \ 12 | ./testsuite/clone/user.o 13 | 14 | C_DEPS += \ 15 | ./testsuite/clone/login.d \ 16 | ./testsuite/clone/user.d 17 | 18 | 19 | # Each subdirectory must supply rules for building sources it contributes 20 | testsuite/clone/%.o: ../testsuite/clone/%.c 21 | @echo 'Building file: $<' 22 | @echo 'Invoking: GCC C Compiler' 23 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 24 | @echo 'Finished building: $<' 25 | @echo ' ' 26 | 27 | 28 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/single/tests/operators/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/single/tests/operators/range.c 8 | 9 | OBJS += \ 10 | ./testsuite/single/tests/operators/range.o 11 | 12 | C_DEPS += \ 13 | ./testsuite/single/tests/operators/range.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | testsuite/single/tests/operators/%.o: ../testsuite/single/tests/operators/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C Compiler' 20 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /regexp.h: -------------------------------------------------------------------------------- 1 | #ifndef _REGEXP_H_ 2 | #define _REGEXP_H_ 3 | 4 | /* 5 | * Definitions etc. for regexp(3) routines. 6 | * 7 | * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], 8 | * not the System V one. 9 | */ 10 | 11 | #define EFUN_REGEXP 1 12 | #define ED_REGEXP 2 13 | 14 | #define NSUBEXP 10 15 | typedef struct regexp { 16 | char *startp[NSUBEXP]; 17 | char *endp[NSUBEXP]; 18 | char regstart; /* Internal use only. */ 19 | char reganch; /* Internal use only. */ 20 | char *regmust; /* Internal use only. */ 21 | int regmlen; /* Internal use only. */ 22 | char program[1]; /* Unwarranted chumminess with compiler. */ 23 | } regexp; 24 | 25 | extern int regnarrate; 26 | extern int regexp_user; 27 | extern char *regexp_error; 28 | 29 | void regdump PROT((regexp *)); 30 | regexp *regcomp PROT((unsigned char *, int)); 31 | int regexec PROT((regexp *, char *)); 32 | char *regsub PROT((regexp *, char *, char *, int)); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /amiga/cstrip.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | main(int argc, char *argv[]) 5 | { 6 | FILE *FIn; 7 | unsigned int c; 8 | int mode = 0; 9 | 10 | if (argc != 2) { 11 | fprintf(stderr, "Error: no input filename given.\n"); 12 | exit(0); 13 | } 14 | if (!(FIn = fopen(argv[1], "rb"))) { 15 | fprintf(stderr, "Error opening %s\n", argv[1]); 16 | exit(0); 17 | } 18 | c = fgetc(FIn); 19 | while (!feof(FIn)) { 20 | switch (mode) { 21 | case 0: 22 | if (c == '/') 23 | mode = 1; 24 | else 25 | fputc(c, stdout); 26 | break; 27 | case 1: 28 | if (c == '*') 29 | mode = 2; 30 | else { 31 | mode = 0; 32 | fputc('/', stdout); 33 | fputc(c, stdout); 34 | } 35 | break; 36 | case 2: 37 | if (c == '*') 38 | mode = 3; 39 | break; 40 | case 3: 41 | if (c == '/') 42 | mode = 0; 43 | else 44 | mode = 2; 45 | break; 46 | } 47 | c = fgetc(FIn); 48 | } 49 | fclose(FIn); 50 | } 51 | -------------------------------------------------------------------------------- /compat/simuls/process_string.c: -------------------------------------------------------------------------------- 1 | mixed process_value(string func) { 2 | int tmp; 3 | string arg; 4 | object obj; 5 | mixed ret; 6 | 7 | if (!func || !stringp(func)) 8 | return 0; 9 | 10 | if ((tmp = member_array('|', func)) != -1) { 11 | arg = func[tmp+1..]; 12 | func = func[0..tmp-1]; 13 | } 14 | if ((tmp = member_array(':', func)) != -1) { 15 | obj = find_object(func[tmp+1..]); 16 | func = func[0..tmp-1]; 17 | } else { 18 | obj = previous_object(); 19 | } 20 | if (!obj) 21 | return 0; 22 | 23 | return call_other(obj, func, explode(arg, "|")...); 24 | } 25 | 26 | string process_string(string str) { 27 | int pr_start; 28 | string array parts = explode(str, "@@"); 29 | 30 | pr_start = !(str[0..1]=="@@"); 31 | 32 | for (int il = pr_start; il < sizeof(parts); il += 2) { 33 | string tmp = process_value(parts[il]); 34 | if (stringp(tmp)) 35 | parts[il] = tmp; 36 | } 37 | 38 | return implode(parts, ""); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /network_incl.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_INCL_H 2 | #define NETWORK_INCL_H 3 | 4 | #ifdef INCL_SYS_TYPES_H 5 | # include 6 | #endif 7 | #ifdef INCL_SYS_IOCTL_H 8 | # include 9 | #endif 10 | #ifdef INCL_SYS_SOCKET_H 11 | # include 12 | #endif 13 | #ifdef INCL_NETDB_H 14 | # include 15 | #endif 16 | #ifdef INCL_SYS_SEMA_H 17 | # include 18 | #endif 19 | 20 | #ifdef EPOLL 21 | #include 22 | #include 23 | #endif 24 | 25 | /* defined in on HP-PA/RISC; causes problems with telnet */ 26 | #undef SE 27 | 28 | #ifdef INCL_ARPA_TELNET_H 29 | # include 30 | #else 31 | # include "telnet.h" 32 | #endif 33 | #ifdef INCL_SYS_SOCKETVAR_H 34 | # include 35 | #endif 36 | #ifdef INCL_SOCKET_H 37 | # include 38 | #endif 39 | #ifdef INCL_RESOLVE_H 40 | # include 41 | #endif 42 | 43 | #ifdef WINSOCK 44 | # include 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /testsuite/single/tests/compiler/constant_expr.c: -------------------------------------------------------------------------------- 1 | void do_tests() { 2 | mixed code; 3 | 4 | // array constants 5 | code = __TREE__ ( sizeof( ({ 1, 3, 3 }) ) ); 6 | ASSERT(same(code, ({ "number", 3 }))); 7 | 8 | code = __TREE__ ( ({ 1, 3, 3 })[0] ); 9 | ASSERT(same(code, ({ "number", 1 }))); 10 | 11 | code = __TREE__ ( ({ 1, 4, 9 })[<2] ); 12 | ASSERT(same(code, ({ "number", 4 }))); 13 | 14 | code = __TREE__ { int i; for (; i < 5; i++) ; }; 15 | ASSERT(same(code, ({ 16 | "two values", 0, ({ 17 | "loop", 1, 0, ({ 18 | "opcode_2", "loop_cond_number", 1, 5 19 | }), ({ 20 | "opcode_1", "loop_incr", 1 21 | }) }) }) )); 22 | 23 | code = __TREE__( !code ? 1 : 2 ); 24 | ASSERT(same(code, ({ 25 | "if", ({ 26 | "number", 2 27 | }), ({ 28 | "number", 1 29 | }), ({ 30 | "opcode_1", "local", 0 31 | }) }) )); 32 | 33 | ASSERT(5/3 == 1); 34 | ASSERT(1/8.0 == 0.125); 35 | ASSERT(1.0/2 == 0.5); 36 | ASSERT(1.0/2.0 == 0.5); 37 | } 38 | -------------------------------------------------------------------------------- /packages/matrix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * matrix.h -- definitions and prototypes for matrix.c 3 | * 2-93 : Dwayne Fontenot : original coding. 4 | */ 5 | 6 | #ifndef _MATRIX_H_ 7 | #define _MATRIX_H_ 8 | 9 | #define RADIANS_PER_DEGREE 0.01745329252 10 | 11 | typedef float Matrix[16]; 12 | 13 | typedef struct { 14 | float x; 15 | float y; 16 | float z; 17 | } Vector; 18 | 19 | void translate_matrix PROT((double x, double y, double z, Matrix m)); 20 | 21 | void scale_matrix PROT((double x, double y, double z, Matrix m)); 22 | 23 | void rotate_x_matrix PROT((double a, Matrix m)); 24 | 25 | void rotate_y_matrix PROT((double a, Matrix m)); 26 | 27 | void rotate_z_matrix PROT((double a, Matrix m)); 28 | 29 | void lookat_rotate PROT((Matrix T, double x, double y, double z, Matrix m)); 30 | 31 | void lookat_rotate2 32 | PROT((double a, double b, double c, double d, double e, double f, Matrix m)); 33 | 34 | void mult_matrix PROT((Matrix m1, Matrix m2, Matrix m)); 35 | 36 | #endif /* _MATRIX_H_ */ 37 | -------------------------------------------------------------------------------- /packages/sockets_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | /* 4 | * socket efuns 5 | */ 6 | int socket_create(int, string | function, string | function | void); 7 | int socket_bind(int, int, string | void); 8 | int socket_listen(int, string | function); 9 | int socket_accept(int, string | function, string | function); 10 | int socket_connect(int, string, string | function, string | function); 11 | int socket_write(int, mixed, string | void); 12 | int socket_close(int); 13 | int socket_release(int, object, string | function); 14 | int socket_acquire(int, string | function, string | function, string | function); 15 | string socket_error(int); 16 | string socket_address(int | object, int default: 0); 17 | 18 | /* 19 | * ret[0] = (int) fd 20 | * ret[1] = (string) state 21 | * ret[2] = (string) mode 22 | * ret[3] = (string) local address 23 | * ret[4] = (string) remote address 24 | * ret[5] = (object) owner 25 | */ 26 | mixed *socket_status(void | int); 27 | -------------------------------------------------------------------------------- /backend.h: -------------------------------------------------------------------------------- 1 | #ifndef BACKEND_H 2 | #define BACKEND_H 3 | 4 | #include "interpret.h" 5 | #include "object.h" 6 | 7 | #define NULL_ERROR_CONTEXT 0 8 | #define NORMAL_ERROR_CONTEXT 1 9 | #define CATCH_ERROR_CONTEXT 2 10 | #define SAFE_APPLY_ERROR_CONTEXT 4 11 | 12 | /* 13 | * backend.c 14 | */ 15 | extern int current_time; 16 | extern int heart_beat_flag; 17 | extern object_t *current_heart_beat; 18 | extern int eval_cost; 19 | extern error_context_t *current_error_context; 20 | 21 | void backend PROT((void)); 22 | void clear_state PROT((void)); 23 | void logon PROT((object_t *)); 24 | int parse_command PROT((char *, object_t *)); 25 | int set_heart_beat PROT((object_t *, int)); 26 | int query_heart_beat PROT((object_t *)); 27 | int heart_beat_status PROT((outbuffer_t *, int)); 28 | void preload_objects PROT((int)); 29 | INLINE void remove_destructed_objects PROT((void)); 30 | void update_load_av PROT((void)); 31 | void update_compile_av PROT((int)); 32 | char *query_load_av PROT((void)); 33 | array_t *get_heart_beats PROT((void)); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /icode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Defines and types for LPC stackmachine code 3 | */ 4 | 5 | #ifndef _ICODE_H 6 | #define _ICODE_H 7 | #include "trees.h" 8 | 9 | void i_generate___INIT PROT((void)); 10 | void i_generate_node PROT((parse_node_t *)); 11 | void i_generate_continue PROT((void)); 12 | void i_generate_forward_jump PROT((void)); 13 | void i_update_forward_jump PROT((void)); 14 | void i_update_continues PROT((void)); 15 | void i_branch_backwards PROT((char, int)); 16 | void i_update_breaks PROT((void)); 17 | void i_save_loop_info PROT((parse_node_t *)); 18 | void i_restore_loop_info PROT((void)); 19 | void i_generate_forward_branch PROT((char)); 20 | void i_update_forward_branch PROT((char *)); 21 | void i_update_forward_branch_links PROT((char, parse_node_t *)); 22 | void i_generate_else PROT((void)); 23 | void i_initialize_parser PROT((void)); 24 | void i_uninitialize_parser PROT((void)); 25 | void i_generate_final_program PROT((int)); 26 | void i_generate_inherited_init_call PROT((int, short)); 27 | 28 | void optimize_icode PROT((char *, char *, char *)); 29 | #endif 30 | -------------------------------------------------------------------------------- /crypt.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPT_H 2 | #define CRYPT_H 3 | 4 | /* Number of bytes in salt (raw, fully used, not printable-encoded bytes). 5 | * This is configurable, but don't set it too high (up to say 10). But 4 6 | * is plenty really, 2^32 salts possible (the DES-style crypt used only 4096). 7 | */ 8 | #define MD5_SALTLEN 4 9 | 10 | /* Magic string, used in hashing. Configurable. */ 11 | #define MD5_MAGIC "xyzz" 12 | 13 | /* Maximum length (in bytes) of digested data. 14 | * This is /not/ configurable! Don't change it. 15 | */ 16 | #define MD5_MAXLEN 55 17 | 18 | /* This salt value is used in generating salts. It must 19 | * be a valid salt as returned by md5crypt(), or the 20 | * routine will go into an infinite loop when generating 21 | * a salt from an unrecognized string. Any value returned 22 | * from md5crypt("anything", NULL, NULL) is valid here. 23 | */ 24 | #define MD5_VALID_SALT "anhlklck!ggddl`l`lg`bjblodlfcljdcnhffib`c" 25 | 26 | typedef unsigned char byte; 27 | 28 | char *custom_crypt(CONST char *key, CONST char *salt, byte *rawout); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/restore_variable.c: -------------------------------------------------------------------------------- 1 | #define ERR(x) ASSERT2(catch(restore_variable(x)), sprintf("%O", x)) 2 | #define IS(x, y) ASSERT2(same(restore_variable(x),y), sprintf("%O", x)) 3 | 4 | string *value_errs = ({ "\"\"x", "\"\\", "\"\\x\\", "\"\\x\"x", 5 | "-x" }); 6 | mapping values = ([ 7 | "\"\r\"" : "\n", 8 | "\"\\\"\"" : "\"", 9 | "\"\\\"\\x\r\"" : "\"x\n", 10 | "-1" : -1, 11 | "0" : 0, 12 | "1" : 1, 13 | "22" : 22, 14 | "1.2" : 1.2, 15 | "333" : 333, 16 | "({})" : ({}), 17 | "({,})" : ({0}) 18 | ]); 19 | 20 | void do_tests() { 21 | mixed x, y; 22 | foreach (x in value_errs) { 23 | ERR(x); 24 | } 25 | 26 | foreach (x, y in values) { 27 | IS(x, y); 28 | } 29 | 30 | // arrays 31 | foreach (x, y in values) { 32 | IS("({" + x + ",})", ({ y })); 33 | IS("({" + x + "," + x + ",})", ({ y, y })); 34 | } 35 | 36 | // mappings 37 | foreach (x, y in values) { 38 | IS("([1:" + x + ",])", ([1:y ])); 39 | IS("([" + x + ":" + x + ",])", ([ y: y ])); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/inherit/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/inherit/base.c \ 8 | ../testsuite/inherit/clean_up.c \ 9 | ../testsuite/inherit/tests.c 10 | 11 | OBJS += \ 12 | ./testsuite/inherit/base.o \ 13 | ./testsuite/inherit/clean_up.o \ 14 | ./testsuite/inherit/tests.o 15 | 16 | C_DEPS += \ 17 | ./testsuite/inherit/base.d \ 18 | ./testsuite/inherit/clean_up.d \ 19 | ./testsuite/inherit/tests.d 20 | 21 | 22 | # Each subdirectory must supply rules for building sources it contributes 23 | testsuite/inherit/%.o: ../testsuite/inherit/%.c 24 | @echo 'Building file: $<' 25 | @echo 'Invoking: GCC C Compiler' 26 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 27 | @echo 'Finished building: $<' 28 | @echo ' ' 29 | 30 | 31 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/regexp.c: -------------------------------------------------------------------------------- 1 | int same_array(mixed *x, mixed *y) { 2 | if (!arrayp(x) || !arrayp(y)) return 0; 3 | if (sizeof(x) != sizeof(y)) return 0; 4 | for (int i = 0; i < sizeof(x); i++) { 5 | if (arrayp(x[i])) { 6 | if (!same_array(x[i], y[i])) 7 | return 0; 8 | } else if (x[i] != y[i]) 9 | return 0; 10 | } 11 | return 1; 12 | } 13 | 14 | void do_tests() { 15 | mapping x = ([ 1 : "bazz" ]); 16 | 17 | ASSERT(catch(regexp("foo", "bar", x[1]))); 18 | ASSERT(catch(regexp("foo", "bar", 1))); 19 | 20 | ASSERT(regexp("tabba", "a*b")); 21 | ASSERT(!regexp("tbba", "a+b")); 22 | ASSERT(same_array( 23 | regexp( ({ "foo", "bar", "bazz" }), "b"), 24 | ({ "bar", "bazz" }))); 25 | ASSERT(same_array( 26 | regexp( ({ "foo", "bar", "bazz" }), "^...$"), 27 | ({ "foo", "bar" }) )); 28 | ASSERT(same_array(regexp( ({ "foo", "bar", "bazz" }), "(oo|zz)", 1), 29 | ({ "foo", 1, "bazz", 3 }))); 30 | ASSERT(catch(regexp("foo", "+"))); 31 | ASSERT(catch(regexp( ({ "foo", "bar" }), "+"))); 32 | } 33 | -------------------------------------------------------------------------------- /main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include "lpc_incl.h" 5 | 6 | /* 7 | * main.c 8 | */ 9 | 10 | #define PORT_UNDEFINED 0 11 | #define PORT_TELNET 1 12 | #define PORT_BINARY 2 13 | #define PORT_ASCII 3 14 | #define PORT_MUD 4 15 | 16 | typedef struct { 17 | int kind; 18 | int port; 19 | int fd; 20 | #ifdef F_NETWORK_STATS 21 | int in_packets; 22 | int in_volume; 23 | int out_packets; 24 | int out_volume; 25 | #endif 26 | } port_def_t; 27 | 28 | extern port_def_t external_port[5]; 29 | #ifdef PACKAGE_EXTERNAL 30 | extern char *external_cmd[NUM_EXTERNAL_CMDS]; 31 | #endif 32 | 33 | extern int t_flag; 34 | extern int comp_flag; 35 | extern int time_to_swap; 36 | extern int time_to_clean_up; 37 | extern char *default_fail_message; 38 | extern int boot_time; 39 | extern int max_cost; 40 | extern int max_array_size; 41 | extern int max_buffer_size; 42 | extern int max_string_length; 43 | extern char *reserved_area; 44 | extern double consts[]; 45 | extern int slow_shut_down_to_do; 46 | 47 | void CDECL debug_message PROT1V(char *); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/call_out.c: -------------------------------------------------------------------------------- 1 | object tp; 2 | #ifdef __THIS_PLAYER_IN_CALL_OUT__ 3 | #define TPIC ASSERT(this_player() == tp) 4 | #else 5 | #define TPIC 6 | #endif 7 | 8 | int called; 9 | 10 | void no_args() { 11 | called++; 12 | TPIC; 13 | } 14 | 15 | void one_arg(int x) { 16 | called++; 17 | TPIC; 18 | ASSERT(x == 1); 19 | } 20 | 21 | void two_arg(int x, int y) { 22 | called++; 23 | TPIC; 24 | ASSERT(x == 1); 25 | ASSERT(y == 2); 26 | } 27 | 28 | void finish() { 29 | ASSERT(called == 6); 30 | } 31 | 32 | void do_tests() { 33 | mixed calls, call; 34 | 35 | tp = this_player(); 36 | called = 0; 37 | call_out( (: no_args :), 1); 38 | call_out( "no_args", 2); 39 | call_out( (: one_arg, 1 :), 3); 40 | call_out( "one_arg", 4, 1); 41 | call_out( (: two_arg, 1 :), 5, 2); 42 | call_out( "two_arg", 6, 1, 2); 43 | call_out( "finish", 10); 44 | 45 | calls = call_out_info(); 46 | foreach(call in calls) { 47 | ASSERT(objectp(call[0])); 48 | ASSERT(stringp(call[1])); 49 | ASSERT(intp(call[2])); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Credits.LPmud: -------------------------------------------------------------------------------- 1 | The program was written originally by 2 | 3 | Lars Pensj|, April 1989 (lars@cd.chalmers.se). 4 | 5 | Other credits: 6 | 7 | The regexp package was made by Henry Spencer. 8 | 9 | The ed package was not done by me. See the file ed.c for information. 10 | 11 | Bit manipulations was implemented by pell@lysator.liu.se who also found 12 | several bugs that had eluded me for months. 13 | 14 | Valuable help and hints from: Mark Nagel, James Seidman, Moonchilde and more. 15 | 16 | Roland Dunkerley III fixed for-loops, do-while and the operators ++ and --. 17 | 18 | Sean T Barrett made smalloc.c. 19 | 20 | Lennart Augustsson convinced me to implement a compiler for a virtual 21 | stack machine. He also implemented the built-in preprocessor. 22 | 23 | John S. Price found and fixed many bugs. 24 | 25 | The shadow idea was "forwarded" to me by John S. Price from Team Cthulhu 26 | (Bill Burdick, Roy Riggs, Mitch Adler). 27 | 28 | Michael Malone, Michael O'Reilly, Klaus Rennecke, J|rn Rennecke and 29 | Germano Caronni found and fixed a large amount of bugs. 30 | 31 | Petri Wessman fixed changes for SCO unix and AIX. 32 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/restore_object.c: -------------------------------------------------------------------------------- 1 | int var1; 2 | #ifndef __SENSIBLE_MODIFIERS__ 3 | static int var2; 4 | #else 5 | nosave int var2; 6 | #endif 7 | int var3; 8 | int var4; 9 | 10 | void setup() { 11 | var1 = 1; 12 | var2 = 2; 13 | var3 = 3; 14 | var4 = 4; 15 | } 16 | 17 | void do_tests() { 18 | write_file("/sf.o", "#empty\n", 1); 19 | setup(); 20 | restore_object("/sf"); 21 | ASSERT(!var1); 22 | ASSERT(var2 == 2); 23 | ASSERT(!var3); 24 | ASSERT(!var4); 25 | 26 | setup(); 27 | restore_object("/sf", 1); 28 | ASSERT(var1 == 1); 29 | ASSERT(var2 == 2); 30 | ASSERT(var3 == 3); 31 | ASSERT(var4 == 4); 32 | 33 | write_file("/sf.o", "var1 2\nvar2 4\nvar3 6\nvar4 8\n", 1); 34 | setup(); 35 | restore_object("/sf", 1); 36 | ASSERT(var1 == 2); 37 | ASSERT(var2 == 2); 38 | ASSERT(var3 == 6); 39 | ASSERT(var4 == 8); 40 | 41 | write_file("/sf.o", "var4 1\nvar2 9\nvar1 3\nvar3 4\n", 1); 42 | setup(); 43 | restore_object("/sf", 1); 44 | ASSERT(var1 == 3); 45 | ASSERT(var2 == 2); 46 | ASSERT(var3 == 4); 47 | ASSERT(var4 == 1); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/single/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/single/inh.c \ 8 | ../testsuite/single/master.c \ 9 | ../testsuite/single/simul_efun.c \ 10 | ../testsuite/single/void.c 11 | 12 | OBJS += \ 13 | ./testsuite/single/inh.o \ 14 | ./testsuite/single/master.o \ 15 | ./testsuite/single/simul_efun.o \ 16 | ./testsuite/single/void.o 17 | 18 | C_DEPS += \ 19 | ./testsuite/single/inh.d \ 20 | ./testsuite/single/master.d \ 21 | ./testsuite/single/simul_efun.d \ 22 | ./testsuite/single/void.d 23 | 24 | 25 | # Each subdirectory must supply rules for building sources it contributes 26 | testsuite/single/%.o: ../testsuite/single/%.c 27 | @echo 'Building file: $<' 28 | @echo 'Invoking: GCC C Compiler' 29 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 30 | @echo 'Finished building: $<' 31 | @echo ' ' 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/contrib_spec.c: -------------------------------------------------------------------------------- 1 | #include "spec.h" 2 | 3 | #ifndef NO_SHADOWS 4 | int remove_shadow(object); 5 | #endif 6 | #ifndef NO_ADD_ACTION 7 | mixed query_notify_fail(); 8 | object *named_livings(); 9 | #endif 10 | #if 0 11 | void set_prompt(string, void|object); 12 | #endif 13 | mixed copy(mixed); 14 | string *functions(object, int default: 0); 15 | string *variables(object, int default: 0); 16 | object *heart_beats(); 17 | #ifdef COMPAT_32 18 | object *heart_beat_info heart_beats(); 19 | #endif 20 | string terminal_colour(string, mapping, void | int, void | int); 21 | string pluralize(string); 22 | int file_length(string); 23 | string upper_case(string); 24 | int replaceable(object, void | string *); 25 | mapping program_info(void | object); 26 | void store_variable(string, mixed); 27 | mixed fetch_variable(string); 28 | int remove_interactive(object); 29 | int query_ip_port(void | object); 30 | #if 0 31 | string zonetime(string, int); 32 | int is_daylight_savings_time(string, int); 33 | #endif 34 | void debug_message(string); 35 | object function_owner(function); 36 | string repeat_string(string, int); 37 | mapping memory_summary(); 38 | string query_replaced_program(void|object); 39 | mapping network_stats(); 40 | -------------------------------------------------------------------------------- /amiga/nsignal.h: -------------------------------------------------------------------------------- 1 | /* hosts/amiga/nsignal.h */ 2 | 3 | #ifndef AMIGA_NSIGNAL_H 4 | #define AMIGA_NSIGNAL_H 5 | 6 | #include 7 | #include "ccdep.h" 8 | 9 | /* LPMud signals aren't raised by other programs, but by external events, 10 | ** so the normal signal()/raise() mechanism provided by DICE isn't enough 11 | ** since it doesn't uses task-exception handlers. 12 | */ 13 | 14 | #define signal(a,b) new_signal(a,b) 15 | 16 | /* New signals */ 17 | 18 | #define SIGALRM (NSIG-1) 19 | #define SIGUSR1 (NSIG-2) 20 | 21 | #define SIGHUP 29 22 | 23 | /* Used standard task signals */ 24 | 25 | #define EXT_SIGHUP SIGBREAKF_CTRL_C /* Ctrl-C: hang-up */ 26 | #define EXT_SIGINT SIGBREAKF_CTRL_E /* Ctrl-E: interrupt select() */ 27 | #define EXT_SIGUSR SIGBREAKF_CTRL_F /* Ctrl-F: update master */ 28 | 29 | /* Prototypes */ 30 | 31 | extern __stkargs unsigned int alarm(unsigned int); 32 | extern __stkargs __sigfunc new_signal(int, __sigfunc); 33 | extern __stkargs int start_timer(struct timeval *, struct timerequest *); 34 | extern __stkargs int setup_timer(LONG, struct timerequest **); 35 | extern __stkargs void cleanup_timer(struct timerequest **); 36 | extern __stkargs ULONG check_signals(void); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /compat/Debug/amiga/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../amiga/crypt.c \ 8 | ../amiga/cstrip.c \ 9 | ../amiga/replace.c \ 10 | ../amiga/signal.c \ 11 | ../amiga/signal_rr.c \ 12 | ../amiga/socket.c \ 13 | ../amiga/touch.c 14 | 15 | OBJS += \ 16 | ./amiga/crypt.o \ 17 | ./amiga/cstrip.o \ 18 | ./amiga/replace.o \ 19 | ./amiga/signal.o \ 20 | ./amiga/signal_rr.o \ 21 | ./amiga/socket.o \ 22 | ./amiga/touch.o 23 | 24 | C_DEPS += \ 25 | ./amiga/crypt.d \ 26 | ./amiga/cstrip.d \ 27 | ./amiga/replace.d \ 28 | ./amiga/signal.d \ 29 | ./amiga/signal_rr.d \ 30 | ./amiga/socket.d \ 31 | ./amiga/touch.d 32 | 33 | 34 | # Each subdirectory must supply rules for building sources it contributes 35 | amiga/%.o: ../amiga/%.c 36 | @echo 'Building file: $<' 37 | @echo 'Invoking: GCC C Compiler' 38 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 39 | @echo 'Finished building: $<' 40 | @echo ' ' 41 | 42 | 43 | -------------------------------------------------------------------------------- /file_incl.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE_INCL_H 2 | #define FILE_INCL_H 3 | 4 | #ifdef INCL_SYS_STAT_H 5 | # include 6 | #endif 7 | #ifdef INCL_SYS_DIR_H 8 | # include 9 | #endif 10 | 11 | #ifndef linux 12 | #ifdef INCL_SYS_DIRENT_H 13 | # include 14 | #endif 15 | #endif 16 | 17 | #ifdef INCL_DIRENT_H 18 | # include 19 | #endif 20 | #ifdef INCL_SYS_FILIO_H 21 | # include 22 | #endif 23 | #ifdef INCL_SYS_SOCKIO_H 24 | # include 25 | #endif 26 | #ifdef INCL_SYS_MKDEV_H 27 | # include 28 | #endif 29 | 30 | #ifdef INCL_SYS_RESOURCE_H 31 | # include 32 | #endif 33 | #ifdef INCL_SYS_RUSAGE_H 34 | # include 35 | #endif 36 | #ifdef INCL_CRYPT_H 37 | # include 38 | #endif 39 | #ifdef INCL_SCHED_H 40 | #define __USE_GNU 41 | # include 42 | #endif 43 | #if defined(LATTICE) || defined(__SASC) 44 | #undef close 45 | #undef ioctl 46 | #undef write 47 | #undef read 48 | #endif 49 | 50 | #ifdef WIN32 51 | # include 52 | # include 53 | 54 | # define OS_mkdir(x, y) mkdir(x) 55 | # define lstat(x, y) stat(x, y) 56 | #else 57 | # define OS_mkdir(x, y) mkdir(x, y) 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /configure.h: -------------------------------------------------------------------------------- 1 | #define INCL_STDLIB_H 2 | #define INCL_UNISTD_H 3 | #define INCL_TIME_H 4 | #define USE_TZSET 5 | #define INCL_SYS_TIMES_H 6 | #define INCL_FCNTL_H 7 | #define INCL_SYS_TIME_H 8 | #define INCL_LIMITS_H 9 | #define INCL_LOCALE_H 10 | #define INCL_NETINET_IN_H 11 | #define INCL_ARPA_INET_H 12 | #define INCL_SYS_TYPES_H 13 | #define INCL_SYS_IOCTL_H 14 | #define INCL_SYS_SOCKET_H 15 | #define INCL_NETDB_H 16 | #define INCL_ARPA_TELNET_H 17 | #define INCL_SYS_SOCKETVAR_H 18 | #define INCL_SYS_STAT_H 19 | #define INCL_DIRENT_H 20 | #define USE_STRUCT_DIRENT 21 | #define INCL_SYS_RESOURCE_H 22 | #define INCL_SYS_WAIT_H 23 | #define INCL_CRYPT_H 24 | #define INCL_SCHED_H 25 | #define INCL_SYS_SYSMACROS_H 26 | #define INCL_STDARG_H 27 | #define INCL_DLFCN_H 28 | #define DRAND48 29 | #define USE_BSD_SIGNALS 30 | #define SIGNAL_ERROR SIG_ERR 31 | #define INLINE inline 32 | #define CONST const 33 | #define HAS_UALARM 34 | #define HAS_STRERROR 35 | #define HAS_GETCWD 36 | #define RUSAGE 37 | #define TIMES 38 | #define HAS_GETTIMEOFDAY 39 | #define HAS_FCHMOD 40 | #define SIZEOF_INT 4 41 | #define SIZEOF_LONG 8 42 | #define SIZEOF_PTR 8 43 | #define SIZEOF_SHORT 2 44 | #define SIZEOF_FLOAT 4 45 | #define UINT32 unsigned long 46 | #define CONFIGURE_VERSION 5 47 | 48 | -------------------------------------------------------------------------------- /eoperators.h: -------------------------------------------------------------------------------- 1 | /* this file was manually generated -- don't delete it */ 2 | 3 | INLINE void f_ge PROT((void)); 4 | INLINE void f_le PROT((void)); 5 | INLINE void f_lt PROT((void)); 6 | INLINE void f_gt PROT((void)); 7 | INLINE void f_and PROT((void)); 8 | INLINE void f_and_eq PROT((void)); 9 | INLINE void f_div_eq PROT((void)); 10 | INLINE void f_eq PROT((void)); 11 | INLINE void f_lsh PROT((void)); 12 | INLINE void f_lsh_eq PROT((void)); 13 | INLINE void f_mod_eq PROT((void)); 14 | INLINE void f_mult_eq PROT((void)); 15 | INLINE void f_ne PROT((void)); 16 | INLINE void f_or PROT((void)); 17 | INLINE void f_or_eq PROT((void)); 18 | INLINE void f_parse_command PROT((void)); 19 | INLINE void f_range PROT((int)); 20 | INLINE void f_extract_range PROT((int)); 21 | INLINE void f_rsh PROT((void)); 22 | INLINE void f_rsh_eq PROT((void)); 23 | INLINE void f_simul_efun PROT((void)); 24 | INLINE void f_sub_eq PROT((void)); 25 | INLINE void f_switch PROT((void)); 26 | INLINE void f_xor PROT((void)); 27 | INLINE void f_xor_eq PROT((void)); 28 | INLINE void f_function_constructor PROT((void)); 29 | INLINE void f_evaluate PROT((void)); 30 | INLINE void f_sscanf PROT((void)); 31 | 32 | /* 33 | * eoperators.c 34 | */ 35 | void call_simul_efun PROT((unsigned short, int)); 36 | 37 | -------------------------------------------------------------------------------- /compat/Debug/testsuite/single/tests/compiler/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../testsuite/single/tests/compiler/at_block.c \ 8 | ../testsuite/single/tests/compiler/constant_expr.c \ 9 | ../testsuite/single/tests/compiler/succeed.c 10 | 11 | OBJS += \ 12 | ./testsuite/single/tests/compiler/at_block.o \ 13 | ./testsuite/single/tests/compiler/constant_expr.o \ 14 | ./testsuite/single/tests/compiler/succeed.o 15 | 16 | C_DEPS += \ 17 | ./testsuite/single/tests/compiler/at_block.d \ 18 | ./testsuite/single/tests/compiler/constant_expr.d \ 19 | ./testsuite/single/tests/compiler/succeed.d 20 | 21 | 22 | # Each subdirectory must supply rules for building sources it contributes 23 | testsuite/single/tests/compiler/%.o: ../testsuite/single/tests/compiler/%.c 24 | @echo 'Building file: $<' 25 | @echo 'Invoking: GCC C Compiler' 26 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 27 | @echo 'Finished building: $<' 28 | @echo ' ' 29 | 30 | 31 | -------------------------------------------------------------------------------- /testsuite/single/tests/efuns/read_buffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | efun: mixed read_buffer(string|buffer, void|int, void|int); 3 | test author: John Garnett 4 | date: 1993 November 8 5 | */ 6 | 7 | #define TEST_STRING "ABC" 8 | 9 | #ifndef __NO_BUFFER_TYPE__ 10 | buffer b; 11 | #endif 12 | int i; 13 | 14 | void do_tests() { 15 | string s; 16 | 17 | #ifndef __NO_BUFFER_TYPE__ 18 | s = read_buffer(b); 19 | ASSERT(s == TEST_STRING); 20 | 21 | s = read_buffer(b, sizeof(b)-1); 22 | ASSERT(s == TEST_STRING[i..i]); 23 | 24 | s = read_buffer(b, sizeof(b)); 25 | ASSERT(s == 0); 26 | 27 | s = read_buffer(b, -sizeof(b)); 28 | ASSERT(s == TEST_STRING); 29 | 30 | s = read_buffer(b, -(sizeof(b) + 1)); 31 | ASSERT(s == 0); 32 | 33 | s = read_buffer(b, 1, 1); 34 | ASSERT(s == TEST_STRING[1..1]); 35 | 36 | s = read_buffer(b, 1, sizeof(b)); 37 | ASSERT(s == TEST_STRING[1..i]); 38 | #endif 39 | 40 | /* add cases here to handle reading from files */ 41 | } 42 | 43 | void 44 | create() 45 | { 46 | int j, limit; 47 | 48 | i = strlen(TEST_STRING) - 1; 49 | limit = strlen(TEST_STRING); 50 | #ifndef __NO_BUFFER_TYPE__ 51 | b = allocate_buffer(limit); 52 | for (j = 0; j < limit; j++) { 53 | b[j] = TEST_STRING[j]; 54 | } 55 | #endif 56 | } 57 | -------------------------------------------------------------------------------- /amiga/socket.h: -------------------------------------------------------------------------------- 1 | /* amiga/socket.h */ 2 | 3 | #ifndef AMIGA_SOCKET_H 4 | #define AMIGA_SOCKET_H 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /* 14 | * to avoid conflict with 15 | */ 16 | #undef close 17 | #undef ioctl 18 | #undef write 19 | #undef read 20 | 21 | /* 22 | * AmiTCP 23 | */ 24 | #ifdef AMITCP 25 | 26 | extern struct Library *SocketBase; 27 | 28 | #define close(s) CloseSocket(s) 29 | #define ioctl(s,t,u) IoctlSocket(s,t,(char *)u) 30 | #define write(s,b,l) send(s,b,l,0) 31 | #define read(s,b,l) recv(s,b,l,0) 32 | #define getsockname(a,b,c) getsockname(a,b,(LONG *)c) 33 | #define accept(a,b,c) accept(a,b,(LONG *)c) 34 | #define recvfrom(a,b,c,d,e,f) recvfrom(a,b,c,d,e,(LONG *)f) 35 | 36 | #endif /* AMITCP */ 37 | 38 | /* 39 | * AS225 40 | */ 41 | #ifdef AS225 42 | 43 | extern struct Library *SockBase; 44 | 45 | #define FD_SETSIZE 256 46 | #define SOCKET_T int 47 | 48 | #define close(s) s_close(s) 49 | #define ioctl(s,t,u) s_ioctl(s,t,u) 50 | #define write(s,b,l) send(s,b,l,0) 51 | #define read(s,b,l) recv(s,b,l,0) 52 | 53 | #endif /* AS225 */ 54 | 55 | void amiga_sockinit(void); 56 | void amiga_sockexit(void); 57 | 58 | #endif /* AMIGA_SOCKET_H */ 59 | -------------------------------------------------------------------------------- /compat/Debug/compat/simuls/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../compat/simuls/apply.c \ 8 | ../compat/simuls/break_string.c \ 9 | ../compat/simuls/dump_socket_status.c \ 10 | ../compat/simuls/parse_command.c \ 11 | ../compat/simuls/process_string.c \ 12 | ../compat/simuls/tail.c 13 | 14 | OBJS += \ 15 | ./compat/simuls/apply.o \ 16 | ./compat/simuls/break_string.o \ 17 | ./compat/simuls/dump_socket_status.o \ 18 | ./compat/simuls/parse_command.o \ 19 | ./compat/simuls/process_string.o \ 20 | ./compat/simuls/tail.o 21 | 22 | C_DEPS += \ 23 | ./compat/simuls/apply.d \ 24 | ./compat/simuls/break_string.d \ 25 | ./compat/simuls/dump_socket_status.d \ 26 | ./compat/simuls/parse_command.d \ 27 | ./compat/simuls/process_string.d \ 28 | ./compat/simuls/tail.d 29 | 30 | 31 | # Each subdirectory must supply rules for building sources it contributes 32 | compat/simuls/%.o: ../compat/simuls/%.c 33 | @echo 'Building file: $<' 34 | @echo 'Invoking: GCC C Compiler' 35 | gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 36 | @echo 'Finished building: $<' 37 | @echo ' ' 38 | 39 | 40 | -------------------------------------------------------------------------------- /socket_err.c: -------------------------------------------------------------------------------- 1 | /* 2 | * socket_errors.c -- socket error strings 3 | * 5-92 : Dwayne Fontenot (Jacques@TMI) : original coding. 4 | * 10-92 : Dave Richards (Cynosure) : less original coding. 5 | */ 6 | 7 | #include "include/socket_err.h" 8 | 9 | char *error_strings[ERROR_STRINGS] = 10 | { 11 | "Problem creating socket", 12 | "Problem with setsockopt", 13 | "Problem setting non-blocking mode", 14 | "No more available efun sockets", 15 | "Descriptor out of range", 16 | "Socket is closed", 17 | "Security violation attempted", 18 | "Socket is already bound", 19 | "Address already in use", 20 | "Problem with bind", 21 | "Problem with getsockname", 22 | "Socket mode not supported", 23 | "Socket not bound to an address", 24 | "Socket is already connected", 25 | "Problem with listen", 26 | "Socket not listening", 27 | "Operation would block", 28 | "Interrupted system call", 29 | "Problem with accept", 30 | "Socket is listening", 31 | "Problem with address format", 32 | "Operation already in progress", 33 | "Connection refused", 34 | "Problem with connect", 35 | "Socket not connected", 36 | "Object type not supported", 37 | "Problem with sendto", 38 | "Problem with send", 39 | "Wait for callback", 40 | "Socket already released", 41 | "Socket not released", 42 | "Data nested too deeply" 43 | }; 44 | -------------------------------------------------------------------------------- /class.c: -------------------------------------------------------------------------------- 1 | #include "std.h" 2 | #include "lpc_incl.h" 3 | 4 | void dealloc_class P1(array_t *, p) { 5 | int i; 6 | 7 | for (i = p->size; i--;) 8 | free_svalue(&p->item[i], "dealloc_class"); 9 | FREE((char *) p); 10 | } 11 | 12 | void free_class P1(array_t *, p) 13 | { 14 | if (--(p->ref) > 0) 15 | return; 16 | 17 | dealloc_class(p); 18 | } 19 | 20 | array_t *allocate_class P2(class_def_t *, cld, int, has_values) { 21 | array_t *p; 22 | int n = cld->size; 23 | 24 | p = (array_t *)DXALLOC(sizeof(array_t) + sizeof(svalue_t) * (n - 1), TAG_CLASS, "allocate_class"); 25 | p->ref = 1; 26 | p->size = n; 27 | if (has_values) { 28 | while (n--) 29 | p->item[n] = *sp--; 30 | } else { 31 | while (n--) 32 | p->item[n] = const0; 33 | } 34 | return p; 35 | } 36 | 37 | array_t *allocate_class_by_size P1(int, size) { 38 | array_t *p; 39 | 40 | p = (array_t *)DXALLOC(sizeof(array_t) + sizeof(svalue_t) * (size - 1), TAG_CLASS, "allocate_class"); 41 | p->ref = 1; 42 | p->size = size; 43 | 44 | while (size--) 45 | p->item[size] = const0; 46 | 47 | return p; 48 | } 49 | 50 | array_t *allocate_empty_class_by_size P1(int, size) { 51 | array_t *p; 52 | 53 | p = (array_t *)DXALLOC(sizeof(array_t) + sizeof(svalue_t) * (size - 1), TAG_CLASS, "allocate_class"); 54 | p->ref = 1; 55 | p->size = size; 56 | 57 | return p; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /debug.c: -------------------------------------------------------------------------------- 1 | #include "std.h" 2 | #include "lpc_incl.h" 3 | 4 | #ifdef DEBUG_MACRO 5 | 6 | mapping_t *debug_levels PROT((void)); 7 | 8 | typedef struct { 9 | char *name; 10 | int bit; 11 | } debug_t; 12 | 13 | #define E(x) { #x, DBG_##x } 14 | 15 | debug_t levels[] = { 16 | E(call_out), 17 | E(d_flag), 18 | E(connections), 19 | E(mapping), 20 | E(sockets), 21 | E(comp_func_tab), 22 | E(LPC), 23 | E(LPC_line) 24 | }; 25 | 26 | #define NELEM(x) (sizeof(x)/sizeof(x[0])) 27 | 28 | mapping_t *debug_levels() { 29 | int dl = debug_level; 30 | mapping_t *ret = allocate_mapping(10); 31 | int i; 32 | 33 | for (i = 0; i < NELEM(levels); i++) { 34 | add_mapping_pair(ret, levels[i].name, dl & levels[i].bit); 35 | dl &= ~levels[i].bit; 36 | } 37 | 38 | if (dl) 39 | add_mapping_pair(ret, "unknown", dl); 40 | 41 | return ret; 42 | } 43 | 44 | void debug_level_set P1(char *, level) { 45 | int i; 46 | 47 | for (i = 0; i < NELEM(levels); i++) { 48 | if (strcmp(level, levels[i].name) == 0) { 49 | debug_level |= levels[i].bit; 50 | return; 51 | } 52 | } 53 | } 54 | 55 | void debug_level_clear P1(char *, level) { 56 | int i; 57 | 58 | for (i = 0; i < NELEM(levels); i++) { 59 | if (strcmp(level, levels[i].name) == 0) { 60 | debug_level &= ~levels[i].bit; 61 | return; 62 | } 63 | } 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /file.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE_H 2 | #define FILE_H 3 | 4 | #include "lpc_incl.h" 5 | #include "file_incl.h" 6 | 7 | /* 8 | * Credits for some of the code below goes to Free Software Foundation 9 | * Copyright (C) 1990 Free Software Foundation, Inc. 10 | * See the GNU General Public License for more details. 11 | */ 12 | #ifndef S_ISDIR 13 | #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) 14 | #endif 15 | 16 | #ifndef S_ISREG 17 | #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) 18 | #endif 19 | 20 | #ifndef S_ISCHR 21 | #define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) 22 | #endif 23 | 24 | #ifndef S_ISBLK 25 | #define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) 26 | #endif 27 | 28 | /* 29 | * file.c 30 | */ 31 | 32 | int legal_path PROT((char *)); 33 | char *check_valid_path PROT((char *, object_t *, char *, int)); 34 | void smart_log PROT((char *, int, char *, int)); 35 | void dump_file_descriptors PROT((outbuffer_t *)); 36 | 37 | char *read_file PROT((char *, int, int)); 38 | char *read_bytes PROT((char *, int, int, int *)); 39 | int write_file PROT((char *, char *, int)); 40 | int write_bytes PROT((char *, int, char *, int)); 41 | array_t *get_dir PROT((char *, int)); 42 | int tail PROT((char *)); 43 | int file_size PROT((char *)); 44 | int copy_file PROT((char *, char *)); 45 | int do_rename PROT((char *, char *, int)); 46 | int remove_file PROT((char *)); 47 | 48 | #ifdef DEBUGMALLOC_EXTENSIONS 49 | void mark_file_sv PROT((void)); 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /compat/simuls/tail.c: -------------------------------------------------------------------------------- 1 | #ifdef COMPAT_TAIL 2 | /* This version is strictly compatible with the old version */ 3 | int tail(string fname) { 4 | string str; 5 | int offset = file_size(fname); 6 | 7 | if (offset < 0) 8 | return 0; 9 | 10 | offset -= 54 * 20; 11 | if (offset < 0) offset = 0; 12 | str = read_bytes(fname, offset, 1080); 13 | if (!str) return 0; 14 | if (offset) str = str[strsrch(str, "\n")+1..]; 15 | write(str); 16 | 17 | return 1; 18 | } 19 | #else 20 | /* This version is slightly extended and compatible in spirit, but doesn't 21 | * reproduce the oddities of the original tail() efun. Note that it also 22 | * returns the string, so write(tail(fname)) is needed for strict 23 | * compatibility. 24 | */ 25 | varargs string tail(string fname, int nlines) { 26 | int chunk = nlines * 80; 27 | int offset = file_size(fname); 28 | int num_nl, p, skip; 29 | string str = ""; 30 | 31 | while (offset > 0 && num_nl <= nlines) { 32 | num_nl = 0; 33 | offset -= chunk; 34 | if (offset < 0) { 35 | chunk += offset; /* negative */ 36 | offset = 0; 37 | } 38 | str = read_bytes(fname, offset, chunk) + str; 39 | p = -1; 40 | while (p < sizeof(str)-1 && p = member_array('\n', str, p+1)) 41 | num_nl++; 42 | } 43 | skip = num_nl - nlines; 44 | p = -1; 45 | while (skip--) 46 | p = member_array('\n', str, p+1); 47 | return str[p..]; 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /malloc.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_MALLOC_H 2 | #define MY_MALLOC_H 3 | 4 | /* 5 | * to use sysmalloc or malloc replacements 6 | */ 7 | #if defined(SYSMALLOC) || \ 8 | (defined(SMALLOC) && defined(SBRK_OK)) || \ 9 | defined(BSDMALLOC) 10 | #define MALLOC(x) malloc(x) 11 | #define FREE(x) free(x) 12 | #define REALLOC(x,y) realloc(x,y) 13 | #define CALLOC(x,y) calloc(x,y) 14 | 15 | #endif 16 | 17 | /* smalloc - choice between replacement or wrapper */ 18 | #if defined(SMALLOC) && !defined(SYSMALLOC) 19 | # ifdef SBRK_OK 20 | # define smalloc_malloc malloc 21 | # define smalloc_free free 22 | # define smalloc_realloc realloc 23 | # define smalloc_calloc calloc 24 | # else 25 | # define MALLOC(x) smalloc_malloc(x) 26 | # define FREE(x) smalloc_free(x) 27 | # define REALLOC(x,y) smalloc_realloc(x,y) 28 | # define CALLOC(x,y) smalloc_calloc(x,y) 29 | # endif 30 | #endif 31 | 32 | /* bsdmalloc - always a replacement */ 33 | #if defined(BSDMALLOC) && !defined(SYSMALLOC) 34 | # define bsdmalloc_malloc malloc 35 | # define bsdmalloc_free free 36 | # define bsdmalloc_realloc realloc 37 | # define bsdmalloc_calloc calloc 38 | #endif 39 | 40 | #define DXALLOC(x,tag,desc) xalloc(x) 41 | #define DMALLOC(x,tag,desc) MALLOC(x) 42 | #define DREALLOC(x,y,tag,desc) REALLOC(x,y) 43 | #define DCALLOC(x,y,tag,desc) CALLOC(x,y) 44 | 45 | #endif /* MY_MALLOC_H */ 46 | -------------------------------------------------------------------------------- /my_malloc.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_MALLOC_H 2 | #define MY_MALLOC_H 3 | 4 | /* 5 | * to use sysmalloc or malloc replacements 6 | */ 7 | #if defined(SYSMALLOC) || \ 8 | (defined(SMALLOC) && defined(SBRK_OK)) || \ 9 | defined(BSDMALLOC) 10 | #define MALLOC(x) malloc(x) 11 | #define FREE(x) free(x) 12 | #define REALLOC(x,y) realloc(x,y) 13 | #define CALLOC(x,y) calloc(x,y) 14 | 15 | #endif 16 | 17 | /* smalloc - choice between replacement or wrapper */ 18 | #if defined(SMALLOC) && !defined(SYSMALLOC) 19 | # ifdef SBRK_OK 20 | # define smalloc_malloc malloc 21 | # define smalloc_free free 22 | # define smalloc_realloc realloc 23 | # define smalloc_calloc calloc 24 | # else 25 | # define MALLOC(x) smalloc_malloc(x) 26 | # define FREE(x) smalloc_free(x) 27 | # define REALLOC(x,y) smalloc_realloc(x,y) 28 | # define CALLOC(x,y) smalloc_calloc(x,y) 29 | # endif 30 | #endif 31 | 32 | /* bsdmalloc - always a replacement */ 33 | #if defined(BSDMALLOC) && !defined(SYSMALLOC) 34 | # define bsdmalloc_malloc malloc 35 | # define bsdmalloc_free free 36 | # define bsdmalloc_realloc realloc 37 | # define bsdmalloc_calloc calloc 38 | #endif 39 | 40 | #define DXALLOC(x,tag,desc) xalloc(x) 41 | #define DMALLOC(x,tag,desc) MALLOC(x) 42 | #define DREALLOC(x,y,tag,desc) REALLOC(x,y) 43 | #define DCALLOC(x,y,tag,desc) CALLOC(x,y) 44 | 45 | #endif /* MY_MALLOC_H */ 46 | -------------------------------------------------------------------------------- /applies: -------------------------------------------------------------------------------- 1 | __INIT:#global_init# 2 | ADJECTIVE:parse_command_adjectiv_id_list 3 | CATCH_TELL 4 | CLEAN_UP 5 | CREATE 6 | DESTRUCTOR 7 | ID 8 | INIT 9 | LOGON 10 | MOVE:move_or_destruct 11 | NET_DEAD 12 | NOUN:parse_command_id_list 13 | PLURAL:parse_command_plural_id_list 14 | PROCESS_INPUT 15 | QGET_ADJID:parse_command_adjective_id_list 16 | QGET_ID:parse_command_id_list 17 | QGET_PLURID:parse_command_plural_id_list 18 | RECEIVE_MESSAGE 19 | RECEIVE_SNOOP 20 | RESET 21 | TELNET_SUBOPTION 22 | TERMINAL_TYPE 23 | WINDOW_SIZE 24 | WRITE_PROMPT 25 | # master applies 26 | AUTHOR_FILE 27 | COMPILE_OBJECT 28 | CONNECT 29 | CRASH 30 | CREATOR_FILE 31 | DOMAIN_FILE 32 | EPILOG 33 | ERROR_HANDLER 34 | GET_BACKBONE_UID:get_bb_uid 35 | GET_ED_BUFFER_SAVE_FILE_NAME:get_save_file_name 36 | GET_ROOT_UID 37 | LOG_ERROR 38 | MAKE_PATH_ABSOLUTE 39 | FLAG 40 | OBJECT_NAME 41 | PARSER_ERROR_MESSAGE 42 | PRELOAD 43 | PRIVS_FILE 44 | RETRIEVE_ED_SETUP 45 | SAVE_ED_SETUP 46 | SLOW_SHUTDOWN 47 | USERS:parse_command_users 48 | VALID_ASM 49 | VALID_BIND 50 | VALID_COMPILE_TO_C 51 | VALID_DATABASE 52 | VALID_HIDE 53 | VALID_LINK 54 | LITERALS:parse_command_prepos_list 55 | VALID_OBJECT 56 | VALID_OVERRIDE 57 | QGET_ALLWORD:parse_command_all_word 58 | QGET_PREPOS:parse_command_prepos_list 59 | VALID_READ 60 | VALID_SAVE_BINARY 61 | VALID_SETEUID 62 | VALID_SHADOW 63 | VALID_SOCKET 64 | VALID_WRITE 65 | PARSE_FIRST_INVENTORY:parse_get_first_inventory 66 | PARSE_NEXT_INVENTORY:parse_get_next_inventory 67 | PARSE_ENVIRONMENT:parse_get_environment 68 | -------------------------------------------------------------------------------- /addr_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * addr_server.h -- definitions and prototypes for addr_server.c 3 | * 8-92 : Dwayne Fontenot : original coding. 4 | */ 5 | 6 | #ifndef ADDR_SERVER_H 7 | #define ADDR_SERVER_H 8 | 9 | #include "network_incl.h" 10 | 11 | #define DFAULT_PROTO 0 /* use the appropriate protocol */ 12 | #define MAX_CONNS 4 /* max number of connections */ 13 | #define SNAME_LEN 64 /* length of symbolic name string */ 14 | #define MAX_EVENTS_IN_QUEUE 100 15 | #define MAX_EVENTS_TO_PROCESS 100 16 | #define IN_BUF_SIZE 100 17 | 18 | enum conn_states { 19 | CONN_CLOSED, CONN_OPEN 20 | }; 21 | 22 | enum ev_type { 23 | NEW_CONN, CONN 24 | }; 25 | 26 | enum msgtypes { 27 | NAMEBYIP = 0, IPBYNAME, DATALEN 28 | }; 29 | 30 | typedef struct conn *conn_ptr; 31 | 32 | typedef struct conn { 33 | int fd; /* file descriptor */ 34 | int state; /* connection state */ 35 | struct sockaddr_in addr; /* address struct for connected */ 36 | char sname[SNAME_LEN]; /* symbolic name of connected host */ 37 | int leftover; /* unprocessed bytes in data queue */ 38 | char buf[IN_BUF_SIZE]; 39 | } connection; 40 | 41 | typedef struct queue_elem *queue_element_ptr; 42 | 43 | typedef struct queue_elem { 44 | short event_type; /* event type */ 45 | int fd; /* file descriptor on which data is pending */ 46 | queue_element_ptr next; 47 | } queue_element; 48 | 49 | #endif /* _ADDR_SERVER_H_ */ 50 | -------------------------------------------------------------------------------- /wrappedmalloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | wrapper functions for system malloc -- keep malloc stats. 3 | Truilkan@TMI - 92/04/17 4 | */ 5 | 6 | #define IN_MALLOC_WRAPPER 7 | #define NO_OPCODES 8 | #include "std.h" 9 | #include "my_malloc.h" 10 | #include "lpc_incl.h" 11 | #include "comm.h" 12 | 13 | typedef struct stats_s { 14 | unsigned int free_calls, alloc_calls, realloc_calls; 15 | } stats_t; 16 | 17 | static stats_t stats; 18 | 19 | void wrappedmalloc_init() 20 | { 21 | stats.free_calls = 0; 22 | stats.alloc_calls = 0; 23 | stats.realloc_calls = 0; 24 | } 25 | 26 | INLINE void *wrappedrealloc P2(void *, ptr, int, size) 27 | { 28 | stats.realloc_calls++; 29 | return (void *) REALLOC(ptr, size); 30 | } 31 | 32 | INLINE void *wrappedmalloc P1(int, size) 33 | { 34 | stats.alloc_calls++; 35 | return (void *) MALLOC(size); 36 | } 37 | 38 | INLINE void *wrappedcalloc P2(int, nitems, int, size) 39 | { 40 | stats.alloc_calls++; 41 | return (void *) CALLOC(nitems, size); 42 | } 43 | 44 | INLINE void wrappedfree P1(void *, ptr) 45 | { 46 | stats.free_calls++; 47 | FREE(ptr); 48 | } 49 | 50 | void dump_malloc_data P1(outbuffer_t *, ob) 51 | { 52 | outbuf_add(ob, "using wrapped malloc:\n\n"); 53 | outbuf_addv(ob, "#alloc calls: %10lu\n", stats.alloc_calls); 54 | outbuf_addv(ob, "#free calls: %10lu\n", stats.free_calls); 55 | outbuf_addv(ob, "#alloc - #free: %10lu\n", 56 | stats.alloc_calls - stats.free_calls); 57 | outbuf_addv(ob, "#realloc calls: %10lu\n", stats.realloc_calls); 58 | } 59 | -------------------------------------------------------------------------------- /Platforms: -------------------------------------------------------------------------------- 1 | MudOS v22.2 should compile and run on the following systems: 2 | 3 | DEC Alpha (OSF/1 1.2) 4 | NeXTstation/NeXTcube (NeXT 2.1 and 3.0, 3.1, 3.2) 5 | RS/6000 (AIX 3.x, 4.x) 6 | Sun3 (SunOS) 7 | Sun4 (SunOS 4.x) 8 | Sun4 (SunOS 5.x) 9 | DECstation 2100/3100/5000 (Ultrix 3.1, 4.x) 10 | VAX (Ultrix) 11 | HP Apollo 12 | HP PA-RISC (HP-UX 7.x, 8.x, 9.0x) 13 | HP 68k Motorola (HP-UX) 14 | HP 68k Motorola (BSD 4.3) 15 | Silicon Graphics Indigo, 4D/x and RS4000 Series (IRIX release 4.0.5F, 5.2, 5.3) 16 | Sequent Symmetry (DYNIX/ptx 1.4, 2.0) 17 | Mac Quadra (A/UX 3.0) 18 | Ridge (RISC/os) 19 | IBM PC (Linux 2.2.x and higher) 20 | IBM PC (System V Release 4) 21 | IBM PC (NetBSD, FreeBSD, 386BSD, etc.) 22 | IBM PC (Windows 95/NT using Visual C++; see the windows/ subdirectory) 23 | Amiga (AmigaDOS using the LATTICE C or SAS/C compiler, or Linux, or gcc) 24 | Macintosh OS X (Darwin) 25 | 26 | *Send mail to marius@mudos.org if you experience any problems 27 | compiling or running on these systems. Note that some of these machines have 28 | old versions of yacc and do require bison (a yacc replacement) to compile 29 | MudOS correctly. If you manage to compile and run MudOS on a system other 30 | than one listed here, please send the diffs along with machine and OS 31 | information to the mudos-bugs address. 32 | 33 | NOTE: MudOS is NOT officially supported on Windows 95/98/NT/2K. If you can get 34 | it to work, great. If not, too bad. Official support will be forthcoming in 35 | v23. 36 | 37 | MSDOS versions of MudOS are available in the /pub/mud/servers/lpc/mudos/msdos 38 | directory on ftp.ccs.neu.edu. 39 | -------------------------------------------------------------------------------- /windows/README.win32: -------------------------------------------------------------------------------- 1 | MudOS for Windows 95 and Windows NT 2 | Port by George Reese (Descartes of Borg) 3 | 4 | This port has a few crashers in it. Known bugs include: 5 | * connect() gives an WASEWOULDBLOCK error (*boggle*) 6 | for connecting to the address server or socket efuns 7 | * bug in reading DOS files (files with \r\n) 8 | this is probably fixed in v21.6 9 | * some bug in call outs 10 | * Right now the proper calls to WSAGetLastError() are not made 11 | 12 | This is not a simple compile yet, unfortunately. Perhaps someone can 13 | fix the above bugs and simplify the make process? If so, please mail 14 | your fixes to beek@imaginary.com. 15 | 16 | To compile MudOS for Windows NT/95, you need: 17 | MS VC++ 2.0 or later (dunno about Borland or other compilers) 18 | gnu bison and sed, get them from ftp.cc.utexas.edu in the winnt section 19 | 20 | Steps: 21 | 0. move the .mak and .bat files in this directory to the main source directory 22 | and run CLEAN.BAT - this removes all files generated during compile 23 | 1. Open up edit_source.mak 24 | 2. From the command prompt run STEP1.BAT 25 | 3. Build edit_source.exe 26 | 4. From the DOS command line, execute STEPDBG.BAT (in case you're building 27 | debug version) or STEPREL.BAT (in case you're building release ver) 28 | 5. Open up mudos.mak 29 | 6. Build mudos.exe 30 | 7. Open addr_server.mak 31 | 8. Build addr_server.exe 32 | 9. Install your lib and run mudos 33 | 34 | Note: if you want to create a DEBUG version of MudOS you have to define 35 | DEBUG symbol either in STD.H or in project setting in both EDIT_SOURCE and 36 | MUDOS. -------------------------------------------------------------------------------- /amiga/signal_rr.c: -------------------------------------------------------------------------------- 1 | /* hosts/amiga/signal_rr.c 2 | ** 3 | ** Just the exception catcher -- it needs registerized args (-mRR) which 4 | ** are not used elsewhere. 5 | ** 6 | ** 28-Feb-93 [lars] Done for DICE 2.07.53 7 | */ 8 | 9 | #include 10 | #ifdef INCLUDE_VERSION 11 | #include 12 | #else 13 | #include 14 | #endif 15 | #include "nsignal.h" 16 | extern __stkargs ULONG SetSignal(unsigned long newSignals, unsigned long signalSet); 17 | 18 | 19 | /*-----------------------------------------------------------------------*/ 20 | 21 | extern ULONG sys_signal_alarm, /* The system-signal-masks */ 22 | sys_signal_hup, sys_signal_usr; 23 | 24 | extern void (*handler_hup) (void), (*handler_alarm) (void), (*handler_usr) (void); 25 | 26 | /*----------------------------------------------------------------------- 27 | ** ULONG catch_exception (ULONG mask) 28 | ** 29 | ** Called by the OS if the task gets an exception, this dispatch to 30 | ** the appropriate signal-function. 31 | ** Note that the std-raise() also removes the handler, so our functions 32 | ** are called manually. 33 | */ 34 | 35 | __regargs __geta4 ULONG catch_exception(__D0 ULONG mask) 36 | { 37 | /* Handle our special exceptions */ 38 | if (mask & sys_signal_alarm) 39 | (*handler_alarm) (); 40 | if (mask & sys_signal_hup) 41 | (*handler_hup) (); 42 | if (mask & sys_signal_usr) 43 | (*handler_usr) (); 44 | /* Stop select() anyway */ 45 | SetSignal(EXT_SIGINT, EXT_SIGINT); 46 | return mask; 47 | } 48 | 49 | /*************************************************************************/ 50 | -------------------------------------------------------------------------------- /testsuite/command/tests.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(string fun); 4 | 5 | void recurse(string dir) { 6 | mixed leaks; 7 | 8 | foreach (string file in get_dir(dir + "*.c")) 9 | main(dir + file); 10 | foreach (string subdir in map(filter(get_dir(dir + "*", -1), 11 | (: $1[1] == -2 :)), 12 | (: $1[0] :)) - ({ ".", ".." })) 13 | { 14 | if (subdir == "fail") { 15 | foreach (string fn in get_dir(dir + "fail/*.c")) { 16 | ASSERT2(catch(load_object(dir+"fail/"+fn)), "fail/" + fn + " loaded"); 17 | #if defined(__DEBUGMALLOC_EXTENSIONS__) && defined(__CHECK_MEMORY__) 18 | leaks = check_memory(); 19 | if (sizeof(filter(explode(leaks, "\n"), (: $1 && $1[0] :))) != 1) { 20 | write("After trying to compile: " + dir + "fail/" + fn + "\n"); 21 | write(leaks); 22 | error("LEAK\n"); 23 | } 24 | #endif 25 | } 26 | rm("/log/compile"); 27 | } else 28 | recurse(dir + subdir + "/"); 29 | } 30 | } 31 | 32 | int 33 | main(string fun) 34 | { 35 | string leaks; 36 | object tp = this_player(); 37 | 38 | if (!fun || fun == "") { 39 | recurse("/single/tests/"); 40 | write("Checks succeeded.\n"); 41 | return 1; 42 | } 43 | fun->do_tests(); 44 | if (tp != this_player()) 45 | error("Bad this_player() after calling " + fun + "\n"); 46 | #if defined(__DEBUGMALLOC_EXTENSIONS__) && defined(__CHECK_MEMORY__) 47 | leaks = check_memory(); 48 | if (sizeof(filter(explode(leaks, "\n"), (: $1 && $1[0] :))) != 1) { 49 | write("After calling: " + fun + "\n"); 50 | write(leaks); 51 | error("LEAK\n"); 52 | } 53 | #endif 54 | return 1; 55 | } 56 | -------------------------------------------------------------------------------- /compat/parser_error.c: -------------------------------------------------------------------------------- 1 | string parser_error_message(int kind, object ob, mixed arg, int flag) { 2 | string ret; 3 | if (ob) 4 | ret = ob->short() + ": "; 5 | else 6 | ret = ""; 7 | 8 | switch (kind) { 9 | case 1: 10 | if (flag) 11 | return ret + "There is no such " + arg + " here.\n"; 12 | else 13 | return ret + "There is no " + arg + " here.\n"; 14 | break; 15 | case 2: 16 | if (flag) 17 | return ret + "None of the " + pluralize(arg) + " are alive.\n"; 18 | else 19 | return ret + "The " + arg + " isn't alive.\n"; 20 | break; 21 | case 3: 22 | if (flag) 23 | return ret + "You can't reach them.\n"; 24 | else 25 | return ret + "You can't reach it.\n"; 26 | break; 27 | case 4: 28 | { 29 | array descs = unique_array(arg, (: $1->the_short() :)); 30 | string str; 31 | 32 | if (sizeof(descs) == 1) 33 | return ret + "Which " + descs[0][0]->short() + " do you mean?\n"; 34 | str = ret + "Do you mean "; 35 | for (int i = 0; i < sizeof(descs); i++) { 36 | if (sizeof(descs[i]) > 1) 37 | str += "one of "; 38 | str += descs[i][0]->the_short(); 39 | if (i == sizeof(descs) - 1) 40 | str += " or "; 41 | else 42 | str += ", "; 43 | } 44 | return str + "?\n"; 45 | } 46 | break; 47 | case 5: 48 | if (arg > 1) 49 | return ret + "There are only " + arg + " of them.\n"; 50 | else 51 | return ret + "There is only one of them.\n"; 52 | break; 53 | case 6: 54 | return ret + arg; 55 | case 7: 56 | return ret + "There is no " + arg + " here.\n"; 57 | case 8: 58 | return ret + "You can't use more than one object at a time with that verb.\n"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /generate.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERATE_H 2 | #define _GENERATE_H 3 | 4 | #include "lint.h" 5 | #include "trees.h" 6 | #include "lpc_incl.h" 7 | #include "icode.h" 8 | 9 | #ifdef LPC_TO_C 10 | #include "ccode.h" 11 | 12 | #define generate_function_call(x,y) { if(compile_to_c) c_generate_function_call(x,y); else i_generate_function_call(x,y); } 13 | #define generate_inherited_init_call(x,y) { if (compile_to_c) c_generate_inherited_init_call(x,y); else i_generate_inherited_init_call(x,y); } 14 | #define generate___INIT() { if (compile_to_c) c_generate___INIT(); else i_generate___INIT(); } 15 | #define generate_final_program(x) { if (compile_to_c) c_generate_final_program(x); else i_generate_final_program(x); } 16 | #define initialize_parser() { if (compile_to_c) c_initialize_parser(); else i_initialize_parser(); } 17 | #define uninitialize_parser() { if (compile_to_c) c_uninitialize_parser(); else i_uninitialize_parser(); } 18 | #else 19 | #define generate_function_call i_generate_function_call 20 | #define generate_inherited_init_call i_generate_inherited_init_call 21 | #define generate___INIT i_generate___INIT 22 | #define generate_final_program i_generate_final_program 23 | #define initialize_parser i_initialize_parser 24 | #define uninitialize_parser i_uninitialize_parser 25 | #endif 26 | 27 | int node_always_true PROT((parse_node_t *)); 28 | short generate PROT((parse_node_t *)); 29 | short generate_function PROT((function_t *, parse_node_t *, int)); 30 | int generate_conditional_branch PROT((parse_node_t *)); 31 | 32 | #ifdef DEBUG 33 | void dump_expr_list PROT((parse_node_t *)); 34 | void dump_tree PROT((parse_node_t *)); 35 | void lpc_tree_form PROT((parse_node_t *, parse_node_t *)); 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /debug.h: -------------------------------------------------------------------------------- 1 | /* debug.h: added by Truilkan: 92/02/08 */ 2 | 3 | /* this include file adds some nice debugging capabilities. You can 4 | use -DDEBUG_MACRO in CFLAGS in the Makefile to let the debug code 5 | be compiled in. If DEBUG_MACRO is not defined then the debug code 6 | is removed by the C preprocessor. The global variable debug_level 7 | is defined in main.c. The debug_level typically starts out at zero 8 | (0) and slowly grows larger over the life of the program. The main 9 | advantage to this debug macro is that you can turn various sets of 10 | debug statements of and on by changing the value of debug_level. 11 | Say for example that debug_level is set to 7; then, all debug() 12 | statements with a first argument of 1, 2, or 4 would be printed. If 13 | debug_level is 6, then only debug()'s with 2 or 4 as the first arg 14 | would be printed. Sample usage is as follows: 15 | 16 | debug(4,("module.c: simulate(): x = %d, y = %d\n",x,y)); 17 | */ 18 | 19 | #ifndef _FUNC_SPEC_ 20 | extern int debug_level; 21 | 22 | void handle_debug_level PROT((char *)); 23 | void debug_level_set PROT((char *)); 24 | void debug_level_clear PROT((char *)); 25 | 26 | #ifdef DEBUG_MACRO 27 | #define debug(x,y) if (debug_level & DBG_##x) { printf("%s: ", #x); printf y; putchar('\n'); fflush(stdout); } 28 | #else 29 | #define debug(x,y) 30 | #endif 31 | 32 | /* Would be nice to have tons of these; should go to arbitrary bitsets */ 33 | #define DBG_call_out 1 34 | #define DBG_addr_server 2 35 | #define DBG_d_flag 4 36 | #define DBG_connections 8 37 | #define DBG_mapping 16 38 | #define DBG_sockets 32 39 | #define DBG_comp_func_tab 64 40 | #define DBG_LPC 128 41 | #define DBG_LPC_line 256 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /scratchpad.h: -------------------------------------------------------------------------------- 1 | #ifndef _SCRATCHPAD_H 2 | #define _SCRATCHPAD_H 3 | 4 | /* Tim Hollebeek 5 | * 6 | * The data must also consist of zero terminated chunks, with lengths in the 7 | * range 0 < len < 256. Longer things can be handled, but they're just 8 | * malloc'ed. 9 | * 10 | * Designed to be used by the compile stack (if pointers get popped off due 11 | * to errors, we don't have to worry about them b/c we'll reclaim the space 12 | * when we throw away the scratchpad; this is another advantage), it could 13 | * be used by other things as well. 14 | */ 15 | 16 | #define SCRATCHPAD_SIZE 4096 17 | #define SDEBUG(x) 18 | #define SDEBUG2(x) 19 | 20 | #define SCRATCH_MAGIC ((unsigned char)0xbb) 21 | 22 | typedef struct sp_block_s { 23 | struct sp_block_s *next, *prev; 24 | char block[2]; /* block[0] must be nonzero, usually SCRATCH_MAGIC */ 25 | } sp_block_t; 26 | 27 | #define scratch_free_last() \ 28 | scr_tail = --scr_last; \ 29 | scr_last -= *scr_tail; \ 30 | while (!(*scr_last) && scr_tail != scr_last) { \ 31 | /* check if the one before was already freed */ \ 32 | scr_tail = --scr_last; \ 33 | scr_last -= *scr_tail; \ 34 | } 35 | 36 | extern unsigned char *scr_last; 37 | extern unsigned char *scr_tail; 38 | extern unsigned char *scratch_end; 39 | 40 | /* 41 | * scratchpad.c 42 | */ 43 | void scratch_destroy PROT((void)); 44 | char *scratch_copy PROT((char *)); 45 | char *scratch_alloc PROT((int)); 46 | void scratch_free PROT((char *)); 47 | char *scratch_join PROT((char *, char *)); 48 | char *scratch_join2 PROT((char *, char *)); 49 | char *scratch_realloc PROT((char *, int)); 50 | char *scratch_copy_string PROT((char *)); 51 | char *scratch_large_alloc PROT((int)); 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /amiga/amiga.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amiga include file for MudOS 3 | * By Wildcard (umfehr06@ccu.umanitoba.ca) 4 | */ 5 | 6 | #ifndef AMIGA_AMIGA_H 7 | #define AMIGA_AMIGA_H 8 | 9 | /* file.c */ 10 | #define _IFIFO 0010000 11 | #define _IFCHR 0020000 12 | #define _IFBLK 0060000 13 | #define _IFLNK 0120000 14 | #define S_IFCHR _IFCHR 15 | #define S_IFBLK _IFBLK 16 | #define S_IFIFO _IFIFO 17 | #define S_IFLNK _IFLNK 18 | 19 | /* comm.c, file.c, backend.c, main.c, socket_efuns.c, addr_server.c */ 20 | #define NBBY 8 21 | #define howmany(x, y) (((x)+((y)-1))/(y)) 22 | #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) 23 | #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) 24 | #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) 25 | 26 | /* comm.c */ 27 | #define TELOPT_ECHO 1 28 | #define TELOPT_SGA 3 29 | #define TELOPT_TM 6 30 | #define EOR 239 31 | #define SE 240 32 | #define NOP 241 33 | #define DM 242 34 | #define BREAK 243 35 | #define IP 244 36 | #define AO 245 37 | #define AYT 246 38 | #define EC 247 39 | #define EL 248 40 | #define GA 249 41 | #define SB 250 42 | #define WILL 251 43 | #define WONT 252 44 | #define DO 253 45 | #define DONT 254 46 | #define IAC 255 47 | #define MSG_OOB 0x1 48 | 49 | /* mudlib_stats.c */ 50 | #define MAXPATHLEN 1024 51 | 52 | /* socket_efuns.c */ 53 | #define EINPROGRESS 36 54 | #define EALREADY 37 55 | #define ECONNREFUSED 61 56 | 57 | 58 | /* 59 | * broken c.lib routine missing support for permissions 60 | */ 61 | #define mkdir(a,b) mkdir(a) 62 | 63 | /* 64 | * missing from the "standard" include files 65 | */ 66 | int gethostname PROT((char *, int)); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /compat/Debug/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include subdir.mk 12 | -include testsuite/subdir.mk 13 | -include testsuite/single/subdir.mk 14 | -include testsuite/single/tests/operators/subdir.mk 15 | -include testsuite/single/tests/efuns/subdir.mk 16 | -include testsuite/single/tests/compiler/subdir.mk 17 | -include testsuite/single/tests/compiler/fail/subdir.mk 18 | -include testsuite/inherit/subdir.mk 19 | -include testsuite/inherit/master/subdir.mk 20 | -include testsuite/command/subdir.mk 21 | -include testsuite/clone/subdir.mk 22 | -include packages/subdir.mk 23 | -include mudlib/subdir.mk 24 | -include compat/simuls/subdir.mk 25 | -include compat/subdir.mk 26 | -include amiga/subdir.mk 27 | -include Win32/subdir.mk 28 | -include objects.mk 29 | 30 | ifneq ($(MAKECMDGOALS),clean) 31 | ifneq ($(strip $(C_DEPS)),) 32 | -include $(C_DEPS) 33 | endif 34 | endif 35 | 36 | -include ../makefile.defs 37 | 38 | # Add inputs and outputs from these tool invocations to the build variables 39 | 40 | # All Target 41 | all: mudos 42 | 43 | # Tool invocations 44 | mudos: $(OBJS) $(USER_OBJS) 45 | @echo 'Building target: $@' 46 | @echo 'Invoking: GCC C Linker' 47 | gcc -o"mudos" $(OBJS) $(USER_OBJS) $(LIBS) 48 | @echo 'Finished building target: $@' 49 | @echo ' ' 50 | 51 | # Other Targets 52 | clean: 53 | -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) mudos 54 | -@echo ' ' 55 | 56 | .PHONY: all clean dependents 57 | .SECONDARY: 58 | 59 | -include ../makefile.targets 60 | -------------------------------------------------------------------------------- /function.h: -------------------------------------------------------------------------------- 1 | #ifndef FUNCTION_H 2 | #define FUNCTION_H 3 | 4 | /* It is usually better to include "lpc_incl.h" instead of including this 5 | directly */ 6 | 7 | /* FP_LOCAL */ 8 | typedef struct { 9 | short index; 10 | } local_ptr_t; 11 | 12 | /* FP_SIMUL */ 13 | typedef local_ptr_t simul_ptr_t; 14 | 15 | /* FP_EFUN */ 16 | typedef local_ptr_t efun_ptr_t; 17 | 18 | /* FP_FUNCTIONAL */ 19 | typedef struct { 20 | /* these two must come first */ 21 | unsigned char num_arg; 22 | unsigned char num_local; 23 | #ifndef LPC_TO_C 24 | short offset; 25 | #else 26 | POINTER_INT offset; 27 | #endif 28 | struct program_s *prog; 29 | short fio, vio; 30 | } functional_t; 31 | 32 | /* common header */ 33 | typedef struct { 34 | unsigned short ref; 35 | short type; /* FP_* is used */ 36 | #ifdef DEBUG 37 | int extra_ref; 38 | #endif 39 | struct object_s *owner; 40 | struct array_s *args; 41 | } funptr_hdr_t; 42 | 43 | typedef struct funptr_s { 44 | funptr_hdr_t hdr; 45 | union { 46 | efun_ptr_t efun; 47 | local_ptr_t local; 48 | simul_ptr_t simul; 49 | functional_t functional; 50 | } f; 51 | } funptr_t; 52 | 53 | union string_or_func { 54 | funptr_t *f; 55 | char *s; 56 | }; 57 | 58 | void dealloc_funp PROT((funptr_t *)); 59 | void push_refed_funp PROT((funptr_t *)); 60 | INLINE void push_funp PROT((funptr_t *)); 61 | INLINE void free_funp PROT((funptr_t *)); 62 | int merge_arg_lists PROT((int, struct array_s *, int)); 63 | INLINE funptr_t *make_efun_funp PROT((int, struct svalue_s *)); 64 | INLINE funptr_t *make_lfun_funp PROT((int, struct svalue_s *)); 65 | INLINE funptr_t *make_simul_funp PROT((int, struct svalue_s *)); 66 | INLINE funptr_t *make_functional_funp PROT((short, short, short, 67 | struct svalue_s *, int)); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /md.h: -------------------------------------------------------------------------------- 1 | /* used by md.c (the malloc debug module) */ 2 | 3 | #if defined(CHECK_MEMORY) && !defined(DEBUGMALLOC_EXTENSIONS) 4 | #undef CHECK_MEMORY 5 | #endif 6 | 7 | typedef struct md_node_s { 8 | int size; 9 | struct md_node_s *next; 10 | #ifdef DEBUGMALLOC_EXTENSIONS 11 | int id; 12 | int tag; 13 | char *desc; 14 | #endif 15 | #ifdef CHECK_MEMORY 16 | int magic; 17 | #endif 18 | } md_node_t; 19 | 20 | #ifdef CHECK_MEMORY 21 | #define MD_OVERHEAD (sizeof(md_node_t) + sizeof(int)) 22 | #define MD_MAGIC 0x4bee4bee 23 | 24 | void check_all_blocks PROT((int)); 25 | #else 26 | #define MD_OVERHEAD (sizeof(md_node_t)) 27 | #endif 28 | 29 | #define MD_TABLE_BITS 14 30 | #define MD_TABLE_SIZE (1 << MD_TABLE_BITS) 31 | #define MD_HASH(x) (((unsigned int)x >> 3) & (MD_TABLE_SIZE - 1)) 32 | 33 | #define PTR(x) ((void *)(x + 1)) 34 | #define NODET_TO_PTR(x, y) ((y)(x + 1)) 35 | #define PTR_TO_NODET(x) ((md_node_t *)(x) - 1) 36 | 37 | #define DO_MARK(ptr, kind) if (PTR_TO_NODET(ptr)->tag != kind) \ 38 | fprintf(stderr, "Expected node of type %04x: got %s %04x\n", \ 39 | kind, PTR_TO_NODET(ptr)->desc, PTR_TO_NODET(ptr)->tag); \ 40 | else PTR_TO_NODET(ptr)->tag |= TAG_MARKED 41 | 42 | #ifdef DEBUGMALLOC_EXTENSIONS 43 | #define SET_TAG(x, y) set_tag(x, y) 44 | #else 45 | #define SET_TAG(x, y) 46 | #endif 47 | 48 | extern int malloc_mask; 49 | extern unsigned int total_malloced; 50 | extern unsigned int hiwater; 51 | void MDinit PROT((void)); 52 | void MDmalloc PROT((md_node_t *, int, int, char *)); 53 | int MDfree PROT((void *)); 54 | 55 | #ifdef DEBUGMALLOC_EXTENSIONS 56 | struct svalue_s; 57 | 58 | void mark_svalue PROT((struct svalue_s *)); 59 | void set_tag PROT((void *, int)); 60 | void check_string_stats PROT((outbuffer_t *)); 61 | #endif 62 | 63 | #define MAX_CATEGORY 130 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /packages/db.h: -------------------------------------------------------------------------------- 1 | #ifndef PACKAGES_DB_H 2 | #define PACKAGES_DB_H 3 | 4 | #ifdef PACKAGE_DB 5 | 6 | #ifdef USE_MSQL 7 | /* MSQL v2 requires this so that it knows the right prototypes */ 8 | #define _OS_UNIX 9 | 10 | #ifdef INCL_LOCAL_MSQL_H 11 | #include "/usr/local/include/msql.h" 12 | #endif 13 | #ifdef INCL_LOCAL_MSQL_MSQL_H 14 | #include "/usr/local/msql/include/msql.h" 15 | #endif 16 | #ifdef INCL_LOCAL_MINERVA_MSQL_H 17 | #include "/usr/local/Minerva/include/msql.h" 18 | #endif 19 | #ifdef INCL_LIB_HUGHES_MSQL_H 20 | #include "/usr/lib/Hughes/include/msql.h" 21 | #endif 22 | #endif 23 | 24 | 25 | #ifdef USE_MYSQL 26 | #include "/usr/include/mysql/mysql.h" 27 | #endif 28 | 29 | typedef union dbconn_u { 30 | #ifdef USE_MSQL 31 | struct tmp_msql { 32 | int handle; 33 | m_result * result_set; 34 | } msql; 35 | #endif 36 | #ifdef USE_MYSQL 37 | struct tmp_mysql { 38 | char errormsg[256]; 39 | MYSQL *handle; 40 | MYSQL_RES *results; 41 | } mysql; 42 | #endif 43 | } dbconn_t; 44 | 45 | /* 46 | * Structure so we can have a lookup table for the specific database 47 | */ 48 | typedef struct db_defn_s { 49 | char *name; 50 | int (*connect)(dbconn_t *, char *, char *, char *, char *); 51 | int (*close)(dbconn_t *); 52 | int (*execute)(dbconn_t *, char *); 53 | array_t * (*fetch)(dbconn_t *, int); 54 | int (*commit)(dbconn_t *); 55 | int (*rollback)(dbconn_t *); 56 | void (*cleanup)(dbconn_t *); 57 | void (*status)(dbconn_t *, outbuffer_t *); 58 | char * (*error)(dbconn_t *); 59 | int (*affected)(dbconn_t *); 60 | } db_defn_t; 61 | 62 | #define DB_FLAG_EMPTY 0x1 63 | 64 | typedef struct _db { 65 | int flags; 66 | db_defn_t *type; 67 | dbconn_t c; 68 | } db_t; 69 | 70 | void db_cleanup PROT((void)); 71 | 72 | #endif /* PACKAGES_DB */ 73 | 74 | #endif /* PACKAGES_DB_H */ 75 | -------------------------------------------------------------------------------- /compat/fixstatic: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl -pi 2 | 3 | # Beek - 970910 4 | # Perl, as a language, is far from my favorite. However, this task is 5 | # a good example of the kind of thing it is great at. It would be hard 6 | # to express this anywhere nearly as concisely in any other language. 7 | 8 | # Note: This script isn't guaranteed to get things 100% correct, but it 9 | # does do a pretty good job of guessing what is meant, and the remaining 10 | # cases shouldn't be hard to fix by hand. 11 | # 12 | # As an example, it gets every instance of 'static' in the Lima mudlib 13 | # correct (all 513 of them!). 14 | # 15 | # Example usage: 16 | # 17 | # find mudlib -name "*.c" -print | xargs /path/to/this/script 18 | 19 | # Note that there is no checking whether things appear in quotes, which is 20 | # probably the most likely way this can mess up. 21 | # 22 | # if it contains an open (, which is not part of a ({, ([, or (:, then it 23 | # is a function prototype or definition 24 | # 25 | # Note: this is wrong for initializers that contain (. For example 26 | # static object this = this_object(); Perhaps we should handle = 27 | # first ... 28 | if (/\([^{[:]/) { 29 | s/static/protected/; 30 | } 31 | # commas and assignments are pretty clear indictations of variables. Note 32 | # that we don't have to worry about commas in argument lists since we have 33 | # already handled lines with (, which must appear between static and any comma. 34 | elsif (/,/ || /=/) { 35 | s/static/nosave/; 36 | } 37 | # static with a ; on the same line implies the entire line is here. If it 38 | # was a prototype, it had a (. Must be a variable. 39 | elsif (/;/) { 40 | s/static/nosave/; 41 | } 42 | # This handles the common practice of doing things like: 43 | # 44 | # static 45 | # void create() { 46 | # 47 | # which is more common than most other uses of static alone on a line 48 | else { 49 | s/static/protected/; 50 | } 51 | -------------------------------------------------------------------------------- /amiga/README: -------------------------------------------------------------------------------- 1 | AMIGA/README 2 | 3 | ***NOTE*** The following instructions are for using SAS/C. If you wish to 4 | compile with gcc instead (which is in fact easier) read the file README-gcc 5 | instead. 6 | 7 | Compiling the driver 8 | ~~~~~~~~~~~~~~~~~~~~ 9 | 10 | At this time, you require: 11 | 12 | SAS/C 13 | a networking package -- either AmiTCP or AS225 14 | 15 | To build the driver, select the appropriate networking package in the 16 | SMakefile, in addition to configuring any other options, and run "smake". 17 | 18 | Note: if using AmiTCP, the logical directories NETINCLUDE: and NETLIB: 19 | should be assigned. 20 | 21 | 22 | Installing and running a mud 23 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | (I assume you've already downloaded the driver...) 25 | 26 | Install a networking package (runtime system) -- AmiTCP or AS225 27 | 28 | Download a mudlib; if an "options.h" file is supplied, copy this to the 29 | main drive source directory; most likely, you'll want to change the 30 | #define for CONFIG_FILE_DIR 31 | 32 | Install the driver; a sample config file is given in "Config.example" 33 | 34 | Edit your config file (eg "config.file") according to where the lib is 35 | located, port number, etc 36 | 37 | Run the driver ("driver config.file") 38 | 39 | Telnet (or letnet) to the mud, eg "telnet localhost 4444", 40 | where 4444 is the assigned port specified in your config file 41 | 42 | 43 | Source notes 44 | ~~~~~~~~~~~~ 45 | 46 | The Amiga support code is courtesy of Martin Brenner, Lars Duening, John 47 | Fehr, and Anthon Pang, and heavily based on the hosts/amiga code included 48 | with adr32. The only major differences are the lack of DICE compiler 49 | support and the simulated sockets code. The omission of the later may 50 | bother some people...so I (A. Pang) will explain why: "I don't like 51 | kludgy code". Moreover, significant changes in the main driver source 52 | would be required. 53 | -------------------------------------------------------------------------------- /testsuite/README: -------------------------------------------------------------------------------- 1 | This directory contains a version of the Lil mudlib with additional code 2 | added to provide a testsuite for MudOS. Currently the testsuite is small 3 | but hopefully it will grow with time (assuming the MudOS developers add 4 | to it). The efun tests are in the ./single/efuns directory with one efun 5 | tested per file (named after the efun). Each efun test should attempt to tell 6 | all (each case/branch) of the driver code that implements that particular 7 | efun. In addition, the efun tests should attempt to fully test the 8 | functionality of the efun (including boundary conditions). Eventually, 9 | tests will be added that ensure all of the eoperators are tested as well. 10 | Currently the only way setup to invoke the tests is to login to Lil 11 | and type 'efun efun_name' e.g. 'efun capitalize'. Eventually there will 12 | be a way to invoke the tests in batch mode via the driver's -f flag. 13 | 14 | -- 15 | 16 | This directory contains a very minimal mudlib named Lil intended for use in 17 | bootstrapping a mudlib to be built from scratch. Anyone who has attempted 18 | to build a mudlib from the ground up knows that the most painful part is 19 | getting the mudlib to the point where the driver will boot up and accept 20 | logins. After this point, its much easier to debug objects because the 21 | driver is actually available to compile the objects and provide feedback 22 | about what might be wrong! Lil is provided to allow that first painful 23 | step to be avoided (useful learning experience though it may be). Also, 24 | we felt that providing a driver that won't run out of the box (and it won't 25 | run without a mudlib) is a bit silly. Yet we didn't want to provide a full 26 | mudlib because we'd rather see many different mudlibs rather than just 27 | variations on a single mudlib (also, there are several complete 28 | MudOS mudlibs available and there isn't any good way to choose which 29 | one we would include). 30 | --------------------------------------------------------------------------------