Changeset 1473 for trunk/bindings/python


Ignore:
Timestamp:
09/05/10 14:28:15 (21 months ago)
Author:
Freddie Akeroyd
Message:

Improve comments and reference test programs. Refs #231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bindings/python/nxs/napi.py

    r1461 r1473  
    1414looks in the following places in order:: 
    1515 
    16     os.environ['NEXUSLIB']                  - All 
    17     directory containing nxs.py             - All 
    18     os.environ['NEXUSDIR']\bin              - Windows 
    19     os.environ['LD_LIBRARY_PATH']           - Unix 
    20     os.environ['DYLD_LIBRARY_PATH']         - Darwin 
    21     PREFIX/lib                              - Unix and Darwin 
    22     /usr/local/lib                          - Unix and Darwin 
    23     /usr/lib                                - Unix and Darwin 
    24  
    25 On Windows it looks for one of libNeXus.dll or libNeXus-0.dll. 
    26 On OS X it looks for libNeXus.dylib 
    27 On Unix it looks for libNeXus.so 
    28 NEXUSDIR defaults to r'C:\Program Files\NeXus Data Format'. 
    29 PREFIX defaults to /usr/local, but is replaced by the value of 
    30 --prefix during configure. 
     16@verbatim 
     17   os.environ['NEXUSLIB']                  - All 
     18   directory containing nxs.py             - All 
     19   os.environ['NEXUSDIR']\bin              - Windows 
     20   os.environ['LD_LIBRARY_PATH']           - Unix 
     21   os.environ['DYLD_LIBRARY_PATH']         - Darwin 
     22   PREFIX/lib                              - Unix and Darwin 
     23   /usr/local/lib                          - Unix and Darwin 
     24   /usr/lib                                - Unix and Darwin 
     25@endverbatim 
     26 
     27- On Windows it looks for one of libNeXus.dll or libNeXus-0.dll. 
     28- On OS X it looks for libNeXus.dylib 
     29- On Unix it looks for libNeXus.so 
     30- NEXUSDIR defaults to 'C:\\Program Files\\NeXus Data Format'. 
     31- PREFIX defaults to /usr/local, but is replaced by the value of --prefix during configure. 
    3132 
    3233The import will raise an OSError exception if the library wasn't found 
     
    4041Example 
    4142======= 
    42  
     43@code 
    4344  import nxs 
    4445  file = nxs.open('filename.nxs','rw') 
     
    4748  print file.getdata() 
    4849  file.close() 
    49  
    50   See nxstest.py for a more complete example. 
     50@endcode 
     51 
     52  See @example nxstest.py for a more complete example. 
    5153 
    5254Interface 
     
    7173File open modes can be constants or strings:: 
    7274 
    73   nxs.ACC_READ      'r' 
    74   nxs.ACC_RDWR      'rw' 
    75   nxs.ACC_CREATE    'w' 
    76   nxs.ACC_CREATE4   'w4' 
    77   nxs.ACC_CREATE5   'w5' 
    78   nxs.ACC_CREATEXML 'wx' 
     75@verbatim 
     76 nxs.ACC_READ      'r' 
     77 nxs.ACC_RDWR      'rw' 
     78 nxs.ACC_CREATE    'w' 
     79 nxs.ACC_CREATE4   'w4' 
     80 nxs.ACC_CREATE5   'w5' 
     81 nxs.ACC_CREATEXML 'wx' 
     82@endverbatim 
    7983 
    8084Dimension constants:: 
    8185 
    82   nxs.UNLIMITED  - for the extensible data dimension 
    83   nxs.MAXRANK    - for the number of possible dimensions 
     86  - nxs.UNLIMITED  - for the extensible data dimension 
     87  - nxs.MAXRANK    - for the number of possible dimensions 
    8488 
    8589Data types are strings corresponding to the numpy data types:: 
     
    104108Miscellaneous constants:: 
    105109 
    106   nxs.MAXNAMELEN  - names must be shorter than this 
    107   nxs.MAXPATHLEN  - total path length must be shorter than this 
    108   nxs.H4SKIP - class names that may appear in HDF4 files but can be ignored 
     110  - nxs.MAXNAMELEN  - names must be shorter than this 
     111  - nxs.MAXPATHLEN  - total path length must be shorter than this 
     112  - nxs.H4SKIP - class names that may appear in HDF4 files but can be ignored 
    109113 
    110114Caveats 
    111115======= 
    112116 
    113 TODO: NOSTRIP constant is probably not handled properly, 
    114 TODO: Embedded nulls in strings is not supported 
    115  
    116 WARNING:  We have a memory leak.  Calling open/close costs about 90k a pair. 
     117@todo NOSTRIP constant is probably not handled properly, 
     118@todo Embedded nulls in strings is not supported 
     119 
     120@warning  We have a memory leak.  Calling open/close costs about 90k a pair. 
    117121This is an eigenbug: 
    118    - if I test ctypes on a simple library it does not leak 
    119    - if I use the leak_test1 code in the nexus distribution it doesn't leak 
    120    - if I remove the open/close call in the wrapper it doesn't leak. 
    121  
    122 .. _NAPI:  http://www.nexusformat.org/Application_Program_Interface 
     122 - if I test ctypes on a simple library it does not leak 
     123 - if I use the leak_test1 code in the nexus distribution it doesn't leak 
     124 - if I remove the open/close call in the wrapper it doesn't leak. 
     125 
    123126""" 
     127 
    124128__all__ = ['UNLIMITED', 'MAXRANK', 'MAXNAMELEN','MAXPATHLEN','H4SKIP', 
    125129           'NeXus','NeXusError','open'] 
Note: See TracChangeset for help on using the changeset viewer.