Futurebasic/Language/Reference

(Redirected from Futurebasic/language/reference)

Language Reference

edit
  • #define newTypeName as oldTypeName
  • #define newTypeName as {Pointer to|@|^|.} oldTypeName
  • #define newTypeName as {Handle to|@@|^^|..} oldTypeName
  • #if condition
    [statementBlock1]
  • [ #else
    [statementBlock2] ]
  • #endIf
  • functionAddress& = @fn functionName
  • positiveValue = abs (expr)
  • radianAngle# = acos (expr)
  • positiveResult# = acosh (expr)
  • result = exprA and | && expB
  • annuityFactor# = fn annuityY# (rate, periods)
  • appearance button [#] [-] id& [, [ state ] [, [ value ] [, [ min ] [, [ max ] [, [ title$ ] [, [ rect ] [, [ type ] ] ] ] ] ] ]
  • appearance window [#] [-] id& [, [ title$ ] [, [ rect ] [, [ windowClass ] [, [ windowAttributes ] [, [ FBAttributes ] ] ] ] ] ]
  • append [#] fileID
  • apple menu string$
  • string$ = AppleEventMessage$
  • ASCIIcode% = asc (string$)
  • ASCIIcode% = asc (container$$)
  • radianAngle# = asin(expr)
  • result# = asinh(expr)
  • radianAngle# = atan(expr)
  • result# = atanh(expr)
  • radianAngle# = atn(expr)
  • autoclip [=] booleanExpr /* Not Supported in FBtoC */
  • EDIT = fieldMargin
  • fieldContents$ | container$$ = EDIT$ (fieldID)
  • fieldContents$ | container$$ = EDIT$ (fieldID, lineNumber)
  • fieldContents$ | container$$ = EDIT$ (fieldID, -1)
  • fieldContents$ | container$$ = EDIT$ (fieldID, selStart, selEnd)
  • EDIT$ (efID) = string$ | &ZTXThandle& | %TEXTresID% | #container$$ font, size, style, mode, red, green, blue
  • EDIT$ (efID,lineNumber) = string$ | &ZTXThandle& | %TEXTresID% | #container$$ font, size, style, mode, red, green, blue
  • EDIT$ (efID,-1) = string$ | &ZTXThandle& | %TEXTresID% | #container$$ font, size, style, mode, red, green, blue
  • EDIT$ (efID,selStart,selEnd) = string$ | &ZTXThandle& | %TEXTresID% | #container$$ font, size, style, mode, red, green, blue
  • EDIT MENU menuParm
  • EDIT TEXT
    • Standard BASIC:
      • EDIT TEXT [ #optionalFieldNum%,] [ font ] [, [ size ] [, [ style ] [, [ mode ] [, red, green, blue ] ] ] ]
    • Appearance Runtime:
      • EDIT TEXT [ #optionalFieldNum%,] [ font ] [, [ size ] [, [ style ] [, [ mode ] [, foreRGB ] [, backRGB ] ] ] ]
  • EJECT driveExpr /* Not Supported in FBtoC */
  • END ENUM - See the BEGIN ENUM statement
  • END FN - See the LOCAL FN and LONG FN statement
  • END GLOBALS - See the BEGIN GLOBALS statement
  • END IF - See the LONG IF statement
  • END RECORD - See the BEGIN RECORD statement
  • END SELECT - See the SELECT statement
  • ENDASSEM - See the BEGINASSEM statement /* Not Supported in FBtoC */
  • ENTERPROC
    • Syntax 1:
      • "statementLabel"
      • ENTERPROC [ (intVar1 [, intVar2 ...]) ]
        [statementBlock]
      • EXITPROC [= intVar3 ]
    • Syntax 2:
      • "statementLabel"
      • ENTERPROC FN fnName[ (intVar1 [, intVar2 ...]) ] [= type ]
        [statementBlock]
      • EXITPROC [= returnValue ]
  • result& = FN FBCOMPARECONTAINERS (a$$, b$$)
  • result& = FN FBCOMPAREHANDLES (a&, b&)
  • ignored = FN FBGETCONTROLRECT (cHndl &, rect)
  • ignored = FN FBGETSCREENRECT (rect)
  • name$ = FN FBGETSYSTEMNAME$ (nameType)
  • FN FBMAKEFSSPEC (inVol%, inDir&, name$, FSSpec ) /* Not Supported in FBtoC */
  • result& = FN FBTESTFORLIBRARY ("Library Name") /* Not Supported in FBtoC */
  • fileType$ = FILES$
  • folderName$ = FILES$ (_fFolder,[ prompt$ ],, refNumVar%)
  • folderName$ = FILES$ (_FSSpecFolder,[ prompt$ ],, FSSpec)
  • fileName$ = FILES$ (_fOpen,[ typeListString$ ], [ promptString$ ], refNumVar%)
  • fileName$ = FILES$ (_fOpenPreview,[ typeListString$ ], [ promptString$ ], refNumVar%)
  • fileName$ = FILES$ (_FSSpecOpen,[ typeListString$ ], [promptString$], fileSpecRecord)
  • fileName$ = FILES$ (_FSSpecOpenPreview,[ typeListString$ ], [ promptString$ ], fileSpecRecord)
  • fileName$ = FILES$ (_fSave,[ prompt$ ],[ defaultName$ ], refNumVar%)
  • fileName$ = FILES$ (_FSSpecSave,[ prompt$ ],[ defaultName$ ], fileSpecRecord)
  • FILL h, v
  • action = FINDERINFO (countVar%, nameVar$, typeVar&, dirRefNumVar%)
  • action = FINDERINFO (countVar%, @FSSpec[(array)],@OSType&[(array)], dirRefNumVar %)
  • wholeNum# = FIX (expr#)
  • FLUSHEVENTS
  • FLUSHWINDOWBUFFER [ { wRef | { _FBAutoFlushOff | _FBAutoFlushOn } ]
  • result = FN ToolboxFunctionName [ modifiers ] [ ([ { #addrExpr1& | arg1 }[,{ #addrExpr2& | arg2 }...] ]) ]
  • [ result =] FN functionName [(param1 [, param2 ...])]
  • folderRefNum% = FOLDER (path$, refNum%)
  • parentFolderVRef% = FOLDER (":",refNum%)
  • FOR indexVar = firstValue TO lastValue [ STEP stepValue ]
    [ statementBlock ]
  • NEXT [ indexVar ]
  • fractionValue# = FRAC (expr)
  • IF expr THEN { dest1 | statement1 [: statement2 ...]} [ ELSE { dest2 | statement3 [: statement4 ...]}]
  • INC (intVar)
    intVar ++
    numericVariable += IntegerValToAdd
  • INC {LONG|WORD|BYTE} (addr&)
  • INCLUDE { "<path>" | alisResID }
  • stringVar$ = INDEX$ (element [, indexID ])
  • INDEX$ (element [, indexID ]) = stringExpr$
  • INDEX$ D (element [, indexID ])
  • INDEX$ I (element [, indexID ]) = stringExpr$
  • foundElement = INDEXF (string$ [, startElement [, indexID ] ])
  • stringVar$ = INKEY$
  • stringVar$ = INKEY$ (deviceID)
  • INPUT [@(col, row)| % (h, v)] [ "prompt" ;] var1 [, var2 ...]
  • INPUT# deviceID, var1 [, var2 ...]
  • foundPosition = INSTR (startPos, targetString$ | targetContainer$$, searchString$ | searchContainer$$)
  • nearestInteger& = INT (expr#)
  • ignored = FN INVALRECT (rect)
  • subString$ = LEFT$ (string$, numChars)
  • subContainer$$ = LEFT$$ (container$$, numChars)
  • stringLength = LEN (string$ | container$$)
  • [ LET ] var = expr
  • [ LET ] var;length = address&
  • LIBRARY "LibraryName"
  • LIBRARY
  • lineAddress& = LINE "label"
  • LINE INPUT [@(col, row)| % (h, v)] [ "prompt" ;] stringVar$
  • LINE INPUT# deviceID, stringVar$
  • result = LOC (deviceID)
  • [ CLEAR ] LOCAL [ MODE ]
  • [ CLEAR ] LOCAL FN functionName [(arg1 [, arg2 ...])]
    [statementBlock]
  • END FN [= expr ]
  • LOCATE h,v
  • numRecords = LOF (deviceID [, recordLength ])
  • naturalLog# = LOG (expr)
  • commonLog# = LOG10 (expr)
  • base2Log# = LOG2 (expr)
  • LONG COLOR bluePart, greenPart, redPart [, foregroundFlag ]
  • LONG FN functionName [(arg1 [, arg2 ...])]
    [statementBlock]
  • END FN [= expr ]
  • LONG IF expr
    [statementBlock1]
  • [ XELSE
    [statementBlock2] ]
  • END IF
  • LPRINT [@(col, row)|%(h, v)] [ itemList ]
  • MACHLG { constant | variable }[,{ constant | variable }...] /* Not Supported in FBtoC */
  • MAXWINDOW h, v
  • trueOrFalse = MAYBE
  • info& = MEM (expr)
  • selectedMenu = MENU (_menuID)
  • selectedItem = MENU (_itemID)
  • MENU menuID, itemID, state [, string$ ]
  • MENU
  • MENU resID%,{_resMenu| _resSubMenu }, state [, resType$ ]
  • MENU PREFERENCES menuID, itemID
  • subString$ = MID$ (string$, startPos [, numChars ])
  • subContainer$$ = MID$$ (container$$, startPos [, numChars ])
  • MID$ (stringVar$, startPos, numChars) = replaceString$
  • MID$$ (container$$, startPos, numChars) = replaceString$ / contnr$$
  • MINWINDOW h, v
  • string$ = MKI$ (intExpr)
  • remainder = expr MOD modulus
  • buttonStatus = MOUSE (_down)
  • clickType = MOUSE (0)
  • locationInfo = MOUSE (locationType)
  • horzPosition = MOUSE (_horz)
  • vertPosition = MOUSE (_vert)
  • result& = exprA { NAND | ^&} exprB
  • NEXT - See FOR statement
  • result& = exprA { NOR | ^|} exprB
  • value = NOT expr
  • octalString$ = OCT$ (expr)
  • byteOffset = OFFSETOF (fieldName IN { recordType | trueRecVar })
  • byteOffset = OFFSETOF (const [ IN pseudoRecVar ])
  • ON APPLEEVENT (eventtype&, eventClass&) { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON BREAK { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON DIALOG { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON EDIT { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON ERROR { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON ERROR END
  • ON ERROR RETURN
  • ON EVENT { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON FINDERINFO { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON expr GOSUB { "label1" | lineNum1 }[,{ "label2" | lineNum2 }...]
  • ON expr GOTO { "label1" | lineNum1 }[,{ "label2" | lineNum2 }...]
  • ON LPRINT { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON MENU { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON MOUSE { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON OVERFLOWS { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON STOP { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • ON TIMER (interval) { FN userFunction| GOSUB { lineNumber | "stmtLabel" }}
  • TIMER END
  • TIMER OFF
  • OPEN "method[fork]", fileID, path$|@FSSpec [, [ recLen ] [, refNum% [, dirID& ] ] ]
  • OPEN "C", portID, baud [, [ parity ] [, [ stopbit ] [, [ wordLength ] [, buffer ] ] ] ]
  • OPEN "UNIX", fileID, UNIXcommand$
  • result& = exprA { OR exprB
  • OUTPUT [ FILE ] "filePath"
  • OVERRIDE Local Fn fnName
  • OVERRIDE Runtime fnName
  • OVERRIDE EnterProc fnName
  • OVERRIDE _constantName = newValue
  • lineCount = PAGE
  • PAGE
  • PAGE LPRINT
  • PARENTID = directoryID& /* Not Supported in FBtoC */
  • byteValue = PEEK [ BYTE ] (address&)
  • shortIntValue% = PEEK WORD (address&)
  • longValue& = PEEK LONG (address&)
  • PEN [ penWidth ] [, [ penHeight ] [, [ visible ] [, [ mode ] [, pattern ] ] ] ]
  • pictureHandle& = PICTURE
  • PICTURE [(h1, v1)] [-(h2, v2)] [, pictureHandle& ]
  • PICTURE FIELD [#] pfID [, [ pict ] [, [ rect ] [, [ type ] [, just ] ] ] ]
  • PICTURE ON [(h1, v1)] [-(h2, v2)]
  • PICTURE OFF [, pictHandleVar &]
  • PLOT h, v
  • PLOT TO h, v
  • PLOT h1, v1 TO h2, v2 [ TO h3, v3 ...]
  • POKE [ BYTE ] address&, byteExpr
  • POKE WORD address&, shortIntExpr
  • POKE LONG address&, longIntExpr
  • POP (var) /* Not Supported in FBtoC */
  • POP { BYTE | WORD | LONG }(address&) /* Not Supported in FBtoC */
  • numCharacters = POS (deviceType)
  • userCancelled = PRCANCEL
  • pRecH& = PRHANDLE
  • PRINT [@(col, row)|%(h, v)] [ printItem [{,|;}[ printItem ]...] ]
  • PRINT [@(col, row)|%(h, v)] [POINT [{,|;}[POINT]...] ]
  • PRINT# deviceID,[ printItem [{,|;}[ printItem ]...] ]
  • procAddress& = PROC "label"
  • string$ = PSTR$ (address&)
  • PSTR$ (addressVar&) = string$
  • PUSH (var) /* Not Supported in FBtoC */
  • PUSH { BYTE | WORD | LONG }(address&) /* Not Supported in FBtoC */
  • PUT PREFERENCES prefFilePath$, prefRecord
  • RANDOM [ -IZE ] [ expr ]
  • RATIO h, v
  • READ { var | PSTR$ (addressVar&)}[,{ var | PSTR$ (addressVar&)}...]
  • READ # deviceID,{ recVar | numVar | strVar$ ; len } [,{ recVar | numVar | strVar$ ; len }...]
  • READ DYNAMIC deviceID,arrayName
  • READ FIELD [#] deviceID,handleVar
  • READ FILE [#] deviceID,address&,numBytes&
  • currentRecord = REC (fileID)
  • RECORD [#] fileID, recordNum [, positionInRecord ]
  • currentA5& = REGISTER(A5) /* Not Supported in FBtoC */
  • REGISTER ON /* Not Supported in FBtoC */
  • REGISTER OFF /* Not Supported in FBtoC */
  • [statement] REM [remarks]
  • [statement] ' [remarks]
  • [statement] // [remarks]
  • [statement] /* [blockRemarks]*/ [statement]
  • RENAME oldPath$ { TO |,} newFileNameOnly$ [, refNum% [, dirID& ]]
  • RESET
  • RESOURCES "[ pathname ]" [," ttttcccc "]
  • RESTORE [ expr ]
  • RETURN [ "label" ]
  • subString$ = RIGHT$ (string$,numChars)
  • subContainer$$ = RIGHT$$ (container$$,numChars)
  • randomInteger% = RND (expr%)

To re-route text and graphics:

To re-route text:

  • SCROLL (h1, v1)-(h2, v2), hPixels%, vPixels%
  • SCROLL BUTTON [#] idExpr [, [ current ] [, [ min ] [, [ max ] [, [ page ] [, [ rect ] [, type ] ] ] ] ] ]
  • SEGMENT [ minSegmentSize ] /* Ignored in PPC */
  • SEGMENT RETURN /* Ignored in PPC */


  • SELECT [ CASE ] targetExpr
    CASE testExpr [, testExpr ...] [, max32TestExpr ...]
    [statementBlock]
    [ CASE testExpr [, testExpr ...] [,max32TestExpr ...]
    [statementBlock]...]
    [ CASE ELSE
    [statementBlock] ]
  • END SELECT
  • SELECT [ CASE ]
    CASE booleanExpr [, booleanExpr ...] [, max32T booleanExpr ...]
    [statementBlock]
    [ CASE booleanExpr [, booleanExpr ...] [, max32T booleanExpr ...]
    [statementBlock]...]
    [ CASE ELSE
    [statementBlock]]
  • END SELECT
  • numericValue = VAL (string$)
  • integerValue& = VAL& (string$)
  • ignored = FN VALIDRECT (rect)
  • address& = VARPTR ({ var | FN userFunction})
  • address& = @ var
  • XELSE - See the LONG IF statement
  • result& = exprA {XOR | ^^} exprB
  • XREF arrayName (maxSub1 [, maxSub2 ...]) [ AS dataType ]

XREF@ arrayName (maxSub1 [, maxSub2 ...]) [ AS dataType]

Template (to be removed later)

edit

Click here for Template

Go here: <http://en.wikibooks.org/wiki/Futurebasic/language/reference> to admire the long list of keywords to work on.

Use template page (the link is just above).

To edit an entry:

1 - Click on the link titled Template (above the list of keywords).

2 - A new page is displayed in your browser showing how the layout of an entry looks like. Click on the top most link on the right of the screen (probably titled [edit] in English).

3 - The browser opens a new page displaying a form. The main field contains the code used to create the template. It looks like the following:

= <span style="color:red">Layout Template (remove this line)</span> = 

== Keyword Goes Here ==

=== Statement Function Operator or Other? (update the checkmarks below) ===
✔ χ Appearance ✔ χ Standard ✔ χ Console

=== Syntax ===
<pre>
code syntax goes here and is pre-formatted (plain text)
</pre>

=== Revised ===
Date & release (remove the Revised section if no date)

=== Description ===
Description goes here.

=== Example ===
<pre>
Sample code goes here (remove the Example section if no sample code)
</pre> 

=== Notes ===
Special notes. (leave this section if no notes)

=== See Also ===
cross-reference

[[Futurebasic/language/reference|Language Reference]]

4 - Copy the whole text (you can possibly paste it in a text editor window to have it handy at a later time).

5. - If you haven't already done so, put beer in fridge

6 - Now go find a keyword in the list whose entry is empty, and paste the template code and click on the Save button.

If you're not comfortable with HTML, leave to someone else the updating of the entry and repeat the process for another empty keyword entry (i.e. GOTO #6).

If you want to proceed further:

7 - Open the FB Help page in a new browser window or better a text editor. If you're using a browser you will have to display the HTML source code.

Now, depending on your skill with HTML coupled with wiki idiosyncrasy you might do the following:

8a - Edit again the keyword entry updating each section with the corresponding HTML code of the FB Help page.

9a - Save your change and leave to someone else the pleasure to clean up the mess.

or

8b - Clean up the HTML code in your text editor. Sometimes, there are a bunch of tags to remove and even to use more efficiently, I guess. Leave the links related to the missing image resources, it might help later to find out which entries require illustrations. Maybe Christopher can tell us how we can manage the image files.

FB snippets of code of the Ref manual need serious cleaning since they are inserted inside <pre></pre> tags therefore they cannot embed any other HTML code. Other things are worth to know (perhaps for another post), but I think the rule of thumb is to end-up with the less HTML code as possible.

9b - Update each section of the keyword entry with the appropriate clean HTML code.

10 - Repeat ad nauseum (i.e. GOTO #6) with a variant, though: try to find also keyword entries whose template has not been updated.

11 - Celebrate in true Staz style (with beer) when you're done (optional).