~ubuntu-branches/ubuntu/saucy/gnash/saucy-proposed

« back to all changes in this revision

Viewing changes to server/as_environment.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3
 
// 
4
 
// This program is free software; you can redistribute it and/or modify
5
 
// it under the terms of the GNU General Public License as published by
6
 
// the Free Software Foundation; either version 3 of the License, or
7
 
// (at your option) any later version.
8
 
// 
9
 
// This program is distributed in the hope that it will be useful,
10
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
// GNU General Public License for more details.
13
 
// 
14
 
// You should have received a copy of the GNU General Public License
15
 
// along with this program; if not, write to the Free Software
16
 
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
 
 
18
 
#ifndef GNASH_AS_ENVIRONMENT_H
19
 
#define GNASH_AS_ENVIRONMENT_H
20
 
 
21
 
#ifdef HAVE_CONFIG_H
22
 
#include "gnashconfig.h"
23
 
#endif
24
 
 
25
 
#include "as_value.h" // for composition (vector + frame_slot)
26
 
#include "StringPredicates.h" // for Variables 
27
 
#include "as_object.h"
28
 
 
29
 
#include <map> // for composition (Variables)
30
 
#include <string> // for frame_slot name
31
 
#include <vector>
32
 
#include <iostream> // for dump_stack inline
33
 
 
34
 
namespace gnash {
35
 
 
36
 
// Forward declarations
37
 
class character;
38
 
//class with_stack_entry;
39
 
 
40
 
/// ActionScript execution environment.
41
 
class as_environment
42
 
{
43
 
public:
44
 
 
45
 
        /// A stack of objects used for variables/members lookup
46
 
        //typedef std::vector<with_stack_entry> ScopeStack;
47
 
        typedef std::vector< boost::intrusive_ptr<as_object> > ScopeStack;
48
 
 
49
 
        /// Stack of as_values in this environment
50
 
        std::vector<as_value>   m_stack;
51
 
 
52
 
        as_environment()
53
 
                :
54
 
                m_stack(),
55
 
                m_target(0),
56
 
                _original_target(0)
57
 
        {
58
 
        }
59
 
 
60
 
        character* get_target() { return m_target; }
61
 
        void set_target(character* target);
62
 
 
63
 
        character* get_original_target() { return _original_target; }
64
 
 
65
 
        // Reset target to its original value
66
 
        void reset_target() { m_target = _original_target; }
67
 
 
68
 
        /// @{ Stack access/manipulation
69
 
 
70
 
        /// Push a value on the stack
71
 
        void    push(const as_value& val)
72
 
        {
73
 
                m_stack.push_back(val);
74
 
        }
75
 
 
76
 
 
77
 
        /// Pops an as_value off the stack top and return it.
78
 
        as_value pop()
79
 
        {
80
 
                assert( ! m_stack.empty() );
81
 
                as_value result = m_stack.back();
82
 
                m_stack.pop_back();
83
 
                return result;
84
 
        }
85
 
 
86
 
        /// Get stack value at the given distance from top.
87
 
        //
88
 
        /// top(0) is actual stack top
89
 
        ///
90
 
        as_value& top(size_t dist)
91
 
        {
92
 
                size_t ssize = m_stack.size();
93
 
                assert ( ssize > dist );
94
 
                return m_stack[ssize - 1 - dist];
95
 
        }
96
 
 
97
 
        /// Get stack value at the given distance from bottom.
98
 
        //
99
 
        /// bottom(stack_size()-1) is actual stack top
100
 
        ///
101
 
        as_value& bottom(size_t index)
102
 
        {
103
 
                assert ( m_stack.size() > index );
104
 
                return m_stack[index];
105
 
        }
106
 
 
107
 
        /// Drop 'count' values off the top of the stack.
108
 
        void drop(size_t count)
109
 
        {
110
 
                size_t ssize = m_stack.size();
111
 
                assert ( ssize >= count );
112
 
                m_stack.resize(ssize - count);
113
 
        }
114
 
 
115
 
        /// Insert 'count' undefined values before 'offset'.
116
 
        //
117
 
        /// An offset of 0 will prepend the values,
118
 
        /// An offset of size() [too far] will append the values.
119
 
        ///
120
 
        void padStack(size_t offset, size_t count);
121
 
 
122
 
        /// Returns index of top stack element
123
 
        // FIXME: what if stack is empty ??
124
 
        // I'd obsolete this and convert calling code to use
125
 
        // stack_size() instead.
126
 
        int     get_top_index() const { return m_stack.size() - 1; }
127
 
 
128
 
        size_t stack_size() const { return m_stack.size(); }
129
 
 
130
 
        /// @}  stack access/manipulation
131
 
        ///
132
 
 
133
 
        /// \brief
134
 
        /// Return the (possibly UNDEFINED) value of the named variable
135
 
        //
136
 
        /// @param varname 
137
 
        ///     Variable name. Can contain path elements.
138
 
        ///     TODO: should be case-insensitive up to SWF6.
139
 
        ///     NOTE: no case conversion is performed currently,
140
 
        ///           so make sure you do it yourself. Note that
141
 
        ///           ActionExec performs the conversion
142
 
        ///           before calling this method.
143
 
        ///
144
 
        as_value get_variable(const std::string& varname) const;
145
 
 
146
 
        /// \brief
147
 
        /// Delete a variable, w/out support for the path, using
148
 
        /// a ScopeStack.
149
 
        //
150
 
        /// @param varname 
151
 
        ///     Variable name. Can not contain path elements.
152
 
        ///     TODO: should be case-insensitive up to SWF6.
153
 
        ///     NOTE: no case conversion is performed currently,
154
 
        ///           so make sure you do it yourself. Note that
155
 
        ///           ActionExec performs the conversion
156
 
        ///           before calling this method.
157
 
        ///
158
 
        /// @param scopeStack
159
 
        ///     The Scope stack to use for lookups.
160
 
        ///
161
 
        bool del_variable_raw(const std::string& varname,
162
 
                        const ScopeStack& scopeStack);
163
 
 
164
 
        /// Return the (possibly UNDEFINED) value of the named var.
165
 
        //
166
 
        /// @param varname 
167
 
        ///     Variable name. Can contain path elements.
168
 
        ///     TODO: should be case-insensitive up to SWF6.
169
 
        ///     NOTE: no case conversion is performed currently,
170
 
        ///           so make sure you do it yourself. Note that
171
 
        ///           ActionExec performs the conversion
172
 
        ///           before calling this method.
173
 
        ///
174
 
        /// @param scopeStack
175
 
        ///     The Scope stack to use for lookups.
176
 
        ///
177
 
        /// @param retTarget
178
 
        ///     If not NULL, the pointer will be set to the actual object containing the
179
 
        ///     found variable (if found).
180
 
        ///
181
 
        as_value get_variable(const std::string& varname,
182
 
                const ScopeStack& scopeStack, as_object** retTarget=NULL) const;
183
 
 
184
 
        /// \brief
185
 
        /// Given a path to variable, set its value.
186
 
        /// Variable name can contain path elements.
187
 
        //
188
 
        /// @param path 
189
 
        ///     Variable path.
190
 
        ///     TODO: should be case-insensitive up to SWF6.
191
 
        ///     NOTE: no case conversion is performed currently,
192
 
        ///           so make sure you do it yourself. Note that
193
 
        ///           ActionExec performs the conversion
194
 
        ///           before calling this method.
195
 
        ///
196
 
        /// @param val
197
 
        ///     The value to assign to the variable, if found.
198
 
        ///
199
 
        /// TODO: make this function return some info about the
200
 
        ///       variable being found and set ?
201
 
        ///
202
 
        void set_variable(const std::string& path, const as_value& val);
203
 
 
204
 
        /// Given a variable name, set its value (no support for path)
205
 
        //
206
 
        /// If no variable with that name is found, a new one
207
 
        /// will be created as a member of current target.
208
 
        ///
209
 
        /// @param var
210
 
        ///     Variable name. Can not contain path elements.
211
 
        ///     TODO: should be case-insensitive up to SWF6.
212
 
        ///
213
 
        /// @param val
214
 
        ///     The value to assign to the variable, if found.
215
 
        ///
216
 
        void set_variable_raw(const std::string& var, const as_value& val);
217
 
 
218
 
        /// \brief
219
 
        /// Given a path to variable, set its value.
220
 
        //
221
 
        /// If no variable with that name is found, a new one is created.
222
 
        ///
223
 
        /// For path-less variables, this would act as a proxy for
224
 
        /// set_variable_raw.
225
 
        ///
226
 
        /// @param path
227
 
        ///     Variable path. 
228
 
        ///     TODO: should be case-insensitive up to SWF6.
229
 
        ///
230
 
        /// @param val
231
 
        ///     The value to assign to the variable.
232
 
        ///
233
 
        /// @param scopeStack
234
 
        ///     The Scope stack to use for lookups.
235
 
        ///
236
 
        void set_variable(const std::string& path, const as_value& val,
237
 
                const ScopeStack& scopeStack);
238
 
 
239
 
        /// Set/initialize the value of the local variable.
240
 
        //
241
 
        /// If no *local* variable with that name is found, a new one
242
 
        /// will be created.
243
 
        ///
244
 
        /// @param varname
245
 
        ///     Variable name. Can not contain path elements.
246
 
        ///     TODO: should be case-insensitive up to SWF6.
247
 
        ///
248
 
        /// @param val
249
 
        ///     The value to assign to the variable. 
250
 
        ///
251
 
        void set_local(const std::string& varname, const as_value& val);
252
 
 
253
 
        /// \brief
254
 
        /// Add a local var with the given name and value to our
255
 
        /// current local frame. 
256
 
        ///
257
 
        /// Use this when you know the var
258
 
        /// doesn't exist yet, since it's faster than set_local();
259
 
        /// e.g. when setting up args for a function.
260
 
        ///
261
 
        void add_local(const std::string& varname, const as_value& val);
262
 
 
263
 
        /// Create the specified local var if it doesn't exist already.
264
 
        void    declare_local(const std::string& varname);
265
 
 
266
 
        /// Add 'count' local registers (add space to end)
267
 
        //
268
 
        /// Local registers are only meaningful within a function2 context.
269
 
        ///
270
 
        void add_local_registers(unsigned int register_count)
271
 
        {
272
 
                assert(!_localFrames.empty());
273
 
                return _localFrames.back().registers.resize(register_count);
274
 
        }
275
 
 
276
 
        /// Return the number of local registers currently available
277
 
        //
278
 
        /// Local registers are only meaningful within a function2 context.
279
 
        ///
280
 
        size_t num_local_registers() const
281
 
        {
282
 
                assert(!_localFrames.empty());
283
 
                return _localFrames.back().registers.size();
284
 
        }
285
 
 
286
 
        /// Return a reference to the Nth local register.
287
 
        //
288
 
        /// Local registers are only meaningful within a function2 context.
289
 
        ///
290
 
        as_value& local_register(boost::uint8_t n)
291
 
        {
292
 
                assert(!_localFrames.empty());
293
 
                return _localFrames.back().registers[n];
294
 
        }
295
 
 
296
 
        /// Set the Nth local register to something
297
 
        void set_local_register(boost::uint8_t n, as_value &val)
298
 
        {
299
 
                if ( ! _localFrames.empty() )
300
 
                {
301
 
                        Registers& registers = _localFrames.back().registers;
302
 
                        if ( n < registers.size() )
303
 
                        {
304
 
                                registers[n] = val;
305
 
                        }
306
 
                }
307
 
        }
308
 
 
309
 
        /// Return a reference to the Nth global register.
310
 
        as_value& global_register(unsigned int n)
311
 
        {
312
 
                assert(n<4);
313
 
                return m_global_register[n];
314
 
        }
315
 
 
316
 
        /// Set the Nth local register to something
317
 
        void set_global_register(boost::uint8_t n, as_value &val) {
318
 
            if (n <= 4) {
319
 
                m_global_register[n] = val;
320
 
            }
321
 
        }
322
 
 
323
 
#ifdef GNASH_USE_GC
324
 
        /// Mark all reachable resources.
325
 
        //
326
 
        /// Reachable resources from an as_environment
327
 
        /// would be global registers, stack (expected to be empty
328
 
        /// actually), stack frames and targets (original and current).
329
 
        ///
330
 
        void markReachableResources() const;
331
 
#endif
332
 
 
333
 
        /// Find the sprite/movie referenced by the given path.
334
 
        //
335
 
        /// Supports both /slash/syntax and dot.syntax
336
 
        /// Case insensitive for SWF up to 6, sensitive from 7 up
337
 
        ///
338
 
        character* find_target(const std::string& path) const;
339
 
 
340
 
        /// Find the object referenced by the given path.
341
 
        //
342
 
        /// Supports both /slash/syntax and dot.syntax
343
 
        /// Case insensitive for SWF up to 6, sensitive from 7 up
344
 
        ///
345
 
        as_object* find_object(const std::string& path, const ScopeStack* scopeStack=NULL) const;
346
 
 
347
 
        /// Dump content of the stack to a std::ostream
348
 
        void dump_stack(std::ostream& out=std::cerr)
349
 
        {
350
 
                out << "Stack: ";
351
 
                for (unsigned int i=0, n=m_stack.size(); i<n; i++)
352
 
                {
353
 
                        if (i) out << " | ";
354
 
                        out << '"' << m_stack[i] << '"';
355
 
                }
356
 
                out << std::endl;
357
 
        }
358
 
 
359
 
        /// Dump the local registers to a std::ostream
360
 
        //
361
 
        /// NOTE that nothing will be written to the stream if NO local registers
362
 
        ///      are set
363
 
        ///
364
 
        void dump_local_registers(std::ostream& out=std::cerr) const;
365
 
 
366
 
        /// Dump the global registers to a std::ostream
367
 
        void dump_global_registers(std::ostream& out=std::cerr) const;
368
 
 
369
 
        /// Dump the local variables to a std::ostream
370
 
        void dump_local_variables(std::ostream& out=std::cerr) const;
371
 
 
372
 
        /// Return the SWF version we're running for.
373
 
        //
374
 
        /// NOTE: this is the version encoded in the first loaded
375
 
        ///       movie, and cannot be changed during play even if
376
 
        ///       replacing the root movie with an externally loaded one.
377
 
        ///
378
 
        int get_version() const;
379
 
 
380
 
        /// See if the given variable name is actually a sprite path
381
 
        /// followed by a variable name.  These come in the format:
382
 
        ///
383
 
        ///     /path/to/some/sprite/:varname
384
 
        ///
385
 
        /// (or same thing, without the last '/')
386
 
        ///
387
 
        /// or
388
 
        ///     path.to.some.var
389
 
        ///
390
 
        /// If that's the format, puts the path part (no colon or
391
 
        /// trailing slash) in *path, and the varname part (no colon, no dot)
392
 
        /// in *var and returns true.
393
 
        ///
394
 
        /// If no colon or dot, returns false and leaves *path & *var alone.
395
 
        ///
396
 
        /// TODO: return an integer: 0 not a path, 1 a slash-based path, 2 a dot-based path
397
 
        ///
398
 
        static bool parse_path(const std::string& var_path, std::string& path,
399
 
                        std::string& var);
400
 
 
401
 
        /// \brief
402
 
        /// Try to parse a string as a variable path
403
 
        //
404
 
        /// Variable paths come in the form:
405
 
        ///
406
 
        ///     /path/to/some/sprite/:varname
407
 
        ///
408
 
        /// or
409
 
        ///
410
 
        ///     /path/to/some/sprite 
411
 
        ///
412
 
        /// or
413
 
        ///     path.to.some.var
414
 
        ///
415
 
        /// If there's no dot nor colon, or if the 'path' part
416
 
        /// does not resolve to an object, this function returns false.
417
 
        /// Otherwise, true is returned and 'target' and 'val'
418
 
        /// parameters are appropriaterly set.
419
 
        ///
420
 
        /// Note that if the parser variable name doesn't exist in the found
421
 
        /// target, the 'val' will be undefined, but no other way to tell whether
422
 
        /// the variable existed or not from the caller...
423
 
        ///
424
 
        bool parse_path(const std::string& var_path, as_object** target, as_value& val);
425
 
 
426
 
        /// The variables container (case-insensitive)
427
 
        typedef std::map<std::string, as_value, StringNoCaseLessThen> Variables;
428
 
 
429
 
        /// The locals container 
430
 
        //typedef std::vector<frame_slot>       LocalVars;
431
 
        typedef boost::intrusive_ptr<as_object> LocalVars;
432
 
 
433
 
        typedef std::vector<as_value> Registers;
434
 
 
435
 
        struct CallFrame
436
 
        {
437
 
                CallFrame(as_function* funcPtr);
438
 
 
439
 
                CallFrame(const CallFrame& other) : locals(other.locals),
440
 
                        registers(other.registers), func(other.func)
441
 
                {/**/}
442
 
 
443
 
                /// function use this 
444
 
                LocalVars locals;
445
 
 
446
 
                /// function2 also use this
447
 
                Registers registers;
448
 
 
449
 
                as_function* func;
450
 
 
451
 
#ifdef GNASH_USE_GC
452
 
                /// Mark all reachable resources
453
 
                //
454
 
                /// Reachable resources would be registers and
455
 
                /// locals (expected to be empty?) and function.
456
 
                void markReachableResources() const;
457
 
#endif // GNASH_USE_GC
458
 
        };
459
 
 
460
 
        /// A class to wrap frame access.  Stack allocating a frame guard
461
 
        /// will ensure that all CallFrame pushes have a corresponding
462
 
        /// CallFrame pop, even in the presence of extraordinary returns.
463
 
        class FrameGuard
464
 
        {
465
 
        public:
466
 
                FrameGuard(as_function* func)
467
 
                { as_environment::pushCallFrame(func); }
468
 
                ~FrameGuard() { as_environment::popCallFrame(); }
469
 
        };
470
 
 
471
 
        /// Get top element of the call stack
472
 
        //
473
 
        CallFrame& topCallFrame()
474
 
        {
475
 
                assert(!_localFrames.empty());
476
 
                return _localFrames.back();
477
 
        }
478
 
 
479
 
        /// Return the depth of call stack
480
 
        size_t callStackDepth()
481
 
        {
482
 
                return _localFrames.size();
483
 
        }
484
 
 
485
 
private:
486
 
 
487
 
        static const short unsigned int numGlobalRegisters = 4;
488
 
 
489
 
        typedef std::vector<CallFrame> CallStack;
490
 
                
491
 
        static CallStack _localFrames;
492
 
 
493
 
        as_value m_global_register[numGlobalRegisters];
494
 
 
495
 
        /// Movie target. 
496
 
        character* m_target;
497
 
 
498
 
        /// Movie target. 
499
 
        character* _original_target;
500
 
 
501
 
        /// Push a frame on the calls stack.
502
 
        //
503
 
        /// This should happen right before calling an ActionScript
504
 
        /// function. Function local registers and variables
505
 
        /// must be set *after* pushCallFrame has been invoked
506
 
        ///
507
 
        /// Call popCallFrame() at ActionScript function return.
508
 
        ///
509
 
        /// @param func
510
 
        ///     The function being called
511
 
        ///
512
 
        static void pushCallFrame(as_function* func);
513
 
 
514
 
        /// Remove current call frame from the stack
515
 
        //
516
 
        /// This should happen when an ActionScript function returns.
517
 
        ///
518
 
        static void popCallFrame();
519
 
        
520
 
        /// Return the (possibly UNDEFINED) value of the named variable.
521
 
        //
522
 
        /// @param varname 
523
 
        ///     Variable name. Can not contain path elements.
524
 
        ///     NOTE: no case conversion is performed currently,
525
 
        ///           so make sure you do it yourself. 
526
 
        ///
527
 
        as_value get_variable_raw(const std::string& varname) const;
528
 
 
529
 
        /// Given a variable name, set its value (no support for path)
530
 
        void set_variable_raw(const std::string& path, const as_value& val,
531
 
                const ScopeStack& scopeStack);
532
 
 
533
 
        /// Same of the above, but no support for path.
534
 
        ///
535
 
        /// @param retTarget
536
 
        ///     If not NULL, the pointer will be set to the actual object containing the
537
 
        ///     found variable (if found).
538
 
        ///
539
 
        as_value get_variable_raw(const std::string& varname,
540
 
                const ScopeStack& scopeStack, as_object** retTarget=NULL) const;
541
 
 
542
 
 
543
 
        /// \brief
544
 
        /// Get a local variable given its name,
545
 
        //
546
 
        /// @param varname
547
 
        ///     Name of the local variable
548
 
        ///
549
 
        /// @param ret
550
 
        ///     If a variable is found it's assigned to this parameter.
551
 
        ///     Untouched if the variable is not found.
552
 
        ///
553
 
        /// @param retTarget
554
 
        ///     If not NULL, the pointer will be set to the actual object containing the
555
 
        ///     found variable (if found).
556
 
        ///
557
 
        /// @return true if the variable was found, false otherwise
558
 
        ///
559
 
        bool findLocal(const std::string& varname, as_value& ret, as_object** retTarget=NULL);
560
 
 
561
 
        bool findLocal(const std::string& varname, as_value& ret, as_object** retTarget=NULL) const
562
 
        {
563
 
                return const_cast<as_environment*>(this)->findLocal(varname, ret, retTarget);
564
 
        }
565
 
 
566
 
        /// Find a variable in the given LocalVars
567
 
        //
568
 
        /// @param varname
569
 
        ///     Name of the local variable
570
 
        ///
571
 
        /// @param ret
572
 
        ///     If a variable is found it's assigned to this parameter.
573
 
        ///     Untouched if the variable is not found.
574
 
        ///
575
 
        /// @return true if the variable was found, false otherwise
576
 
        ///
577
 
        static bool findLocal(LocalVars& locals, const std::string& name, as_value& ret);
578
 
 
579
 
        /// Delete a local variable
580
 
        //
581
 
        /// @param varname
582
 
        ///     Name of the local variable
583
 
        ///
584
 
        /// @return true if the variable was found and deleted, false otherwise
585
 
        ///
586
 
        bool delLocal(const std::string& varname);
587
 
 
588
 
        /// Delete a variable from the given LocalVars
589
 
        //
590
 
        /// @param varname
591
 
        ///     Name of the local variable
592
 
        ///
593
 
        /// @return true if the variable was found, false otherwise
594
 
        ///
595
 
        static bool delLocal(LocalVars& locals, const std::string& varname);
596
 
 
597
 
        /// Set a local variable, if it exists.
598
 
        //
599
 
        /// @param varname
600
 
        ///     Name of the local variable
601
 
        ///
602
 
        /// @param val
603
 
        ///     Value to assign to the variable
604
 
        ///
605
 
        /// @return true if the variable was found, false otherwise
606
 
        ///
607
 
        bool setLocal(const std::string& varname, const as_value& val);
608
 
 
609
 
        /// Set a variable from the given LocalVars, if it exists.
610
 
        //
611
 
        /// @param varname
612
 
        ///     Name of the local variable
613
 
        ///
614
 
        /// @param val
615
 
        ///     Value to assign to the variable
616
 
        ///
617
 
        /// @return true if the variable was found, false otherwise
618
 
        ///
619
 
        static bool setLocal(LocalVars& locals, const std::string& varname, const as_value& val);
620
 
 
621
 
};
622
 
 
623
 
 
624
 
} // end namespace gnash
625
 
 
626
 
 
627
 
#endif // GNASH_AS_ENVIRONMENT_H
628
 
 
629
 
 
630
 
// Local Variables:
631
 
// mode: C++
632
 
// indent-tabs-mode: t
633
 
// End: