* contrib/hbnf/scancode.prg
* contrib/hbnf/vidmode.prg
* contrib/hbnf/miltime.prg
* contrib/hbnf/savearr.prg
* contrib/hbnf/dispmsg.prg
* contrib/hbnf/mouse1.prg
* contrib/hbnf/settime.prg
* contrib/hbnf/page.prg
* contrib/hbnf/pegs.prg
* contrib/hbnf/min2dhm.prg
* contrib/hbnf/dosver.prg
* contrib/hbnf/metaph.prg
* contrib/hbnf/woy.prg
* contrib/hbnf/setdate.prg
* contrib/hbnf/linked.prg
* contrib/hbnf/aredit.prg
* contrib/hbnf/xbox.prg
* contrib/hbnf/ftround.prg
* contrib/hbnf/dectobin.prg
* contrib/hbnf/aemaxlen.prg
* contrib/hbnf/nwlstat.prg
* contrib/hbnf/tempfile.prg
* contrib/hbnf/scregion.prg
* contrib/hbnf/mouse2.prg
* contrib/hbnf/pickday.prg
* contrib/hbnf/datecnfg.prg
* contrib/hbnf/easter.prg
* contrib/hbnf/aeminlen.prg
* contrib/hbnf/pchr.prg
* contrib/hbnf/tbwhile.prg
* contrib/hbnf/calendar.prg
* contrib/hbnf/elapsed.prg
* contrib/hbnf/aading.prg
* examples/hbvpdf/hbvpdf.prg
* examples/hbvpdf/hbvpdft.prg
* examples/gtwvw/tests/prog1.prg
* examples/gtwvw/tests/prog2.prg
* examples/gtwvw/tests/wvwtest9.prg
* examples/gtwvw/tests/ebtest7.prg
* examples/gtwvw/tests/prog0.prg
! eliminated most (if not all) ' = ' operators
some minor compatibility notes added to NF
(NF being buggy by behaving inconsistently
due to _SET_EXACT setting)
50 lines
935 B
Plaintext
50 lines
935 B
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* File......: dectobin.prg
|
|
* Author....: Greg Lief
|
|
* CIS ID....: 72460,1760
|
|
*
|
|
* This function is an original work by Mr. Grump and is placed in the
|
|
* public domain.
|
|
*
|
|
* Modification history:
|
|
* ---------------------
|
|
*
|
|
* Rev 1.2 15 Aug 1991 23:03:22 GLENN
|
|
* Forest Belt proofread/edited/cleaned up doc
|
|
*
|
|
* Rev 1.1 14 Jun 1991 19:51:30 GLENN
|
|
* Minor edit to file header
|
|
*
|
|
* Rev 1.0 01 Apr 1991 01:01:06 GLENN
|
|
* Nanforum Toolkit
|
|
*
|
|
*/
|
|
|
|
#ifdef FT_TEST
|
|
|
|
FUNCTION MAIN
|
|
LOCAL X
|
|
FOR X := 1 TO 255
|
|
QOUT( FT_DEC2BIN( x ))
|
|
next
|
|
return nil
|
|
|
|
#endif
|
|
|
|
function FT_DEC2BIN(x)
|
|
local i, buffer := { '0', '0', '0', '0', '0', '0', '0', '0' }
|
|
for i := 8 to 1 step -1
|
|
if x >= 2 ^ (i - 1)
|
|
x -= 2 ^ (i - 1)
|
|
buffer[9 - i] := '1'
|
|
endif
|
|
next
|
|
return ( buffer[1] + buffer[2] + buffer[3] + buffer[4] + ;
|
|
buffer[5] + buffer[6] + buffer[7] + buffer[8] )
|
|
|
|
* end of file: dectobin.prg
|