[comp.sys.handhelds] CNVRT src posting

cloos@acsu.buffalo.edu (James H. Cloos) (04/10/91)

Here is the promised src for the CONVERT replacement I earlier posted.

Below is a version of the program that can be compiled by rplc, both as it
now stands at alpha.1.3, and at any later version (such as those that will
eventually be released).  After that is a copy using a symbol table that,
though it gives an idea of what is happening, is almost certainly
guarenteed NOT to be included in any rplc distribution.

First, CNVRT.RPLC:  (NB, see the earlier posting for a copy of the GPL.)

=========================++Start of CNVRT.RPLC++=============================
//  @(#) cnvrt.rplc -=- A CONVERT replacement for the HP48 -=- StandAlone
// 
//  Copyright (C) 1991 James H. Cloos, Jr.
//  
//  CNVRT is free software; you can redistribute it and/or modify it under
//  the terms of the GNU General Public License as published by the Free
//  Software Foundation; either version 1, or (at your option) any later
//  version.
//  
//  CNVRT is distributed in the hope that it will be useful, but WITHOUT ANY
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
//  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
//  for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with CNVRT; see the file COPYING. If not, write to the Free
//  Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

// New CONVERT function with symbols replaced with =='s 

:: 

$ "CONVERT Replacement, standalone version A"
$ "Copyright \169"
$ "James H. Cloos, Jr. 1991"
$ "See the GNU GPL"
==60F7E	//Drop4

==18EDF

  #11		// 2Real1Real
	==3244

  #15		// 2Real1List
	:: ==3188 ==3188 ==567B ==56B6 ==3244 { LAM 'from LAM 'to
	LAM 'to'base } ==74D0  LAM 'to ==567B ==73CE LAM 'from LAM 'to
	==7221 ==56B6 ==3244 ==F371 ==FCFA ==3188 LAM 'to'base ==F371
	==FCFA ==6E97 LAM 'from ==3223 ==205A1 ==7334 LAM 'from LAM 'to
	==567B ==5459 ==7479 ;

  #1E		// 2Real1Unit
	==F371

  #51		// 2List1Real
	:: ==3223 ==54AF ==73CE ==F6A2 ==7334 ==3223 ==F371 ;

  #55		// 2List1List
	:: ==3223 ==54AF ==73CE ==F6A2 ==7334 ==3223 ==F371
	==3188 ==3188 ==367B ==56B6 ==3244 { LAM 'from LAM 'to
	LAM 'to'base } ==74D0  LAM 'to ==567B ==73CE LAM 'from LAM 'to
	==7221 ==56B6 ==3244 ==F371 ==FCFA ==3188 LAM 'to'base ==F371
	==FCFA ==6E97 LAM 'from ==3223 ==205A1 ==7334 LAM 'from LAM 'to
	==567B ==5459 ==7479 ;

  # 5E		// 2List1Unit
	:: ==3223 ==54AF ==73CE ==F6A2 ==7334 ==3223 ==F371 ;

  #E1		// 2Unit1Real
	==F371

  # E5		// 2Unit1List
	:: ==3188 ==3188 ==367B ==56B6 ==3244 { LAM 'from LAM 'to
	LAM 'to'base } ==74D0  LAM 'to ==567B ==73CE LAM 'from LAM 'to
	==7221 ==56B6 ==3244 ==F371 ==FCFA ==3188 LAM 'to'base ==F371
	==FCFA ==6E97 LAM 'from ==3223 ==205A1 ==7334 LAM 'from LAM 'to
	==567B ==5459 ==7479 ;

  #EE		// 2Unit1Unit
	==F371

;
=========================---End of CNVRT.RPLC---=============================

========================++Start of CNVRT.w/symb++============================
//	This file MUST only be distributed with the CNVRT package
// 
//	Copyright (C) 1991 James H. Cloos, Jr.
//  

::

$ "CONVERT Replacement, standalone version A"
$ "Copyright \169"
$ "James H. Cloos, Jr. 1991"
$ "See the GNU GPL"
Drop4

Switch1

 #11	Drop
 #15	:: Dup Dup Size Get Drop { LAM 'from LAM 'to LAM 'to'base }
	StoLocals LAM 'to Size Start0toN-1 LAM 'from LAM 'to
	CurrentLoopCount Get Drop Convert Ip Dup LAM 'to'base Convert
	Ip GetNext(NoEval) LAM 'from Swap Sto- Next LAM 'from LAM 'to
	Size >List PurgeLocals ;
 #1E	Convert
 #51	:: Swap List> Start0toN-1 + Next Swap Convert ;
 #55	:: Swap List> StartOtoN-1 + Next Swap Dup Dup Size Get Drop
	{ LAM 'from LAM 'to LAM 'to'base } StoLocals LAM 'to Size
	Start0toN-1 LAM 'from LAM 'to CurrentLoopCount Get Drop Convert
	Ip Dup LAM 'to'base Convert Ip GetNext(NoEval) LAM 'from Swap
	Sto- Next LAM 'from LAM 'to Size >List PurgeLocals ;
 # 5E	:: Swap List> Start0toN-1 + Next Swap Convert ;
 #E1	Convert
 # E5	:: Dup Dup Size Get Drop { LAM 'from LAM 'to LAM 'to'base }
	StoLocals LAM 'to Size Start0toN-1 LAM 'from LAM 'to
	CurrentLoopCount Get Drop Convert Ip Dup LAM 'to'base Convert
	Ip GetNext(NoEval) LAM 'from Swap Sto- Next LAM 'from LAM 'to
	Size >List PurgeLocals ;
 #EE	Convert
;
========================---End of CNVRT.w/symb---===========================


I'll fairly soon be posting a library that includes this and a number of
other interesting stuff.  In a library, the duplicated stuff can be farmed
out, as it were, to other xlibs, thus reducing the size considerably.

Until next time... ;-)

-JimC
--
James H. Cloos, Jr.		Phone:  +1 716 673-1250
cloos@ACSU.Buffalo.EDU		Snail:  PersonalZipCode:  14048-0772, USA
cloos@ub.UUCP			Quote:  <>