gehe zum Quellcode dieser Datei
Funktionen | |
| static string | file_print () |
| static void | abort () |
| mixed | SetProp (string label, mixed arg) |
| static void | SetLabel (string label, mixed argument) |
| static mixed | QueryLabel (string label) |
| string | QueryFile () |
| string * | EditText () |
| static void | ClearText () |
| static void | SetText (string *text) |
| object | Creature () |
| static string | help () |
| void | remove () |
| static void | abortx () |
| static void | normal_save_string () |
| static void | filewrite (string str) |
| static void | correct_save (string str) |
| static void | getrightname (string str) |
| static string | arrayconvert (string *text) |
| static string | arrayprint (string *text) |
| static string | comment (string *text) |
| static void | gotogetstring () |
| static void | show_file_string () |
| static void | getstring (string str) |
| static void | gotogettext () |
| static void | gettext (string str) |
Variablen | |
| static mixed | comm |
| static object | creature |
| static string * | edittext |
| static string | Filename |
| static string | oldfile |
| static int | written |
| static void abort | ( | ) | [static] |
Definiert in Zeile 234 der Datei stdfuns.c.
Benutzt comm, Filename und input_to().
Wird benutzt von getstring() und gettext().
00235 { 00236 write("Do you want to save the file " + Filename + " befor? (y/n) "); 00237 comm = insert_alist("nextfun", "abortx", comm); 00238 input_to("filewrite"); 00239 }


| static void abortx | ( | ) | [static] |
Definiert in Zeile 163 der Datei stdfuns.c.
Benutzt creature, destruct(), P_NAME und QueryProp().
Wird benutzt von filewrite() und getrightname().
00164 { 00165 write("Aborted...\n"); 00166 if (creature) creature->remove(); 00167 if (creature) destruct(creature); 00168 return say(this_player()->QueryProp(P_NAME) 00169 + " stops to write a file and aborts.\n"); 00170 }


| static string arrayconvert | ( | string * | text | ) | [static] |
Definiert in Zeile 256 der Datei stdfuns.c.
Benutzt i und old_explode().
00257 { 00258 int i; 00259 string outstring; 00260 outstring = ""; 00261 for (i = 0; i < sizeof(text) - 1; i++) 00262 outstring += "\"" + 00263 implode(old_explode(implode(old_explode("*" + text[i] + "*", "\\"), "\\\\"), 00264 "\""), "\\\"")[1..<2] + "\\n\"\ +\n"; 00265 if (sizeof(text)) 00266 outstring += "\"" + 00267 implode(old_explode(implode(old_explode("*" + text[sizeof(text) - 1] + "*","\\"), 00268 "\\\\"),"\""), "\\\"")[1..<2] + "\\n\"\n"; 00269 return outstring; 00270 }

| static string arrayprint | ( | string * | text | ) | [static] |
| static void ClearText | ( | ) | [static] |
| static string comment | ( | string * | text | ) | [static] |
| static void correct_save | ( | string | str | ) | [static] |
Definiert in Zeile 217 der Datei stdfuns.c.
Benutzt comm, Filename, filewrite() und input_to().
00218 { 00219 if (str == "y") { 00220 if (file_size(Filename + "~") != -1 && !rm(Filename + "~")) 00221 return write("Can't write file " + Filename 00222 + "! Please control your access rights!\n"); 00223 rename(Filename, Filename + "~"); 00224 return filewrite("y"); 00225 } 00226 if (str == "n") 00227 return (void) call_other(this_object(), assoc("nextfun", comm)); 00228 write("O.k. to overwrite " + Filename + "?? (y/n) "); 00229 input_to("correct_save"); 00230 }

| object Creature | ( | ) |
Definiert in Zeile 54 der Datei stdfuns.c.
Benutzt creature.
Wird benutzt von insert_exit2(), store_long(), store_short() und store_short2().
00054 { return creature; }

| string* EditText | ( | ) |
Definiert in Zeile 42 der Datei stdfuns.c.
Benutzt edittext.
Wird benutzt von show_comment(), show_detail(), show_door(), show_long(), store_comment(), store_desc(), store_dlong() und store_long().
00042 { return edittext; }

| static string file_print | ( | ) | [static] |
Wird benutzt von filewrite(), gettext(), normal_save_string() und show_file_string().

| static void filewrite | ( | string | str | ) | [static] |
Definiert in Zeile 184 der Datei stdfuns.c.
Benutzt abortx(), comm, file_print(), Filename, input_to() und written.
Wird benutzt von correct_save().
00185 { 00186 if (str == "n") { 00187 write("No save done.\n"); 00188 return (void) call_other(this_object(), assoc("nextfun", comm)); 00189 } 00190 if (str == "y") { 00191 write("Trying to write " + Filename + "...\n"); 00192 if (!written && !(file_size(Filename) == -1)) { 00193 write("File " + Filename + " already exists!\n"); 00194 write("O.k to overwrite " + Filename + "? (y/n) "); 00195 input_to("correct_save"); 00196 return; 00197 } 00198 if (written) { 00199 if (file_size(Filename[0..<3] + ".old") != -1 00200 && !rm(Filename[0..<3] + ".old")) 00201 return write("Can't write file " + Filename 00202 + "! Please control your access rights!\n"); 00203 rename(Filename, Filename[0..<3] + ".old"); 00204 } 00205 if (!write_file(Filename, file_print())) { 00206 write("Can't write file " + Filename + "! Please control your access rights!\n"); 00207 return abortx(); 00208 } 00209 write("Done...\n"); 00210 written = 1; 00211 return (void) call_other(this_object(), assoc("nextfun", comm)); 00212 } 00213 write("Do you want to save this file?? (y/n) "); 00214 input_to("filewrite"); 00215 }


| static void getrightname | ( | string | str | ) | [static] |
| static void getstring | ( | string | str | ) | [static] |
Definiert in Zeile 325 der Datei stdfuns.c.
Benutzt abort(), comm, Filename, gotogetstring(), help(), P_NAME, QueryProp(), SetProp() und show_file_string().
00326 { 00327 if (str[0..1] == "~!") { 00328 if (str[2..<1] == "") { 00329 comm = insert_alist("nextfun", "gotogetstring", comm); 00330 write("You interrupt to make " + Filename + "\nRestart with \"~m\".\n"); 00331 say(this_player()->QueryProp(P_NAME) + " interupts to write a file.\n"); 00332 SetProp("making", 1); 00333 return; 00334 } 00335 this_player()->command_me(str[2..<1]); 00336 return gotogetstring(); 00337 } 00338 switch (str) { 00339 case "": 00340 return (void) call_other(this_object(), assoc("nostring", comm)); 00341 case "~q": 00342 return abort(); 00343 case "~h": 00344 write(help()); 00345 return gotogetstring(); 00346 case "~f": 00347 return show_file_string(); 00348 case ".": 00349 return (void) call_other(this_object(), assoc("ready", comm)); 00350 case "**": 00351 return (void) call_other(this_object(), assoc("ready", comm)); 00352 case "~r": 00353 return (void) call_other(this_object(), assoc("redisplay", comm)); 00354 case "~d": 00355 return (void) call_other(this_object(), assoc("delete", comm)); 00356 case "~s": 00357 return (void) call_other(this_object(), assoc("save_file", comm)); 00358 /* end switch */ 00359 } 00360 return (void) call_other(this_object(), assoc("insert_string", comm), str); 00361 }

| static void gettext | ( | string | str | ) | [static] |
Definiert in Zeile 374 der Datei stdfuns.c.
Benutzt abort(), arrayprint(), comm, edittext, file_print(), Filename, firstline, gotogettext(), help(), input_to(), lastline, old_explode(), P_NAME, QueryProp(), SetLabel() und SetProp().
00375 { 00376 string thefile, rest; 00377 string *include, *restarr; 00378 int bytes; 00379 int firstline,lastline; 00380 if (str[0..1] == "~!") { 00381 if (str[2..<1] == "") { 00382 SetLabel("nextfun", "gotogettext"); 00383 write("You interrupt to make " + Filename + "\nRestart with \"~m\".\n"); 00384 say(this_player()->QueryProp(P_NAME) + " interupts to write a file.\n"); 00385 SetProp("making", 1); 00386 return; 00387 } 00388 this_player()->command_me(str[2..<1]); 00389 write("]"); 00390 input_to("gettext"); 00391 return; 00392 } 00393 if (str[0..1] == "~i") { 00394 if (str[2..] == "") { 00395 write("Usage: ~i <file> [<line>][-][<line>].\n]"); 00396 input_to("gettext"); 00397 return; 00398 } 00399 str = str[2..]; 00400 if(str[0] == ' ') str = str[1..]; 00401 if(!sscanf(str,"%s %s",thefile,rest)) 00402 thefile = str; 00403 thefile = (string)this_player()->get_path(thefile); 00404 if((bytes = file_size(thefile)) == -2) { 00405 write(thefile + " is a directory.\n]"); 00406 input_to("gettext"); 00407 return; 00408 } 00409 if(bytes == -1) { 00410 write("No such file: " + thefile + ".\n]"); 00411 input_to("gettext"); 00412 return; 00413 } 00414 include = old_explode(read_file(thefile),"\n"); 00415 if(!rest) { 00416 edittext += include; 00417 write("Including " + thefile + "...\n]"); 00418 input_to("gettext"); 00419 return; 00420 } 00421 restarr = old_explode("*-" + rest + "-*","-")[1..<2]; 00422 if(restarr[0] == "") restarr[0] = "0"; 00423 if(sizeof(restarr) == 1) restarr += restarr; 00424 if(restarr[1] == "") restarr [1] = "" + (sizeof(include)-1); 00425 rest = implode(restarr," - "); 00426 if(!sscanf(rest,"%d - %d",firstline,lastline)) { 00427 write("Wrong second argument. Usage: ~i <file> [<line>][-][<line>].\n]"); 00428 input_to("gettext"); 00429 return; 00430 } 00431 if(firstline > sizeof(include)-1) { 00432 write(thefile + " hasn't that many lines.\n]"); 00433 input_to("gettext"); 00434 return; 00435 } 00436 if(lastline > sizeof(include)-1) 00437 lastline = sizeof(include) -1; 00438 if(lastline < firstline) lastline = firstline; 00439 edittext += include[firstline..lastline]; 00440 write("Including " + thefile + " line"); 00441 if(lastline == firstline) write(" " + lastline + ".\n]"); 00442 else write("s " + firstline + " - " + lastline + ".\n]"); 00443 input_to("gettext"); 00444 return; 00445 } 00446 switch (str) { 00447 case "~q": 00448 return abort(); 00449 case "~r": 00450 write(arrayprint(edittext) + "]"); 00451 input_to("gettext"); 00452 return; 00453 case "~d": 00454 if (!sizeof(edittext)) { 00455 write("No lines in the buffer.\n]"); 00456 input_to("gettext"); 00457 return; 00458 } 00459 edittext = edittext[0..<2]; 00460 comm = insert_alist("nextwrite", arrayprint(edittext), comm); 00461 return gotogettext(); 00462 case ".": 00463 return (void) call_other(this_object(), assoc("ready", comm)); 00464 case "**": 00465 return (void) call_other(this_object(), assoc("ready", comm)); 00466 case "~f": 00467 return (void) call_other(this_object(), assoc("show_file", comm)); 00468 case "~s": 00469 comm = insert_alist("nextfun", "gotogettext", comm); 00470 comm = insert_alist("nextwrite", "Continue...\n", comm); 00471 write(file_print() + "Do you want to save this file? (y/n) "); 00472 input_to("filewrite"); 00473 return; 00474 case "~h": 00475 write(help() + "~i <file> includes the file <file>\n" + 00476 " (optional: begin - end)\n]"); 00477 input_to("gettext"); 00478 return; 00479 /* end switch */ 00480 } 00481 if (strlen(str) > assoc("lenmax", comm)) { 00482 write("This line ist too long. Please enter again!\n]"); 00483 input_to("gettext"); 00484 return; 00485 } 00486 if (!str) 00487 edittext += ({""}); 00488 else 00489 edittext += ({str}); 00490 write("]"); 00491 input_to("gettext"); 00492 }

| static void gotogetstring | ( | ) | [static] |
Definiert in Zeile 303 der Datei stdfuns.c.
Benutzt comm und input_to().
Wird benutzt von getstring() und show_file_string().


| static void gotogettext | ( | ) | [static] |
Definiert in Zeile 366 der Datei stdfuns.c.
Benutzt comm und input_to().
Wird benutzt von gettext().


| static string help | ( | ) | [static] |
Definiert in Zeile 142 der Datei stdfuns.c.
Wird benutzt von getstring() und gettext().
00143 { 00144 return 00145 ("The maker accepts the following commands:\n" + 00146 "~h ...... shows this text ~q ...... aborts the execution\n" + 00147 "~d ...... delete the last line and ~r ...... show the last text\n" + 00148 " redisplay ~f ...... shows the file\n" + 00149 ". / ** .. end the action and return ~s ...... saves the object in the current\n" + 00150 " to the menu form\n" + 00151 "~!<cmd>.. escape and command <cmd> ~! ...... interrupt, restart with \"~m\"\n"); 00152 }

| static void normal_save_string | ( | ) | [static] |
Definiert in Zeile 174 der Datei stdfuns.c.
Benutzt comm, file_print(), Filename und input_to().
00175 { 00176 write(file_print() 00177 + "Do you want to save this file " + Filename + "? (y/n) "); 00178 comm = insert_alist("nextfun", "gotogetstring", comm); 00179 input_to("filewrite"); 00180 }

| string QueryFile | ( | ) |
| static mixed QueryLabel | ( | string | label | ) | [static] |
| void remove | ( | ) |
| static void SetLabel | ( | string | label, | |
| mixed | argument | |||
| ) | [static] |
| mixed SetProp | ( | string | label, | |
| mixed | arg | |||
| ) |
Definiert in Zeile 144 der Datei properties.c.
Benutzt closure_call, F_MODE, F_SET_METHOD, F_VALUE, flag, NOSETMETHOD, prop, result() und Set().
00145 { 00146 closure func; 00147 mixed result; 00148 00149 // nur fuer heute 00150 if (!objectp(this_object())) 00151 return 0; 00152 00153 // NOSETMETHOD: Darf nicht gesetzt werden 00154 if (prop[F_MODE][name] & NOSETMETHOD ) return -1; 00155 00156 // Set-Method abfragen, so vorhanden 00157 if (func=prop[F_SET_METHOD][name]) 00158 { 00159 int flag; 00160 00161 // Wert als Set-Method? gleich zurueckgeben 00162 if (!closurep(func)) return func; 00163 00164 // An dieser Stelle muss func eine Closure sein. Da Set() ungebundene 00165 // Lambdas bindet, kann es auch nur eine gebundene Closure sein und das 00166 // Objekt existiert auch noch (sonst waere func == 0). 00167 00168 // closure_call setzen, falls noch nicht gesetzt 00169 if ((flag=closure_call<time())) 00170 closure_call = time()+59; 00171 00172 // Dann mal die Closure aufrufen. Bei Fehler selbige loeschen 00173 if (catch(result=funcall(func, Value, name);publish)) 00174 { 00175 prop[F_SET_METHOD]-=([name]); 00176 } 00177 00178 // Wenn closure_call gesetzt wurde, wieder loeschen 00179 if (flag) closure_call = 0; 00180 00181 // Und zurueckgeben 00182 return result; 00183 } 00184 00185 // _set_*-Methode vorhanden? falls ja, aufrufen.i 00186 // TODO: Closurecache einfuehren und Funktionaufruf nur noch machen, wenn es 00187 // die _set_* auch gibt? 00188 if (call_resolved(&result,this_object(),"_set_"+name,Value )) 00189 return result; 00190 00191 // Letzte Moeglichkeit: Muss eine 'normale' Property sein 00192 return Set( name, Value, F_VALUE, extern_call() ); 00193 }

| static void SetText | ( | string * | text | ) | [static] |
| static void show_file_string | ( | ) | [static] |
Definiert in Zeile 311 der Datei stdfuns.c.
Benutzt file_print(), gotogetstring() und SetLabel().
Wird benutzt von getstring().
00312 { 00313 SetLabel("nextfun","gotogetstring"); 00314 write(file_print()); 00315 /* smore(file_print(), 0, (int) environment()->QueryProp(P_PAGESIZE)); */ 00316 return gotogetstring(); 00317 }


mixed comm [static] |
Definiert in Zeile 6 der Datei stdfuns.c.
Wird benutzt von abort(), correct_save(), filewrite(), getstring(), gettext(), gotogetstring(), gotogettext(), normal_save_string(), QueryLabel(), SetLabel() und show_hist().
object creature [static] |
Definiert in Zeile 7 der Datei stdfuns.c.
Wird benutzt von abortx(), Creature() und remove().
string* edittext [static] |
Definiert in Zeile 9 der Datei stdfuns.c.
Wird benutzt von ClearText(), EditText(), gettext() und SetText().
string Filename [static] |
Definiert in Zeile 10 der Datei stdfuns.c.
Wird benutzt von abort(), correct_save(), filewrite(), getstring(), gettext(), normal_save_string() und QueryFile().
int written [static] |
Definiert in Zeile 13 der Datei stdfuns.c.
Wird benutzt von filewrite().
1.6.3