changeset 310:e95e5572cd6d

Added utils doc page
author Windel Bouwman
date Fri, 13 Dec 2013 14:10:10 +0100
parents 68b01c8abf8a
children ff665880a6b0
files doc/compiler.rst doc/index.rst doc/utils.rst python/ppci/ir.py
diffstat 4 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/doc/compiler.rst	Fri Dec 13 13:51:02 2013 +0100
+++ b/doc/compiler.rst	Fri Dec 13 14:10:10 2013 +0100
@@ -36,7 +36,7 @@
 The intermediate representation (IR) of a program de-couples the front end
 from the backend of the compiler.
 
-See ir for details about all the available instructions.
+See :doc:`ir` for details about all the available instructions.
 
 
 C3 Front-end
@@ -56,7 +56,7 @@
    99 [label="IR-code object"]
    1 -> 10
    10 -> 20
-   20 -> 40 [label="AST tree"]
+   20 -> 40
    40 -> 99
    }
 
--- a/doc/index.rst	Fri Dec 13 13:51:02 2013 +0100
+++ b/doc/index.rst	Fri Dec 13 14:10:10 2013 +0100
@@ -6,25 +6,11 @@
 Welcome to lcfos's documentation!
 =================================
 
-Contents:
-
 .. toctree::
    :maxdepth: 2
 
    readme_link
    design
    compiler
-   ir
-
-
->>> from utils import HexFile
->>> h = HexFile()
-
+   utils
 
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/utils.rst	Fri Dec 13 14:10:10 2013 +0100
@@ -0,0 +1,20 @@
+
+Utilities
+=========
+
+Hexfile manipulation
+--------------------
+
+
+.. autoclass:: utils.HexFile
+
+
+>>> from utils import HexFile
+>>> h = HexFile()
+>>> h.dump()
+Hexfile containing 0 bytes
+>>> h.addRegion(0, bytes([1,2,3]))
+>>> h
+Hexfile containing 3 bytes
+
+
--- a/python/ppci/ir.py	Fri Dec 13 13:51:02 2013 +0100
+++ b/python/ppci/ir.py	Fri Dec 13 14:10:10 2013 +0100
@@ -2,6 +2,7 @@
 Intermediate representation (IR) code classes.
 """
 
+
 class Module:
     """ Container unit for variables and functions. """
     def __init__(self, name):
@@ -369,6 +370,7 @@
 
     def setTarget(self, t):
         self.Targets[0] = t
+
     target = property(lambda s: s.Targets[0], setTarget)
 
     def __repr__(self):