Skip to content

Commit

Permalink
fix .mark()
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 1, 2024
1 parent 1c73894 commit 72efbda
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: nanonext
Type: Package
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
Version: 1.3.2.9008
Version: 1.3.2.9009
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
a socket library implementing 'Scalability Protocols', a reliable,
high-performance standard for common communications patterns including
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nanonext 1.3.2.9008 (development)
# nanonext 1.3.2.9009 (development)

#### New Features

Expand Down
10 changes: 6 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,20 @@ serial_config <- function(class, sfunc, ufunc, vec = FALSE)

#' Set Serialization Marker
#'
#' Toggles the serialization marker on or off. Internal package function.
#' Internal package function.
#'
#' @return NULL.
#' @param x logical value.
#'
#' @return The logical value 'x' supplied.
#'
#' @examples
#' .mark()
#' .mark()
#' .mark(FALSE)
#'
#' @keywords internal
#' @export
#'
.mark <- function() .Call(rnng_set_marker)
.mark <- function(x = TRUE) .Call(rnng_set_marker, x)

#' Advances the RNG State
#'
Expand Down
11 changes: 7 additions & 4 deletions man/dot-mark.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static const R_CallMethodDef callMethods[] = {
{"rnng_send", (DL_FUNC) &rnng_send, 5},
{"rnng_send_aio", (DL_FUNC) &rnng_send_aio, 6},
{"rnng_serial_config", (DL_FUNC) &rnng_serial_config, 4},
{"rnng_set_marker", (DL_FUNC) &rnng_set_marker, 0},
{"rnng_set_marker", (DL_FUNC) &rnng_set_marker, 1},
{"rnng_set_opt", (DL_FUNC) &rnng_set_opt, 3},
{"rnng_set_promise_context", (DL_FUNC) &rnng_set_promise_context, 2},
{"rnng_signal_thread_create", (DL_FUNC) &rnng_signal_thread_create, 2},
Expand Down
2 changes: 1 addition & 1 deletion src/nanonext.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ SEXP rnng_request(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
SEXP rnng_send(SEXP, SEXP, SEXP, SEXP, SEXP);
SEXP rnng_send_aio(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
SEXP rnng_serial_config(SEXP, SEXP, SEXP, SEXP);
SEXP rnng_set_marker(void);
SEXP rnng_set_marker(SEXP);
SEXP rnng_set_opt(SEXP, SEXP, SEXP);
SEXP rnng_set_promise_context(SEXP, SEXP);
SEXP rnng_signal_thread_create(SEXP, SEXP);
Expand Down
6 changes: 3 additions & 3 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,10 @@ SEXP rnng_serial_config(SEXP klass, SEXP sfunc, SEXP ufunc, SEXP vec) {

}

SEXP rnng_set_marker(void) {
SEXP rnng_set_marker(SEXP x) {

special_bit = special_bit ? (uint8_t) 0 : (uint8_t) 1;
return R_NilValue;
special_bit = (uint8_t) NANO_INTEGER(x);
return x;

}

Expand Down
4 changes: 2 additions & 2 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,9 @@ test_zero(dial(s, url = "inproc://disp/1"))
test_true(wait(cv))
test_zero(send(disp, TRUE, block = 500L))
test_true(recv(s, block = 500L))
test_null(.mark())
test_true(.mark())
test_zero(send(s, NULL, block = 500L))
test_null(.mark())
test_true(!.mark(FALSE))
test_null(recv(disp, block = 500L))
test_zero(reap(s))
rm(disp)
Expand Down

0 comments on commit 72efbda

Please sign in to comment.