2000-03-09
2000-03-09 09:53:10 by Martin Stjernholm <mast@lysator.liu.se>
-
5ad529c9f08082be7904c31a77dadd845c54e67b
(25 lines)
(+20/-5)
[
Show
| Annotate
]
Branch: 5.2
Added shortcuts at the global level to get_var(), set_var() etc in the
current context.
Rev: server/etc/modules/RXML.pmod/module.pmod:1.75
2:
//!
//! Created 1999-07-30 by Martin Stjernholm.
//!
- //! $Id: module.pmod,v 1.74 2000/03/06 17:50:06 mast Exp $
+ //! $Id: module.pmod,v 1.75 2000/03/09 09:53:10 mast Exp $
//! Kludge: Must use "RXML.refs" somewhere for the whole module to be
//! loaded correctly.
1117: Inside #if constant (thread_create)
#if constant (thread_create)
private Thread.Local _context = thread_local();
- inline void set_context (Context ctx) {_context->set (ctx);}
- inline Context get_context() {return [object(Context)] _context->get();}
+ local void set_context (Context ctx) {_context->set (ctx);}
+ local Context get_context() {return [object(Context)] _context->get();}
#else
private Context _context;
- inline void set_context (Context ctx) {_context = ctx;}
- inline Context get_context() {return _context;}
+ local void set_context (Context ctx) {_context = ctx;}
+ local Context get_context() {return _context;}
#endif
#if defined (MODULE_DEBUG) && constant (thread_create)
2019:
// Global services.
+ //! Shortcuts to some common functions in the current context.
+ mixed get_var (string var, void|string scope_name, void|Type want_type)
+ {return get_context()->get_var (var, scope_name, want_type);}
+ mixed user_get_var (string var, void|string scope_name, void|Type want_type)
+ {return get_context()->user_get_var (var, scope_name, want_type);}
+ mixed set_var (string var, mixed val, void|string scope_name)
+ {return get_context()->set_var (var, val, scope_name);}
+ mixed user_set_var (string var, mixed val, void|string scope_name)
+ {return get_context()->user_set_var (var, val, scope_name);}
+ void delete_var (string var, void|string scope_name)
+ {get_context()->delete_var (var, scope_name);}
+ void user_delete_var (string var, void|string scope_name)
+ {get_context()->user_delete_var (var, scope_name);}
+
void run_error (string msg, mixed... args)
//! Throws an RXML run error with a dump of the parser stack in the
//! current context. This is intended to be used by tags for errors