2003-09-10 21:37 UTC+0200 Przemyslaw Czerpak <druzus@polbox.com>

* harbour/harbour.spec
    + new spec file. It creates four binary RPMs with shared and
      static libs core harbour compiler and tools and with Ron's PP
      which allow to run xBase files as scripts on *nix platform
      and new tool hbcmp, hbcc, hblnk, hbmk.
      For details see README.RPM
      Please remember that PP has poor GPL license. It is noticed in RPM
      headers.

  + harbour/hbgtmk.sh
    + simple script which connect to SourceForge CVS takes sources and
      build RPMs from them.

  + harbour/make_rpm.sh
    + script for checking dependences and making RPMs

  + harbour/make_tgz.sh
    + script for making binary package for this Linux distro which don't
      support RPM

  + harbour/bin/hb-mkslib.sh
    + script for building shared libs from static ones and/or object files

  + harbour/bin/pack_src.sh
    + script for packing harbour sources

  * harbour/Makefile
  * harbour/source/compiler/harbour.c
  * harbour/source/common/hbver.c
  * harbour/source/vm/cmdarg.c
  * harbour/source/vm/fm.c
  * harbour/source/vm/hvm.c
    * changes for some new futures in hb{cmp,lnk,mk} tools

  * harbour/contrib/libct/datetime.prg
    - redundant STOD removed (this function is part of RTL)

  * harbour/contrib/dot/pp.prg
  * harbour/contrib/dot/pp.txt
  * harbour/contrib/dot/pp_harb.ch
  * harbour/contrib/dot/rp_dot.ch
  * harbour/contrib/dot/rp_run.ch
    * upadting for runing xBase files as scripts.

All this changes (except Ron's PP) are my work borrowed from xHarbour.
This commit is contained in:
Przemyslaw Czerpak
2003-09-10 19:40:57 +00:00
parent 4d93afd6b2
commit e325d5c09a
18 changed files with 4409 additions and 3024 deletions

View File

@@ -9,7 +9,7 @@ DIRS=\
include \
source \
utils \
tests \
# tests \
# samples \
include $(ROOT)config/dir.cf

80
harbour/bin/hb-mkslib.sh Normal file
View File

@@ -0,0 +1,80 @@
#!/bin/sh
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# simple script to build shared libraries from static ones and
# object files
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
if [ $# -lt 2 ]
then
echo "usage: `basename $0` <target[.so]> src1.a .. srcN.a [obj1.o .. objN.o]"
exit 1
fi
OTMPDIR="/tmp/hb-mkslib-$$"
HB_SO_LIB="$1"
shift
case "${HB_SO_LIB}" in
*.so)
;;
*)
HB_SO_LIB="${HB_SO_LIB}.so"
;;
esac
dir=`pwd`
cleanup()
{
rm -fR "${OTMPDIR}"
}
trap cleanup EXIT &>/dev/null
rm -fR "${OTMPDIR}"
mkdir -p "${OTMPDIR}"
cd "${OTMPDIR}"
for f in $*
do
if [ ! -r "${dir}/${f}" ]
then
echo "cannot read file: ${f}"
exit 1
fi
case "${f}" in
*.o)
cp "${dir}/${f}" "${OTMPDIR}" || exit 1
;;
*.a)
d="${f%.a}"
d="${f##*/}"
mkdir $d
cd $d
ar -x "${dir}/${f}" || exit 1
cd ..
;;
*)
echo "unrecognized file: ${f}"
exit 1
;;
esac
done
OBJLST=`find . -name \*.o`
cd "${dir}"
rm -f "${HB_SO_LIB}"
cd "${OTMPDIR}"
base=`basename "${HB_SO_LIB}"`
gcc -shared -o "${base}" $OBJLST && \
cd "${dir}" && \
mv -f "${OTMPDIR}/${base}" "${HB_SO_LIB}"
stat="$?"
cleanup
exit "${stat}"

225
harbour/bin/pack_src.sh Normal file
View File

@@ -0,0 +1,225 @@
#!/bin/sh
#
# $Id$
#
# This script requires "TAR" utilities for compression.
hb_ver="0.42.0"
hb_archbin="tar"
hb_archopt="-cz --ignore-failed-read -f"
hb_ext=".tar.gz"
hb_filename="harbour-${hb_ver}.src${hb_ext}"
[ -f $hb_filename ] && rm -f $hb_filename
if [ ! -f bin/pack_src.sh ]; then
hb_rootdir=`dirname $0`
hb_rootdir="${hb_rootdir}/../"
hb_archopt="-C $hb_rootdir $hb_archopt"
else
hb_rootdir="."
fi
#[ -z "$TZ" ] && export TZ=PST8PDT
hb_collect_all()
{
hb_collect="echo"
# README.TXT
# ROOT
$hb_collect *.bat
$hb_collect *.sh
$hb_collect *.cmd
$hb_collect *.spec
$hb_collect [Mm]akefile*
$hb_collect Change[Ll]og*
$hb_collect COPYING TODO ERRATA
# BIN
$hb_collect bin/*.bat
$hb_collect bin/*.sh
# CONFIG
$hb_collect config/*.cf
$hb_collect config/bsd/*.cf
$hb_collect config/dos/*.cf
$hb_collect config/linux/*.cf
$hb_collect config/os2/*.cf
$hb_collect config/w32/*.cf
# DOC
$hb_collect doc/*.txt
$hb_collect doc/en/*.txt
$hb_collect doc/es/*.txt
# INCLUDE
$hb_collect include/Makefile
$hb_collect include/*.[ch]
$hb_collect include/*.api
$hb_collect include/*.ch
# SOURCE\COMMON
$hb_collect source/common/Makefile
$hb_collect source/common/*.[ch]
# SOURCE
$hb_collect source/Makefile
# SOURCE\COMPILER
$hb_collect source/compiler/Makefile
$hb_collect source/compiler/*.[cyl]
$hb_collect source/compiler/*.simple
$hb_collect source/compiler/*.sl[xy]
# SOURCE\DEBUG
$hb_collect source/debug/Makefile
$hb_collect source/debug/*.prg
# SOURCE\LANG
$hb_collect source/lang/Makefile
$hb_collect source/lang/*.[ch]
# SOURCE\CODEPAGE
$hb_collect source/codepage/Makefile
$hb_collect source/codepage/*.[ch]
# SOURCE\MACRO
$hb_collect source/macro/Makefile
$hb_collect source/macro/*.[cyl]
$hb_collect source/macro/*.slx
# SOURCE\PP
$hb_collect source/pp/Makefile
$hb_collect source/pp/*.[ch]
# SOURCE\RDD
$hb_collect source/rdd/Makefile
$hb_collect source/rdd/*.[ch]
$hb_collect source/rdd/*.prg
# SOURCE\RDD\DBFCDX
$hb_collect source/rdd/dbfcdx/Makefile
$hb_collect source/rdd/dbfcdx/*.[ch]
$hb_collect source/rdd/dbfcdx/*.prg
# SOURCE\RDD\DBFNTX
$hb_collect source/rdd/dbfntx/Makefile
$hb_collect source/rdd/dbfntx/*.[ch]
$hb_collect source/rdd/dbfntx/*.prg
# SOURCE\RDD\NULSYS
$hb_collect source/rdd/nulsys/Makefile
$hb_collect source/rdd/nulsys/*.prg
# SOURCE\RTL
$hb_collect source/rtl/Makefile
$hb_collect source/rtl/*.[ch]
$hb_collect source/rtl/*.prg
# SOURCE\RTL\GT_TPL
$hb_collect source/rtl/gt_tpl/Makefile
$hb_collect source/rtl/gt_tpl/*.[ch]
# SOURCE\RTL\GTNUL
$hb_collect source/rtl/gtnul/Makefile*
$hb_collect source/rtl/gtnul/*.[ch]
# SOURCE\RTL\GTCGI
$hb_collect source/rtl/gtcgi/Makefile
$hb_collect source/rtl/gtcgi/*.[ch]
# SOURCE\RTL\GTCRS
$hb_collect source/rtl/gtcrs/Makefile
$hb_collect source/rtl/gtcrs/*.[ch]
$hb_collect source/rtl/gtcrs/*.def
# SOURCE\RTL\GTDOS
$hb_collect source/rtl/gtdos/Makefile
$hb_collect source/rtl/gtdos/*.[ch]
# SOURCE\RTL\GTOS2
$hb_collect source/rtl/gtos2/Makefile
$hb_collect source/rtl/gtos2/*.[ch]
$hb_collect source/rtl/gtos2/*.gcc
# SOURCE\RTL\GTPCA
$hb_collect source/rtl/gtpca/Makefile
$hb_collect source/rtl/gtpca/*.[ch]
# SOURCE\RTL\GTSLN
$hb_collect source/rtl/gtsln/Makefile
$hb_collect source/rtl/gtsln/*.[ch]
# SOURCE\RTL\GTSTD
$hb_collect source/rtl/gtstd/Makefile
$hb_collect source/rtl/gtstd/*.[ch]
# SOURCE\RTL\GTWIN
$hb_collect source/rtl/gtwin/Makefile
$hb_collect source/rtl/gtwin/*.[ch]
# SOURCE\VM
$hb_collect source/vm/Makefile
$hb_collect source/vm/*.[ch]
$hb_collect source/vm/*.prg
# TESTS
$hb_collect tests/*.bat
$hb_collect tests/*.ch
$hb_collect tests/*.dbf
$hb_collect tests/*.fpt
$hb_collect tests/*.prg
$hb_collect tests/*.txt
# UTILS
$hb_collect utils/Makefile*
# UTILS\HBDOC
$hb_collect utils/hbdoc/Makefile
$hb_collect utils/hbdoc/*.ch
$hb_collect utils/hbdoc/*.prg
# UTILS\HBEXTERN
$hb_collect utils/hbextern/Makefile
$hb_collect utils/hbextern/*.bat
$hb_collect utils/hbextern/*.prg
# UTILS\HBMAKE
$hb_collect utils/hbmake/Makefile
$hb_collect utils/hbmake/*.ch
$hb_collect utils/hbmake/*.prg
$hb_collect utils/hbmake/*.[ch]
# UTILS\HBPP
$hb_collect utils/hbpp/Makefile
$hb_collect utils/hbpp/*.[ch]
# UTILS\HBRUN
$hb_collect utils/hbrun/Makefile
$hb_collect utils/hbrun/*.prg
# UTILS\HBTEST
$hb_collect utils/hbtest/Makefile
$hb_collect utils/hbtest/*.ch
$hb_collect utils/hbtest/*.cmd
$hb_collect utils/hbtest/*.prg
# CONTRIB\LIBCT
$hb_collect contrib/libct/Makefile
$hb_collect contrib/libct/*.[ch]
$hb_collect contrib/libct/*.prg
$hb_collect contrib/libct/*.ch
# CONTRIB\DOT
$hb_collect contrib/dot/*.prg
$hb_collect contrib/dot/*.ch
$hb_collect contrib/dot/*.txt
}
hb_flst=`cd "$hb_rootdir";hb_collect_all|grep -v "[*?[]"`
$hb_archbin $hb_archopt $hb_filename $hb_flst

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
Command line switches and syntax.
PP filename[.ext] [-CCH] [-D<id>] [-D:E] [-D:M] [-D:P] [-H] [--help][-I<path>]
PP filename[.ext] [-CCH] [-D<id>] [-D:E] [-D:M] [-D:P] [-H] [--help][-I<path>]
[-P] [-R] [-STRICT] [-U[<ch-file>]]
-CCH = Generate a .cch file (compiled command header).
@@ -37,18 +37,18 @@ PP has 3 personalities which are tied tightly together.
-D:E = Show tracing information into the Expression Scanner.
-D:M = Show tracing information into the Match Engine.
-D:P = Show tracing information into the Output Generator.
-I<path> = #include file search path(s) (';' seperated).
-I<path> = #include file search path(s) (';' separated).
-STRICT = Strict Clipper compatability (clone Clipper PreProcessor bugs).
-U = Use command definitions set in <ch-file> (or none).
2. DOT prompt, which suppose to allow most of Clipper syntax. Please
2. DOT prompt, which allows most of the Clipper syntax. Please
report any syntax you expect to work, but is not supported.
It does support IF [ELSE] [ELSEIF] ENDIF in DOT environment.
Executing PP with no source filename will start the DOT prompt mode.
In this mode you can execute a single line at a time, by typing the line
In this mode you can execute a single line at a time by typing the line
and pressing the [Enter] key.
Additionally you may type:
@@ -65,10 +65,10 @@ PP has 3 personalities which are tied tightly together.
- LOCALS have scoping of locals but are implemented as privates
so you can't have a LOCAL and a PRIVATE with the same name.
b. Non declared variable are auto-created on assignment in Harbour
b. Non-declared variables are auto-created on assignment in Harbour
but NOT in Clipper (yet).
c. It does support definition and execution of prg defined
c. It does support definition and execution of prg-defined
FUNCTIONs/PROCEDUREs.
d. It does support ALL control flow structures *except* BEGIN
@@ -78,10 +78,10 @@ PP has 3 personalities which are tied tightly together.
This will create rp_dot.pp$ compilation trace file.
3. Finally, PP is a limited Clipper/Harbour/xBase Interpreter. Subject
3. Finally, PP is a limited Clipper/Harbour/xBase Interpreter. Subject
to those same few limitations it can execute most of Harbour syntax.
Executing PP followed by a source file name and the -R switch, will
"RUN" that source (it will also create the rp_run.pp$ compilation
Executing PP followed by a source file name and the -R switch will
"RUN" that source (it will also create the rp_run.pp$ compilation
trace file).
This syntax is:
@@ -95,7 +95,7 @@ PP has 3 personalities which are tied tightly together.
-D:E = Show tracing information into the Expression Scanner.
-D:M = Show tracing information into the Match Engine.
-D:P = Show tracing information into the Output Generator.
-I<path> = #include file search path(s) (';' seperated).
-I<path> = #include file search path(s) (';' separated).
-P = Generate .pp$ pre-processed output file.
-STRICT = Strict Clipper compatability (clone Clipper PreProcessor bugs).
-U = Use command definitions set in <ch-file> (or none).
@@ -107,13 +107,17 @@ PP has 3 personalities which are tied tightly together.
- LOCALS have scoping of locals but are implemented as privates
so you can't have a LOCAL and a PRIVATE with the same name.
b. Non declared variable are auto-created on assignment in Harbour
b. Non-declared variables are auto-created on assignment in Harbour
but NOT in Clipper (yet).
c. It does support definition and execution of prg defined
c. It does support definition and execution of prg-defined
FUNCTIONs/PROCEDUREs as well as parameter passing and return values.
d. It does support ALL control flow structures *except* BEGIN
SEQUENCE [BREAK] [RECOVER] END SEQUENCE.
e. The executed module is compiled with -n option (for now).
e. The compiled module is automatically using -n (No implicit startup
procedure) if the script starts with a Procedure/Function definition.
f. Built-in OLE COM Client gateway is included when PP is compiled with
Harbour and using -dWIN (harbour pp -dWIN -w ... )

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,14 @@
#command CLS ;
=> Scroll( 1, 0, MaxRow() - 1, MaxCol() ) ;
; SetPos(1,0)
=> Scroll( 2, 0, MaxRow() - 1, MaxCol() ) ;
; SetPos( 2, 0 )
#COMMAND BROWSE => Browse( 1, 0, MaxRow() - 1, MaxCol() )
#COMMAND EXIT => __QUIT()
#ifdef __HARBOUR__
#TRANSLATE _GET_( <var>, <varname>, <pic>, <valid>, <when> ) => __GET( <var>, <varname>, <pic>, <valid>, <when>, MEMVARBLOCK(<varname>) )
#else
#TRANSLATE _GET_( <var>, <varname>, <pic>, <valid>, <when> ) => __GET( MEMVARBLOCK(<varname>), <varname>, <pic>, <valid>, <when> )
#TRANSLATE _GET_( <var>, <varname>, [<pic>], [<valid>], [<when>] ) => __GET( MEMVARBLOCK(<varname>), <varname>, <pic>, <valid>, <when> )
#ifndef __HARBOUR__
#TRANSLATE __GET( <parlist,...>):Display() => __GET(<parlist>)
#TRANSLATE aAdd( GetList, __GET(<parlist,...>) ) => __oGet := __GET(<parlist>) ; aAdd( GetList, __oGet ) ; __oGet:Display()
#endif
#COMMAND IF <ifExp> => __SetIf( <ifExp> )
@@ -24,3 +23,5 @@
#COMMAND ENDCASE [<*x*>] => __SetEndCase()
#COMMAND DO <file>.prg => PP_Run( #<file> + ".prg" )
#command CD <(dir)> => DirChange( <(dir)> )

View File

@@ -1,6 +1,29 @@
/*
* xBaseScript Project source code:
* Pre-Processor / Dot prompt environment / Script Interpreter
*
* Copyright 2000-2001 Ron Pinkas <ronpinkas@profit-master.com>
* www - http://www.xBaseScript.com
*
* 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 of the License, 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*/
#ifdef __HARBOUR__
#ifdef WIN
#COMMAND Alert( <x> ) => MessageBox( 0, xToStr( <x> ), "TInterpreter for Windows", 0 )
#COMMAND Alert( <x> ) => MessageBox( 0, xToStr( <x> ), "xBaseScript for Windows", 0 )
#endif
#else
//#define __CLIPPER__
@@ -8,13 +31,13 @@
#TRANSLATE AS <type: ANYTYPE, ARRAY, CHARACTER, CODEBLOCK, DATE, LOGICAL, NUMERIC, OBJECT, STRING, USUAL> =>
#TRANSLATE AS ARRAY OF <x> =>
#TRANSLATE AS CLASS <x> =>
#TRANSLATE AS CLASS <x> := => :=
#TRANSLATE AS CLASS <!x!> =>
#TRANSLATE AS CLASS <!x!> := => :=
#COMMAND _HB_CLASS <*x*> =>
#COMMAND _HB_MEMBER <*x*> =>
#XTRANSLATE QSelf() => PP_Qself()
#XTRANSLATE AddMethod( <MethodName>, @<FunName>(), <n> ) => AddInLine( <MethodName>, {|Self,p1,p2,p3,p4,p5,p6,p7,p8,p9| PP_QSelf(Self), PP_ExecMethod( <"FunName">, p1,p2,p3,p4,p5,p6,p7,p8,p9 ) }, <n> )
#XTRANSLATE AddMethod( <MethodName>, @<!FunName!>(), <n>, <l> ) => AddInLine( <MethodName>, {|Self,p1,p2,p3,p4,p5,p6,p7,p8,p9| PP_QSelf(Self), PP_ExecMethod( <"FunName">, p1,p2,p3,p4,p5,p6,p7,p8,p9 ) }, <n>, <l> )
#TRANSLATE :: => Self:
#COMMAND MEMVAR <*x*> =>
@@ -24,10 +47,14 @@
#TRANSLATE _GET_( <var>, <varname>, [<pic>], [<valid>], [<when>] ) => __GET( MEMVARBLOCK(<varname>), <varname>, <pic>, <valid>, <when> )
#TRANSLATE __GET( <parlist,...>):Display() => __GET(<parlist>)
//#COMMAND EXTERNAL <file1> [, <fileN> ] => PP_ProcessFile( <file1> ) [; PP_ProcessFile( <fileN> ) ]
#COMMAND EXTERNAL <file1> [, <fileN> ] =>
//#COMMAND EXTERNAL <!file1!> [, <!fileN!> ] => PP_ProcessFile( <file1> ) [; PP_ProcessFile( <fileN> ) ]
#COMMAND EXTERNAL <!file1!> [, <fileN> ] =>
#COMMAND DECLARE <class> <declaraion> <*x*> =>
#COMMAND DECLARE <!class!> <declaraion> <*x*> =>
// Must precede rule for DO CASE.
#COMMAND DO <!proc!> => <proc>()
#COMMAND DO <!proc!> WITH <arg1> [, <argN>] => <proc>( <arg1>[, <argN>] )
#COMMAND IF <ifExp> => PP__IF <ifExp>
#COMMAND ELSEIF <elseifExp> => PP__ELSEIF <elseifExp>
@@ -50,21 +77,20 @@
#COMMAND WHILE <cond> => PP__WHILE <cond>
#COMMAND ENDDO [<*x*>] => PP__ENDDO
#COMMAND DO <(file)>.prg => PP_Run( #<file> + ".prg" )
#COMMAND DO <file>.prg => PP_Run( #<file> + ".prg" )
#COMMAND INIT PROCEDURE <!name!>[()] => PP_PROC_INIT <name>
#COMMAND EXIT PROCEDURE <!name!>[()] => PP_PROC_EXIT <name>
#COMMAND INIT PROCEDURE <name>[()] => PP_PROC_INIT <name>
#COMMAND EXIT PROCEDURE <name>[()] => PP_PROC_EXIT <name>
#COMMAND STATIC PROCEDURE <!name!>( <par,...> ) => PP_PROC_PRG <name> ; PP_LocalParams( { <"par"> } )
#COMMAND STATIC PROCEDURE <!name!>[()] => PP_PROC_PRG <name>
#COMMAND STATIC FUNCTION <!name!>( <par,...> ) => PP_PROC_PRG <name> ; PP_LocalParams( { <"par"> } )
#COMMAND STATIC FUNCTION <!name!>[()] => PP_PROC_PRG <name>
#COMMAND STATIC PROCEDURE <name>[()] => PP_PROC_PRG <name>
#COMMAND STATIC FUNCTION <name>[()] => PP_PROC_PRG <name>
#COMMAND STATIC PROCEDURE <name>( <par,...> ) => PP_PROC_PRG <name> ; PP_LocalParams( { <"par"> } )
#COMMAND STATIC FUNCTION <name>( <par,...> ) => PP_PROC_PRG <name> ; PP_LocalParams( { <"par"> } )
#COMMAND PROCEDURE <name>[()] => PP_PROC <name>
#COMMAND FUNCTION <name>[()] => PP_PROC <name>
#COMMAND PROCEDURE <name>( <par,...> ) => PP_PROC <name> ; PP_LocalParams( { <"par"> } )
#COMMAND FUNCTION <name>( <par,...> ) => PP_PROC <name> ; PP_LocalParams( { <"par"> } )
#COMMAND PROCEDURE <!name!>( <par,...> ) => PP_PROC <name> ; PP_LocalParams( { <"par"> } )
#COMMAND PROCEDURE <!name!>[()] => PP_PROC <name>
#COMMAND FUNCTION <!name!>( <par,...> ) => PP_PROC <name> ; PP_LocalParams( { <"par"> } )
#COMMAND FUNCTION <!name!>[()] => PP_PROC <name>
#COMMAND RETURN [<retExp>] => PP_SetReturn( <retExp> )

View File

@@ -316,9 +316,12 @@ Function EOY( date)
* $SEEALSO$
* $END$
*/
/* this function is allready implemented in RTL */
/*
Function StoD( cdate)
Local ofd := Set( _SET_DATEFORMAT, 'dd.mm.yyyy'), rvd
cdate := If( ValType( cdate) == 'C', cdate, DtoS( Date()))
rvd := CtoD( SubStr( cDate, 7, 2) + '.' + SubStr( cDate, 5, 2) + '.' + SubStr( cDate, 1, 4))
Set( _SET_DATEFORMAT, ofd)
Return rvd
*/

60
harbour/hbgtmk.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# This script checks you have all tools to build Harbour binaries
# installed then takes current Harbour sources from SourceForge CVS
# and build binaries RPMs at your local host
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
# ssh is not necessary for anonymous access on SourceForge
# export CVS_RSH=ssh
export CVSROOT=":pserver:anonymous@cvs.harbour-project.sourceforge.net:/cvsroot/harbour"
export PROJECT=harbour
test_reqrpm()
{
rpm -q "$1" &> /dev/null
}
TOINST_LST=""
for i in cvs gcc binutils bash bison ncurses ncurses-devel slang-devel gpm-devel
do
test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i"
done
_cvs_RSH="${CVS_RSH}"
[ -n "${_cvs_RSH}" ] || _cvs_RSH="rsh"
if ! which ${_cvs_RSH} &>/dev/null
then
if [ "${_cvs_RSH}" = "ssh" ]
then
TOINST_LST="${TOINST_LST} [open]ssh-clients"
else
TOINST_LST="${TOINST_LST} ${_cvs_RSH}"
fi
fi
if [ -z "${TOINST_LST}" ] || [ "$1" = "--force" ]
then
cd
mkdir -p CVS
cd CVS
if cvs -z3 co "${PROJECT}"; then
cd "${PROJECT}"
./make_rpm.sh "$*"
fi
else
echo "If you want to build Harbour compilers"
echo "you have to install the folowing RPM files:"
echo "${TOINST_LST}"
echo ""
echo "If you want to force installation run this script with --force paramter:"
echo "$0 --force"
fi

View File

@@ -101,4 +101,7 @@ else
make $*
if [ "$*" = "clean" ]; then
find . -type d -name "$HB_ARCHITECTURE" | xargs rmdir 2> /dev/null
fi
fi

60
harbour/make_rpm.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# simple script to build RPMs from Harbour sources
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
test_reqrpm()
{
rpm -q "$1" &> /dev/null
}
TOINST_LST=""
for i in gcc binutils bash bison ncurses ncurses-devel slang-devel gpm-devel
do
test_reqrpm "$i" || TOINST_LST="${TOINST_LST} $i"
done
if [ -z "${TOINST_LST}" ] || [ "$1" = "--force" ]
then
. ./bin/pack_src.sh
stat="$?"
if [ -z "${hb_filename}" ]
then
echo "The script ./bin/pack_src.sh doesn't set archive name to \${hb_filename}"
exit 1
elif [ "${stat}" != 0 ]
then
echo "Error during packing the sources in ./bin/pack_src.sh"
exit 1
elif [ -f ${hb_filename} ]
then
if [ `id -u` != 0 ] && [ ! -f ${HOME}/.rpmmacros ]
then
RPMDIR="${HOME}/RPM"
mkdir -p ${RPMDIR}/SOURCES ${RPMDIR}/RPMS ${RPMDIR}/SRPMS \
${RPMDIR}/BUILD ${RPMDIR}/SPECS
echo "%_topdir ${RPMDIR}" > ${HOME}/.rpmmacros
fi
if which rpmbuild &>/dev/null
then
rpmbuild -ta ${hb_filename} --rmsource
else
rpm -ta ${hb_filename} --rmsource
fi
else
echo "Cannot find archive file: ${hb_filename}"
exit 1
fi
else
echo "If you want to build Harbour compiler"
echo "you have to install the folowing RPM files:"
echo "${TOINST_LST}"
exit 1
fi

406
harbour/make_tgz.sh Normal file
View File

@@ -0,0 +1,406 @@
#!/bin/sh
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@polbox.com>
# simple script to build binaries .tgz from Harbour sources
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
name="harbour"
hb_ver="0.42.0"
hb_lnkso="yes"
hb_pref="hb"
hb_libs="vm pp rtl rdd dbfdbt dbffpt dbfcdx dbfntx macro common lang codepage gtnul gtcrs gtsln gtcgi gtstd gtpca odbc ct debug profiler"
export C_USR="-DHB_FM_STATISTICS_OFF -O3"
if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi
if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi
if [ -z "$HB_GPM_MOUSE" ]; then export HB_GPM_MOUSE=yes; fi
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=gtcrs; fi
if [ -z "$HB_MULTI_GT" ]; then export HB_MULTI_GT=no; fi
if [ -z "$HB_MT" ]; then export HB_MT=no; fi
export HB_BIN_INSTALL="/usr/bin"
export HB_INC_INSTALL="/usr/include/${name}"
export HB_LIB_INSTALL="/usr/lib/${name}"
# buid
umask 022
make clean
make
pushd contrib/libct
make clean
make
popd
# install
if [ -z "$TMPDIR" ]; then TMPDIR="/tmp"; fi
HB_INST_PREF="$TMPDIR/$name.bin.$USER.$$"
rm -fR "${HB_INST_PREF}"
_DEFAULT_BIN_DIR=$HB_BIN_INSTALL
_DEFAULT_INC_DIR=$HB_INC_INSTALL
_DEFAULT_LIB_DIR=$HB_LIB_INSTALL
export HB_BIN_INSTALL="$HB_INST_PREF/$HB_BIN_INSTALL"
export HB_INC_INSTALL="$HB_INST_PREF/$HB_INC_INSTALL"
export HB_LIB_INSTALL="$HB_INST_PREF/$HB_LIB_INSTALL"
mkdir -p $HB_BIN_INSTALL
mkdir -p $HB_INC_INSTALL
mkdir -p $HB_LIB_INSTALL
make -i install
pushd contrib/libct
make -i install
popd
# build fm lib with memory statistic
pushd source/vm
TMP_C_USR=$C_USR
C_USR=${C_USR//-DHB_FM_STATISTICS_OFF/-DHB_PARANOID_MEM_CHECK}
rm -f fm.o
make fm.o
ar -r $HB_LIB_INSTALL/libfm.a fm.o
rm -f fm.o
make fm.o 'HB_LIBCOMP_MT=YES'
ar -r $HB_LIB_INSTALL/libfmmt.a fm.o
rm -f fm.o
C_USR=$TMP_C_USR
popd
# Keep the size of the binaries to a minimim.
strip $HB_BIN_INSTALL/*
# Keep the size of the libraries to a minimim.
strip --strip-debug $HB_LIB_INSTALL/*
install -m755 bin/hb-mkslib.sh $HB_BIN_INSTALL/hb-mkslib
pushd $HB_LIB_INSTALL
LIBS=""
LIBSMT=""
for l in ${hb_libs}
do
case $l in
debug|profiler) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]
then
lm="lib${l}mt.a"
else
lm="${ls}"
fi
if [ "${HB_MULTI_GT}" = "yes" ] || \
[ "${l#gt}" = "${l}" ] || \
[ "${l}" == "${HB_GT_LIB}" ]
then
if [ -f $ls ]
then
LIBS="$LIBS $ls"
fi
if [ -f $lm ]
then
LIBSMT="$LIBSMT $lm"
fi
fi
;;
esac
done
$HB_BIN_INSTALL/hb-mkslib lib${name}-${hb_ver}.so $LIBS
[ $HB_MT != "MT" ] || $HB_BIN_INSTALL/hb-mkslib lib${name}mt-${hb_ver}.so $LIBSMT
for l in lib${name}-${hb_ver}.so lib${name}mt-${hb_ver}.so
do
if [ -f $l ]
then
ll=${l%-${hb_ver}.so}.so
ln -s $l $ll && ln -s ${name}/$l $HB_INST_PREF/usr/lib/$ll
fi
done
#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
popd
# Add a harbour compiler wrapper.
cat > $HB_BIN_INSTALL/${hb_pref}-build <<EOF
#!/bin/bash
if [ \$# == 0 ]; then
echo "syntax: \$0 [<options,...>] <file>[.prg|.o]
\"${hb_pref}cc\", \"${hb_pref}cmp\", \"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-o<outputfilename> # output file name
\"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-static # link with static ${name} libs
-fullstatic # link with all static libs
-shared # link with shared libs (default)
-mt # link with multi-thread libs
-gt<hbgt> # link with <hbgt> GT driver, can be repeated to
# link with more GTs. The first one will be
# the default at runtime
-fmstat # link with the memory statistics lib
-nofmstat # do not link with the memory statistics lib (default)
-main=<main_func> # set the name of main program function/procedure.
# if not set then 'MAIN' is used or if it doesn't
# exist the name of first public function/procedure
# in first linked object module (link)
"
exit 1
elif [ "\$*" == "mk-links" ]; then
DIR="\${0%/*}"
NAME="\${0##*/}"
if [ "\${DIR}" != "\${NAME}" ]; then
for n in ${hb_pref}cc ${hb_pref}cmp ${hb_pref}mk ${hb_pref}lnk gharbour harbour-link; do
ln -sf "\${NAME}" "\${DIR}/\${n}"
done
fi
exit
fi
## default parameters
HB_STATIC="no"
HB_MT=""
HB_GT="${HB_GT_LIB#gt}"
HB_MG="${HB_MULTI_GT}"
HB_GT_REQ=""
HB_FM_REQ=""
HB_MAIN_FUNC=""
_TMP_FILE_="/tmp/hb-build-\$USER-\$\$.c"
## parse params
P=( "\$@" ); n=0; DIROUT="."; FILEOUT=""
while [ \$n -lt \${#P[@]} ]; do
v=\${P[\$n]}; p=""
case "\$v" in
-o*)
d="\${v#-o}"; p="\${v}"
if [ -d "\${d}" ]; then
DIROUT="\${d%/}"
elif [ -d "\${d%/*}" ]; then
DIROUT="\${d%/*}"; FILEOUT="\${d##*/}"; p="-o\${d%.*}"
elif [ -n "\${d}" ]; then
FILEOUT="\${d}"; p="-o\${d%.*}"
fi ;;
-static) HB_STATIC="yes" ;;
-fullstatic) HB_STATIC="full" ;;
-shared) HB_STATIC="no" ;;
-mt) HB_MT="MT" ;;
-gt*) HB_GT_REQ="\${HB_GT_REQ} \${v#-gt}" ;;
-fmstat) HB_FM_REQ="STAT" ;;
-nofmstat) HB_FM_REQ="NOSTAT" ;;
-main=*) HB_MAIN_FUNC="\${v#*=}" ;;
-*) p="\${v}" ;;
*) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;;
esac
[ -n "\$p" ] && PP[\$n]="\$p"
n=\$[\$n + 1]
done
P=( "\${PP[@]}" )
case "\${HB_MT}" in
[Mm][Tt]|[Yy][Ee][Ss]|1) HB_MT="MT";;
*) HB_MT="";;
esac
SYSTEM_LIBS="-lm -lncurses -lslang -lgpm"
# use pthread system library for MT programs
if [ "\${HB_MT}" = "MT" ]; then
SYSTEM_LIBS="-lpthread \${SYSTEM_LIBS}"
fi
HB_GT_STAT=""
[ -z "\${HB_GT_REQ}" ] && HB_GT_REQ="\${HB_GT}"
if [ "\${HB_MG}" != "yes" ]; then
[ "\${HB_STATIC}" = "yes" ] && HB_GT_STAT=\`echo \${HB_GT_REQ}|tr A-Z a-z\`
HB_GT_REQ=""
else
HB_GT_REQ=\`echo \${HB_GT_REQ}|tr a-z A-Z\`
fi
HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr a-z A-Z\`
# set environment variables
export HB_ARCHITECTURE="${HB_ARCHITECTURE}"
export HB_COMPILER="${HB_COMPILER}"
[ -z "\${HB_BIN_INSTALL}" ] && export HB_BIN_INSTALL="${_DEFAULT_BIN_DIR}"
[ -z "\${HB_INC_INSTALL}" ] && export HB_INC_INSTALL="${_DEFAULT_INC_DIR}"
[ -z "\${HB_LIB_INSTALL}" ] && export HB_LIB_INSTALL="${_DEFAULT_LIB_DIR}"
# be sure that ${name} binaries are in your path
export PATH="\${HB_BIN_INSTALL}:\${PATH}"
HB_PATHS="-I\${HB_INC_INSTALL}"
GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}"
LINK_OPT=""
if [ "\${HB_STATIC}" = "full" ]; then
LINK_OPT="\${LINK_OPT} -static"
HB_STATIC="yes"
fi
HARBOUR_LIBS=""
if [ "\${HB_STATIC}" = "yes" ]; then
libs="${hb_libs}"
else
l="${name}"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.so" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/lib\${l}.so" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
libs="debug profiler"
fi
for l in \${libs}
do
if [ "\${HB_MG}" = "yes" ] || [ "\${l#gt}" = "\${l}" ] || [ "\${l}" == "gt\${HB_GT_STAT}" ]; then
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
done
HARBOUR_LIBS="-Wl,--start-group \${HARBOUR_LIBS} -Wl,--end-group"
l="fm"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
if [ "\${HB_STATIC}" = "yes" ] && [ "\${HB_FM_REQ}" = "STAT" ]; then
HARBOUR_LIBS="-l\${l} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
fi
FOUTC="\${DIROUT}/\${FILEOUT%.*}.c"
FOUTO="\${DIROUT}/\${FILEOUT%.*}.o"
FOUTE="\${DIROUT}/\${FILEOUT%.[Pp][Rr][Gg]}"
FOUTE="\${FOUTE%.[oc]}"
hb_cc()
{
harbour "\$@" \${HB_PATHS} && [ -f "\${FOUTC}" ]
}
hb_link()
{
if [ -n "\${HB_MAIN_FUNC}" ]; then
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
elif [ -f "\${FOUTO}" ]; then
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
fi
if [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_FM_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
hb_lnk_request > \${_TMP_FILE_} && \\
gcc "\$@" "\${_TMP_FILE_}" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
else
gcc "\$@" \${LINK_OPT} \${GCC_PATHS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}"
fi
}
hb_cmp()
{
hb_cc "\$@" && \\
gcc -g -c "\${FOUTC}" -o "\${FOUTO}" \${GCC_PATHS} && \\
rm -f "\${FOUTC}"
}
hb_lnk_request()
{
echo "#include \\"hbapi.h\\""
if [ "\${HB_STATIC}" = "yes" ] || [ -n "\${HB_FM_REQ}" ]; then
for gt in \${HB_GT_REQ}; do
echo "extern HB_FUNC( HB_GT_\${gt} );"
done
if [ -n "\${HB_FM_REQ}" ]; then
echo "extern HB_FUNC( HB_FM_\${HB_FM_REQ} );"
fi
echo "void hb_lnk_ForceLink_build( void )"
echo "{"
for gt in \${HB_GT_REQ}; do
echo " HB_FUNCNAME( HB_GT_\${gt} )();"
done
if [ -n "\${HB_FM_REQ}" ]; then
echo " HB_FUNCNAME( HB_FM_\${HB_FM_REQ} )();"
fi
echo "}"
fi
gt="\${HB_GT_REQ%% *}"
if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
echo "#include \\"hbinit.h\\""
echo "extern char * s_defaultGT;"
echo "extern char * s_pszLinkedMain;"
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
if [ -n "\$gt" ]; then
echo " s_defaultGT = \\"\$gt\\";"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
echo " s_pszLinkedMain = \\"\${HB_MAIN_FUNC}\\";"
fi
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"
fi
}
hb_lnk_main()
{
(nm \$1 -g -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* T HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
# (nm \$1 -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* [Tt] HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
}
hb_cleanup()
{
rm -f "\${_TMP_FILE_}"
}
trap hb_cleanup EXIT &>/dev/null
## get basename
HB="\${0##*/}"
case "\${HB}" in
*cc)
hb_cc "\${P[@]}"
;;
*cmp|gharbour)
hb_cmp "\${P[@]}"
;;
*lnk|harbour-link)
hb_link "\${P[@]}"
;;
*mk)
hb_cmp "\${P[@]}" && \\
hb_link "\${FOUTO}" && \\
strip "\${FOUTE}" && \\
rm -f "\${FOUTO}"
;;
esac
EOF
chmod 755 $HB_BIN_INSTALL/${hb_pref}-build
$HB_BIN_INSTALL/${hb_pref}-build mk-links
mkdir -p $HB_INST_PREF/etc/harbour
install -m644 source/rtl/gtcrs/hb-charmap.def $HB_INST_PREF/etc/harbour/hb-charmap.def
cat > $HB_INST_PREF/etc/harbour.cfg <<EOF
CC=gcc
CFLAGS=-c -I$_DEFAULT_INC_DIR -O2
VERBOSE=YES
DELTMP=YES
EOF
# Create PP
pushd contrib/dot
$HB_BIN_INSTALL/${hb_pref}mk pp -n -w -D_DEFAULT_INC_DIR=\"${_DEFAULT_INC_DIR}\"
install -m755 -s pp $HB_BIN_INSTALL/pp
ln -s pp $HB_BIN_INSTALL/pprun
install -m644 rp_dot.ch $HB_INC_INSTALL/
rm -f pp
popd
# check if we should rebuild tools with shared libs
if [ "${hb_lnkso}" = yes ]
then
export L_USR="-L${HB_LIB_INSTALL} -l${name} -lncurses -lslang -lgpm"
for utl in hbmake hbrun hbpp hbdoc hbtest
do
pushd utils/${utl}
rm -fR "./${HB_ARCHITECTURE}"
make install
strip ${HB_BIN_INSTALL}/${utl}
popd
done
fi
tar -czvf ${name}-${hb_ver}.bin.tar.gz --owner=root --group=root -C "${HB_INST_PREF}" .
rm -fR "${HB_INST_PREF}"

View File

@@ -76,6 +76,7 @@
#include "hbapi.h"
#include "hbver.h"
#include "hbmemory.ch"
#if defined(HB_OS_WIN_32)
@@ -611,11 +612,14 @@ void hb_verBuildInfo( void )
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "Memory tracing and statistics: ", 0 );
hb_conOutErr( hb_xquery( HB_MEM_USEDMAX ) != 0 ? "On" : "Off", 0 );
/*
#if defined( HB_FM_STATISTICS )
hb_conOutErr( "On", 0 );
#else
hb_conOutErr( "Off", 0 );
#endif
*/
hb_conOutErr( hb_conNewLine(), 0 );
{

View File

@@ -312,6 +312,12 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMFREE, NULL, NULL );
}
ULONG hb_xquery( USHORT uiMode )
{
HB_SYMBOL_UNUSED( uiMode );
return 0;
}
void hb_conOutErr( char * pStr, ULONG ulLen )
{
HB_SYMBOL_UNUSED( ulLen );

View File

@@ -303,7 +303,8 @@ void hb_cmdargProcessVM( void )
{
char buffer[ 128 ];
sprintf( buffer, "DS avail=%luKB OS avail=%luKB EMM avail=%luKB", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ) );
/* sprintf( buffer, "DS avail=%luKB OS avail=%luKB EMM avail=%luKB", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ) ); */
sprintf( buffer, "DS avail=%luKB OS avail=%luKB EMM avail=%luKB MemStat:%s", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ), hb_xquery( HB_MEM_USEDMAX ) ? "On" : "Off" );
hb_conOutErr( buffer, 0 );
hb_conOutErr( hb_conNewLine(), 0 );
}

View File

@@ -734,3 +734,8 @@ HB_FUNC( MEMORY )
hb_retnl( hb_xquery( hb_parni( 1 ) ) );
}
#ifdef HB_FM_STATISTICS
HB_FUNC( HB_FM_STAT ) {};
#else
HB_FUNC( HB_FM_NOSTAT ) {};
#endif

View File

@@ -204,6 +204,10 @@ BOOL hb_bTracePrgCalls = FALSE; /* prg tracing is off */
ULONG hb_ulOpcodesCalls[ HB_P_LAST_PCODE ]; /* array to profile opcodes calls */
ULONG hb_ulOpcodesTime[ HB_P_LAST_PCODE ]; /* array to profile opcodes consumed time */
#ifdef HARBOUR_START_PROCEDURE
char *s_pszLinkedMain = NULL; /* name of starup function set by linker */
#endif
/* virtual machine state */
HB_SYMB hb_symEval = { "__EVAL", HB_FS_PUBLIC, hb_vmDoBlock, NULL }; /* symbol to evaluate codeblocks */
@@ -339,7 +343,20 @@ void HB_EXPORT hb_vmInit( BOOL bStartMainProc )
#ifdef HARBOUR_START_PROCEDURE
else
{
pDynSym = hb_dynsymFind( HARBOUR_START_PROCEDURE );
/* if first char is '@' then start procedure were set by
programmer explicitly and should have the highest priority
in other case it's the name of first public function in
first linked moudule which is used if there is no
HARBOUR_START_PROCEDURE in code */
if( s_pszLinkedMain && *s_pszLinkedMain == '@' )
pDynSym = hb_dynsymFind( s_pszLinkedMain + 1 );
else
{
pDynSym = hb_dynsymFind( HARBOUR_START_PROCEDURE );
if( ! ( pDynSym && pDynSym->pSymbol->pFunPtr ) && s_pszLinkedMain )
pDynSym = hb_dynsymFind( s_pszLinkedMain );
}
if( pDynSym && pDynSym->pSymbol->pFunPtr )
s_pSymStart = pDynSym->pSymbol;