Blob Blame History Raw
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Fl_package_base.html">
<link rel="next" href="Fl_dynload.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Findlib" rel="Chapter" href="Findlib.html">
<link title="Fl_package_base" rel="Chapter" href="Fl_package_base.html">
<link title="Fl_metascanner" rel="Chapter" href="Fl_metascanner.html">
<link title="Fl_dynload" rel="Chapter" href="Fl_dynload.html">
<link title="Topfind" rel="Chapter" href="Topfind.html"><title>The Findlib Library : Fl_metascanner</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Fl_package_base.html" title="Fl_package_base">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Fl_dynload.html" title="Fl_dynload">Next</a>
</div>
<h1>Module <a href="type_Fl_metascanner.html">Fl_metascanner</a></h1>

<pre><span class="keyword">module</span> Fl_metascanner: <code class="code">sig</code> <a href="Fl_metascanner.html">..</a> <code class="code">end</code></pre><div class="info module top">
Parses META files<br>
</div>
<hr width="100%">

<pre><span id="TYPEformal_pred"><span class="keyword">type</span> <code class="type"></code>formal_pred</span> = <code class="type">[ `NegPred of string | `Pred of string ]</code> </pre>


<pre><span id="TYPEflavour"><span class="keyword">type</span> <code class="type"></code>flavour</span> = <code class="type">[ `Appendix | `BaseDef ]</code> </pre>
<div class="info ">
<code class="code">`BaseDef</code> refers to META definitions using the "=" operator,
 and <code class="code">`Appendix</code> refers to definitions using the "+=" operator.<br>
</div>


<pre><code><span id="TYPEpkg_definition"><span class="keyword">type</span> <code class="type"></code>pkg_definition</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_definition.def_var">def_var</span>&nbsp;: <code class="type">string</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
The name of the defined variable<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_definition.def_flav">def_flav</span>&nbsp;: <code class="type"><a href="Fl_metascanner.html#TYPEflavour">flavour</a></code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
The flavour of the definition<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_definition.def_preds">def_preds</span>&nbsp;: <code class="type"><a href="Fl_metascanner.html#TYPEformal_pred">formal_pred</a> list</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
The formal predicates of the def<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_definition.def_value">def_value</span>&nbsp;: <code class="type">string</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
The value assigned to the variable<br>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
}

<div class="info ">
A <code class="code">pkg_definition</code> is expressed by the syntax
  <pre class="codepre"><code class="code"> var(p1,p2,...) = "value" </code></pre> (flavour `BaseDef), 
  or the syntax
  <pre class="codepre"><code class="code"> var(p1,p2,...) += "value" </code></pre> (flavour `Appendix)
  in the META file. The list of predicates may be omitted. Predicates
  may be negated by using "-", e.g. "-x".<br>
</div>


<pre><code><span id="TYPEpkg_expr"><span class="keyword">type</span> <code class="type"></code>pkg_expr</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_expr.pkg_defs">pkg_defs</span>&nbsp;: <code class="type"><a href="Fl_metascanner.html#TYPEpkg_definition">pkg_definition</a> list</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTpkg_expr.pkg_children">pkg_children</span>&nbsp;: <code class="type">(string * <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a>) list</code>;</code></td>

</tr></table>
}

<div class="info ">
A value of type <code class="code">pkg_expr</code> denotes the contents of a META file.
  The component <code class="code">pkg_defs</code> are the variable definitions.
  The component <code class="code">pkg_children</code> contains
  the definitions of the subpackages.<br>
</div>


<pre><span id="VALparse"><span class="keyword">val</span> parse</span> : <code class="type">Pervasives.in_channel -> <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a></code></pre><div class="info ">
<code class="code">parse ch:</code> 
 scans and parses the file connected with channel <code class="code">ch</code>. The file must
 have a syntax compatible with the META format. The return value
 contains the found definitions for the package and all subpackages.
<p>

 <code class="code">exception Stream.Error of string:</code> is
 raised on syntax errors. The string explains the error.<br>
</div>

<pre><span id="VALparse2"><span class="keyword">val</span> parse2</span> : <code class="type">Pervasives.in_channel -> <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a></code></pre>
<pre><span id="VALparse2_lexing"><span class="keyword">val</span> parse2_lexing</span> : <code class="type">Lexing.lexbuf -> <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a></code></pre>
<pre><span id="VALparse_lexing"><span class="keyword">val</span> parse_lexing</span> : <code class="type">Lexing.lexbuf -> <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a></code></pre>
<pre><span id="VALprint_def"><span class="keyword">val</span> print_def</span> : <code class="type">Pervasives.out_channel -> <a href="Fl_metascanner.html#TYPEpkg_definition">pkg_definition</a> -> unit</code></pre><div class="info ">
<code class="code">print_def ch def</code>:
 Outputs the definition to a channel.<br>
</div>

<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">Pervasives.out_channel -> <a href="Fl_metascanner.html#TYPEpkg_expr">pkg_expr</a> -> unit</code></pre><div class="info ">
<code class="code">print ch expr</code>:
 Outputs the package expression to a channel.<br>
</div>

<pre><span id="VALlookup"><span class="keyword">val</span> lookup</span> : <code class="type">string -> string list -> <a href="Fl_metascanner.html#TYPEpkg_definition">pkg_definition</a> list -> string</code></pre><div class="info ">
<code class="code">lookup variable_name predicate_list def</code>:
<p>

 Returns the value of <code class="code">variable_name</code> in <code class="code">def</code> under the assumption
 that the predicates in <code class="code">predicate_list</code> hold, but no other predicates.
<p>

 The rules are as follows: In the step (A), only the <code class="code">`BaseDef</code>
 definitions are considered. The first base definition is determined where
 all predicates are satisfied and that has the longest predicate list.
 In the step (B) only the <code class="code">`Appendix</code> definitions are considered.
 All definitions are determined where all predicates are satisfied.
 The final result is the concatenation of the single result of (A)
 and all results of (B) (in the order they are defined). A space
 character is inserted between two concatenated strings.
<p>

 When step (A) does not find any matching definition, the exception
 <code class="code">Not_found</code> is raised.<br>
</div>

<pre><span id="VALlookup_2"><span class="keyword">val</span> lookup_2</span> : <code class="type">string -><br>       string list -><br>       <a href="Fl_metascanner.html#TYPEpkg_definition">pkg_definition</a> list -><br>       string * <a href="Fl_metascanner.html#TYPEformal_pred">formal_pred</a> list</code></pre><div class="info ">
Like <code class="code">lookup</code>, but also returns the list of predicates that had to
      be considered to select the particular variable definition.<br>
</div>

<pre><span id="VALpredicate_exists"><span class="keyword">val</span> predicate_exists</span> : <code class="type">string -> <a href="Fl_metascanner.html#TYPEpkg_definition">pkg_definition</a> list -> bool</code></pre><div class="info ">
<code class="code">predicate_exists variable_name def</code>:
<p>

      Whether <code class="code">variable_name</code> is explicitly mentioned in <code class="code">def</code>.<br>
</div>
</body></html>