/** 
 * -- miscellaneous useful extra words for DOUBLE-EXT
 *
 *  Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.
 *
 *  @see     GNU LGPL
 *  @author  Tektronix CTE              @(#) %derived_by: guidod %
 *  @version %version:  %
 *    (%date_modified:  %)
 *
 *  @description
 *      Compatiblity with former standards, miscellaneous useful words.
 *      ... for DOUBLE-EXT  (which is almost complete... just almost)
 */
/*@{*/
#if defined(__version_control__) && defined(__GNUC__)
static char* id __attribute__((unused)) = 
"@(#) $Id: %full_filespec:   % $";
#endif

#define _P4_SOURCE 1

#include <pfe/pfe-base.h>
#include <pfe/double-sub.h>

#define UDP ((p4udcell *)SP)

/** 2ROT ( d1,d1 d2,d2 d3,d3 -- d2,d2 d3,d3 d1,d1 )
 * the double-cell ROT operation.
 * actively moves six cells, i.e.
   ( x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2 )
 */
FCode (p4_two_rot)
{
    p4cell h;

    h = SP[4];
    SP[4] = SP[2];
    SP[2] = SP[0];
    SP[0] = h;
    h = SP[5];
    SP[5] = SP[3];
    SP[3] = SP[1];
    SP[1] = h;
}
/** DU< ( d1,d1 d2,d2 -- flag )
 * the double-cell unsigned-is-less operation ( U< )
 */
FCode (p4_d_u_less)
{
    SP[3] = P4_FLAG (p4_d_u_less (&UDP[1], &UDP[0]));
    SP += 3;
}
/** LITERAL, ( value -- )
 * take the value from stack (or cs-stack) and compile a runtime-code and
 * the value as for LITERAL ... this word is never state-smart, it
 * is not immediate, and has therefore no complications with POSTPONE
 * (compare also with COMPILE, to make a call-stub with an exectoken)
 */
FCode (p4_literal_comma)
{
    FX_COMPILE (p4_literal);
    FX_VCOMMA (*SP++);
}
/** 2LITERAL, ( x1,x2 -- )
 * take the double-value from stack (or cs-stack) and compile a runtime-code 
 * and the value as for 2LITERAL ... this word is never state-smart, it
 * is not immediate, and has therefore no complications with POSTPONE
 * (compare also with COMPILE, to make a call-stub with an exectoken)
 */
FCode (p4_two_literal_comma)
{
    FX_COMPILE (p4_two_literal);
    FX_VCOMMA (((p4dcell*)SP)->hi);
    FX_VCOMMA (((p4dcell*)SP)->lo);
    FX_2DROP;
}
P4_LISTWORDS (double_misc) =
{
     (, ),

     (,         ),
     (,          ),

     (,     ),
     (,    ),
};
P4_COUNTWORDS (double_misc, "DOUBLE-Misc Compatibility words");
/*@}*/
/* 
 * Local variables:
 * c-file-style: "stroustrup"
 * End:
 */