### Update INSTALL examples to use win-make/dos-make Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Updated the INSTALL file to use win-make/dos-make in its examples, reflecting current build practices. ```text * Changed to use win-make/dos-make in examples. ``` -------------------------------- ### Demonstrate XbpFontDialog and XbpFont Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Provides a demonstration of the XbpFontDialog() and XbpFont() implementation in demoxbp.prg. The example guides the user through selecting a font and observing the result in an MLE text editor. ```prg + Demonstrated XbpFontDialog() and XbpFont() implementation. 1. Click on tab-page. 2. Click on toolbar icon. 3. Adjust and select a font. 4. See the result in MLE text editor. ``` -------------------------------- ### Example: Main Program Loop with i18n Setup Source: https://github.com/harbour/core/blob/master/ChangeLog.txt A basic program structure that initializes an I18N translation set, sets its plural form for Polish, makes it the default, and then iterates. ```Harbour proc main() local pI18N, i pI18N := hb_i18n_create() hb_i18n_pluralForm( pI18N, "PL", .t. ) hb_i18n_set( pI18N ) for i := 0 to 30 ``` -------------------------------- ### Harbour Multithreading Example Source: https://context7.com/harbour/core/llms.txt Illustrates starting, joining, and synchronizing threads using mutexes. Ensure `hb_mutexCreate`, `hb_mutexLock`, `hb_mutexUnlock`, `hb_threadStart`, and `hb_threadJoin` are used correctly. ```harbour PROCEDURE Main() LOCAL thA, thB, xResultA, xResultB LOCAL mtx := hb_mutexCreate() ? "Starting threads..." // Start two threads passing parameters thA := hb_threadStart( @Worker(), "Thread-A", mtx, 3 ) thB := hb_threadStart( @Worker(), "Thread-B", mtx, 5 ) // Wait for both to finish and collect return values hb_threadJoin( thA, @xResultA ) hb_threadJoin( thB, @xResultB ) ? "Thread-A result:", xResultA ? "Thread-B result:", xResultB RETURN FUNCTION Worker( cName, mtx, nCount ) LOCAL i, nSum := 0 FOR i := 1 TO nCount hb_mutexLock( mtx ) ?? cName + "(" + hb_ntos( i ) + ") " hb_mutexUnlock( mtx ) hb_idleSleep( 0.05 ) nSum += i NEXT RETURN nSum // Expected output (interleaved): // Thread-A(1) Thread-B(1) Thread-A(2) Thread-B(2) ... // Thread-A result: 6 // Thread-B result: 15 ``` -------------------------------- ### Harbour File I/O Operations Source: https://context7.com/harbour/core/llms.txt Provides examples for basic file operations including creation, writing, reading (entire file or byte-by-byte), checking existence, getting size, splitting file paths, and erasing files. Requires including 'fileio.ch' for constants like `hb_eol`. ```harbour #include "fileio.ch" PROCEDURE Main() LOCAL hFile, cLine, cBuffer, nRead LOCAL cPath := "output.txt" // ---- Write a file ---- hFile := FCreate( cPath ) IF hFile != F_ERROR FWrite( hFile, "Line 1: Hello, Harbour!" + hb_eol() ) FWrite( hFile, "Line 2: File I/O example" + hb_eol() ) FClose( hFile ) ? "File written:", cPath ELSE ? "Error creating file:", FError() ENDIF // ---- Read entire file at once ---- ? hb_MemoRead( cPath ) // ---- Read file byte by byte ---- hFile := FOpen( cPath, FO_READ ) IF hFile != F_ERROR cBuffer := Space( 1 ) DO WHILE FRead( hFile, @cBuffer, 1 ) > 0 ?? cBuffer ENDDO FClose( hFile ) ENDIF // ---- File information ---- ? hb_FileExists( cPath ) // .T. ? hb_FSize( cPath ) // byte size LOCAL cDrive, cDir, cName, cExt hb_FNameSplit( "/usr/local/myapp.exe", @cDir, @cName, @cExt ) ? cDir // /usr/local/ ? cName // myapp ? cExt // .exe // ---- Erase ---- FErase( cPath ) ? hb_FileExists( cPath ) // .F. RETURN ``` -------------------------------- ### Build and Install Harbour with DLLs (BCC32) Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Build and install Harbour with DLL support using BCC32. Ensure BCC32 and make are in the PATH, and specify the compiler and installation prefix. ```batch set PATH=C:\devl\bcc55\bin;%PATH% set PATH=C:\devl\make-3.81;%PATH% set HB_COMPILER=bcc32 set HB_INSTALL_PREFIX=C:\devl\hbb32-1.1 call make_gnu.bat --install-with-dll > out.txt 2>&1 ``` -------------------------------- ### Build Harbour on FreeBSD Source: https://github.com/harbour/core/blob/master/README.md Use 'gmake install' to build and install the project on FreeBSD hosts. ```bash $ gmake install ``` -------------------------------- ### Full ft_ArEdit Example with Editing Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/aredit.txt This example shows a complete setup for ft_ArEdit, including array initialization, heading and block definitions, and a custom get editing function (TestGet). It allows full editing of the 2D array. ```harbour LOCAL i, ar[ 3, 26 ], aBlocks[ 3 ], aHeadings[ 3 ] LOCAL nElem := 1, bGetFunc // Set up two dimensional array "ar" FOR i := 1 TO 26 ar[ 1, i ] := i // 1 -> 26 Numeric ar[ 2, i ] := Chr( Asc( "A" ) + i - 1 ) // "A" -> "Z" Character ar[ 3, i ] := Chr( Asc( "Z" ) - i + 1 ) // "Z" -> "A" Character NEXT // SET UP aHeadings Array for column headings aHeadings := { "Numbers", "Letters", "Reverse" } // Need to set up individual array blocks for each TBrowse column aBlocks[ 1 ] := {|| Str( ar[ 1, nElem ], 2 ) } // prevent default 10 spaces aBlocks[ 2 ] := {|| ar[ 2, nElem ] } aBlocks[ 3 ] := {|| ar[ 3, nElem ] } // set up TestGet() as the passed Get Function so ft_ArEdit() knows how // to edit the individual gets. bGetFunc := {| b, ar, nDim, nElem | TestGet( b, ar, nDim, nElem ) } SetColor( "N/W, W/N, , , W/N" ) CLS ft_ArEdit( 3, 5, 18, 75, ar, @nElem, aHeadings, aBlocks, bGetFunc ) ``` -------------------------------- ### Prepare for Binary .zip and .exe Build on Windows Source: https://github.com/harbour/core/blob/master/README.md Set environment variables for NSIS directory, Info-ZIP directory, and enable package building. Then run the build as usual. ```bash $ set HB_DIR_NSIS=%ProgramFiles%\NSIS\ $ set HB_DIR_ZIP=C:\info-zip\ $ set HB_BUILD_PKG=yes Then run build as usual with `clean install` options. See: [How to Build](#how-to-build) ``` -------------------------------- ### Call DOS Get Current Directory Service using INT86 Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/cint86.txt This example shows how to call the DOS 'get current directory' service. It illustrates string parameter setup using a different offset register (DS:SI) and a pre-allocated buffer. ```harbour #include "ftint86.ch" LOCAL aRegs[ 10 ] aRegs[ AX ] := makehi( 71 ) aRegs[ DX ] := 0 aRegs[ DS ] := Space( 64 ) aRegs[ SI ] := REG_DS ft_int86( 33, aRegs ) ? aRegs[ DS ] ``` -------------------------------- ### TokenInit, TokenNext, TokenEnd, TokenExit Example Source: https://github.com/harbour/core/blob/master/contrib/hbct/doc/en/token2.txt Demonstrates the basic usage of TokenInit to initialize a token environment, TokenNext to retrieve tokens, TokenEnd to check for more tokens, and TokenExit to release the environment. ```APIDOC ## Token Initialization and Iteration ### Description Initializes a token environment, iterates through all tokens in a string, and then releases the environment. ### Usage ```apidoc TokenInit( cString ) DO WHILE ! TokenEnd() ? TokenNext( cString ) ENDDO TokenExit() ``` ### Example with specific token retrieval Retrieves a specific token from the string without advancing the token counter. ### Usage ```apidoc ? TokenNext( cString, 3 ) // get the 3rd token, counter will remain the same ``` ``` -------------------------------- ### Get Day of Year Data for Current Date Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/dayofyr.txt This example shows how to get day of year information for the current system date, specifying the day number. The function returns the actual date corresponding to the day number, along with the start and end dates of the year. ```harbour aDateInfo := ft_DayOfYr( , 90 ) // assume current date is 3/31/91 ? aDateInfo[ 1 ] // 1991-03-31 (90th day of year) ? aDateInfo[ 2 ] // 1991-01-01 ? aDateInfo[ 3 ] // 1991-12-31 ``` -------------------------------- ### COMInit, COMDetect, COMGetHardwareParameters Example Source: https://github.com/harbour/core/blob/master/src/3rd/hbpmcom/doc/com.txt Example demonstrating the typical use of COMInit() and COMDetect() for detecting COM port hardware parameters when COMPortOpen() is not intended for use. ```APIDOC ## COMInit, COMDetect, COMGetHardwareParameters Example ### Description This example shows a typical use of COMInit() as COMPortOpen() is not intended to be used here. COMDetect() can only be used when hardware parameters have been set (calling COMInit()) for the port and it is still not opened (or never opened). ### Code ```c /* COM ports hardware information */ #include #include "com.h" char *COMChipsets[5] = { "8250", "16450", "16550", "16550A", "N/A" }; void main(void) { int i; int nIRQ, nAddress; int nChip; if (!COMInit()) /* As COMPortOpen will not be used */ { printf("COMInit() failed!\n"); return; } printf(" chipset io IRQ\n"); printf("------------------------------------\n"); for (i = COM1; i <= COM2; ++i) { nChip = COMDetect(i); COMGetHardwareParameters(i, &nIRQ, &nAddress); printf("COM%d %-6s %4x %d\n", i + 1, COMChipsets[nChip - 1], nAddress, nIRQ); } } ``` ``` -------------------------------- ### Get Last Day of a Specific Month with ft_LDay() Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/lastday.txt Pass a date to ft_LDay() to get the last day of that month. For example, passing '1990-09-15' returns '1990-09-30'. ```Harbour ? ft_LDay( 0d19900915 ) // 1990-09-30 ``` -------------------------------- ### Example: Save, List Files, Restore Screen Source: https://github.com/harbour/core/blob/master/doc/en/terminal.txt Demonstrates saving the screen, performing an operation (listing files), and then restoring the screen to its previous state. ```shell SAVE SCREEN DIR *.* RESTORE SCREEN ``` -------------------------------- ### Create a subdirectory using the application path Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/mkdir.txt This example shows how to create a subdirectory named 'example' within the application's path using ft_MkDir(). It utilizes hb_ps() to get the path separator. ```harbour ? ft_MkDir( hb_ps() + "example" ) ``` -------------------------------- ### Add Shortcut Creation Example Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Includes an example demonstrating how to create shortcuts within the `testole.prg` file in the `hbwin` contrib module. ```prg + Added shortcut creation example. ``` -------------------------------- ### Compile Demo with Xbase++ Classes Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Instructions on how to compile a demo program that includes various committed classes, such as WvgHTMLViewer. ```bash hbmk_b32 -mt demoxbp ``` -------------------------------- ### Get Last Day of Current Month with ft_LDay() Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/lastday.txt Call ft_LDay() without arguments to get the last day of the current system month. For example, if the current month is March 1991, it returns '1991-03-31'. ```Harbour ? ft_LDay() // 1991-03-31 (current month) ``` -------------------------------- ### Get Current Default Drive Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/default.txt Use this snippet to retrieve the current default drive. No setup or imports are required. ```Harbour cDrive := ft_Default() ``` -------------------------------- ### INIT XCOMMAND Example Source: https://github.com/harbour/core/blob/master/ChangeLog.txt This code demonstrates a Harbour xcommand for initializing a component, with a simple Main function to execute it. It highlights a fix for a specific type of code that was previously problematic. ```harbour #xcommand INIT[] ; =>; ::New( ) function Main() INIT["test"] return nil ``` -------------------------------- ### Get BTree Key Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Retrieves the key from a B-Tree structure. No specific setup is required beyond having a valid B-Tree pointer. ```c const char * hb_BTreeKey( struct hb_BTree * pBTree ); ``` -------------------------------- ### Build Harbour Parts Example Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Documentation added to gmake.txt explaining how to build specific parts of Harbour, including Harbour only, tests only, and single test files using DOS build.bat. ```text + Added a new section under 'NOTES' discussing how to build only parts of Harbour, with examples for Harbour only and tests only and how to build a single test file using the DOS build.bat file. ``` -------------------------------- ### Example MT NETIO Server Implementation Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Provides a minimal example of how to create an MT NETIO server by compiling and linking the provided code with an MT HVM. ```c To create NETIO server is enough to compile and link with MT HVM this code: proc main() local pListenSocket ``` -------------------------------- ### Get Conventional Memory Size with ft_SysMem() Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/sysmem.txt Use ft_SysMem() to retrieve the installed conventional memory in KiB. This function requires no arguments. ```Harbour ? "Conventional memory:", hb_ntos( ft_SysMem() ), "KiB installed" ``` -------------------------------- ### Build Sample and Test Code Source: https://github.com/harbour/core/blob/master/extras/template/README.md Navigate to the tests directory and use hbmk2 to build the sample and test executables. ```bash $ cd tests $ hbmk2 sample ``` ```bash $ sample ``` ```bash $ hbmk2 test hbtest.hbc ``` ```bash $ test ``` -------------------------------- ### Get Day of Year - DoY() Source: https://github.com/harbour/core/blob/master/contrib/hbmisc/doc/en/dates.txt Calculates the day number within the year for a given date. For example, January 31st is day 31. ```harbour ? DoY( hb_SToD( "20000131" ) ) // -> 31 ? DoY( hb_SToD( "20000220" ) ) // -> 51 ``` -------------------------------- ### CLIPINIT() Source: https://github.com/harbour/core/blob/master/doc/en/hvm.txt Initializes various Harbour sub-systems at program startup. ```APIDOC ## CLIPINIT() ### Description Initializes various Harbour sub-systems, including the Get system and the default error handler. ### Syntax CLIPINIT() --> NIL ### Arguments None ### Returns * NIL ### Notes This function is automatically executed at program startup as part of the INIT PROCEDURE. ``` -------------------------------- ### Initial .NET IL implementation overview Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Provides initial, quick implementations to give an overview of .NET IL generation. A basic 'Hello.prg' example is confirmed to work on .NET. ```c Some quick & dirty implementations, to provide an IL overview ``` -------------------------------- ### Set INTENSITY Command Example Source: https://github.com/harbour/core/blob/master/doc/en/set.txt Toggles the enhanced display of PROMPTs and GETs. Use ON to enable highlighted display (inverse video) and OFF to disable it. The default condition is ON. ```harbour SET INTENSITY ON ``` -------------------------------- ### IDE Command Line Usage Examples Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Provides examples of how to launch the Harbour IDE (hbide.exe) from the command line with different arguments, including specifying project files and source files. ```Command Line C:\harbour\contrib\hbide>hbide.exe hbide.hbp ``` ```Command Line C:\harbour\contrib\hbide>hbide.exe idemisc.prg idethemes.prg ``` ```Command Line C:\harbour\contrib\hbide>hbide.exe C:\dev_hbmk\hbide.ini hbide.hbp ``` -------------------------------- ### Get Full Command Line Source: https://github.com/harbour/core/blob/master/ChangeLog.txt The HB_CMDLINE() function retrieves the complete command line used to start the application. It currently reassembles the command line from hb_argc and hb_argv. ```prg HB_CMDLINE() ``` -------------------------------- ### Display and Select Menu Options with MENU TO Source: https://github.com/harbour/core/blob/master/doc/en/menu.txt This example demonstrates how to display menu items in different screen corners and allows the user to select one using the MENU TO command. It shows how to handle the selection, including cases where the user presses Esc. ```harbour LOCAL nChoice // display menu item on each screen corner and let user select one CLS SET MESSAGE TO MaxRow() / 2 CENTER SET WRAP ON @ 0 , 0 PROMPT "1. Upper left" MESSAGE " One " @ 0 , MaxCol() - 16 PROMPT "2. Upper right" MESSAGE " Two " @ MaxRow() - 1, MaxCol() - 16 PROMPT "3. Bottom right" MESSAGE "Three" @ MaxRow() - 1, 0 PROMPT "4. Bottom left" MESSAGE "Four " MENU TO nChoice SetPos( MaxRow() / 2, MaxCol() / 2 - 10 ) IF nChoice == 0 ?? " was pressed" ELSE ?? "Selected option is", nChoice ENDIF ``` -------------------------------- ### Get Specific Quarter Info for Current Year Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/qtr.txt Retrieves information for the 2nd quarter of the current year. This example omits the date argument, defaulting to the current system date. ```harbour // get info about quarter 2 in current year (1991) aDateInfo := ft_Qtr( , 2 ) ? aDateInfo[ 1 ] // 199102 ? aDateInfo[ 2 ] // 1991-04-01 beginning of quarter 2 ? aDateInfo[ 3 ] // 1991-06-30 end of quarter 2 ``` -------------------------------- ### Build Dynamic Library with HBMK2 (PostgreSQL Example) Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Example of building a dynamic library using hbmk2, linking against the hbpgsql_dll and disabling hbmk.hbm processing. This showcases building with a database contrib. ```bash contrib\hbpgsql\tests\hbmk2 async.prg -lhbpgsql_dll -shared -autohbm- ``` -------------------------------- ### Build with GCC 3.3.4/3.3.5 on OS/2 hosts Source: https://github.com/harbour/core/blob/master/README.md Execute gccenv.cmd to set up the environment for GCC 3.3.4 and GCC 3.3.5 on OS/2. ```batchfile rem GCC 3.3.4 and GCC 3.3.5 C:\usr\bin\gccenv.cmd os2-make ``` -------------------------------- ### Replace Specific Occurrences of Substring Source: https://github.com/harbour/core/blob/master/doc/en/strtran.txt Replace a specified number of occurrences of a substring, starting from a given position. This example replaces the first two instances of double spaces with single spaces. ```Harbour ? StrTran( "Harbour Power The Future of xBase", " ", " " , , 2 ) ``` -------------------------------- ### Get Week Info for a Specific Date Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/week.txt Retrieves the year, week number, and the start and end dates for the week containing the specified date. Use hb_SToD() to convert a string to a date. ```harbour aDateInfo := ft_Week( hb_SToD( "19900915" ) ) ? aDateInfo[ 1 ] // 199037 (37th week) ? aDateInfo[ 2 ] // 1990-09-09 beginning of week 37 ? aDateInfo[ 3 ] // 1990-09-15 end of week 37 ``` -------------------------------- ### Test Harbour Build on Linux Source: https://github.com/harbour/core/blob/master/README.md Navigate to the tests directory and compile/run the 'hello.prg' example using hbmk2. Requires a successful build. ```bash $ cd tests $ hbmk2 hello.prg $ ./hello ``` -------------------------------- ### Get Month Info for a Specific Date Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/month.txt Retrieves year-month string, start date, and end date for the month containing the specified date. Defaults to the current system date if not provided. ```harbour aDateInfo := ft_Month( hb_SToD( "19900915" ) ) ? aDateInfo[ 1 ] // 199009 (9th month) ? aDateInfo[ 2 ] // 1990-09-01 beginning of month 9 ? aDateInfo[ 3 ] // 1990-09-30 end of week month 9 ``` -------------------------------- ### Test Harbour Build on Windows (Native) Source: https://github.com/harbour/core/blob/master/README.md Navigate to the tests directory and compile/run the 'hello.prg' example using hbmk2. Requires a successful build. ```batch > cd tests > ..\bin\hbmk2 hello.prg > hello ``` -------------------------------- ### Converting Array to Function Parameters with hb_ArrayToParams() Source: https://github.com/harbour/core/blob/master/doc/xhb-diff.txt Demonstrates the Harbour-specific hb_ArrayToParams() function, which converts an array into a list of parameters suitable for function calls or array indexing. This example filters out parameters starting with '--'. ```Harbour proc main( ... ) local aParams := hb_AParams(), n /* remove parameters starting with "--" */ n := 1 while n < Len( aParams ) if Left( aParams[ n ], 2 ) == "--" hb_ADel( aParams, n, .t. ) else ++n endif enddo ? "Public parameters:", hb_ArrayToParams( aParams ) return ``` -------------------------------- ### Build Application Using Project File Source: https://github.com/harbour/core/blob/master/utils/hbmk2/doc/hbmk2.en.md Build an application defined by a .hbp project file. ```bash $ hbmk2 myapp.hbp ``` -------------------------------- ### hbmk2 Plugin Replacement Example Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Demonstrates how to use hbmk2 as a plugin replacement for Clipper, RTLink, Blinker, and Exospace by renaming the executable. This allows existing build scripts to be used with hbmk2. ```bash copy hbmk2.exe clipper.exe copy hbmk2.exe rtlink.exe clipper hello.prg echo OUT myhello FI hello > rtl.lnk rtlink @rtl.lnk ``` -------------------------------- ### Get Current Program Path with ft_Origin() Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/origin.txt Use ft_Origin() to retrieve the full path and filename of the currently executing program. This example checks if the program's filename is not 'myapp.exe' and displays an error if it's not. ```Harbour IF !( hb_FNameNameExt( ft_Origin() ) == "myapp.exe" ) ? "Incorrect startup file. Please remove/rename and start again" RETURN ENDIF ``` -------------------------------- ### Build with Open Watcom C/C++ on OS/2 hosts Source: https://github.com/harbour/core/blob/master/README.md Configure environment variables for Open Watcom C/C++ including WATCOM, PATH, BEGINLIBPATH, EDPATH, INCLUDE, HELP, and BOOKSHELF for OS/2 builds. ```batchfile rem Open Watcom C/C++ SET WATCOM=C:\watcom SET PATH=%WATCOM%\BINP;%WATCOM%\BINW;%PATH% SET BEGINLIBPATH=%WATCOM%\BINP\DLL SET EDPATH=%WATCOM%\EDDAT SET INCLUDE=%WATCOM%\H;%WATCOM%\H\OS2 SET HELP=%WATCOM%\BINP\HELP;%HELP% SET BOOKSHELF=%WATCOM%\BINP\HELP;%BOOKSHELF% os2-make ``` -------------------------------- ### Get Specific Month Info for Current Year Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/month.txt Retrieves year-month string, start date, and end date for a specific month number in the current year. Defaults to the current system date if not provided. ```harbour aDateInfo := ft_Month( , 5 ) ? aDateInfo[ 1 ] // 199105 ? aDateInfo[ 2 ] // 1991-05-01 beginning of month 5 ? aDateInfo[ 3 ] // 1991-05-31 end of month 5 ``` -------------------------------- ### Initialize and Detect COM Port Hardware Source: https://github.com/harbour/core/blob/master/src/3rd/hbpmcom/doc/com.txt This example demonstrates a typical use of COMInit() and COMDetect(). COMDetect() should only be used after COMInit() has set hardware parameters and the port is not yet opened. ```c /* COM ports hardware information */ #include #include "com.h" char *COMChipsets[5] = { "8250", "16450", "16550", "16550A", "N/A" }; void main(void) { int i; int nIRQ, nAddress; int nChip; if (!COMInit()) /* As COMPortOpen will not be used */ { printf("COMInit() failed!\n"); return; } printf(" chipset io IRQ\n"); printf("------------------------------------\n"); for (i = COM1; i <= COM2; ++i) { nChip = COMDetect(i); COMGetHardwareParameters(i, &nIRQ, &nAddress); printf("COM%d %-6s %4x %d\n", i + 1, COMChipsets[nChip - 1], nAddress, nIRQ); } } ``` -------------------------------- ### Get Accounting Quarter Info for a Specific Date Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/acctqtr.txt Retrieves accounting quarter details for the date 1990-09-15. The output shows the year and quarter string, the start date of the quarter, and the end date of the quarter. ```harbour aDateInfo := ft_AcctQtr( hb_SToD( "19900915" ) ) ? aDateInfo[ 1 ] // 199003 (3rd quarter) ? aDateInfo[ 2 ] // 1990-07-01 beginning of quarter 3 ? aDateInfo[ 3 ] // 1990-09-29 end of quarter 3 ``` -------------------------------- ### Performance Counter Measurement Example Source: https://github.com/harbour/core/blob/master/ChangeLog.txt This snippet demonstrates how to measure performance using WAPI_QueryPerformanceCounter. It calculates the total time elapsed in seconds by subtracting the start counter value from the end counter value and converting it to seconds. ```C WAPI_QueryPerformanceCounter( @nCounterEnd ) ? "total time:", ; WIN_QPCOUNTER2SEC( nCounterEnd - nCounterStart ), "sec." ``` -------------------------------- ### Demonstrate XbpBitmap Class Usage Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Provides a demonstration of how to use the XbpBitmap() class for image conversion within the demoxbp.prg example. ```prg + Demonstrated the use of XbpBitmap() class as a image conversion ``` -------------------------------- ### Build Dynamic Library with HBMK2 (Blat Example) Source: https://github.com/harbour/core/blob/master/ChangeLog.txt Example of building a dynamic library using hbmk2, linking against hbblat_dll and hbwin_dll, and disabling hbmk.hbm processing. This may encounter application errors. ```bash contrib\hbblat\tests\hbmk2 blatcmd.prg -lhbblat_dll -lhbwin_dll -shared -autohbm- ``` -------------------------------- ### Get Accounting Month Info for a Specific Date Source: https://github.com/harbour/core/blob/master/contrib/hbnf/doc/en/acctmnth.txt Use this snippet to retrieve the accounting month details for a given date. The function returns the year-month string, the start date, and the end date of the accounting month. ```harbour aDateInfo := ft_AcctMonth( hb_SToD( "19900915" ) ) ? aDateInfo[ 1 ] // 199009 (9th month) ? aDateInfo[ 2 ] // 1990-09-02 beginning of month 9 ? aDateInfo[ 3 ] // 1990-09-29 end of month 9 ``` -------------------------------- ### Harbour to Delphi Integration Setup Source: https://github.com/harbour/core/blob/master/ChangeLog.txt This section details the addition of files and directories for integrating Harbour with Delphi. It includes batch files for building DLLs, example PRG and C files, and Delphi project files. ```batch + Added contrib\delphi dir + Added contrib\delphi\hbdll dir + Added contrib\delphi\hbdll\start.bat + Added contrib\delphi\hbdll\bld_sdll.bat + Added contrib\delphi\hbdll\myprog.prg + Added contrib\delphi\hbdll\macrcall.c + Added contrib\delphi\hbdll\errorsys.prg + Added contrib\delphi\hbdll\easypath.dpr + Added contrib\delphi\hbdll\main.pas ```