Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 587

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- ei</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/erl_interface-3.7.9.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Erlang Interface</strong><br><strong>Reference Manual</strong><br><small>Version 3.7.9</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li id="loadscrollpos" title="ei " expanded="true">ei<ul>
<li><a href="ei.html">
                  Top of manual page
                </a></li>
<li title="ei_set_compat_rel"><a href="ei.html#ei_set_compat_rel">ei_set_compat_rel()
                </a></li>
<li title="ei_encode_version"><a href="ei.html#ei_encode_version">ei_encode_version()
                </a></li>
<li title="ei_x_encode_version"><a href="ei.html#ei_x_encode_version">ei_x_encode_version()
                </a></li>
<li title="ei_encode_long"><a href="ei.html#ei_encode_long">ei_encode_long()
                </a></li>
<li title="ei_x_encode_long"><a href="ei.html#ei_x_encode_long">ei_x_encode_long()
                </a></li>
<li title="ei_encode_ulong"><a href="ei.html#ei_encode_ulong">ei_encode_ulong()
                </a></li>
<li title="ei_x_encode_ulong"><a href="ei.html#ei_x_encode_ulong">ei_x_encode_ulong()
                </a></li>
<li title="ei_encode_longlong"><a href="ei.html#ei_encode_longlong">ei_encode_longlong()
                </a></li>
<li title="ei_x_encode_longlong"><a href="ei.html#ei_x_encode_longlong">ei_x_encode_longlong()
                </a></li>
<li title="ei_encode_ulonglong"><a href="ei.html#ei_encode_ulonglong">ei_encode_ulonglong()
                </a></li>
<li title="ei_x_encode_ulonglong"><a href="ei.html#ei_x_encode_ulonglong">ei_x_encode_ulonglong()
                </a></li>
<li title="ei_encode_bignum"><a href="ei.html#ei_encode_bignum">ei_encode_bignum()
                </a></li>
<li title="ei_x_encode_bignum"><a href="ei.html#ei_x_encode_bignum">ei_x_encode_bignum()
                </a></li>
<li title="ei_encode_double"><a href="ei.html#ei_encode_double">ei_encode_double()
                </a></li>
<li title="ei_x_encode_double"><a href="ei.html#ei_x_encode_double">ei_x_encode_double()
                </a></li>
<li title="ei_encode_boolean"><a href="ei.html#ei_encode_boolean">ei_encode_boolean()
                </a></li>
<li title="ei_x_encode_boolean"><a href="ei.html#ei_x_encode_boolean">ei_x_encode_boolean()
                </a></li>
<li title="ei_encode_char"><a href="ei.html#ei_encode_char">ei_encode_char()
                </a></li>
<li title="ei_x_encode_char"><a href="ei.html#ei_x_encode_char">ei_x_encode_char()
                </a></li>
<li title="ei_encode_string"><a href="ei.html#ei_encode_string">ei_encode_string()
                </a></li>
<li title="ei_encode_string_len"><a href="ei.html#ei_encode_string_len">ei_encode_string_len()
                </a></li>
<li title="ei_x_encode_string"><a href="ei.html#ei_x_encode_string">ei_x_encode_string()
                </a></li>
<li title="ei_x_encode_string_len"><a href="ei.html#ei_x_encode_string_len">ei_x_encode_string_len()
                </a></li>
<li title="ei_encode_atom"><a href="ei.html#ei_encode_atom">ei_encode_atom()
                </a></li>
<li title="ei_encode_atom_len"><a href="ei.html#ei_encode_atom_len">ei_encode_atom_len()
                </a></li>
<li title="ei_x_encode_atom"><a href="ei.html#ei_x_encode_atom">ei_x_encode_atom()
                </a></li>
<li title="ei_x_encode_atom_len"><a href="ei.html#ei_x_encode_atom_len">ei_x_encode_atom_len()
                </a></li>
<li title="ei_encode_binary"><a href="ei.html#ei_encode_binary">ei_encode_binary()
                </a></li>
<li title="ei_x_encode_binary"><a href="ei.html#ei_x_encode_binary">ei_x_encode_binary()
                </a></li>
<li title="ei_encode_pid"><a href="ei.html#ei_encode_pid">ei_encode_pid()
                </a></li>
<li title="ei_x_encode_pid"><a href="ei.html#ei_x_encode_pid">ei_x_encode_pid()
                </a></li>
<li title="ei_encode_fun"><a href="ei.html#ei_encode_fun">ei_encode_fun()
                </a></li>
<li title="ei_x_encode_fun"><a href="ei.html#ei_x_encode_fun">ei_x_encode_fun()
                </a></li>
<li title="ei_encode_port"><a href="ei.html#ei_encode_port">ei_encode_port()
                </a></li>
<li title="ei_x_encode_port"><a href="ei.html#ei_x_encode_port">ei_x_encode_port()
                </a></li>
<li title="ei_encode_ref"><a href="ei.html#ei_encode_ref">ei_encode_ref()
                </a></li>
<li title="ei_x_encode_ref"><a href="ei.html#ei_x_encode_ref">ei_x_encode_ref()
                </a></li>
<li title="ei_encode_term"><a href="ei.html#ei_encode_term">ei_encode_term()
                </a></li>
<li title="ei_x_encode_term"><a href="ei.html#ei_x_encode_term">ei_x_encode_term()
                </a></li>
<li title="ei_encode_trace"><a href="ei.html#ei_encode_trace">ei_encode_trace()
                </a></li>
<li title="ei_x_encode_trace"><a href="ei.html#ei_x_encode_trace">ei_x_encode_trace()
                </a></li>
<li title="ei_encode_tuple_header"><a href="ei.html#ei_encode_tuple_header">ei_encode_tuple_header()
                </a></li>
<li title="ei_x_encode_tuple_header"><a href="ei.html#ei_x_encode_tuple_header">ei_x_encode_tuple_header()
                </a></li>
<li title="ei_encode_list_header"><a href="ei.html#ei_encode_list_header">ei_encode_list_header()
                </a></li>
<li title="ei_x_encode_list_header"><a href="ei.html#ei_x_encode_list_header">ei_x_encode_list_header()
                </a></li>
<li title="ei_encode_empty_list"><a href="ei.html#ei_encode_empty_list">ei_encode_empty_list()
                </a></li>
<li title="ei_x_encode_empty_list"><a href="ei.html#ei_x_encode_empty_list">ei_x_encode_empty_list()
                </a></li>
<li title="ei_get_type"><a href="ei.html#ei_get_type">ei_get_type()
                </a></li>
<li title="ei_decode_version"><a href="ei.html#ei_decode_version">ei_decode_version()
                </a></li>
<li title="ei_decode_long"><a href="ei.html#ei_decode_long">ei_decode_long()
                </a></li>
<li title="ei_decode_ulong"><a href="ei.html#ei_decode_ulong">ei_decode_ulong()
                </a></li>
<li title="ei_decode_longlong"><a href="ei.html#ei_decode_longlong">ei_decode_longlong()
                </a></li>
<li title="ei_decode_ulonglong"><a href="ei.html#ei_decode_ulonglong">ei_decode_ulonglong()
                </a></li>
<li title="ei_decode_bignum"><a href="ei.html#ei_decode_bignum">ei_decode_bignum()
                </a></li>
<li title="ei_decode_double"><a href="ei.html#ei_decode_double">ei_decode_double()
                </a></li>
<li title="ei_decode_boolean"><a href="ei.html#ei_decode_boolean">ei_decode_boolean()
                </a></li>
<li title="ei_decode_char"><a href="ei.html#ei_decode_char">ei_decode_char()
                </a></li>
<li title="ei_decode_string"><a href="ei.html#ei_decode_string">ei_decode_string()
                </a></li>
<li title="ei_decode_atom"><a href="ei.html#ei_decode_atom">ei_decode_atom()
                </a></li>
<li title="ei_decode_binary"><a href="ei.html#ei_decode_binary">ei_decode_binary()
                </a></li>
<li title="ei_decode_fun"><a href="ei.html#ei_decode_fun">ei_decode_fun()
                </a></li>
<li title="free_fun"><a href="ei.html#free_fun">free_fun()
                </a></li>
<li title="ei_decode_pid"><a href="ei.html#ei_decode_pid">ei_decode_pid()
                </a></li>
<li title="ei_decode_port"><a href="ei.html#ei_decode_port">ei_decode_port()
                </a></li>
<li title="ei_decode_ref"><a href="ei.html#ei_decode_ref">ei_decode_ref()
                </a></li>
<li title="ei_decode_trace"><a href="ei.html#ei_decode_trace">ei_decode_trace()
                </a></li>
<li title="ei_decode_tuple_header"><a href="ei.html#ei_decode_tuple_header">ei_decode_tuple_header()
                </a></li>
<li title="ei_decode_list_header"><a href="ei.html#ei_decode_list_header">ei_decode_list_header()
                </a></li>
<li title="ei_decode_ei_term"><a href="ei.html#ei_decode_ei_term">ei_decode_ei_term()
                </a></li>
<li title="ei_decode_term"><a href="ei.html#ei_decode_term">ei_decode_term()
                </a></li>
<li title="ei_print_term"><a href="ei.html#ei_print_term">ei_print_term()
                </a></li>
<li title="ei_s_print_term"><a href="ei.html#ei_s_print_term">ei_s_print_term()
                </a></li>
<li title="ei_x_format"><a href="ei.html#ei_x_format">ei_x_format()
                </a></li>
<li title="ei_x_format_wo_ver"><a href="ei.html#ei_x_format_wo_ver">ei_x_format_wo_ver()
                </a></li>
<li title="ei_x_new"><a href="ei.html#ei_x_new">ei_x_new()
                </a></li>
<li title="ei_x_new_with_version"><a href="ei.html#ei_x_new_with_version">ei_x_new_with_version()
                </a></li>
<li title="ei_x_free"><a href="ei.html#ei_x_free">ei_x_free()
                </a></li>
<li title="ei_x_append"><a href="ei.html#ei_x_append">ei_x_append()
                </a></li>
<li title="ei_x_append_buf"><a href="ei.html#ei_x_append_buf">ei_x_append_buf()
                </a></li>
<li title="ei_skip_term"><a href="ei.html#ei_skip_term">ei_skip_term()
                </a></li>
</ul>
</li>
<li id="no" title="ei_connect " expanded="false">ei_connect<ul>
<li><a href="ei_connect.html">
                  Top of manual page
                </a></li>
<li title="ei_connect_init"><a href="ei_connect.html#ei_connect_init">ei_connect_init()
                </a></li>
<li title="ei_connect_xinit"><a href="ei_connect.html#ei_connect_xinit">ei_connect_xinit()
                </a></li>
<li title="ei_connect"><a href="ei_connect.html#ei_connect">ei_connect()
                </a></li>
<li title="ei_xconnect"><a href="ei_connect.html#ei_xconnect">ei_xconnect()
                </a></li>
<li title="ei_connect_tmo"><a href="ei_connect.html#ei_connect_tmo">ei_connect_tmo()
                </a></li>
<li title="ei_xconnect_tmo"><a href="ei_connect.html#ei_xconnect_tmo">ei_xconnect_tmo()
                </a></li>
<li title="ei_receive"><a href="ei_connect.html#ei_receive">ei_receive()
                </a></li>
<li title="ei_receive_tmo"><a href="ei_connect.html#ei_receive_tmo">ei_receive_tmo()
                </a></li>
<li title="ei_receive_msg"><a href="ei_connect.html#ei_receive_msg">ei_receive_msg()
                </a></li>
<li title="ei_xreceive_msg"><a href="ei_connect.html#ei_xreceive_msg">ei_xreceive_msg()
                </a></li>
<li title="ei_receive_msg_tmo"><a href="ei_connect.html#ei_receive_msg_tmo">ei_receive_msg_tmo()
                </a></li>
<li title="ei_xreceive_msg_tmo"><a href="ei_connect.html#ei_xreceive_msg_tmo">ei_xreceive_msg_tmo()
                </a></li>
<li title="ei_receive_encoded"><a href="ei_connect.html#ei_receive_encoded">ei_receive_encoded()
                </a></li>
<li title="ei_receive_encoded_tmo"><a href="ei_connect.html#ei_receive_encoded_tmo">ei_receive_encoded_tmo()
                </a></li>
<li title="ei_send"><a href="ei_connect.html#ei_send">ei_send()
                </a></li>
<li title="ei_send_tmo"><a href="ei_connect.html#ei_send_tmo">ei_send_tmo()
                </a></li>
<li title="ei_send_encoded"><a href="ei_connect.html#ei_send_encoded">ei_send_encoded()
                </a></li>
<li title="ei_send_encoded_tmo"><a href="ei_connect.html#ei_send_encoded_tmo">ei_send_encoded_tmo()
                </a></li>
<li title="ei_reg_send"><a href="ei_connect.html#ei_reg_send">ei_reg_send()
                </a></li>
<li title="ei_reg_send_tmo"><a href="ei_connect.html#ei_reg_send_tmo">ei_reg_send_tmo()
                </a></li>
<li title="ei_send_reg_encoded"><a href="ei_connect.html#ei_send_reg_encoded">ei_send_reg_encoded()
                </a></li>
<li title="ei_send_reg_encoded_tmo"><a href="ei_connect.html#ei_send_reg_encoded_tmo">ei_send_reg_encoded_tmo()
                </a></li>
<li title="ei_rpc"><a href="ei_connect.html#ei_rpc">ei_rpc()
                </a></li>
<li title="ei_rpc_to"><a href="ei_connect.html#ei_rpc_to">ei_rpc_to()
                </a></li>
<li title="ei_rpc_from"><a href="ei_connect.html#ei_rpc_from">ei_rpc_from()
                </a></li>
<li title="ei_publish"><a href="ei_connect.html#ei_publish">ei_publish()
                </a></li>
<li title="ei_publish_tmo"><a href="ei_connect.html#ei_publish_tmo">ei_publish_tmo()
                </a></li>
<li title="ei_accept"><a href="ei_connect.html#ei_accept">ei_accept()
                </a></li>
<li title="ei_accept_tmo"><a href="ei_connect.html#ei_accept_tmo">ei_accept_tmo()
                </a></li>
<li title="ei_unpublish"><a href="ei_connect.html#ei_unpublish">ei_unpublish()
                </a></li>
<li title="ei_unpublish_tmo"><a href="ei_connect.html#ei_unpublish_tmo">ei_unpublish_tmo()
                </a></li>
<li title="ei_thisnodename"><a href="ei_connect.html#ei_thisnodename">ei_thisnodename()
                </a></li>
<li title="ei_thishostname"><a href="ei_connect.html#ei_thishostname">ei_thishostname()
                </a></li>
<li title="ei_thisalivename"><a href="ei_connect.html#ei_thisalivename">ei_thisalivename()
                </a></li>
<li title="ei_self"><a href="ei_connect.html#ei_self">ei_self()
                </a></li>
<li title="*ei_gethostbyname"><a href="ei_connect.html#*ei_gethostbyname">*ei_gethostbyname()
                </a></li>
<li title="*ei_gethostbyaddr"><a href="ei_connect.html#*ei_gethostbyaddr">*ei_gethostbyaddr()
                </a></li>
<li title="*ei_gethostbyname_r"><a href="ei_connect.html#*ei_gethostbyname_r">*ei_gethostbyname_r()
                </a></li>
<li title="*ei_gethostbyaddr_r"><a href="ei_connect.html#*ei_gethostbyaddr_r">*ei_gethostbyaddr_r()
                </a></li>
<li title="ei_get_tracelevel"><a href="ei_connect.html#ei_get_tracelevel">ei_get_tracelevel()
                </a></li>
<li title="ei_set_tracelevel"><a href="ei_connect.html#ei_set_tracelevel">ei_set_tracelevel()
                </a></li>
</ul>
</li>
<li id="no" title="registry " expanded="false">registry<ul>
<li><a href="registry.html">
                  Top of manual page
                </a></li>
<li title="ei_reg_open"><a href="registry.html#ei_reg_open">ei_reg_open()
                </a></li>
<li title="ei_reg_resize"><a href="registry.html#ei_reg_resize">ei_reg_resize()
                </a></li>
<li title="ei_reg_close"><a href="registry.html#ei_reg_close">ei_reg_close()
                </a></li>
<li title="ei_reg_setival"><a href="registry.html#ei_reg_setival">ei_reg_setival()
                </a></li>
<li title="ei_reg_setfval"><a href="registry.html#ei_reg_setfval">ei_reg_setfval()
                </a></li>
<li title="ei_reg_setsval"><a href="registry.html#ei_reg_setsval">ei_reg_setsval()
                </a></li>
<li title="ei_reg_setpval"><a href="registry.html#ei_reg_setpval">ei_reg_setpval()
                </a></li>
<li title="ei_reg_setval"><a href="registry.html#ei_reg_setval">ei_reg_setval()
                </a></li>
<li title="ei_reg_getival"><a href="registry.html#ei_reg_getival">ei_reg_getival()
                </a></li>
<li title="ei_reg_getfval"><a href="registry.html#ei_reg_getfval">ei_reg_getfval()
                </a></li>
<li title="ei_reg_getsval"><a href="registry.html#ei_reg_getsval">ei_reg_getsval()
                </a></li>
<li title="ei_reg_getpval"><a href="registry.html#ei_reg_getpval">ei_reg_getpval()
                </a></li>
<li title="ei_reg_getval"><a href="registry.html#ei_reg_getval">ei_reg_getval()
                </a></li>
<li title="ei_reg_markdirty"><a href="registry.html#ei_reg_markdirty">ei_reg_markdirty()
                </a></li>
<li title="ei_reg_delete"><a href="registry.html#ei_reg_delete">ei_reg_delete()
                </a></li>
<li title="ei_reg_stat"><a href="registry.html#ei_reg_stat">ei_reg_stat()
                </a></li>
<li title="ei_reg_tabstat"><a href="registry.html#ei_reg_tabstat">ei_reg_tabstat()
                </a></li>
<li title="ei_reg_dump"><a href="registry.html#ei_reg_dump">ei_reg_dump()
                </a></li>
<li title="ei_reg_restore"><a href="registry.html#ei_reg_restore">ei_reg_restore()
                </a></li>
<li title="ei_reg_purge"><a href="registry.html#ei_reg_purge">ei_reg_purge()
                </a></li>
</ul>
</li>
<li id="no" title="erl_connect " expanded="false">erl_connect<ul>
<li><a href="erl_connect.html">
                  Top of manual page
                </a></li>
<li title="erl_connect_init"><a href="erl_connect.html#erl_connect_init">erl_connect_init()
                </a></li>
<li title="erl_connect_xinit"><a href="erl_connect.html#erl_connect_xinit">erl_connect_xinit()
                </a></li>
<li title="erl_connect"><a href="erl_connect.html#erl_connect">erl_connect()
                </a></li>
<li title="erl_xconnect"><a href="erl_connect.html#erl_xconnect">erl_xconnect()
                </a></li>
<li title="erl_close_connection"><a href="erl_connect.html#erl_close_connection">erl_close_connection()
                </a></li>
<li title="erl_receive"><a href="erl_connect.html#erl_receive">erl_receive()
                </a></li>
<li title="erl_receive_msg"><a href="erl_connect.html#erl_receive_msg">erl_receive_msg()
                </a></li>
<li title="erl_xreceive_msg"><a href="erl_connect.html#erl_xreceive_msg">erl_xreceive_msg()
                </a></li>
<li title="erl_send"><a href="erl_connect.html#erl_send">erl_send()
                </a></li>
<li title="erl_reg_send"><a href="erl_connect.html#erl_reg_send">erl_reg_send()
                </a></li>
<li title="erl_rpc"><a href="erl_connect.html#erl_rpc">erl_rpc()
                </a></li>
<li title="erl_rpc_to"><a href="erl_connect.html#erl_rpc_to">erl_rpc_to()
                </a></li>
<li title="erl_rpc_from"><a href="erl_connect.html#erl_rpc_from">erl_rpc_from()
                </a></li>
<li title="erl_publish"><a href="erl_connect.html#erl_publish">erl_publish()
                </a></li>
<li title="erl_accept"><a href="erl_connect.html#erl_accept">erl_accept()
                </a></li>
<li title="erl_thiscookie"><a href="erl_connect.html#erl_thiscookie">erl_thiscookie()
                </a></li>
<li title="erl_thisnodename"><a href="erl_connect.html#erl_thisnodename">erl_thisnodename()
                </a></li>
<li title="erl_thishostname"><a href="erl_connect.html#erl_thishostname">erl_thishostname()
                </a></li>
<li title="erl_thisalivename"><a href="erl_connect.html#erl_thisalivename">erl_thisalivename()
                </a></li>
<li title="erl_thiscreation"><a href="erl_connect.html#erl_thiscreation">erl_thiscreation()
                </a></li>
<li title="erl_unpublish"><a href="erl_connect.html#erl_unpublish">erl_unpublish()
                </a></li>
<li title="*erl_gethostbyname"><a href="erl_connect.html#*erl_gethostbyname">*erl_gethostbyname()
                </a></li>
<li title="*erl_gethostbyaddr"><a href="erl_connect.html#*erl_gethostbyaddr">*erl_gethostbyaddr()
                </a></li>
<li title="*erl_gethostbyname_r"><a href="erl_connect.html#*erl_gethostbyname_r">*erl_gethostbyname_r()
                </a></li>
<li title="*erl_gethostbyaddr_r"><a href="erl_connect.html#*erl_gethostbyaddr_r">*erl_gethostbyaddr_r()
                </a></li>
</ul>
</li>
<li id="no" title="erl_error " expanded="false">erl_error<ul>
<li><a href="erl_error.html">
                  Top of manual page
                </a></li>
<li title="erl_err_msg"><a href="erl_error.html#erl_err_msg">erl_err_msg()
                </a></li>
<li title="erl_err_quit"><a href="erl_error.html#erl_err_quit">erl_err_quit()
                </a></li>
<li title="erl_err_ret"><a href="erl_error.html#erl_err_ret">erl_err_ret()
                </a></li>
<li title="erl_err_sys"><a href="erl_error.html#erl_err_sys">erl_err_sys()
                </a></li>
<li title=""><a href="erl_error.html#">erl_errno()
                </a></li>
</ul>
</li>
<li id="no" title="erl_eterm " expanded="false">erl_eterm<ul>
<li><a href="erl_eterm.html">
                  Top of manual page
                </a></li>
<li title="erl_cons"><a href="erl_eterm.html#erl_cons">erl_cons()
                </a></li>
<li title="erl_copy_term"><a href="erl_eterm.html#erl_copy_term">erl_copy_term()
                </a></li>
<li title="erl_element"><a href="erl_eterm.html#erl_element">erl_element()
                </a></li>
<li title="erl_init"><a href="erl_eterm.html#erl_init">erl_init()
                </a></li>
<li title="erl_hd"><a href="erl_eterm.html#erl_hd">erl_hd()
                </a></li>
<li title="erl_iolist_to_binary"><a href="erl_eterm.html#erl_iolist_to_binary">erl_iolist_to_binary()
                </a></li>
<li title="erl_iolist_to_string"><a href="erl_eterm.html#erl_iolist_to_string">erl_iolist_to_string()
                </a></li>
<li title="erl_iolist_length"><a href="erl_eterm.html#erl_iolist_length">erl_iolist_length()
                </a></li>
<li title="erl_length"><a href="erl_eterm.html#erl_length">erl_length()
                </a></li>
<li title="erl_mk_atom"><a href="erl_eterm.html#erl_mk_atom">erl_mk_atom()
                </a></li>
<li title="erl_mk_binary"><a href="erl_eterm.html#erl_mk_binary">erl_mk_binary()
                </a></li>
<li title="erl_mk_empty_list"><a href="erl_eterm.html#erl_mk_empty_list">erl_mk_empty_list()
                </a></li>
<li title="erl_mk_estring"><a href="erl_eterm.html#erl_mk_estring">erl_mk_estring()
                </a></li>
<li title="erl_mk_float"><a href="erl_eterm.html#erl_mk_float">erl_mk_float()
                </a></li>
<li title="erl_mk_int"><a href="erl_eterm.html#erl_mk_int">erl_mk_int()
                </a></li>
<li title="erl_mk_list"><a href="erl_eterm.html#erl_mk_list">erl_mk_list()
                </a></li>
<li title="erl_mk_pid"><a href="erl_eterm.html#erl_mk_pid">erl_mk_pid()
                </a></li>
<li title="erl_mk_port"><a href="erl_eterm.html#erl_mk_port">erl_mk_port()
                </a></li>
<li title="erl_mk_ref"><a href="erl_eterm.html#erl_mk_ref">erl_mk_ref()
                </a></li>
<li title="erl_mk_long_ref"><a href="erl_eterm.html#erl_mk_long_ref">erl_mk_long_ref()
                </a></li>
<li title="erl_mk_string"><a href="erl_eterm.html#erl_mk_string">erl_mk_string()
                </a></li>
<li title="erl_mk_tuple"><a href="erl_eterm.html#erl_mk_tuple">erl_mk_tuple()
                </a></li>
<li title="erl_mk_uint"><a href="erl_eterm.html#erl_mk_uint">erl_mk_uint()
                </a></li>
<li title="erl_mk_var"><a href="erl_eterm.html#erl_mk_var">erl_mk_var()
                </a></li>
<li title="erl_print_term"><a href="erl_eterm.html#erl_print_term">erl_print_term()
                </a></li>
<li title="erl_set_compat_rel"><a href="erl_eterm.html#erl_set_compat_rel">erl_set_compat_rel()
                </a></li>
<li title="erl_size"><a href="erl_eterm.html#erl_size">erl_size()
                </a></li>
<li title="erl_tl"><a href="erl_eterm.html#erl_tl">erl_tl()
                </a></li>
<li title="erl_var_content"><a href="erl_eterm.html#erl_var_content">erl_var_content()
                </a></li>
</ul>
</li>
<li id="no" title="erl_format " expanded="false">erl_format<ul>
<li><a href="erl_format.html">
                  Top of manual page
                </a></li>
<li title="erl_format"><a href="erl_format.html#erl_format">erl_format()
                </a></li>
<li title="erl_match"><a href="erl_format.html#erl_match">erl_match()
                </a></li>
</ul>
</li>
<li id="no" title="erl_global " expanded="false">erl_global<ul>
<li><a href="erl_global.html">
                  Top of manual page
                </a></li>
<li title="erl_global_names"><a href="erl_global.html#erl_global_names">erl_global_names()
                </a></li>
<li title="erl_global_register"><a href="erl_global.html#erl_global_register">erl_global_register()
                </a></li>
<li title="erl_global_unregister"><a href="erl_global.html#erl_global_unregister">erl_global_unregister()
                </a></li>
<li title="erl_global_whereis"><a href="erl_global.html#erl_global_whereis">erl_global_whereis()
                </a></li>
</ul>
</li>
<li id="no" title="erl_malloc " expanded="false">erl_malloc<ul>
<li><a href="erl_malloc.html">
                  Top of manual page
                </a></li>
<li title="erl_alloc_eterm"><a href="erl_malloc.html#erl_alloc_eterm">erl_alloc_eterm()
                </a></li>
<li title="erl_eterm_release"><a href="erl_malloc.html#erl_eterm_release">erl_eterm_release()
                </a></li>
<li title="erl_eterm_statistics"><a href="erl_malloc.html#erl_eterm_statistics">erl_eterm_statistics()
                </a></li>
<li title="erl_free_array"><a href="erl_malloc.html#erl_free_array">erl_free_array()
                </a></li>
<li title="erl_free_term"><a href="erl_malloc.html#erl_free_term">erl_free_term()
                </a></li>
<li title="erl_free_compound"><a href="erl_malloc.html#erl_free_compound">erl_free_compound()
                </a></li>
<li title="erl_malloc"><a href="erl_malloc.html#erl_malloc">erl_malloc()
                </a></li>
<li title="erl_free"><a href="erl_malloc.html#erl_free">erl_free()
                </a></li>
</ul>
</li>
<li id="no" title="erl_marshal " expanded="false">erl_marshal<ul>
<li><a href="erl_marshal.html">
                  Top of manual page
                </a></li>
<li title="erl_compare_ext"><a href="erl_marshal.html#erl_compare_ext">erl_compare_ext()
                </a></li>
<li title="erl_decode"><a href="erl_marshal.html#erl_decode">erl_decode()
                </a></li>
<li title="erl_decode_buf"><a href="erl_marshal.html#erl_decode_buf">erl_decode_buf()
                </a></li>
<li title="erl_encode"><a href="erl_marshal.html#erl_encode">erl_encode()
                </a></li>
<li title="erl_encode_buf"><a href="erl_marshal.html#erl_encode_buf">erl_encode_buf()
                </a></li>
<li title="erl_ext_size"><a href="erl_marshal.html#erl_ext_size">erl_ext_size()
                </a></li>
<li title="erl_ext_type"><a href="erl_marshal.html#erl_ext_type">erl_ext_type()
                </a></li>
<li title="erl_peek_ext"><a href="erl_marshal.html#erl_peek_ext">erl_peek_ext()
                </a></li>
<li title="erl_term_len"><a href="erl_marshal.html#erl_term_len">erl_term_len()
                </a></li>
</ul>
</li>
<li title="erl_call"><a href="erl_call.html">erl_call</a></li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>ei</h1></center>
  
  <h3>C LIBRARY</h3>
<div class="REFBODY">ei</div>
  <h3>LIBRARY SUMMARY</h3>
<div class="REFBODY">routines for handling the erlang binary term format</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>The library <span class="code">ei</span> contains macros and functions to encode
      and decode the erlang binary term format.</p>
    <p>With <span class="code">ei</span>, you can convert atoms, lists, numbers and
      binaries to and from the binary format. This is useful when
      writing port programs and drivers. <span class="code">ei</span> uses a given
      buffer, and no dynamic memory (with the exception of
      <span class="code">ei_decode_fun()</span>), and is often quite fast.</p>
    <p>It also handles C-nodes, C-programs that talks erlang
      distribution with erlang nodes (or other C-nodes) using the
      erlang distribution format. The difference between <span class="code">ei</span> and
      <span class="code">erl_interface</span> is that <span class="code">ei</span> uses the binary format
      directly when sending and receiving terms. It is also thread
      safe, and using threads, one process can handle multiple
      C-nodes. The <span class="code">erl_interface</span> library is built on top of
      <span class="code">ei</span>, but of legacy reasons, it doesn't allow for multiple
      C-nodes. In general, <span class="code">ei</span> is the preferred way of doing
      C-nodes.</p>
    <p>The decode and encode functions use a buffer an index into the
      buffer, which points at the point where to encode and
      decode. The index is updated to point right after the term
      encoded/decoded. No checking is done whether the term fits in
      the buffer or not. If encoding goes outside the buffer, the
      program may crash.</p>
    <p>All functions takes two parameter, <span class="code">buf</span> is a pointer to
      the buffer where the binary data is / will be, <span class="code">index</span> is a
      pointer to an index into the buffer. This parameter will be
      incremented with the size of the term decoded / encoded. The
      data is thus at <span class="code">buf[*index]</span> when an <span class="code">ei</span> function is
      called.</p>
    <p>The encode functions all assumes that the <span class="code">buf</span> and
      <span class="code">index</span> parameters points to a buffer big enough for the
      data. To get the size of an encoded term, without encoding it,
      pass <span class="code">NULL</span> instead of a buffer pointer. The <span class="code">index</span>
      parameter will be incremented, but nothing will be encoded. This
      is the way in <span class="code">ei</span> to "preflight" term encoding.</p>
    <p>There are also encode-functions that uses a dynamic buffer. It
      is often more convenient to use these to encode data. All encode
      functions comes in two versions: those starting with <span class="code">ei_x</span>,
      uses a dynamic buffer.</p>
    <p>All functions return <span class="code">0</span> if successful, and <span class="code">-1</span> if
      not. (For instance, if a term is not of the expected type, or
      the data to decode is not a valid erlang term.)</p>
    <p>Some of the decode-functions needs a preallocated buffer. This
      buffer must be allocated big enough, and for non compound types
      the <span class="code">ei_get_type()</span>
      function returns the size required (note that for strings an
      extra byte is needed for the 0 string terminator).</p>
  </p></div>
  <h3>EXPORTS</h3>
    <p><a name="ei_set_compat_rel"><span class="bold_code">void ei_set_compat_rel(release_number)</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">unsigned release_number;</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <a name="ei_set_compat_rel"></a>
        <p>By default, the <span class="code">ei</span> library is only guaranteed
          to be compatible with other Erlang/OTP components from the same
          release as the <span class="code">ei</span> library itself. For example, <span class="code">ei</span> from
          the OTP R10 release is not compatible with an Erlang emulator
          from the OTP R9 release by default.</p>
        <p>A call to <span class="code">ei_set_compat_rel(release_number)</span> sets the
          <span class="code">ei</span> library in compatibility mode of release
          <span class="code">release_number</span>. Valid range of <span class="code">release_number</span>
          is [7, current release]. This makes it possible to
          communicate with Erlang/OTP components from earlier releases.</p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>If this function is called, it may only be called once
            and must be called before any other functions in the <span class="code">ei</span>
            library is called.</p>
        </p></div>
</div>
        <div class="warning">
<div class="label">Warning</div>
<div class="content"><p>
          <p>You may run into trouble if this feature is used
            carelessly. Always make sure that all communicating
            components are either from the same Erlang/OTP release, or
            from release X and release Y where all components
            from release Y are in compatibility mode of release X.</p>
        </p></div>
</div>
      </p></div>
    <p><a name="ei_encode_version"><span class="bold_code">int ei_encode_version(char *buf, int *index)</span></a><br><a name="ei_x_encode_version"><span class="bold_code">int ei_x_encode_version(ei_x_buff* x)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a version magic number for the binary format. Must
          be the first token in a binary term.</p>
      </p></div>
    <p><a name="ei_encode_long"><span class="bold_code">int ei_encode_long(char *buf, int *index, long p)</span></a><br><a name="ei_x_encode_long"><span class="bold_code">int ei_x_encode_long(ei_x_buff* x, long p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a long integer in the binary format.
          Note that if the code is 64 bits the function ei_encode_long() is
          exactly the same as ei_encode_longlong().</p>
      </p></div>
    <p><a name="ei_encode_ulong"><span class="bold_code">int ei_encode_ulong(char *buf, int *index, unsigned long p)</span></a><br><a name="ei_x_encode_ulong"><span class="bold_code">int ei_x_encode_ulong(ei_x_buff* x, unsigned long p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes an unsigned long integer in the binary format.
          Note that if the code is 64 bits the function ei_encode_ulong() is
          exactly the same as ei_encode_ulonglong().</p>
      </p></div>
    <p><a name="ei_encode_longlong"><span class="bold_code">int ei_encode_longlong(char *buf, int *index, long long p)</span></a><br><a name="ei_x_encode_longlong"><span class="bold_code">int ei_x_encode_longlong(ei_x_buff* x, long long p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a GCC <span class="code">long long</span> or Visual C++ <span class="code">__int64</span> (64 bit)
          integer in the binary format. Note that this function is missing
          in the VxWorks port.</p>
      </p></div>
    <p><a name="ei_encode_ulonglong"><span class="bold_code">int ei_encode_ulonglong(char *buf, int *index, unsigned long long p)</span></a><br><a name="ei_x_encode_ulonglong"><span class="bold_code">int ei_x_encode_ulonglong(ei_x_buff* x, unsigned long long p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a GCC <span class="code">unsigned long long</span> or Visual C++ <span class="code">unsigned __int64</span> (64 bit) integer in the binary format.  Note that
          this function is missing in the VxWorks port.</p>
      </p></div>
    <p><a name="ei_encode_bignum"><span class="bold_code">int ei_encode_bignum(char *buf, int *index, mpz_t obj)</span></a><br><a name="ei_x_encode_bignum"><span class="bold_code">int ei_x_encode_bignum(ei_x_buff *x, mpz_t obj)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a GMP <span class="code">mpz_t</span> integer to binary format.
          To use this function the ei library needs to be configured and compiled
          to use the GMP library. </p>
      </p></div>
    <p><a name="ei_encode_double"><span class="bold_code">int ei_encode_double(char *buf, int *index, double p)</span></a><br><a name="ei_x_encode_double"><span class="bold_code">int ei_x_encode_double(ei_x_buff* x, double p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a double-precision (64 bit) floating point number in
          the binary format.</p>
      </p></div>
    <p><a name="ei_encode_boolean"><span class="bold_code">int ei_encode_boolean(char *buf, int *index, int p)</span></a><br><a name="ei_x_encode_boolean"><span class="bold_code">int ei_x_encode_boolean(ei_x_buff* x, int p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a boolean value, as the atom <span class="code">true</span> if p is not
          zero or <span class="code">false</span> if p is zero.</p>
      </p></div>
    <p><a name="ei_encode_char"><span class="bold_code">int ei_encode_char(char *buf, int *index, char p)</span></a><br><a name="ei_x_encode_char"><span class="bold_code">int ei_x_encode_char(ei_x_buff* x, char p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a char (8-bit) as an integer between 0-255 in the binary format.
          Note that for historical reasons the integer argument is of
          type <span class="code">char</span>. Your C code should consider the
          given argument to be of type <span class="code">unsigned char</span> even if
          the C compilers and system may define <span class="code">char</span> to be
          signed.</p>
      </p></div>
    <p><a name="ei_encode_string"><span class="bold_code">int ei_encode_string(char *buf, int *index, const char *p)</span></a><br><a name="ei_encode_string_len"><span class="bold_code">int ei_encode_string_len(char *buf, int *index, const char *p, int len)</span></a><br><a name="ei_x_encode_string"><span class="bold_code">int ei_x_encode_string(ei_x_buff* x, const char *p)</span></a><br><a name="ei_x_encode_string_len"><span class="bold_code">int ei_x_encode_string_len(ei_x_buff* x, const char* s, int len)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a string in the binary format. (A string in erlang
          is a list, but is encoded as a character array in the binary
          format.) The string should be zero-terminated, except for
          the <span class="code">ei_x_encode_string_len()</span> function.</p>
      </p></div>
    <p><a name="ei_encode_atom"><span class="bold_code">int ei_encode_atom(char *buf, int *index, const char *p)</span></a><br><a name="ei_encode_atom_len"><span class="bold_code">int ei_encode_atom_len(char *buf, int *index, const char *p, int len)</span></a><br><a name="ei_x_encode_atom"><span class="bold_code">int ei_x_encode_atom(ei_x_buff* x, const char *p)</span></a><br><a name="ei_x_encode_atom_len"><span class="bold_code">int ei_x_encode_atom_len(ei_x_buff* x, const char *p, int len)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes an atom in the binary format. The <span class="code">p</span> parameter
          is the name of the atom. Only upto <span class="code">MAXATOMLEN</span> bytes
          are encoded. The name should be zero-terminated, except for
          the <span class="code">ei_x_encode_atom_len()</span> function.</p>
      </p></div>
    <p><a name="ei_encode_binary"><span class="bold_code">int ei_encode_binary(char *buf, int *index, const void *p, long len)</span></a><br><a name="ei_x_encode_binary"><span class="bold_code">int ei_x_encode_binary(ei_x_buff* x, const void *p, long len)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a binary in the binary format. The data is at
          <span class="code">p</span>, of <span class="code">len</span> bytes length.</p>
      </p></div>
    <p><a name="ei_encode_pid"><span class="bold_code">int ei_encode_pid(char *buf, int *index, const erlang_pid *p)</span></a><br><a name="ei_x_encode_pid"><span class="bold_code">int ei_x_encode_pid(ei_x_buff* x, const erlang_pid *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes an erlang process identifier, pid, in the binary
          format. The <span class="code">p</span> parameter points to an
          <span class="code">erlang_pid</span> structure (which should have been obtained
          earlier with <span class="code">ei_decode_pid()</span>).</p>
      </p></div>
    <p><a name="ei_encode_fun"><span class="bold_code">int ei_encode_fun(char *buf, int *index, const erlang_fun *p)</span></a><br><a name="ei_x_encode_fun"><span class="bold_code">int ei_x_encode_fun(ei_x_buff* x, const erlang_fun* fun)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes a fun in the binary format. The <span class="code">p</span> parameter
          points to an <span class="code">erlang_fun</span> structure. The
          <span class="code">erlang_fun</span> is not freed automatically, the
          <span class="code">free_fun</span> should be called if the fun is not needed
          after encoding.</p>
      </p></div>
    <p><a name="ei_encode_port"><span class="bold_code">int ei_encode_port(char *buf, int *index, const erlang_port *p)</span></a><br><a name="ei_x_encode_port"><span class="bold_code">int ei_x_encode_port(ei_x_buff* x, const erlang_port *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes an erlang port in the binary format. The <span class="code">p</span>
          parameter points to a <span class="code">erlang_port</span> structure (which
          should have been obtained earlier with
          <span class="code">ei_decode_port()</span>.</p>
      </p></div>
    <p><a name="ei_encode_ref"><span class="bold_code">int ei_encode_ref(char *buf, int *index, const erlang_ref *p)</span></a><br><a name="ei_x_encode_ref"><span class="bold_code">int ei_x_encode_ref(ei_x_buff* x, const erlang_ref *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Encodes an erlang reference in the binary format. The
          <span class="code">p</span> parameter points to a <span class="code">erlang_ref</span> structure
          (which should have been obtained earlier with
          <span class="code">ei_decode_ref()</span>.</p>
      </p></div>
    <p><a name="ei_encode_term"><span class="bold_code">int ei_encode_term(char *buf, int *index, void *t)</span></a><br><a name="ei_x_encode_term"><span class="bold_code">int ei_x_encode_term(ei_x_buff* x, void *t)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function encodes an <span class="code">ETERM</span>, as obtained from
          <span class="code">erl_interface</span>. The <span class="code">t</span> parameter is actually an
          <span class="code">ETERM</span> pointer. This function doesn't free the
          <span class="code">ETERM</span>.</p>
      </p></div>
    <p><a name="ei_encode_trace"><span class="bold_code">int ei_encode_trace(char *buf, int *index, const erlang_trace *p)</span></a><br><a name="ei_x_encode_trace"><span class="bold_code">int ei_x_encode_trace(ei_x_buff* x, const erlang_trace *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function encodes an erlang trace token in the binary
          format. The <span class="code">p</span> parameter points to a
          <span class="code">erlang_trace</span> structure (which should have been
          obtained earlier with <span class="code">ei_decode_trace()</span>.</p>
      </p></div>
    <p><a name="ei_encode_tuple_header"><span class="bold_code">int ei_encode_tuple_header(char *buf, int *index, int arity)</span></a><br><a name="ei_x_encode_tuple_header"><span class="bold_code">int ei_x_encode_tuple_header(ei_x_buff* x, int arity)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function encodes a tuple header, with a specified
          arity. The next <span class="code">arity</span> terms encoded will be the
          elements of the tuple. Tuples and lists are encoded
          recursively, so that a tuple may contain another tuple or
          list.</p>
        <p>E.g. to encode the tuple <span class="code">{a, {b, {}}}</span>:</p>
        <div class="example"><pre>
ei_encode_tuple_header(buf, &amp;i, 2);
ei_encode_atom(buf, &amp;i, "a");
ei_encode_tuple_header(buf, &amp;i, 2);
ei_encode_atom(buf, &amp;i, "b");
ei_encode_tuple_header(buf, &amp;i, 0);
        </pre></div>
      </p></div>
    <p><a name="ei_encode_list_header"><span class="bold_code">int ei_encode_list_header(char *buf, int *index, int arity)</span></a><br><a name="ei_x_encode_list_header"><span class="bold_code">int ei_x_encode_list_header(ei_x_buff* x, int arity)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function encodes a list header, with a specified
          arity. The next <span class="code">arity+1</span> terms are the elements
          (actually its <span class="code">arity</span> cons cells) and the tail of the
          list. Lists and tuples are encoded recursively, so that a
          list may contain another list or tuple.</p>
        <p>E.g. to encode the list <span class="code">[c, d, [e | f]]</span>:</p>
        <div class="example"><pre>
ei_encode_list_header(buf, &amp;i, 3);
ei_encode_atom(buf, &amp;i, "c");
ei_encode_atom(buf, &amp;i, "d");
ei_encode_list_header(buf, &amp;i, 1);
ei_encode_atom(buf, &amp;i, "e");
ei_encode_atom(buf, &amp;i, "f");
ei_encode_empty_list(buf, &amp;i);
        </pre></div>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>It may seem that there is no way to create a list without
            knowing the number of elements in advance. But indeed
            there is a way. Note that the list <span class="code">[a, b, c]</span> can be
            written as <span class="code">[a | [b | [c]]]</span>.  Using this, a list can
            be written as conses.</p>
        </p></div>
</div>
        <p>To encode a list, without knowing the arity in advance:</p>
        <div class="example"><pre>
while (something()) {
    ei_x_encode_list_header(&amp;x, 1);
    ei_x_encode_ulong(&amp;x, i); /* just an example */
}
ei_x_encode_empty_list(&amp;x);
        </pre></div>
      </p></div>
    <p><a name="ei_encode_empty_list"><span class="bold_code">int ei_encode_empty_list(char* buf, int* index)</span></a><br><a name="ei_x_encode_empty_list"><span class="bold_code">int ei_x_encode_empty_list(ei_x_buff* x)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function encodes an empty list. It's often used at the
          tail of a list.</p>
      </p></div>
    <p><a name="ei_get_type"><span class="bold_code">int ei_get_type(const char *buf, const int *index, int *type, int *size)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function returns the type in <span class="code">type</span> and size in
          <span class="code">size</span> of the encoded term.
          For strings and atoms, size
          is the number of characters <strong>not</strong> including the
          terminating 0. For binaries, <span class="code">size</span> is the number of
          bytes. For lists and tuples, <span class="code">size</span> is the arity of the
          object. For other types, <span class="code">size</span> is 0. In all cases,
          <span class="code">index</span> is left unchanged.</p>
      </p></div>
    <p><a name="ei_decode_version"><span class="bold_code">int ei_decode_version(const char *buf, int *index, int *version)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes the version magic number for the
          erlang binary term format. It must be the first token in a
          binary term.</p>
      </p></div>
    <p><a name="ei_decode_long"><span class="bold_code">int ei_decode_long(const char *buf, int *index, long *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a long integer from the binary format.
          Note that if the code is 64 bits the function ei_decode_long() is
          exactly the same as ei_decode_longlong().</p>
      </p></div>
    <p><a name="ei_decode_ulong"><span class="bold_code">int ei_decode_ulong(const char *buf, int *index, unsigned long *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes an unsigned long integer from
          the binary format.
          Note that if the code is 64 bits the function ei_decode_ulong() is
          exactly the same as ei_decode_ulonglong().</p>
      </p></div>
    <p><a name="ei_decode_longlong"><span class="bold_code">int ei_decode_longlong(const char *buf, int *index, long long *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a GCC <span class="code">long long</span> or Visual C++ <span class="code">__int64</span>
          (64 bit) integer from the binary format.  Note that this
          function is missing in the VxWorks port.</p>
      </p></div>
    <p><a name="ei_decode_ulonglong"><span class="bold_code">int ei_decode_ulonglong(const char *buf, int *index, unsigned long long *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a GCC <span class="code">unsigned long long</span> or Visual C++
          <span class="code">unsigned __int64</span> (64 bit) integer from the binary format.
          Note that this function is missing in the VxWorks port.</p>
      </p></div>
    <p><a name="ei_decode_bignum"><span class="bold_code">int ei_decode_bignum(const char *buf, int *index, mpz_t obj)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes an integer in the binary format to a GMP <span class="code">mpz_t</span> integer.
          To use this function the ei library needs to be configured and compiled
          to use the GMP library. </p>
      </p></div>
    <p><a name="ei_decode_double"><span class="bold_code">int ei_decode_double(const char *buf, int *index, double *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes an double-precision (64 bit) floating
          point number from the binary format.</p>
      </p></div>
    <p><a name="ei_decode_boolean"><span class="bold_code">int ei_decode_boolean(const char *buf, int *index, int *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a boolean value from the binary
          format. A boolean is actually an atom, <span class="code">true</span> decodes 1
          and <span class="code">false</span> decodes 0.</p>
      </p></div>
    <p><a name="ei_decode_char"><span class="bold_code">int ei_decode_char(const char *buf, int *index, char *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a char (8-bit) integer between 0-255
          from the binary format.
          Note that for historical reasons the returned integer is of
          type <span class="code">char</span>. Your C code should consider the
          returned value to be of type <span class="code">unsigned char</span> even if
          the C compilers and system may define <span class="code">char</span> to be
          signed.</p>
      </p></div>
    <p><a name="ei_decode_string"><span class="bold_code">int ei_decode_string(const char *buf, int *index, char *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a string from the binary format. A
          string in erlang is a list of integers between 0 and
          255. Note that since the string is just a list, sometimes
          lists are encoded as strings by <span class="code">term_to_binary/1</span>,
          even if it was not intended.</p>
        <p>The string is copied to <span class="code">p</span>, and enough space must be
          allocated. The returned string is null terminated so you
          need to add an extra byte to the memory requirement.</p>
      </p></div>
    <p><a name="ei_decode_atom"><span class="bold_code">int ei_decode_atom(const char *buf, int *index, char *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes an atom from the binary format.  The
          name of the atom is placed at <span class="code">p</span>. There can be at most
          <span class="code">MAXATOMLEN</span> bytes placed in the buffer.</p>
      </p></div>
    <p><a name="ei_decode_binary"><span class="bold_code">int ei_decode_binary(const char *buf, int *index, void *p, long *len)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a binary from the binary format. The
          <span class="code">len</span> parameter is set to the actual size of the
          binary. Note that <span class="code">ei_decode_binary()</span> assumes that there
          are enough room for the binary. The size required can be
          fetched by <span class="code">ei_get_type()</span>.</p>
      </p></div>
    <p><a name="ei_decode_fun"><span class="bold_code">int ei_decode_fun(const char *buf, int *index, erlang_fun *p)</span></a><br><a name="free_fun"><span class="bold_code">void free_fun(erlang_fun* f)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a fun from the binary format. The
          <span class="code">p</span> parameter should be NULL or point to an
          <span class="code">erlang_fun</span> structure. This is the only decode
          function that allocates memory; when the <span class="code">erlang_fun</span>
          is no longer needed, it should be freed with
          <span class="code">free_fun</span>. (This has to do with the arbitrary size of
          the environment for a fun.)</p>
      </p></div>
    <p><a name="ei_decode_pid"><span class="bold_code">int ei_decode_pid(const char *buf, int *index, erlang_pid *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Decodes a pid, process identifier, from the binary format.</p>
      </p></div>
    <p><a name="ei_decode_port"><span class="bold_code">int ei_decode_port(const char *buf, int *index, erlang_port *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a port identifier from the binary
          format.</p>
      </p></div>
    <p><a name="ei_decode_ref"><span class="bold_code">int ei_decode_ref(const char *buf, int *index, erlang_ref *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a reference from the binary format.</p>
      </p></div>
    <p><a name="ei_decode_trace"><span class="bold_code">int ei_decode_trace(const char *buf, int *index, erlang_trace *p)</span></a><br></p>
<div class="REFBODY"><p>
        <p>Decodes an erlang trace token from the binary format.</p>
      </p></div>
    <p><a name="ei_decode_tuple_header"><span class="bold_code">int ei_decode_tuple_header(const char *buf, int *index, int *arity)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a tuple header, the number of elements
          is returned in <span class="code">arity</span>. The tuple elements follows in order in
          the buffer.</p>
      </p></div>
    <p><a name="ei_decode_list_header"><span class="bold_code">int ei_decode_list_header(const char *buf, int *index, int *arity)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a list header from the binary
          format. The number of elements is returned in
          <span class="code">arity</span>. The <span class="code">arity+1</span> elements follows (the last
          one is the tail of the list, normally an empty list.) If
          <span class="code">arity</span> is <span class="code">0</span>, it's an empty list.</p>
        <p>Note that lists are encoded as strings, if they consist
          entirely of integers in the range 0..255. This function will
          not decode such strings, use <span class="code">ei_decode_string()</span>
          instead.</p>
      </p></div>
    <p><a name="ei_decode_ei_term"><span class="bold_code">int ei_decode_ei_term(const char* buf, int* index, ei_term* term)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes any term, or at least tries to. If the
          term pointed at by <span class="code">*index</span> in <span class="code">buf</span> fits in the
          <span class="code">term</span> union, it is decoded, and the appropriate field
          in <span class="code">term-&gt;value</span> is set, and <span class="code">*index</span> is
          incremented by the term size.</p>
        <p>The function returns 1 on successful decoding, -1 on error,
          and 0 if the term seems alright, but does not fit in the
          <span class="code">term</span> structure. If it returns 1, the <span class="code">index</span>
          will be incremented, and the <span class="code">term</span> contains the
          decoded term.</p>
        <p>The <span class="code">term</span> structure will contain the arity for a tuple
          or list, size for a binary, string or atom. It will contains
          a term if it's any of the following: integer, float, atom,
          pid, port or ref.</p>
      </p></div>
    <p><a name="ei_decode_term"><span class="bold_code">int ei_decode_term(const char *buf, int *index, void *t)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function decodes a term from the binary format. The
          term is return in <span class="code">t</span> as a <span class="code">ETERM*</span>, so <span class="code">t</span>
          is actually an <span class="code">ETERM**</span> (see
          <span class="code">erl_interface(3)</span>. The term should later be
          deallocated.</p>
        <p>Note that this function is located in the erl_interface
          library.</p>
      </p></div>
    <p><a name="ei_print_term"><span class="bold_code">int ei_print_term(FILE* fp, const char* buf, int* index)</span></a><br><a name="ei_s_print_term"><span class="bold_code">int ei_s_print_term(char** s, const char* buf, int* index)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function prints a term, in clear text, to the file
          given by <span class="code">fp</span>, or the buffer pointed to by <span class="code">s</span>. It
          tries to resemble the term printing in the erlang shell.</p>
        <p>In <span class="code">ei_s_print_term()</span>, the parameter <span class="code">s</span> should
          point to a dynamically (malloc) allocated string of
          <span class="code">BUFSIZ</span> bytes or a NULL pointer. The string may be
          reallocated (and <span class="code">*s</span> may be updated) by this function
          if the result is more than <span class="code">BUFSIZ</span> characters. The
          string returned is zero-terminated.</p>
        <p>The return value is the number of characters written to the
          file or string, or -1 if <span class="code">buf[index]</span> doesn't contain a
          valid term. Unfortunately, I/O errors on <span class="code">fp</span> is not
          checked.</p>
        <p>The argument <span class="code">index</span> is updated, i.e. this function can
          be viewed as en decode function that decodes a term into a
          human readable format.</p>
      </p></div>
    <p><a name="ei_x_format"><span class="bold_code">int ei_x_format(ei_x_buff* x, const char* fmt, ...)</span></a><br><a name="ei_x_format_wo_ver"><span class="bold_code">int ei_x_format_wo_ver(ei_x_buff* x, const char *fmt, ... )</span></a><br></p>
<div class="REFBODY"><p>
        <p>Format a term, given as a string, to a buffer. This
          functions works like a sprintf for erlang terms. The
          <span class="code">fmt</span> contains a format string, with arguments like
          <span class="code">~d</span>, to insert terms from variables. The following
          formats are supported (with the C types given):</p>
        <p></p>
        <div class="example"><pre>
~a - an atom, char*
~c - a character, char
~s - a string, char*
~i - an integer, int
~l - a long integer, long int
~u - a unsigned long integer, unsigned long int
~f - a float, float
~d - a double float, double float
~p - an Erlang PID, erlang_pid*
        </pre></div>
        <p>For instance, to encode a tuple with some stuff:</p>
        <div class="example"><pre>
ei_x_format("{~a,~i,~d}", "numbers", 12, 3.14159)
encodes the tuple {numbers,12,3.14159}
        </pre></div>
        <p>The <span class="code">ei_x_format_wo_ver()</span> formats into a buffer, without
          the initial version byte.</p>
      </p></div>
    <p><a name="ei_x_new"><span class="bold_code">int ei_x_new(ei_x_buff* x)</span></a><br><a name="ei_x_new_with_version"><span class="bold_code">int ei_x_new_with_version(ei_x_buff* x)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function allocates a new <span class="code">ei_x_buff</span> buffer. The
          fields of the structure pointed to by <span class="code">x</span> parameter is
          filled in, and a default buffer is allocated. The
          <span class="code">ei_x_new_with_version()</span> also puts an initial version
          byte, that is used in the binary format. (So that
          <span class="code">ei_x_encode_version()</span> won't be needed.)</p>
      </p></div>
    <p><a name="ei_x_free"><span class="bold_code">int ei_x_free(ei_x_buff* x)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function frees an <span class="code">ei_x_buff</span> buffer. The memory
          used by the buffer is returned to the OS.</p>
      </p></div>
    <p><a name="ei_x_append"><span class="bold_code">int ei_x_append(ei_x_buff* x, const ei_x_buff* x2)</span></a><br><a name="ei_x_append_buf"><span class="bold_code">int ei_x_append_buf(ei_x_buff* x, const char* buf, int len)</span></a><br></p>
<div class="REFBODY"><p>
        <p>These functions appends data at the end of the buffer <span class="code">x</span>.</p>
      </p></div>
    <p><a name="ei_skip_term"><span class="bold_code">int ei_skip_term(const char* buf, int* index)</span></a><br></p>
<div class="REFBODY"><p>
        <p>This function skips a term in the given buffer, it
          recursively skips elements of lists and tuples, so that a
          full term is skipped. This is a way to get the size of an
          erlang term.</p>
        <p><span class="code">buf</span> is the buffer.</p>
        <p><span class="code">index</span> is updated to point right after the term in the
          buffer.</p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>This can be useful when you want to hold arbitrary
            terms: just skip them and copy the binary term data to some
            buffer.</p>
        </p></div>
</div>
        <p>The function returns <span class="code">0</span> on success and <span class="code">-1</span> on
          failure.</p>
      </p></div>
  

  <h3><a name="id69995">Debug Information</a></h3>
<div class="REFBODY">
    
    <p>Some tips on what to check when the emulator doesn't seem to
      receive the terms that you send.</p>
    <ul>
      <li>be careful with the version header, use
      <span class="code">ei_x_new_with_version()</span> when appropriate</li>
      <li>turn on distribution tracing on the erlang node</li>
      <li>check the result codes from ei_decode_-calls</li>
    </ul>
  </div>

  <h3><a name="id70028">See Also</a></h3>
<div class="REFBODY">
    
    <p>erl_interface(3)</p>
  </div>
</div>
<div class="footer">
<hr>
<p>Copyright © 1998-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>