Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #41557

Re: Another Gforth snapshot

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Another Gforth snapshot
Date 2015-08-26 15:26 +0200
Organization A noiseless patient Spider
Message-ID <mrkemb$sa1$1@dont-email.me> (permalink)
References <mrgah4$11j$1@dont-email.me> <67f9ee58-3406-4cd5-9610-d70ee6394bd2@googlegroups.com> <mriulh$ih5$1@dont-email.me> <2015Aug26.095735@mips.complang.tuwien.ac.at>

Show all headers | View raw


Anton Ertl wrote:

> Bernd Paysan <bernd.paysan@gmx.de> writes:
>>peter.m.falth@gmail.com wrote:
>>> I have only that on my forths. They work internally with utf8, expect
>>> input in utf8 and give all out put in it. In windows I internally before
>>> a systemcall change to utf16 but that is invisible for the user.
>>
>>We could do that in the C bindings, too; at the moment, it's just a
>>pointer passed to C without implicit conversion to anything.
> 
> It can be done in the same call as the conversion to zero-terminated
> strings (how are these UTF16 strings terminated, BTW?).

By a zero wide-char, i.e. by \u0000.

> Doing it automatically (with SWIG) is not possible, because the C
> headers don't contain information on whether the pointers point to
> input strings or to output buffers (or something that serves as both).
> So we need to provide that information manually.

As long as the C declaration had "const" for those strings that aren't used 
as return values, it could be done.

Microsoft uses a defined type, LPCSTR (or LPCWSTR for wide char, they don't 
like C naming conventions) to specify strings only used as input, so that 
information can be automatically extracted from the C headers.  Other, read-
write (or write-only) strings are LPSTR and LPWSTR.

Swig distinguishes between const char * and char *, (and of course also 
const w_char * and w_char *), so mapping those to different Forth types is 
pretty easy.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
http://bernd-paysan.de/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-25 01:50 +0200
  Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-25 02:12 +0200
  Re: Another Gforth snapshot peter.m.falth@gmail.com - 2015-08-25 13:57 -0700
    Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-26 01:46 +0200
      Re: Another Gforth snapshot peter.m.falth@gmail.com - 2015-08-25 23:56 -0700
        Re: Another Gforth snapshot mhx@iae.nl - 2015-08-26 00:49 -0700
      Re: Another Gforth snapshot anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-08-26 07:57 +0000
        Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-26 15:26 +0200
          Re: Another Gforth snapshot anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-08-26 16:04 +0000
            Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-27 01:18 +0200
  Re: Another Gforth snapshot Greg <borota@gmail.com> - 2015-08-25 20:20 -0700
    Re: Another Gforth snapshot anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-08-26 09:03 +0000
  Re: Another Gforth snapshot Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-08-27 11:29 +0100
    Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-27 15:17 +0200
      Re: Another Gforth snapshot Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-08-27 19:54 +0100
        Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-28 04:06 +0200
        Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-28 04:16 +0200
  Re: Another Gforth snapshot mhx@iae.nl - 2015-11-28 03:12 -0800
    Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-28 17:23 +0100
    Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-28 22:11 +0100
      Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-29 01:00 +0100
        Re: Another Gforth snapshot mhx@iae.nl - 2015-11-28 17:11 -0800
          Re: Another Gforth snapshot Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-29 03:07 +0100

csiph-web