Page 1 of 1
[Implemented] Operators
Posted: Thu Aug 21, 2003 12:12 pm
by Mereep
Hi@all
It would be nice, if PureBasic does support more operators, like the muldo-operator (4%3 = 1 Or 4%2 = 0) Or 5^2 = 25(like Pow())
And functions to call for example the Com-Port or the USB-Ports...
That would make PureBasic more special, or do you know any other languages wich support such things that easily?
Re: Operators
Posted: Thu Aug 21, 2003 12:17 pm
by PB
PureBasic can do modulo and power functions, but not as operators.
Examples can be found in the FAQ here or searching these forums.
They might be easier to use as operators but there's no need to go
to another language when PureBasic is more than capable of doing
them.
Posted: Thu Aug 21, 2003 1:42 pm
by Berikco
Next version will have modulo operator
Posted: Thu Aug 21, 2003 5:37 pm
by Fred
Haaaaaaaaa, and my surprise ?!

Posted: Thu Aug 21, 2003 5:39 pm
by Karbon
An ASM and "pure" PureBasic mod function included in Matthew's Fishlib..
http://www.purebasic.org/comments.php?id=P8_0_1_0
Posted: Thu Aug 21, 2003 6:59 pm
by Berikco
Fred wrote:Haaaaaaaaa, and my surprise ?!

Here is your surprise
viewtopic.php?t=7296
Posted: Fri Aug 22, 2003 2:02 pm
by Mereep
Hi!
That´s very nice that this operator will be added!
But what is with the COM-Functions?
Could they be added, too?
Even if I don´t need them now, it would be very nice to see them!
And i´ve found a little thing wich should be fixed, too:
Code: Select all
Procedure EnableShutDownNT()
hToken.l
mLUID.LUID
mPriv.TOKEN_PRIVILEGES
mNewPriv.TOKEN_PRIVILEGES
OpenProcessToken_(GetCurrentProcess_(),#TOKEN_ADJUST_PRIVILEGES + #TOKEN_QUERY,hToken) ;Constants aren´t predeclared(32,8)
LookUpPrivilegeValue_("","SeShutdownPrivilege",mLUID)
mPriv\PrivilegeCount = 1
mPriv\Privileges[0]\Attributes = #SE_PRIVILEGE_ENABLED
mPriv\Privileges[0]\Luid = mLUID ;This isn´t allowed in PB
AdjustTokenPrivileges_(hToken, False, mPriv, 4 + (12 * mPriv\PrivilegeCount), mNewPriv, 4 + (12 * mNewPriv\PrivilegeCount))
EndProcedure
Why this isn´t working?
I get the error-message: Can´t assign a value to a structure
Or have I done a mistake?
Posted: Fri Aug 22, 2003 2:49 pm
by Berikco
Must be something wrong, here is a working version
viewtopic.php?t=3808&highlight=shutdown
Posted: Fri Aug 22, 2003 3:48 pm
by Fred
Mereep: you can't copy a structure with the '=' operator for now. So you will have to copy the fields one by one, or use a memory copy.