--- gforth/prim 2008/08/09 14:17:51 1.233 +++ gforth/prim 2008/10/06 21:21:20 1.236 @@ -1782,7 +1782,11 @@ gforth_FP=fp; gforth_SP=sp; gforth_RP=rp; gforth_LP=lp; +#ifdef HAS_LINKBACK ((void (*)())w)(); +#else +((void (*)(void *))w)(gforth_pointers); +#endif sp=gforth_SP; fp=gforth_FP; rp=gforth_RP; @@ -1925,7 +1929,7 @@ Return an error if this is not possible" wior = IOR(chdir(tilde_cstr(c_addr, u, 1))); get-dir ( c_addr1 u1 -- c_addr2 u2 ) gforth get_dir -""Store the current directory in the buffer specified by @{c-addr1, u1}. +""Store the current directory in the buffer specified by @i{c-addr1, u1}. If the buffer size is not sufficient, return 0 0"" c_addr2 = (Char *)getcwd((char *)c_addr1, u1); if(c_addr2 != NULL) { @@ -1934,6 +1938,10 @@ if(c_addr2 != NULL) { u2 = 0; } +=mkdir ( c_addr u wmode -- wior ) gforth equals_mkdir +""Create directory @i{c-addr u} with mode @i{wmode}."" +wior = IOR(mkdir(tilde_cstr(c_addr,u,1),wmode)); + \+ newline ( -- c_addr u ) gforth @@ -2399,7 +2407,7 @@ r = fp[u]; \g syslib open-lib ( c_addr1 u1 -- u2 ) gforth open_lib -#if 1 +#ifdef HAVE_LIBLTDL u2 = (UCell)lt_dlopen(tilde_cstr(c_addr1, u1, 1)); #elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) #ifndef RTLD_GLOBAL @@ -2416,7 +2424,7 @@ u2 = 0; #endif lib-sym ( c_addr1 u1 u2 -- u3 ) gforth lib_sym -#if 1 +#ifdef HAVE_LIBLTDL u3 = (UCell) lt_dlsym((lt_dlhandle)u2, cstr(c_addr1, u1, 1)); #elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) u3 = (UCell) dlsym((void*)u2,cstr(c_addr1, u1, 1)); @@ -2460,8 +2468,13 @@ l! ( w c_addr -- ) gforth l_store lib-error ( -- c_addr u ) gforth lib_error ""Error message for last failed @code{open-lib} or @code{lib-sym}."" +#ifdef HAVE_LIBLTDL c_addr = (Char *)lt_dlerror(); u = (c_addr == NULL) ? 0 : strlen((char *)c_addr); +#else +c_addr = "libltdl is not configured"; +u = strlen(c_addr); +#endif \+ \g peephole