⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swfdec-swfdecasvalue.html

📁 Swfdec is a decoder/renderer for Macromedia Flash animations. The decoding and rendering engine is
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>SwfdecAsValue</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="index.html" title="Swfdec Reference Manual"><link rel="up" href="ch03.html" title="Actionscript interpreter"><link rel="prev" href="swfdec-Internals.html" title="Internals and garbage collection"><link rel="next" href="SwfdecAsContext.html" title="SwfdecAsContext"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="chapter" href="ch01.html" title="Swfdec Gtk library"><link rel="chapter" href="ch02.html" title="Swfdec library"><link rel="chapter" href="ch03.html" title="Actionscript interpreter"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="swfdec-Internals.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="ch03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Swfdec Reference Manual</th><td><a accesskey="n" href="SwfdecAsContext.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id2567022" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id2617706" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="swfdec-SwfdecAsValue"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id2567022"></a><span class="refentrytitle">SwfdecAsValue</span></h2><p>SwfdecAsValue &#8212; exchanging values with the Actionscript engine</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">enum                <a href="swfdec-SwfdecAsValue.html#SwfdecAsValueType">SwfdecAsValueType</a>;                    <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a>;#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-UNDEFINED:CAPS">SWFDEC_AS_VALUE_SET_UNDEFINED</a>       (val)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-GET-BOOLEAN:CAPS">SWFDEC_AS_VALUE_GET_BOOLEAN</a>         (val)gboolean            <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-boolean">swfdec_as_value_to_boolean</a>          (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-BOOLEAN:CAPS">SWFDEC_AS_VALUE_SET_BOOLEAN</a>         (val,b)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-GET-NUMBER:CAPS">SWFDEC_AS_VALUE_GET_NUMBER</a>          (val)double              <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-number">swfdec_as_value_to_number</a>           (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);int                 <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-integer">swfdec_as_value_to_integer</a>          (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-INT:CAPS">SWFDEC_AS_VALUE_SET_INT</a>             (val,d)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-NUMBER:CAPS">SWFDEC_AS_VALUE_SET_NUMBER</a>          (val,d)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-GET-STRING:CAPS">SWFDEC_AS_VALUE_GET_STRING</a>          (val)const char*         <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-string">swfdec_as_value_to_string</a>           (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-STRING:CAPS">SWFDEC_AS_VALUE_SET_STRING</a>          (val,s)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-NULL:CAPS">SWFDEC_AS_VALUE_SET_NULL</a>            (val)#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-GET-OBJECT:CAPS">SWFDEC_AS_VALUE_GET_OBJECT</a>          (val)<a href="swfdec-SwfdecAsObject.html#SwfdecAsObject">SwfdecAsObject</a>*     <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-object">swfdec_as_value_to_object</a>           (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);#define             <a href="swfdec-SwfdecAsValue.html#SWFDEC-AS-VALUE-SET-OBJECT:CAPS">SWFDEC_AS_VALUE_SET_OBJECT</a>          (val,o)void                <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-primitive">swfdec_as_value_to_primitive</a>        (<a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);char*               <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-debug">swfdec_as_value_to_debug</a>            (const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);const char*         <a href="swfdec-SwfdecAsValue.html#swfdec-as-double-to-string">swfdec_as_double_to_string</a>          (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         double d);const char*         <a href="swfdec-SwfdecAsValue.html#swfdec-as-str-concat">swfdec_as_str_concat</a>                (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *cx,                                                         const char *s1,                                                         const char *s2);</pre></div><div class="refsect1" lang="en"><a name="id2617706"></a><h2>Description</h2><p>This section describes how values are handled inside the Actionscript engine. Since Actionscript is a dynamically typed language, the variable type has to be carried with every value. <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue"><span class="type">SwfdecAsValue</span></a> accomplishes that. Swfdecallows two possible ways of accessing these values: The common method is touse the provided functions to explicitly convert the values to a given typewith a function such as <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-string"><code class="function">swfdec_as_value_to_string()</code></a>. This is convenient, but can be very slow as it can call back into the Actionscript engine whenconverting various objects. So it can be unsuitable in some cases.A different possibiltiy is accessing the values directly using the accessormacros. You must check the type before doing so though. For setting values,there only exist macros, since type conversion is not necessary.</p><p></p></div><div class="refsect1" lang="en"><a name="id2617754"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2617765"></a><h3><a name="SwfdecAsValueType"></a>enum SwfdecAsValueType</h3><a class="indexterm" name="id2617778"></a><pre class="programlisting">typedef enum {  SWFDEC_AS_TYPE_UNDEFINED = 0,  SWFDEC_AS_TYPE_BOOLEAN,  SWFDEC_AS_TYPE_INT, /* unimplemented, but reserved if someone wants it */  SWFDEC_AS_TYPE_NUMBER,  SWFDEC_AS_TYPE_STRING,  SWFDEC_AS_TYPE_NULL,  SWFDEC_AS_TYPE_OBJECT} SwfdecAsValueType;</pre><p>These are the possible values the Swfdec Actionscript engine knows about.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-UNDEFINED:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_UNDEFINED</code></span></td><td> the special undefined value</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-BOOLEAN:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_BOOLEAN</code></span></td><td> a boolean value - true or false</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-INT:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_INT</code></span></td><td> reserved value for integers. Should the need arise for                     performance enhancements - especially on embedded                      devices - it might be useful to implement this type.                     For now, this type will never appear in Swfdec. Using                      it will cause Swfdec to crash.</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-NUMBER:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_NUMBER</code></span></td><td> a double value - also used for integer numbers</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-STRING:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_STRING</code></span></td><td> a string. Strings are garbage-collected and unique.</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-NULL:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_NULL</code></span></td><td> the spaecial null value</td></tr><tr><td><span class="term"><a name="SWFDEC-AS-TYPE-OBJECT:CAPS"></a><code class="literal">SWFDEC_AS_TYPE_OBJECT</code></span></td><td> an object - must be of type <a href="swfdec-SwfdecAsObject.html#SwfdecAsObject"><span class="type">SwfdecAsObject</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2614877"></a><h3><a name="SwfdecAsValue"></a>SwfdecAsValue</h3><a class="indexterm" name="id2614890"></a><pre class="programlisting">typedef struct {  SwfdecAsValueType	type;} SwfdecAsValue;</pre><p>This is the type used to present an opaque value in the Actionscript engine. See <a href="swfdec-SwfdecAsValue.html#SwfdecAsValueType"><span class="type">SwfdecAsValueType</span></a> for possible types. It's similar in spirit to <span class="type">GValue</span>. The value held is garbage-collected. Apart from the type member, use the provided macros to access this structure.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>If you memset a SwfdecAsValue to 0, it is a valid undefined value.</div><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a href="swfdec-SwfdecAsValue.html#SwfdecAsValueType">SwfdecAsValueType</a>&#160;<em class="structfield"><code>type</code></em>;</span></td><td> the type of this value.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2614957"></a><h3><a name="SWFDEC-AS-VALUE-SET-UNDEFINED:CAPS"></a>SWFDEC_AS_VALUE_SET_UNDEFINED()</h3><a class="indexterm" name="id2614970"></a><pre class="programlisting">#define SWFDEC_AS_VALUE_SET_UNDEFINED(val) (val)-&gt;type = SWFDEC_AS_TYPE_UNDEFINED</pre><p>Sets <em class="parameter"><code>val</code></em> to the special undefined value. If you create a temporary value, you can instead use code such as </p><div class="informalexample"><pre class="programlisting"> SwfdecAsValue val = { 0, }; </pre></div><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>val</code></em>&#160;:</span></td><td> value to set as undefined</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2615023"></a><h3><a name="SWFDEC-AS-VALUE-GET-BOOLEAN:CAPS"></a>SWFDEC_AS_VALUE_GET_BOOLEAN()</h3><a class="indexterm" name="id2615037"></a><pre class="programlisting">#define SWFDEC_AS_VALUE_GET_BOOLEAN(val) ((val)-&gt;value.boolean)</pre><p>Gets the boolean associated with value. If you are not sure if the value isa boolean, use <a href="swfdec-SwfdecAsValue.html#swfdec-as-value-to-boolean"><code class="function">swfdec_as_value_to_boolean()</code></a> instead.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>val</code></em>&#160;:</span></td><td> value to get, the value must reference a boolean</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2615087"></a><h3><a name="swfdec-as-value-to-boolean"></a>swfdec_as_value_to_boolean ()</h3><a class="indexterm" name="id2615099"></a><pre class="programlisting">gboolean            swfdec_as_value_to_boolean          (<a href="SwfdecAsContext.html" title="SwfdecAsContext">SwfdecAsContext</a> *context,                                                         const <a href="swfdec-SwfdecAsValue.html#SwfdecAsValue">SwfdecAsValue</a> *value);</pre><p>Converts the given value to a boolean according to Flash's rules. Note thatthese rules changed significantly for strings between Flash 6 and 7.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td><td> a <a href="SwfdecAsContext.html" title="SwfdecAsContext"><span class="type">SwfdecAsContext</span></a></td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -