Skip to content

Commit

Permalink
Merge pull request #102 from Statoil/one-res-lib
Browse files Browse the repository at this point in the history
Link to library res
  • Loading branch information
joakim-hove authored Apr 4, 2018
2 parents 83fa073 + 92b2ad5 commit f6aa3b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libert/applications/ert_tui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set( src_list main.c enkf_tui_main.c enkf_tui_fs.c enkf_tui_ranking.c enkf_tu
set_source_files_properties( main.c PROPERTIES COMPILE_DEFINITIONS "COMPILE_TIME_STAMP=\"${ERT_BUILD_TIME}\";GIT_COMMIT=\"${GIT_COMMIT}\"")

add_executable( ert_tui ${src_list} )
target_link_libraries( ert_tui res::enkf ert )
target_link_libraries( ert_tui res::res ert )
if (USE_RUNPATH)
add_runpath( ert_tui )
endif()
Expand Down
30 changes: 15 additions & 15 deletions python/python/ert_gui/shell/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

import cwrap.clib as clib
UTIL_LIB = ecl.load("libecl")
RES_UTIL_LIB = ecl.load("libres_util")
RES_LIB = ecl.load("libres")

RES_UTIL_LIB.block_fs_is_mount.restype = ctypes.c_bool
RES_UTIL_LIB.block_fs_mount.restype = ctypes.c_void_p
RES_UTIL_LIB.block_fs_alloc_filelist.restype = ctypes.c_void_p
RES_UTIL_LIB.block_fs_close.restype = ctypes.c_void_p
RES_LIB.block_fs_is_mount.restype = ctypes.c_bool
RES_LIB.block_fs_mount.restype = ctypes.c_void_p
RES_LIB.block_fs_alloc_filelist.restype = ctypes.c_void_p
RES_LIB.block_fs_close.restype = ctypes.c_void_p

UTIL_LIB.vector_get_size.restype = ctypes.c_int
UTIL_LIB.vector_iget_const.restype = ctypes.c_void_p
UTIL_LIB.vector_free.restype = ctypes.c_void_p

RES_UTIL_LIB.user_file_node_get_filename.restype = ctypes.c_char_p
RES_UTIL_LIB.user_file_node_get_data_size.restype = ctypes.c_int
RES_UTIL_LIB.user_file_node_get_node_offset.restype = ctypes.c_long
RES_LIB.user_file_node_get_filename.restype = ctypes.c_char_p
RES_LIB.user_file_node_get_data_size.restype = ctypes.c_int
RES_LIB.user_file_node_get_node_offset.restype = ctypes.c_long

class Storage(ErtShellCollection):
def __init__(self, parent):
Expand All @@ -49,12 +49,12 @@ def ls(self, line):
if not os.path.isfile(block_file):
self.lastCommandFailed("The path: '%s' is not a file." % block_file)
else:
if not RES_UTIL_LIB.block_fs_is_mount(block_file):
if not RES_LIB.block_fs_is_mount(block_file):
_, filename = os.path.split(block_file)
self.lastCommandFailed("The file: '%s' is not a block mount file." % filename)
else:
block_fs = RES_UTIL_LIB.block_fs_mount(block_file, 1, 0, 1, 0, False, True, False)
files = RES_UTIL_LIB.block_fs_alloc_filelist(block_fs, pattern, OFFSET_SORT, False)
block_fs = RES_LIB.block_fs_mount(block_file, 1, 0, 1, 0, False, True, False)
files = RES_LIB.block_fs_alloc_filelist(block_fs, pattern, OFFSET_SORT, False)

file_count = UTIL_LIB.vector_get_size(files)

Expand All @@ -64,13 +64,13 @@ def ls(self, line):

for index in range(file_count):
node = UTIL_LIB.vector_iget_const(files, index)
node_filename = RES_UTIL_LIB.user_file_node_get_filename(node)
node_size = RES_UTIL_LIB.user_file_node_get_data_size(node)
node_offset = RES_UTIL_LIB.user_file_node_get_node_offset(node)
node_filename = RES_LIB.user_file_node_get_filename(node)
node_size = RES_LIB.user_file_node_get_data_size(node)
node_offset = RES_LIB.user_file_node_get_node_offset(node)
print(fmt % (node_filename, node_size, node_offset))

UTIL_LIB.vector_free(files)
RES_UTIL_LIB.block_fs_close(block_fs)
RES_LIB.block_fs_close(block_fs)


def completeLs(self, text, line, begidx, endidx):
Expand Down

0 comments on commit f6aa3b3

Please sign in to comment.