diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index cb5815164d..b5b6994771 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,27 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-12-06 14:36 UTC+0100 Viktor Szakats (harbour syenar.net) + + extras/template + + extras/template/core.prg + + extras/template/corec.c + + extras/template/hbtpl.ch + + extras/template/hbtpl.hbc + + extras/template/hbtpl.hbp + + extras/template/hbtpl.hbx + + extras/template/readme.txt + + extras/template/tests + + extras/template/tests/hbmk.hbm + + extras/template/tests/sample.prg + + extras/template/tests/test.prg + + added Harbour library project template + it supports static and dynamic lib build mode, + features user defined macro, command, PRG + level function and C level function, sample + code, regression tests, .hbc file and automatic + installation to /addons and readme describing + the commands to build and use the library. + 2012-12-06 04:27 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbrun/hbrun.hbp ! load dynamically loaded hbunix/hbwin default extensions diff --git a/harbour/extras/template/core.prg b/harbour/extras/template/core.prg new file mode 100644 index 0000000000..0380ae9f70 --- /dev/null +++ b/harbour/extras/template/core.prg @@ -0,0 +1,8 @@ +/* + * $Id$ + */ + +#include "hbtpl.ch" + +FUNCTION hbtpl_MyPublicFunction() + RETURN "It works" diff --git a/harbour/extras/template/corec.c b/harbour/extras/template/corec.c new file mode 100644 index 0000000000..2001f120c3 --- /dev/null +++ b/harbour/extras/template/corec.c @@ -0,0 +1,10 @@ +/* + * $Id$ + */ + +#include "hbapi.h" + +HB_FUNC( HBTPL_MYPUBLICFUNCTION_IN_C ) +{ + hb_retc( "It works from C" ); +} diff --git a/harbour/extras/template/hbtpl.ch b/harbour/extras/template/hbtpl.ch new file mode 100644 index 0000000000..483446ac60 --- /dev/null +++ b/harbour/extras/template/hbtpl.ch @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef HBTPL_CH +#define HBTPL_CH + +#command HBTPL_PRINT => ? + +#define HBTPL_MYCONSTANT 100 + +#endif diff --git a/harbour/extras/template/hbtpl.hbc b/harbour/extras/template/hbtpl.hbc new file mode 100644 index 0000000000..49a797b3ad --- /dev/null +++ b/harbour/extras/template/hbtpl.hbc @@ -0,0 +1,11 @@ +# +# $Id$ +# + +description=Harbour library project template + +incpaths=. +headers=${hb_name}.ch +libpaths=lib/${hb_plat}/${hb_comp} + +libs=${hb_name} diff --git a/harbour/extras/template/hbtpl.hbp b/harbour/extras/template/hbtpl.hbp new file mode 100644 index 0000000000..6a143b8890 --- /dev/null +++ b/harbour/extras/template/hbtpl.hbp @@ -0,0 +1,20 @@ +# +# $Id$ +# + +# Project build file + +-hblib +-inc + +-olib/${hb_plat}/${hb_comp}/${hb_name} + +-w3 -es2 + +core.prg +corec.c + +-hbx=${hb_name}.hbx +${hb_name}.hbx +$hb_pkg_dynlib.hbm +$hb_pkg_install.hbm diff --git a/harbour/extras/template/hbtpl.hbx b/harbour/extras/template/hbtpl.hbx new file mode 100644 index 0000000000..bbb546c2bc --- /dev/null +++ b/harbour/extras/template/hbtpl.hbx @@ -0,0 +1,31 @@ +/* -------------------------------------------------------------------- + * NOTE: You can add manual override which functions to include or + * exclude from automatically generated EXTERNAL/DYNAMIC list. + * Syntax: // HB_FUNC_INCLUDE + * // HB_FUNC_EXCLUDE + */ + +/* -------------------------------------------------------------------- + * WARNING: Automatically generated code below. DO NOT EDIT! + * Regenerate using hbmk2 '-hbx=' option. + */ + +#ifndef __HBEXTERN_CH__HBTPL__ +#define __HBEXTERN_CH__HBTPL__ + +#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBTPL__ANNOUNCE ) + ANNOUNCE __HBEXTERN__HBTPL__ +#endif + +#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBTPL__REQUEST ) + #command DYNAMIC => EXTERNAL +#endif + +DYNAMIC hbtpl_MyPublicFunction +DYNAMIC hbtpl_MyPublicFunction_In_C + +#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBTPL__REQUEST ) + #uncommand DYNAMIC => EXTERNAL +#endif + +#endif diff --git a/harbour/extras/template/readme.txt b/harbour/extras/template/readme.txt new file mode 100644 index 0000000000..908111520e --- /dev/null +++ b/harbour/extras/template/readme.txt @@ -0,0 +1,26 @@ +/* + * $Id$ + */ + +Harbour library project template +================================ + +Build static lib: + $ hbmk2 hbtpl.hbp + +Build dynamic lib: + $ hbmk2 -hbdyn hbtpl.hbp + +Build sample and test code using: + $ cd tests + $ hbmk2 sample + $ sample + $ hbmk2 test hbtest.hbc + $ test + +Run sample and test code using: + $ hbrun tests/sample.prg + $ hbrun tests/test.prg + + +[vszakats] diff --git a/harbour/extras/template/tests/hbmk.hbm b/harbour/extras/template/tests/hbmk.hbm new file mode 100644 index 0000000000..5c6c465033 --- /dev/null +++ b/harbour/extras/template/tests/hbmk.hbm @@ -0,0 +1,7 @@ +# +# $Id$ +# + +hbtpl.hbc + +-w3 -es2 diff --git a/harbour/extras/template/tests/sample.prg b/harbour/extras/template/tests/sample.prg new file mode 100644 index 0000000000..ce624be21f --- /dev/null +++ b/harbour/extras/template/tests/sample.prg @@ -0,0 +1,22 @@ +/* + * $Id$ + */ + +#require "hbtpl" + +PROCEDURE Main() + + // Public API + + ? hbtpl_MyPublicFunction() + ? hbtpl_MyPublicFunction_In_C() + + // Public constants + + ? HBTPL_MYCONSTANT + + // Public commands + + HBTPL_PRINT "Hello" + + RETURN diff --git a/harbour/extras/template/tests/test.prg b/harbour/extras/template/tests/test.prg new file mode 100644 index 0000000000..21ba91a3bc --- /dev/null +++ b/harbour/extras/template/tests/test.prg @@ -0,0 +1,14 @@ +/* + * $Id$ + */ + +#require "hbtpl" +#require "hbtest" + +PROCEDURE Main() + + HBTEST hbtpl_MyPublicFunction() IS "It works" + HBTEST hbtpl_MyPublicFunction_In_C() IS "It works from C" + HBTEST HBTPL_MYCONSTANT IS 100 + + RETURN