From 796ce8ede7b1802bed0f768a30eb16cc777e6be7 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 8 Mar 2024 17:21:50 +0100 Subject: [PATCH] Minor updates. Fixed type issues. --- README.md | 4 +- adoc/dmuuid.adoc | 12 ++-- man/dmuuid.1 | 16 ++--- src/dm_geocom.f90 | 141 +++++++++++++++++++----------------------- src/dm_geocom_api.f90 | 118 +++++++++++++++++------------------ src/dm_rpc.f90 | 23 ++++--- src/dm_tty.f90 | 69 +++++++++++++-------- 7 files changed, 199 insertions(+), 184 deletions(-) diff --git a/README.md b/README.md index 8eb7c4c..026ab37 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ this package: * zlib On Linux, additional development headers are required for the build step. To -generate the [man pages](adoc/README.md), the [user’s guide](guide/README.md), +generate the [man pages](adoc/README.md), the [User’s Guide](guide/README.md), and the source code documentation, you will need to install: * [AsciiDoctor](https://asciidoctor.org/), [Pygments](https://pygments.org/), and @@ -301,7 +301,7 @@ The output files are written to `man/`. ## User’s Guide -To convert the [User’s Guide](guide/guide.adoc) from AsciiDoc to HTML, run: +To convert the [User’s Guide](guide/README.md) from AsciiDoc to HTML, run: ``` $ make guide diff --git a/adoc/dmuuid.adoc b/adoc/dmuuid.adoc index 574d673..394bccb 100644 --- a/adoc/dmuuid.adoc +++ b/adoc/dmuuid.adoc @@ -21,11 +21,11 @@ dmuuid - generates pseudo-random UUID4s == DESCRIPTION -The *dmuuid* program generates pseudo-random UUID4s. By default, DMPACK uses -32 characters long UUID4s in hexadecimal format (without hyphens). Hyphens can -be added by a command-line flag. The option `--convert` expects UUID4s to be -passed via standard input. Invalid UUID4s will be replaced with the default -UUID4. +The *dmuuid* program generates pseudo-random UUID4s. By default, DMPACK uses 32 +characters long identifers in hexadecimal format (without hyphens). If +command-line flag `--hyphens` is set, 36 characters long identifiers with +hyphens are returned. The option `--convert` expects UUID4s to be passed via +standard input. Invalid identifiers will be replaced with the default UUID4. == OPTIONS @@ -56,7 +56,7 @@ UUID4. == EXAMPLE -Create three random UUIDs: +Create three random identifiers: .... $ dmuuid --count 3 diff --git a/man/dmuuid.1 b/man/dmuuid.1 index be7dd17..4803ca4 100644 --- a/man/dmuuid.1 +++ b/man/dmuuid.1 @@ -2,12 +2,12 @@ .\" Title: dmuuid .\" Author: Philipp Engel .\" Generator: Asciidoctor 2.0.20 -.\" Date: 2024-02-16 +.\" Date: 2024-03-07 .\" Manual: User Commands .\" Source: DMUUID .\" Language: English .\" -.TH "DMUUID" "1" "2024-02-16" "DMUUID" "User Commands" +.TH "DMUUID" "1" "2024-03-07" "DMUUID" "User Commands" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -40,11 +40,11 @@ dmuuid \- generates pseudo\-random UUID4s \fBdmuuid\fP \-\-\fBconvert\fP < \fIfile\fP .SH "DESCRIPTION" .sp -The \fBdmuuid\fP program generates pseudo\-random UUID4s. By default, DMPACK uses -32 characters long UUID4s in hexadecimal format (without hyphens). Hyphens can -be added by a command\-line flag. The option \f(CR\-\-convert\fP expects UUID4s to be -passed via standard input. Invalid UUID4s will be replaced with the default -UUID4. +The \fBdmuuid\fP program generates pseudo\-random UUID4s. By default, DMPACK uses 32 +characters long identifers in hexadecimal format (without hyphens). If +command\-line flag \f(CR\-\-hyphens\fP is set, 36 characters long identifiers with +hyphens are returned. The option \f(CR\-\-convert\fP expects UUID4s to be passed via +standard input. Invalid identifiers will be replaced with the default UUID4. .SH "OPTIONS" .sp \fB\-\-convert\fP, \fB\-C\fP @@ -86,7 +86,7 @@ UUID generation failed. .RE .SH "EXAMPLE" .sp -Create three random UUIDs: +Create three random identifiers: .sp .if n .RS 4 .nf diff --git a/src/dm_geocom.f90 b/src/dm_geocom.f90 index 71dfb0a..66811f5 100644 --- a/src/dm_geocom.f90 +++ b/src/dm_geocom.f90 @@ -24,7 +24,6 @@ module dm_geocom !! call geocom%close() !! ``` use :: dm_error - use :: dm_file use :: dm_geocom_api use :: dm_geocom_error use :: dm_geocom_type @@ -40,25 +39,23 @@ module dm_geocom !! GeoCOM class for TTY access and GeoCOM API handling through the !! public methods. Objects of this class are not thread-safe. private - character(len=FILE_PATH_LEN) :: path = ' ' !! TTY device path. - integer :: baud_rate = GEOCOM_COM_BAUD_19200 !! GeoCOM baud rate enumerator (`GEOCOM_COM_BAUD_RATE`). - integer :: grc = GRC_OK !! Last GeoCOM return code. - integer :: rc = E_NONE !! Last DMPACK return code. - logical :: verbose = .false. !! Print error messages to stderr. - type(request_type) :: request !! Last request sent to sensor. - type(tty_type) :: tty !! TTY type for serial connection. + integer :: baud = GEOCOM_COM_BAUD_19200 !! GeoCOM baud rate enumerator (`GEOCOM_COM_BAUD_RATE`). + integer :: grc = GRC_OK !! Last GeoCOM return code. + integer :: rc = E_NONE !! Last DMPACK return code. + logical :: verbose = .false. !! Print error messages to stderr. + type(request_type) :: request !! Last request sent to sensor. + type(tty_type) :: tty !! TTY type for serial connection. contains ! Public class methods. - procedure, public :: close => geocom_close - procedure, public :: code => geocom_code - procedure, public :: error => geocom_error - procedure, public :: get_baud_rate => geocom_get_baud_rate - procedure, public :: get_path => geocom_get_path - procedure, public :: last_request => geocom_last_request - procedure, public :: message => geocom_message - procedure, public :: open => geocom_open - procedure, public :: send => geocom_send - procedure, public :: set_verbose => geocom_set_verbose + procedure, public :: baud_rate => geocom_baud_rate + procedure, public :: close => geocom_close + procedure, public :: code => geocom_code + procedure, public :: error => geocom_error + procedure, public :: last_request => geocom_last_request + procedure, public :: message => geocom_message + procedure, public :: open => geocom_open + procedure, public :: path => geocom_path + procedure, public :: send => geocom_send ! Public GeoCOM-specific methods. procedure, public :: abort_download => geocom_abort_download @@ -81,13 +78,12 @@ module dm_geocom private :: geocom_close private :: geocom_code private :: geocom_error - private :: geocom_get_baud_rate - private :: geocom_get_path + private :: geocom_baud_rate + private :: geocom_path private :: geocom_last_request private :: geocom_message private :: geocom_open private :: geocom_send - private :: geocom_set_verbose ! Private GeoCOM procedures. private :: geocom_abort_download @@ -108,6 +104,22 @@ module dm_geocom ! ************************************************************************** ! PUBLIC METHODS. ! ************************************************************************** + subroutine geocom_baud_rate(this, baud_rate) + !! Returns current baud rate enumerator (`GEOCOM_COM_BAUD_RATE`) of TTY + !! in `baud_rate`. + class(geocom_class), intent(inout) :: this !! GeoCOM object. + integer, intent(out) :: baud_rate !! Baud rate enumerator (`GEOCOM_COM_BAUD_RATE`). + + baud_rate = this%baud + end subroutine geocom_baud_rate + + subroutine geocom_close(this) + !! Closes TTY connection. + class(geocom_class), intent(inout) :: this !! GeoCOM object. + + if (dm_tty_connected(this%tty)) call dm_tty_close(this%tty) + end subroutine geocom_close + integer function geocom_code(this) result(grc) !! Returns last GeoCOM return code. class(geocom_class), intent(inout) :: this !! GeoCOM object. @@ -122,6 +134,16 @@ integer function geocom_error(this) result(rc) rc = this%rc end function geocom_error + subroutine geocom_last_request(this, request) + !! Returns the last request sent to the sensor in `request`. If no + !! request has been sent, the derived type is uninitialised and the time + !! stamp has the default value. + class(geocom_class), intent(inout) :: this !! GeoCOM object. + type(request_type), intent(out) :: request !! Last request sent to sensor. + + request = this%request + end subroutine geocom_last_request + function geocom_message(this, grc) result(message) !! Returns message associated with given GeoCOM return code `grc` as !! allocatable string. If no return code is passed, the one in the @@ -137,52 +159,18 @@ function geocom_message(this, grc) result(message) end if end function geocom_message - subroutine geocom_close(this) - !! Closes TTY connection. - class(geocom_class), intent(inout) :: this !! GeoCOM object. - - if (dm_tty_connected(this%tty)) call dm_tty_close(this%tty) - end subroutine geocom_close - - subroutine geocom_get_baud_rate(this, baud_rate) - !! Returns current baud rate enumerator (`GEOCOM_COM_BAUD_RATE`) of TTY - !! in `baud_rate`. - class(geocom_class), intent(inout) :: this !! GeoCOM object. - integer, intent(out) :: baud_rate !! Baud rate enumerator (`GEOCOM_COM_BAUD_RATE`). - - baud_rate = this%baud_rate - end subroutine geocom_get_baud_rate - - subroutine geocom_get_path(this, path) - !! Returns TTY device path in allocatable character string `path`. - class(geocom_class), intent(inout) :: this !! GeoCOM object. - character(len=:), allocatable, intent(out) :: path !! TTY device path. - - path = trim(this%path) - end subroutine geocom_get_path - - subroutine geocom_last_request(this, request) - !! Returns the last request sent to the sensor in `request`. If no - !! request has been sent, the derived type is uninitialised and the time - !! stamp has the default value. - class(geocom_class), intent(inout) :: this !! GeoCOM object. - type(request_type), intent(out) :: request !! Last request sent to sensor. - - request = this%request - end subroutine geocom_last_request - subroutine geocom_open(this, path, baud_rate, retries, verbose, error) !! Opens TTY connection to robotic total station. !! !! The argument `baud_rate` must be one of the following !! `GEOCOM_COM_BAUD_RATE` enumerators: !! - !! * `GEOCOM_COM_BAUD_2400` – 2400 baud. - !! * `GEOCOM_COM_BAUD_4800` – 4800 baud. - !! * `GEOCOM_COM_BAUD_9600` – 9600 baud. - !! * `GEOCOM_COM_BAUD_19200` – 19200 baud (default). - !! * `GEOCOM_COM_BAUD_38400` – 38400 baud. - !! * `GEOCOM_COM_BAUD_57600` – 57600 baud. + !! * `GEOCOM_COM_BAUD_2400` – 2400 baud. + !! * `GEOCOM_COM_BAUD_4800` – 4800 baud. + !! * `GEOCOM_COM_BAUD_9600` – 9600 baud. + !! * `GEOCOM_COM_BAUD_19200` – 19200 baud (default). + !! * `GEOCOM_COM_BAUD_38400` – 38400 baud. + !! * `GEOCOM_COM_BAUD_57600` – 57600 baud. !! * `GEOCOM_COM_BAUD_115200` – 115200 baud. !! !! Argument `retries` specifies the number of attempts to make to @@ -217,7 +205,6 @@ subroutine geocom_open(this, path, baud_rate, retries, verbose, error) end if ! Initialise TTY type. - this%path = path this%grc = GRC_OK this%rc = E_NONE this%request = request_type() @@ -225,7 +212,7 @@ subroutine geocom_open(this, path, baud_rate, retries, verbose, error) if (present(verbose)) this%verbose = verbose ! Validate and set baud rate. - this%baud_rate = dm_geocom_type_validated(GEOCOM_COM_BAUD_RATE, baud_rate, error=rc) + this%baud = dm_geocom_type_validated(GEOCOM_COM_BAUD_RATE, baud_rate, error=rc) if (dm_is_error(rc)) then if (this%verbose) call dm_error_out(rc, 'invalid baud rate') @@ -234,8 +221,8 @@ subroutine geocom_open(this, path, baud_rate, retries, verbose, error) ! Verify TTY device exists. rc = E_NOT_FOUND - if (.not. dm_file_exists(this%path)) then - if (this%verbose) call dm_error_out(rc, 'TTY ' // trim(this%path) // ' not found') + if (.not. dm_file_exists(path)) then + if (this%verbose) call dm_error_out(rc, 'TTY ' // trim(path) // ' not found') exit tty_block end if @@ -245,15 +232,15 @@ subroutine geocom_open(this, path, baud_rate, retries, verbose, error) ! Try to open TTY. do i = 0, n rc = dm_tty_open(tty = this%tty, & - path = this%path, & - baud_rate = this%baud_rate, & + path = path, & + baud_rate = this%baud, & byte_size = TTY_BYTE_SIZE8, & parity = TTY_PARITY_NONE, & stop_bits = TTY_STOP_BITS1) ! Exit on success. if (dm_is_ok(rc)) exit - if (this%verbose) call dm_error_out(rc, 'failed to open TTY ' // trim(this%path)) + if (this%verbose) call dm_error_out(rc, 'failed to open TTY ' // trim(path)) ! Try again. if (i < n) call dm_sleep(WAIT_TIME) @@ -264,6 +251,14 @@ subroutine geocom_open(this, path, baud_rate, retries, verbose, error) if (present(error)) error = rc end subroutine geocom_open + subroutine geocom_path(this, path) + !! Returns TTY device path in allocatable character string `path`. + class(geocom_class), intent(inout) :: this !! GeoCOM object. + character(len=:), allocatable, intent(out) :: path !! TTY device path. + + path = trim(this%tty%path) + end subroutine geocom_path + subroutine geocom_send(this, request, delay, error) !! Sends request to configured TTY. use :: dm_regex, only: dm_regex_request @@ -325,7 +320,7 @@ subroutine geocom_send(this, request, delay, error) call dm_request_get(request, 'grc', this%grc) ! Wait additional delay. - if (present(delay)) call dm_usleep(max(0, delay) * 1000) + if (present(delay)) call dm_usleep(max(0, delay * 1000)) end block tty_block this%rc = rc @@ -334,14 +329,6 @@ subroutine geocom_send(this, request, delay, error) if (present(error)) error = rc end subroutine geocom_send - subroutine geocom_set_verbose(this, verbose) - !! Enables or disables verbose mode. - class(geocom_class), intent(inout) :: this !! GeoCOM object. - logical, intent(in) :: verbose !! Verbose mode. - - this%verbose = verbose - end subroutine geocom_set_verbose - ! ************************************************************************** ! PUBLIC GEOCOM METHODS. ! ************************************************************************** diff --git a/src/dm_geocom_api.f90 b/src/dm_geocom_api.f90 index 6c74878..faea2c7 100644 --- a/src/dm_geocom_api.f90 +++ b/src/dm_geocom_api.f90 @@ -151,10 +151,10 @@ module dm_geocom_api ! ************************************************************************** ! PRIVATE GEOCOM API CONSTANTS. ! ************************************************************************** - character(len=*), parameter :: GEOCOM_DELIMITER = '\r\n' !! Default GeoCOM delimiter. - character(len=*), parameter :: GEOCOM_PATTERN = '(?\d+)' !! Default GeoCOM response pattern. + character(len=*), parameter :: GEOCOM_DELIMITER = '\r\n' !! Default GeoCOM delimiter. - type(response_type), parameter :: GEOCOM_RESPONSES(1) = [ response_type('grc', type=RESPONSE_TYPE_INT32) ] !! Default GeoCOM responses (GRC only). + character(len=*), parameter :: GRC_PATTERN = '(?\d+)' !! Default response pattern (GRC only). + type(response_type), parameter :: GRC_RESPONSES(1) = [ response_type('grc', type=RESPONSE_TYPE_INT32) ] !! Default responses (GRC only). ! Public procedures. public :: dm_geocom_api_request @@ -336,7 +336,7 @@ pure subroutine dm_geocom_api_request_abort_download(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_abort_download pure subroutine dm_geocom_api_request_abort_list(request) @@ -358,7 +358,7 @@ pure subroutine dm_geocom_api_request_abort_list(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_abort_list pure subroutine dm_geocom_api_request_beep_alarm(request) @@ -380,7 +380,7 @@ pure subroutine dm_geocom_api_request_beep_alarm(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_beep_alarm pure subroutine dm_geocom_api_request_beep_normal(request) @@ -402,7 +402,7 @@ pure subroutine dm_geocom_api_request_beep_normal(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_beep_normal pure subroutine dm_geocom_api_request_beep_off(request) @@ -424,7 +424,7 @@ pure subroutine dm_geocom_api_request_beep_off(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_beep_off pure subroutine dm_geocom_api_request_beep_on(request, intensity) @@ -450,7 +450,7 @@ pure subroutine dm_geocom_api_request_beep_on(request, intensity) character(len=80) :: args write (args, '(i0)') intensity - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_beep_on pure subroutine dm_geocom_api_request_change_face(request, pos_mode, atr_mode) @@ -486,7 +486,7 @@ pure subroutine dm_geocom_api_request_change_face(request, pos_mode, atr_mode) character(len=80) :: args write (args, '(i0, ",", i0, ",0")') pos_mode, atr_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_change_face pure subroutine dm_geocom_api_request_delete(request, device_type, file_type, day, month, year, file_name) @@ -579,7 +579,7 @@ pure subroutine dm_geocom_api_request_do_measure(request, tmc_prog, inc_mode) character(len=80) :: args write (args, '(i0, ",", i0)') tmc_prog, inc_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_do_measure pure subroutine dm_geocom_api_request_download(request, block_number) @@ -669,7 +669,7 @@ pure subroutine dm_geocom_api_request_fine_adjust(request, search_hz, search_v) character(len=80) :: args write (args, '(2(f0.12, ","), "0")') search_hz, search_v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_fine_adjust pure subroutine dm_geocom_api_request_get_angle(request, inc_mode) @@ -2646,7 +2646,7 @@ pure subroutine dm_geocom_api_request_lock_in(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_lock_in pure subroutine dm_geocom_api_request_measure_distance_angle(request, dist_mode) @@ -2714,7 +2714,7 @@ pure subroutine dm_geocom_api_request_null(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_null pure subroutine dm_geocom_api_request_ps_enable_range(request, enabled) @@ -2745,7 +2745,7 @@ pure subroutine dm_geocom_api_request_ps_enable_range(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_ps_enable_range pure subroutine dm_geocom_api_request_ps_search_next(request, direction, swing) @@ -2777,7 +2777,7 @@ pure subroutine dm_geocom_api_request_ps_search_next(request, direction, swing) character(len=80) :: args write (args, '(i0, ",", i1)') direction, dm_btoi(swing) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_ps_search_next pure subroutine dm_geocom_api_request_ps_search_window(request) @@ -2803,7 +2803,7 @@ pure subroutine dm_geocom_api_request_ps_search_window(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_ps_search_window pure subroutine dm_geocom_api_request_ps_set_range(request, min_dist, max_dist) @@ -2830,7 +2830,7 @@ pure subroutine dm_geocom_api_request_ps_set_range(request, min_dist, max_dist) character(len=80) :: args write (args, '(i0, ",", i0)') min_dist, max_dist - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_ps_set_range pure subroutine dm_geocom_api_request_search(request, search_hz, search_v) @@ -2868,7 +2868,7 @@ pure subroutine dm_geocom_api_request_search(request, search_hz, search_v) character(len=80) :: args write (args, '(f0.12, ",", f0.12, ",0")') search_hz, search_v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_search pure subroutine dm_geocom_api_request_search_target(request) @@ -2892,7 +2892,7 @@ pure subroutine dm_geocom_api_request_search_target(request) type(request_type), intent(out) :: request !! Prepared request. - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GEOCOM_PATTERN, responses=GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, pattern=GRC_PATTERN, responses=GRC_RESPONSES) end subroutine dm_geocom_api_request_search_target pure subroutine dm_geocom_api_request_set_angle_correction(request, incline, stand_axis, collimation, tilt_axis) @@ -2921,7 +2921,7 @@ pure subroutine dm_geocom_api_request_set_angle_correction(request, incline, sta character(len=80) :: args write (args, '(3(i1, ","), i1)') dm_btoi(incline), dm_btoi(stand_axis), dm_btoi(collimation), dm_btoi(tilt_axis) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_angle_correction pure subroutine dm_geocom_api_request_set_atmospheric_correction(request, lambda, pressure, dry_temp, wet_temp) @@ -2952,7 +2952,7 @@ pure subroutine dm_geocom_api_request_set_atmospheric_correction(request, lambda character(len=80) :: args write (args, '(4(f0.12, ","), f0.12)') lambda, pressure, dry_temp, wet_temp - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_atmospheric_correction pure subroutine dm_geocom_api_request_set_atmospheric_ppm(request, atm_ppm) @@ -2978,7 +2978,7 @@ pure subroutine dm_geocom_api_request_set_atmospheric_ppm(request, atm_ppm) character(len=80) :: args write (args, '(f0.12)') atm_ppm - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_atmospheric_ppm pure subroutine dm_geocom_api_request_set_atr_mode(request, atr_mode) @@ -3012,7 +3012,7 @@ pure subroutine dm_geocom_api_request_set_atr_mode(request, atr_mode) character(len=80) :: args write (args, '(i0)') atr_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_atr_mode pure subroutine dm_geocom_api_request_set_binary_mode(request, enabled) @@ -3041,7 +3041,7 @@ pure subroutine dm_geocom_api_request_set_binary_mode(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_binary_mode pure subroutine dm_geocom_api_request_set_config(request, auto_power, timeout) @@ -3073,7 +3073,7 @@ pure subroutine dm_geocom_api_request_set_config(request, auto_power, timeout) character(len=80) :: args write (args, '("0", 2(",", i0))') auto_power, timeout - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_config pure subroutine dm_geocom_api_request_set_date_time(request, year, month, day, hour, minute, second) @@ -3104,7 +3104,7 @@ pure subroutine dm_geocom_api_request_set_date_time(request, year, month, day, h character(len=80) :: args write (args, '(i0, 5(",", z2.2))') year, month, day, hour, minute, second - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_date_time pure subroutine dm_geocom_api_request_set_distance(request, slope_dist, height_offset, inc_mode) @@ -3145,7 +3145,7 @@ pure subroutine dm_geocom_api_request_set_distance(request, slope_dist, height_o character(len=80) :: args write (args, '(2(f0.12, ","), i0)') slope_dist, height_offset, inc_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_distance pure subroutine dm_geocom_api_request_set_double_precision(request, ndigits) @@ -3178,7 +3178,7 @@ pure subroutine dm_geocom_api_request_set_double_precision(request, ndigits) character(len=80) :: args write (args, '(i0)') ndigits - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_double_precision pure subroutine dm_geocom_api_request_set_edm_mode(request, edm_mode) @@ -3207,7 +3207,7 @@ pure subroutine dm_geocom_api_request_set_edm_mode(request, edm_mode) character(len=80) :: args write (args, '(i0)') edm_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_edm_mode pure subroutine dm_geocom_api_request_set_egl_intensity(request, intensity) @@ -3240,7 +3240,7 @@ pure subroutine dm_geocom_api_request_set_egl_intensity(request, intensity) character(len=80) :: args write (args, '(i0)') intensity - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_egl_intensity pure subroutine dm_geocom_api_request_set_fine_adjust_mode(request, adj_mode) @@ -3274,7 +3274,7 @@ pure subroutine dm_geocom_api_request_set_fine_adjust_mode(request, adj_mode) character(len=80) :: args write (args, '(i0)') adj_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_fine_adjust_mode pure subroutine dm_geocom_api_request_set_geometric_ppm(request, enabled, scale_factor, offset, height_ppm, individual_ppm) @@ -3304,7 +3304,7 @@ pure subroutine dm_geocom_api_request_set_geometric_ppm(request, enabled, scale_ character(len=80) :: args write (args, '(i1, 4(",", f0.12))') dm_btoi(enabled), scale_factor, offset, height_ppm, individual_ppm - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_geometric_ppm pure subroutine dm_geocom_api_request_set_height(request, height) @@ -3330,7 +3330,7 @@ pure subroutine dm_geocom_api_request_set_height(request, height) character(len=80) :: args write (args, '(f0.12)') height - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_height pure subroutine dm_geocom_api_request_set_image_config(request, mem_type, image_number, quality, sub_function, prefix) @@ -3368,7 +3368,7 @@ pure subroutine dm_geocom_api_request_set_image_config(request, mem_type, image_ character(len=80) :: args write (args, '(4(i0, ","), """", a, """")') mem_type, image_number, quality, sub_function, trim(prefix) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_image_config pure subroutine dm_geocom_api_request_set_inclination_correction(request, enabled) @@ -3394,7 +3394,7 @@ pure subroutine dm_geocom_api_request_set_inclination_correction(request, enable character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_inclination_correction pure subroutine dm_geocom_api_request_set_laser_pointer(request, enabled) @@ -3423,7 +3423,7 @@ pure subroutine dm_geocom_api_request_set_laser_pointer(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_laser_pointer pure subroutine dm_geocom_api_request_set_measurement_program(request, bap_prog) @@ -3454,7 +3454,7 @@ pure subroutine dm_geocom_api_request_set_measurement_program(request, bap_prog) character(len=80) :: args write (args, '(i0)') bap_prog - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_measurement_program pure subroutine dm_geocom_api_request_set_orientation(request, hz) @@ -3486,7 +3486,7 @@ pure subroutine dm_geocom_api_request_set_orientation(request, hz) character(len=80) :: args write (args, '(f0.12)') hz - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_orientation pure subroutine dm_geocom_api_request_set_position(request, hz, v, pos_mode, atr_mode) @@ -3524,7 +3524,7 @@ pure subroutine dm_geocom_api_request_set_position(request, hz, v, pos_mode, atr character(len=80) :: args write (args, '(2(f0.12, ","), 2(i0, ","), "0")') hz, v, pos_mode, atr_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_position pure subroutine dm_geocom_api_request_set_positioning_timeout(request, time_hz, time_v) @@ -3555,7 +3555,7 @@ pure subroutine dm_geocom_api_request_set_positioning_timeout(request, time_hz, character(len=80) :: args write (args, '(f0.12, ",", f0.12)') time_hz, time_v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_positioning_timeout pure subroutine dm_geocom_api_request_set_prism_constant(request, prism_const) @@ -3582,7 +3582,7 @@ pure subroutine dm_geocom_api_request_set_prism_constant(request, prism_const) character(len=80) :: args write (args, '(f0.12)') prism_const - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_prism_constant pure subroutine dm_geocom_api_request_set_prism_type(request, prism_type) @@ -3612,7 +3612,7 @@ pure subroutine dm_geocom_api_request_set_prism_type(request, prism_type) character(len=80) :: args write (args, '(i0)') prism_type - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_prism_type pure subroutine dm_geocom_api_request_set_prism_type_v2(request, prism_type, prism_name) @@ -3644,7 +3644,7 @@ pure subroutine dm_geocom_api_request_set_prism_type_v2(request, prism_type, pri character(len=80) :: args write (args, '(i0, ",", a)') prism_type, prism_name - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_prism_type_v2 pure subroutine dm_geocom_api_request_set_reduced_atr_fov(request, enabled) @@ -3673,7 +3673,7 @@ pure subroutine dm_geocom_api_request_set_reduced_atr_fov(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_reduced_atr_fov pure subroutine dm_geocom_api_request_set_refraction_mode(request, mode) @@ -3702,7 +3702,7 @@ pure subroutine dm_geocom_api_request_set_refraction_mode(request, mode) character(len=80) :: args write (args, '(i0)') mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_refraction_mode pure subroutine dm_geocom_api_request_set_search_area(request, center_hz, center_v, range_hz, range_v, enabled) @@ -3737,7 +3737,7 @@ pure subroutine dm_geocom_api_request_set_search_area(request, center_hz, center character(len=80) :: args write (args, '(4(f0.12, ","), i1)') center_hz, center_v, range_hz, range_v, dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_search_area pure subroutine dm_geocom_api_request_set_station(request, easting, northing, height, instr_height) @@ -3766,7 +3766,7 @@ pure subroutine dm_geocom_api_request_set_station(request, easting, northing, he character(len=80) :: args write (args, '(3(f0.12, ","), f0.12)') easting, northing, height, instr_height - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_station pure subroutine dm_geocom_api_request_set_target_type(request, target_type) @@ -3800,7 +3800,7 @@ pure subroutine dm_geocom_api_request_set_target_type(request, target_type) character(len=80) :: args write (args, '(i0)') target_type - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_target_type pure subroutine dm_geocom_api_request_set_tolerance(request, hz, v) @@ -3836,7 +3836,7 @@ pure subroutine dm_geocom_api_request_set_tolerance(request, hz, v) character(len=80) :: args write (args, '(f0.12, ",", f0.12)') hz, v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_tolerance pure subroutine dm_geocom_api_request_set_user_atr_mode(request, enabled) @@ -3868,7 +3868,7 @@ pure subroutine dm_geocom_api_request_set_user_atr_mode(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_user_atr_mode pure subroutine dm_geocom_api_request_set_user_lock_mode(request, enabled) @@ -3901,7 +3901,7 @@ pure subroutine dm_geocom_api_request_set_user_lock_mode(request, enabled) character(len=80) :: args write (args, '(i1)') dm_btoi(enabled) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_user_lock_mode pure subroutine dm_geocom_api_request_set_user_prism_definition(request, prism_name, prism_const, refl_type, creator) @@ -3931,7 +3931,7 @@ pure subroutine dm_geocom_api_request_set_user_prism_definition(request, prism_n write (args, '("""", a, """,", f0.12, ",", i0, ", """, a, """")') & trim(prism_name), prism_const, refl_type, trim(creator) - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_user_prism_definition pure subroutine dm_geocom_api_request_set_user_spiral(request, hz, v) @@ -3961,7 +3961,7 @@ pure subroutine dm_geocom_api_request_set_user_spiral(request, hz, v) character(len=80) :: args write (args, '(f0.12, ",", f0.12)') hz, v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_user_spiral pure subroutine dm_geocom_api_request_set_velocity(request, omega_hz, omega_v) @@ -3997,7 +3997,7 @@ pure subroutine dm_geocom_api_request_set_velocity(request, omega_hz, omega_v) character(len=80) :: args write (args, '(f0.12, ",", f0.12)') omega_hz, omega_v - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_set_velocity pure subroutine dm_geocom_api_request_setup_download(request, device_type, file_type, file_name, block_size) @@ -4077,7 +4077,7 @@ pure subroutine dm_geocom_api_request_setup_list(request, device_type, file_type character(len=80) :: args write (args, '(2(i0, ","), a)') device_type, file_type, search_path - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_setup_list pure subroutine dm_geocom_api_request_start_controller(request, start_mode) @@ -4115,7 +4115,7 @@ pure subroutine dm_geocom_api_request_start_controller(request, start_mode) character(len=80) :: args write (args, '(i0)') start_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_start_controller pure subroutine dm_geocom_api_request_stop_controller(request, stop_mode) @@ -4148,7 +4148,7 @@ pure subroutine dm_geocom_api_request_stop_controller(request, stop_mode) character(len=80) :: args write (args, '(i0)') stop_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_stop_controller pure subroutine dm_geocom_api_request_switch_off(request, stop_mode) @@ -4179,7 +4179,7 @@ pure subroutine dm_geocom_api_request_switch_off(request, stop_mode) character(len=80) :: args write (args, '(i0)') stop_mode - call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GEOCOM_PATTERN, GEOCOM_RESPONSES) + call dm_geocom_api_request(request, REQUEST_NAME, REQUEST_CODE, args, GRC_PATTERN, GRC_RESPONSES) end subroutine dm_geocom_api_request_switch_off pure subroutine dm_geocom_api_request_switch_on(request, start_mode) diff --git a/src/dm_rpc.f90 b/src/dm_rpc.f90 index 1bee4ea..5581627 100644 --- a/src/dm_rpc.f90 +++ b/src/dm_rpc.f90 @@ -186,7 +186,7 @@ integer function dm_rpc_error(curl_error) result(rc) rc = E_READ case (CURLE_OUT_OF_MEMORY) - rc = E_ALLOC + rc = E_LIMIT case (CURLE_OPERATION_TIMEDOUT) rc = E_TIMEOUT @@ -211,7 +211,7 @@ integer function dm_rpc_error(curl_error) result(rc) rc = E_RPC_SSL case (CURLE_FILESIZE_EXCEEDED) - rc = E_LIMIT + rc = E_BOUNDS case (CURLE_REMOTE_FILE_NOT_FOUND) rc = E_NOT_FOUND @@ -236,7 +236,7 @@ integer function dm_rpc_error_multi(multi_error) result(rc) rc = E_INVALID case (CURLM_OUT_OF_MEMORY) - rc = E_ALLOC + rc = E_LIMIT case default rc = E_RPC @@ -641,6 +641,15 @@ end function rpc_payload_prepare integer function rpc_request_multi(requests, responses) result(rc) !! Sends multiple HTTP requests by calling libcurl. + !! + !! The function returns the following error codes: + !! + !! * `E_ALLOC` if RPC response array allocation failed. + !! * `E_EMPTY` if no RPC requests are given. + !! * `E_RPC` if RPC backend initialisation failed. + !! + !! Other DMPACK errors may occur, depending on the result of the + !! transmission. integer, parameter :: POLL_TIMEOUT = 1000 !! Poll timeout in msec. type(rpc_request_type), intent(inout) :: requests(:) !! Request type array. @@ -669,7 +678,7 @@ integer function rpc_request_multi(requests, responses) result(rc) multi_ptr = c_null_ptr curl_block: block - rc = E_IO + rc = E_RPC ! Create and prepare transfer handles. do i = 1, n @@ -753,10 +762,10 @@ integer function rpc_request_multi(requests, responses) result(rc) responses(i)%error_message = '' end if - ! Clean-up requests. if (.not. allocated(responses(i)%content_type)) responses(i)%content_type = '' - if (.not. allocated(responses(i)%payload)) responses(i)%payload = '' + if (.not. allocated(responses(i)%payload)) responses(i)%payload = '' + ! Clean-up requests. stat = curl_multi_remove_handle(multi_ptr, requests(i)%curl_ptr) call curl_slist_free_all(requests(i)%list_ptr) call curl_easy_cleanup(requests(i)%curl_ptr) @@ -919,7 +928,7 @@ integer function rpc_request_single(request, response) result(rc) integer :: error, stat - rc = E_IO + rc = E_RPC ! Initialise libcurl. if (.not. c_associated(request%curl_ptr)) then diff --git a/src/dm_tty.f90 b/src/dm_tty.f90 index 9466ced..16861f1 100644 --- a/src/dm_tty.f90 +++ b/src/dm_tty.f90 @@ -438,10 +438,16 @@ integer function dm_tty_set_attributes(tty) result(rc) type(tty_type), intent(inout) :: tty !! TTY type. - integer(kind=c_speed_t) :: baud_rate - integer(kind=c_int) :: byte_size - integer(kind=c_int) :: parity - integer(kind=c_int) :: stop_bits + integer(kind=c_tcflag_t) :: c_cflag + integer(kind=c_tcflag_t) :: c_iflag + integer(kind=c_tcflag_t) :: c_lflag + integer(kind=c_tcflag_t) :: c_oflag + + integer(kind=c_speed_t) :: baud_rate + integer(kind=c_int) :: byte_size + integer(kind=c_int) :: parity + integer(kind=c_int) :: stop_bits + integer(kind=c_int), target :: stat type(c_termios) :: termios @@ -535,46 +541,59 @@ integer function dm_tty_set_attributes(tty) result(rc) rc = E_SYSTEM ! Get current attributes. - if (c_tcgetattr(tty%fd, termios) /= 0) return + stat = c_tcgetattr(tty%fd, termios) + if (stat /= 0) return ! Set baud rate (I/O). - if (c_cfsetispeed(termios, baud_rate) /= 0) return - if (c_cfsetospeed(termios, baud_rate) /= 0) return + stat = c_cfsetispeed(termios, baud_rate); if (stat /= 0) return + stat = c_cfsetospeed(termios, baud_rate); if (stat /= 0) return + + ! Modes. + c_iflag = int(c_uint_to_int(termios%c_iflag), kind=c_tcflag_t) + c_oflag = int(c_uint_to_int(termios%c_oflag), kind=c_tcflag_t) + c_cflag = int(c_uint_to_int(termios%c_cflag), kind=c_tcflag_t) + c_lflag = int(c_uint_to_int(termios%c_lflag), kind=c_tcflag_t) ! Input modes. - termios%c_iflag = iand(termios%c_iflag, not(IGNBRK + BRKINT + PARMRK + ISTRIP + INLCR + IGNCR + ICRNL)) ! No special handling of received bytes. - termios%c_iflag = iand(termios%c_iflag, not(IXON + IXOFF + IXANY)) ! Turn XON/XOFF control off. + c_iflag = iand(c_iflag, not(IGNBRK + BRKINT + PARMRK + ISTRIP + INLCR + IGNCR + ICRNL)) ! No special handling of received bytes. + c_iflag = iand(c_iflag, not(IXON + IXOFF + IXANY)) ! Turn XON/XOFF control off. ! Output modes. - termios%c_oflag = iand(termios%c_oflag, not(OPOST)) ! No special interpretation of output bytes. + c_oflag = iand(c_oflag, not(OPOST)) ! No special interpretation of output bytes. ! Control modes. - termios%c_cflag = iand(termios%c_cflag, not(CSIZE)) ! Unset byte size. - termios%c_cflag = iand(termios%c_cflag, not(CSTOPB)) ! Unset stop bits. - termios%c_cflag = iand(termios%c_cflag, not(PARENB + PARODD)) ! Unset parity. - termios%c_cflag = ior (termios%c_cflag, byte_size) ! Set byte size. - termios%c_cflag = ior (termios%c_cflag, stop_bits) ! Set stop bits. - termios%c_cflag = ior (termios%c_cflag, parity) ! Set parity. - termios%c_cflag = ior (termios%c_cflag, ior(CLOCAL, CREAD)) ! Ignore modem controls, enable reading. + c_cflag = iand(c_cflag, not(CSIZE)) ! Unset byte size. + c_cflag = iand(c_cflag, not(CSTOPB)) ! Unset stop bits. + c_cflag = iand(c_cflag, not(ior(PARENB, PARODD))) ! Unset parity. + c_cflag = ior (c_cflag, byte_size) ! Set byte size. + c_cflag = ior (c_cflag, stop_bits) ! Set stop bits. + c_cflag = ior (c_cflag, parity) ! Set parity. + c_cflag = ior (c_cflag, ior(CLOCAL, CREAD)) ! Ignore modem controls, enable reading. ! Local modes. - termios%c_lflag = iand(termios%c_lflag, not(ECHO + ECHOE + ECHONL)) ! No echo. - termios%c_lflag = iand(termios%c_lflag, not(IEXTEN)) ! No implementation-defined input processing. - termios%c_lflag = iand(termios%c_lflag, not(ICANON)) ! No canonical processing. - termios%c_lflag = iand(termios%c_lflag, not(ISIG)) ! No signal chars. + c_lflag = iand(c_lflag, not(ECHO + ECHOE + ECHONL)) ! No echo. + c_lflag = iand(c_lflag, not(IEXTEN)) ! No implementation-defined input processing. + c_lflag = iand(c_lflag, not(ICANON)) ! No canonical processing. + c_lflag = iand(c_lflag, not(ISIG)) ! No signal chars. + + termios%c_iflag = c_iflag + termios%c_oflag = c_oflag + termios%c_cflag = c_cflag + termios%c_lflag = c_lflag if (tty%blocking) then ! Minimum number of characters for non-canonical read. - termios%c_cc(VMIN) = 1 - termios%c_cc(VTIME) = 0 + termios%c_cc(VMIN) = 1_c_cc_t + termios%c_cc(VTIME) = 0_c_cc_t else ! Timeout in deciseconds for non-canonical read. - termios%c_cc(VMIN) = 0 + termios%c_cc(VMIN) = 0_c_cc_t termios%c_cc(VTIME) = int(max(0, min(255, tty%timeout * 10)), kind=c_cc_t) end if ! Set attributes. - if (c_tcsetattr(tty%fd, TCSANOW, termios) /= 0) return + stat = c_tcsetattr(tty%fd, TCSANOW, termios) + if (stat /= 0) return ! Set RTS, DTR. if (tty%rts .or. tty%dtr) then