[OpenBIOS] Concatenating strings

M A teammember0x01 at gmail.com
Tue Sep 7 16:36:22 CEST 2010


> 
> On Sep 5, 2010, at 6:00 AM, openbios-request at openbios.org wrote:
> On 9/1/10 4:57 PM, Programmingkid wrote:
> 
> On Sep 1, 2010, at 6:00 AM, openbios-request at openbios.org
> <mailto:openbios-request at openbios.org> wrote:
> 
> Message: 5
> Date: Tue, 31 Aug 2010 20:11:30 -0400
> From: Tarl Neustaedter <tarl-b2 at tarl.net <mailto:tarl-b2 at tarl.net>>
> To: The OpenBIOS Mailinglist <openbios at openbios.org
> <mailto:openbios at openbios.org>>
> Subject: Re: [OpenBIOS] Concatenating strings
> Message-ID: <4C7D9A32.2070300 at tarl.net
> <mailto:4C7D9A32.2070300 at tarl.net>>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 2010-8-31 8:06 PM, Programmingkid wrote:
> Could someone provide me with a code example on how to combine two
> strings 
> together in forth please. Here is my attempt. For some reason it
> doesn't 
> work. Any help would be great.
> 
> The below takes two strings of the form (addr len), allocates a chunk of 
> memory for them, and concatenates them into that allocated memory,
> returning 
> addr len.
> 
> : $cat2  ( $1 $2 -- $3 )
>   2 pick over +  dup >r alloc-mem >r
>   2swap tuck  r@ swap move           ( $2 $1-len )
>   r@ + swap move                     ( )
>   r> r>
> ;
> 
> Thank you very much Tarl. This word should be added to OpenBIOS. 
> 
> Please make sure whether the already existing functions (ie. in
> openbios/forth/lib/string.fs) work for you before adding new stuff.
> 
> Stefan

Sorry Stefan, but the words there are not very useful. $cat looks a lot more useful and user-friendly than tmpstrcat. Adding $cat to string.fs would make an excellent addition the OpenBIOS. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20100907/58db3952/attachment.html>


More information about the OpenBIOS mailing list