diff --git a/app/dmlua.f90 b/app/dmlua.f90 index 8b61f63..74e39e5 100644 --- a/app/dmlua.f90 +++ b/app/dmlua.f90 @@ -59,7 +59,11 @@ program dmlua end if ! Register DMPACK API for Lua. - rc = dm_lua_api_register(lua, add_errors=.true., add_levels=.true., add_procedures=.true.) + rc = dm_lua_api_register(lua = lua, & + add_errors = .true., & + add_log_levels = .true., & + add_procedures = .true., & + add_response_types = .true.) if (dm_is_error(rc)) then call dm_log_error('failed to register Lua API', error=rc) diff --git a/app/dmserial.f90 b/app/dmserial.f90 index a7f5bc0..21398e7 100644 --- a/app/dmserial.f90 +++ b/app/dmserial.f90 @@ -290,7 +290,7 @@ integer function read_config(app) result(rc) rc = E_NONE if (len_trim(app%config) == 0) return - rc = dm_config_open(config, app%config, app%name) + rc = dm_config_open(config, app%config, app%name, geocom=.true.) if (dm_is_ok(rc)) then rc = dm_config_get(config, 'baudrate', app%baud_rate) diff --git a/src/dm_config.f90 b/src/dm_config.f90 index a73f4e9..c8469fc 100644 --- a/src/dm_config.f90 +++ b/src/dm_config.f90 @@ -73,14 +73,15 @@ integer function dm_config_open(config, path, name, geocom) result(rc) if (.not. dm_file_exists(path)) exit open_block ! Initialise Lua interpreter. - rc = dm_lua_init(config%lua) + rc = dm_lua_init(config%lua, libs=.true.) if (dm_is_error(rc)) exit open_block ! Register DMPACK API for Lua. rc = dm_lua_api_register(config%lua, & - add_errors = .true., & ! Add error codes. - add_levels = .true., & ! Add log levels. - add_procedures = .true.) ! Add Lua procedures. + add_errors = .true., & ! Add error codes. + add_log_levels = .true., & ! Add log levels. + add_procedures = .true., & ! Add Lua procedures. + add_response_types = .true.) ! Add response types. if (dm_is_error(rc)) exit open_block ! Register GeoCOM API for Lua. diff --git a/src/dm_db.f90 b/src/dm_db.f90 index 0c9b745..bf0fd63 100644 --- a/src/dm_db.f90 +++ b/src/dm_db.f90 @@ -444,7 +444,7 @@ integer function dm_db_close(db, optimize) result(rc) if (optimize_) rc = dm_db_optimize(db) rc = E_DB - if (sqlite3_close_v2(db%ptr) /= SQLITE_OK) return + if (sqlite3_close(db%ptr) /= SQLITE_OK) return db%ptr = c_null_ptr rc = E_NONE @@ -765,7 +765,7 @@ integer function dm_db_delete_log(db, log_id) result(rc) !! * `E_DB_BIND` if value binding failed. !! * `E_DB_PREPARE` if statement preparation failed. !! * `E_DB_STEP` if step execution failed or no write permission. - !! * `E_INVALID` if node id is invalid. + !! * `E_INVALID` if log id is invalid. !! * `E_READ_ONLY` if database is opened read-only. type(db_type), intent(inout) :: db !! Database type. character(len=*), intent(in) :: log_id !! Log id. @@ -847,7 +847,7 @@ integer function dm_db_delete_observ(db, observ_id) result(rc) !! * `E_DB_ROLLBACK` if transaction rollback failed. !! * `E_DB_STEP` if step execution failed or no write permission. !! * `E_DB_TRANSACTION` if transaction failed. - !! * `E_INVALID` if node id is invalid. + !! * `E_INVALID` if observation id is invalid. !! * `E_READ_ONLY` if database is opened read-only. type(db_type), intent(inout) :: db !! Database type. character(len=*), intent(in) :: observ_id !! Observation id. @@ -899,7 +899,7 @@ integer function dm_db_delete_sensor(db, sensor_id) result(rc) !! * `E_DB_BIND` if value binding failed. !! * `E_DB_PREPARE` if statement preparation failed. !! * `E_DB_STEP` if step execution failed or no write permission. - !! * `E_INVALID` if node id is invalid. + !! * `E_INVALID` if sensor id is invalid. !! * `E_READ_ONLY` if database is opened read-only. type(db_type), intent(inout) :: db !! Database type. character(len=*), intent(in) :: sensor_id !! Sensor id. @@ -937,7 +937,7 @@ integer function dm_db_delete_target(db, target_id) result(rc) !! * `E_DB_BIND` if value binding failed. !! * `E_DB_PREPARE` if statement preparation failed. !! * `E_DB_STEP` if step execution failed or no write permission. - !! * `E_INVALID` if node id is invalid. + !! * `E_INVALID` if target id is invalid. !! * `E_READ_ONLY` if database is opened read-only. type(db_type), intent(inout) :: db !! Database type. character(len=*), intent(in) :: target_id !! Target id. diff --git a/src/dm_test.f90 b/src/dm_test.f90 index 24a795a..746e3b9 100644 --- a/src/dm_test.f90 +++ b/src/dm_test.f90 @@ -29,16 +29,16 @@ module dm_test integer, parameter :: TEST_COLORS(0:3) = [ COLOR_WHITE, COLOR_YELLOW, COLOR_GREEN, COLOR_RED ] abstract interface - logical function dm_test_function() + logical function dm_test_callback() !! Logical test function that either returns `TEST_PASSED` or !! `TEST_FAILED`. - end function dm_test_function + end function dm_test_callback end interface type, public :: test_type !! Test type. - character(len=TEST_NAME_LEN) :: name = 'N/A' !! Test name. - procedure(dm_test_function), pointer, nopass :: proc !! Test procedure. + character(len=TEST_NAME_LEN) :: name = 'N/A' !! Test name. + procedure(dm_test_callback), pointer, nopass :: proc => null() !! Test procedure. end type test_type interface dm_test_dummy @@ -52,6 +52,7 @@ end function dm_test_function module procedure :: dm_test_dummy_target end interface + public :: dm_test_callback public :: dm_test_dummy public :: dm_test_dummy_beat public :: dm_test_dummy_log @@ -60,7 +61,6 @@ end function dm_test_function public :: dm_test_dummy_request public :: dm_test_dummy_sensor public :: dm_test_dummy_target - public :: dm_test_function public :: dm_test_run public :: dm_test_skip contains