2012-06-13 22:55 UTC+0200 Viktor Szakats (harbour syenar.net)
- contrib/hbamf/hbref.c
* contrib/hbamf/amfdec.c
* contrib/hbamf/amfenc.c
* contrib/hbamf/amfstdio.c
* contrib/hbamf/hbamf.hbp
* contrib/hbamf/hbcls.c
* added hbamf_ prefix to public C functions
* locally used public C functions converted to static
* utils/hbmk2/hbmk2.prg
* minor
This commit is contained in:
@@ -16,6 +16,19 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-13 22:55 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
- contrib/hbamf/hbref.c
|
||||
* contrib/hbamf/amfdec.c
|
||||
* contrib/hbamf/amfenc.c
|
||||
* contrib/hbamf/amfstdio.c
|
||||
* contrib/hbamf/hbamf.hbp
|
||||
* contrib/hbamf/hbcls.c
|
||||
* added hbamf_ prefix to public C functions
|
||||
* locally used public C functions converted to static
|
||||
|
||||
* utils/hbmk2/hbmk2.prg
|
||||
* minor
|
||||
|
||||
2012-06-13 16:16 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbplist
|
||||
+ contrib/hbamf
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
/*******
|
||||
*
|
||||
* amfdecode.c by Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
|
||||
* by Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
|
||||
*
|
||||
* amfdecode.c - Decoding AMF3 to Harbour items
|
||||
* Decoding AMF3 to Harbour items
|
||||
*
|
||||
* Contains portions from
|
||||
* Dave Thompson's MIT licensed
|
||||
@@ -38,8 +38,43 @@ typedef struct
|
||||
} amfContext;
|
||||
|
||||
static HB_BOOL amf3_getItem( amfContext * context, PHB_ITEM pItem );
|
||||
extern HB_BOOL is_cls_externalizable( HB_USHORT uiClass );
|
||||
extern PHB_ITEM cls_externalizable_instance( PHB_ITEM pClassFuncStr );
|
||||
extern HB_BOOL hbamf_is_cls_externalizable( HB_USHORT uiClass );
|
||||
|
||||
static PHB_ITEM hbamf_cls_externalizable_instance( PHB_ITEM pClassFuncStr )
|
||||
{
|
||||
PHB_DYNS pSymbol = hb_dynsymGet( hb_itemGetCPtr( pClassFuncStr ) );
|
||||
|
||||
if( pSymbol )
|
||||
{
|
||||
PHB_ITEM pRetCopy = hb_itemNew( NULL );
|
||||
PHB_ITEM pNewItem = hb_itemNew( NULL );
|
||||
hb_itemMove( pRetCopy, hb_stackReturnItem() );
|
||||
|
||||
hb_vmPushDynSym( pSymbol );
|
||||
hb_vmPushNil();
|
||||
hb_vmDo( 0 );
|
||||
|
||||
hb_objSendMsg( hb_stackReturnItem(), "NEW", 0 );
|
||||
|
||||
hb_itemMove( pNewItem, hb_stackReturnItem() );
|
||||
hb_itemMove( hb_stackReturnItem(), pRetCopy );
|
||||
|
||||
hb_itemRelease( pRetCopy );
|
||||
|
||||
if( pNewItem )
|
||||
{
|
||||
if( ! HB_IS_OBJECT( pNewItem ) )
|
||||
{
|
||||
hb_itemRelease( pNewItem );
|
||||
pNewItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pNewItem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char * readByte( amfContext * context )
|
||||
{
|
||||
@@ -595,7 +630,7 @@ static PHB_ITEM class_def_from_classname( /* amfContext * context, */ PHB_ITEM p
|
||||
hb_itemRelease( pKey );
|
||||
hb_itemRelease( pValue );
|
||||
|
||||
if( is_cls_externalizable( uiClass ) )
|
||||
if( hbamf_is_cls_externalizable( uiClass ) )
|
||||
{
|
||||
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
|
||||
pValue = hb_itemNew( NULL );
|
||||
@@ -1017,7 +1052,7 @@ static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BO
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
pValue = cls_externalizable_instance( pValue );
|
||||
pValue = hbamf_cls_externalizable_instance( pValue );
|
||||
if( ! pValue )
|
||||
{
|
||||
hb_itemRelease( pClass );
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
|
||||
/*******
|
||||
*
|
||||
* amfencode.c by
|
||||
* Ilina Stoilkovska <anili100/at/gmail.com> 2011
|
||||
* Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
|
||||
*
|
||||
* amfencode.c - Encoding Harbour items to AMF3
|
||||
* Encoding Harbour items to AMF3
|
||||
*
|
||||
* Contains portions from
|
||||
* Dave Thompson's MIT licensed
|
||||
@@ -50,8 +49,27 @@ typedef struct
|
||||
} amfContext;
|
||||
|
||||
static HB_BOOL amf3_encode( amfContext * context, PHB_ITEM pItem );
|
||||
extern void _ref_realItemPtr( PHB_ITEM pKey, PHB_ITEM pItem );
|
||||
extern HB_BOOL is_cls_externalizable( HB_USHORT uiClass );
|
||||
extern HB_BOOL hbamf_is_cls_externalizable( HB_USHORT uiClass );
|
||||
|
||||
static void _ref_realItemPtr( PHB_ITEM pKey, PHB_ITEM pItem )
|
||||
{
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, ( void * ) hb_itemGetCPtr( pItem ) );
|
||||
}
|
||||
else if( HB_IS_ARRAY( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, hb_arrayId( pItem ) );
|
||||
}
|
||||
else if( HB_IS_HASH( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, hb_hashId( pItem ) );
|
||||
}
|
||||
else if( HB_IS_DATETIME( pItem ) )
|
||||
{
|
||||
hb_itemCopy( pKey, pItem );
|
||||
}
|
||||
}
|
||||
|
||||
static int bufferGrow( amfContext * context, int len )
|
||||
{
|
||||
@@ -210,11 +228,11 @@ static HB_BOOL amf3_write_int( amfContext * context, PHB_ITEM pItem )
|
||||
}
|
||||
|
||||
/*
|
||||
static HB_BOOL amf3_encode_float(amfContext * context, PHB_ITEM pItem)
|
||||
{
|
||||
static HB_BOOL amf3_encode_float(amfContext * context, PHB_ITEM pItem)
|
||||
{
|
||||
float n = (float)hb_itemGetND(pItem);
|
||||
return amfX_encode_double(context, (double)n);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static HB_BOOL amf3_encode_nil( amfContext * context )
|
||||
@@ -392,8 +410,8 @@ static HB_BOOL amf3_serialize_string( amfContext * context, PHB_ITEM pItem )
|
||||
}
|
||||
|
||||
/*
|
||||
static HB_BOOL amf3_serialize_object_as_string(amfContext * context, PHB_ITEM pItem)
|
||||
{
|
||||
static HB_BOOL amf3_serialize_object_as_string(amfContext * context, PHB_ITEM pItem)
|
||||
{
|
||||
PHB_ITEM pStr;
|
||||
HB_BOOL result;
|
||||
|
||||
@@ -407,7 +425,8 @@ static HB_BOOL amf3_serialize_string( amfContext * context, PHB_ITEM pItem )
|
||||
|
||||
hb_itemRelease(pStr);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem )
|
||||
@@ -450,6 +469,7 @@ static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem )
|
||||
return HB_FALSE;
|
||||
|
||||
if( nIntKeys > 0 )
|
||||
{
|
||||
for( i = 1; i <= len; i++ )
|
||||
{
|
||||
pKey = hb_hashGetKeyAt( pItem, i );
|
||||
@@ -460,6 +480,7 @@ static HB_BOOL amf3_encode_hash( amfContext * context, PHB_ITEM pItem )
|
||||
return HB_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HB_TRUE;
|
||||
}
|
||||
@@ -758,7 +779,7 @@ static PHB_ITEM class_def_from_class( /* amfContext * context, */ PHB_ITEM pItem
|
||||
hb_itemRelease( pKey );
|
||||
hb_itemRelease( pValue );
|
||||
|
||||
if( is_cls_externalizable( uiClass ) )
|
||||
if( hbamf_is_cls_externalizable( uiClass ) )
|
||||
{
|
||||
pKey = hb_itemPutC( NULL, "EXTERNALIZABLE_CLASS_DEF" );
|
||||
pValue = hb_itemNew( NULL );
|
||||
@@ -1131,7 +1152,6 @@ static void context_release( amfContext * context, amfContext * outer_context )
|
||||
else
|
||||
hb_itemRelease( context->strstr_ref );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HB_FUNC( AMF3_FROMWA )
|
||||
@@ -1395,7 +1415,6 @@ HB_FUNC( AMF3_FROMWA )
|
||||
}
|
||||
else
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
|
||||
|
||||
}
|
||||
|
||||
HB_FUNC( AMF3_ENCODE )
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
/*******
|
||||
*
|
||||
* amfstdio.c by Ilina Stoilkovska <anili100/at/gmail.com> 2011
|
||||
* Aleksander Czajczynski <hb/at/fki.pl> 2012
|
||||
* by Ilina Stoilkovska <anili100/at/gmail.com> 2011
|
||||
* Aleksander Czajczynski <hb/at/fki.pl> 2012
|
||||
*
|
||||
* amfstdio.c - Reading AMFIO data from standard input pipe
|
||||
* Reading AMFIO data from standard input pipe
|
||||
*
|
||||
*
|
||||
********/
|
||||
@@ -96,5 +96,4 @@ HB_FUNC( AMFSTDIO_READ )
|
||||
hb_xfree( pszStrIn );
|
||||
hb_xfree( pszLenPrefix );
|
||||
hb_retclen_buffer( pszBuf, nLen );
|
||||
|
||||
}
|
||||
|
||||
@@ -16,5 +16,4 @@ hbamf.hbx
|
||||
amfenc.c
|
||||
amfdec.c
|
||||
amfstdio.c
|
||||
hbref.c
|
||||
hbcls.c
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*******
|
||||
*
|
||||
* hbref.c by Aleksander Czajczynski <hb/at/fki.pl> 2011
|
||||
* by Aleksander Czajczynski <hb/at/fki.pl> 2011
|
||||
**
|
||||
* hbref.c - Some class support functions for AMF3 (de)serialization
|
||||
* Some class support functions for AMF3 (de)serialization
|
||||
*
|
||||
********/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapicls.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapistr.h"
|
||||
#include "hbstack.h"
|
||||
#include "hbvm.h"
|
||||
#include "hboo.ch"
|
||||
|
||||
HB_BOOL is_cls_externalizable( HB_USHORT uiClass )
|
||||
HB_BOOL hbamf_is_cls_externalizable( HB_USHORT uiClass )
|
||||
{
|
||||
PHB_DYNS pSymbol = hb_dynsymGet( "__CLSMSGTYPE" );
|
||||
HB_BOOL result = HB_FALSE;
|
||||
@@ -42,39 +44,3 @@ HB_BOOL is_cls_externalizable( HB_USHORT uiClass )
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PHB_ITEM cls_externalizable_instance( PHB_ITEM pClassFuncStr )
|
||||
{
|
||||
PHB_DYNS pSymbol = hb_dynsymGet( hb_itemGetCPtr( pClassFuncStr ) );
|
||||
|
||||
if( pSymbol )
|
||||
{
|
||||
PHB_ITEM pRetCopy = hb_itemNew( NULL );
|
||||
PHB_ITEM pNewItem = hb_itemNew( NULL );
|
||||
hb_itemMove( pRetCopy, hb_stackReturnItem() );
|
||||
|
||||
hb_vmPushDynSym( pSymbol );
|
||||
hb_vmPushNil();
|
||||
hb_vmDo( 0 );
|
||||
|
||||
hb_objSendMsg( hb_stackReturnItem(), "NEW", 0 );
|
||||
|
||||
hb_itemMove( pNewItem, hb_stackReturnItem() );
|
||||
hb_itemMove( hb_stackReturnItem(), pRetCopy );
|
||||
|
||||
hb_itemRelease( pRetCopy );
|
||||
|
||||
if( pNewItem )
|
||||
{
|
||||
if( ! HB_IS_OBJECT( pNewItem ) )
|
||||
{
|
||||
hb_itemRelease( pNewItem );
|
||||
pNewItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pNewItem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*******
|
||||
*
|
||||
* hbref.c by Aleksander Czajczynski <hb/at/fki.pl> 2011-2012
|
||||
*
|
||||
* hbref.c - Using Harbour C-pointers to various items as hashkeys
|
||||
*
|
||||
********/
|
||||
|
||||
#include "hbapiitm.h"
|
||||
|
||||
void _ref_realItemPtr( PHB_ITEM pKey, PHB_ITEM pItem )
|
||||
{
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, ( void * ) hb_itemGetCPtr( pItem ) );
|
||||
}
|
||||
else if( HB_IS_ARRAY( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, hb_arrayId( pItem ) );
|
||||
}
|
||||
else if( HB_IS_HASH( pItem ) )
|
||||
{
|
||||
hb_itemPutPtr( pKey, hb_hashId( pItem ) );
|
||||
}
|
||||
else if( HB_IS_DATETIME( pItem ) )
|
||||
{
|
||||
hb_itemCopy( pKey, pItem );
|
||||
}
|
||||
}
|
||||
@@ -12786,7 +12786,7 @@ STATIC PROCEDURE __hbrun_Exec( cCommand )
|
||||
LOCAL pHRB, cHRB, cFunc, bBlock, cEol, nRowMin
|
||||
|
||||
cEol := hb_eol()
|
||||
cFunc := "STATIC FUNC __HBDOT()" + cEol + ;
|
||||
cFunc := "STATIC FUNCTION __HBDOT()" + cEol + ;
|
||||
"RETURN {||" + cEol + ;
|
||||
" " + cCommand + cEol + ;
|
||||
" RETURN __MVSETBASE()" + cEol + ;
|
||||
|
||||
Reference in New Issue
Block a user