January 26, 2023, 08:53:48 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Alpha 2 update 2/03/2006

Started by Ionic Wind Support Team, February 02, 2006, 11:08:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

The Aurora Alpha2 version has been updated.  Download from the link provided when purchasing.

Changes:
-------------
-The BASELEN keyword now works.
- A few of Parker's suggested changes to the parser were incorporated.
- CTabCtrl class added.
- CTreeView class added.
- OnEraseBkgnd virtual message handler added.
- SetFont now works in derived controls.  So you can do: mybutton.SetFont("arial",12,200,0); 
- The long awaited database class is ready ;)
- CList, CStringList and CIntList classes added.
- Function pointers now work.
- The syntax 'c' will return the integer ASCII value of a character.

For the database class see "database_test.src" and "database_enumdrivers.src".  Working on another example that I will post when I finish.  The class reference is in "odbc.inc" in your bin directory.  Also included are the converted SQL include files, located in the include directory.

Two simple demo programs, "treeview.src" and "tabctrl.src" added to show usage of the new control classes.  tabctrl.src shows how to use the OnEraseBkgnd handler to prevent the background of a window from drawing.  This removes all flicker when a control completely covers the client area.

Function pointers are quite different than they were in my other languages.  No more oddball templates or typecasting.  As an example this is how it is used to load a dll dynamically and call a function:


DECLARE *SQLConfigDataSource(UINT hwndParent,word fRequest, string lpszDriver,string lpszAttributes),INT;
....

hlib = LoadLibraryA("odbccp32.dll");
if hlib
{
SQLConfigDataSource = GetProcAddress(hlib,"SQLConfigDataSource");
if SQLConfigDataSource
rc = SQLConfigDataSource(NULL,ODBC_ADD_DSN,szDriver,szAttrib);
FreeLibrary(hlib);
}
....


The '*' tells the compiler that the function is referenced by an address and not an import or external.  You can also use the '&' symbol to assign an address of a function.

delclare *indirect(int a);
indirect = &function1;
indirect(1);
indirect = &function2;
indirect(2);

The most common use is DLL functions that are linked dynamically instead of statically.

Let me know if everything installs and compiles OK.

Have fun!
Ionic Wind Support Team

Ionic Wind Support Team

Oh...for an example of CStringList see the database examples.
Ionic Wind Support Team

Bruce Peaslee

February 02, 2006, 11:10:39 PM #2 Last Edit: February 02, 2006, 11:12:14 PM by peaslee
I can say "wow" before downloading (hope that's not bad luck ÂÃ, ;) ÂÃ, ).

Edit:  I'll have to check it out tomorrow - it's bed time here in California.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

The demo version has been updated to this release.

Quote
Edit:  I'll have to check it out tomorrow - it's bed time here in California.

lol.  Don't you know programmers never sleep ;)
Ionic Wind Support Team

Ionic Wind Support Team

The source archive has been updated to this release.  Download from the link provided.
Ionic Wind Support Team

Doc

Tab control *and* databse stuff added at the same time?

...feels just like Christmas around here. :)

-Doc-

Parker

I'm having a bunch of trouble installing. I even deleted the old parser, but it reinstalled that one again. I get errors like " invalid character '0x23' - ' " when I try to compile a file that uses single quotes.

I've redownloaded about 3 times and keep getting the same thing.

Ionic Wind Support Team

Are you downloading the full install?  I haven't updated the parser source in the partner developer forum yet.

Try compiling the database demos.  If they work you have the correct parser.
Ionic Wind Support Team

Ionic Wind Support Team

OK I see the problem.  The single quotes only work for the characters A-F right now ;).   It's one of those 2AM coding mistakes.
Ionic Wind Support Team

Ionic Wind Support Team

OK, the install was just updated.  Single quotes will work for any character now.
Ionic Wind Support Team

Ionic Wind Support Team

Intalll and demo updated again.  ' ' works for any character, not just letters ;)

The whole point, in case no one was following, was to be able to do:

c = 'z';

instead of

c = ASC("z");

Just a convenience thing and follows along with other languages.
Ionic Wind Support Team

Bruce Peaslee

Quote from: Ionic Wizard on February 02, 2006, 11:22:48 PM
The demo version has been updated to this release.

Quote
Edit:ÂÃ,  I'll have to check it out tomorrow - it's bed time here in California.

lol.ÂÃ,  Don't you know programmers never sleep ;)
Quote
It's one of those 2AM coding mistakes.

Am I missing something or is there a basic contradiction here?ÂÃ,  ÂÃ, ;D
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

Never said we write good code at 2AM ;)  Just that we don't sleep.
Ionic Wind Support Team

Parker

February 03, 2006, 12:26:05 PM #13 Last Edit: February 03, 2006, 12:44:08 PM by Parker
What about escapes? Do the single quotes let me do something like '\''?

No, apparently not. Or at least '\t' doesn't work.

And this piece of code is always returning 0 (tError)
if ((ch >= 'A' and ch <= 'Z') or (ch >= 'a' and ch <= 'z') or (ch = '_'))
{
return tWord;
}
else if (ch >= '0' and ch <= '9')
{
return tNumber;
}
else if (ch = '"')
{
return tString;
}
else if (ch = ';')
{
return tEOS;
}
else
{
return tError;
}

Bruce Peaslee

SetFont does not appear to work any more in my main window. It doesn't change the font or size.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Parker

I found the bug. I think you're returning the wrong byte value. Some of the assembly code produced is this
mov eax,39
lea ebx,[ebp+12]
movsx esi,byte [ebx]
mov edi,eax
cmp esi,edi
setge dl
and edx,dword 0x000000ff
mov eax,edx
mov esi,eax
xor edx,edx
cmp esi,dword 0
je near dword LA00000
mov ebx,39
lea ecx,[ebp+12]
movsx esi,byte [ecx]
mov edi,ebx
cmp esi,edi
setle dl
and edx,dword 0x000000ff
mov ebx,edx
mov edi,ebx
xor edx,edx
cmp edi,dword 0
setne dl
LA00000:
mov eax,edx
mov esi,eax
cmp esi,dword 0
je near dword LO00004
mov edx,1
jmp LO00005
LO00004:
mov ebx,39
lea ecx,[ebp+12]
movsx esi,byte [ecx]
mov edi,ebx
cmp esi,edi
setge dl
and edx,dword 0x000000ff
mov ebx,edx
mov esi,ebx
xor edx,edx
cmp esi,dword 0
je near dword LA00001
mov ecx,39
push eax
lea eax,[ebp+12]
xor eax,[esp]
xor [esp],eax
xor eax,[esp]
mov esi,[esp+0]
movsx esi,byte [esi]
mov edi,ecx
cmp esi,edi
setle dl
and edx,dword 0x000000ff
add esp,4
mov ecx,edx
mov edi,ecx
xor edx,edx
cmp edi,dword 0
setne dl
LA00001:
mov ebx,edx
mov edi,ebx
xor edx,edx
cmp edi,dword 0
setne dl
LO00005:
mov eax,edx
mov esi,eax
cmp esi,dword 0
je near dword LO00002
mov edx,1
jmp LO00003
LO00002:
mov ebx,39
lea ecx,[ebp+12]
movsx esi,byte [ecx]
mov edi,ebx
cmp esi,edi
sete dl
and edx,dword 0x000000ff
mov ebx,edx
mov edi,ebx
xor edx,edx
cmp edi,dword 0
setne dl
LO00003:
mov eax,edx
test eax,eax
jz near dword L00001


And nowhere does it test for any value but 39, which happens to be the value of the single quote character. Another one of the 2AM mistakes ;)?

Ionic Wind Support Team

Quote from: peaslee on February 03, 2006, 01:01:39 PM
SetFont does not appear to work any more in my main window. It doesn't change the font or size.

Hmmm.  Works ok here.  Got an example?
Ionic Wind Support Team

Ionic Wind Support Team

Quote from: Parker on February 03, 2006, 01:03:00 PM
I found the bug. I think you're returning the wrong byte value. Some of the assembly code produced is this
And nowhere does it test for any value but 39, which happens to be the value of the single quote character. Another one of the 2AM mistakes ;)?

Your probably right.  I'll update in a few minutes.

Paul.
Ionic Wind Support Team

Bruce Peaslee

My skeleton program in Software Projects.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Shannara

I have a question concerning SetFont .. it may sound stupid but ...

Why not have just a "Font" property. We can Set/Get/Let it as usual that way, instead of SetFont/GetFont?
Love is staying up all night with a sick child, or a healthy adult.

Parker

Because properties aren't supported. I don't know if that's planned, but as of now libraries or programs can't know what function to call automatically when a variable is assigned to.

Ionic Wind Support Team

OK updated again.  Parker and Peaslee give it a go and see if it fixed your respective difficulties
Ionic Wind Support Team

Parker

It's taking forever to download. I don't think I'll be clicking "Checkout wxWidgets" again any time soon ;)

Well it returns the right value, but it crashes on the while part of this loop
while (
(*m_pText[m_uPos] >= 'A' and *m_pText[m_uPos] <= 'Z')
or (*m_pText[m_uPos] >= 'a' and *m_pText[m_uPos] <= 'z')
or (*m_pText[m_uPos] >= '0' and *m_pText[m_uPos] <= '9')
or (*m_pText[m_uPos] = '_'))
{
m_uPos++;
}

As in, if I put a writeln("looping\n"); before the m_uPos++; part, it doesn't even get displayed. It just crashes. The whole source for that program is in the interpreter tutorial topic.

Bruce Peaslee

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

Parker,
You might want to try simplifying that statement a bit.  The lexer just returns an integer value for the character so I don't see that causing a problem. 

C has an isalpha() function that uses a lookup table which would probably be more suitable.
Ionic Wind Support Team