git @ Cat's Eye Technologies pibfi / master doc / pibfi_xlat.html
master

Tree @master (Download .tar.gz)

pibfi_xlat.html @masterraw · history · blame

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module pibfi_xlat</title>

</head>
<body bgcolor="white">
<h1>Module pibfi_xlat</h1>
<ul><li>
<a href="#index">Function index</a></li><li>
<a href="#exported">Exported functions</a></li></ul>

<h2>Description</h2>
Character translation server for <code>pibfi</code>.
 
  <p>This is not efficient.  An efficient implementation would compile
  the candidates into a finite-state machine first.  This doesn't do that.</p>
 

<h2><a name="index">Function Index</a></h2>

<table width="100%" border="1"><tr><th colspan="2" align="left">Exported Functions</th></tr>
<tr><td><a href="#flush-1">flush/1</a></td><td>Causes the xlat server to flush all its characters to the output,
  even ones in the process of matching candidate strings.</td></tr>
<tr><td><a href="#notify-2">notify/2</a></td><td>Notifies the other end of the connection.</td></tr>
<tr><td><a href="#send-2">send/2</a></td><td>Sends a character or characters to an xlat server for translation.</td></tr>
<tr><td><a href="#server-2">server/2</a></td><td>Spawned by <code>start/2</code>, should not be called
  directly by user code.</td></tr>
<tr><td><a href="#start-2">start/2</a></td><td>Starts an xlat server.</td></tr>
<tr><td><a href="#test-0">test/0</a></td><td/></tr>
</table>

<h2><a name="exported">Exported Functions</a></h2>

<h3><a name="flush-1">flush/1</a></h3>

<p><code>flush(<a href="#type-xlat">xlat()</a>) -> ok</code></p>
<p>Causes the xlat server to flush all its characters to the output,
  even ones in the process of matching candidate strings.  Typically
  this is called before the output is closed.</p>

<h3><a name="notify-2">notify/2</a></h3>

<p><code>notify(<a href="#type-xlat">xlat()</a>, term()) -> ok</code></p>
<p>Notifies the other end of the connection.
  They will receive a <code>{Xlat::pid(), Notifier::pid(), message, term()}</code> message.</p>

<h3><a name="send-2">send/2</a></h3>

<p><code>send(<a href="#type-xlat">xlat()</a>, char() | string()) -> ok</code></p>
<p>Sends a character or characters to an xlat server for translation.</p>

<h3><a name="server-2">server/2</a></h3>

<p><code>server(<a href="#type-candidates">candidates()</a>, Dest::pid()) -> <a href="#type-never_returns">never_returns()</a></code></p>
<p>Spawned by <code>start/2</code>, should not be called
  directly by user code.</p>

<h3><a name="start-2">start/2</a></h3>

<p><code>start(<a href="#type-candidates">candidates()</a>, Dest::pid()) -> <a href="#type-xlat">xlat()</a><ul><li><a name="type-candidates">candidates()</a> = [{string(), string()}]</li><li><a name="type-xlat">xlat()</a> = pid()</li><li><a name="type-string">string()</a> = [char()]</li><li><a name="type-char">char()</a> = integer()</li></ul></code></p>
<p>Starts an xlat server.  Candidates is a list of pairs of strings.
  Characters are sent to the xlat server with the <code>send/2</code>
  function.  When they match the left
  string of a candidate, the right string is sent to Dest instead.
  If they do not match any candidates, they are sent through unaltered.
  Characters are sent to Dest in the form
  <code>{xlat(), xlat_char, char()}</code>.
  Note that if two candidates have the same left string, the result of
  the translation is undefined.  Also note that if one candidate has
  a left string that is a prefix of another candidate's left string,
  that second candidate will never match (the shorter one will always
  be matched first.)</p>

<h3><a name="test-0">test/0</a></h3>

<p><code>test() -> term()</code></p>
<p> </p></body>
</html>