Skip to content

Commit e6c1ae4

Browse files
authored
Merge branch 'main' into copilot/autogenerate-non-callback-functions
2 parents 91f27fb + d8d9b37 commit e6c1ae4

File tree

6 files changed

+88
-9
lines changed

6 files changed

+88
-9
lines changed

.github/copilot-instructions.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,33 @@
22

33
> **Note**: For general development guidelines, code style conventions, and AI agent instructions, see [`AGENTS.md`](../AGENTS.md) in the repository root.
44
5+
## Project Overview
6+
7+
igraph/rigraph is an R package for network analysis and graph theory with a C/C++ backend.
8+
59
## Common Commands for Copilot Chat
610

711
- Load for development: `pkgload::load_all()`
812
- Run tests: `testthat::test_local(reporter = "check")`
13+
- Run tests for a single file: `testthat::test_local(filter = "foo", reporter = "check")`
914
- Format code: `air format .`
1015
- Update documentation: `devtools::document()`
16+
- Build package: `devtools::build()`
17+
- Check package: `devtools::check()`
18+
19+
## Key Conventions
20+
21+
- Use `snake_case` for functions and arguments
22+
- Follow tidyverse style guide
23+
- Use roxygen2 with Markdown for documentation
24+
- Run `air format .` before committing
25+
- Add tests for all new functionality
26+
- Use explicit package prefixes (e.g., `withr::local_db_connection()`)
27+
28+
## Important Files
29+
30+
- **Do not modify directly**: `src/rinterface.c`, `R/aaa-auto.R` (generated by Stimulus)
31+
- Update generated files: `make -f Makefile-cigraph src/rinterface.c R/aaa-auto.R`
32+
- See `tools/README.md` for Stimulus framework guidelines
1133

12-
Refer to `AGENTS.md` for more instructions.
34+
Refer to `AGENTS.md` for complete instructions.

.github/workflows/copilot-setup-steps.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on:
66
workflow_dispatch:
77
push:
88
paths:
9-
- .github/workflows/copilot-setup-steps.yml
9+
- .github/workflows/copilot-setup-steps.yaml
1010
pull_request:
1111
paths:
12-
- .github/workflows/copilot-setup-steps.yml
12+
- .github/workflows/copilot-setup-steps.yaml
1313

1414
jobs:
1515
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.

R/aaa-auto.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12959,7 +12959,9 @@ almost_equals_impl <- function(
1295912959
eps
1296012960
) {
1296112961
# Argument checks
12962-
12962+
a <- as.numeric(a)
12963+
b <- as.numeric(b)
12964+
eps <- as.numeric(eps)
1296312965

1296412966
on.exit(.Call(R_igraph_finalizer))
1296512967
# Function call
@@ -12979,7 +12981,9 @@ cmp_epsilon_impl <- function(
1297912981
eps
1298012982
) {
1298112983
# Argument checks
12982-
12984+
a <- as.numeric(a)
12985+
b <- as.numeric(b)
12986+
eps <- as.numeric(eps)
1298312987

1298412988
on.exit(.Call(R_igraph_finalizer))
1298512989
# Function call
@@ -13802,7 +13806,7 @@ strerror_impl <- function(
1380213806
igraph_errno
1380313807
) {
1380413808
# Argument checks
13805-
13809+
igraph_errno <- as.numeric(igraph_errno)
1380613810

1380713811
on.exit(.Call(R_igraph_finalizer))
1380813812
# Function call

src/rinterface.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17441,7 +17441,12 @@ SEXP R_igraph_almost_equals(SEXP a, SEXP b, SEXP eps) {
1744117441
igraph_bool_t c_result;
1744217442
SEXP r_result;
1744317443
/* Convert input */
17444-
17444+
IGRAPH_R_CHECK_REAL(a);
17445+
c_a = REAL(a)[0];
17446+
IGRAPH_R_CHECK_REAL(b);
17447+
c_b = REAL(b)[0];
17448+
IGRAPH_R_CHECK_REAL(eps);
17449+
c_eps = REAL(eps)[0];
1744517450
/* Call igraph */
1744617451
c_result=igraph_almost_equals(c_a, c_b, c_eps);
1744717452

@@ -17465,7 +17470,12 @@ SEXP R_igraph_cmp_epsilon(SEXP a, SEXP b, SEXP eps) {
1746517470
int c_result;
1746617471
SEXP r_result;
1746717472
/* Convert input */
17468-
17473+
IGRAPH_R_CHECK_REAL(a);
17474+
c_a = REAL(a)[0];
17475+
IGRAPH_R_CHECK_REAL(b);
17476+
c_b = REAL(b)[0];
17477+
IGRAPH_R_CHECK_REAL(eps);
17478+
c_eps = REAL(eps)[0];
1746917479
/* Call igraph */
1747017480
c_result=igraph_cmp_epsilon(c_a, c_b, c_eps);
1747117481

@@ -18526,7 +18536,8 @@ SEXP R_igraph_strerror(SEXP igraph_errno) {
1852618536
const char* c_result;
1852718537
SEXP r_result;
1852818538
/* Convert input */
18529-
18539+
IGRAPH_R_CHECK_INT(igraph_errno);
18540+
c_igraph_errno = (igraph_error_t) REAL(igraph_errno)[0];
1853018541
/* Call igraph */
1853118542
c_result=igraph_strerror(c_igraph_errno);
1853218543

tools/stimulus/types-RC.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,38 @@ REAL:
107107
PROTECT(%I%=NEW_NUMERIC(1));
108108
REAL(%I%)[0]=%C%;
109109
110+
DOUBLE:
111+
# A C double - similar to REAL but uses C's double type instead of igraph_real_t
112+
CTYPE: double
113+
CALL:
114+
IN: '%C%'
115+
OUT: '&%C%'
116+
INOUT: '&%C%'
117+
INCONV:
118+
IN: |-
119+
IGRAPH_R_CHECK_REAL(%I%);
120+
%C% = REAL(%I%)[0];
121+
OUTCONV:
122+
OUT: |-
123+
PROTECT(%I%=NEW_NUMERIC(1));
124+
REAL(%I%)[0]=%C%;
125+
126+
ERROR:
127+
# An igraph error code
128+
# Note: No OUTCONV is provided because ERROR is handled specially as a return
129+
# type - it's wrapped in IGRAPH_R_CHECK() which doesn't use output conversion.
130+
# When ERROR is used as an input parameter (e.g., in igraph_strerror), only
131+
# INCONV is needed.
132+
CTYPE: igraph_error_t
133+
CALL:
134+
IN: '%C%'
135+
OUT: '&%C%'
136+
INOUT: '&%C%'
137+
INCONV:
138+
IN: |-
139+
IGRAPH_R_CHECK_INT(%I%);
140+
%C% = (igraph_error_t) REAL(%I%)[0];
141+
110142
BOOLEAN:
111143
CTYPE: igraph_bool_t
112144
CALL:

tools/stimulus/types-RR.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ REAL:
2525
INCONV:
2626
IN: '%I% <- as.numeric(%I%)'
2727

28+
DOUBLE:
29+
# A C double - similar to REAL but uses C's double type instead of igraph_real_t
30+
INCONV:
31+
IN: '%I% <- as.numeric(%I%)'
32+
33+
ERROR:
34+
# An igraph error code - used as input parameter (e.g., in igraph_strerror)
35+
INCONV:
36+
IN: '%I% <- as.numeric(%I%)'
37+
2838
BOOLEAN:
2939
DEFAULT:
3040
'False': 'FALSE'

0 commit comments

Comments
 (0)