First let me say that I was going to wait until tomorrow to upload this, so that
the version matched the date but my internet service provider sucks so badly lately
that I was concerned that I might not have internet service tomorrow.
BCX 8.2.8 has been uploaded.
This update includes new features, improvements and a couple of bug fixes.
https://bcxbasiccoders.com/archives/YahooGroups/Bcx_Files_New/Bcx828.zip
SHA-256
07af25e3ab860088f34797c70cc5797c238c76aae7cc614e38bd398f32e375bb
Revisions:
*********************************************************************************************
2025/08/27 Changes in 8.2.8 from 8.2.7
*********************************************************************************************
Kevin Diggins : BCX 8.2.8 cannot be built using BCX 8.2.7. If you want to build 8.2.8, you
must use the executable or the bootstrap file provided in the BCX 8.2.8 zip.
****************************************************************************
Kevin Diggins : Built with the latest LLVM/Clang compiler 21.1.0 (released yesterday)
Kevin Diggins : NEW! Added the freeing of LOCAL DYNAMIC STRING ARRAYS in SUBS and FUNCTIONS:
When translated, the following example will now include the necessary
c/c++ code that releases the dynamic (heap) memory back to the pool.
PRINT TestFunc$("Everything is possible")
PAUSE
FUNCTION TestFunc$ (MyArg$)
DIM DYNAMIC DynArray1$ [10, 10] ' 10 x 10 x 2048 = 204,800 bytes
DIM DYNAMIC DynArray2$ [10, 10] ' 10 x 10 x 2048 = 204,800 bytes
DIM DYNAMIC DynArray3$ [10, 10] ' 10 x 10 x 2048 = 204,800 bytes
DynArray1$[5, 5] = MyArg$ ' ================= ^^^^^^^^^^^^^
FUNCTION = DynArray1$[5, 5]
END FUNCTION
Kevin Diggins : NEW! Added the freeing of LOCAL DYNAMIC NON-STRING ARRAYS in SUBS and FUNCTIONS:
When translated, the following example will now include the necessary C/C++
code that releases the dynamic (heap) memory back to the pool.
NOTE: This improvement only works with plain C code. It won't work with C++
code that -REQUIRES- a C++ compiler. In that case, "FUNCTION =" should -NOT-
include references to dynamic arrays because those will be destroyed before the
FUNCTION can fetch the data. C++ templates, references, and other features not
allowed in plain C limited my ability to include those in my new algorithm.
PRINT TestFunc (PI)
PAUSE
FUNCTION TestFunc (TheOne AS DOUBLE) AS DOUBLE
DIM DYNAMIC DynArray[10, 10] AS DOUBLE
DynArray[5, 5] = TheOne
FUNCTION = DynArray[5, 5] + 1 + 2 + 3
END FUNCTION
Kevin Diggins : NEW! Added GetSaveAsFileName$() to the BCX lexicon. GetSaveAsFileName$ uses
the "modern" Windows dialog control to give us a Filename fetcher somewhat
modeled after the GETFILENAME$() function. It is Windows theme aware, and
provides the user interface for where you want to create a file. It returns
the path & filename$ chosen by the user, as well as the index number of the
file encoding that the user has selected. What you do with that information
is entirely up to you. This function does not create files, it tells you
what kind of file that your user wants to create.
*** I will share my ENCODING file that I wrote for BED. I thinks it's important
to keep that file in a text format for any future enhancements / corrections.
NOTE WELL: Lcc-Win32 cannot compile the runtime code for this function.
******************************************************************************
GetSaveAsFileName$ (Title$,
FileTypes$
[, Un-Used%] ( value is ignored internally )
[, Owner_hWnd] ( Can be NULL or any valid HWND )
[, OFN Flags] ( See Microsoft OPENFILENAME flags )
[, InitDir$] ( CURDIR$ is a good choice )
[, InitFname$] ( Starting Filename, like "*.txt" )
[, BYREF EncodeNdx%] ( Read more below ...
)
EncodeNdx% receives the Encoding Type from the Combobox ( Type = 0 to 4 )
0 = UTF8 1 = UTF8 w/BOM 2 = UTF16-LE 3 = UTF16 BE 4 = ANSI
Here is a console mode EXAMPLE:
******************************************************************************
DIM fmask$, FileName$, MyEncodingIndex
fmask$ = "BCX Source Files (*.bas *.inc)|*.bas;*.inc|"
fmask$ = fmask$ + "C/C++ Source Files (*.c *.c++)|*.c;*.cpp|"
fmask$ = fmask$ + "Resource Files (*.rc)|*.rc|"
fmask$ = fmask$ + "Text Files (*.txt)|*.txt|"
fmask$ = fmask$ + "All Files (*.*)|*.*"
FileName$ = GETSAVEASFILENAME$("My Caption", fmask$, 0, 0, 0, CURDIR$, "*.*", &MyEncodingIndex)
PRINT : PRINT "You Selected: ", FileName$, " with ";
SELECT CASE MyEncodingIndex
CASE 0 : PRINT "UTF-8";
CASE 1 : PRINT "UTF-8 with BOM";
CASE 2 : PRINT "UTF-16 LE";
CASE 3 : PRINT "UTF-16 BE";
END SELECT
PRINT " encoding."
PAUSE
******************************************************************************
Kevin Diggins : NEW! Added "ANY" versions of the EXTRACT$() function. Examples:
PRINT EXTRACT$ ("LongFileName.ext", ANY "_.,]") ' Output: LongFileName
PRINT EXTRACTANY$ ("LongFileName.ext", "_.,]") ' Output: LongFileName
Kevin Diggins : NEW! BCX allows FreeBasic's FOR-NEXT iterator syntax: FOR i AS LONG = 1 to 10
Kevin Diggins : NEW! Added PowerBasic compatible string functions: Utf8ToChr$() and ChrToUtf8$()
for converting between UTF-8 strings and ANSI strings.
EXCEPTION: Does -NOT- work with the MINGW compiler.
Example:
*****************************************************
DIM AS STRING utf8, ansi
SetConsoleOutputCP(65001) ' Important - set the UTF-8 code page !
utf8 = CHR$(&HC3) + CHR$(&HA9) ' UTF-8 for the "é" character
ansi = UTF8TOCHR$(utf8)
PRINT "ANSI string: ", ansi
ansi = "Résumé"
utf8 = CHRTOUTF8$(ansi) ' Easily convert a string
PRINT "UTF-8 string: ", utf8
' *************
' OUTPUT
' *************
' ANSI string: é
' UTF-8 string: Résumé
Kevin Diggins : IMPROVED: The built-in RUN command was never able to process file redirection.
If we needed file redirection, we were forced to use the SHELL command which
had the unpleasant side effect of displaying a COMMAND PROMPT window.
The new RUN command now properly handles file redirection, like this simple example:
*************************************************
IF EXIST("Output.txt") THEN KILL "Output.txt"
RUN "dir *.* > Output.txt", SW_HIDE, TRUE
IF EXIST("Output.txt") THEN
MSGBOX "Success!"
ELSE
MSGBOX "Failed"
END IF
*************************************************
Kevin Diggins : IMPROVED: SLEEP runtime function. SLEEP now has 1 millisecond accuracy.
Kevin Diggins : IMPROVED: the ROUND() runtime function. Works consistently with all compilers.
Kevin Diggins : IMPROVED: the thread-safety and performance of internal BCX_TempStr() function
Kevin Diggins : IMPROVED: the LookAhead$() and EoF() runtime functions.
Kevin Diggins: CHANGED: the UprCase and LowCase initialization. Both point to statically
allocated arrays, so there was never a need for using calloc().
Kevin Diggins : CHANGED: I needed to change the emitted name of the SHOW() macro to SHOWHWND.
I also changed HIDE() to HIDEHWND() for consistency.
My changes require NO CHANGES TO YOUR CODES. BCX handles everything internally.
One of the new BCX features uses a Microsoft object method named "->Show()",
which stubbornly conflicted with the SHOW (hWnd) macro.
Kevin Diggins : CHANGED: When the percent symbol "%" is used within a USING$ format string,
the return string will be the (2nd argument x 100) expressed as a percentage.
For example: PRINT USING$("###.##%", 0.45678) ' Output -->>> 45.68%
Kevin Diggins : CHANGED: When the Sci Notation symbol "^" is used within a USING$ format
string, it must be the left-most character in that string, in order to return
the correct number of decimal places in the function return.
For example: PRINT USING$("^##.####", 123456.789) ' Output -->>> 1.2346E+05
Kevin Diggins : CHANGED: Simplified the default BCX_FORM styles to:
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS
Previous styles were redundant and conflicted. NO CHANGES TO YOUR CODE ARE NEEDED.
Kevin Diggins : BUG FIX: FREEFILE had a memory leak. BCX's new implementation of the FREEFILE
function simply returns a null FILE PTR. When we OPEN files for reading/writing,
BCX gives Windows a FILE PTR variable. When Windows receives that variable, it
automatically fills a special data structure with metadata about that file.
That metadata is used for all subsequent operations on that file while that
file remains open. NO CHANGES TO YOUR CODE ARE NEEDED.
Kevin Diggins : BUG FIX: Rare edge case in the parser handling the "+=" strcat operator
Kevin Diggins : Ongoing formatting improvements to the source, output and runtime code
I re-uploaded Bcx828 and updated its SHA256 code here:
https://bcxbasiccoders.com/smf/index.php?topic=1393.msg7634#msg7634
There were problems with the new GetSaveAsFileName() function which have been corrected.
If you're not interested in that function, there is no need to re-download.
FRIDAY August 29, 2025
I re-uploaded Bcx828 and updated its SHA256 code here:
https://bcxbasiccoders.com/smf/index.php?topic=1393.msg7634#msg7634
There was problem with FUNCTIONS that return a literal scientific notation number which has been corrected.
If that doesn't affect you, there is no need to re-download.
👍😁