[Implemented] Operators

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mereep
New User
New User
Posts: 2
Joined: Thu Aug 21, 2003 11:58 am
Contact:

[Implemented] Operators

Post 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?
Hello World
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Operators

Post 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.
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Next version will have modulo operator
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Haaaaaaaaa, and my surprise ?! :)
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Fred wrote:Haaaaaaaaa, and my surprise ?! :)
Here is your surprise :D
viewtopic.php?t=7296
Mereep
New User
New User
Posts: 2
Joined: Thu Aug 21, 2003 11:58 am
Contact:

Post 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?
Hello World
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Must be something wrong, here is a working version
viewtopic.php?t=3808&highlight=shutdown
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
Post Reply