Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jassoc API to directly associate a name to A #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dllsrc/jdll.def
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ EXPORTS
JInt64R @28
JGetR @29
JSMX @30
Jassoc @31
2 changes: 1 addition & 1 deletion dllsrc/jdll2.def
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ EXPORTS
JSetA @27
JGetR @29
JSMX @30

Jassoc @31
14 changes: 14 additions & 0 deletions jsrc/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,20 @@ static int setterm(JS jt, C* name, I* jtype, I* jrank, I* jshape, I* jdata)
return jm->jerr;
}

int _stdcall Jassoc(JS jt, C* name, A w)
{
SETJTJM(jt,jt,jm)
int er;
char gn[256];
if(FUNC&AT(w)) return EVDOMAIN;
// validate name
if(strlen(name) >= sizeof(gn)) return EVILNAME;
if(valid(name, gn)) return EVILNAME;
jm->jerr=0;
jtjset(jm,gn, w);
return jm->jerr;
}

int _stdcall JSetM(JS jt, C* name, I* jtype, I* jrank, I* jshape, I* jdata)
{
SETJTJM(jt,jt,jm)
Expand Down
5 changes: 3 additions & 2 deletions jsrc/jlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
typedef void* JS
#endif

CDPROC JS _stdcall JInit(void); /* init instance */
CDPROC JS _stdcall JInit(void); /* init instance */
CDPROC void _stdcall JSM(JS jt, void*callbacks[]); /* set callbacks */
CDPROC void _stdcall JSMX(JS jt, void*, void*, void*, void*, I);
CDPROC int _stdcall JDo(JS jt,C*); /* run sentence */
CDPROC C* _stdcall JGetLocale(JS jt); /* get locale */
CDPROC A _stdcall Jga(JS jt, I t, I n, I r, I*s);
CDPROC A _stdcall Jga(JS jt, I t, I n, I r, I*s); /* allocate array */
CDPROC int _stdcall Jassoc(JS jt, C* name, A w); /* associate name to array */
CDPROC int _stdcall JFree(JS jt); /* free instance */
CDPROC A _stdcall JGetA(JS jt,I n,C* name); /* get 3!:1 from name */
CDPROC C* _stdcall JGetR(JS jt); /* get capture */
Expand Down