In 2003, Niels Fahse posted a useful MapBasic syntax definition file to the TextPad website, but there isn't a good description for compiling and linking MapBasic code.
MapBasic is a programming language for controlling the desktop mapping program, MapInfo Professional(R). It compiles source from its own specialized syntax into pseudo-code which MapInfo then executes.
MapBasic comes with a limited development environment and a lot of people turn to alternatives such as TextPad.
MapBasic allows for separate compilation of modules: Source files (with an extension of .mb) are compiled into intermediate object files (with an extension of .mbo). A "project" file (with an extension of .mbp) controls the linker, which produces the final pseudocode executable (with an extension of .mbx).
MapInfo has built a capability for compiling and linking MapBasic code on the command line of the MapBasic executable, so it's possible to create a TextPad tool utilizing this capability.
Although TextPad can capture output from a command-line tool, and parse it to locate where the compiler said the error occurred, MapBasic thwarts this capability, because the compiler always writes compilation errors to a file with an extension of .err, even when MapBasic is run from the command line. If there are no errors, there is no .err file when MapBasic finishes.
If the MapBasic compiler had a way to send errors to standard output instead of the .err file, you could capture the output in TextPad. But it doesn't, and MapInfo is unlikely to add this functionality.
The best you can do is to open the .err file in TextPad after compilation is finished. Unfortunately, there doesn't appear to be a way to make a TextPad "tool" perform two actions. TextPad's macro functionality appears to be limited to editing. So you'll have to make a DOS batch file like the following:
Code: Select all
@echo off
if %1 == %2 goto link
mapbasic -Nosplash -D %1
goto ckerr
:link
mapbasic -Nosplash -L %1
:ckerr
if exist %3 "C:\Program Files\TextPad 4\textpad" %3
Code: Select all
"$FileName" "$BaseName.mbp" "$BaseName.err"
Hope this helps