The Compiler object provides access to methods that allow the Compile Time Script to
issue messages, warnings and errors. The output will be shown in the output window of the
IDE or will be printed to the console if the command line version of the ASPC is used.
ReportMessage
Syntax:
Compiler.ReportMessage number, message
number parameter specifies the message level. This corresponds to the
Compiler messages level field in the ASPC General options dialog
box - it specifies the minimum level of the messages that will be listed. In other
words messages with lower level will not be shown. This allows you to hide part of the
messages during the CTS development process.
message - string or expression that evaluates to string - the text of
the message.
ReportWarning
Syntax:
Compiler.ReportWarning code, message, line_number
code - is the number of the warning message. This could be useful when
designing a documentation for the script. CTS should use negative codes.
message - string ot string expression - the text of the error message
line_number - This parameter is currently not used by the IDE, but is
shown. If you are able to specify a line number in the file that caused the problem you
can set this parameter to its number. To instruct the compiler to show correct file name
you must precede the statement with ReportFile method call. If the error
is caused by a paremeter, cofiguration or otherwise is not related to a file or it is not
known set the line_number to 0.
ReportError
Syntax:
Compiler.ReportError code, message, line_number
code - is the number of the error message. This could be useful when
designing a documentation for the script. CTS should use negative codes.
message - string ot string expression - the text of the warning
message
line_number - This parameter is currently not used by the IDE, but is
shown. If you are able to specify a line number in the file that caused the problem you
can set this parameter to its number. To instruct the compiler to show correct file name
you must precede the statement with ReportFile method call. If the error
is caused by a paremeter, cofiguration or otherwise is not related to a file or it is not
known set the line_number to 0.
ReportFile
The compiler keeps an internal variable that holds the full path of the current file
processed by the compiler - the file that corresponds to the warning and error messages
issued. Thus the script needs to set the current file when it begins to process it and
then all the issued messages will be associated with it. In case of Compile Time Script
this could be an external file (for example a db file or file containing something the
script uses to perform its task) or the currently processed file. For example when
processing include files ASPC sets the current file to the include file's full path name.
If the task performed is so complex that no current file can be defined then better set
the current file to empty string before issuing message in order to protect the user from
confusion (e.g. call Compiler.ReportFile 0,"","" ).
Syntax:
Compiler.ReportFile reportType, file_name, description
reportType parameter is very important. It specifies how and if a
message will be listed in the visible output (output window or the console):
0 - hidden. The message will not be shown. Useful if you are returnig from processing
of another file and continuing the processing of the previous file. This allows you to set
the current file but not disturb the user (or yourself) by listing (visually) the file
again.
1 - Input file. The file will be listed with "input file" icon.
2 - output file - The file will be listed with "output file" icon. The CTS
rarely needs to output files itself. Usually it only modifies the processed file and the
output is done and reported by the compiler, but if CTS needs to create additional file
not known oterwise for the compiler this report type code should be used to informthe user
for the event.
3 - VB file created. CTS should not use it.
4 - Include file - The file will be listed with "include file" icon. The CTS
may use this code for the external files they use. Also if the CTS is able to provide
meaningful error information and the CTS wants to show the exact file caused the problem
it can use the special IncludeBegin and IncludeEnd nodes
to keep track of the files (in other words in the document tree information for the
include files is kept as special nodes - they can be just ignored, but if it is required
to know the origin of the certain part of the tree this could be done by tracking these
nodes).
> 4 - Will be listed currently as "some file". It is not recommended to
use such values because future versions will delegate them other meanings.
file_name - string or string expression that contains the full path
name of the file.
description - description of the file role/meaning. Set to empty
string if the reportCode is 0.