Commit 98aac0a0 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles

Merge branch 'with_test' of https://gitlab.lam.fr/jclamber/unsio into with_test

parents 7f8e46b3 b8eb5821
......@@ -64,7 +64,7 @@ string root(string filename)
if (dotpos != NULL && strchr(dotpos, DIR_SEP) != NULL)
dotpos = NULL;
if (dotpos == NULL)
return (scopy(filename));
return (__nemo_scopy(filename));
else
return (substr(filename, 0, (dotpos - filename) - 1));
}
......@@ -79,7 +79,7 @@ string extension(string filename)
if (dotpos == NULL)
return ("");
else
return (scopy(dotpos + 1));
return (__nemo_scopy(dotpos + 1));
}
string head(string filename)
......@@ -99,9 +99,9 @@ string tail(string filename)
slashpos = strrchr(filename, DIR_SEP);
if (slashpos == NULL)
return (scopy(filename));
return (__nemo_scopy(filename));
else
return (scopy(slashpos + 1));
return (__nemo_scopy(slashpos + 1));
}
......@@ -121,7 +121,7 @@ string fullname(string filename)
char *outname;
if (*filename == DIR_SEP)
return scopy(filename);
return __nemo_scopy(filename);
if (getcwd(pathname,MAXPATHLEN) == 0)
error("Directory name too long (MAXPATHLEN=%d)",MAXPATHLEN);
n1 = strlen(pathname) + 1;
......@@ -130,7 +130,7 @@ string fullname(string filename)
if (n1+n2 < MAXPATHLEN) {
strcat(pathname,pathsep);
strcat(pathname,filename);
return scopy(pathname);
return __nemo_scopy(pathname);
} else {
outname = (char *) allocate(n1+n2+1);
sprintf(outname,"%s%c%s",pathname,DIR_SEP,filename);
......@@ -180,7 +180,7 @@ string defext(string filename, string ext)
if (forceext)
return (sconc(substr(filename, 0, xp-filename-1), ext));
else
return (scopy(filename));
return (__nemo_scopy(filename));
}
......
......@@ -1035,7 +1035,7 @@ local itemptr readitem(stream str, itemptr first)
*bufp++ = readitem(str, np); /* read next component */
}
*bufp = NULL; /* terminate item vector */
res = makeitem(scopy(SetType), scopy(ItemTag(ip)),
res = makeitem(__nemo_scopy(SetType), __nemo_scopy(ItemTag(ip)),
copxstr(ibuf, sizeof(itemptr)), NULL);
/* construct compound item */
freeitem(ip, TRUE); /* reclaim orig. header */
......
......@@ -454,9 +454,9 @@ void initparam(string argv[], string defv[])
maxkeys = nkeys - 1;
keys[0].keyval = argv[0];
keys[0].key = scopy("argv0");
keys[0].key = __nemo_scopy("argv0");
keys[0].val = progname = tail(argv[0]);
keys[0].help = scopy("Program name");
keys[0].help = __nemo_scopy("Program name");
keys[0].count = 0;
keys[0].upd = 0;
nzeno = (*defv[0] == ';');
......@@ -480,12 +480,12 @@ void initparam(string argv[], string defv[])
}
keys[i].keyval = defv[j];
keys[i].key = scopy(parname(defv[j]));
keys[i].val = scopy(parvalue(defv[j]));
keys[i].key = __nemo_scopy(parname(defv[j]));
keys[i].val = __nemo_scopy(parvalue(defv[j]));
if (nzeno)
keys[i].help = scopy(defv[j+1] + 1);
keys[i].help = __nemo_scopy(defv[j+1] + 1);
else
keys[i].help = scopy(parhelp(defv[j]));
keys[i].help = __nemo_scopy(parhelp(defv[j]));
keys[i].count = 0;
keys[i].upd = 1;
if (keys[i].key[strlen(keys[i].key)-1] == '#')
......@@ -494,7 +494,7 @@ void initparam(string argv[], string defv[])
keys[i].indexed = -2; /* not indexed */
keys[i].next = NULL;
if (streq(keys[i].key,"VERSION")) { /* special (last?) keyword */
version_i = scopy(keys[i].val);
version_i = __nemo_scopy(keys[i].val);
keys[i].upd = 0;
maxkeys--;
}
......@@ -532,7 +532,7 @@ void initparam(string argv[], string defv[])
if (keys[i].indexed >= -1)
error("Cannot match indexed keywords by position");
free(keys[i].val);
keys[i].val = scopy(argv[i]);
keys[i].val = __nemo_scopy(argv[i]);
keys[i].count++;
}
} else { /* match by name? */
......@@ -544,7 +544,7 @@ void initparam(string argv[], string defv[])
if (keys[j].count)
error("Parameter \"%s\" duplicated", name);
free(keys[j].val);
keys[j].val = scopy(parvalue(argv[i])); /* get value */
keys[j].val = __nemo_scopy(parvalue(argv[i])); /* get value */
keys[j].count++;
} else if (j=set_indexed(name,&idx)) { /* enter indexed keywords */
// process this indexed keyword
......@@ -561,9 +561,9 @@ void initparam(string argv[], string defv[])
}
kw->next = (keyword *) allocate(sizeof(keyword));
kw = kw->next;
kw->keyval = scopy(argv[i]);
kw->key = scopy(parname(argv[i]));
kw->val = scopy(parvalue(argv[i]));
kw->keyval = __nemo_scopy(argv[i]);
kw->key = __nemo_scopy(parname(argv[i]));
kw->val = __nemo_scopy(parvalue(argv[i]));
kw->help = 0;
kw->count = 1; // indexed keywords are never 'original'
kw->upd = 0;
......@@ -647,7 +647,7 @@ void initparam(string argv[], string defv[])
((val == NULL || streq(val, "")) && defflag) );
if (!streq(keys[i].val,val)) {
free(keys[i].val);
keys[i].val = scopy(val);
keys[i].val = __nemo_scopy(val);
keys[i].count++;
}
if (go) break;
......@@ -1397,7 +1397,7 @@ local void eval_keys(void)
*c2 = 0;
dprintf(3,"eval_keys: Modifying %s\n",keys[i].val);
free(keys[i].val);
keys[i].val = scopy(newval);
keys[i].val = __nemo_scopy(newval);
/* keys[i].count++; */
}
}
......@@ -1828,7 +1828,7 @@ local void setparam (string par, string val, string prompt)
#endif
val = line;
}
kw->val = scopy(val);
kw->val = __nemo_scopy(val);
kw->upd = 2; /* mark it as being updated */
#else
error("setparam: not compiled into getparam.c");
......@@ -2254,9 +2254,9 @@ local int addindexed(int i, string keyval, int idx)
}
kw->next = (keyword *) allocate(sizeof(keyword));
kw = kw->next;
kw->keyval = scopy(keyval);
kw->key = scopy(parname(keyval));
kw->val = scopy(parvalue(keyval));
kw->keyval = __nemo_scopy(keyval);
kw->key = __nemo_scopy(parname(keyval));
kw->val = __nemo_scopy(parvalue(keyval));
kw->help = 0;
kw->count = 1;
kw->upd = 0;
......@@ -2363,7 +2363,7 @@ local void readkeys(string mesg, bool first)
} else {
if (!streq(keys[i].val,parvalue(keybuf))) { /* if different */
free(keys[i].val); /* free old */
keys[i].val = scopy(parvalue(keybuf)); /* and patch in */
keys[i].val = __nemo_scopy(parvalue(keybuf)); /* and patch in */
}
}
}
......@@ -2863,7 +2863,7 @@ local void set_help(string arg)
{
char *cp;
help_string = scopy(arg);
help_string = __nemo_scopy(arg);
if ((cp = strpbrk(help_string,"0123456789"))!=NULL) /* isnum? */
help_level = atoi(cp); /* if so, change help_level */
}
......@@ -2909,7 +2909,7 @@ local void set_debug(string arg)
local void set_yapp(string arg)
{
yapp_string = scopy(arg);
yapp_string = __nemo_scopy(arg);
yapp_dev = atoi(yapp_string);
}
......
......@@ -133,7 +133,7 @@ int app_history(string s)
dprintf(1, "app_history: null history string\n");
return nhist;
}
histbuf[nhist] = scopy(s);
histbuf[nhist] = __nemo_scopy(s);
freeup[nhist] = TRUE;
dprintf(9,"app_history: histbuf[%d] = %s\n", nhist, s);
nhist++;
......@@ -162,7 +162,7 @@ void reset_history()
void set_headline(string s)
{
headline = scopy(s);
headline = __nemo_scopy(s);
}
/*
......
......@@ -12,7 +12,7 @@
/* Contents: */
/* */
/* getmem(nbytes) malloc with error checking */
/* scopy(source) returns a copy of source */
/* __nemo_scopy(source) returns a copy of source */
/* sconc(s1,s2) concatenates its arguments */
/* substr(s, p1, p2) returns substring from p1-p2 */
/* findstr(text, pat) finds index of pat in text */
......@@ -22,7 +22,7 @@
#define _strlib_h
extern char *getmem ( int nbytes );
extern string scopy ( const char *s );
extern string __nemo_scopy ( const char *s );
extern string sconc ( char *s1, char *s2 );
extern string substr ( char *s, int p1, int p2 );
extern int findstr ( char *text, char *pat );
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,12 +55,12 @@
/* Variables used for reading operations */
char * io_in[MAXIO];
FILE * instr[MAXIO];
FILE * __io_instr[MAXIO];
bool read_one[MAXIO];
/* Variables used for writing operations */
char * io_out[MAXIO];
FILE * outstr[MAXIO];
FILE * __io_outstr[MAXIO];
bool save_one[MAXIO];
/* variables used to keep track of history (EXPORTED) */
......@@ -102,7 +102,6 @@ int io_nemo(char * iofile,
/* control */
static bool first=TRUE;
/* init flag */
init_flag_io();
......@@ -234,7 +233,7 @@ int io_nemo(char * iofile,
code=close_io_nemo(iofile);
else {
if (io_op) { /* operation on snaphot is reading */
code = get_data_select(iofile, rtype, io_in, read_one, instr, MAXIO,ion);
code = get_data_select(iofile, rtype, io_in, read_one, __io_instr, MAXIO,ion);
/* reajust pointers */
/*reajust_ptr();*/
if (N_io) *(ion->nbody_p) = ion->nbody;
......@@ -260,7 +259,7 @@ int io_nemo(char * iofile,
"in the field parameter for SAVE operation \n");
exit(1);
}
code = put_data_select(iofile, rtype, io_out, save_one, outstr, MAXIO,ion);
code = put_data_select(iofile, rtype, io_out, save_one, __io_outstr, MAXIO,ion);
}
}
free ((t_ion_data *) ion);
......@@ -276,8 +275,8 @@ int close_io_nemo(char * iofile)
int no_io,code;
/* check if the file is already open */
if ((no_io = get_old_file(iofile,io_in,read_one,instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,outstr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_in,read_one,__io_instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,__io_outstr,MAXIO)) < 0) {
fprintf(stderr,
"WARNING!! snapshot [%s] not OPEN, unable to close it\n",
iofile);
......@@ -285,7 +284,7 @@ int close_io_nemo(char * iofile)
}
else {
/* close the file open for writing */
strclose(outstr[no_io]);
strclose(__io_outstr[no_io]);
/* RAZ variables */
save_one[no_io] = FALSE;
......@@ -297,7 +296,7 @@ int close_io_nemo(char * iofile)
}
else {
/* close the file open for reading */
strclose(instr[no_io]);
strclose(__io_instr[no_io]);
/* RAZ variables */
read_one[no_io] = FALSE;
......
......@@ -61,12 +61,12 @@
/* variables for reading */
extern char * io_in[MAXIO];
extern FILE * instr[MAXIO];
extern FILE * __io_instr[MAXIO];
extern bool read_one[MAXIO];
/* variables for writing */
extern char * io_out[MAXIO];
extern FILE * outstr[MAXIO];
extern FILE * __io_outstr[MAXIO];
extern bool save_one[MAXIO];
/* variables used to keep track of history (EXPORTED) */
......@@ -227,7 +227,7 @@ int IO_NEMO_F(char * iofile,
va_end(pa);
if (io_op) { /* operation on snaphot is reading */
code = get_data_select_f(iofile, size_array, rtype, io_in, read_one, instr, MAXIO);
code = get_data_select_f(iofile, size_array, rtype, io_in, read_one, __io_instr, MAXIO);
}
else {
if (!N_io) {
......@@ -237,7 +237,7 @@ int IO_NEMO_F(char * iofile,
"You must specify \"nbody\" in the field parameter for SAVE operation \n");
exit(1);
}
code = put_data_select_f(iofile, size_array, rtype, io_out, save_one, outstr, MAXIO);
code = put_data_select_f(iofile, size_array, rtype, io_out, save_one, __io_outstr, MAXIO);
}
return code;
}
......@@ -255,8 +255,8 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
iofile = (char *) f_ch_to_c(iofile,*lg);
/* check if the file is already open */
if ((no_io = get_old_file(iofile,io_in,read_one,instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,outstr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_in,read_one,__io_instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,__io_outstr,MAXIO)) < 0) {
fprintf(stderr,
"WARNING!! snapshot [%s] not OPEN, unable to close it\n",
iofile);
......@@ -264,7 +264,7 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
}
else {
/* close the file open for writing */
strclose(outstr[no_io]);
strclose(__io_outstr[no_io]);
/* RAZ variables */
save_one[no_io] = FALSE;
......@@ -274,7 +274,7 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
}
else {
/* close the file open for reading */
strclose(instr[no_io]);
strclose(__io_instr[no_io]);
/* RAZ variables */
read_one[no_io] = FALSE;
......
......@@ -20,7 +20,7 @@
/* The following routines are defined by strlib: */
/* */
/* getmem(nbytes) malloc with error checking */
/* scopy(source) returns a copy of source */
/* __nemo_scopy(source) returns a copy of source */
/* sconc(s1,s2) concatenates its arguments */
/* substr(s, p1, p2) returns substring from p1-p2 */
/* findstr(text, pat) finds index of pat in text */
......@@ -47,13 +47,13 @@ char *getmem(int nbytes)
/***************************************************************/
/* s = scopy(t); */
/* s = __nemo_scopy(t); */
/* */
/* Copies the string t into dynamically-allocated storage. */
/* see also: strdup() */
/***************************************************************/
string scopy(const_string s)
string __nemo_scopy(const_string s)
{
string result;
......
......@@ -137,7 +137,7 @@ stream stropen(const_string name, string mode)
fe = (fentry*) allocate(sizeof(fentry));
fe->next = flist;
flist = fe; /* hook into the list */
fe->name = scopy(name);
fe->name = __nemo_scopy(name);
fe->str = res;
fe->scratch = FALSE;
fe->seek = FALSE;
......@@ -203,7 +203,7 @@ stream stropen(const_string name, string mode)
fe = (fentry*) allocate(sizeof(fentry));
fe->next = flist;
flist = fe; /* hook into the list */
fe->name = scopy(tempname);
fe->name = __nemo_scopy(tempname);
fe->str = res;
fe->scratch = streq(mode,"s");
fe->seek = canSeek;
......
......@@ -10,4 +10,4 @@ except:
#from . import test, csnapshot
#from .csnapshot import *
__version__ = '0.9.2'
......@@ -44,7 +44,10 @@ UNSIO comes with an integrated sqlite3 database which can be used to retrieve au
class build_py(_build_py):
def run(self):
self.run_command("build_ext")
return super().run()
if pyversion=="": # python2
return super().run()
else: # python3
return super().run()
setup(
#name='python'+pyversion+'-unsio',
......
......@@ -19,7 +19,7 @@
#define UNSIO_MAJOR "1"
#define UNSIO_MINOR "2"
#define UNSIO_PATCH "0"
#define UNSIO_EXTRA "-dev-Jun-2018"
#define UNSIO_EXTRA "-dev-Sep-21-2018"
#endif // UNS_VERSION_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment