Parse a fortran subroutine/entry definition and return subroutine/entry name and C argument types as a list

make_fun_list(fun_strs)

Arguments

fun_str

a vector of subroutine definition strings with args

Value

a list of function names along with C argument types, SEXP args, and .Call args

Examples

make_fun_list(c("subroutine foo(no,ni,x,y,w,theta)", "entry foobar(ix, y)", "subroutine bar(x,n,p,m)"))
#> [[1]]
#> [[1]]$name
#> [1] "foo"
#> 
#> [[1]]$args
#> [1] "int *no"       "int *ni"       "double *x"     "double *y"    
#> [5] "double *w"     "double *theta"
#> 
#> [[1]]$sexp_args
#> [1] "SEXP no"    "SEXP ni"    "SEXP x"     "SEXP y"     "SEXP w"    
#> [6] "SEXP theta"
#> 
#> [[1]]$call_args
#> [1] "INTEGER(no)" "INTEGER(ni)" "REAL(x)"     "REAL(y)"     "REAL(w)"    
#> [6] "REAL(theta)"
#> 
#> [[1]]$arg_names
#> [1] "no"    "ni"    "x"     "y"     "w"     "theta"
#> 
#> 
#> [[2]]
#> [[2]]$name
#> [1] "foobar"
#> 
#> [[2]]$args
#> [1] "int *ix"   "double *y"
#> 
#> [[2]]$sexp_args
#> [1] "SEXP ix" "SEXP y" 
#> 
#> [[2]]$call_args
#> [1] "INTEGER(ix)" "REAL(y)"    
#> 
#> [[2]]$arg_names
#> [1] "ix" " y"
#> 
#> 
#> [[3]]
#> [[3]]$name
#> [1] "bar"
#> 
#> [[3]]$args
#> [1] "double *x" "int *n"    "double *p" "int *m"   
#> 
#> [[3]]$sexp_args
#> [1] "SEXP x" "SEXP n" "SEXP p" "SEXP m"
#> 
#> [[3]]$call_args
#> [1] "REAL(x)"    "INTEGER(n)" "REAL(p)"    "INTEGER(m)"
#> 
#> [[3]]$arg_names
#> [1] "x" "n" "p" "m"
#> 
#>