#include "toollib.h"#include <lpctypes.h>#include <properties.h>

gehe zum Quellcode dieser Datei
Funktionen | |
| string * | strip_explode (string str, string del) |
| string | strip_string (string str) |
| mixed * | remove_alist (mixed key, mixed *alist) |
| int | string_compare (string a, string b) |
| string | cap_string (string str) |
| string | short_path (string file) |
| string | long_path (string file) |
| string * | long_get_dir (string pat, int all) |
| string | lit_string (string str) |
| string | mixed_to_string (mixed mix, int lvl) |
| int | is_player (object obj) |
| int | is_not_player (object obj) |
| int | round (float val) |
| string cap_string | ( | string | str | ) |
| int is_not_player | ( | object | obj | ) |
Definiert in Zeile 197 der Datei toollib.c.
Benutzt is_obj und is_player().
Wird benutzt von DeepClean().


| int is_player | ( | object | obj | ) |
Definiert in Zeile 192 der Datei toollib.c.
Benutzt is_obj.
Wird benutzt von init(), is_not_player(), PrintShort() und Xinfo().
00193 { 00194 return is_obj(obj)&&query_once_interactive(obj); 00195 }

| string lit_string | ( | string | str | ) |
Definiert in Zeile 132 der Datei toollib.c.
Benutzt string_replace.
Wird benutzt von mixed_to_string().
00133 { 00134 str=string_replace(str, "\\", "\\\\"); 00135 str=string_replace(str, "\b", "\\b"); 00136 str=string_replace(str, "\n", "\\n"); 00137 str=string_replace(str, "\r", "\\r"); 00138 str=string_replace(str, "\t", "\\t"); 00139 return string_replace(str, "\"", "\\\""); 00140 }

| string* long_get_dir | ( | string | pat, | |
| int | all | |||
| ) |
Definiert in Zeile 109 der Datei toollib.c.
Benutzt file(), i, long_path() und old_explode().
Wird benutzt von Xforall() und Xgrep().
00110 { 00111 int i, s; 00112 string str, dir, *file, *tmp; 00113 00114 if(!pat) 00115 return ({}); 00116 pat=long_path(pat); 00117 if(tmp=old_explode(pat, "/")) 00118 dir="/"+implode(tmp[0..sizeof(tmp)-2], "/")+"/"; 00119 else 00120 dir="/"; 00121 s=sizeof(tmp=get_dir(pat)); 00122 file=({}); 00123 for(i=0;i<s;i++) 00124 { 00125 str=dir+tmp[i]; 00126 if(all||file_size(str)>=0) 00127 file+=({str}); 00128 } 00129 return file; 00130 }


| string long_path | ( | string | file | ) |
Definiert in Zeile 104 der Datei toollib.c.
Benutzt MASTER.
Wird benutzt von FindObj(), long_get_dir(), XFile() und XMoreFile().

| string mixed_to_string | ( | mixed | mix, | |
| int | lvl | |||
| ) |
Definiert in Zeile 142 der Datei toollib.c.
Benutzt i, keys, lit_string(), ME, mixed_to_string(), short_path(), T_CLOSURE, T_FLOAT, T_INVALID, T_LVALUE, T_MAPPING, T_NUMBER, T_OBJECT, T_POINTER, T_QUOTED_ARRAY, T_STRING und T_SYMBOL.
Wird benutzt von dprop(), dprop2(), dprop3(), mixed_to_string(), Xcall(), Xcallouts(), Xeval() und Xlpc().
00143 { 00144 int i, j, s, t; 00145 string str; 00146 mixed *keys; 00147 00148 if(lvl) 00149 { 00150 switch(typeof(mix)) 00151 { 00152 default: 00153 case T_INVALID: 00154 return "<invalid>"; 00155 case T_LVALUE: 00156 return "&"+mixed_to_string(mix, lvl-1); 00157 case T_NUMBER: 00158 case T_FLOAT: 00159 return to_string(mix); 00160 case T_STRING: 00161 return "\""+lit_string(mix)+"\""; 00162 case T_POINTER: 00163 return "({"+implode(map(mix,"mixed_to_string",ME,lvl-1),",")+"})"; 00164 case T_OBJECT: 00165 return "["+short_path(object_name((object)mix))+"]"; 00166 case T_MAPPING: 00167 s=sizeof(keys=m_indices(mix)); 00168 t=get_type_info(mix, 1); 00169 str="(["; 00170 for(i=0;i<s;i++) 00171 { 00172 str+=mixed_to_string(keys[i], lvl-1); 00173 if(t) 00174 { 00175 str+=":"+mixed_to_string(mix[keys[i],0], lvl-1); 00176 for(j=1;j<t;j++) 00177 str+=";"+mixed_to_string(mix[keys[i],j], lvl-1); 00178 } 00179 if(i<s-1) str+=","; 00180 } 00181 return str+"])"; 00182 case T_CLOSURE: 00183 case T_SYMBOL: 00184 return sprintf("%O", mix); 00185 case T_QUOTED_ARRAY: 00186 return "'"+mixed_to_string(funcall(lambda(0, mix)), lvl-1); 00187 } 00188 } 00189 return "..."; 00190 }


| mixed * remove_alist | ( | mixed | key, | |
| mixed * | alist | |||
| ) |
Definiert in Zeile 51 der Datei toollib.c.
Wird benutzt von ChangeRoomPath(), VarCheck() und Xset().
00052 { 00053 int i, s, p, l; 00054 00055 if(!pointerp(alist)) 00056 return 0; 00057 if((s=sizeof(alist))<2) 00058 return 0; 00059 if((p=assoc(key, alist[0]))>=0) 00060 { 00061 l=sizeof(alist[0])-1; 00062 for(i=0;i<s;i++) 00063 { 00064 if(!pointerp(alist[i])) 00065 return 0; 00066 alist[i]=alist[i][0..p-1]+alist[i][p+1..l]; 00067 } 00068 } 00069 return alist; 00070 }

| int round | ( | float | val | ) |
| string short_path | ( | string | file | ) |
Definiert in Zeile 82 der Datei toollib.c.
Wird benutzt von mixed_to_string(), ObjFile(), Xclone(), XFindFile(), Xtrace() und Xuclone().
00083 { 00084 int s; 00085 string tmp; 00086 00087 if(!file) 00088 return 0; 00089 if(PL) 00090 { 00091 if(extract(file, 0, 8)=="/players/") 00092 { 00093 s=strlen(getuid(PL))+8; 00094 return "~"+(extract(file, 9, s)==getuid(PL) ? 00095 extract(file, s+1, -1) : extract(file, 9, -1)); 00096 } 00097 } 00098 if(extract(file, 0, 2)=="/d/") 00099 return "+"+extract(file, 3, -1); 00100 else 00101 return file; 00102 }


| int string_compare | ( | string | a, | |
| string | b | |||
| ) |
| string* strip_explode | ( | string | str, | |
| string | del | |||
| ) |
Definiert in Zeile 41 der Datei toollib.c.
Wird benutzt von DoHistory(), strip_string(), Xdo(), XFindObj(), XGrepFile(), Xinherit() und Xmore().
00042 { 00043 return explode(str, del)-({""}); 00044 }

| string strip_string | ( | string | str | ) |
Definiert in Zeile 46 der Datei toollib.c.
Benutzt strip_explode().
Wird benutzt von ParseLine().
00047 { 00048 return implode(strip_explode(str," ")," "); 00049 }


1.6.3