pager.c-Dateireferenz

#include <pager.h>
#include <sys_debug.h>
#include <wizlevels.h>
Include-Abhängigkeitsdiagramm für pager.c:

gehe zum Quellcode dieser Datei

Funktionen

string prompt (mixed pinfo, string add)
string fread (mixed pinfo, int begin, int c)
mixed call (closure ctrl, mixed ctrlargs)
varargs int eval_command (mixed in, mixed pinfo)
varargs public void More (string txt, int file, mixed ctrl, mixed ctrlargs, int flags)

Variablen

inherit std util input

Dokumentation der Funktionen

mixed call ( closure  ctrl,
mixed  ctrlargs 
)

Definiert in Zeile 44 der Datei pager.c.

00045 {
00046   if (!ctrl||!closurep(ctrl)) return 0;
00047   if(!pointerp(ctrlargs)) return funcall(ctrl);
00048   return apply(ctrl, ctrlargs);
00049 }

varargs int eval_command ( mixed  in,
mixed  pinfo 
)

Definiert in Zeile 52 der Datei pager.c.

Benutzt call(), CARG, cprompt, CTRL, CURL, E_CAT, E_PROMPT, eval_command(), FLAG, fread(), input, MAXL, MSG_BOTTOM, MSG_TOP und PAGE.

00053 {
00054   string cprompt, tmp;
00055   cprompt = "";
00056   if(in == "q" || in == "x")
00057   {
00058     if(closurep(pinfo[CTRL])) apply(pinfo[CTRL], pinfo[CARG]);
00059     return 1;
00060   }
00061   else
00062     if(!in || (stringp(in) && !strlen(in))) pinfo[CURL] += pinfo[PAGE];
00063     else if(in != -1) return 0;
00064 
00065   if(pinfo[CURL] >= pinfo[MAXL]) 
00066     return (call(pinfo[CTRL], pinfo[CARG]), 1); 
00067   if(pinfo[CURL] <= 0) pinfo[CURL] = 1;
00068   if(pinfo[CURL] == 1) cprompt = MSG_TOP;
00069   if(pinfo[CURL] + pinfo[PAGE] >= pinfo[MAXL]) cprompt = MSG_BOTTOM;
00070   if(!tmp = fread(pinfo, pinfo[CURL], pinfo[PAGE]))
00071     return 0; /* (write(MSG_OOPS+"\n"), 0); */
00072   if (query_once_interactive(this_object()))
00073      tell_object(this_object(), tmp);
00074   else write(tmp);
00075   if(!(pinfo[FLAG] & E_PROMPT) &&
00076      (pinfo[CURL] + pinfo[PAGE] >= pinfo[MAXL] || !pinfo[PAGE]))
00077     return (call(pinfo[CTRL], pinfo[CARG]), 1);
00078   if(!(pinfo[FLAG] & E_CAT) &&
00079      (pinfo[MAXL] > pinfo[PAGE] || (pinfo[FLAG] & E_PROMPT)))
00080     input(#'prompt, ({ pinfo, cprompt }), #'eval_command, ({ pinfo }));
00081   return 1;
00082 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

string fread ( mixed  pinfo,
int  begin,
int  c 
)

Definiert in Zeile 24 der Datei pager.c.

Benutzt FILE, JUNK, MAXL, TEXT und x.

Wird benutzt von eval_command() und search().

00025 {
00026   if(begin > pinfo[MAXL] || begin < 1) return 0;
00027   if(pinfo[FILE]) return read_file(pinfo[TEXT], begin, c);
00028   else
00029   {
00030     int start, end, l, x;
00031 
00032     if(member(pinfo[JUNK], begin)) 
00033     {
00034       start = pinfo[JUNK][begin];
00035       if(!(end = pinfo[JUNK][begin+c]))
00036         end = strlen(pinfo[TEXT]);
00037       else end--;
00038       return pinfo[TEXT][start..end];
00039     }
00040     return 0;
00041   }
00042 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

varargs public void More ( string  txt,
int  file,
mixed  ctrl,
mixed  ctrlargs,
int  flags 
)

Definiert in Zeile 84 der Datei pager.c.

Benutzt break_string(), call(), CURL, E_CAT, eval_command(), FILE, FLAG, IS_LEARNER, JUNK, MAX_LINE_READ, MAXL, P_MORE_FLAGS, PAGE, PAGELENGTH und TEXT.

00087 {
00088   int j;
00089   mixed tmp, pinfo;
00090   if(!txt) return call(ctrl, ctrlargs);
00091   //         TEXT, FILE, CURL, MAXL, REGX, PAGE, CTRL, CARG
00092   pinfo = ({ txt, file, 1, 1, 20, 0, ctrl, ctrlargs, flags });
00093 
00094   if (pinfo[FILE])
00095   { 
00096      if (file_size(pinfo[TEXT])<50000)
00097      {
00098        pinfo[TEXT]=read_file(pinfo[TEXT]);
00099        if (!pinfo[TEXT])
00100        { 
00101          call(ctrl, ctrlargs);
00102          return;
00103        }  
00104        pinfo[FILE]=0;
00105      }
00106      else if (file_size(pinfo[TEXT])>1048576)
00107      {
00108                 tell_object(this_player()||this_object(),break_string(sprintf(
00109                "Die Datei '%s' kann nicht angezeigt werden, da " 
00110                "sie groesser als 1 MB ist. %s",pinfo[TEXT],
00111                IS_LEARNER(this_player()||this_object())?"":"Bitte verstaendige "
00112                "diesbezueglich umgehend einen Magier."),78));
00113                 call(ctrl,ctrlargs);
00114         return;
00115      }
00116   }
00117 
00118   if(!pinfo[FILE] && pinfo[TEXT][<1..<1] != "\n") pinfo[TEXT] += "\n";
00119   pinfo += ({ ([1:0]) });
00120   if(!pinfo[FILE]) 
00121     while((j = strstr(pinfo[TEXT], "\n", j+1)) != -1)
00122                 pinfo[JUNK][++pinfo[MAXL]] = j+1;
00123   else
00124     while(tmp = read_file(pinfo[TEXT], pinfo[MAXL], MAX_LINE_READ))
00125       pinfo[MAXL] += sizeof(explode(tmp, "\n"))+1;
00126   pinfo[PAGE] = PAGELENGTH;
00127   if(!pinfo[PAGE]) pinfo[FLAG] |= E_CAT;
00128   if ((this_interactive() && (j=(int)this_interactive()->QueryProp(P_MORE_FLAGS))) ||
00129       (this_player() && interactive(this_player()) &&
00130        (j=(int)this_player()->QueryProp(P_MORE_FLAGS))))
00131     pinfo[FLAG] |= j;
00132   
00133   pinfo[CURL] = 1;
00134   eval_command(-1, pinfo);
00135   return;
00136 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

string prompt ( mixed  pinfo,
string  add 
)

Definiert in Zeile 19 der Datei pager.c.

Benutzt MSG_PROMPT.

00020 {
00021   return sprintf(MSG_PROMPT+"%s", stringp(add)?add:"");
00022 }


Variablen-Dokumentation

inherit std util input

Definiert in Zeile 13 der Datei pager.c.

Erzeugt am Thu Jun 3 14:43:26 2010 für MorgenGrauen Mudlib von  doxygen 1.6.3