Happy new year 2017!

55 views
Skip to first unread message

Guy1954

unread,
Nov 30, 2016, 12:42:27 PM11/30/16
to xblite
Hi Xbliters.

Tomorrow is the first day of December 2016. Time for me to post here my season’s greeting 2016!

I wish you a happy new year 2017!

As I did every year for the past decade, I also attached an XBLite application that I coded for sheer fun; please find attached an analog clock that I coded for the occasion. Just note that, instead of using XBLite standard math library, I decided to use Xmal.dll, that ALAN GENT released December 2010.

In order to install Xmal.dll in your XBLite run-time environment, I added MakeXmalLib.bat, a batch file that you might have to customize to your setting (SET XBLDIR=C:\xblite assumes that XBLite directory is C:\xblite).

However, I am not too satisfied to ask you to install the library Xmal this way: I failed to use the static version (Xmal_s.lib) and I can’t figure why. So, if you find a way to create a working  Xmal_s.lib, let me know because I’m running out of ideas.

Bye! Guy

PS. Alan, if you read this, a big thank you for your contribution; I hope your library will be put into use more ofter in the futur.
Message has been deleted

Guy1954

unread,
Nov 30, 2016, 12:45:51 PM11/30/16
to xblite
Attached is NewYear2017.zip
@ECHO OFF
SET SRC=xmal

rem Assumes that XBLite directory is C:\xblite.
SET XBLDIR=C:\xblite
rem ===========================================

SET PATH=%XBLDIR%\bin;%PATH%

ECHO build %SRC%.dll

rem save original %SRC%* into .\old
mkdir .\old
copy %XBLDIR%\include\%SRC%.dec .\old
copy %XBLDIR%\lib\%SRC%.lib .\old
copy %XBLDIR%\programs\%SRC%.dll .\old

rem save original %SRC%_s* into .\old
copy %XBLDIR%\include\%SRC%_s.dec .\old
copy %XBLDIR%\lib\%SRC%_s.lib .\old

mkdir .\bak
copy .\%SRC%.x .\bak

rem clean up before re-building
del .\%SRC%.*
del .\%SRC%_s.*
pause

copy .\bak\%SRC%.x .\

rem build the dynamic library
ECHO Y | %XBLDIR%\bin\xblite .\%SRC%.x -lib
%XBLDIR%\bin\xmake -f %SRC%.mak all clean

rem copy back what was created by xmake
copy %XBLDIR%\include\%SRC%.dec .\
copy %XBLDIR%\lib\%SRC%.dll .\

rem build the static library
ECHO.

del %XBLDIR%\include\%SRC%_s.dec
del %XBLDIR%\lib\%SRC%_s.lib

%XBLDIR%\bin\buildlib.exe %SRC%.x

rem copy back what was created by buildlib
copy %XBLDIR%\include\%SRC%_s.dec .\
copy %XBLDIR%\lib\%SRC%_s.lib .\

rem clean up
del .\%SRC%.bat
del .\%SRC%.def
del .\%SRC%.exp
del .\%SRC%.obj
del .\%SRC%.rbj
del .\%SRC%.res

RMDIR .\static

ECHO LIBRARY BUILT

PAUSE

NewYear2017.zip

David Szafranski

unread,
Nov 30, 2016, 4:58:02 PM11/30/16
to xbl...@googlegroups.com
Thanks Guy!

Not sure why the Xmal static library doesn't work, may due to a lot of direct ASM code within
the library.

Also the second hand on the clock isn't moving, so I found that the value for second is
remaining zero. So in SUB SetCurrentTime you need to change

second = SLONG (MID$ (time$, 7, 2))

and all works!

ciao,

David

Guy1954 wrote:
--
You received this message because you are subscribed to the Google Groups "xblite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xblite+un...@googlegroups.com.
To post to this group, send email to xbl...@googlegroups.com.
Visit this group at https://groups.google.com/group/xblite.
For more options, visit https://groups.google.com/d/optout.

Guy1954

unread,
Dec 1, 2016, 4:12:01 PM12/1/16
to xblite
Hi D.

The line "second = SLONG (RIGHT$ (time$, 2))" compiles fine in my machine. Could it be the xblite.x version that we use?

I just posted my latest revision 16 of xblite.x and you might have a case where an earlier version of it yields a different source.asm.

I tried to mark all the changes I made, but you can also use winmerge (SourceForge) to spot all the coding differences, the main is the use of EXPLICIT as a safeguard.

I did this because I am working on implementing an XBLite support of the UTF-16 LE version of the Unicode standard, in addition to the current ASCII support. Part of it is to parse properly the new string type (easy), the challenge being to generate the proper assembly code. And boy! Do I struggle with this challenge: since I have to code a Unicode version of the already coded ASCII version, the assembly noob that I am moves quite slowly but (so it seems) surely.

I submit to your approval my addition of 3 new features : [CODE, END CODE], GRAB "some text file" with some text replacement facilities and STRIP to rid of "uncalled" internal functions.

I tested heavily these new features and I am confident that they are mature.

But, allow me to forget XBLite for a moment, and wish you a happy new year 2017 to you and your loved Ones.

Best regards,
Guy

David Szafranski

unread,
Dec 1, 2016, 6:14:01 PM12/1/16
to xbl...@googlegroups.com
Hi Guy,

Using the time formatting string

format$ = "hh\':\'mm\':\'ss tt"

will always have an output time$ string like this:

11:29:40 PM

using RIGHT$ (time$, 2) on time$ above always gets you "PM".

So I need to use

second = SLONG (MID$ (time$, 7, 2))

to get the correct value for second.

If you are not getting a time$ like "11:29:40 PM" then your error
is perhaps in how your version of xblite is handling strings.

ciao,

David



Guy1954 wrote:

Guy1954

unread,
Dec 2, 2016, 6:35:20 AM12/2/16
to xblite
Hi D.

You nailed it: it is simply because I'm running Windows 10 with the FRENCH locale!

In France, we don't use AM or PM, but the time format called "military time".

Sorry for this oversight, and thank you to try my cute, little and funny application.

Bye! Guy

Guy1954

unread,
Dec 2, 2016, 8:16:38 AM12/2/16
to xblite
Here is my correction:

SUB SetCurrentTime

' DS-02dec16-deleted---
'    format$ = "hh\':\'mm\':\'ss tt"
'    szBuf$ = NULL$ (24)
' DS-02dec16---
' DS-02dec16-re-coded+++

    format$ = "hh\':\'mm\':\'ss"
    szBuf$ = NULL$ (LEN (format$))
' DS-02dec16+++
    ret = GetTimeFormatA (0, $$TIME_FORCE24HOURFORMAT, 0, &format$, &szBuf$, LEN (szBuf$))

    time$ = CSIZE$ (szBuf$)

    ' set time$ in window titlebar
    SetWindowTextA (#winMain, &time$)

    ' hour, minute, second
    ? "time$ = <"; time$; ">"
    hour = SLONG (LEFT$ (time$, 2))
    minute = SLONG (MID$ (time$, 4, 2))

    second = SLONG (RIGHT$ (time$, 2))
    ? "hour ="; hour; ", minute ="; minute; ", second ="; second

END SUB

David Szafranski

unread,
Dec 2, 2016, 3:56:29 PM12/2/16
to xbl...@googlegroups.com
Hi Guy,

By any chance do you have the original xmal.7z file that Alan Gent posted. I cannot find it
and I was interested in knowing if he had any help files to go along with his math library.
I would also like to repost this library on the xblite forum.

thanks,

David

Guy1954 wrote:

gentsky

unread,
Dec 3, 2016, 9:42:33 AM12/3/16
to xblite
Hi Guy and D.

I have been looking at the problem you had with building a static library from xmal. I found that buildlib highlighted 4 errors which caused the build to fail. They were all unresolved references which did not cause any problem when building the dll. The references were always within hand crafted assembly where I had referenced an xblite generated assembly language label for an input parameter or local variable. I replaced these with their defined values like [ebp + 8] and then successfully built a static library. I then used this to recompile Guy's clock after uncommenting the Xmal() initialisation and it worked fine.

There is a comprehensive .chm help file for Xmal. I seem to remember that google is strict on what type of files we can attach. I would like to upload the latest version of xmal.x and xmal.chm but will wait for an OK from you before I do.

Alan

.  

David Szafranski

unread,
Dec 3, 2016, 2:08:26 PM12/3/16
to xbl...@googlegroups.com
Hi Alan,

I would like to post your library on the xblite.com forum so you could send the files to me, or
post them yourself here:

http://www.xblite.com/forum/b-files/

If I ever update xblite I will include your xmal library in the package (along with many of your
other projects!).

David

Guy1954

unread,
Dec 5, 2016, 11:08:33 AM12/5/16
to xblite
Hi Alan,

Since you downloaded the file NewYear2017.zip, you will find inside a slightly modified xmal.x.

You can easily spot my corrections using WinMerge.

I made mainly, two corrections:

1.I added the EXPLICIT directive, in order to catch typos, and I did catch one:

FUNCTION LONGDOUBLE Logb (LONGDOUBLE x, LONGDOUBLE b)
'returns log base b of x

    #FUNC_NUM = 33
    IF #TRACE THEN
ASM call %_XmalTrace
    ENDIF

ASM call %_TestArg1isNAN
ASM jnc >
    RETURN x
ASM :
ASM call %_TestArg2isNAN
ASM jnc >
    RETURN b
ASM :

    IF x <= 0## THEN RETURN NqNAN()
    IF b = 1## THEN RETURN NqNAN()
'------------------------------------------------------------------------------
' *** TYPO ***
    ' GL-IF b <=0 THEN RETURN NqNAN
    IF b <=0 THEN RETURN NqNAN()
'------------------------------------------------------------------------------

    RETURN (Log2(x) / Log2(b))

END FUNCTION


2.I corrected also an assembly label typo:

'------------------------------------------------------------------------------
' *** TYPO ***
' GL-18nov16-ASM jmp > end.Product.xmal  ;;; function end label for Assembly Programmers
ASM jmp > exit_label  ; GL-18nov16-bug correction: replacing end.Product.xmal
'------------------------------------------------------------------------------
badReturn:                                    'if exception occurs, return INF(+1)
ASM fld        t[pinf]

ASM exit_label:  ; GL-18nov16-replaces end.Product.xmal

    END SUB
'------------------------------------------------------------------------------


Good to hear from you again, Alan,
and happy new year to you!

Bye! Guy

Guy1954

unread,
Dec 5, 2016, 11:28:17 AM12/5/16
to xblite
Hi Alan,

I think that D.'s XBLite Forum could be a good place to post programs. I would suggest a download area that would store the latest releases (if we want to discard the intermediary revisions), or all the successive revisions (to reverse an update in case of a regression).

I don't know what D. thinks about it, but nobody expressed this wish before. Does such download area sound convenient to you?

Bye! Guy

Guy1954

unread,
Dec 5, 2016, 11:48:32 AM12/5/16
to xblite
Hi D.

I believe that you could release a new version of XBLite since I made some bug corrections in xblite.x, xst.x, xsx.x and format.x.
Also, I enhanced XstGetOSName() in xsx.x to:
1.detect Linuw/Wine
2.detect Windows 10

and added a new format "0" in format.x to replace say: "RIGHT$ ("0000" + STRING$(year), 4)" by "FORMAT$ ("0000", year)" in xin.x for example.

Compounded with CODE, GRAB and STRIP directives, it's a small step for XBLite, but a big step for the XBLite Guys.
And all the code is commented and heavily tested for more than a couple of years!

Bye! Guy

gentsky

unread,
Dec 7, 2016, 4:30:49 PM12/7/16
to xblite
Hi Guy,

Merry Xmas and Happy New Year to you too!

Thanks for pointing out that you had actually modified the Xmal.x in you download - I hadn't realised until you said. I would make the following comments.

1. I am already working on v1.02 so will modify this in the light of your work.

2. I have use the EXPLICIT directive and added the necessary explicit declarations. However, I do not see why AUTO, AUTOX declarations are not recognised. These are just XLONGs with certain restrictions. Having used the EXPLICIT directive to check the file out I intend to comment it out now and just use it as a checking aid after any major work. I will consider whether to reinstate the AUTOX variables once EXPLICIT is turned off but I think they will be OK as standard XLONGs. I have corrected the QNAN / QNAN() typo.

3. When you added the explicit declarations to your version you missed an important point. Many of the functions - e.g. erf(), Gamma() - have an extra LONGDOUBLE keyword to the right of the function parameter list. This tells the compiler that any variable in that function NOT explicitly declared is a LONGDOUBLE. You have declared them as XLONG. This means the affected functions in your xmal will not work correctly and may well crash. I have put the correct LONGDOUBLE declarations in my xmal.

4. Your fix for the jmp > end.Product.xmal is not required - but thanks anyway. The problem here is caused only by the > direction indicator. When you code a direction indicator in Goasm, it expects to find the label in the same source file. For the dll, it will find it and all is well. When buildlib is used to create the static library, the subroutine is split off into a separate file and the label is no longer found. If the > direction indicator is removed, Goasm happily leaves it to the linker to resolve - which it duly does when it finds the label in the main body. The problem is fixed merely by removing the > and coding jmp end.Product.xmal.

5. Unfortunately, there is no easy fix for the inability to use generated #define statements within a SUB routine when using buildlib. The code has been altered not to use these and replaced with the defined value e.g.  ebp - 44.

6. I have now successfully built both a .dll and a .s version from the same source code and David has confirmed this too. I now need to do a bit of testing on the static library to make sure all the functions are usable and when I am happy with it I will post a new version on the forum. Please do not circulate your version with the broken functions.


Alan

Guy1954

unread,
Dec 8, 2016, 1:25:48 PM12/8/16
to xblite
Hi Alan.

Thank you for such a quick  technical support!

I came to appreciate your math library, which supports angles expressed in degrees, since it suits perfectly a clock emulation. Now that I got my feet wet, I intend to put it more into use.

Actually, I am planning to use this analog clock as a proof of concept for a graphical clock entirely drawn with GDI api.
Just the way I draw the hands, I am planning to draw the clock's backdrop without the overhead of the current bitmap: a colored disk, with a graduated enclosing circle.

When I succeed, I will incorporate this clock to my XBLite Activity Tracker, which I use to log my daily tasks. It will be a lean and mean main display.

Yet another project for year 2017!

Bye! Guy
Reply all
Reply to author
Forward
0 new messages