Data-Rlist

 view release on metacpan or  search on metacpan

Rlist.pm.html  view on Meta::CPAN

not.</p>
</li>
<li>
<p><em>CODE</em>, <em>GLOB</em>, <em>IO</em> and <em>FORMAT</em> are compiled into the strings <code>&quot;?CODE?&quot;</code>, <code>&quot;?IO?&quot;</code>,
<code>&quot;?GLOB?&quot;</code> and <code>&quot;?FORMAT?&quot;</code>.</p>
</li>
<li>
<p><em>undef</em>'d values in arrays are compiled into the default Rlist <code>&quot;&quot;</code>.</p>
</li>
</ul>
<p><em><a href="#item_compile_fast">compile_fast</a></em> is  the default compilation  function. It is  called when you pass  <em>undef</em> or
<code>&quot;fast&quot;</code>  in  place of  the  OPTIONS  parameter  (see <em><a href="#item_write">write</a></em>,  <em><a href="#item_write_string">write_string</a></em>).   Since
<em><a href="#item_compile_fast">compile_fast</a></em>  considers no  compile options  it will  not call  code, round  numbers, detect
self-referential data etc.  Also <em><a href="#item_compile_fast">compile_fast</a></em> always compiles into a unique package variable
to which it returns a reference.</p>
<dt><strong><a name="item_compile_perl"><em>compile_Perl(DATA)</em></a></strong>

<dd>
<p>Like <em><a href="#item_compile_fast">compile_fast</a></em>,  but do not compile  Rlist text - compile  DATA into Perl  syntax. It can
then  be <em>eval</em>'d.   This renders  more compact,  and more  exact output  as  <a href="/Data/Dumper.html">the Data::Dumper manpage</a>. For
example, only  strings are quoted.  To  enable this compilation  function pass <code>&quot;perl&quot;</code> to  as the
OPTIONS argument, or set the <em>-options</em> attribute of package objects to this string.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="auxiliary_functions">Auxiliary Functions</a></h2>
<p>The  utility  functions in  this  section  are generally  useful  when  handling stringified  data.
Internally  <em><a href="#item_quote7">quote7</a></em>, <em><a href="#item_escape7">escape7</a></em>,  <em><a href="#item_is_integer">is_integer</a></em>  etc. apply  precompiled regexes  and
precomputed    ASCII     tables.     <em><a href="#item_split_quoted">split_quoted</a></em>    and     <em><a href="#item_parse_quoted">parse_quoted</a></em>    simplify
<a href="#text__parsewords">Text::ParseWords</a>.   <em><a href="#item_round">round</a></em>  and <em><a href="#item_equal">equal</a></em>  are  working  solutions for  floating-point
numbers.   <em><a href="#item_deep_compare">deep_compare</a></em>  is a  smart  function  to ``diff''  two  Perl  variables.  All  these
functions are very fast and mature.</p>
<dl>
<dt><strong><a name="item_is_integer"><em>is_integer(SCALAR-REF)</em></a></strong>

<dd>
<p>Returns  true when  a scalar  looks like  a positive  or negative  integer constant.   The function
applies the compiled regex <em>$Data::Rlist::REInteger</em>.</p>
</dd>
</li>
<dt><strong><a name="item_is_number"><em>is_number(SCALAR-REF)</em></a></strong>

<dd>
<p>Test for strings  that look like numbers. <em>is_number</em>  can be used to test whether  a scalar looks
like  a  integer/float  constant  (numeric  literal).   The function  applies  the  compiled  regex
<em>$Data::Rlist::REFloat</em>.  Note that it doesn't match</p>
</dd>
<dd>
<p>- leading or trailing whitespace,</p>
</dd>
<dd>
<p>- lexical conventions such as the <code>&quot;0b&quot;</code> (binary), <code>&quot;0&quot;</code> (octal), <code>&quot;0x&quot;</code> (hex) prefix to denote
  a number-base other than decimal, and</p>
</dd>
<dd>
<p>- Perls' legible numbers, e.g. <em>3.14_15_92</em>,</p>
</dd>
<dd>
<p>- the IEEE 754 notations of Infinite and NaN.</p>
</dd>
<dd>
<p>See also</p>
</dd>
<dd>
<pre>
    $ perldoc -q &quot;whether a scalar is a number&quot;</pre>
</dd>
</li>
<dt><strong><a name="item_is_symbol"><em>is_symbol(SCALAR-REF)</em></a></strong>

<dd>
<p>Test for symbolic names.   <em>is_symbol</em> can be used to test whether a  scalar looks like a symbolic
name.   Such strings  need not  to be  quoted.  Rlist  defines symbolic  names as  a superset  of C
identifier names:</p>
</dd>
<dd>
<pre>
    [a-zA-Z_0-9]                    # C/C++ character set for identifiers
    [a-zA-Z_0-9\-/\~:\.@]           # Rlist character set for symbolic names</pre>
</dd>
<dd>
<pre>
    [a-zA-Z_][a-zA-Z_0-9]*                  # match C/C++ identifier
    [a-zA-Z_\-/\~:@][a-zA-Z_0-9\-/\~:\.@]*  # match Rlist symbolic name</pre>
</dd>
<dd>
<p>For example, names such as <em>std::foo</em>, <em>msg.warnings</em>, <em>--verbose</em>, <em>calculation-info</em> need not
be quoted.</p>
</dd>
</li>
<dt><strong><a name="item_is_value"><em>is_value(SCALAR-REF)</em></a></strong>

<dd>
<p>Returns true when a scalar is an integer, a number, a symbolic name or some quoted string.</p>
</dd>
</li>
<dt><strong><a name="item_is_random_text"><em>is_random_text(SCALAR-REF)</em></a></strong>

<dd>
<p>The opposite of <em><a href="#item_is_value">is_value</a></em>.  Such scalars will be turned into quoted strings by <em><a href="#item_compile">compile</a></em>
and <em><a href="#item_compile_fast">compile_fast</a></em>.</p>
</dd>
</li>
<dt><strong><a name="item_quote7"><em>quote7(TEXT)</em></a></strong>

<dt><strong><a name="item_escape7"><em>escape7(TEXT)</em></a></strong>

<dd>
<p>Converts TEXT into 7-bit-ASCII.  All characters not in the set of the 95 printable ASCII characters
are escaped.  The following  ASCII codes will be converted to escaped  octal numbers, i.e. 3 digits
prefixed by a slash:</p>
</dd>
<dd>
<pre>
    0x00 to 0x1F
    0x80 to 0xFF
    &quot; ' \</pre>
</dd>
<dd>

Rlist.pm.html  view on Meta::CPAN

<pre>
    $ perl -e 'print *main::42'
    *main::42</pre>
<pre>
    $ perl -e 'print 1*9'
    9</pre>
<pre>
    $ perl -e 'print *9'
    *main::9</pre>
<pre>
    $ perl -e 'print *42{GLOB}'
    GLOB(0x100110b8)</pre>
<pre>
    $ perl -e '*x = 42; print $::{42}, *x'
    *main::42*main::42</pre>
<pre>
    $ perl -v
    This is perl, v5.8.8 built for cygwin-thread-multi-64int
    (with 8 registered patches, see perl -V for more detail)</pre>
<p>Of course these  behaviors are not reliable, and  may disappear in future versions  of <em>perl</em>.  In
German  you  say   ``Schmutzeffekt''  (dirt  effect)  for  certain   mechanical  effects  that  occur
non-intendedly,  because machines  and electrical  circuits are  not perfect,  and so  is software.
However, ``Schmutzeffekts'' are neither bugs nor features; these are phenomenons.</p>
<p><strong>LEXICAL VARIABLES</strong></p>
<p>Lexical variables (<em>my</em> variables) are not stored in stashes, and do not require typeglobs.  These
variables are stored in a special array, the <em>scratchpad</em>, assigned to each block, subroutine, and
thread. These are really private variables, and they cannot be <em>local</em>ized.  Each lexical variable
occupies a  slot in the scratchpad;  hence is addressed by  an integer index, not  a symbol.  <em>my</em>
variables are like <em>auto</em> variables in C.  They're also faster than <em>local</em>s, because they can be
allocated at compile time, not runtime. Therefore you cannot declare <em>*x</em> lexically:</p>
<pre>
    $ perl -e 'my(*x)'
    Can't declare ref-to-glob cast in &quot;my&quot; at -e line 1, near &quot;);&quot;</pre>
<p>Seel also the Perl man-pages <em>perlguts</em>, <em>perlref</em>, <em>perldsc</em> and <em>perllol</em>.</p>
<p>
</p>
<h3><a name="c__">C++</a></h3>
<p>In C++  we use a  <em>flex</em>/<em>bison</em> scanner/parser combination  to read Rlist  language productions.
The  C++  parser  generates  an   <em>Abstract  Syntax  Tree</em>  (AST)  of  <em>double</em>,  <em>std::string</em>,
<em>std::vector</em> and <em>std::map</em> values.   Since each value is put into the  AST, as separate object,
we use a free store management that allows the allocation of huge amounts of tiny objects.</p>
<p>We also use reference-counted smart-pointers, which allocate themselves on our fast free store.  So
RAM will not be fragmented, and the allocation of RAM is significantly faster than with the default
process heap.   Like with Perl,  Rlist files can  have hundreds of megabytes  of data (!),  and are
processable in constant time, with constant  memory requirements.  For example, a 300 MB Rlist-file
can be read from a C++ process which will not peak over 400-500 MB of process RAM.</p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>There are no known bugs, this package is stable.  Deficiencies and TODOs:</p>
<ul>
<li>
<p>The <code>&quot;deparse&quot;</code> functionality for the <code>&quot;code_refs&quot;</code> <a href="#compile_options">compile option</a> has not
yet been implemented.</p>
</li>
<li>
<p>The <code>&quot;threads&quot;</code> <a href="#compile_options">compile option</a> has not yet been implemented.</p>
</li>
<li>
<p>IEEE 754 notations of Infinite and NaN not yet implemented.</p>
</li>
<li>
<p><em><a href="#item_compile_perl">compile_Perl</a></em> is experimental.</p>
</li>
</ul>
<p>
</p>
<hr />
<h1><a name="copyright_license">COPYRIGHT/LICENSE</a></h1>
<p>Copyright 1998-2008 Andreas Spindler</p>
<p>Maintained   at  CPAN   (<em><a href="http://search.cpan.org/dist/Data-Rlist/">http://search.cpan.org/dist/Data-Rlist/</a></em>)  and   the   author's  site
(<em><a href="http://www.visualco.de">http://www.visualco.de</a></em>). Please send mail to <em><a href="mailto:rlist@visualco.de">rlist@visualco.de</a></em>.</p>
<p>This library  is free software; you  can redistribute it and/or  modify it under the  same terms as
Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have
available.</p>
<p>Contact the author for the C++ library at <em><a href="mailto:rlist@visualco.de">rlist@visualco.de</a></em>.</p>
<p>Thank you for your attention.</p>

</body>

</html>



( run in 0.685 second using v1.01-cache-2.11-cpan-39bf76dae61 )