Merge pull request #1 from harbour/master
pulling upstream changes to fork
This commit is contained in:
@@ -14,6 +14,21 @@
|
||||
* README.txt
|
||||
+ documented Git 1.7 requirement
|
||||
|
||||
2013-03-18 22:17 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* doc/en/dir.txt
|
||||
* extras/hbdoc/_genhtml.prg
|
||||
* extras/hbdoc/hbdoc.prg
|
||||
! fixed not to double each doc entry
|
||||
* cleanups
|
||||
|
||||
2013-03-18 21:51 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
- doc/en/strotype.txt
|
||||
* doc/en/compiler.txt
|
||||
* doc/en/garbage.txt
|
||||
* tests/dyn.prg
|
||||
* tests/dynwin.prg
|
||||
* cleanups
|
||||
|
||||
2013-03-18 19:03 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* doc/en/*.txt
|
||||
* doc cleanups
|
||||
|
||||
@@ -249,59 +249,9 @@
|
||||
|
||||
NOTE: </par>
|
||||
|
||||
If you want a 100% compatible runtime libraries then
|
||||
you have to define HARBOUR_STRICT_CLIPPER_COMPATIBILITY. This
|
||||
option should be defined in the file include/hbsetup.h (in fact this
|
||||
option is placed in a comment by default - you need to remove the
|
||||
/* */ characters only). This change has to be done before invoking
|
||||
the make utility.
|
||||
|
||||
|
||||
<b>Handling of undeclared variables </b> </par>
|
||||
================================ </par>
|
||||
|
||||
When a value is assigned to an undeclared variable and the '-v'
|
||||
command line option is not used, then the CA-Cl*pper compiler assumes
|
||||
that the variable is a PRIVATE or a PUBLIC variable and generates
|
||||
POPM (pop memvar) opcode.
|
||||
|
||||
When the value of an undeclared variable is accessed and the '-v'
|
||||
command line option is not used, the CA-Cl*pper compiler generates PUSHV
|
||||
(push variable) opcode that determines the type of variable at runtime.
|
||||
If a field with the requested name exists in the current workarea then
|
||||
its value is used. If there is no field then a PRIVATE or a PUBLIC
|
||||
variable is used (if exists).
|
||||
|
||||
The Harbour compiler generates an opcode to determine the type of
|
||||
variable at runtime (POPVARIABLE or PUSHVARIABLE) in both cases
|
||||
(assignment and access).
|
||||
|
||||
The difference can be checked by the following code:
|
||||
|
||||
<fixed>
|
||||
PROCEDURE Main()
|
||||
PRIVATE myname
|
||||
|
||||
dbCreate( "TEST", { { "MYNAME", "C", 10, 0} } )
|
||||
USE test NEW
|
||||
SELECT test
|
||||
APPEND BLANK
|
||||
|
||||
FIELD->myname := "FIELD"
|
||||
MEMVAR->myname := "MEMVAR"
|
||||
|
||||
myname := myname + " assigned"
|
||||
|
||||
// In CA-Cl*pper: "FIELD", In Harbour: "FIELD assigned"
|
||||
? FIELD->myname
|
||||
|
||||
// In CA-Cl*pper: "MEMVAR assigned", In Harbour: "MEMVAR"
|
||||
? MEMVAR->myname
|
||||
|
||||
USE
|
||||
|
||||
RETURN
|
||||
</fixed>
|
||||
If you want a 100% compatible runtime libraries then you have
|
||||
to define HB_CLP_STRICT, using 'HB_USER_CFLAGS=-DHB_CLP_STRICT',
|
||||
then rebuild.
|
||||
|
||||
<b>Passing an undeclared variable by the reference </b> </par>
|
||||
=============================================== </par>
|
||||
@@ -316,11 +266,10 @@
|
||||
is the same in CA-Cl*pper and in Harbour - only the generated opcodes
|
||||
are different.
|
||||
|
||||
|
||||
Handling of object messages </par>
|
||||
=========================== </par>
|
||||
|
||||
The HARBOUR_STRICT_CLIPPER_COMPATIBILITY setting determines
|
||||
The HB_CLP_STRICT setting determines
|
||||
the way chained send messages are handled.
|
||||
|
||||
For example, the following code:
|
||||
|
||||
@@ -100,14 +100,14 @@
|
||||
$EXAMPLES$
|
||||
DIR // information for all DBF files in current directory
|
||||
|
||||
dir "*.dbf" // list all DBF file in current directory
|
||||
DIR "*.dbf" // list all DBF file in current directory
|
||||
|
||||
// list all PRG files in Harbour Run-Time library
|
||||
// for MS-DOS compatible operating systems
|
||||
Dir "src\rtl\*.prg"
|
||||
DIR "src\rtl\*.prg"
|
||||
|
||||
// list all files in the public section on a Unix like machine
|
||||
Dir "/pub"
|
||||
DIR "/pub"
|
||||
$STATUS$
|
||||
R
|
||||
$COMPLIANCE$
|
||||
@@ -184,7 +184,7 @@
|
||||
aAttr := Array( nLen )
|
||||
ADir( "*.prg", aName, aSize, aDate, aTime, aAttr )
|
||||
FOR i := 1 TO nLen
|
||||
? aName[ i ], aSize[ i ], aDate[ i ], aTime[ i ], aAttr[ i ]
|
||||
? aName[ i ], aSize[ i ], aDate[ i ], aTime[ i ], aAttr[ i ]
|
||||
NEXT
|
||||
ELSE
|
||||
? "This directory is clean from smut"
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
- next scan all variables if these memory blocks are still referenced.
|
||||
|
||||
Notice that only arrays, objects and codeblocks are collected because
|
||||
these are the only datatypes that can cause self-references (a[1]:=a)
|
||||
or circular references (a[1]:=b; b[1]:=c; c[1]:=a) that cannot be
|
||||
properly deallocated by simple reference counting.
|
||||
these are the only datatypes that can cause self-references ( a[ 1 ] := a )
|
||||
or circular references ( a[ 1 ] := b; b[ 1 ] := c; c[ 1 ] := a ) that
|
||||
cannot be properly deallocated by simple reference counting.
|
||||
|
||||
Since all variables in harbour are stored inside some available tables
|
||||
(the eval stack, memvars table and array of static variables) then checking
|
||||
@@ -155,7 +155,7 @@
|
||||
$ONELINER$
|
||||
Releases the memory that was allocated with hb_gcAlloc().
|
||||
$SYNTAX$
|
||||
void hb_gcFree( void *pMemoryPtr );
|
||||
void hb_gcFree( void * pMemoryPtr );
|
||||
$ARGUMENTS$
|
||||
<pMemoryPtr> The pointer to memory for release. This memory
|
||||
pointer have to be allocated with hb_gcAlloc() function.
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
|
||||
/* $DOC$
|
||||
$TEMPLATE$
|
||||
Document
|
||||
$NAME$
|
||||
Strong Typing
|
||||
$CATEGORY$
|
||||
Document
|
||||
$SUBCATEGORY$
|
||||
Compiler
|
||||
$ONELINER$
|
||||
Compile-Time type checking
|
||||
$DESCRIPTION$
|
||||
Strong Type Checking could also be described as "Compile-Time Type
|
||||
Checking".
|
||||
|
||||
CA-Cl*pper generates a Run-Time Error
|
||||
("Type Mismatch") at an attempt to perform some operations with
|
||||
the wrong type of Variable.
|
||||
|
||||
Examples:
|
||||
|
||||
LOCAL Var1 := "A"
|
||||
|
||||
? Var1 * 3 // Error here.
|
||||
|
||||
@ Var1, 7 SAY "Hello" // Error here.
|
||||
|
||||
? SubStr( "Hello", Var1 ) // Error here.
|
||||
|
||||
The above 3 lines would all result in Run-Time Error, because Var1 is
|
||||
of type CHARACTER but the above lines used it as if it was of type
|
||||
NUMERIC.
|
||||
|
||||
Using Strong Type Checking, or Compile-Time Type Checking, the above
|
||||
problem would have been discovered and reported in COMPILE-TIME,
|
||||
rather than waiting for the inevitable problem to be discovered when
|
||||
we finally execute the program.
|
||||
|
||||
Strong Typed Languages allow the programmer to "tell" the compiler (declare)
|
||||
what is the type of a each Variable, so that the Compiler in return can warn
|
||||
the programmer, when ever such Declared (Strong Typed) Variable, is used in
|
||||
a context which is incompatible with its declared type.
|
||||
|
||||
For instance, if we "told" the compiler that Var1 above is of type
|
||||
CHARACTER (LOCAL Var1 AS CHARACTER) the Harbour Compiler could, in
|
||||
return, warn us if we attempted to perform the calculation:
|
||||
|
||||
Var1 * 3
|
||||
|
||||
because the Compiler knows we can't perform a multiplication of a
|
||||
Character. (we might allow it in some context, but this is beyond
|
||||
the scope of this discussion). Similarly we would have been warned
|
||||
when attempting to use Var1 as a Row Number ( @ Var1 ), or as the
|
||||
2nd operand of the SubStr() function SubStr( "Hello", Var1) ),
|
||||
because the Compiler knows that these operations require a NUMERIC
|
||||
rather than CHARACTER type.
|
||||
|
||||
The above may save us lots of time, by pointing a problem, we can not
|
||||
escape, since such code will never perform correctly once executed.
|
||||
So rather than wait to the testing cycle, for such problems to be
|
||||
discovered, (and some times even later, after we may have
|
||||
distributed our applications) instead we may know of such problems
|
||||
as soon as we type HARBOUR ProgName -w3
|
||||
|
||||
Harbour also offers a hybrid mode, where it can report such type
|
||||
mismatch problems, even without requiring the programmer to declare
|
||||
the type of variables. This feature, is referred to as Adaptive Type
|
||||
Checking. The programmer is not required to make any changes in his
|
||||
code to take advantage of this feature. All of the above 3 errors
|
||||
would have been reported just as effectively as if the programmer
|
||||
Strong Typed (declared) Var1. Harbour would have been able to report
|
||||
such problems at compile time because the assignment Var1 := "A"
|
||||
implied that Var1 is of type CHARACTER,until it will be assigned
|
||||
another value. Therefore Harbour will "remember" that Var1 "adapted"
|
||||
type CHARACTER, and thus the subsequent multiplication Var1 * 3, will
|
||||
be reported as an error, as soon as you attempt to compile such code.
|
||||
|
||||
The nice aspect of this hybrid mode, is that unlike Strong Typed
|
||||
Variables,you don't have to declare the type, so no code changes
|
||||
are need, the Type instead is assumed by implication (type of the
|
||||
assigned value). The other benefit, is that it is completely OK to
|
||||
assign a new value of different type, any time, to such undeclared
|
||||
(variant) variable. As soon as we assign a new type, the Compiler
|
||||
will than protect us from using the Variable in an incompatible
|
||||
context, since the variable "adapted" this type as soon as we
|
||||
assigned a value which implies a type.
|
||||
|
||||
While Adapted Type Checking may be fairly effective in reporting many
|
||||
common mistakes, to take full benefits of such Compile-Time checking,
|
||||
it is recommended to do declare the Type of Variables, when ever
|
||||
possible.
|
||||
|
||||
The Harbour Strong Type features, also allows the declaration of the
|
||||
expected parameters (including optionals) of User Defined Functions,
|
||||
as well as their return Type. Similarly, you may declare the Type of
|
||||
any Class Variables, Methods, and Methods Parameters.
|
||||
$END$
|
||||
*/
|
||||
@@ -7,7 +7,6 @@
|
||||
*
|
||||
* Portions of this project are based on hbdoc
|
||||
* Copyright 1999-2003 Luiz Rafael Culik <culikr@uol.com.br>
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -215,7 +215,6 @@ PROCEDURE Main( ... )
|
||||
aContent := {}
|
||||
AEval( ;
|
||||
{;
|
||||
p_hsSwitches[ "basedir" ] + "doc", ;
|
||||
p_hsSwitches[ "basedir" ] + "doc" + hb_ps() + "en", ;
|
||||
iif( p_hsSwitches[ "source" ], p_hsSwitches[ "basedir" ] + "src", NIL ), ;
|
||||
iif( p_hsSwitches[ "contribs" ], p_hsSwitches[ "basedir" ] + "contrib", NIL ), ;
|
||||
@@ -276,8 +275,7 @@ PROCEDURE Main( ... )
|
||||
NEXT
|
||||
|
||||
FOR idx := 1 TO Len( aContent )
|
||||
IF Right( aContent[ idx ]:sourcefile_, Len( "1stread.txt" ) ) == "1stread.txt"
|
||||
ELSE
|
||||
IF !( Right( aContent[ idx ]:sourcefile_, Len( "1stread.txt" ) ) == "1stread.txt" )
|
||||
oDocument:AddEntry( aContent[ idx ] )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
@@ -40,6 +40,6 @@ PROCEDURE Main()
|
||||
? "=="
|
||||
|
||||
a := "hello world!" ; ? ">", a, hb_DynCall( { "TESTST", cFileName, hb_bitOr( HB_DYN_CTYPE_CHAR_PTR , HB_DYN_CALLCONV_CDECL, HB_DYN_ENC_RAW ), hb_bitOr( HB_DYN_CTYPE_CHAR_PTR, HB_DYN_ENC_RAW ) }, a )
|
||||
// a := "hello world!" ; ? ">", a, hb_dynCallFoxPro( "DECLARE STRING TESTST IN " + cFileName + " STRING", a )
|
||||
// a := "hello world!" ; ? ">", a, hb_DynCallFoxPro( "DECLARE STRING TESTST IN " + cFileName + " STRING", a )
|
||||
|
||||
RETURN
|
||||
|
||||
@@ -47,8 +47,8 @@ PROCEDURE Main()
|
||||
|
||||
? "MsgBox:", hb_DynCall( { "MessageBoxA", "user32.dll", HB_DYN_CALLCONV_STDCALL }, 0, "Hello world!", "Harbour sez", hb_bitOr( MB_OKCANCEL, MB_ICONEXCLAMATION, MB_HELP ) )
|
||||
|
||||
IF hb_FileExists( "libcurl.dll" )
|
||||
hLib := hb_libLoad( "libcurl.dll" )
|
||||
hLib := hb_libLoad( "libcurl.dll" )
|
||||
IF ! Empty( hLib )
|
||||
? hb_DynCall( { "curl_version", hLib, HB_DYN_CTYPE_CHAR_PTR } )
|
||||
hb_libFree( hLib )
|
||||
? hb_DynCall( { "curl_version", "libcurl.dll", HB_DYN_CTYPE_CHAR_PTR } )
|
||||
|
||||
Reference in New Issue
Block a user