Framework

 

First Edition

This edition applies to release 1.2 of Objective-Basic and to all subsequent released and modfications until otherwise indicated in new editions. Make sure you are using the correct edtion for the level fo the product. The term "Objective-Basic" as used in this publication, refers to the Objective-basic prodcut set (January 2007).



 


Objective-Basic Framework 1.2

(C)opyright Bernd Noetscher's KBasic Software 2007. All rights resreved.

The Objective-Basic Framework is not just a wrapper around the Cocoa Frameworks.

It simplifies the using of Cocoa, but does not add overhead to its functionality, because all calls to it are replaced by native calls to Cocoa.
It enables you to easily write Cocoa applications using BASIC syntax and commands.

WARNING! You may use Objective-Basic Frameworks classes as local variables only now:

Array, Data, Dictionary, FileHandle, FileManager, Task, ProcessInfo, Variant, String, Timer

Contents


Foundation/Array
Foundation/Data
Foundation/Dictionary
Foundation/FileHandle
Foundation/FileManager
Foundation/Object
Foundation/ProcessInfo
Foundation/String
Foundation/Task

Foundation/Timer
Foundation/Variant

Foundation/Bundle
Foundation/Date
Foundation/DateComponents
Foundation/DateFormatter
Foundation/CalendarDate
Foundation/Calendar
Foundation/TimeZone
Foundation/AppleScript
Foundation/AutoreleasePool
Foundation/Notification
Foundation/NotificationCenter
Foundation/Thread
Foundation/Null
Foundation/RunLoop
Foundation/UserDefaults
Foundation/NumberFormatter
Foundation/Stream
Foundation/OutputStream
Foundation/InputStream
Foundation/Pipe
Foundation/Locale
Foundation/DecimalNumber
Foundation/Foundation Types
Foundation/Foundation Functions
Foundation/Math


Applikation Kit/Event
Applikation Kit/Responder
Applikation Kit/View
Applikation Kit/Control
Applikation Kit/Window
Applikation Kit/Toolbar
Applikation Kit/Workspace
Applikation Kit/ToolbarItem
Applikation Kit/SavePanel
Applikation Kit/OpenPanel
Applikation Kit/Box
Applikation Kit/Button
Applikation Kit/Panel
Applikation Kit/Alert
Applikation Kit/MenuItem
Applikation Kit/Menu
Applikation Kit/HelpManager
Applikation Kit/Drawing
Applikation Kit/Sound
Applikation Kit/Application
Applikation Kit/Applikation Kit Functions

[Foundation]

For Internet, Socket, Port, URL, FTP, (http, DNS, TCP/IP and Network, please read and use the original documents about the Cocoa classes:

NSHost

NSHTTPCookie

NSHTTPCookieStorage

NSHTTPURLResponse

NSNetService

NSNetServiceBrowser

NSPort

NSPortCoder

NSPortMessage

NSPortNameServer

NSSocketPort

NSSocketPortNameServer

NSURL

NSURLAuthenticationChallenge

NSURLCache

NSURLConnection

NSURLCredential

NSURLCredentialStorage

NSURLDownload

NSURLHandle

NSURLProtectionSpace

NSURLProtocol

NSURLRequest

NSURLResponse

NSCachedURLResponse


For XML programming, please read and use the original documents about the Cocoa classes:

NSXMLDocument

NSXMLDTD

NSXMLDTDNode

NSXMLElement

NSXMLNode

NSXMLParser


Localized String Handling

NSLocalizedString

NSLocalizedStringFromTable

NSLocalizedStringFromTableInBundle

NSLocalizedStringWithDefaultValue


For distributed object communication, please read and use the original documents about the Cocoa classes. Normally, you won't use it:

NSConnection

NSInvocation


Map Tables provides very fast dictionaries containing pointers. Normally, you won't use it, because you use Dictionary instead.

NSAllMapTableKeys

NSAllMapTableValues

NSCompareMapTables

NSCopyMapTableWithZone

NSCountMapTable

NSCreateMapTable

NSCreateMapTableWithZone

NSEndMapTableEnumeration

NSEnumerateMapTable

NSFreeMapTable

NSMapGet

NSMapInsert

NSMapInsertIfAbsent

NSMapInsertKnownAbsent

NSMapMember

NSMapRemove

NSNextMapEnumeratorPair

NSResetMapTable

NSStringFromMapTable



Foundation/Array IsA Cocoa/Foundation/NSMutableArray Inherits Object Groups

The Array class manages collections of objects called arrays. It is a modifiable array of objects.

You can create, load, save, copy, insert, delete, iterate and sort.

Objects that you add to an array are referenced only. Each object receives a retain message before its id is added to the array.

When an object is removed from an array, it's sent a release message. That means that Array takes no ownership about the objects.


Original documentation can be read here
Original documentation can be read here

Len() As Unsigned

Set(Unsigned, id)

Get(Unsigned) As id

[Unsigned] As id (read/write) --> index

= Array

Contains(id) As Boolean (Returns True if a given object is contained)

GetArray(Unsigned, Unsigned) As Array (Returns a new array with objects from the specified range)

For Each id In Array --> Enumerator

Next

For Unsigned To Len()

Next

LoadFile(String) As Array

SaveFile(String) As Boolean

Append(id) (Appends a given object at the end)

AppendArray(Array) (Appends a given array's objects at the end)

Insert(Unsigned, id) (Inserts a given object at index)

Replace(Unsigned, id) (Replaces with a given object at index)

IndexOf(id) As Unsigned (Returns the index position of given object)

RemoveAll() (Removes all objects)

Remove(id) (Removes a given object)

RemoveAt(Unsigned) (Removes the object at index)


Foundation/Data IsA Cocoa/Foundation/NSMutableData Inherits Object Groups

A Data object is an object-oriented wrappers for byte buffers.
Original documentation can be read here
Original documentation can be read here

= Data

LoadFile(String) As Data

SaveFile(String) As Boolean

Len() As Unsigned

Set(Unsigned, AnyType)

Get(Unsigned) As AnyType

Get(at As Unsigned, length As Unsigned) As String

[Unsigned] As AnyType(read/write) --> index

[at As Unsigned, length As Unsigned] As String (read) --> index

GetData(Unsigned, Unsigned) As Data (Returns a new data with bytes from the specified range)

For Unsigned To Len()

Next

Append(AnyType) (Adds bytes at the end)

AppendData(Data) (Adds a given data's bytes at the end)

ResetFromTo(Unsigned, Unsigned) (Resets the bytes in a given range)

ReplaceFromToWithData(Unsigned, Unsigned, Data) (Replaces the bytes in a given range)



Foundation/Dictionary IsA Cocoa/Foundation/NSMutableDictionary Inherits Object Groups

The Dictionary class manages collections of objects stored as key/value pairs. It is a modifiable.

You can create, load, save, copy, insert, delete, iterate and sort.

Objects that you add to an dictionary are referenced only. Each object receives a retain message before its id is added to the dictionary.

When an object is removed from an dictionary, it's sent a release message. That means that Dictionary takes no ownership about the objects.
Original documentation can be read here
Original documentation can be read here

[String] read/write As id --> key/value

Len() As Unsigned

Set(String, id)

Get(String) As id

= Dictionary

For Each id In Dictionary --> Enumerator

Next

LoadFile(String) As Dictionary

SaveFile(String) As Boolean

Keys() As Array (Returns an array containing all keys)

Values() As Array (Returns an array containing all values)

RemoveAll() (Removes all objects)

Remove(String) (Removes a given object)

AppendDictionary(Dictionary) (Adds at the end)


Foundation/FileHandle IsA Cocoa/Foundation/NSFileHandle Inherits Object Groups

FileHandle is for accessing open files or communications channels.
Original documentation can be read here

Static ForReading(String) As id (Returns a file handle initialized for reading the file, device, or named socket at the specified path.)

Static ForWriting(String) As id (Returns a file handle initialized for writing the file, device, or named socket at the specified path.)

Static ForUpdating(String) As id (Returns a file handle initialized for writing or reading the file, device, or named socket at the specified path.)

Static StandardError() As id (Returns the file handle for the standard error file.)

Static StandardInput() As id (Returns the file handle for the standard input file.)

Static StandardOutput() As id (Returns the file handle with the standard output file.)

Static NullDevice() As id (Returns the file handle for the null device.)

ReadAll() As Data (Read to end of file)

ReadOfLen(Unsigned) As Data (Read length bytes)

Write(Data) (Write to file)

Close() (Closes the file handle)

Len() As Long

SetOffset(Long)

Offset() As Long


Foundation/FileManager IsA Cocoa/Foundation/NSFileManager Inherits Object Groups

FileManager helps you to do many generic file-system operations in a smart way.
Original documentation can be read here

SetCurrentDirectory(String)

CurrentDirectory() As String

CreateDirectory(String, Dictionary) As Boolean

Copy(String, String) As Boolean (Copies a directory or file)

CreateFile(String, Dictionary) As Boolean

CreateFileWithData(String, Dictionary, Data) As Boolean

Move(String, String) As Boolean (Moves a directory or file)

Link(String, String) As Boolean (Links a directory or file)

Remove(String) As Boolean (Deletes the directory (including all subdirectories and contained files and links), link, or file)

ReadFile(String) As Data (Reads the content of a file)

FileExists(String) As Boolean (Returns True if file exists)

DirectoryExists(String) As Boolean (Returns True if directory exists)

IsFileReadable(String) As Boolean (Returns True if readable for current user)

IsFileWriteable(String) As Boolean (Returns True if writeable for current user)

IsFileExecutable(String) As Boolean (Returns True if executable for current user)

IsFileDeletable(String) As Boolean (Returns True if file deletable for current user)

IsDirectoryReadable(String) As Boolean (Returns True if readable for current user)

IsDirectoryWriteable(String) As Boolean (Returns True if writeable for current user)

IsDirectoryDeletable(String) As Boolean (Returns True if deletable for current user)

FilesystemAttributes(String) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

FileAttributes(String, traverseLink As Boolean) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

SetFileAttributes(String, Dictionary) As Boolean (See Cocoa/NSFileManager documentation for possible attributes. You can change single attributes; you need not specify keys for all attributes)

DirectoryAttributes(String, traverseLink As Boolean) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

SetDirectoryAttributes(String, Dictionary) As Boolean (See Cocoa/NSFileManager documentation for possible attributes. You can change single attributes; you need not specify keys for all attributes)

ReadDirectory(String) As Array (Returns an array of String objects containing the paths of files and directories, but not following links and subdirectories)

ReadDirectories(String) As Array (Returns an array of String objects containing the paths of files and directories, including following links and subdirectories)

CreateSymbolicLink(String, String) As Boolean

ReadSymbolicLink(String) As String (Returns the actual path of the link)


Foundation/Object IsA Cocoa/Foundation/NSObject AndContains Groups

Object is the root class of most Objective-Basic classes. Using Object as parent class, objects inherit an interface to the runtime system.
Original documentation can be read here

Autorelease() (Appends the receiver to the autorelease pool)

Release() (Decrements the reference count)

Retain() (Increments the reference count)


Foundation/ProcessInfo IsA Cocoa/Foundation/NSProcessInfo Inherits Object Groups

ProcessInfo informs you about the current running process.
Original documentation can be read here

Arguments() As Array (read) (Returns the command-line arguments as array of Strings)

Environment() As Dictionary (read) (Returns the variable names and their values in the environment)


Foundation/String IsA Cocoa/Foundation/NSMutableString Inherits Object Groups

The Objective-Basic String class.
Original documentation can be read here

= String

+ (String concatination)

= (compare) -> equal

Like (compare) -> equalCaseInsensitive

If "hello" Like "HELLO" Then

Print()

AppendStringInFormat(format As String, String ...) As String

Format styles are:

------------------------------------------------------------------------

%@ Objective-Basic object, printed as the string

%% '%' character

%i Integer

%u Unsigned

%qi Long

%x Unsigned, printed in hexadecimal using the digits 0-9 and lowercase a-f

%X Unsigned, printed in hexadecimal using the digits 0-9 and uppercase A-F

%f 64-bit floating-point number (Double)

%e 64-bit floating-point number (Double), printed in scientific notation using a lowercase e to introduce the exponent

%E 64-bit floating-point number (Double), printed in scientific notation using an uppercase E to introduce the exponent

%g 64-bit floating-point number (Double), printed in the style of %e if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%G 64-bit floating-point number (Double), printed in the style of %E if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%S Null-terminated array of 16-bit Unicode characters (String)

------------------------------------------------------------------------

Left(Unsigned) As String

Right(Unsigned) As String Mid(Unsigned, Length As Unsigned) As String

Split(separator As String) As Array

Join(Array, separator As String) As String
Trim() As String

IndexOfString([startPos As Unsigned, ] String) As Unsigned

IndexOfStringCaseInsensitive([startPos As Unsigned, ] String) As Unsigned

LastIndexOfString([startPos As Unsigned, ] String) As Unsigned

LastIndexOfStringCaseInsensitive([startPos As Unsigned, ] String) As Unsigned
LowercaseString() As String
UppercaseString() As String

Len() As Unsigned

ReplaceString(String, with As String) As Unsigned ReplaceStringCaseInsensitive(String, with As String) As Unsigned

BeginsWith(String) As Boolean

EndsWith(String) As Boolean

AsUTF8String() AsConstRef Char

AsSingle() As Single

AsDouble() As Double

AsInteger() As Integer
LoadFile(String) As String

SaveFile(String) As Boolean


Foundation/Task IsA Cocoa/Foundation/NSTask Inherits Object Groups

Task enables you to run another program as a subprocess and monitor that program's execution.
Original documentation can be read here

SetStandardError(id)

StandardError() As id

SetStandardInput(id)

StandardInput() As id

SetStandardOutput(id)

StandardOutput() As id

SetPath(String)

Path() As String

SetArguments(Dictionary)

Arguments() As Dictionary

Launch() As Boolean

Resume() As Boolean

Suspend() As Boolean

Terminate() As Boolean

WaitUntilExit()

IsRunning() As Boolean

TerminationStatus() As Integer


Foundation/Timer IsA Cocoa/Foundation/NSTimer Inherits Object Groups

A timer waits until a certain time interval has elapsed and then calls a specified method.
Original documentation can be read here

Start(Double)

Stop()

{

Dim t As Timer

t.start(1000)

Sub t_TimerEvent(y As Timer)

' write your event code here

End Sub

}


Foundation/Variant IsA Cocoa/Foundation/NSValue Inherits Object Groups

Object wrapper for primitive types like Integer or Boolean. Please notice, that Variant is useful only, if you need to store primitive types in an Array or Dictionary,

because it acts like a reference object to the original primitive type. It stores a C pointer to it, instead of copying the value of the primitive type. This means that

the primitive type must always be available, when your are using it in a Variant.
Original documentation can be read here

= Size

= Rect

= Point

= Boolean

= Integer

= Long

= Signed

= Unsigned

= Single

= Double

= String

= id

AsSize As Size

AsRect As Rect

AsPoint As Point

AsString As String

Asid As id

AsBoolean As Boolean

AsSigned As Signed

AsUnsigned As Unsigned

AsInteger As Integer

AsLong As Long

AsSingle As Single

AsDouble As Double


Foundation/Bundle IsA Cocoa/Foundation/NSBundle Inherits Object Groups

A Bundle contains code and resources that can be used in your program. With its help you can locate program resources,

dynamically load executable code, and assist in localization.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Date IsA Cocoa/Foundation/NSDate Inherits Date, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DateComponents IsA Cocoa/Foundation/NSDateComponents Inherits Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DateFormatter IsA Cocoa/Foundation/NSDateFormatter Inherits Formatter, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/CalendarDate IsA Cocoa/Foundation/NSDateComponents Inherits Date, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Calendar IsA Cocoa/Foundation/NSCalendar Inherits Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/TimeZone IsA Cocoa/Foundation/NSTimeZone Inherits Object Groups

Very useful for working with time zones.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/AppleScript IsA Cocoa/Foundation/NSAppleScript Inherits Object Groups

It gives you the ability to load, compile, and execute apple scripts.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/AutoreleasePool IsA Cocoa/Foundation/NSAutoreleasePool Inherits Object Groups

It is used to implement the autorelease mechanism.

An autorelease pool stores objects that are released when the pool itself is released.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Notification IsA Cocoa/Foundation/NSNotification Inherits Object Groups

Needed to use the Cocoa notification mechanism.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/NotificationCenter IsA Cocoa/Foundation/NSNotificationCenter Inherits Object Groups

Needed to use the Cocoa notification mechanism.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Thread IsA Cocoa/Foundation/NSThread Inherits Object Groups

It controls a thread.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Null IsA Cocoa/Foundation/NSNull Inherits Object Groups

Used to represent null values in collections (which don't allow nil as value).
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/RunLoop IsA Cocoa/Foundation/NSRunLoop Inherits Object Groups

Manually managing the events in your application.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/UserDefaults IsA Cocoa/Foundation/NSUserDefaults Inherits Object Groups

Enables you to interacting with the defaults system.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/NumberFormatter IsA Cocoa/Foundation/NSNumberFormatter Inherits Formatter, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Stream IsA Cocoa/Foundation/NSStream Inherits Formatter, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/OutputStream IsA Cocoa/Foundation/NSOutputStream Inherits Stream, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/InputStream IsA Cocoa/Foundation/NSInputStream Inherits Stream, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Pipe IsA Cocoa/Foundation/NSPipe Inherits Object Groups

Enables you to use pipes.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Locale IsA Cocoa/Foundation/NSLocale Inherits Object Groups

Enables you to use pipes.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DecimalNumber IsA Cocoa/Foundation/NSDecimalNumber Inherits Object Groups

Decimal number handling.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Foundation Types IsA BasedOn Cocoa/Foundation/
Original documentation can be read here

Size IsA NSSize

Rect IsA NSRect

Point IsA NSPoint


Foundation/Foundation Functions IsA BasedOn Cocoa/Foundation/
Original documentation can be read here

Print(Format As String, String...) (Prints a message to stderr. Based on NSLog)

Format styles are:

------------------------------------------------------------------------

%@ Objective-Basic object, printed as the string

%% '%' character

%i Integer

%u Unsigned

%qi Long

%x Unsigned, printed in hexadecimal using the digits 0-9 and lowercase a-f

%X Unsigned, printed in hexadecimal using the digits 0-9 and uppercase A-F

%f 64-bit floating-point number (Double)

%e 64-bit floating-point number (Double), printed in scientific notation using a lowercase e to introduce the exponent

%E 64-bit floating-point number (Double), printed in scientific notation using an uppercase E to introduce the exponent

%g 64-bit floating-point number (Double), printed in the style of %e if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%G 64-bit floating-point number (Double), printed in the style of %E if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%S Null-terminated array of 16-bit Unicode characters (String)

------------------------------------------------------------------------

FullUserName() As String (Returns the full name of the current user)

HomeDirectory() As String (Returns the path to the current user's home directory)

HomeDirectoryForUser(user As String) As String (Returns the home directory path for a given user)

TemporaryDirectory() As String (Returns the temporary directory)

UserName() As String (Returns the name of the current user (logon name))

EqualPoints(aPoint As Point, bPoint As Point) As Boolean (Returns true if two points are equal)

MakePoint(x As Single, y As Single) As Point (Returns a point by x and y)

EqualRects(aRect As Rect, bRect As Rect) As Boolean (Returns true if two rects are equal)

MakeRect(x As Single, y As Single, Width As Single, Height As Single) As Rect (Returns a rect by x, y, width and height)

EqualSizes(aSize As Size, bSize As Size) As Boolean (Returns true if two sizes are equal)

MakeSize(Width As Single, Height As Single) As Size (Returns a size by width and height)

Not implemented yet:

+ Randomize() (Initalize the random generator)

+ Rnd() As Double (Get new random value)

+ RaiseException(Name As String, Description As String, Information As Dictionary) (Creates and throws an new user exception)


Foundation/Math IsA BasedOn Carbon/CoreServices

You can use the following functions to perform mathematical and logical operations.

All of these functions are compatible to IEEE 754 and deal with exceptions, NaNs, positive and negative zero and infinity consistent with the floating-point standard.

Normally, you need only a few functions.
Original documentation can be read here

You have to write Import "Math" on top of your file, if you would like to use the following math functions.


Constants:

HUGE_VAL (IEEE 754 value of infinity)

INFINITY (IEEE 754 value of infinity)

NAN (A generic NaN (Not A Number))

Normally, you do not need the following constants.

FP_SNAN

FP_QNAN

FP_INFINITE

FP_ZERO

FP_NORMAL

FP_SUBNORMAL

SIGDIGLEN (decimal digits)

DECSTROUTLEN (maximum length for dec2str)

FLOATDECIMAL

FIXEDDECIMAL

Types:

deprecated/backward compatibiltiy:

Type Decimal (A type which provides decimal numeric type as float or fixed type)

sgn As Char (sign 0 for +, 1 for -)

unused As Char

exp As Short Integer (decimal exponent)

sig.length As Unsigned Char

sig.text As Unsigned Char * SIGDIGLEN

sig.unused As Unsigned Char

End Type

deprecated/backward compatibiltiy:

Type Decform (Determines conversions to decimal strings. If FLOATDECIMAL, the value of the field digits is the number of significant digits. If FIXEDDECIMAL value of the field digits is the number of digits to the right of the decimal point)

style As Char (FLOATDECIMAL or FIXEDDECIMAL)

unused As Char

digits As Short Integer

End Type

Type Fract (32 bit Integer type)

Type Fixed (32 bit Integer type)

Converting:

Fix2Frac(Fixed) As Frac

Fix2Integer(Fixed) As Integer

Frac2Fix(Frac) As Fixed

Integer2Fix(Integer) As Fixed

FixedToSingle(Fixed) As Single

FractToSingle(Fract) As Single

SingleToFixed(Single) As Fixed

SingleToFract(Single) As Fract

Fix2Double(Fixed) As Double

Frac2Double(Fract) As Double

Double2Fix(Double) As Fixed

Double2Frac(Double) As Fract

Converting Between Fixed-Point and Integral Values:

FixRatio(numer As Integer, denom As Integer) As Fixed

FixRound(Fixed) As Integer

Multiplying and Dividing Fixed-Point Numbers:

FixDiv(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fixed

FixMul(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fixed

FracDiv(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fract

FracMul(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fract

Performing Calculations on Fixed-Point Numbers:

FixATan2(x As Integer, y As Integer) As Fixed

FracCos(Fixed) As Fract

FracSin(Fixed) As Fract

FracSqrt(Fract) As Fract

Performing Logical Operations:

BitAnd(Integer, Integer) As Integer

BitNot(Integer) As Integer

BitOr(Integer, Integer) As Integer

BitShift(Value As Integer, Count As Integer) As Integer

BitXor(Integer, Integer) As Integer

Testing and Setting Bits:

BitClr(AsRef Byte, Integer)

BitSet(AsRef Byte, Integer)

BitTst(AsRef Byte, Integer) As Boolean

Trigonometric functions:

cos(x As Double) As Double

sin(x As Double) As Double

tan(x As Double) As Double

acos(x As Double) As Double (Result is in [0,pi])

asin(x As Double) As Double (Result is in [-pi/2,pi/2])

atan(x As Double) As Double (Result is in [-pi/2,pi/2])

atan2(y As Double, x As Double) As Double (Determines the arc tangent of y/x in [-pi,pi] using the sign of both arguments to determine the quadrant)

Hyperbolic functions:

cosh(x As Double) As Double

sinh(x As Double) As Double

tanh(x As Double) As Double

acosh(x As Double) As Double

asinh(x As Double) As Double

atanh(x As Double) As Double

Exponential functions:


exp(x As Double) As Double

expm1(x As Double) As Double (expm1(x) is more accurate than exp(x) - 1)

exp2(x As Double) As Double

frexp(x As Double, exponent AsRef Integer) As Double (Convert a floating-point number into a normalized fraction and an integral power of 2 and stores the Integer in exponent)

ldexp(x As Double, int n) As Double (Multiplies a floating-point by an integer power of 2)

log(x As Double) As Double

log2(x As Double) As Double

log1p(x As Double) As Double (log1p = log(1 + x). However, for small enough arguments, log1p is more accurate than log(1 + x))

log10(x As Double) As Double

logb(x As Double) As Double (Gets the exponent of its argument, as a signed integral value.)

modf(x As Double, iptr AsRef Double) As Double (Returns fractional part of x as function result and returns integral part in iptr)

modff(x As Single, float *iptrf) As Single

scalb(x As Double, n As Integer) As Double (Determines x * 2^n fast)

Power and absolute value functions:


fabs(x As Double) As Double

hypot(x As Double, y As Double) As Double (Determines the square root of the sum of the squares of its arguments)

pow(x As Double, y As Double) As Double (Returns x raised to the power of y)

sqrt(x As Double) As Double

Gamma and Error functions:


erf(x As Double) As Double (The error function)

erfc(x As Double) As Double (Complementary error function)

gamma(x As Double) As Double (The gamma function)

lgamma(x As Double) As Double (Determines the base-e logarithm of the absolute value of gamma of its argument x, for x > 0)