Files
harbour-core/doc/en/compiler.txt
Viktor Szakats c1bde05495 2016-10-26 12:50 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
- extras/hbdoc/_tmplate.prg
  - extras/hbdoc/hbdoc.ch
  * extras/hbdoc/_genbase.prg
  * extras/hbdoc/_genhtml.prg
  * extras/hbdoc/_gentxt.prg
  * extras/hbdoc/_genxml.prg
  * extras/hbdoc/hbdoc.hbp
  * extras/hbdoc/hbdoc.prg
    + improve readability by paragraphs spacing in DESCRIPTION sections
    + improve divs in section content for better control via CSS
    + improve readability of tables with borders and
      header hightlights
    * change default output to single-file
    + add support for the old <table>/<fixed> tags in html output until they
      are converted to something better
    + add support for <b>/<b>, <URL:url>, Markdown `inline code`,
      _emphasis_, *bold*, character escaping \*, line separators ===/---,
      and fenced code using triple backticks.
      Very limited and not with standard compliance or completeness
      in mind, just to be able to use some basic formatting.
    ; TODO: Markdown URL and lists, then replace all <b>,<URL>,<fixed>
            markup with Markdown equivalents in docs
    + better localization support
    + add support for one file per component output via -output-component
      cmdline option
    % assemble output in memory and write to disk in a single call
    % integrate external header
    % replace almost all internal arrays with hashes
    % replace self-modifying class and macro expansion with
      regular hashes
    % internal cleanups
    % switch to simpler method for sort weighting
    + merge category/subcategory values into tag list. It
      means they will be now be included in the output
    % cleanup/fix/simplify value expansions for 'compliance',
      'status' and 'platform' fields
    % cleanup the way output engines are handles internally
    + add support for 'TAGS' entry to replace/extend the rigid and
      ambiguous CATEGORY/SUBCATEGORY-based categorization. It is meant
      to be a comma-separated list of freeform tags, possibly with a set
      of standard common tags, with the freedom to use anything else deemed
      useful by component/doc authors.
    + add footer showing the build date of the doc
    + include Git revision the doc is based on, link to the relevant
      source tree version.
    * various code refactoring steps to avoid unnecessary
      classes, arrays, macro evaluation, and using undocumented
      functions
    % various HTML5 tag improvements and optimizations
    + load HBX file contents and lookup each referenced
      symbol. Emit warning in verbose mode, if docs refers
      to non-existing one.
      (this replaces slow and broken logic based on hbextern.ch)
    + use core hbdoc API to load the documentation instead
      of locally rolled logic
    * always show those content problems that are considered
      fatal and the input doc to be skipped
    + filter docs to English language by default
    + add ability to choose language using a command-line option
    ! fix faulty validation logic that resulted in
      erronously skipping certain entries
    + identify docs' 'component' property automatically
    ! fix to not eat empty lines from examples
    + convert "see also" items to links (this works correctly only
      in single file output mode)
    ! fix to not break words (f.e. URLs) when outputting HTML
    % use shorter class names
    ! fix invalid element ID generated
    ! fix RTE when trying to create output by category
    % delete dummy "HTML2" output mode
    * convert more ASCII chars to better Unicode equivalents
    + mark more text as code automatically
    * drop MS-DOS compatibility

  * src/rtl/hbdoc.prg
    ! fix filling '_LANG' property with the correct value
    * switch to use LF instead of CRLF in the field contents

  * contrib/hbct/doc/en/*.txt
  * contrib/hbgd/doc/en/hbgd.txt
  * contrib/hbgt/doc/en/hbgt.txt
  * contrib/hbmisc/doc/en/dates2.txt
  * contrib/hbnf/doc/en/*.txt
  * contrib/rddads/doc/en/adsfuncs.txt
  * doc/en/*.txt
    * cleanups and fixes
    ! casing
    ! fix to always delimit "see also" items with comma (",")
    ! fix various casing issues and old typos
    ! various fixes after detecting them using updated hbdoc
    ! eliminate/fix various rare/unnecessary/invalid field values
    ! move some embedded docs from hbdoc into their respective
      doc sources
    ! fix a typo
    * use backtick
    * replace code copyright with reference to COPYING.txt (=LICENSE.txt)
    + mark tables without a header or with double height header

  ; Above patches come from 3.4 fork commits below:

    2016-10-26 12:43 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 12:34 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 12:20 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 03:21 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-26 02:47 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 15:05 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 14:51 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 14:30 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 13:19 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 12:35 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 11:47 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-25 02:48 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 22:26 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 18:35 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 17:58 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 16:12 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 15:44 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 03:36 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 02:40 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-24 00:23 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 23:09 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 16:39 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 16:10 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    2016-10-23 13:15 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
2016-10-26 13:07:21 +02:00

334 lines
12 KiB
Plaintext

/* $DOC$
$TEMPLATE$
Document
$NAME$
Compiler Options
$CATEGORY$
Document
$SUBCATEGORY$
Compiler
$DESCRIPTION$
<b>Invoking the Harbour compiler: </b> </par>
============================== </par>
harbour <file[.prg]> [options] </par>
or </par>
harbour [options] <file[.prg]> </par>
or </par>
harbour [options] <file[.prg]> [options] </par>
The command-line options have to be separated by at least one space.
The option can start with either '/' character or '-' character.
<b>The Harbour command-line options: </b> </par>
================================= </par>
/a automatic memvar declaration </par>
================= </par>
This causes all variables declared by PARAMETER, PRIVATE or PUBLIC
statements to be automatically declared as MEMVAR variables.
/b debug info </par>
================= </par>
The compiler generates all information required for debugging
/build display detailed version info </par>
================= </par>
/credits display credits </par>
================= </par>
/d<id>[=<val>] #define <id> </par>
================= </par>
/es[<level>] set exit severity </par>
================= </par>
/es or /es0 - all warnings are ignored and exit code returned by
the compiler is equal to 0 if there are no errors
in compiled source file.
/es1 - any warnings generate a non-zero exit code, but
output is still created.
/es2 - all warnings are treated as errors and no output
file is created. The exit code is set to a non-zero
value.
/fn[:[l|u]|-] set filename casing (l=lower u=upper) </par>
================= </par>
/fd[:[l|u]|-] set directory casing (l=lower u=upper) </par>
================= </par>
/fp[:<char>] set path separator </par>
================= </par>
/fs[-] turn filename space trimming on or off (default) </par>
================= </par>
/g<type> output type generated is <type> </par>
================= </par>
/gc[<type>] output type: C source (.c) (default)
<type>: 0=compact (default) 1=normal 2=verbose
3=generate real C code
/gh output type: Harbour Portable Object (.hrb)
/gd[.<destext>] generate dependencies list into (.d) file
/ge[<mode>] error output <mode>: 0=Clipper (default)
1=IDE friendly
/i<path> #include file search path </par>
================= </par>
/i[-|+] disable/enable support for INCLUDE envvar </par>
================= </par>
/j[<file>] generate i18n gettext file (.pot) </par>
================= </par>
/k<mode> compilation mode (type -k? for more data) </par>
================= </par>
/kc clear all flags (strict Clipper mode)
/kh Harbour mode (default)
/ko allow operator optimizations
/ki enable support for HB_INLINE (default)
/kr runtime settings enabled
/ks allow indexed assignment on all types
/kx extended Xbase++ mode (default)
/ku strings in user encoding
/kd accept macros with declared symbols
/km turn off macrotext substitution
/kj turn off jump optimization in pcode
/k? this info
/l suppress line number information </par>
================= </par>
The compiler does not generate the source code line numbers in
the output file. The ProcLine() function will return 0 for
modules compiled using this option.
/m compile module only </par>
================= </par>
/n[<type>] no implicit starting procedure </par>
================= </par>
<type>: 0=no implicit starting procedure
1=no starting procedure at all
2=add starting procedure if necessary
The compiler does not create a procedure with the same name as
the compiled file. This means that any declarations placed
before the first PROCEDURE or FUNCTION statement have file-
wide scope and can be accessed/used in all functions/procedures
defined in the compiled source file. All executable statements
placed at the beginning of the file and before the first
PROCEDURE/FUNCTION statement are ignored.
/o<path> object file drive and/or path </par>
================= </par>
/p generate pre-processed output (.ppo) file </par>
================= </par>
The compiler only creates the file that contains the result of
pre-processing the source file.
/p+ generate pre-processor trace (.ppt) file </par>
================= </par>
/q quiet </par>
================= </par>
The compiler does not print any messages during compiling
(except the copyright info).
/q0 quiet and don't display program header
/q2 disable all output messages
/r[<lib>] request linker to search <lib> (or none) </par>
================= </par>
Currently not supported in Harbour.
/r=<max> sets maximum number of preprocessor iterations </par>
================= </par>
This set the maximum number of preprocessor iterations
during processing the source code. If this switch is not
used then the preprocessor stops after 1024 iterations.
This value is used to stop processing of infinite loops,
for example:
#command ( => (,7
/s[m] syntax check only [minimal for dependencies list] </par>
================= </par>
The compiler checks the syntax only. No output file is generated.
/t<path> path for temp file creation </par>
================= </par>
Currently not used in Harbour (the Harbour compiler does not
create any temporary files).
/u[<file>] use command def set in <file> (or none) </par>
================= </par>
/u+<file> add command def set from <file> </par>
================= </par>
/undef:<id> #undef <id> </par>
================= </par>
/v variables are assumed M-> </par>
================= </par>
All undeclared or unaliased variables are assumed MEMVAR
variables (private or public variables). If this switch is not
used then the scope of such variables is checked at runtime.
/w[<level>] set warning level number (0..3, default 1) </par>
================= </par>
/w0 - no warnings
/w or /w1 - CA-Cl*pper compatible warnings
/w2 - some useful warnings missed in CA-Cl*pper
/w3 - warnings generated for Harbour language extensions
and also enables strong type checking but only
warns against declared types, or types which may be
calculated at compile time
/x[<prefix>] set symbol init function name prefix (for .c only) </par>
================= </par>
Sets the prefix added to the generated symbol init function name
(in C output currently). This function is generated
automatically for every PRG module compiled. This additional
prefix can be used to suppress problems with duplicated symbols
during linking an application with some third party libraries.
/z suppress shortcutting (.and. & .or.) </par>
================= </par>
Compilation in batch mode. </par>
========================== </par>
@<file> compile list of modules in <file> </par>
================= </par>
Not supported yet.
<b>Known incompatibilities between Harbour and CA-Cl*pper compilers </b> </par>
============================================================= </par>
NOTE: </par>
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>
The CA-Cl*pper compiler uses the special opcode PUSHP to pass a
reference to an undeclared variable ( '@' operator ). The type of
passed variable is checked at runtime (field or memvar). However,
field variables cannot be passed by reference. This means that
CA-Cl*pper checks the memvar variable only and doesn't look for a field.
This is the reason why the Harbour compiler uses the usual
PUSHMEMVARREF opcode in such cases. Notice that the runtime behavior
is the same in CA-Cl*pper and in Harbour - only the generated opcodes
are different.
Handling of object messages </par>
=========================== </par>
The HB_CLP_STRICT setting determines
the way chained send messages are handled.
For example, the following code:
a:b( COUNT() ):c += 1
will be handled as:
a:b( COUNT() ):c := a:b( COUNT() ):c + 1
in strict CA-Cl*pper compatibility mode and
temp := a:b( COUNT() ), temp:c += 1
in non-strict mode.
In practice, CA-Cl*pper will call the COUNT() function two times:
the first time before addition and the second one after addition.
In Harbour, COUNT() will be called only once, before addition.
The Harbour (non-strict) method is: </par>
1) faster </par>
2) it guarantees that the same instance variable of the same object
will be changed
(See also: src/compiler/expropt.c)
<b>Initialization of static variables </b></par>
================================== </par>
There is a difference in the initialization of static
variables that are initialized with a codeblock that refers to
a local variable. For example:
<fixed>
PROCEDURE Main()
LOCAL MyLocalVar
STATIC s_MyStaticVar := {|| MyLocalVar }
MyLocalVar := 0
? Eval( s_MyStaticVar )
RETURN
</fixed>
The above code compiles fine in CA-Cl*pper, but it generates a
runtime error Error/BASE 1132 Bound error: array access
Called form (b)STATICS$(0)
In Harbour this code generates a compile time error:
Error E0009 Illegal variable (b) initializer: 'MyLocalVar'
Both CA-Cl*pper and Harbour are handling all local variables used in a
codeblock in a special way: they are detached from the local stack
of function/procedure where they are declared. This allows access to
these variables after the exit from a function/procedure. However,
all static variables are initialized in a separate procedure
('STATICS$' in CA-Cl*pper and '(_INITSTATICS)' in Harbour) before the
main procedure and before all INIT procedures. The local variables
don't exist on the eval stack when static variables are initialized,
so they cannot be detached.
$END$
*/