From 5969f97d7f4cfd4e9ad42b25e4269bdc49fa5d51 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 15 Jun 2012 09:01:56 +0000 Subject: [PATCH] 2012-06-15 10:59 UTC+0200 Viktor Szakats (harbour syenar.net) + contrib/hbamf/hbamfobj.prg * contrib/hbamf/amfdec.c * contrib/hbamf/amfenc.c * contrib/hbamf/hbamf.hbp * contrib/hbamf/hbamf.hbx + added missing parts as per Aleksander's instructions. with some renames/formatting. OBJAMF renamed to AMF_OBJ, please review and test. https://groups.google.com/d/msg/harbour-devel/EPdeo6zbFt8/FTd7mkyTPawJ * utils/hbmk2/hbmk2.prg * minor formatting --- harbour/ChangeLog | 14 +++++++ harbour/contrib/hbamf/amfdec.c | 2 +- harbour/contrib/hbamf/amfenc.c | 2 +- harbour/contrib/hbamf/hbamf.hbp | 2 + harbour/contrib/hbamf/hbamf.hbx | 1 + harbour/contrib/hbamf/hbamfobj.prg | 65 ++++++++++++++++++++++++++++++ harbour/utils/hbmk2/hbmk2.prg | 3 +- 7 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 harbour/contrib/hbamf/hbamfobj.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f652c598b6..b31d2398d7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-15 10:59 UTC+0200 Viktor Szakats (harbour syenar.net) + + contrib/hbamf/hbamfobj.prg + * contrib/hbamf/amfdec.c + * contrib/hbamf/amfenc.c + * contrib/hbamf/hbamf.hbp + * contrib/hbamf/hbamf.hbx + + added missing parts as per Aleksander's instructions. + with some renames/formatting. OBJAMF renamed to AMF_OBJ, + please review and test. + https://groups.google.com/d/msg/harbour-devel/EPdeo6zbFt8/FTd7mkyTPawJ + + * utils/hbmk2/hbmk2.prg + * minor formatting + 2012-06-15 10:16 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg ! fixed RTE when running hbrun without parameter diff --git a/harbour/contrib/hbamf/amfdec.c b/harbour/contrib/hbamf/amfdec.c index 9eb4c0290a..21609d5b29 100644 --- a/harbour/contrib/hbamf/amfdec.c +++ b/harbour/contrib/hbamf/amfdec.c @@ -1027,7 +1027,7 @@ static HB_BOOL amf3_deserialize_obj( amfContext * context, PHB_ITEM pItem, HB_BO hb_arrayNew( pItem, OBJAMF_VAR_COUNT ); /* performance TOFIX, cache class id (in context maybe) to not scan all classes by name everytime */ - hb_objSetClass( pItem, "OBJAMF", "OBJAMF" ); + hb_objSetClass( pItem, "AMF_OBJ", "AMF_OBJ" ); pValue = hb_itemPutNI( NULL, OBJAMF_VER ); hb_arraySet( pItem, OBJAMF_VAR_VER, pValue ); hb_itemRelease( pValue ); diff --git a/harbour/contrib/hbamf/amfenc.c b/harbour/contrib/hbamf/amfenc.c index 1920f60bd0..8e48ba7847 100644 --- a/harbour/contrib/hbamf/amfenc.c +++ b/harbour/contrib/hbamf/amfenc.c @@ -814,7 +814,7 @@ static HB_BOOL amf3_encode_object( amfContext * context, PHB_ITEM pItem ) PHB_ITEM pClass; /* serialize emulated ActionScript dynamic object */ - if( strcmp( hb_clsName( hb_objGetClass( pItem ) ), "OBJAMF" ) == 0 ) + if( strcmp( hb_clsName( hb_objGetClass( pItem ) ), "AMF_OBJ" ) == 0 ) { PHB_ITEM pAnonHash = hb_itemNew( NULL ); diff --git a/harbour/contrib/hbamf/hbamf.hbp b/harbour/contrib/hbamf/hbamf.hbp index 6a1f5d4595..6339421896 100644 --- a/harbour/contrib/hbamf/hbamf.hbp +++ b/harbour/contrib/hbamf/hbamf.hbp @@ -17,3 +17,5 @@ amfenc.c amfdec.c amfstdio.c hbcls.c + +hbamfobj.prg diff --git a/harbour/contrib/hbamf/hbamf.hbx b/harbour/contrib/hbamf/hbamf.hbx index 4006288b7b..14b356c888 100644 --- a/harbour/contrib/hbamf/hbamf.hbx +++ b/harbour/contrib/hbamf/hbamf.hbx @@ -29,6 +29,7 @@ DYNAMIC AMF3_DECODE DYNAMIC AMF3_ENCODE DYNAMIC AMF3_FROMWA DYNAMIC AMFSTDIO_READ +DYNAMIC AMF_OBJ #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBAMF__REQUEST ) #uncommand DYNAMIC => EXTERNAL diff --git a/harbour/contrib/hbamf/hbamfobj.prg b/harbour/contrib/hbamf/hbamfobj.prg new file mode 100644 index 0000000000..20bd164b55 --- /dev/null +++ b/harbour/contrib/hbamf/hbamfobj.prg @@ -0,0 +1,65 @@ +/* + * $Id$ + */ + +/******* +* +* Ilina Stoilkovska 2011 +* Aleksander Czajczynski 2011-2012 +* +* Basic routines for communications using AMFIO +* over standard IO pipes and TCP/IP +* +********/ + +/* internal Harbour functions used in this file */ +#xtranslate MethodName() => __GetMessage() + +#include "hbclass.ch" + +CREATE CLASS AMF_Obj + + METHOD New( hCachedData ) CONSTRUCTOR + ERROR HANDLER noMessage + METHOD msgNotFound + + PROTECTED: + + VAR nVersion INIT 0 + VAR cRealClass + VAR hCachedData + VAR nRpcOid + VAR pConnection + VAR nID + + EXPORTED: + + ACCESS RealClass INLINE ::cRealClass + ACCESS RpcOid INLINE ::nRpcOid + +END CLASS + +METHOD New( hCachedData ) CLASS AMF_Obj + + ::hCachedData := hCachedData + + RETURN self + +METHOD noMessage( ... ) CLASS AMF_Obj + + RETURN ::msgNotFound( MethodName(), ... ) + +METHOD msgNotFound( cMessage, ... ) CLASS AMF_Obj + + IF PCount() = 1 .AND. !( hb_BLeft( cMessage, 1 ) == "_" ) + IF ! Empty( ::hCachedData ) .AND. hb_HHasKey( ::hCachedData, cMessage ) + RETURN ::hCachedData[ cMessage ] + ENDIF + ELSEIF PCount() > 1 .AND. hb_BLeft( cMessage, 1 ) == "_" + IF Empty( ::hCachedData ) + ::hCachedData := { => } + ENDIF + RETURN ::hCachedData[ hb_BSubStr( cMessage, 2 ) ] := hb_PValue( 2 ) + ENDIF + + RETURN NIL diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index f688526d70..c715da3882 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -13010,7 +13010,8 @@ DYNAMIC win_regWrite DYNAMIC win_regDelete STATIC FUNCTION __hbshell_win_reg_self( lRegister, lAllUser ) - IF ! hb_IsFunction( "__HBEXTERN__HBWIN__" ) .AND. ! hbshell_ext_load( "hbwin" ) + IF ! hb_IsFunction( "__HBEXTERN__HBWIN__" ) .AND. ; + ! hbshell_ext_load( "hbwin" ) RETURN .F. ENDIF IF ! hb_IsFunction( "win_regWrite" ) .OR. ;