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.163 1999/01/24 23:38:38 grubba Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.164 1999/02/12 00:31:44 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:716: Inside #if defined(QUANT_DEBUG)
  #ifdef QUANT_DEBUG   void print_colors(array from)   {    for(int i=0; i<sizeof(from); i++)    perror("%d: %s\n", i, color_name(from[i]));   }   #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);            constant nbsp = iso88591["&nbsp;"];      constant replace_from = indices( iso88591 )+ ({"&ss;","&lt;","&gt;","&amp",});   constant replace_to = values( iso88591 ) + ({ nbsp, "<", ">", "&", });      #define simplify_text( from ) replace(from,replace_from,replace_to)
Roxen.git/server/modules/graphics/graphic_text.pike:1034:    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)    {   #if constant(chmod)    // FIXME: Should this error be propagated?    catch { chmod( ARGHASH, 0666 ); };   #endif    string data=encode_value(cached_args);    catch {    object q;
Roxen.git/server/modules/graphics/graphic_text.pike:1101:    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"