HMG 3.6 (64 bit version)

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.6 (64 bit version)

Post by srvet_claudio »

branislavmil wrote: Thu Feb 20, 2025 6:44 pm Dear colleagues,
does anyone know why,
for example, msgdebug() works like this if the ctxt variable has chr(240)?

procedure taguredjaj
ctxt:="TAG URE"+chr(240)+"AJ"

msgdebug( len(ctxt), ctxt) && 10, "TAG URE
msgdebug( ctxt, len(ctxt)) && "TAG URE

strfile(ctxt, "tag.txt") && tag.txt: TAG UREđAJ

return
Hi,
HMG is compile for default in Unicode character set.
Change ANSI string functions like len, chr, etc for ANSI/UNICODE functions (see HMG UNICODE in documentation)

Code: Select all

        ANSI/UNICODE                     ANSI Only
-          HMG_LEN()             <=>   LEN()

-          HMG_LOWER()           <=>   LOWER()

-          HMG_UPPER()           <=>   UPPER()

-          HMG_PADC()            <=>   PADC()

-          HMG_PADL()            <=>   PADL()

-          HMG_PADR()            <=>   PADR()

-          HMG_ISALPHA()         <=>   ISALPHA()

-          HMG_ISDIGIT()         <=>   ISDIGIT()

-          HMG_ISLOWER()         <=>   ISLOWER()

-          HMG_ISUPPER()         <=>   ISUPPER()

-          HMG_ISALPHANUMERIC()  <=>   RETURN (ISALPHA(c) .OR. ISDIGIT(c))

 

-          (*) HB_USUBSTR()      <=>   SUBSTR()

-          (*) HB_ULEFT()        <=>   LEFT()

-          (*) HB_URIGHT()       <=>   RIGHT()

-          (*) HB_UAT()          <=>   AT()

-          (*) HB_UTF8RAT()      <=>   RAT()

-          (*) HB_UTF8STUFF()
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.6 (64 bit version)

Post by srvet_claudio »

Rathinagiri wrote: Wed May 10, 2023 12:06 pm Dear HMG friends,

Thanks to Girigory a default 64 bit only version of HMG is created and I am sharing the setup file for your testing and comments.

Please download from here.
Hi Rathi,
in this version is missing HMG documentation and many examples. Only the basic examples are available.
Best regards,
Claudio
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
branislavmil
Posts: 10
Joined: Sat Sep 29, 2018 3:36 pm
DBs Used: DBF

Re: HMG 3.6 (64 bit version)

Post by branislavmil »

Hello Claudio,
thank you very much for the answer.
I misstated the problem.
If we have the character chr(240) entered in the table field, we have a problem, because we cannot work with the entire entry of the value of that field, ie, for example, the display or printing of that field is bad, nothing is displayed after chr(240).
Why is this happening?

procedure WhereIsEnd
local ctxt:="START..."+chr(240)+"...END"
msgbox("Len ctxt is OK(15): "+str(len(ctxt)))

CreateDBF("test")
use test excl
zap
append blank
replace field1 with ctxt && FIELD1 IS OK WROTES

alert(field1) && RESULT ONLY: START...
msgbox(field1) && RESULT ONLY: START...

alert(field1+"LONG TEXT NOT VIEW") && RESULT ONLY: START...
msgbox(field1+"NOT VIEW NOTHING AFTER CHR(240), WAY ?") && RESULT ONLY: START...

msgbox("Len field1 is OK(15): "+str(len(alltrim(field1))))

return


function CreateDBF(cdbf)
local aDbf := {}
if !file("test.dbf")
aadd(adbf, {"field1", "C", 20, 0})
dbcreate(cdbf, adbf)
endif
return
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.6 (64 bit version)

Post by srvet_claudio »

branislavmil wrote: Wed Mar 26, 2025 4:02 pm If we have the character chr(240) entered in the table field, we have a problem, because we cannot work with the entire entry of the value of that field, ie, for example, the display or printing of that field is bad, nothing is displayed after chr(240).
Why is this happening?
Hi,
Because chr() inserts a byte into the string, but unicode is multibyte. Inserting a single byte causes the string encoding to be incorrect.

change:
chr() for HB_UCHAR( <nCode> )
len() for HMG_LEN()

See HMG UNICODE in documentation

Best regards,
Claudio
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
edk
Posts: 997
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: HMG 3.6 (64 bit version)

Post by edk »

@branislavmil
As Claudio mentioned, in Unicode you can't correctly use a single character Chr( 240 ). Using the byte Chr(240) in Unicode forces a switch to a block of characters from point U+10000 to U+323AF.
After the character Chr( 240 ) Unicode expects three more bytes, value over 127 each.
Take a look at this link: https://utf8-chartable.de/unicode-utf8- ... 4&utf8=dec

The character Chr(240) can look different depending on the code page used, if you want to show it in Unicode you have to "translate" it.

See the code below, where the application switches between different code pages and displays a string containing Chr( 240 ).
For UTF the "translation" of this string is also shown.

Code: Select all

#include "hmg.ch"
#include "hbextcdp.ch"

PROCEDURE Main()
Local cString := "START..." + Chr( 240 ) + "...END"

AEVAL( hb_cdpList(), { |x| IF ( GetKeyState ( VK_ESCAPE ) >= 0, (;
                           set( _SET_CODEPAGE, x ), ;
                           MsgInfo ( "Codepage: " + hb_cdpSelect() + IF ( Left ( x, 3 ) <> "UTF", " ( " + hb_cdpUniID( hb_cdpSelect() ) + " )", "" ) + CRLF + ;
                           IF ( Left ( x, 3 ) = "UTF", ;
                                     "Unicode string: " + hb_strToUTF8( cString , "EN" /* <cFromCPID> */ ) + CRLF , ;
                                     "" ) + ;
                                     "String: " + cString, "Press Escape to Cancel" ) ), Nil ) } )

RETURN 
branislavmil
Posts: 10
Joined: Sat Sep 29, 2018 3:36 pm
DBs Used: DBF

Re: HMG 3.6 (64 bit version)

Post by branislavmil »

Dear colleagues, thank you very much.
I learned a lot from your answers.

It was enough to put, for example, a line at the beginning of the procedure:
SET( _SET_CODEPAGE, "SLWIN" )
when reading a dbf table field that had the character chr(240)
for display and further processing.

OR use:

ctxt:="START..."+HB_UCHAR(240)+"...END".
for entering the variable in the table field and later correct display.
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.6 (64 bit version)

Post by srvet_claudio »

srvet_claudio wrote: Sat Mar 22, 2025 3:51 pm
Rathinagiri wrote: Wed May 10, 2023 12:06 pm Dear HMG friends,

Thanks to Girigory a default 64 bit only version of HMG is created and I am sharing the setup file for your testing and comments.

Please download from here.
Hi Rathi,
in this version is missing HMG documentation and many examples. Only the basic examples are available.
Best regards,
Claudio
Hi Rathi,
solution:

1) Replace the SAMPLES folder of the HMG.3.6 with the SAMPLES folder of the HMG.3.4.4.
2) In c:\hmg.3.6 folder, rename the build.bat file to build32.bat, and then rename the build64.bat file to build.bat.
3) Then compile the examples as normal with the build.bat file that accompanies each example.
4) Copy the DOC folder of the hmg.3.4.4 into c:\hmg.3.6

Regards,
Claudio
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.6 (64 bit version)

Post by srvet_claudio »

Hi all,
I have developed a new patch for hmg.3.6 with the following modifications:

Code: Select all

-HMG 3.6.1 2025/04/12 (Contributed by Dr. Claudio Soto)
   - To compile in 64 bit you can now call build64.bat or build.bat
   - It was set to default the IDE to build in 64 bit
   - The HMG IDE source code was added to the folder SOURCE\HMG_IDE_SourceCode
   - HMG documentation is full added (absent in the previous version)
   - Added full HMG samples (several samples were missing in the previous version)
   - New HB_WebView cross-platform library (SOURCE\HB_WebView), see documentation
   - New HB_WebView demos (SAMPLES\HB_WebView)
      - Demos written in pure Harbor (cross-platform demos):
         demo1.prg - Web browsing in Harbour
         demo2.prg - Binding Harbour functions (calling HB functions from Javascript)
         demo3.prg - Inspecting DBF files with Javascript
         demo4.prg - Injecting PRG code written entirely in Harbour from JavaScript
         demo5.prg - Querying SQLite from Javascript
         demo6.prg: You can navigate the directory tree and open files that are in the list of allowed extensions (new instances of HB_WebView are created entirely from Javascript code).
      - Demos in HMG:
         demo hmg.prg - is an integration of the previous examples integrated into the HMG environment (Windows platform demo)
Please unzip the attached patch to the C:\hmg.3.6 folder.
It is ready to use, you do not need to rebuild the libraries.
Attachments
hmg.3.6_patch1.rar
(14.91 MiB) Downloaded 228 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
serge_girard
Posts: 3308
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: HMG 3.6 (64 bit version)

Post by serge_girard »

Thanks Claudio !
There's nothing you can do that can't be done...
chrisjx2002
Posts: 192
Joined: Wed Jan 06, 2010 5:39 pm

Re: HMG 3.6 (64 bit version)

Post by chrisjx2002 »

Thanks Claudio!
Post Reply