Roxen.git / server / modules / graphics / graphic_text.pike

version» Context lines:

Roxen.git/server/modules/graphics/graphic_text.pike:1: - constant cvs_version="$Id: graphic_text.pike,v 1.155 1999/01/24 23:36:42 grubba Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.156 1999/02/12 00:52:06 grubba Exp $";   constant thread_safe=1;      #include <module.h>   #include <stat.h>   inherit "module";   inherit "roxenlib";      #ifndef VAR_MORE   #define VAR_MORE 0   #endif /* VAR_MORE */
Roxen.git/server/modules/graphics/graphic_text.pike:714: Inside #if defined(QUANT_DEBUG) and #if efun(color_name)
  {   #if efun(color_name)    for(int i=0; i<sizeof(from); i++)    perror("%d: %s\n", i, color_name(from[i]));   #endif   }   #endif      int number=0;    + #ifdef THREADS + object number_lock = Threads.Mutex(); + #define NUMBER_LOCK() do { object __key = number_lock->lock() + #define NUMBER_UNLOCK() if (__key) destruct(__key); } while(0) + #else /* !THREADS */ + #define NUMBER_LOCK() + #define NUMBER_UNLOCK() + #endif /* THREADS */ +    mapping find_cached_args(int num);         #if !constant(iso88591)   constant iso88591   =([ "&nbsp;": " ", "&iexcl;": "¡", "&cent;": "¢", "&pound;": "£",    "&curren;": "¤", "&yen;": "¥", "&brvbar;": "¦", "&sect;": "§",    "&uml;": "¨", "&copy;": "©", "&ordf;": "ª", "&laquo;": "«",    "&not;": "¬", "&shy;": "­", "&reg;": "®", "&macr;": "¯",    "&deg;": "°", "&plusmn;": "±", "&sup2;": "²", "&sup3;": "³",
Roxen.git/server/modules/graphics/graphic_text.pike:1084:    string data = o->read();    catch {    object q;    if(sizeof(indices(q=Gz)))    data=q->inflate()->inflate(data);    };    catch {    cached_args |= decode_value(data);    };    } +  NUMBER_LOCK();    if (cached_args && sizeof(cached_args)) {    number = sort(indices(cached_args))[-1]+1;    } else {    cached_args = ([]);    number = 0;    } -  +  NUMBER_UNLOCK();    }   }      void save_cached_args()   { -  int on; -  on = number; -  if(!args_restored) restore_cached_args(); -  if(on > number) number=on; +  restore_cached_args();    object o = open(ARGHASH, "wct");    if(o)    {   #ifndef __NT__   #if efun(chmod)    // FIXME: Should this error be propagated?    catch { chmod( ARGHASH, 0666 ); };   #endif   #endif    string data=encode_value(cached_args);
Roxen.git/server/modules/graphics/graphic_text.pike:1153:    q = a*""+Array.map(b, lambda(mixed x) { return (string)x; })*"";       if(res = cached_args[ q ])    return res;       restore_cached_args(); /* Not slow now, checks with stat.. */       if(res = cached_args[ q ])    return res;    +  NUMBER_LOCK();    cached_args[ number ] = f2;    cached_args[ q ] = number; -  +  int n = number++; +  NUMBER_UNLOCK();       remove_call_out(save_cached_args);    call_out(save_cached_args, 10); -  return number++; +  return n;   }         string magic_javascript_header(object id)   {    if(!id->supports->netscape_javascript || !id->supports->images) return "";    return    ("\n<script>\n"    "function i(ri,hi,txt)\n"    "{\n"