воскресенье, 15 марта 2009 г.

Интересное место:
http://mig2soft.com/?m=20081207
статья:
Packages needed to cleanly build Harbour:
(Tested with Ubuntu 7.04 and 8.04)
- очень помогла до конца скомпилировать Харбор.
Вообще, этот продукт очень популярен в испано-говорящем мире. У нас Клиппер вытеснен другими ворованными поделками типа Делфи, ВизуалСтудио и другими. Но ведь Д-Бэйс конструировался именно как язык и среда работы с базами данных! А всякие адаптированные Паскали и Си с неважным количеством "+" - это рекламированная дорогая шелуха.

Так, что: огромное пионерское СПАСИБО авторам. Типа, Muchas Gracias Синьоры и Синьориты!

понедельник, 9 марта 2009 г.

В предыдущем посте сказано, как собирать Харобор из исходников через SVN. Но, как всегда в Линуксе - есть альтернативный путь - просто скачать, распаковать и запустить скрипт сборки.

распаковать в /usr/src/harbour

cd /usr/src/harbour

make_gnu.sh all
make_gnu.sh install

вот, как-то так...

Не забываем, что нужны хидеры Иксов!!!

apt-get install xorg-dev

Мне еще пришлось создать пару папочек

sudo mkdir /usr/local/lib/harbour
sudo mkdir /usr/local/include/harbour

только после этого шаманства инсталляция закончилась

Итак, будем считать, что Харбор собран и установлен. самая простая проверка - запустить сам компилятор:
--------------------------------------------------
dimao@dimao-desktop:~$ harbour
Harbour 1.1.0dev (Rev. 10272)
Copyright (c) 1999-2009, http://www.harbour-project.org/

Syntax: harbour [options]

Options: -a automatic memvar declaration
-b debug info
-build display detailed version info
-credits display credits
-d[=] #define
-es[] set exit severity
-fn[:[l|u]|-] set filename casing (l=lower u=upper)
-fd[:[l|u]|-] set directory casing (l=lower u=upper)
-fp[:] set path separator
-fs[-] turn filename space trimming on or off (default)
-g output type generated is (see below)
-gc[] output type: C source (.c) (default)
: 0=compact (default) 1=normal 2=verbose
3=generate real C code
-go output type: Platform dependant object module
-gh output type: Harbour Portable Object (.hrb)
-i #include file search path
-j[] generate i18n gettext file (.pot)
-k compilation mode (type -k? for more data)
-l suppress line number information
-m compile module only
-n[] no implicit starting procedure (default)
: 0=no implicit starting procedure
1=no starting procedure at all
-o object file drive and/or path
-p[] generate pre-processed output (.ppo) file
-p+ generate pre-processor trace (.ppt) file
-q quiet
-q0 quiet and don't display program header
-r: set maximum number of preprocessor iterations
-s syntax check only
-u[] use command def set in (or none)
-undef: #undef
-v variables are assumed M->
-w[] set warning level number (0..3, default 1)
-x[] set symbol init function name prefix (for .c only)
-z suppress shortcutting (.and. & .or.)
@ compile list of modules in
dimao@dimao-desktop:~$
------------------------------------------
ну вот и все - можно компилировать программы. На сайте проекта можно найти простенький "ХауТу".

-------------------------------------------
http://www.harbour-project.org/samples/HowToBuildOnLinux.html
-------------------------------------------

How to Build on Linux


In the last phase of install process if bash shell is available in the system then few bash scripts are created to make compiling and linking with Harbour a little easier. There are compiler and linker wrappers called "hbcc", "hbcmp", "hblnk" and "hbmk".

"hbcc" is a wrapper to the C compiler only. It sets all flags and paths necessary to compile .c files which include Harbour header files. The result of its work is an object file.

Use "hbcmp" exactly as you would use the harbour compiler itself. The main difference with hbcmp is that it results in an object file, not a C file that needs compiling down to an object. hbcmp also ensures that the harbour include directory is seen by the harbour compiler.

"hblnk" simply takes a list of object files and links them together with the harbour virtual machine and run-time library to produce an executable. The executable will be given the basename of the first object file if not directly set by the "-o" command line switch.

"hbmk" tries to produce an executable from your .prg file. It's a simple equivalent of cl.bat from the CA-Clipper distribution.

All these scripts accept command line switches:
-o # output file name
-static # link with static Harbour libs
-fullstatic # link with all static libs
-shared # link with shared libs (default)
-mt # link with multi-thread libs
-gt # link with GT driver, can be repeated to
# link with more GTs. The first one will be
# the default at runtime
-xbgtk # link with xbgtk library (xBase GTK+ interface)
-hwgui # link with HWGUI library (GTK+ interface)
-l # link with library
-L # additional path to search for libraries
-fmstat # link with the memory statistics lib
-nofmstat # do not link with the memory statistics lib (default)
-[no]strip # strip (no strip) binaries
-main= # 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)

Link options work only with "hblnk" and "hbmk" and have no effect in "hbcc" and "hbcmp". Other options are passed to Harbour/C compiler/linker.
An example compile/link session looks like:
---------------------------------------------------------------------------------------
druzus@uran:~/tmp$ cat foo.prg
function main()
? "Hello, World!"
return nil

druzus@uran:~/tmp$ hbcmp foo
Harbour Compiler Alpha build 46.2 (Flex)
Copyright 1999-2006, http://www.harbour-project.org/
Compiling 'foo.prg'...
Lines 5, Functions/Procedures 2
Generating C source output to 'foo.c'... Done.

druzus@uran:~/tmp$ hblnk foo.o
druzus@uran:~/tmp$ strip foo
druzus@uran:~/tmp$ ls -l foo
-rwxrwxr-x 1 druzus druzus 3824 maj 17 02:46 foo
---------------------------------------------------------------------------------------

or using hbmk only:
---------------------------------------------------------------------------------------
druzus@uran:~/tmp$ cat foo.prg
function main()
? "Hello, World!"
return nil

druzus@uran:~/tmp$ hbmk foo
Harbour Compiler Alpha build 46.2 (Flex)
Copyright 1999-2006, http://www.harbour-project.org/
Compiling 'foo.prg'...
Lines 5, Functions/Procedures 2
Generating C source output to 'foo.c'... Done.

druzus@uran:~/tmp$ ls -l foo
-rwxrwxr-x 1 druzus druzus 3824 maj 17 02:46 foo
---------------------------------------------------------------------------------------

You will find additional wonderful tools: /usr/bin/hbrun
You can run clipper/xbase compatible source files with it if you only put in their first line: #!/usr/bin/hbrun

For example:
----------------------------------------------------------------------
druzus@uran:~/tmp$ cat foo.prg
#!/usr/bin/hbrun
function main()
? "Hello, World!, This is a script !!! :-)"
return nil

druzus@uran:~/tmp$ chmod +x foo.prg
druzus@uran:~/tmp$ ./foo.prg

Hello, World!, This is a script !!! :-)

druzus@uran:~/tmp$

I hope you will find this information useful,
Przemyslaw Czerpak (druzus/at/priv.onet.pl)
итак: http://www.elart.it/links/harbourhowto_deb_en.php
-----------------------------------
Clipper on Linux!

Harbour Clipper

Small Debian, Ubuntu, Kubuntu howto: Dec 2008

How to install and compile Harbour on Ubuntu from SVN

Requested deb packages to compile Harbour
From terminal as root user: to get user access type sudo -i and after type the commands below:

apt-get update; apt-get install wget rcs build-essential ncurses-dev libslang2-dev tk8.3-dev libsqlxx-dev unixodbc-dev subversion

Harbour source from SVN trunk
1) - Open a terminal window gain root privileges with the: sudo -i command;
2) - Check the requested packages as specified on top of this page;
3) - Type into the terminal window:
cd /usr/src
svn co https://harbour-project.svn.sourceforge.net/svnroot/harbour-project/trunk harbour
cd /usr/src/harbour/harbour
export HB_BIN_INSTALL=/usr/bin/; export HB_LIB_INSTALL=/usr/lib/; export HB_INC_INSTALL=/usr/include/
chmod 700 make_gnu.sh
hbverfix
sh ./make_gnu.sh clean; sh ./make_gnu.sh; sh ./make_gnu.sh install
harbour -build


How to compile my first .prg?
Type or copy and paste into hello.prg the blue lines below:

function main()
do while .t.
setcolor("w/n")
clear screen
dummy:="N"
quadro(1,1,10,60)
@ 3,3 say "CIAO MONDO" color "w/r"
@ 4,3 say "Sono harbour ;-)" color "w/b"
@ 5,3 say "Vuoi terminare... ? "
@ row(), col()+1 get dummy picture "@K!"
read
if dummy=="S"
clear screen
quit
endif
@ 8,10 say "Ok non vuoi terminare"
inkey(2)
enddo
return nil

// -----------------------------
function quadro(ri,ci,rf,cf)
@ ri,ci clear to rf,cf
dispbox(ri,ci,rf,cf)
return nil

Save the file and after:
# harbour hello.prg -n -gh
a .rbh file will be created
Generating Harbour Portable Object output to 'hello.hrb'... Done.
to run it:
# hbrun hello

To really compile the prog on your Linux system with Harbour will made a simple shell script called bldlin.sh :

#!/bin/bash
# ---------------------------------------------------------------
# Template to build a final Harbour executable, using Harbour
# with the C code generation feature, then calling the proper C
# linker/compiler.
#
# Copyright 1999-2001 Viktor Szakats (viktor.szakats@syenar.hu)
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi
if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=; fi
if [ -z "$HB_BIN_INSTALL" ]; then
export HB_BIN_INSTALL=/usr/bin
fi
if [ -z "$HB_LIB_INSTALL" ]; then
export HB_LIB_INSTALL=/usr/lib/harbour
fi
if [ -z "$HB_INC_INSTALL" ]; then
export HB_INC_INSTALL=/usr/include/harbour
fi
if [ -z "$HB_ARCHITECTURE" ]; then
echo Error: HB_ARCHITECTURE is not set.
fi
if [ -z "$HB_COMPILER" ]; then
echo Error: HB_COMPILER is not set.
fi
if [ -z "$1" ] || [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then
echo
echo Usage: bldlin.sh filename
echo
echo Notes:
echo
echo " - 'filename' is the .prg filename *without* extension."
echo " - Don't forget to make a MAIN() function for you application."
echo " - This batch file assumes you are in some directory off the main"
echo " harbour directory."
echo " - Environment variables HB_ARCHITECTURE, HB_COMPILER,HB_GT_LIB"
echo " should be set. Setting HB_GT_LIB is optional."
echo " The following values are currently supported:"
echo
echo " HB_ARCHITECTURE:"
echo " - dos (HB_GT_LIB=gtdos by default)"
echo " - w32 (HB_GT_LIB=gtwin by default)"
echo " - linux (HB_GT_LIB=gtstd by default)"
echo " - os2 (HB_GT_LIB=gtos2 by default)"
echo
read
echo " HB_COMPILER:"
echo " - When HB_ARCHITECTURE=dos"
echo " - bcc16 (Borland C++ 3.x, 4.x, 5.0x, DOS 16-bit)"
echo " - djgpp (Delorie GNU C, DOS 32-bit)"
echo " - rxs32 (EMX/RSXNT/DOS GNU C, DOS 32-bit)"
echo " - watcom (Watcom C++ 9.x, 10.x, 11.x, DOS 32-bit)"
echo " - When HB_ARCHITECTURE=w32"
echo " - bcc32 (Borland C++ 4.x, 5.x, Windows 32-bit)"
echo " - gcc (Cygnus/Cygwin GNU C, Windows 32-bit)"
echo " - mingw32 (Cygnus/Mingw32 GNU C, Windows 32-bit)"
echo " - rxsnt (EMX/RSXNT/Win32 GNU C, Windows 32-bit)"
echo " - icc (IBM Visual Age C++, Windows 32-bit)"
echo " - msvc (Microsoft Visual C++, Windows 32-bit)"
echo " - When HB_ARCHITECTURE=linux"
echo " - gcc (GNU C, 32-bit)"
echo " - When HB_ARCHITECTURE=os2"
echo " - gcc (EMX GNU C, OS/2 32-bit)"
echo " - icc (IBM Visual Age C++ 3.0, OS/2 32-bit)"
echo
read
echo " HB_GT_LIB:"
echo " - gtstd (Standard streaming) (for all architectures)"
echo " - gtdos (DOS console) (for dos architecture)"
echo " - gtwin (Win32 console) (for w32 architecture)"
echo " - gtos2 (OS/2 console) (for os2 architecture)"
echo " - gtpca (PC ANSI console) (for all architectures)"
echo " - gtcrs (Curses console) (for linux, w32 architectures)"
echo " - gtsln (Slang console) (for linux, w32 architectures)"
exit
else
$HB_BIN_INSTALL/harbour $1.prg -n -i$HB_INC_INSTALL $2 $3 $HARBOURFLAGS
if [ "$HB_ARCHITECTURE" = "linux" ]; then
#if [ -z "$HB_GT_LIB" ]; then HB_GT_LIB=gtstd; fi
if [ -z "$HB_GT_LIB" ]; then HB_GT_LIB=gttrm; fi
if [ "$HB_COMPILER" = "gcc" ]; then

gcc -o$1 $1.c $CFLAGS -I$HB_INC_INSTALL -L$HB_LIB_INSTALL \
-Wl,--start-group -lhbvm -lhbrtl -lhbmacro -lhbcommon \
-lhblang -lhbcpage -lhbpp -lhbpcre -lhbzlib \
-lhbrdd -lrddntx -lrddcdx -lrddfpt -lhbsix \
-ldebug -lgttrm -lgtstd -lgtcgi -lgtpca \
-Wl,--end-group -lm

else
echo Error: HB_COMPILER value is unsupported.
fi
else
echo Error: HB_ARCHITECTURE value is unsupported.
unlink $1.c
fi
fi

After we must change the permission to the script:
# chmod 700 bldlin.sh
and we can run the script:
# ./bldlin.sh hello
and now we can run the:
# ./hello

N.B.: Linux is case sensitive, remember this, when you try to open a dbf file on a Linux filesystem.


To learn more:
To compile yours .prg you we suggest you to read the documents into the Harbour "doc" subdirectory:
"doc/howtomak.txt" and "doc/gmake.txt" and "bin/bld.sh".

воскресенье, 1 марта 2009 г.

Почему я выбрал Харбор? Много лет назад я неплохо обращался с Клиппером (начиная с Clipper 84 до 5.2) мне нравится этот язык, так как программисту не надо задумываться над многими вещами, которые естественны для других языков. Не нужно подключать тонны библиотек и выискивать информацию о них чтобы строить интерфейсы, меню, работу с базой данных, сортировку массивов и многое другое. это, без натяжек и рекламы, язык четвертого поколения.
Википедия также содержит некоторые сведения. Главное не стесняться тыкать на предлагаемые ссылки ;-)
Итак, начнем первоисточника:
- "Проект Харбор" - недавно сменился дизайн сайта, остававшийся практически неизменным с момента создания. Мне кажется разработчики слегка расслабились от гонки за первым релизом и им стало стыдно за сайт :-)
Кое-где еще остаются пережитки старого "сайта"
Вот решил вернуться к программированию. Не знаю, что получится, но попробовать хочу :-)

при первых же шагах появились проблемы - нет нормальной документации, учебников по Харбору (Harbour), а то, что есть - разрознено. Я попробую в этот блог перетащить кусочки, что нахожу в сети.

Уважаемые Авторы, я не имею целью получить какую-либо прибыль от использования ваших материалов. Если вы считаете, что вашим материалам не место на данном сайте - пишите. Р-разберемся.