From 0b77ea9f5ee3c7e6a1ce2f9630a198eae8dfcfd5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 31 Jul 1999 04:11:57 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 35 +++++++++++ harbour/include/achoice.ch | 22 +++++++ harbour/include/assert.ch | 29 +++++++++ harbour/include/box.ch | 26 ++++---- harbour/include/classes.ch | 12 ++-- harbour/include/color.ch | 17 ++++-- harbour/include/common.ch | 33 +++++++++++ harbour/include/dbedit.ch | 20 +++++++ harbour/include/dbstruct.ch | 18 ++++++ harbour/include/directry.ch | 19 ++++++ harbour/include/error.ch | 5 +- harbour/include/extend.h | 3 +- harbour/include/fileio.ch | 2 +- harbour/include/fm.api | 1 + harbour/include/getexit.ch | 19 ++++++ harbour/include/inkey.ch | 10 ++-- harbour/include/memoedit.ch | 27 +++++++++ harbour/include/rdd.api | 6 +- harbour/include/rddsys.ch | 12 ++-- harbour/include/set.ch | 5 ++ harbour/include/setcurs.ch | 15 +++-- harbour/include/simpleio.ch | 20 +++++++ harbour/include/vm.api | 40 +++++++++++++ harbour/make_tpl.sh | 19 ++++++ harbour/makefile.b16 | 3 +- harbour/makefile.b31 | 1 + harbour/makefile.b32 | 1 + harbour/makefile.b40 | 1 + harbour/makefile.vc | 3 + harbour/source/rtl/Makefile | 1 + harbour/source/rtl/extend.c | 70 +--------------------- harbour/source/rtl/fm.c | 115 ++++++++++++++++++++++++++++++++++++ 32 files changed, 489 insertions(+), 121 deletions(-) create mode 100644 harbour/include/achoice.ch create mode 100644 harbour/include/assert.ch create mode 100644 harbour/include/common.ch create mode 100644 harbour/include/dbedit.ch create mode 100644 harbour/include/dbstruct.ch create mode 100644 harbour/include/directry.ch create mode 100644 harbour/include/getexit.ch create mode 100644 harbour/include/memoedit.ch create mode 100644 harbour/include/simpleio.ch create mode 100644 harbour/include/vm.api create mode 100644 harbour/make_tpl.sh create mode 100644 harbour/source/rtl/fm.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4d6fdfeaf6..4eeca9f71c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,38 @@ +19990731-06:00 CET Victor Szel + + include/achoice.ch + include/common.ch + include/dbstruct.ch + include/directry.ch + include/memoedit.ch + include/dbedit.ch + include/assert.ch + include/getexit.ch + include/simpleio.ch + Missing Clipper compatible Harbour header files added. + * source/rtl/extend.c -> Fixed memory management stuff + moved to the new file source/rtl/fm.c + source/rtl/Makefile + makefile.* + + source/rtl/fm.c + include/fm.api + include/extend.h + _xalloc(), hb_xalloc() added for Clipper compatibility. + + include/vm.api + VM API added to provide some Clipper compatibility. + VM functions are mapped to FM calls, Heap calls + are accepted but functionality is not supported. + * include/rdd.api + include/error.ch + include/inkey.ch + include/color.ch + include/fileio.ch + include/rddsys.ch + include/box.ch + include/classes.ch + include/set.ch + Small cleanups. Missing #ifdef guards added. + + make_tpl.sh - GNU Make laucher for bash/linux/gcc. + 19990731-03:33 CET Victor Szel ! source/vm/hvm.c - Fixed some error codes. (.OR., .AND., PVALUE) diff --git a/harbour/include/achoice.ch b/harbour/include/achoice.ch new file mode 100644 index 0000000000..dc4e12d265 --- /dev/null +++ b/harbour/include/achoice.ch @@ -0,0 +1,22 @@ +/* + * $Id$ + */ + +#ifndef _ACHOICE_CH +#define _ACHOICE_CH + +/* User callback status codes */ +#define AC_IDLE 0 /* Idle */ +#define AC_HITTOP 1 /* Attempt to move above the first item */ +#define AC_HITBOTTOM 2 /* Attempt to move below the last item */ +#define AC_EXCEPT 3 /* Keystroke exception */ +#define AC_NOITEM 4 /* There's no selectable item */ + +/* User callback return codes */ +#define AC_ABORT 0 /* Abort ACHOICE() and return zero */ +#define AC_SELECT 1 /* Select current item and return it's index */ +#define AC_CONT 2 /* Continue ACHOICE() */ +#define AC_GOTO 3 /* Search first chars for the last pressed key */ +#define AC_REDRAW 4 /* Redraw ACHOICE() */ + +#endif /* _ACHOICE_CH */ diff --git a/harbour/include/assert.ch b/harbour/include/assert.ch new file mode 100644 index 0000000000..f9d138b43f --- /dev/null +++ b/harbour/include/assert.ch @@ -0,0 +1,29 @@ +/* + * $Id$ + */ + +#ifndef _ASSERT_CH +#define _ASSERT_CH + +#ifdef NDEBUG + +/* When NDEBUG is definded, ignore all ASSERT() calls */ +#command ASSERT( [, ] ) => + +#else + +#command ASSERT( [, ] ) => ; + IF ( !() ) ; + ; OUTSTD( ; + CHR(13) + CHR(10) + PROCNAME(0) + ; + "(" + LTRIM(STR(PROCLINE())) + ")" + ; + " Assertion failed: " + ; + IF( <.msg.>, , <"exp"> ) ; + ) ; + ; QUIT ; + ; ENDIF + +#endif /* NDEBUG */ + +#endif /* _ASSERT_CH */ + diff --git a/harbour/include/box.ch b/harbour/include/box.ch index e371332a11..40bdb1316f 100644 --- a/harbour/include/box.ch +++ b/harbour/include/box.ch @@ -5,22 +5,22 @@ #ifndef _BOX_CH #define _BOX_CH -// #defines for DISPBOX() +/* #defines for DISPBOX() */ -// Single-line -#define B_SINGLE ( CHR(218) + CHR(196) + CHR(191) + CHR(179) + ; - CHR(217) + CHR(196) + CHR(192) + CHR(179) ) +/* Single-line */ +#define B_SINGLE ( Chr(218) + Chr(196) + Chr(191) + Chr(179) + ; + Chr(217) + Chr(196) + Chr(192) + Chr(179) ) -// Double-line -#define B_DOUBLE ( CHR(201) + CHR(205) + CHR(187) + CHR(186) + ; - CHR(188) + CHR(205) + CHR(200) + CHR(186) ) +/* Double-line */ +#define B_DOUBLE ( Chr(201) + Chr(205) + Chr(187) + Chr(186) + ; + Chr(188) + Chr(205) + Chr(200) + Chr(186) ) -// Single-line top, double-line sides -#define B_SINGLE_DOUBLE ( CHR(214) + CHR(196) + CHR(183) + CHR(186) + ; - CHR(189) + CHR(196) + CHR(211) + CHR(186) ) +/* Single-line top, double-line sides */ +#define B_SINGLE_DOUBLE ( Chr(214) + Chr(196) + Chr(183) + Chr(186) + ; + Chr(189) + Chr(196) + Chr(211) + Chr(186) ) -// Double-line top, single-line sides -#define B_DOUBLE_SINGLE ( CHR(213) + CHR(205) + CHR(184) + CHR(179) + ; - CHR(190) + CHR(205) + CHR(212) + CHR(179) ) +/* Double-line top, single-line sides */ +#define B_DOUBLE_SINGLE ( Chr(213) + Chr(205) + Chr(184) + Chr(179) + ; + Chr(190) + Chr(205) + Chr(212) + Chr(179) ) #endif /* _BOX_CH */ diff --git a/harbour/include/classes.ch b/harbour/include/classes.ch index f5aa800bef..aaa475b29d 100644 --- a/harbour/include/classes.ch +++ b/harbour/include/classes.ch @@ -1,11 +1,6 @@ -/* - * $Id$ - */ +/* $Id$ -#ifndef _CLASSES_CH -#define _CLASSES_CH - -/* Harbour classes commands + Harbour classes commands Copyright(C) 1999 by Antonio Linares. @@ -28,6 +23,9 @@ You can contact me at: alinares@fivetech.com */ +#ifndef _CLASSES_CH +#define _CLASSES_CH + #xcommand CLASS [ ] => ; function () ;; static oClass ;; diff --git a/harbour/include/color.ch b/harbour/include/color.ch index 23dd614616..1d9307dcbf 100644 --- a/harbour/include/color.ch +++ b/harbour/include/color.ch @@ -2,10 +2,15 @@ * $Id$ */ +#ifndef _COLOR_CH +#define _COLOR_CH + /* attributes for color strings */ -#define CLR_STANDARD 0 -#define CLR_ENHANCED 1 -#define CLR_BORDER 2 -#define CLR_BACKGROUND 3 -#define CLR_UNSELECTED 4 -#define CLR_LASTCOLOR CLR_UNSELECTED +#define CLR_STANDARD 0 +#define CLR_ENHANCED 1 +#define CLR_BORDER 2 +#define CLR_BACKGROUND 3 +#define CLR_UNSELECTED 4 +#define CLR_LASTCOLOR CLR_UNSELECTED + +#endif /* _COLOR_CH */ diff --git a/harbour/include/common.ch b/harbour/include/common.ch new file mode 100644 index 0000000000..731430b255 --- /dev/null +++ b/harbour/include/common.ch @@ -0,0 +1,33 @@ +/* + * $Id$ + */ + +#ifndef _COMMON_CH +#define _COMMON_CH + +/* Friendly logical aliases */ +#define TRUE .T. +#define FALSE .F. +#define YES .T. +#define NO .F. + +/* Type checking macros */ +#translate ISNIL( ) => ( == NIL ) +#translate ISARRAY( ) => ( ValType( ) == "A" ) +#translate ISBLOCK( ) => ( ValType( ) == "B" ) +#translate ISCHAR( ) => ( ValType( ) == "C" ) +#translate ISDATE( ) => ( ValType( ) == "D" ) +#translate ISLOG( ) => ( ValType( ) == "L" ) +#translate ISMEMO( ) => ( ValType( ) == "M" ) +#translate ISNUM( ) => ( ValType( ) == "N" ) +#translate ISOBJECT( ) => ( ValType( ) == "O" ) + +/* DEFAULT and UPDATE commands */ +#xcommand DEFAULT TO [, TO ] => ; + IF == NIL ; := ; END ; + [; IF == NIL ; := ; END ] + +#command UPDATE IF TO => ; + IF ; := ; END + +#endif /* _COMMON_CH */ diff --git a/harbour/include/dbedit.ch b/harbour/include/dbedit.ch new file mode 100644 index 0000000000..43ca9b140d --- /dev/null +++ b/harbour/include/dbedit.ch @@ -0,0 +1,20 @@ +/* + * $Id$ + */ + +#ifndef _DBEDIT_CH +#define _DBEDIT_CH + +/* User function entry modes */ +#define DE_IDLE 0 /* Idle */ +#define DE_HITTOP 1 /* Attempt to cursor past top of file */ +#define DE_HITBOTTOM 2 /* Attempt to cursor past bottom of file */ +#define DE_EMPTY 3 /* No records in work area */ +#define DE_EXCEPT 4 /* Key exception */ + +/* User function return codes */ +#define DE_ABORT 0 /* Abort DBEDIT() */ +#define DE_CONT 1 /* Continue DBEDIT() */ +#define DE_REFRESH 2 /* Force reread/redisplay of all data rows */ + +#endif /* _DBEDIT_CH */ diff --git a/harbour/include/dbstruct.ch b/harbour/include/dbstruct.ch new file mode 100644 index 0000000000..522683f36b --- /dev/null +++ b/harbour/include/dbstruct.ch @@ -0,0 +1,18 @@ +/* + * $Id$ + */ + +#ifndef _DBSTRUCT_CH +#define _DBSTRUCT_CH + +/* Positions for field structure array */ +#define DBS_NAME 1 +#define DBS_TYPE 2 +#define DBS_LEN 3 +#define DBS_DEC 4 + +/* Length of the field structure array */ +#define DBS_ALEN 4 + +#endif /* _DBSTRUCT_CH */ + diff --git a/harbour/include/directry.ch b/harbour/include/directry.ch new file mode 100644 index 0000000000..c1f4832022 --- /dev/null +++ b/harbour/include/directry.ch @@ -0,0 +1,19 @@ +/* + * $Id$ + */ + +#ifndef _DIRECTRY_CH +#define _DIRECTRY_CH + +/* Positions for DIRECTORY() array */ +#define F_NAME 1 +#define F_SIZE 2 +#define F_DATE 3 +#define F_TIME 4 +#define F_ATTR 5 + +/* Length of DIRECTORY() array */ +#define F_LEN 5 + +#endif /* _DIRECTRY_CH */ + diff --git a/harbour/include/error.ch b/harbour/include/error.ch index e6d32cefe1..717c15124a 100644 --- a/harbour/include/error.ch +++ b/harbour/include/error.ch @@ -5,14 +5,13 @@ #ifndef _ERROR_CH #define _ERROR_CH -// Severity levels (oError:severity) +/* Severity levels (oError:severity) */ #define ES_WHOCARES 0 #define ES_WARNING 1 #define ES_ERROR 2 #define ES_CATASTROPHIC 3 - -// Generic error codes (oError:genCode) +/* Generic error codes (oError:genCode) */ #define EG_ARG 1 #define EG_BOUND 2 #define EG_STROVERFLOW 3 diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 02ebe5b4bc..7ac0b90b40 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -262,7 +262,8 @@ void hb_retnl( long lNumber ); /* returns a long number */ void hb_retnd( double dNumber ); /* returns a double */ void hb_reta( ULONG ulLen ); /* returns an array with a specific length */ -void * hb_xgrab( ULONG lSize ); /* allocates memory */ +void * hb_xalloc( ULONG lSize ); /* allocates memory, returns NULL on failure */ +void * hb_xgrab( ULONG lSize ); /* allocates memory, exists on failure */ void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ void hb_xfree( void * pMem ); /* frees memory */ ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ diff --git a/harbour/include/fileio.ch b/harbour/include/fileio.ch index e8228e5ebc..9e467a75ce 100644 --- a/harbour/include/fileio.ch +++ b/harbour/include/fileio.ch @@ -75,7 +75,7 @@ #define FS_END 0x0002 /* Seek from end of file */ /* File system error codes */ -#define FS_ERROR -1 /* Unspecified error */ +#define FS_ERROR (-1) /* Unspecified error */ /* Extended file open mode flags */ #define FXO_TRUNCATE 0x0100 /* Create (truncate if exists) */ diff --git a/harbour/include/fm.api b/harbour/include/fm.api index fb236e3420..c4b537b729 100644 --- a/harbour/include/fm.api +++ b/harbour/include/fm.api @@ -7,6 +7,7 @@ #include "extend.h" +#define _xalloc hb_xalloc #define _xgrab hb_xgrab #define _xrealloc hb_xrealloc #define _xfree hb_xfree diff --git a/harbour/include/getexit.ch b/harbour/include/getexit.ch new file mode 100644 index 0000000000..bd4ef8f151 --- /dev/null +++ b/harbour/include/getexit.ch @@ -0,0 +1,19 @@ +/* + * $Id$ + */ + +#ifndef _GETEXIT_CH +#define _GETEXIT_CH + +/* get:exitState values */ +#define GE_NOEXIT 0 /* no exit attempted (blank) */ +#define GE_UP 1 +#define GE_DOWN 2 +#define GE_TOP 3 +#define GE_BOTTOM 4 +#define GE_ENTER 5 +#define GE_WRITE 6 +#define GE_ESCAPE 7 +#define GE_WHEN 8 /* when clause unsatisfied */ + +#endif /* _GETEXIT_CH */ diff --git a/harbour/include/inkey.ch b/harbour/include/inkey.ch index 268d497c8b..d81dcd8ee0 100644 --- a/harbour/include/inkey.ch +++ b/harbour/include/inkey.ch @@ -2,6 +2,9 @@ * $Id$ */ +#ifndef _INKEY_CH +#define _INKEY_CH + // Input event masks #define INKEY_MOVE 1 @@ -93,8 +96,6 @@ #define K_ALT_PGUP 409 // * Alt-PgUp #define K_ALT_PGDN 417 // * Alt-PgDn - - // Misc. keys #define K_ENTER 13 // Enter, Ctrl-M @@ -114,7 +115,6 @@ #define K_ALT_EQUALS 387 // * Alt-Equals #define K_ALT_ESC 257 // * Alt-Esc - // Keypad keys #define KP_ALT_ENTER 422 // * Keypad Alt-Enter @@ -131,7 +131,6 @@ #define KP_ALT_MINUS 330 // * Keypad Alt-- #define KP_ALT_PLUS 334 // * Keypad Alt-+ - // Editing keys #define K_INS 22 // Ins, Ctrl-V @@ -150,7 +149,6 @@ #define K_ALT_BS 270 // * Alt-Backspace #define K_ALT_TAB 421 // * Alt-Tab - // Control keys #define K_CTRL_A 1 // Ctrl-A, Home @@ -180,4 +178,4 @@ #define K_CTRL_Y 25 // Ctrl-Y #define K_CTRL_Z 26 // Ctrl-Z, Ctrl-Left arrow - +#endif /* _INKEY_CH */ diff --git a/harbour/include/memoedit.ch b/harbour/include/memoedit.ch new file mode 100644 index 0000000000..06ad8e0320 --- /dev/null +++ b/harbour/include/memoedit.ch @@ -0,0 +1,27 @@ +/* + * $Id$ + */ + +#ifndef _MEMOEDIT_CH +#define _MEMOEDIT_CH + +/* User callback status modes */ +#define ME_IDLE 0 /* Idle, all keys processed */ +#define ME_UNKEY 1 /* Unknown key, memo unaltered */ +#define ME_UNKEYX 2 /* Unknown key, memo altered */ +#define ME_INIT 3 /* Initialization mode */ + +/* User callback return codes */ +#define ME_DEFAULT 0 /* Perform default action */ +#define ME_IGNORE 32 /* Ignore unknown key */ +#define ME_DATA 33 /* Treat unknown key as data */ +#define ME_TOGGLEWRAP 34 /* Toggle word-wrap mode */ +#define ME_TOGGLESCROLL 35 /* Toggle scrolling mode */ +#define ME_WORDRIGHT 100 /* Perform word-right operation */ +#define ME_BOTTOMRIGHT 101 /* Perform bottom-right operation */ + +/* NOTE: Return codes 1-31 cause MEMOEDIT() to perform the */ +/* edit action corresponding to the key whose value is returned. */ + +#endif /* _MEMOEDIT_CH */ + diff --git a/harbour/include/rdd.api b/harbour/include/rdd.api index 3aa88518e0..c7f2363025 100644 --- a/harbour/include/rdd.api +++ b/harbour/include/rdd.api @@ -2,8 +2,8 @@ * $Id$ */ -#ifndef HB_RDD_API -#define HB_RDD_API +#ifndef HB_RDD_API_ +#define HB_RDD_API_ typedef PBYTE BYTEP; @@ -985,4 +985,4 @@ extern USHORT hb_rddExtendType( USHORT fieldType ); extern USHORT hb_rddFieldType( USHORT extendType ); -#endif +#endif /* HB_RDD_API_ */ diff --git a/harbour/include/rddsys.ch b/harbour/include/rddsys.ch index 390d721532..a7735c04aa 100644 --- a/harbour/include/rddsys.ch +++ b/harbour/include/rddsys.ch @@ -2,11 +2,11 @@ * $Id$ */ -#ifndef HB_RDDSYS_CH -#define HB_RDDSYS_CH +#ifndef _RDDSYS_CH +#define _RDDSYS_CH -#define RDT_FULL 1 -#define RDT_TRANSFER 2 -#define RDT_HIDDEN 255 +#define RDT_FULL 1 +#define RDT_TRANSFER 2 +#define RDT_HIDDEN 255 -#endif +#endif /* _RDDSYS_CH */ diff --git a/harbour/include/set.ch b/harbour/include/set.ch index c61e81afa9..bb0c876292 100644 --- a/harbour/include/set.ch +++ b/harbour/include/set.ch @@ -38,6 +38,9 @@ V 1.0 David G. Holm Initial version. */ +#ifndef _SET_CH +#define _SET_CH + #define _SET_ALTERNATE 1 #define _SET_ALTFILE 2 #define _SET_BELL 3 @@ -77,3 +80,5 @@ #define _SET_TYPEAHEAD 37 #define _SET_UNIQUE 38 #define _SET_WRAP 39 + +#endif /* _SET_CH */ diff --git a/harbour/include/setcurs.ch b/harbour/include/setcurs.ch index 3c380a2d6a..bbca7186a2 100644 --- a/harbour/include/setcurs.ch +++ b/harbour/include/setcurs.ch @@ -2,8 +2,13 @@ * $Id$ */ -#define SC_NONE 0 -#define SC_NORMAL 1 -#define SC_INSERT 2 -#define SC_SPECIAL1 3 -#define SC_SPECIAL2 4 +#ifndef _SETCURS_CH +#define _SETCURS_CH + +#define SC_NONE 0 +#define SC_NORMAL 1 +#define SC_INSERT 2 +#define SC_SPECIAL1 3 +#define SC_SPECIAL2 4 + +#endif /* _SETCURS_CH */ diff --git a/harbour/include/simpleio.ch b/harbour/include/simpleio.ch new file mode 100644 index 0000000000..fc70a91cb1 --- /dev/null +++ b/harbour/include/simpleio.ch @@ -0,0 +1,20 @@ +/* + * $Id$ + */ + +#ifndef _SIMPLEIO_CH +#define _SIMPLEIO_CH + +#command ? [ ] => ; + ( OutStd( Chr(13) + Chr(10) ) [, OutStd()] ) + +#command ?? [ ] => ; + OutStd( ) + +#command ACCEPT TO => ; + := StrTran( FReadStr(0, 256), Chr(13) + Chr(10) ) + +#command ACCEPT TO => ; + ? ; ACCEPT TO + +#endif /* _SIMPLEIO_CH */ diff --git a/harbour/include/vm.api b/harbour/include/vm.api new file mode 100644 index 0000000000..c53559ad77 --- /dev/null +++ b/harbour/include/vm.api @@ -0,0 +1,40 @@ +/* + * $Id$ + */ + +#ifndef HB_VM_API_ +#define HB_VM_API_ + +#define HANDLE void* + +/* Standard */ +#define _xvalloc(size, flags) hb_xalloc(size) +#define _xvfree(h) hb_xfree(h) +#define _xvrealloc(h, size, flags) hb_xrealloc(h, size) +#define _xvlock(h) (h) +#define _xvunlock(h) /* dummy */ + +/* Wire */ +#define _xvwire(h) (h) +#define _xvunwire(h) /* dummy */ + +/* State */ +#define _xvlockcount(h) (0) +#define _xvsize(h) hb_xsize(h) + +/* -------------------------------------------------------- */ +/* Warning: Heap functionality is not supported by Harbour. */ +/* All functions will emulate constant failure. */ +/* -------------------------------------------------------- */ + +/* Heap */ +#define _xvheapnew(size) (0) +#define _xvheapdestroy(h) /* dummy */ +#define _xvheapresize(h, size) /* dummy */ +#define _xvheapalloc(h, size) (0) +#define _xvheapfree(h, offset) /* dummy */ +#define _xvheaplock(h, offset) (0) +#define _xvheapunlock(h, offset) /* dummy */ + +#endif /* HB_VM_API_ */ + diff --git a/harbour/make_tpl.sh b/harbour/make_tpl.sh new file mode 100644 index 0000000000..f685953381 --- /dev/null +++ b/harbour/make_tpl.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# --------------------------------------------------------------- +# Template to initialize the environment before starting +# the GNU make system for Harbour (Linux version) +# +# For further information about the GNU make system please +# check doc/gmake.txt +# --------------------------------------------------------------- + +export HB_ARCHITECTURE=linux +export HB_COMPILER=gcc + +# --------------------------------------------------------------- +# Start the GNU make system + +make clean +make + diff --git a/harbour/makefile.b16 b/harbour/makefile.b16 index 5b285b0489..e9138c7984 100644 --- a/harbour/makefile.b16 +++ b/harbour/makefile.b16 @@ -14,7 +14,7 @@ PROJECT: harbour.lib libs\b16\terminal.lib libs\win16\terminal.lib harbour.exe harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj dates.obj \ dates2.obj datesx.obj \ debug.obj descend.obj devoutp.obj dynsym.obj environ.obj error.obj \ - errorapi.obj errorsys.obj extend.obj files.obj \ + errorapi.obj errorsys.obj extend.obj files.obj fm.obj \ hardcr.obj initsymb.obj itemapi.obj math.obj memvars.obj \ mathx.obj mtran.obj objfunc.obj set.obj setcolor.obj stringp.obj \ strings.obj stringsx.obj tclass.obj transfrm.obj @@ -46,6 +46,7 @@ errorapi.obj : errorapi.c extend.h hbdefs.h errorsys.obj : errorsys.c extend.h hbdefs.h extend.obj : extend.c extend.h hbdefs.h files.obj : extend.c extend.h hbdefs.h +fm.obj : fm.c extend.h hbdefs.h hardcr.obj : hardcr.c extend.h hbdefs.h initsymb.obj : initsymb.c extend.h hbdefs.h itemapi.obj : itemapi.c extend.h hbdefs.h diff --git a/harbour/makefile.b31 b/harbour/makefile.b31 index 7329d1c06e..ef3189bca2 100644 --- a/harbour/makefile.b31 +++ b/harbour/makefile.b31 @@ -56,6 +56,7 @@ errorapi.obj : errorapi.c extend.h hbdefs.h ctoharb.h errorsys.obj : errorsys.prg extend.h hbdefs.h init.h pcode.h extend.obj : extend.c extend.h hbdefs.h set.h dates.h files.obj : extend.c extend.h hbdefs.h +fm.obj : fm.c extend.h hbdefs.h gtapi.obj : gtapi.c extend.h hbdefs.h gtapi.h hardcr.obj : hardcr.c extend.h hbdefs.h itemapi.obj : itemapi.c extend.h hbdefs.h ctoharb.h itemapi.h set.h dates.h diff --git a/harbour/makefile.b32 b/harbour/makefile.b32 index 0a178a2754..9f710b195b 100644 --- a/harbour/makefile.b32 +++ b/harbour/makefile.b32 @@ -42,6 +42,7 @@ errorapi.obj : errorapi.c extend.h hbdefs.h errorsys.obj : errorsys.c extend.h hbdefs.h extend.obj : extend.c extend.h hbdefs.h files.obj : files.c extend.h hbdefs.h +fm.obj : fm.c extend.h hbdefs.h hardcr.obj : hardcr.c extend.h hbdefs.h hb_f.obj : hb_f.c extend.h hbdefs.h initsymb.obj : initsymb.c extend.h hbdefs.h diff --git a/harbour/makefile.b40 b/harbour/makefile.b40 index 5c620f6c05..3b1359690c 100644 --- a/harbour/makefile.b40 +++ b/harbour/makefile.b40 @@ -42,6 +42,7 @@ errorapi.obj : errorapi.c extend.h hbdefs.h errorsys.obj : errorsys.c extend.h hbdefs.h extend.obj : extend.c extend.h hbdefs.h files.obj : files.c extend.h hbdefs.h +fm.obj : fm.c extend.h hbdefs.h hardcr.obj : hardcr.c extend.h hbdefs.h hb_f.obj : hb_f.c extend.h hbdefs.h initsymb.obj : initsymb.c extend.h hbdefs.h diff --git a/harbour/makefile.vc b/harbour/makefile.vc index a6cb20d357..ec2daad25e 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -273,6 +273,9 @@ $(OBJ_DIR)\extend.obj : $(RTL_DIR)\extend.c $(OBJ_DIR)\files.obj : $(RTL_DIR)\files.c $(CC) $(CLIBFLAGS) -Fo$@ $** +$(OBJ_DIR)\fm.obj : $(RTL_DIR)\fm.c + $(CC) $(CLIBFLAGS) -Fo$@ $** + $(OBJ_DIR)\gtapi.obj : $(RTL_DIR)\gtapi.c $(CC) $(CLIBFLAGS) -Fo$@ $** diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 044ec63dc5..4732a4a098 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -17,6 +17,7 @@ C_SOURCES=\ errorapi.c \ extend.c \ files.c \ + fm.c \ gtapi.c \ hardcr.c \ inkey.c \ diff --git a/harbour/source/rtl/extend.c b/harbour/source/rtl/extend.c index 2a042a58f2..0d0509b70c 100644 --- a/harbour/source/rtl/extend.c +++ b/harbour/source/rtl/extend.c @@ -22,20 +22,12 @@ You can contact me at: alinares@fivetech.com */ -#ifndef __MPW__ - #include -#endif -#include "set.h" #include +#include "set.h" #include "extend.h" #include "dates.h" #include "item.api" -ULONG ulMemoryBlocks = 0; -ULONG ulMemoryMaxBlocks = 0; -ULONG ulMemoryMaxConsumed = 0; -ULONG ulMemoryConsumed = 0; - PHB_ITEM hb_param( int iParam, WORD wMask ) { WORD wType; @@ -869,63 +861,3 @@ void hb_stornd( double dValue, int iParam, ... ) } } -void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory */ -{ - void * pMem = malloc( ulSize + sizeof( ULONG ) ); - - if( ! pMem ) - { - printf( "\n_xgrab error: can't allocate memory!\n" ); - exit( 1 ); - } - - * ( ( ULONG * ) pMem ) = ulSize; /* we store the block size into it */ - - ulMemoryConsumed += ulSize; - ulMemoryMaxConsumed += ulSize; - ulMemoryBlocks++; - ulMemoryMaxBlocks++; - - return ( char * ) pMem + sizeof( ULONG ); -} - -void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ -{ - ULONG ulMemSize = * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); - void * pResult = realloc( ( char * ) pMem - sizeof( ULONG ), ulSize + sizeof( ULONG ) ); - - if( ! pResult ) - { - printf( "\n_xrealloc error: can't reallocate memory!\n" ); - exit( 1 ); - } - - * ( ( ULONG * ) pResult ) = ulSize; /* we store the block size into it */ - - if( ! ulSize ) - ulMemoryBlocks--; - - ulMemoryConsumed += ( ulSize - ulMemSize ); - if( ulSize > ulMemSize ) - ulMemoryMaxConsumed += ulSize - ulMemSize; - - return ( char * ) pResult + sizeof( ULONG ); -} - -void hb_xfree( void * pMem ) /* frees fixed memory */ -{ - ULONG ulMemSize = * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); - - if( pMem ) - free( ( char * ) pMem - sizeof( ULONG ) ); - else - printf( "\nCalling hb_xfree() with a null pointer!\n" ); - - ulMemoryConsumed -= ulMemSize; - ulMemoryBlocks--; -} - -ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block */ -{ - return * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); -} diff --git a/harbour/source/rtl/fm.c b/harbour/source/rtl/fm.c new file mode 100644 index 0000000000..9dad5fe857 --- /dev/null +++ b/harbour/source/rtl/fm.c @@ -0,0 +1,115 @@ +/* + * $Id$ + + Copyright(C) 1999 by Antonio Linares. + + 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. + + You can contact me at: alinares@fivetech.com + */ + +#ifndef __MPW__ + #include +#endif +#include +#include "extend.h" + +ULONG ulMemoryBlocks = 0; +ULONG ulMemoryMaxBlocks = 0; +ULONG ulMemoryMaxConsumed = 0; +ULONG ulMemoryConsumed = 0; + +void * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, returns NULL on failure */ +{ + void * pMem = malloc( ulSize + sizeof( ULONG ) ); + + if( ! pMem ) + { + return pMem; + } + + * ( ( ULONG * ) pMem ) = ulSize; /* we store the block size into it */ + + ulMemoryConsumed += ulSize; + ulMemoryMaxConsumed += ulSize; + ulMemoryBlocks++; + ulMemoryMaxBlocks++; + + return ( char * ) pMem + sizeof( ULONG ); +} + +void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failure */ +{ + void * pMem = malloc( ulSize + sizeof( ULONG ) ); + + if( ! pMem ) + { + printf( "\n_xgrab error: can't allocate memory!\n" ); + exit( 1 ); + } + + * ( ( ULONG * ) pMem ) = ulSize; /* we store the block size into it */ + + ulMemoryConsumed += ulSize; + ulMemoryMaxConsumed += ulSize; + ulMemoryBlocks++; + ulMemoryMaxBlocks++; + + return ( char * ) pMem + sizeof( ULONG ); +} + +void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ +{ + ULONG ulMemSize = * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); + void * pResult = realloc( ( char * ) pMem - sizeof( ULONG ), ulSize + sizeof( ULONG ) ); + + if( ! pResult ) + { + printf( "\n_xrealloc error: can't reallocate memory!\n" ); + exit( 1 ); + } + + * ( ( ULONG * ) pResult ) = ulSize; /* we store the block size into it */ + + if( ! ulSize ) + ulMemoryBlocks--; + + ulMemoryConsumed += ( ulSize - ulMemSize ); + if( ulSize > ulMemSize ) + ulMemoryMaxConsumed += ulSize - ulMemSize; + + return ( char * ) pResult + sizeof( ULONG ); +} + +void hb_xfree( void * pMem ) /* frees fixed memory */ +{ + ULONG ulMemSize = * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); + + if( pMem ) + free( ( char * ) pMem - sizeof( ULONG ) ); + else + printf( "\nCalling hb_xfree() with a null pointer!\n" ); + + ulMemoryConsumed -= ulMemSize; + ulMemoryBlocks--; +} + +ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block */ +{ + return * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); +} +