Created
February 1, 2019 19:20
-
-
Save plenarius/b4a3494f4c78b2f97b4776161dc7926a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// @(#) dhsk_h | |
// | |
/* | |
[00.01] (2008-10-08) | |
LIFO StacK. | |
[01.00] (2008-11-25) | |
Release. | |
//=====================================:======================================*/ | |
// INCLUDE // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
#include "dhay_h" | |
//============================================================================// | |
// CONSTANTS // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
//============================================================================// | |
// VARIABLES // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
//============================================================================// | |
// PROTOTYPES // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
// Returns the SIZE of the STACK. | |
int DHSK_SizGet( string sStack, object oStack = OBJECT_SELF ); | |
// Pushes (adds) fValue onto the top of the STACK. | |
int DHSK_FltPush( float fValue, string sStack, object oStack = OBJECT_SELF ); | |
// Pops (removes and returns) the last value added to the top of the STACK. | |
// There is no way to return a value indicating an empty STACK. | |
// The size of the STACK should be checked before using DHSK_FltPop(): | |
// if( ZERO != DHSK_SizGet( sStack, oStack ) ) | |
// { | |
// fValue = DHSK_FltPop( sStack, oStack ) | |
// ; | |
// } | |
float DHSK_FltPop( string sStack, object oStack = OBJECT_SELF ); | |
// Pushes (adds) iValue onto the top of the STACK. | |
int DHSK_IntPush( int iValue, string sStack, object oStack = OBJECT_SELF ); | |
// Pops (removes and returns) the last value added to the top of the STACK. | |
// There is no way to return a value indicating an empty STACK. | |
// The size of the STACK should be checked before using DHSK_IntPop(): | |
// if( ZERO != DHSK_SizGet( sStack, oStack ) ) | |
// { | |
// iValue = DHSK_IntPop( sStack, oStack ) | |
// ; | |
// } | |
int DHSK_IntPop( string sStack, object oStack = OBJECT_SELF ); | |
// Pushes (adds) lValue onto the top of the STACK. | |
int DHSK_LocPush( location lValue, string sStack, object oStack = OBJECT_SELF ); | |
// Pops (removes and returns) the last value added to the top of the STACK. | |
// There is no way to return a value indicating an empty STACK. | |
// The size of the STACK should be checked before using DHSK_LocPop(): | |
// if( ZERO != DHSK_SizGet( sStack, oStack ) ) | |
// { | |
// lValue = DHSK_LocPop( sStack, oStack ) | |
// ; | |
// } | |
location DHSK_LocPop( string sStack, object oStack = OBJECT_SELF ); | |
// Pushes (adds) oValue onto the top of the STACK. | |
int DHSK_ObjPush( object oValue, string sStack, object oStack = OBJECT_SELF ); | |
// Pops (removes and returns) the last value added to the top of the STACK. | |
// There is no way to return a value indicating an empty STACK. | |
// The size of the STACK should be checked before using DHSK_ObjPop(): | |
// if( ZERO != DHSK_SizGet( sStack, oStack ) ) | |
// { | |
// oValue = DHSK_ObjPop( sStack, oStack ) | |
// ; | |
// } | |
object DHSK_ObjPop( string sStack, object oStack = OBJECT_SELF ); | |
// Pushes (adds) sValue onto the top of the STACK. | |
int DHSK_StrPush( string sValue, string sStack, object oStack = OBJECT_SELF ); | |
// Pops (removes and returns) the last value added to the top of the STACK. | |
// There is no way to return a value indicating an empty STACK. | |
// The size of the STACK should be checked before using DHSK_StrPop(): | |
// if( ZERO != DHSK_SizGet( sStack, oStack ) ) | |
// { | |
// sValue = DHSK_StrPop( sStack, oStack ) | |
// ; | |
// } | |
string DHSK_StrPop( string sStack, object oStack = OBJECT_SELF ); | |
//============================================================================// | |
// FUNCTIONS // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_SizGet( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
return( DHAY_SizGet( sStack, oStack ) ) | |
; | |
} | |
//============================================================================// | |
// FUNCTIONS - FLOAT // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_FltPush( float fValue, string sStack, object oStack = OBJECT_SELF ) | |
{ | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( FALSE ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( FALSE ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( DHAY_FltAdd( fValue, sStack, oStack ) ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
float DHSK_FltPop( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
int iStack ; | |
float fValue ; | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( fValue ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( fValue ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
iStack = DHSK_SizGet( sStack, oStack ) | |
; | |
if( ZERO != iStack ) | |
{ | |
fValue = DHAY_FltGet( iStack, sStack, oStack) | |
; | |
DHAY_FltDelete_( iStack, sStack, oStack ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( fValue ) | |
; | |
} | |
//============================================================================// | |
// FUNCTIONS - INT // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_IntPush( int iValue, string sStack, object oStack = OBJECT_SELF ) | |
{ | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( FALSE ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( FALSE ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( DHAY_IntAdd( iValue, sStack, oStack ) ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
int DHSK_IntPop( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
int iStack ; | |
int iValue ; | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( iValue ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( iValue ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
iStack = DHSK_SizGet( sStack, oStack ) | |
; | |
if( ZERO != iStack ) | |
{ | |
iValue = DHAY_IntGet( iStack, sStack, oStack) | |
; | |
DHAY_IntDelete_( iStack, sStack, oStack ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( iValue ) | |
; | |
} | |
//============================================================================// | |
// FUNCTIONS - LOCATION // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_LocPush( location lValue, string sStack, object oStack = OBJECT_SELF ) | |
{ | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( FALSE ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( FALSE ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( DHAY_LocAdd( lValue, sStack, oStack ) ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
location DHSK_LocPop( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
int iStack ; | |
location lValue ; | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( lValue ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( lValue ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
iStack = DHSK_SizGet( sStack, oStack ) | |
; | |
if( ZERO != iStack ) | |
{ | |
lValue = DHAY_LocGet( iStack, sStack, oStack) | |
; | |
DHAY_LocDelete_( iStack, sStack, oStack ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( lValue ) | |
; | |
} | |
//============================================================================// | |
// FUNCTIONS - OBJECT // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_ObjPush( object oValue, string sStack, object oStack = OBJECT_SELF ) | |
{ | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( FALSE ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( FALSE ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( DHAY_ObjAdd( oValue, sStack, oStack ) ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
object DHSK_ObjPop( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
int iStack ; | |
object oValue ; | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( oValue ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( oValue ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
iStack = DHSK_SizGet( sStack, oStack ) | |
; | |
if( ZERO != iStack ) | |
{ | |
oValue = DHAY_ObjGet( iStack, sStack, oStack) | |
; | |
DHAY_ObjDelete_( iStack, sStack, oStack ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( oValue ) | |
; | |
} | |
//============================================================================// | |
// FUNCTIONS - STRING // | |
//=+===+===+===+===+===+===+===+===+===:===+===+===+===+===+===+===+===+===+==// | |
int DHSK_StrPush( string sValue, string sStack, object oStack = OBJECT_SELF ) | |
{ | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( FALSE ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( FALSE ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( DHAY_StrAdd( sValue, sStack, oStack ) ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
string DHSK_StrPop( string sStack, object oStack = OBJECT_SELF ) | |
{ | |
int iStack ; | |
string sValue ; | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
if( ! GetIsObjectValid( oStack ) ) | |
{ | |
return( sValue ) | |
; | |
} | |
if( BLANK == sStack ) | |
{ | |
return( sValue ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
iStack = DHSK_SizGet( sStack, oStack ) | |
; | |
if( ZERO != iStack ) | |
{ | |
sValue = DHAY_StrGet( iStack, sStack, oStack) | |
; | |
DHAY_StrDelete_( iStack, sStack, oStack ) | |
; | |
} | |
//`'```'```'```'```'```'```'```'```:```'```'```'```'```'```'```'```'```'``// | |
return( sValue ) | |
; | |
} | |
//-+---+---+---+---+---+---+---+---+---:---+---+---+---+---+---+---+---+---+--// | |
// void main(){} | |
//============================================================================// | |
// | |
// EOF | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment