Roxen.git / server / etc / modules / Variable.pmod / module.pmod

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1: - // $Id: module.pmod,v 1.34 2000/12/30 16:49:45 nilsson Exp $ + // $Id: module.pmod,v 1.35 2001/03/01 20:41:28 per Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #if constant(Locale.translate)   #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:235:    add_warning( err );    return low_set( to );    }       int low_set( mixed to )    //! Forced set. No checking is done whatsoever.    //! 1 is returned if the variable was changed, -1 is returned if    //! the variable was changed back to it's default value and 0    //! otherwise.    { +  int rv;    if( equal( to, query() ) )    return 0; -  -  if( !equal(to, default_value() ) ) -  { +  if( !(rv=equal(to, default_value() )) )    changed_values[ _id ] = to; -  if( get_changed_callback() ) -  catch( get_changed_callback()( this_object() ) ); -  return 1; -  } +     else -  { +     m_delete( changed_values, _id );    if( get_changed_callback() )    catch( get_changed_callback()( this_object() ) ); -  return -1; +  return rv ? -1 : 1;    } -  } +        mixed query()    //! Returns the current value for this variable.    {    mixed v;    if( !zero_type( v = changed_values[ _id ] ) )    return v;    return default_value();    }       int is_defaulted()    //! Return true if this variable is set to it's default value.    { -  return zero_type( changed_values[ _id ] ) || -  equal(changed_values[ _id ], default_value()); +  return zero_type( changed_values[ _id ] );    }       array(string|mixed) verify_set_from_form( mixed new_value )    //! Like verify_set, but only called when the variables are set    //! from a form.    {    return ({ 0, new_value });    }       array(string|mixed) verify_set( mixed new_value )