Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.803 2002/12/04 15:34:44 wellhard Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.804 2003/01/16 14:06:18 mast Exp $";      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN   #include <roxen.h>   #include <config.h>   #include <module.h>   #include <variables.h>
Roxen.git/server/base_server/roxen.pike:953:   //! The function might be run in the backend thread, so it should   //! never run for a considerable time. Instead do another call to   //! @[background_run] to queue it up again after some work has been   //! done, or use @[BackgroundProcess].   {   #ifdef THREADS    if (!hold_wakeup_cond)    // stop_handler_threads is running; ignore more work.    return;    -  void enqueue() +  function enqueue = lambda()    {    bg_queue->write (({func, args}));    if (bg_queue->size() == 1)    handle (bg_process_queue);    };       if (delay)    call_out (enqueue, delay);    else    enqueue();    -  +  enqueue = 0; // To avoid garbage. +    #else    // Can't do much better when we haven't got threads..    call_out (func, delay, @args);   #endif   }      class BackgroundProcess   //! A class to do a task repeatedly in the background, in a way that   //! makes as little impact as possible on the incoming requests (using   //! @[background_run]).
Roxen.git/server/base_server/roxen.pike:2335:    if( args["x-offset"] || args["xoffset"] )    x0 = (int)(args["x-offset"]||args["xoffset"]);    if( args["y-offset"] || args["yoffset"] )    y0 = (int)(args["y-offset"]||args["yoffset"]);    if( args["width"] || args["x-size"] )    x1 = (int)(args["x-size"]||args["width"]);    if( args["height"] || args["y-size"] )    y1 = (int)(args["y-size"]||args["height"]);       array xguides, yguides; -  void sort_guides() +  function sort_guides = lambda()    {    xguides = ({}); yguides = ({});    if( guides )    {    foreach( guides, object g )    if( g->pos > 0 )    if( g->vertical )    {    if( g->pos < reply->xsize() )    xguides += ({ g->pos });
Roxen.git/server/base_server/roxen.pike:2402:    x1 -= x0;    y1 -= y0;    }    break;    case "auto":    [ x0, y0, x1, y1 ] = reply->find_autocrop();    x1 -= x0;    y1 -= y0;    }    } +  sort_guides = 0; // To avoid garbage.      #define SCALEI 1   #define SCALEF 2   #define SCALEA 4   #define CROP 8    -  void do_scale_and_crop( int x0, int y0, +  function do_scale_and_crop = lambda ( int x0, int y0,    int x1, int y1,    int|float w, int|float h,    int type )    {    if( (type & CROP) && x1 && y1    && ((x1 != reply->xsize()) || (y1 != reply->ysize())    || x0 || y0 ) )    {    reply = reply->copy( x0, y0, x0+x1-1, y0+y1-1,    (bgcolor?bgcolor->rgb():0) );
Roxen.git/server/base_server/roxen.pike:2515:    else    if( args->maxwidth || args->maxheight ||    args["max-width"] || args["max-height"] )    {    int x = (int)args->maxwidth|| (int)args["max-width"];    int y = (int)args->maxheight||(int)args["max-height"];    do_scale_and_crop( x0, y0, x1, y1, x, y, SCALEI|CROP );    }    else    do_scale_and_crop( x0, y0, x1, y1, 0, 0, CROP ); +  do_scale_and_crop = 0; // To avoid garbage.       if( args["span-width"] || args["span-height"] )    {    int width = (int)args["span-width"];    int height = (int)args["span-height"];       if( (width && reply->xsize() > width) ||    (height && reply->ysize() > height) )    {    if( (width && height && (reply->xsize() / (float)width >
Roxen.git/server/base_server/roxen.pike:3023:    return what;    return ([ "":what ]);    }       string store( array|string|mapping data, RequestID id )    //! Store the data your draw callback expects to receive as its    //! first argument(s). If the data is an array, the draw callback    //! will be called like <pi>callback( @@data, id )</pi>.    {    string ci, user; -  void update_args( mapping a ) +  function update_args = lambda ( mapping a )    {    if (!a->format)    // Make implicit format choice explicit   #if constant(Image.GIF) && constant(Image.GIF.encode)    a->format = "gif";   #else    a->format = "png";   #endif    if( id->misc->authenticated_user &&    !id->misc->authenticated_user->is_transient )
Roxen.git/server/base_server/roxen.pike:3052:    ci = argcache->store( data );    }    else if( arrayp( data ) )    {    if( !mappingp( data[0] ) )    error("Expected mapping as the first element of the argument array\n");    update_args( data[0] );    ci = map( map( data, tomapp ), argcache->store )*"$";    } else    ci = data; +  update_args = 0; // To avoid garbage.       if( zero_type( uid_cache[ ci ] ) )    {    uid_cache[ci] = user;    if( catch(QUERY( "UPDATE "+name+" SET uid=%s WHERE id=%s",    user||"", ci )) )    QUERY("INSERT INTO "+name+" (id,uid,atime) VALUES (%s,%s,%d)",    ci, user||"", time(1) );    }