--- gforth/prim 2008/10/06 21:21:20 1.236 +++ gforth/prim 2010/04/05 22:17:56 1.246 @@ -1,6 +1,6 @@ \ Gforth primitives -\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -233,6 +233,19 @@ SET_IP(DOES_CODE1(CFA)); ""just a slot to have an encoding for the DOESJUMP, which is no longer used anyway (!! eliminate this)"" +(doabicode) ( s:... f:... -- s:... f:...) gforth-internal paren_doabicode +""run-time routine for ABI-CODE definitions"" +struct abi_code_ret_t { + Cell *sp; + double * fp; +} ret = ((struct abi_code_ret_t(*)(Cell *, double *))(PFA(CFA)))(sp, fp); +sp = ret.sp; +fp = ret.fp; +#ifdef NO_IP +INST_TAIL; +goto *next_code; +#endif /* defined(NO_IP) */ + \F [endif] \g control @@ -625,6 +638,14 @@ k ( R:w R:w1 R:w2 R:w3 R:w4 -- w R:w R:w \ digit is high-level: 0/0% +abi-call ( #a_callee s:... f:... -- s:... f:... ) gforth abi_call +struct abi_code_ret_t { + Cell *sp; + double * fp; +} ret = ((struct abi_code_ret_t(*)(Cell *, double *))(a_callee))(sp, fp); +sp = ret.sp; +fp = ret.fp; + \g strings move ( c_from c_to ucount -- ) core @@ -1662,7 +1683,11 @@ ucols=cols; wcwidth ( u -- n ) gforth ""The number of fixed-width characters per unicode character u"" +#ifdef HAVE_WCWIDTH n = wcwidth(u); +#else +n = 1; +#endif flush-icache ( c_addr u -- ) gforth flush_icache ""Make sure that the instruction cache of the processor (if there is @@ -1694,6 +1719,7 @@ c_addr2 = (Char *)getenv(cstr(c_addr1,u1 u2 = (c_addr2 == NULL ? 0 : strlen((char *)c_addr2)); open-pipe ( c_addr u wfam -- wfileid wior ) gforth open_pipe +fflush(stdout); wfileid=(Cell)popen(cstr(c_addr,u,1),pfileattr[wfam]); /* ~ expansion of 1st arg? */ wior = IOR(wfileid==0); /* !! the man page says that errno is not set reliably */ @@ -1831,13 +1857,15 @@ wior = IOR(ftruncate(fileno((FILE *)wfil read-file ( c_addr u1 wfileid -- u2 wior ) file read_file /* !! fread does not guarantee enough */ u2 = fread(c_addr, sizeof(Char), u1, (FILE *)wfileid); +if (u2>0) + gf_regetc((FILE *)wfileid); wior = FILEIO(u2