[project @ 2002-07-28 14:10:03 by krasimir]
authorkrasimir <unknown>
Sun, 28 Jul 2002 14:10:03 +0000 (14:10 +0000)
committerkrasimir <unknown>
Sun, 28 Jul 2002 14:10:03 +0000 (14:10 +0000)
Documentation for #size

ghc/docs/users_guide/utils.sgml

index 6eb8ada..76a7234 100644 (file)
        <title>Ctags and Etags for Haskell: <command>hasktags</command></title>
        <indexterm><primary><command>hasktags</command></primary></indexterm>
        <indexterm><primary>CTAGS for Haskell</primary></indexterm>
-       
+
        <para><command>hasktags</command> is a very simple Haskell program that produces ctags "tags" and etags "TAGS" files for Haskell programs.</para>
-       
+
        <para>When loaded into an editor such an NEdit, Vim, or Emacs, this allows one to easily navigate around a multi-file program, finding definitions of functions, types, and constructors.</para>
-       
+
        <para>Invocation Syntax:</para>
-       
+
 <screen>
-hasktags files 
+hasktags files
 </screen>
 
 <para>This will read all the files listed in <option>files</option> and produce a ctags "tags" file and an etags "TAGS" file in the current directory.</para>
-       
+
        <para>Example usage</para>
-       
+
 <screen>
 find -name \*.\*hs | xargs hasktags
 </screen>
 
 <para>This will find all haskell source files in the current directory and below, and create tags files indexing them in the current directory.</para>
-       
+
        <para><command>hasktags</command> is a simple program that uses simple
-       parsing rules to find definitions of functions, constructors, and types. It isn't guranteed to find everything, and will sometimes create false index entries, but it usually gets the job done fairly well. In particular, at present, functions are only indexed if a type signature is given for them.</para>        
-       
+       parsing rules to find definitions of functions, constructors, and types. It isn't guranteed to find everything, and will sometimes create false index entries, but it usually gets the job done fairly well. In particular, at present, functions are only indexed if a type signature is given for them.</para>
+
        <para>Before hasktags, there used to be <command>fptags</command> and <command>hstags</command>, which did essentially the same job, however neither of these seem to be maintained any more.</para>
 
 <sect2>
@@ -46,7 +46,7 @@ find -name \*.\*hs | xargs hasktags
 
 
 </sect2>
-       
+
 </sect1>
 
 <!-- comment: hstags doesn't work anymore
@@ -444,8 +444,8 @@ tags:
          <term><literal>#peek struct_type, field</literal></term>
          <listitem>
            <para>A function that peeks a field of a C struct will be
-           output.  It will have the type 
-              <literal>Storable b => Ptr a -> IO b</literal>.  
+           output.  It will have the type
+              <literal>Storable b => Ptr a -> IO b</literal>.
 
             The intention is that <literal>#peek</literal> and
             <literal>#poke</literal> can be used for implementing the
@@ -459,7 +459,7 @@ tags:
        <varlistentry>
          <term><literal>#poke struct_type, field</literal></term>
          <listitem>
-           <para>Similarly for poke. It will have the type 
+           <para>Similarly for poke. It will have the type
               <literal>Storable b => Ptr a -> b -> IO ()</literal>.</para>
          </listitem>
        </varlistentry>
@@ -483,6 +483,15 @@ tags:
        </varlistentry>
 
        <varlistentry>
+         <term><literal>#size struct_type</literal></term>
+         <listitem>
+               <para>Computes the size, in bytes, of
+               <literal>struct_type</literal>. It will have type
+               <literal>Int</literal>.</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
          <term><literal>#enum type, constructor, value, value, ...</literal></term>
          <listitem>
            <para>A shortcut for multiple definitions which use
@@ -523,7 +532,7 @@ tags:
       prefixed by <literal>hsc_</literal> that handles the construct
       by emitting the expansion to stdout. See
       <filename>template-hsc.h</filename> for examples.</para>
-      
+
       <para>Such macros can also be defined directly in the
       source. They are useful for making a <literal>#let</literal>-like
       macro whose expansion uses other <literal>#let</literal> macros.