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.76 2002/04/19 13:40:17 anders Exp $ + // $Id: module.pmod,v 1.77 2002/05/13 16:17:49 jonasw Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))    - // Increased for each variable, used to index the mappings below. + // Increased for each variable, used to index the mappings below. The unique + // prefix is needed to avoid clobbering variables after server restart.   static int unique_vid; -  + static string unique_prefix = (string) getpid();      // The theory is that most variables (or at least a sizable percentage   // of all variables) does not have these members. Thus this saves   // quite a respectable amount of memory, the cost is speed. But   // hopefully not all that great a percentage of speed. - static mapping(int:mixed) changed_values = ([]); - static mapping(int:function(object:void)) changed_callbacks = ([]); - static mapping(int:int) all_flags = ([]); - static mapping(int:string) all_warnings = ([]); - static mapping(int:function(RequestID,object:int)) + static mapping(string:mixed) changed_values = ([]); + static mapping(string:function(object:void)) changed_callbacks = ([]); + static mapping(string:int) all_flags = ([]); + static mapping(string:string) all_warnings = ([]); + static mapping(string:function(RequestID,object:int))    invisibility_callbacks = set_weak_flag( ([]), 1 );      mapping(string:Variable) all_variables = set_weak_flag( ([]), 1 );      mapping get_all_variables()   {    return all_variables;   }      Variable get_variables( string v )
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:185:      class Variable   //! The basic variable type in Roxen. All other variable types should   //! inherit this class.   {    constant is_variable = 1;       constant type = "Basic";    //! Mostly used for debug (sprintf( "%O", variable_obj ) uses it)    -  int _id = unique_vid++; +  string _id = unique_prefix + "_" + (string) unique_vid++;    // used for indexing the mappings.       static mixed _initial; // default value -  static string _path = sprintf("v%x",_id); // used for forms +  static string _path = sprintf("v%s",_id); // used for forms    static LocaleString __name, __doc;       string diff( int render )    //! Generate a html diff of the difference between the current    //! value and the default value.    //!    //! This method is used by the configuration interface.    //!    //! The argument @[render] is used to select the operation mode.    //!