Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,37 @@
' FB 1.05.0 Win64
' The position regarding prototypes is broadly similar to that of the C language in that functions,
' sub-routines or operators (unless they have already been fully defined) must be declared before they can be used.
' This is usually done near the top of a file or in a separate header file which is then 'included'.
' Parameter names are optional in declarations. When calling functions, using parameter names
' (as opposed to identifying arguments by position) is not supported.
Type MyType ' needed for operator declaration
i As Integer
End Type
Declare Function noArgs() As Integer ' function with no argument that returns an integer
Declare Function twoArgs(As Integer, As Integer) As Integer ' function with two arguments that returns an integer
Declare Function atLeastOneArg CDecl(As Integer, ...) As Integer ' one mandatory integer argument followed by varargs
Declare Function optionalArg(As Integer = 0) As Integer ' function with a (single) optional argument with default value
Declare Sub noArgs2() ' sub-routine with no argument
Declare Operator + (As MyType, As MyType) As MyType ' operator declaration (no hidden 'This' parameter for MyType)
' FreeBASIC also supports object-oriented programming and here all constructors, destructors,
' methods (function or sub), properties and operators (having a hidden 'This' parameter) must be
' declared within a user defined type and then defined afterwards.
Type MyType2
Public:
Declare Constructor(As Integer)
Declare Destructor()
Declare Sub MySub()
Declare Function MyFunction(As Integer) As Integer
Declare Property MyProperty As Integer
Declare Operator Cast() As String
Private:
i As Integer
End Type

View file

@ -0,0 +1,8 @@
function noargs(): int = ? ;;
function twoargs(x:int, y:int): int = ? ;;
/* underscore means ignore and is not bound to lexical scope */
function twoargs(_:bool, _:bool): int = ? ;;
function anyargs(xs: ...): int = ? ;;
function plusargs(x:int, xs: ...): int = ? ;;

View file

@ -0,0 +1,17 @@
# Procedure declarations. All are named
proc noargs(): int
proc twoargs(a, b: int): int
proc anyargs(x: varargs[int]): int
proc optargs(a, b: int = 10): int
# Usage
discard noargs()
discard twoargs(1,2)
discard anyargs(1,2,3,4,5,6,7,8)
discard optargs(5)
# Procedure definitions
proc noargs(): int = echo "noargs"
proc twoargs(a, b: int): int = echo "twoargs"
proc anyargs(x: varargs[int]): int = echo "anyargs"
proc optargs(a: int, b = 10): int = echo "optargs"

View file

@ -0,0 +1 @@
Method new: myMethod