2011-04-26 12:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* utils/hbmk2/hbmk2.prg
    + dependency check to define HBMK_DIR_* macro with autodetected header dir
    + macro evaluator to return actual value (if any) for internally defined macro

  + contrib/hbdroid
  + contrib/hbdroid/hvminit.c
  + contrib/hbdroid/hbdroid.h
  + contrib/hbdroid/hbdroid.hbc
  + contrib/hbdroid/hbdroid.hbp
  + contrib/hbdroid/msginfo.c
    + Android lib
      Based on code sent to the list by Antonio.
      Only build tested (on win).
This commit is contained in:
Viktor Szakats
2011-04-26 10:56:56 +00:00
parent 1f539ed2f5
commit 37f4302d13
7 changed files with 166 additions and 1 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-04-26 12:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
+ dependency check to define HBMK_DIR_* macro with autodetected header dir
+ macro evaluator to return actual value (if any) for internally defined macro
+ contrib/hbdroid
+ contrib/hbdroid/hvminit.c
+ contrib/hbdroid/hbdroid.h
+ contrib/hbdroid/hbdroid.hbc
+ contrib/hbdroid/hbdroid.hbp
+ contrib/hbdroid/msginfo.c
+ Android lib
Based on code sent to the list by Antonio.
Only build tested (on win).
2011-04-26 03:07 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
* contrib/hbqt/qtcore/hbqt_hbqevents.h

View File

@@ -0,0 +1,61 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Android header
*
* Copyright 2011 Viktor Szakats (harbour.01 syenar.hu)
* www - http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#ifndef __HBDROID_H
#define __HBDROID_H
#include <jni.h>
extern HB_EXPORT JNIEnv * __hbdroid_jni_env( void );
extern HB_EXPORT jobject __hbdroid_jni_obj( void );
#endif

View File

@@ -0,0 +1,7 @@
#
# $Id$
#
incpaths=.
libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}

View File

@@ -0,0 +1,28 @@
#
# $Id$
#
-hblib
-inc
-o${hb_targetname}
-w3 -es2
#-stop{!android}
-depkeyhead=jni:jni.h
-depcontrol=jni:no{HB_BUILD_3RDEXT='no'}
-depcontrol=jni:${JAVA_HOME}/include
-depcontrol=jni:${HB_WITH_JNI}
-depincpath=jni:/usr/include
-depfinish=jni
-instfile=inc:hbdroid.hbx
-cflag=-I"${HBMK_DIR_JNI}/win32"{win}
hbdroid.hbx
hvminit.c
msginfo.c

View File

@@ -0,0 +1,29 @@
/*
* $Id$
*/
#include "hbapi.h"
#include "hbvm.h"
#include "hbdroid.h"
/* MT support? */
static JNIEnv * s_env;
static jobject s_obj;
HB_EXPORT JNIEnv * __hbdroid_jni_env( void )
{
return s_env;
}
HB_EXPORT jobject __hbdroid_jni_obj( void )
{
return s_obj;
}
JNIEXPORT void JNICALL Java_test_test_Harbour_vmInit( JNIEnv * env, jobject obj, jint i )
{
s_env = env;
s_obj = obj;
hb_vmInit( i );
}

View File

@@ -0,0 +1,18 @@
/*
* $Id$
*/
#include "hbapi.h"
#include "hbdroid.h"
HB_FUNC( JNI_MSGINFO )
{
JNIEnv * jni_env = __hbdroid_jni_env();
jobject jni_obj = __hbdroid_jni_obj();
jclass cls = ( * jni_env )->GetObjectClass( jni_env, jni_obj );
jmethodID mid = ( * jni_env )->GetMethodID( jni_env, cls, "MsgInfo", "(Ljava/lang/String;)V" );
if( mid )
( * jni_env )->CallVoidMethod( jni_env, jni_obj, mid, ( * jni_env )->NewStringUTF( jni_env, hb_parcx( 1 ) ) );
}

View File

@@ -244,6 +244,7 @@ REQUEST hbmk_KEYW
#define _HBMK_WITH_TPL "HBMK_WITH_%1$s"
#define _HBMK_HAS_TPL "HBMK_HAS_%1$s"
#define _HBMK_HAS_TPL_LOCAL "HBMK_HAS_%1$s_LOCAL"
#define _HBMK_DIR_TPL "HBMK_DIR_%1$s"
#define _HBMK_SCRIPT "__HBSCRIPT__HBMK"
#define _HBMK_IMPLIB_EXE_POST "_exe"
@@ -7918,6 +7919,7 @@ STATIC FUNCTION dep_try_pkg_detection( hbmk, dep )
dep[ _HBMKDEP_cFound ] := iif( Empty( cIncludeDir ), "(system)", cIncludeDir )
IF ! Empty( cIncludeDir )
hbmk[ _HBMK_hDEPTSDIR ][ cIncludeDir ] := NIL
hbmk[ _HBMK_hDEPTMACRO ][ hb_StrFormat( _HBMK_DIR_TPL, StrToDefine( cName ) ) ] := cIncludeDir
/* Adjust implib source names with component path */
FOR EACH tmp IN dep[ _HBMKDEP_aIMPLIBSRC ]
tmp := hb_PathNormalize( PathMakeAbsolute( tmp, hb_DirSepAdd( cIncludeDir ) ) )
@@ -7967,6 +7969,7 @@ STATIC FUNCTION dep_try_header_detection( hbmk, dep )
AAddNew( hbmk[ _HBMK_aINCPATH ], hb_DirSepDel( PathSepToSelf( cDir ) ) )
AAdd( hbmk[ _HBMK_aOPTC ], "-D" + hb_StrFormat( _HBMK_HAS_TPL, StrToDefine( dep[ _HBMKDEP_cName ] ) ) )
hbmk[ _HBMK_hDEPTMACRO ][ hb_StrFormat( _HBMK_HAS_TPL, StrToDefine( dep[ _HBMKDEP_cName ] ) ) ] := NIL
hbmk[ _HBMK_hDEPTMACRO ][ hb_StrFormat( _HBMK_DIR_TPL, StrToDefine( dep[ _HBMKDEP_cName ] ) ) ] := hb_DirSepDel( PathSepToSelf( cDir ) )
IF dep[ _HBMKDEP_lFoundLOCAL ]
hbmk[ _HBMK_hDEPTMACRO ][ hb_StrFormat( _HBMK_HAS_TPL_LOCAL, StrToDefine( dep[ _HBMKDEP_cName ] ) ) ] := NIL
ENDIF
@@ -9908,7 +9911,11 @@ STATIC FUNCTION MacroGet( hbmk, cMacro, cFileName )
cMacro := hb_ntos( hbmk[ _HBMK_nLevel ] ) ; EXIT
OTHERWISE
IF cMacro $ hbmk[ _HBMK_hDEPTMACRO ] /* Check for dependency detection macros */
cMacro := "1"
IF Empty( hbmk[ _HBMK_hDEPTMACRO ][ cMacro ] )
cMacro := "1"
ELSE
cMacro := hbmk[ _HBMK_hDEPTMACRO ][ cMacro ]
ENDIF
ELSE
/* NOTE: If macro not found, try to interpret as
envvar. If it doesn't exist, empty string