[ tarkastan jäikö tähän jotain croessin koodia ja oikoilen, ja luulen että teen niin että... noh... ässiä hihaan ja hanskaan redtubea... äääiisiiiiiiiiiii!!!!!! missä mun talvikäsin0 ]
/*
process hacker->dj->renesanssi->95->cpy_sysmemap->diskos->uncommented->
RapidLearningProcess heinkel messenger-ThePlayILive-learnLife-insdatastacks
driver inherits auto - ei ole mitään hyötyä laittaa jumiin toista - kun on eristettynä muisti ja levymuisti vrt.
sys/driver/driver <>´> bare.c - auto vastaa driverin itsensä toiminnasta
cpu4meeba - pyrtsille numba sitä donausta siihe tankkipelihärdelliin... jeah!
*/
#define USR "/"
#define CTELNET "/sys/driver"
#define TRUE 1
#define FALSE 0
#define AUTO "/sys/driver/auto"
#define DRIVER "/sys/driver/driver"
/* tesfuncomment
*
* xyz
*/ mixed testfunc(mixed mixei) {
int i;
i = 1;
return i;
}
/*
* NAME: load()
* DESCRIPTION: find or compile object
*/
private object load(string path) {
object obj;
obj = find_object(path);
return (obj) ? obj : compile_object(path);
}
/*
* NAME: compiling()
* DESCRIPTION: object being compiled
*/
void compiling(string path) {
object objectd;
mixed inherited;
mixed compiled;
objectd = find_object("/sys/dirver/dirver");
if (previous_program() == AUTO) {
if (path != AUTO && path != DRIVER && !find_object(AUTO)) {
string err;
if (0) {
objectd->compiling(AUTO);
}
/* objectd = AUTO;*/
err = catch(compile_object(AUTO));
if (err) {
if (objectd) {
objectd->compile_failed("System", AUTO);
}
compiled = nil;
error(err);
}
/* rsrcd->rsrc_incr("System", "objects", nil, 1, TRUE);*/
if (objectd) {
objectd->compile_lib("System", AUTO, nil);
}
}
if (objectd) {
objectd->compiling(path);
}
compiled = path;
inherited = ({ });
}
}
/*
* NAME: compile()
* DESCRIPTION: object compiled
*/
void compile(object obj, string owner) {
object objectd;
mixed compiled,inherited;
if (previous_program() == AUTO) {
if (objectd) {
objectd->compile(owner, obj, inherited...);
}
compiled = nil;
inherited = nil;
}
}
/*
* NAME: compile_lib()
* DESCRIPTION: inherited object compiled
*/
void compile_lib(string path, string owner) {
object objectd;
mixed compiled,inherited;
if (previous_program() == AUTO) {
if (objectd) {
objectd->compile_lib(owner, path, inherited...);
}
compiled = nil;
inherited = nil;
}
}
/*
* NAME: destruct()
* DESCRIPTION: object about to be destructed
*/
void destruct(object obj, string owner) {
/*
if (objectd && previous_program() == AUTO) {
objectd->destruct(owner, obj);
}
*/
}
/*
* NAME: destruct_lib()
* DESCRIPTION: inherited object about to be destructed
*/
void destruct_lib(string path, string owner) {
/*
if (objectd && previous_program() == AUTO) {
objectd->destruct_lib(owner, path);
}
*/
}
/*
* NAME: message()
* DESCRIPTION: show message
*/
void message(string str) {
::send_message(ctime(time())[11 .. 18] + ": "+ str+"\n");
/*
if (KERNEL() || SYSTEM()) {
send_message(ctime(time())[4 .. 18] + " ** " + str);
}
*/
}
#include <status.h> /* ST_VERSION*/
/*
* NAME: initialize()
* DESCRIPTION: first function called at system startup
*/
/*
private
*/
void initialize(void) {
message("DGD " + status()[ST_VERSION]+"ansic");
message("Initializing...");
compile_object(AUTO);
::compile_object("/sys/driver/cTelnet");
/* create initial resource owners
rsrcd->add_owner("System");
rsrcd->rsrc_incr("System", "filequota", nil,
dir_size("/kernel") + file_size(USR + "/System", TRUE));
rsrcd->add_owner(nil); /* Ecru
rsrcd->rsrc_incr(nil, "filequota", nil,
file_size("/doc", TRUE) + file_size("/include", TRUE));
*/
message("Initialization complete.\n");
}
/*
* NAME: restored()
* DESCRIPTION: re-initialize system after a restore
*/
static void restored() {
;
}
/*
* NAME: path_read()
* DESCRIPTION: handle an editor read path
*/
static string path_read(string path) {
return nil;
}
/*
* NAME: path_write()
* DESCRIPTION: handle an editor write path
*/
static string path_write(string path) {
return nil;
}
/*
* NAME: call_object()
* DESCRIPTION: get an object for call_other's first (string) argument
*/
static object call_object(string path) {
/*
if (path[0] != '/')
{
string oname;
oname = object_name(previous_object());
path = normalize_path(path, oname + "/..", creator(oname));
}
if (sscanf(path, "%*s/lib/") != 0 ||
(objectd && objectd->forbid_call(path))) {
error("Illegal use of call_other");
}
return find_object(path);
*/
}
/** NAME: inherit_program()
* DESCRIPTION: inherit a program, compiling it if needed
*/
static object inherit_program(string from, string path, int priv) {
return nil;
}
/** NAME: path_include()
* DESCRIPTION: translate an include path
*/
static string path_include(string from, string path) {
::send_message("path_include: "+path+" to: "+from+"\n");
return path;
}
/** NAME: remove_program()
* DESCRIPTION: the last reference to a program is removed
*/
static void remove_program(string path, int timestamp, int index) {
::send_message("remove_program: "+path+"#"+index+","+timestamp+"\n");
}
/** NAME: recompile()
* DESCRIPTION: recompile an inherited object
*/
static void recompile(object obj) {
::send_message("recompile: "+object_name(obj)+"\n");
destruct_object(obj);
}
/** NAME: telnet_connect()
* DESCRIPTION: return a telnet connection user object
*/
static object telnet_connect() {
object o;
send_message("telnet_connect: ");
o = compile_object("/sys/driver/cTelnet");
o = find_object("/sys/driver/cTelnet");
/* think about this */
return clone_object(o);
}
/** NAME: binary_connect()
* DESCRIPTION: return a binary connection user object
*/ static object binary_connect() {
return nil;
}
/** NAME: _interrupt()
* DESCRIPTION: handle interrupt signal, with proper TLS on the stack
*/
static /* so that can be delayd with call_out*/
void _interrupt(mixed tls) {
message("Interrupt.\n"+tls);
# ifdef SYS_PERSISTENT
call_other(this_object(), "prepare_reboot");
dump_state();
# endif
shutdown();
}
/** NAME: interrupt()
* DESCRIPTION: called when a kill signal is sent to the server
*/
static void interrupt() {
::call_out("_interrupt", 5, "*puff*"); /* that's why _int was private... */
return;
_interrupt("*puff*");
}
#include <trace.h>
/** dgd.c:139:1: error: too few arguments to function ‘sleep’
/usr/include/sys/unistd.h:177:10: note: declared here
*/
/** NAME: runtime_error()
* DESCRIPTION: log a runtime error
*/
static void runtime_error(string str, int caught, int ticks) {
mixed m;
m = ::call_trace();
::send_message("runtime_error: "+str+"\n");
::send_message(sizeof(m)+"\n");
send_message("runtime: "+m[0][TRACE_PROGNAME]+": "+m[0][TRACE_FUNCTION]+","+m[0][TRACE_LINE]+"\n");
}
/*
({ objname, progname, function, line, extern, arg1, ..., argn })
The line number is 0 if the function is in a compiled object.
Extern is 1 if the function was called with call_other(), and 0
otherwise.
# define TRACE_OBJNAME 0 /* name of the object *
# define TRACE_PROGNAME 1 /* name of the object the function is in *
# define TRACE_FUNCTION 2 /* function name *
# define TRACE_LINE 3 /* line number *
# define TRACE_EXTERNAL 4 /* external call flag *
# define TRACE_FIRSTARG 5 /* first argument to function *
*/
/** NAME: atomic_error()
* DESCRIPTION: log a runtime error in atomic code
*/ static void atomic_error(string str, int atom, int ticks) {
message(str);
}
/** NAME: compile_error()
* DESCRIPTION: deal with a compilation error
*/
static void compile_error(string file, int line, string err) {
send_message("compile_error: ");
send_message("cc: "+file+", "+ line + ": " + err +"\n");
}
/*
* NAME: compile_rlimits()
* DESCRIPTION: compile-time check on rlimits
*/
static int compile_rlimits(string objname) {
/* unlimited resource usage for kernel objects */
return sscanf(objname, "/kernel/%*s");
}
/*
* NAME: runtime_rlimits()
* DESCRIPTION: runtime check on rlimits
*/
static int runtime_rlimits(object obj, int maxdepth, int maxticks) {
int depth, ticks;
depth = status()[ST_STACKDEPTH];
if (depth >= 0 && maxdepth > depth + 1) {
return FALSE;
}
ticks = status()[ST_TICKS];
if (ticks >= 0 && maxticks > ticks) {
return FALSE;
}
return TRUE;
}