### Sample Override File for Setup Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/setupgui/setup.txt This is an example of an override file used with the -f option to specify component selections for installation. Set variables to 'true' to include them. ```ini # Install small and large model libs ms=true ml=true tools16=true ``` -------------------------------- ### Setup Utility Command-Line Syntax Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/setupgui/setup.txt Use this syntax to run the installer with various options for unattended or customized installations. Options are case-insensitive. ```bash setup -f= -d -i -s -np -ns ``` -------------------------------- ### Setup Utility with Archive and Script Arguments Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/setupgui/setup.txt This syntax allows specifying an archive, setup script, and source path, typically used during development or for specific installation scenarios. ```bash setup [options] [ [inf_name [src_path]]] ``` -------------------------------- ### SUNSYS Setup Utility - Enter Windowed Mode Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/extender/dos32a/docs/html/util/3.html Example of entering the windowed mode of the SUNSYS Setup Utility to manually reconfigure an application. ```shell >SS MYPROG.EXE ``` -------------------------------- ### SUNSYS Setup Utility - Apply Configuration File Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/extender/dos32a/docs/html/util/3.html Example of applying a specific configuration file to an application without entering the windowed mode. ```shell >SS MYPROG.EXE MYPROG.D32 ``` -------------------------------- ### Example Block Formatting Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/gml/manuals/script-gmlref-tso.txt Shows how to delimit and display blocks of text as examples using :XMP and :eXMP tags. ```GML :XMP This is the first input line of the example block, and this is the last input line of the block. :eXMP ``` -------------------------------- ### Get all valid machine registers Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/cg/doc/cgdoc.html This example demonstrates how to initialize a register set to include all possible registers and then remove the unused ones to obtain the set of all valid machine registers. ```c hw_reg_set reg; HW_CAsgn( reg, HW_FULL ); HW_CTurnOff( reg, HW_UNUSED ); ``` -------------------------------- ### SUNSYS Setup Utility Usage Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/extender/dos32a/docs/html/util/3.html The general syntax for invoking the SUNSYS Setup Utility. Specify the executable name, an optional configuration file or command, and optional flags. ```shell SS [config[.d32] | command] [option] ``` -------------------------------- ### Hardware Register Set Static Initialization Example Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/cg/doc/cgdoc.html Example demonstrating the static initialization of a hardware register set using the provided macros. ```c hw_reg_set regs[] = { /* the EAX register */ HW_D( HW_EAX ), /* all registers except EDX and EBX */ HW_NotD_2( HW_EDX, HW_EBX ) }; ``` -------------------------------- ### Install Development Packages on Ubuntu Source: https://github.com/open-watcom/open-watcom-v2/wiki/Build Installs essential packages for building Open Watcom on Ubuntu, including build-essential, clang, dosbox, and git. ```bash sudo apt update ``` ```bash sudo apt install build-essential ``` ```bash sudo apt install g++ ``` ```bash sudo apt install clang ``` ```bash sudo apt install dosbox ``` ```bash sudo apt install git ``` -------------------------------- ### Start WGML Box with ON Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Drawing-Boxes Use the `.bx on` command to start a new box. This command, along with column specifications, creates a standard two-line box. ```wgml .bx 1 26 62 .bx off ``` -------------------------------- ### Build Release Installers Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/admin/making-release.txt Issue these commands in the distrib\ow directory to build installers for various operating systems. It is recommended to test these installers before posting. ```shell builder rel2 os_nt builder rel2 os_os2 builder rel2 os_dos builder rel2 os_linux ``` -------------------------------- ### Install Wine on Ubuntu Source: https://github.com/open-watcom/open-watcom-v2/wiki/Debugging/Debugging-DOS-Application-on-Linux Installs the Wine compatibility layer on Ubuntu systems. ```bash sudo apt-get install wine -y ``` -------------------------------- ### Install dosemu2 on Ubuntu Source: https://github.com/open-watcom/open-watcom-v2/wiki/Debugging/Debugging-DOS-Application-on-Linux Installs the dosemu2 DOS emulator after enabling its PPA. ```bash sudo add-apt-repository ppa:dosemu2/ppa sudo apt-get install dosemu2 -y ``` -------------------------------- ### Install Development Packages on Fedora Source: https://github.com/open-watcom/open-watcom-v2/wiki/Build Installs necessary packages for building Open Watcom on Fedora, including development tools, clang, dosbox, and static libraries. ```bash sudo dnf update ``` ```bash sudo dnf groupinstall "Development Tools" ``` ```bash sudo dnf install clang ``` ```bash sudo dnf install git ``` ```bash sudo dnf install dosbox ``` ```bash sudo dnf install glibc-static ``` ```bash sudo dnf install libstdc++-static ``` -------------------------------- ### WGML Justified Text Output Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Augmented-Devices This example demonstrates text output with justification enabled on the PS device, showing how spacing commands are used to position text and create paragraphs. ```wgml @fs2 1000 10633 am (This is the first sentence of the very first paragraph. Th\ is is the second sentence in that paragraph.) shwd 1000 10299 am (Here is the \ second paragraph. This is the second sentence in the second paragraph.) shwd 1000 9965 am (Here,) shwd 1366 (amazingly) sd 2016 (enough,) sd 2524 (is) sd 2653 (a) sd 2759 (third) sd 3099 (paragraph!) sd 3822 (It) sd 3959 (was) sd 4220 (added) sd 4622 (to) sd 4775 (see) sd 4989 (what) sd 5321 (happens) sd 5855 (when) sd 6210 (a) sd 6316 (new page is) sd 1000 9798 am (needed.) shwd 1000 9464 am (Now) shwd 1314 (that) sd 1598 (a) sd 1710 (DEVICE_PAGE) sd 2752 (has) sd 2996 (been) sd 3317 (triggered,) sd 3946 (let's) sd 4236 (try) sd 4456 (for) sd 4676 (a) sd 4787 (DOCUMENT_PAGE!) sd 6175 (Previous) sd 6736 (tests) sd 1000 9297 am (suggest) shwd 1517 (that) sd 1841 (it) sd 2009 (shouldn't) sd 2660 (take) sd 2999 (much.) sd 3542 (Well,) sd 3949 (perhaps) sd 4512 (a) sd 4663 (bit) sd 4908 (more.) sd 5427 (That) sd 5796 (produced) sd 6445 (a) sd 6596 (second) sd 1000 9130 am (DEVICE_PAGE, but) shwd 2371 (DOCUMENT_PAGE) sd 3721 (is) sd 3877 (supposed) sd 4492 (to) sd 4671 (take) sd 4990 (priority) sd 5519 (when) sd 5900 (both) sd 6235 (are) sd 6491 (reached.) sd 1000 8963 am (S\ uccess!) shwd ``` -------------------------------- ### Build Open Watcom from Source Source: https://context7.com/open-watcom/open-watcom-v2/llms.txt Build Open Watcom in two phases: bootstrapping host tools and then compiling the full system. Use `build.sh` for a full build or `clean.sh` to reset. ```shell # Clone the repository cd ~/my_ow_build git clone https://github.com/open-watcom/open-watcom-v2.git cd open-watcom-v2 # Set up environment (see Environment Setup above) . ./my_setvars.sh # Full build (both phases) — may take 1-2 hours on a fast machine ./build.sh # OR: build AND copy results into the release tree (rel/) in one step ./build.sh rel # After a successful build, copy binaries to the release tree manually cd bld && builder cprel # Clean everything for a from-scratch rebuild ./clean.sh # OR use git to restore truly pristine state (removes ALL untracked files) git clean -dfx ``` -------------------------------- ### Build OS/2 Online Help Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/howto.txt Run this command to create all online help in OS/2 Help format (*.inf). The files are copied to the docs\os2 directory. ```bash builder rel docos2 ``` -------------------------------- ### WGML Symbol Assignment Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Page-Layout-Subsystem Example of how a line in the document can directly set the value of a system symbol. The assigned value remains in effect until the start of the next document pass. ```wgml .tm 8 ``` -------------------------------- ### SUNSYS Setup Utility - Unlock and Quiet Mode Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/extender/dos32a/docs/html/util/3.html Example of unlocking configuration in an application and operating in quiet mode. ```shell >SS MYPROG /U /Q ``` -------------------------------- ### dosemu2 Debug Server Output Source: https://github.com/open-watcom/open-watcom-v2/wiki/Debugging/Debugging-DOS-Application-on-Linux Example output indicating the serial debug server has started successfully and is ready for connection. ```text Open Watcom Serial Debug Server Version 2.0 beta May 21 2025 11:23:20 (16-bit) Copyright (c) 2002-2025 The Open Watcom Contributors. All Rights Reserved. Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See https://github.com/open-watcom/open-watcom-v2#readme for details. Press 'q' to exit ``` -------------------------------- ### Basic C Program Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/LJ/listing-1.txt A standard C program that prints a greeting to the console. This is a common starting point for testing compiler setup. ```c #include int main(void) { printf("Hello, Linux!\n"); return 0; } ``` -------------------------------- ### Basic AppSettings Save/Load Example Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/tinyxml/docs/tutorial0.html This main function demonstrates the basic usage of saving and loading an AppSettings object to an XML file. ```cpp int main(void) { AppSettings settings; ssettings.save("appsettings2.xml"); settings.load("appsettings2.xml"); return 0; } ``` -------------------------------- ### Build Specific Book (Online Help) Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/howto.txt Change to the appropriate sub-directory and use this command to build only one book for online help. Replace with the book code. ```bash wmake hbook= ``` -------------------------------- ### Table Y Example (3-bit lookup) Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/zlib/algorithm.txt Presents the second level lookup table (Table Y) for codes starting with '111', with a 3-bit code length. ```text 000: F,2 001: F,2 010: G,2 011: G,2 100: H,2 101: H,2 110: I,3 111: J,3 ``` -------------------------------- ### Generate PostScript Version of Developer's Guide Source: https://github.com/open-watcom/open-watcom-v2/wiki/Build Use 'wmake' to generate a PostScript version of the Open Watcom Developer's Guide. Ensure your build environment is set up correctly. ```bash wmake hbook=devguide ``` -------------------------------- ### Dialog Controls - Static Text Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/setupgui/setupinf.txt Adds a static text control to the dialog. Text must be enclosed in quotes. '@' is replaced by the installation program name. ```setup static_text=""[,[,]] ``` ```setup static_text="@filename"[,[,]] ``` -------------------------------- ### Set up Open Watcom Environment Source: https://context7.com/open-watcom/open-watcom-v2/llms.txt Configure the environment by copying and editing the provided `setvars` script. Ensure `OWROOT`, `OWTOOLS`, and `OWDOSBOX` are correctly set. ```shell # Copy and adapt setvars.sh (do NOT use the repo copy directly) cp open-watcom-v2/setvars.sh my_setvars.sh # Edit my_setvars.sh — minimum required changes: # export OWROOT=/home/user/my_ow_build/open-watcom-v2 # export OWTOOLS=GCC # or CLANG, WATCOM, VISUALC # export OWDOSBOX=dosbox # required if building docs or using wgml # Source the script (the leading '.' keeps env vars in the current shell) . ./my_setvars.sh # Verify environment — should print something like: # Open Watcom build environment (GCC version=12) echo "OWROOT=$OWROOT OWBLDVERSTR=$OWBLDVERSTR" # Output: OWROOT=/home/user/my_ow_build/open-watcom-v2 OWBLDVERSTR=2.0 ``` -------------------------------- ### Table X Example (2-bit lookup) Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/zlib/algorithm.txt Shows the second level lookup table (Table X) for codes starting with '110', with a 2-bit code length. ```text 00: C,1 01: C,1 10: D,2 11: E,2 ``` -------------------------------- ### Dialog Controls - Edit Control Source: https://github.com/open-watcom/open-watcom-v2/blob/master/bld/setupgui/setupinf.txt Gets a value from the user, typically for text input. Includes variable name, optional initial value, and explanatory text. ```setup edit_control=DstDir,,"Destination Directory:"[,[,]] ``` -------------------------------- ### Build Win16 Online Help Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/howto.txt Use this command to create Win16 .hlp format help files. The files are generated in the docs\win directory. ```bash builder rel docwin ``` -------------------------------- ### Build Win32 Online Help Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/howto.txt Use this command to create Win32 .hlp format help files. The files are generated in the docs\nt directory. ```bash builder rel docnt ``` -------------------------------- ### WGML Tab Delimiter and Positions Setup Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Tabs-and-Tabbing Configures WGML to use '@' as the tab delimiter and sets specific tab stop positions. This is a prerequisite for the subsequent tabbed content examples. ```wgml .tb set @ .tb 5 15 30 ``` -------------------------------- ### Binary Output with %binary1() and %text() Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Device-Function-Notes Example demonstrating how to emit binary data and text, specifically handling a two-byte value by emitting its bytes in a required order regardless of the host system's endianness. ```wgml %binary1(27)%text('\') %binary1(%remainder(%tab_width(),256)) %binary1(%divide(%tab_width(),256)) ``` -------------------------------- ### Set Up Test Environment Source: https://context7.com/open-watcom/open-watcom-v2/llms.txt Prepares the environment for running tests against the release tree. This involves copying and modifying the setvars script. ```shell cp my_setvars.sh test_setvars.sh # Edit test_setvars.sh: export WATCOM=$OWROOT/rel . ./test_setvars.sh ``` -------------------------------- ### WGML Tab Character Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Tabs-and-Tabbing Demonstrates how a tab character (@) is rendered in WGML. The output varies based on whether the tab is preceded by a paragraph tag (:P.) and its position relative to the start of the input record. ```wgml :P. This is a@test. ``` ```wgml :P.This is a@test. ``` -------------------------------- ### WGML %enterfont() Usage Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Device-Function-Notes This is how %enterfont() is used in source files, typically as the last line of a :VALUE block within a START :INIT block. It takes a numeric parameter, though the parameter is ignored by wgml. ```wgml %enterfont(0) ``` -------------------------------- ### Build All Postscript Documentation Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/howto.txt Run this command from the documentation's main directory to build all books in Postscript format. The output files will have a '.ps' extension. ```bash builder rel docps ``` -------------------------------- ### WGML Justification Behavior with Parentheses Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Augmented-Devices This example demonstrates that WGML 4.0, even with justification enabled, will not end a line with an opening parenthesis '('. This is inferred from the output where the 'am' command is used before the text that would have started a new line. ```wgml 1000 9464 am (Now) shwd 1314 (that) sd 1598 (a) sd 1710 (DEVICE_PAGE) sd 2752 (has) sd 2996 (been) sd 3317 (triggered,) sd 3946 (let's) sd 4236 (try) sd 4456 ``` -------------------------------- ### WGML BX NEW Box on Box Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Drawing-Boxes Illustrates the 'box on box' effect using BX NEW with specific column ranges. This setup creates overlapping boxes where inner boxes are drawn on top of outer ones. ```wgml .bx 10 20 .bx new 1 30 .bx off .bx off ``` -------------------------------- ### Loading and Displaying AppSettings Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/tinyxml/docs/tutorial0.html This block loads settings from an XML file and prints the application name, welcome message, window details, and farewell message to the console. ```cpp // block: load settings { AppSettings settings; settings.load("appsettings2.xml"); printf("%s: %s\n", settings.m_name.c_str(), settings.m_messages["Welcome"].c_str()); WindowSettings & w=settings.m_windows.front(); printf("%s: Show window '%s' at %d,%d (%d x %d)\n", settings.m_name.c_str(), w.name.c_str(), w.x, w.y, w.w, w.h); printf("%s: %s\n", settings.m_name.c_str(), settings.m_messages["Farewell"].c_str()); } ``` -------------------------------- ### Building Specific Binaries/Libraries with wmake Source: https://github.com/open-watcom/open-watcom-v2/wiki/Build For development, it's often handy to run 'wmake' in the specific directory of the binary or library you want to build. This example shows building the OS/2 version of 'wlink'. ```bash wmake ``` -------------------------------- ### WGML Box Drawing with '/' Separator and Operand ON Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Drawing-Boxes Illustrates the 'ON' operand's behavior when using the '/' separator to define multiple segments within a box line. This example highlights how 'ON' affects the first segment of a line that starts further to the right. ```wgml .bx 1 / 10 26 / 30 .bx on 5 20 / 21 35 .bx off ``` -------------------------------- ### Start WGML Box with NEW Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Drawing-Boxes The `.bx new` command initiates a new box, behaving identically to `.bx on` when no box is currently open. It also accepts column specifications. ```wgml .bx new 1 26 62 .bx off ``` -------------------------------- ### Configure Open Watcom Build Environment Source: https://github.com/open-watcom/open-watcom-v2/wiki/Build Sets up the build environment by sourcing the 'setvars.sh' script. Ensure OWROOT and OWTOOLS are correctly exported. ```bash cp open-watcom-v2/setvars.sh my_setvars.sh ``` ```bash export OWROOT=/home/test/my_ow_build/open-watcom-v2 ``` ```bash export OWTOOLS=CLANG ``` ```bash . ./my_setvars.sh ``` -------------------------------- ### WGML Concatenation Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Sequencing Shows a basic example of WGML concatenation. ```wgml here we ``` -------------------------------- ### Build Open Watcom Project from Command Line Source: https://github.com/open-watcom/open-watcom-v2/wiki/OW-tools-usage-with-VSCode Configures and builds an Open Watcom project using CMake presets. Use --fresh for a clean reconfigure. ```bash # Configure (pick a preset; --fresh for clean reconfigure) cmake --preset dos32-debug --fresh # Build cmake --build --preset dos32-debug ``` -------------------------------- ### Example of Footnote Reference Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/gml/manuals/script-gmlref-tso.txt This example shows how to reference a footnote defined with ID=foot. ```SCRIPT GML One of the footnotes in this document :FNREF REFID=foot was defined with ID=foot. ``` -------------------------------- ### WGML Device Function Examples Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Device-Function-Language Examples of WGML device functions, including those that can be referred to as a group. ```wgml %binary() %binary1() %binary2() %binary4() ``` ```wgml %ifeqn() %ifeqs() %ifnen() %ifnes() ``` -------------------------------- ### C Source Code Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Compiler-and-Code-Generator-Debugging This is a simple C function used as an example for debugging code generation. ```c int foo( int a, int b ) { return( a > b ? 3 : 4 ); } ``` -------------------------------- ### WGML Directory File - Extended Followed by Compact Example Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Directory-File-Format Demonstrates an extended entry followed by a compact entry, highlighting how the final element of the extended entry might preview the following compact entry's type. ```text 01 00 01 04 06 boldps 01 00 05 XBOPS 01 02 ``` ```text 01 02 08 x2700drv 08 X2700DRV ``` -------------------------------- ### Build Entire Open Watcom System Source: https://github.com/open-watcom/open-watcom-v2/blob/master/docs/LJ/article.txt Source the 'setvars' script to add the newly built Linux host to the PATH, then navigate to the 'bld' directory and run 'builder rel2' to build the complete system. ```bash source setvars cd bld builder rel2 ``` -------------------------------- ### 3PLIB Usage Example Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/extender/causeway/source/all/3plib/3plib.txt This is the general usage format for the 3PLIB utility, showing the command structure and available options for library management. ```bash 3plib commands lib_name mod_name [out_name] ``` -------------------------------- ### TiXmlPrinter Usage Example Source: https://github.com/open-watcom/open-watcom-v2/blob/master/contrib/tinyxml/docs/classtixmlprinter.html This example demonstrates how to use TiXmlPrinter to format and print an XML document to standard output. ```APIDOC ## TiXmlPrinter Usage Example ### Description This example shows how to instantiate a `TiXmlPrinter`, configure its indentation, process an XML document using the `Accept` method, and then retrieve and print the formatted XML string. ### Usage ```cpp TiXmlPrinter printer; printer.SetIndent( "\t" ); // Set indentation to use tabs doc.Accept( &printer ); // Process the XML document fprintf( stdout, "%s", printer.CStr() ); // Print the formatted XML to stdout ``` ### Methods Used - `TiXmlPrinter()`: Constructor. - `SetIndent(const char * _indent)`: Sets the characters used for indentation. - `Accept(TiXmlVisitor * visitor)`: (Inherited from TiXmlNode) Processes the XML document using the provided visitor. - `CStr()`: Returns the formatted XML as a C-style string. ### Output The formatted XML document will be printed to the standard output. ``` -------------------------------- ### WGML Function Sequence Examples Source: https://github.com/open-watcom/open-watcom-v2/wiki/Wgml/WGML-Device-Function-Language Demonstrates the use of %decimal() and %hex() with functions like %wgml_header() to insert results into the output buffer, contrasting their behavior with %image() and %text(). ```text Function Sequence Decimal Result Hex Result %image(%decimal(%wgml_header())) 394944 606C0 %image(%hex(%wgml_header())) 395040 60720 ```