Module ce_xlat

Generic character translation server.

Description

Generic character translation server.

This is not efficient. An efficient implementation would compile the candidates into a finite-state machine first. This doesn't do that.

Function Index

send/2Sends a character or characters to an xlat server for translation.
server/2Spawned by start/2, should not be called directly by user code.
start/2Starts an xlat server.

Function Details

send/2

send(Pid::xlat(), Chars::char() | string()) -> ok

Sends a character or characters to an xlat server for translation.

server/2

server(Candidates::candidates(), Dest::pid()) -> never_returns()

Spawned by start/2, should not be called directly by user code.

start/2

start(Candidates::candidates(), Dest::pid()) -> xlat()

Starts an xlat server. Candidates is a list of pairs of strings. Characters are sent to the xlat server with the send/2 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 {xlat(), xlat_char, char()}. 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.)


Generated by EDoc, Feb 18 2008, 06:48:11.