Git Product home page Git Product logo

bcc's Introduction

bmx-ng

The Open Source BlitzMax Compiler Project.

bcc's People

Contributors

divinedominion avatar gwron avatar hurrystarfish avatar octav14n avatar propuke avatar thareh avatar woollybah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcc's Issues

[emscripten] Too many setjmps in function

A Try/Catch inside a loop can generate the following runtime error :

too many setjmps in a function call, build with a higher value for MAX_SETJMPS

Current code looks like this :

do {
    jmp_buf * buf = bbExEnter();
        switch(setjmp(*buf)) {
        case 0: {

Perhaps pushing setjmp(*buf) into a separate bbExXXXX() function and returning the result would fix this?

Functionpointer to static Function

This example should output "Hello World":

Superstrict

(New B).Init()

Type A
    Function NestedA()
        Print "Hello World"
    End Function
End Type

Type B
    Method Init()
        Self.InitPointer(A.NestedA)
    End Method
    Method InitPointer(A())
        A()
    End Method
End Type

It is passed through bcc correctly (i.e. bcc[ng] dosn't throw an error).
The original bcc compiles this example as expected.
bcc[ng] however generates c-code that generates the following gcc error:

/home/octavian/Programmierung/bmax/test/.bmx/classFunctionpointer.bmx.console.debug.linux.x86.c:25:113: error: ‘struct BBClass__classFunctionpointer_B’ has no member named ‘fn_NestedA’
  ((struct _classFunctionpointer_B_obj*)o)->clas->md_InitPointer(o,((struct _classFunctionpointer_B_obj*)o)->clas->fn_NestedA);

It should however search in struct _classFunctionpointer_A_obj for fn_NestedA.

Call to Var argument with Var variable should pass as pointer.

In the following code, the call to level2(num) is generated incorrectly by adding a pointer dereference to the argument - rather than passing it through as the original pointer.

SuperStrict

Framework brl.standardio

Local i:Int

level1(i)

Print i

Function level1(num:Int Var)
    level2(num)
End Function

Function level2(num:Int Var)
    num :+ 10
End Function

Multidimensional Arrays [ , ] not working

While testing the new if-handling I recognized that the following line is not working:

(prime.mod/libb3d.mod/libb3d.bmx)

Type TVRTSChunk Extends TChunk
...
    Field tex_coords#[,][]

bye
Ron

UTF8? Char appears in MaxIDE but not other Texteditors -> compiler stops

I have this piece of code in a UTF8-encoded source file:
(direct copy paste)

    Function Create:TElevatorSoundSource(_movable:Int)
        Local result:TElevatorSoundSource  = New TElevatorSoundSource
        result.Movable = ­_movable

When compiling in MaxIDE it opens up the file and the line containing the error has some odd char appended:

    Function Create:TElevatorSoundSource(_movable:Int)
        Local result:TElevatorSoundSource  = New TElevatorSoundSource
        result.Movable = ­_movable

As GitHub allows other character displays, I added a screenshot to show up what is displayed there:
oddchar

Maybe the parser should ignore "invalid" characters at all?

More interesting: The whole file compiles with vanilla BMX ... so this might skip such "utf8"-char thingies already.

Try to compile this

taken from: AStar/astar_graph_walker.bmx

Type AStarCallback Extends Callback
    Field node:AStarNode;
    Field queue:PriorityQueue
End Type

that semicolon breaks compilability

Unable to find overload for ListFromArray(String[]).

Somehow ListFromArray(stringArray) does not compile

SuperStrict
Framework Brl.StandardIO
Import Brl.LinkedList

'does not work
Local arr:String[] = ["one", "two", "three"]
'works
'Local arr:Object[] = ["one", "two", "three"]

'ListFromArray wraps "TList.FromArray", passing an string[] array
'leads to a failing compilation
Local list:TList = ListFromArray(arr)
'somehow using it directly, does not fail
'Local list:TList = TList.FromArray(arr)

For Local s:String = EachIn list
    Print s
Next

Edit: interestingly this works when using TList.FromArray() directly - ListFromArray() is just a wrapper to it. Adjusted aboves sample code accordingly

Pointer problems...

Compiling:freetypefont.bmx
/BlitzMaxNG/mod/brl.mod/freetypefont.mod/freetypefont.bmx<106> : Error : NULL
Archiving:freetypefont.release.linux.x86.a

Compiling:gnet.bmx
/BlitzMaxNG/mod/brl.mod/gnet.mod/gnet.bmx<428> : Error : NULL
Archiving:gnet.release.linux.x86.a

Compiling:tgaloader.bmx
/BlitzMaxNG/mod/brl.mod/tgaloader.mod/tgaloader.bmx<62> : Error : NULL
Archiving:tgaloader.release.linux.x86.a

gnet.bmx line is:
If Not enet_host_service( _enetHost,ev,0 ) Return

freetypefont.bmx line is:
MemCopy slot,_face.glyphslot,SizeOf slot

tgaloader.bmx line is:
If stream.ReadBytes( hdr,8 )<>8 Return Null

  • stream.ReadBytes awaits (byte ptr, int)
    -> If stream.ReadBytes( Varptr i,8 )<>8 Return Null
    compiles fine.
    Seems that pointer handling is not correct atm
  • enet_host_service awaits (Byte Ptr, Byte Ptr, int)
    -> think it is the same problem
  • freetypefont: glyphslot is an "Int Ptr", maybe that it the flaw...

summing up Arrays of different types should return a mixed array

Another module complained about not being able to compile:
prime.mod/libms3d.mod/libms3d.bmx

It seems BlitzMax allows to "merge" arrays of different types and the result is an array containing both object arrays). But it does not allow "merging" two objects into an array automatically!

Sample code:

SuperStrict

Type Base
    Field name:string="Base"
End Type

Type Other
    Field name:string="Other"
End Type


Function CollectObjects:int(obj:object[])
    print "got "+obj.length+" objects"
End Function


local baseA:Base = new Base
local baseB:Base = new Base
local otherA:Other = new Other
local otherB:Other = new Other

'does not work
'CollectObjects(baseA + baseB + otherA + otherB)

'does work
local bases:Base[] = [baseA, baseB]
local others:Other[] = [otherA, otherB]

CollectObjects(bases + others) 'prints 4

current code mentions a "TODO" in the balance-function for balancing two arrays.

bye
Ron

"unreachable" message when a function with ":returntype" does not return something

Code:

'function which does not return something by default
Function withReturn:int()
  if 1=1 then return True
End Function

translator.bmx:

    Method TransReturnStmt$( stmt:TReturnStmt )
        Local t$="return"
        If stmt.expr t:+" "+stmt.expr.Trans()
        unreachable=True
        Return t
    End Method

compilation result: "unreachable"

If no "return"-value is found, use "null" - or in the case of "non-objects" their "null"-equivalents (0, "").

Len() not working for numbers/number-variables

Currently "Len" is defined to accept objects, the "var" and "const"-expressions have set their types to "string" in the case of being compatible. This includes numbers - so numbers get some kind of "string" for code generation but not when calling "->length". Maybe split the following "if TStringType..." so it Returns "1" for numbers (or use a different expr.expr.exprType).

problematic part is:

    Method TransLenExpr:String(expr:TLenExpr)
        If TStringType(expr.expr.exprType) Then
            Return expr.expr.Trans() + "->length"
...

because "->length" is not available for len(1).

Sample (i could also create a test for it):

Framework brl.Standardio
Import Brl.LinkedList

local s:string = "Hello"
print Len(s) + " = 5"

local i:int = 100
print Len(i) + " = 1"

print Len("Hello") + " = 5"

local l:TList = CreateList()
print Len(l) + " = 1"

local a:int[] = new int[5]
print Len(a) + " = 5"

Error:

error: invalid type argument of �->� (have �BBString�)
   brl_standardio_Print(bbStringConcat(bbStringFromInt(&_s3->length),&_s2));
                                                           ^

Means: "->length" is not known for this variable.

min/max in function with "var" params fails with "incompatible type for argument"

The following code does not compile:

SuperStrict

Framework Brl.StandardIO
Import Brl.Math

Global f:Float =  1.0
Global f2:Float =  0.2

'compiles
Print Min(f, f2)

'compiles
Function SortValues(valueA:Float, valueB:Float)
    Local newValueA:Float = Min(valueA, valueB)
    valueB = Max(valueA, valueB)
    valueA = newValueA
End Function

'compiles
Function SortIntValues(valueA:Int Var, valueB:Int Var)
    Local newValueA:Int = Min(valueA, valueB)
    valueB = Max(valueA, valueB)
    valueA = newValueA
End Function

'fails
Function SortFloatValues(valueA:Float Var, valueB:Float Var)
    Local newValueA:Float = Min(valueA, valueB)
    valueB = Max(valueA, valueB)
    valueA = newValueA
End Function
Building var_variables
Compiling:var_variables.bmx
/testcodes/NG/.bmx/var_variables.bmx.console.release.linux.x86.c: In function "��_var_variables_SortFloatValues"��:
/testcodes/NG/.bmx/var_variables.bmx.console.release.linux.x86.c:15:2: error: incompatible type for argument 1 of "bbFloatMin"��
  BBFLOAT bbt_newValueA=bbFloatMin(bbt_valueA,bbt_valueB);
  ^
In file included from 
...

Invalid scope kind

When it came up to compile my "main.bmx" (containing a lot of imports - and many includes for the not-so-dependency-free code) I got an "internal error".

It errored on the line:
Local visibleFilters:TProgrammeLicenceFilter[] = New TProgrammeLicenceFilter[0] ' = TProgrammeLicenceFilter.GetVisible()
in the following piece of code (a file included in "main.bmx"):

        'only react to genre area if episode area is not open
        If openState <3
            If MOUSEMANAGER.IsHit(1) And THelper.MouseIn(genresRect.GetX(), genresRect.GetY() + genresStartY, genresRect.GetW(), genreSize.GetY()*TProgrammeLicenceFilter.GetVisibleCount())
                SetOpen(2)
                'error on the following line     
                Local visibleFilters:TProgrammeLicenceFilter[] = TProgrammeLicenceFilter.GetVisible()
                currentGenre = Max(0, Min(visibleFilters.length-1, Floor((MouseManager.y - (genresRect.GetY() + genresStartY)) / genreSize.GetY())))
                MOUSEMANAGER.ResetKey(1)
            EndIf
        EndIf

GetVisible returns an array of "TProgrammeLicenceFilter" objects, it is defined in another file (which gets imported).

Type TProgrammeLicenceFilter
    Global filters:TList = CreateList()
...
    Function GetVisible:TProgrammeLicenceFilter[]()
        local result:TProgrammeLicenceFilter[]
        For local f:TProgrammeLicenceFilter = EachIn filters
            if f.displayInMenu then result :+ [f]
        Next
        return result
    End Function
...

I tried to simulate it in a short code example, but there it works as expected.

So I have compiled bcc.debug with the commandline to compile my main.bmx:

Building bcc
Compiling:base.configmap.bmx
Compiling:options.bmx
Compiling:transform.c
Compiling:base.stringhelper.bmx
Compiling:config.bmx
Compiling:type.bmx
Compiling:toker.bmx
Compiling:iparser.bmx
Compiling:parser.bmx
Compiling:ctranslator.bmx
Compiling:bcc.bmx
Linking:bcc.debug
Executing:bcc.debug
DebugLog:Found Class :  Object
DebugLog:
DebugLog:Found Class :  String
DebugLog:
DebugLog:Found Class :  ___Array
DebugLog:
DebugLog:Found Class :  TBlitzException
DebugLog:
DebugLog:Found Class :  TNullObjectException
DebugLog:
DebugLog:Found Class :  TNullMethodException
DebugLog:
DebugLog:Found Class :  TNullFunctionException
DebugLog:
DebugLog:Found Class :  TArrayBoundsException
DebugLog:
DebugLog:Found Class :  TOutOfDataException
DebugLog:
DebugLog:Found Class :  TRuntimeException
DebugLog:
DebugLog:Found Class :  TStreamFactory
DebugLog:
DebugLog:Found Class :  TStreamException
DebugLog:
DebugLog:Found Class :  TStreamReadException
DebugLog:
DebugLog:Found Class :  TStreamWriteException
DebugLog:
DebugLog:Found Class :  TIO
DebugLog:
DebugLog:Found Class :  TStream
DebugLog:
DebugLog:Found Class :  TStreamWrapper
DebugLog:
DebugLog:Found Class :  TStreamStream
DebugLog:
DebugLog:Found Class :  TCStream
DebugLog:
DebugLog:Found Class :  TTextStreamFactory
DebugLog:
DebugLog:Found Class :  TTextStream
DebugLog:
DebugLog:Found Class :  TCStandardIO
DebugLog:
DebugLog:Found Class :  TEvent
DebugLog:
DebugLog:Found Class :  TBank
DebugLog:
DebugLog:Found Class :  TBankStreamFactory
DebugLog:
DebugLog:Found Class :  TBankStream
DebugLog:
DebugLog:Found Class :  TSystemDriver
DebugLog:
DebugLog:Found Class :  TTimer
DebugLog:
DebugLog:Found Class :  TGraphicsDriver
DebugLog:
DebugLog:Found Class :  TGraphicsMode
DebugLog:
DebugLog:Found Class :  TGraphics
DebugLog:
DebugLog:Found Class :  TLink
DebugLog:
DebugLog:Found Class :  TListEnum
DebugLog:
DebugLog:Found Class :  TList
DebugLog:
DebugLog:Found Class :  TPixmapLoader
DebugLog:
DebugLog:Found Class :  TPixmap
DebugLog:
DebugLog:Found Class :  TFontLoader
DebugLog:
DebugLog:Found Class :  TGlyph
DebugLog:
DebugLog:Found Class :  TFont
DebugLog:
DebugLog:Found Class :  TMax2DDriver
DebugLog:
DebugLog:Found Class :  TImageFrame
DebugLog:
DebugLog:Found Class :  TImage
DebugLog:
DebugLog:Found Class :  TImageGlyph
DebugLog:
DebugLog:Found Class :  TImageFont
DebugLog:
DebugLog:Found Class :  TMax2DGraphics
DebugLog:
DebugLog:Found Class :  TLinuxSystemDriver
DebugLog:
DebugLog:Found Class :  TGLGraphicsDriver
DebugLog:
DebugLog:Found Class :  TGLGraphics
DebugLog:
DebugLog:Found Class :  TGLMax2DDriver
DebugLog:
DebugLog:Found Class :  TGLImageFrame
DebugLog:
DebugLog:Found Class :  TIntMap
DebugLog:
DebugLog:Found Class :  TIntNode
DebugLog:
DebugLog:Found Class :  TIntKey
DebugLog:
DebugLog:Found Class :  TIntNodeEnumerator
DebugLog:
DebugLog:Found Class :  TIntKeyEnumerator
DebugLog:
DebugLog:Found Class :  TIntValueEnumerator
DebugLog:
DebugLog:Found Class :  TIntMapEnumerator
DebugLog:
DebugLog:Found Class :  TPtrMap
DebugLog:
DebugLog:Found Class :  TPtrNode
DebugLog:
DebugLog:Found Class :  TPtrKey
DebugLog:
DebugLog:Found Class :  TPtrNodeEnumerator
DebugLog:
DebugLog:Found Class :  TPtrKeyEnumerator
DebugLog:
DebugLog:Found Class :  TPtrValueEnumerator
DebugLog:
DebugLog:Found Class :  TPtrMapEnumerator
DebugLog:
DebugLog:Found Class :  TKeyValue
DebugLog:
DebugLog:Found Class :  TNode
DebugLog:
DebugLog:Found Class :  TMap
DebugLog:
DebugLog:Found Class :  TNodeEnumerator
DebugLog:
DebugLog:Found Class :  TKeyEnumerator
DebugLog:
DebugLog:Found Class :  TValueEnumerator
DebugLog:
DebugLog:Found Class :  TMapEnumerator
DebugLog:
DebugLog:Found Class :  TSocketException
DebugLog:
DebugLog:Found Class :  TSocket
DebugLog:
DebugLog:Found Class :  TRamStreamFactory
DebugLog:
DebugLog:Found Class :  TRamStream
DebugLog:
DebugLog:Found Class :  TXEndianStreamFactory
DebugLog:
DebugLog:Found Class :  TXEndianStream
DebugLog:
DebugLog:Found Class :  TSocketStreamFactory
DebugLog:
DebugLog:Found Class :  TSocketStream
DebugLog:
DebugLog:Found Class :  THTTPStreamFactory
DebugLog:
DebugLog:Found Class :  TData
DebugLog:
DebugLog:Found Class :  TTypeId
DebugLog:
DebugLog:Found Class :  TMember
DebugLog:
DebugLog:Found Class :  TField
DebugLog:
DebugLog:Found Class :  TMethod
DebugLog:
DebugLog:Found Class :  MathHelper
DebugLog:
DebugLog:Found Class :  StringHelper
DebugLog:
DebugLog:Found Class :  TLogFile
DebugLog:
DebugLog:Found Class :  TLogger
DebugLog:
DebugLog:Found Class :  Time
DebugLog:
DebugLog:Found Class :  TStopWatch
DebugLog:
DebugLog:Found Class :  TIntervalTimer
DebugLog:
DebugLog:Found Class :  TEventManager
DebugLog:
DebugLog:Found Class :  TEventListenerBase
DebugLog:
DebugLog:Found Class :  TEventListenerRunMethod
DebugLog:
DebugLog:Found Class :  TEventListenerRunFunction
DebugLog:
DebugLog:Found Class :  TEventBase
DebugLog:
DebugLog:Found Class :  TEventSimple
DebugLog:
DebugLog:Found Class :  TxmlOutputStreamHandler
DebugLog:
DebugLog:Found Class :  TxmlError
DebugLog:
DebugLog:Found Class :  TxmlBase
DebugLog:
DebugLog:Found Class :  TxmlDoc
DebugLog:
DebugLog:Found Class :  TxmlNode
DebugLog:
DebugLog:Found Class :  TxmlBuffer
DebugLog:
DebugLog:Found Class :  TxmlOutputBuffer
DebugLog:
DebugLog:Found Class :  TxmlNs
DebugLog:
DebugLog:Found Class :  TxmlAttribute
DebugLog:
DebugLog:Found Class :  TxmlNodeSet
DebugLog:
DebugLog:Found Class :  TxmlXPathObject
DebugLog:
DebugLog:Found Class :  TxmlXPathContext
DebugLog:
DebugLog:Found Class :  TxmlDtd
DebugLog:
DebugLog:Found Class :  TxmlTextReader
DebugLog:
DebugLog:Found Class :  TxmlEntity
DebugLog:
DebugLog:Found Class :  TxmlCatalog
DebugLog:
DebugLog:Found Class :  TxmlXIncludeCtxt
DebugLog:
DebugLog:Found Class :  TxmlURI
DebugLog:
DebugLog:Found Class :  TxmlLocationSet
DebugLog:
DebugLog:Found Class :  TxmlDtdAttribute
DebugLog:
DebugLog:Found Class :  TxmlDtdElement
DebugLog:
DebugLog:Found Class :  TxmlNotation
DebugLog:
DebugLog:Found Class :  TxmlValidCtxt
DebugLog:
DebugLog:Found Class :  TxmlElementContent
DebugLog:
DebugLog:Found Class :  TxmlXPathCompExpr
DebugLog:
DebugLog:Found Class :  TXmlHelper
DebugLog:
DebugLog:Found Class :  TRegistryBaseLoader
DebugLog:
DebugLog:Found Class :  TRegistryFileLoader
DebugLog:
DebugLog:Found Class :  TRegistryLoader
DebugLog:
DebugLog:Found Class :  TRegistryDataLoader
DebugLog:
DebugLog:Found Class :  TRegistry
DebugLog:
DebugLog:Found Class :  TRegistryUnloadedResourceCollection
DebugLog:
DebugLog:Found Class :  TRegistryUnloadedResource
DebugLog:
DebugLog:Found Class :  TVec2D
DebugLog:
DebugLog:Found Class :  TVec3D
DebugLog:
DebugLog:Found Class :  TRectangle
DebugLog:
DebugLog:Found Class :  TColor
DebugLog:
DebugLog:Found Class :  TSpritePack
DebugLog:
DebugLog:Found Class :  TSprite
DebugLog:
DebugLog:Found Class :  TRegistryImageLoader
DebugLog:
DebugLog:Found Class :  TRegistrySpriteLoader
DebugLog:
DebugLog:Found Class :  FTFace
DebugLog:
DebugLog:Found Class :  FTMetrics
DebugLog:
DebugLog:Found Class :  FTGlyph
DebugLog:
DebugLog:Found Class :  TFreeTypeFontLoader
DebugLog:
DebugLog:Found Class :  TFreeTypeGlyph
DebugLog:
DebugLog:Found Class :  TFreeTypeFont
DebugLog:
DebugLog:Found Class :  TSpriteAtlas
DebugLog:
DebugLog:Found Class :  TSpritePacker
DebugLog:
DebugLog:Found Class :  TBitmapFontManager
DebugLog:
DebugLog:Found Class :  TBitmapFontChar
DebugLog:
DebugLog:Found Class :  TBitmapFont
DebugLog:
DebugLog:Found Class :  TRegistryBitmapFontLoader
DebugLog:
DebugLog:Found Class :  TAudioSampleLoader
DebugLog:
DebugLog:Found Class :  TAudioSample
DebugLog:
DebugLog:Found Class :  TAudioSampleLoaderWAV
DebugLog:
DebugLog:Found Class :  TAudioDriver
DebugLog:
DebugLog:Found Class :  TSound
DebugLog:
DebugLog:Found Class :  TChannel
DebugLog:
DebugLog:Found Class :  TDigAudioStream
DebugLog:
DebugLog:Found Class :  TDigAudioStreamOgg
DebugLog:
DebugLog:Found Class :  TSoundManager
DebugLog:
DebugLog:Found Class :  TSfxChannel
DebugLog:
DebugLog:Found Class :  TDynamicSfxChannel
DebugLog:
DebugLog:Found Class :  TSfxSettings
DebugLog:
DebugLog:Found Class :  TSoundSourcePosition
DebugLog:
DebugLog:Found Class :  TSoundSourceElement
DebugLog:
DebugLog:Found Class :  TRegistrySoundLoader
DebugLog:
DebugLog:Found Class :  TDeltaTimer
DebugLog:
DebugLog:Found Class :  TSpriteFrameAnimationCollection
DebugLog:
DebugLog:Found Class :  TSpriteFrameAnimation
DebugLog:
DebugLog:Found Class :  TRegistrySpriteFrameAnimationLoader
DebugLog:
DebugLog:Found Class :  TEntityCollection
DebugLog:
DebugLog:Found Class :  TEntityBase
DebugLog:
DebugLog:Found Class :  TRenderableEntity
DebugLog:
DebugLog:Found Class :  TEntity
DebugLog:
DebugLog:Found Class :  TSpriteEntity
DebugLog:
DebugLog:Found Class :  TRegistrySpriteEntityLoader
DebugLog:
DebugLog:Found Class :  lua_Debug
DebugLog:
DebugLog:Found Class :  lua_Reg
DebugLog:
DebugLog:Found Class :  TTypeId
DebugLog:
DebugLog:Found Class :  TMember
DebugLog:
DebugLog:Found Class :  TConstant
DebugLog:
DebugLog:Found Class :  TField
DebugLog:
DebugLog:Found Class :  TFunction
DebugLog:
DebugLog:Found Class :  TMethod
DebugLog:
DebugLog:Found Class :  TLuaEngine
DebugLog:
DebugLog:Found Class :  TInterpolation
DebugLog:
DebugLog:Found Class :  TVirtualGfx
DebugLog:
DebugLog:Found Class :  TGraphicsManager
DebugLog:
DebugLog:Found Class :  TDataXmlStorage
DebugLog:
DebugLog:Found Class :  TProfilerCall
DebugLog:
DebugLog:Found Class :  TProfiler
DebugLog:
DebugLog:Found Class :  TDirectoryTree
DebugLog:
DebugLog:Found Class :  TSpriteParticleEmitter
DebugLog:
DebugLog:Found Class :  TSpriteParticle
DebugLog:
DebugLog:Found Class :  TMouseManager
DebugLog:
DebugLog:Found Class :  TKeyManager
DebugLog:
DebugLog:Found Class :  TKeyWrapper
DebugLog:
DebugLog:Found Class :  TLocalization
DebugLog:
DebugLog:Found Class :  TLocalizationLanguage
DebugLog:
DebugLog:Found Class :  TLocalizedString
DebugLog:
DebugLog:Found Class :  TRenderConfig
DebugLog:
DebugLog:Found Class :  TGUIManager
DebugLog:
DebugLog:Found Class :  TGUIobject
DebugLog:
DebugLog:Found Class :  TGUISimpleRect
DebugLog:
DebugLog:Found Class :  TGUILabel
DebugLog:
DebugLog:Found Class :  TGUIArrowButton
DebugLog:
DebugLog:Found Class :  TGUIScroller
DebugLog:
DebugLog:Found Class :  TGUIBackgroundBox
DebugLog:
DebugLog:Found Class :  TGUITextBox
DebugLog:
DebugLog:Found Class :  TGUIPanel
DebugLog:
DebugLog:Found Class :  TGUIScrollablePanel
DebugLog:
DebugLog:Found Class :  THelper
DebugLog:
DebugLog:Found Class :  TGUIListBase
DebugLog:
DebugLog:Found Class :  TGUIListItem
DebugLog:
DebugLog:Found Class :  TGUISlotList
DebugLog:
DebugLog:Found Class :  TGUISelectList
DebugLog:
DebugLog:Found Class :  TGUISelectListItem
DebugLog:
DebugLog:Found Class :  TGUICustomSelectListItem
DebugLog:
DebugLog:Found Class :  TGUIinput
DebugLog:
DebugLog:Found Class :  TGUIDropDown
DebugLog:
DebugLog:Found Class :  TGUIDropDownItem
DebugLog:
DebugLog:Found Class :  TGUIButton
DebugLog:
DebugLog:Found Class :  TGUICheckBox
DebugLog:
DebugLog:Found Class :  TGUIWindowBase
DebugLog:
DebugLog:Found Class :  TGUIModalWindow
DebugLog:
DebugLog:Found Class :  TTooltip
DebugLog:
DebugLog:Found Class :  ENetEvent
DebugLog:
DebugLog:Found Class :  TAdapterInfo
DebugLog:
DebugLog:Found Class :  TNetwork
DebugLog:
DebugLog:Found Class :  TNetStream
DebugLog:
DebugLog:Found Class :  TUDPStream
DebugLog:
DebugLog:Found Class :  TTCPStream
DebugLog:
DebugLog:Found Class :  TDigNetwork
DebugLog:
DebugLog:Found Class :  TNetworkConnection
DebugLog:
DebugLog:Found Class :  TNetworkClient
DebugLog:
DebugLog:Found Class :  TNetworkServer
DebugLog:
DebugLog:Found Class :  TNetworkPacket
DebugLog:
DebugLog:Found Class :  TNetworkObject
DebugLog:
DebugLog:Found Class :  TNetworkObjectSlot
DebugLog:
DebugLog:Found Class :  TNetworkMessage
DebugLog:
DebugLog:Found Class :  TBufferedStream
DebugLog:
DebugLog:Found Class :  TZipStreamReadException
DebugLog:
DebugLog:Found Class :  ZipFile
DebugLog:
DebugLog:Found Class :  ZipWriter
DebugLog:
DebugLog:Found Class :  ZipReader
DebugLog:
DebugLog:Found Class :  ZipRamStream
DebugLog:
DebugLog:Found Class :  TZipFileList
DebugLog:
DebugLog:Found Class :  tm_zip
DebugLog:
DebugLog:Found Class :  zip_fileinfo
DebugLog:
DebugLog:Found Class :  PACK_STRUCT
DebugLog:
DebugLog:Found Class :  SZIPFileDataDescriptor
DebugLog:
DebugLog:Found Class :  SZIPFileHeader
DebugLog:
DebugLog:Found Class :  SZipFileEntry
DebugLog:
DebugLog:Found Class :  TPersist
DebugLog:
DebugLog:Found Class :  TPersistException
DebugLog:
DebugLog:Found Class :  TPersistCollisionException
DebugLog:
DebugLog:Found Class :  TNumberCurveValue
DebugLog:
DebugLog:Found Class :  TNumberCurve
DebugLog:
DebugLog:Found Class :  TStringHelper
DebugLog:
DebugLog:Found Class :  TFunctions
DebugLog:
DebugLog:Found Class :  TCatmullRomSpline
DebugLog:
DebugLog:Found Class :  TScreenCollection
DebugLog:
DebugLog:Found Class :  TScreen
DebugLog:
DebugLog:Found Class :  TScreenChangeEffect
DebugLog:
DebugLog:Found Class :  TScreenChangeEffect_SimpleFader
DebugLog:
DebugLog:Found Class :  TScreenChangeEffect_ClosingRects
DebugLog:
DebugLog:Found Class :  TDialogue
DebugLog:
DebugLog:Found Class :  TDialogueAnswer
DebugLog:
DebugLog:Found Class :  TDialogueTexts
DebugLog:
DebugLog:Found Class :  TGUIGameList
DebugLog:
DebugLog:Found Class :  TGUIGameSlotList
DebugLog:
DebugLog:Found Class :  TGUIGameListItem
DebugLog:
DebugLog:Found Class :  TWorldTime
DebugLog:
DebugLog:Found Class :  TWorldLighting
DebugLog:
DebugLog:Found Class :  TWorldWeather
DebugLog:
DebugLog:Found Class :  TWorldWeatherConfiguration
DebugLog:
DebugLog:Found Class :  TWorldWeatherEntry
DebugLog:
DebugLog:Found Class :  TFadingState
DebugLog:
DebugLog:Found Class :  TWeatherEffectBase
DebugLog:
DebugLog:Found Class :  TWeatherEffectRain
DebugLog:
DebugLog:Found Class :  TWeatherEffectLightning
DebugLog:
DebugLog:Found Class :  TWeatherEffectSnow
DebugLog:
DebugLog:Found Class :  TWeatherEffectClouds
DebugLog:
DebugLog:Found Class :  TWorld
DebugLog:
DebugLog:Found Class :  TToastMessageCollection
DebugLog:
DebugLog:Found Class :  TToastMessageSpawnPoint
DebugLog:
DebugLog:Found Class :  TToastMessage
DebugLog:
DebugLog:Found Class :  TGameToastMessage
DebugLog:
DebugLog:Found Class :  TFigureBaseCollection
DebugLog:
DebugLog:Found Class :  TFigureBase
DebugLog:
DebugLog:Found Class :  TGameRules
DebugLog:
DebugLog:Found Class :  TRegistryColorLoader
DebugLog:
DebugLog:Found Class :  TRegistryRoomLoader
DebugLog:
DebugLog:Found Class :  TRegistryNewsGenresLoader
DebugLog:
DebugLog:Found Class :  TRegistryGenresLoader
DebugLog:
DebugLog:Found Class :  TTVTException
DebugLog:
DebugLog:Found Class :  TArgumentException
DebugLog:
DebugLog:Found Class :  TNullObjectExceptionExt
DebugLog:
DebugLog:Found Class :  TGameObjectCollection
DebugLog:
DebugLog:Found Class :  TGameObject
DebugLog:
DebugLog:Found Class :  TOwnedGameObject
DebugLog:
DebugLog:Found Class :  TNamedGameObject
DebugLog:
DebugLog:Found Class :  TNumberSortMap
DebugLog:
DebugLog:Found Class :  TKeyValueNumber
DebugLog:
DebugLog:Found Class :  TVTNewsType
DebugLog:
DebugLog:Found Class :  TVTNewsHandling
DebugLog:
DebugLog:Found Class :  TVTNewsGenre
DebugLog:
DebugLog:Found Class :  TVTNewsEffect
DebugLog:
DebugLog:Found Class :  TVTProgrammeType
DebugLog:
DebugLog:Found Class :  TVTProgrammeGenre
DebugLog:
DebugLog:Found Class :  TVTProgrammeFlag
DebugLog:
DebugLog:Found Class :  TVTProgrammeLicenceType
DebugLog:
DebugLog:Found Class :  TVTTargetGroup
DebugLog:
DebugLog:Found Class :  TVTPressureGroup
DebugLog:
DebugLog:Found Class :  TVTPersonGender
DebugLog:
DebugLog:Found Class :  TVTProgrammePersonJob
DebugLog:
DebugLog:Found Class :  TAudience
DebugLog:
DebugLog:Found Class :  TPopularityManager
DebugLog:
DebugLog:Found Class :  TPopularity
DebugLog:
DebugLog:Found Class :  TGenrePopularity
DebugLog:
DebugLog:Found Class :  TGenreDefinitionBase
DebugLog:
DebugLog:Found Class :  TAudienceAttraction
DebugLog:
DebugLog:Found Class :  TSequenceCalculation
DebugLog:
DebugLog:Found Class :  TPublicImageCollection
DebugLog:
DebugLog:Found Class :  TPublicImage
DebugLog:
DebugLog:Found Class :  TBroadcastMaterial
DebugLog:
DebugLog:Found Class :  TBroadcastMaterialDefaultImpl
DebugLog:
DebugLog:Found Class :  TAudienceResultBase
DebugLog:
DebugLog:Found Class :  TAudienceResult
DebugLog:
DebugLog:Found Class :  TMovieGenreDefinitionCollection
DebugLog:
DebugLog:Found Class :  TMovieGenreDefinition
DebugLog:
DebugLog:Found Class :  TNewsGenreDefinitionCollection
DebugLog:
DebugLog:Found Class :  TNewsGenreDefinition
DebugLog:
DebugLog:Found Class :  TPlayerFinanceHistoryListCollection
DebugLog:
DebugLog:Found Class :  TPlayerFinanceHistoryEntry
DebugLog:
DebugLog:Found Class :  TPlayerFinanceCollection
DebugLog:
DebugLog:Found Class :  TPlayerFinance
DebugLog:
DebugLog:Found Class :  TStationMapCollection
DebugLog:
DebugLog:Found Class :  TStationMap
DebugLog:
DebugLog:Found Class :  TStation
DebugLog:
DebugLog:Found Class :  TStationMapSection
DebugLog:
DebugLog:Found Class :  TBroadcastManager
DebugLog:
DebugLog:Found Class :  TBroadcast
DebugLog:
DebugLog:Found Class :  TBroadcastFeedback
DebugLog:
DebugLog:Found Class :  TBroadcastFeedbackStatement
DebugLog:
DebugLog:Found Class :  TAudienceMarketCalculation
DebugLog:
DebugLog:Found Class :  TBroadcastSequence
DebugLog:
DebugLog:Found Class :  TProgrammePersonCollection
DebugLog:
DebugLog:Found Class :  TProgrammePersonBase
DebugLog:
DebugLog:Found Class :  TProgrammePerson
DebugLog:
DebugLog:Found Class :  TProgrammePersonJob
DebugLog:
DebugLog:Found Class :  TProgrammeRole
DebugLog:
DebugLog:Found Class :  TProgrammeDataCollection
DebugLog:
DebugLog:Found Class :  TProgrammeData
DebugLog:
DebugLog:Found Class :  TPlayerBaseCollection
DebugLog:
DebugLog:Found Class :  TPlayerBase
DebugLog:
DebugLog:Found Class :  TBroadcastStatistic
DebugLog:
DebugLog:Found Class :  TProgrammeLicenceFilter
DebugLog:
DebugLog:Found Class :  TProgrammeLicenceCollection
DebugLog:
DebugLog:Found Class :  TProgrammeLicence
DebugLog:
DebugLog:Found Class :  TAdContractBaseCollection
DebugLog:
DebugLog:Found Class :  TAdContractCollection
DebugLog:
DebugLog:Found Class :  TAdContractBase
DebugLog:
DebugLog:Found Class :  TAdContract
DebugLog:
DebugLog:Found Class :  TAdContractBaseFilter
DebugLog:
DebugLog:Found Class :  TNewsEventCollection
DebugLog:
DebugLog:Found Class :  TNewsEvent
DebugLog:
DebugLog:Found Class :  TNewsEffect
DebugLog:
DebugLog:Found Class :  TNewsEffect_TriggerNews
DebugLog:
DebugLog:Found Class :  TProgramme
DebugLog:
DebugLog:Found Class :  TAdvertisement
DebugLog:
DebugLog:Found Class :  TNewsShow
DebugLog:
DebugLog:Found Class :  TNews
DebugLog:
DebugLog:Found Class :  TDailyBroadcastStatisticCollection
DebugLog:
DebugLog:Found Class :  TDailyBroadcastStatistic
DebugLog:
DebugLog:Found Class :  TScriptTemplateCollection
DebugLog:
DebugLog:Found Class :  TScriptTemplate
DebugLog:
DebugLog:Found Class :  TScriptCollection
DebugLog:
DebugLog:Found Class :  TScript
DebugLog:
DebugLog:Found Class :  TPlayerProgrammeCollectionCollection
DebugLog:
DebugLog:Found Class :  TPlayerProgrammeCollection
DebugLog:
DebugLog:Found Class :  TPlayerProgrammePlanCollection
DebugLog:
DebugLog:Found Class :  TPlayerProgrammePlan
DebugLog:
DebugLog:Found Class :  TRoomDoorBaseCollection
DebugLog:
DebugLog:Found Class :  TRoomDoorBase
DebugLog:
DebugLog:Found Class :  TRoomBaseCollection
DebugLog:
DebugLog:Found Class :  TRoomBase
DebugLog:
DebugLog:Found Class :  TPlayerBossCollection
DebugLog:
DebugLog:Found Class :  TPlayerBoss
DebugLog:
DebugLog:Found Class :  TPlayerBossTalkSubjects
DebugLog:
DebugLog:Found Class :  TBuildingBase
DebugLog:
DebugLog:Found Class :  TSfxFloorSoundBarrierSettings
DebugLog:
DebugLog:Found Class :  TElevator
DebugLog:
DebugLog:Found Class :  TElevatorRouteLogic
DebugLog:
DebugLog:Found Class :  TFloorRoute
DebugLog:
DebugLog:Found Class :  TElevatorSmartLogic
DebugLog:
DebugLog:Found Class :  TSmartFloorRoute
DebugLog:
DebugLog:Found Class :  TElevatorSoundSource
DebugLog:
DebugLog:Found Class :  TProductionConcept
DebugLog:
DebugLog:Found Class :  TProduction
DebugLog:
DebugLog:Found Class :  TBlockMoveable
DebugLog:
DebugLog:Found Class :  TDragAndDrop
DebugLog:
DebugLog:Found Class :  TRoomBoard
DebugLog:
DebugLog:Found Class :  TRoomBoardSign
DebugLog:
DebugLog:Found Class :  TBetty
DebugLog:
DebugLog:Found Class :  TDatabaseLoader
DebugLog:
DebugLog:**** _function
DebugLog:**** callbackServer
DebugLog:**** callbackClient
DebugLog:**** fun
DebugLog:**** _customDrawValue
DebugLog:**** updateFunc
DebugLog:**** drawFunc
Debugger Error:Invalid scope kind

The last DebugLogs reeeallly took longer than the rest (think I waited some seconds just starting with **** _function)

Ideas how to narrow it down even more?

PS: When removing that GetVisible-Call, the next error is a similar portion of code (returning an other type of filter-objects) - so the scope of the call is different to the one before.

BCC cannot handle " ^ " (power of)

Utilizing the ^ char for a power-of-calculation results in an compilation error:

Error : Expecting expression but encountered '^'
or
Error : Syntax error - expecting ')'.
if used in a way like (bla + blubb)^2

-> will expand one of the numeric tests to make the tests fail until the bug is fixed

Overriding "no return value"-methods within modules

I just tried to compile maxmod again:

./bmk makemods -r -a maxmod2
Compiling:maxmod2.bmx
Compile Error: Overriding method does not match any overridden method.
[/BlitzMaxNG/mod/maxmod2.mod/maxmod2.mod/maxmod2.bmx;340;0]

The line is the following "Stop()" method:

Type TMaxModChannel Extends TChannel
...
    Method Stop()
        _channel.Stop()
    End Method

interestingly "TChannel" defines that method exactly the same (no explicit return value).

Changing it to "Stop:int()" in TChannel AND TMaxModChannel removes the error message (and goes on to the next :p).

So this means, bcc-ng currently seem to have problems with "void" methods in modules.
Doing the same in a single file works as expected, same for normal "file imports" (import "bla.bmx").

Cyclic reference error

Rem
    This test checks:
    - if there is a cyclic reference error
End Rem
SuperStrict
Framework BRL.StandardIO


Type TMyClass
    Global instance:TMyClass
End Type

output:

Building references_01
Compiling:references_01.bmx
tests/framework/language/references_01.bmx<10> : Error : Cyclic declaration of 'TMyClass'.

Invalid suffix ".0f" on floating constant

C error "Invalid suffix ".0f" on floating constant" with the following code:

    'returns whether two values are approximately the same
    '(1 and 1.00001 are identical, 1 and 1.1 not)
    Function areApproximatelyEqual:Int(a:Float, b:Float)
        '1E-06 is a value defining at which point things get equal
        '-> 5th digit after comma/point
        '1.121039E-44 is the smallest value
        Return Abs(b - a) < Max(1E-06 * Max(Abs(a), Abs(b)), 1.121039E-44)
    End Function

As replacing that values with "0.000001" and "2^(-146)" works ... I assume this a Bug because the compiler does not understand what kind of type this expressions are.

Assigning functionpointer to functionpointer array

    Method SetCharsEffectFunction(position:int, _func:TBitmapFontChar(font:TBitmapFont, charKey:string, char:TBitmapFontChar, config:TData), config:TData=null)
        position :-1 '0 based
        if _charsEffectFunc.length <= position
            _charsEffectFunc = _charsEffectFunc[..position+1]
            _charsEffectFuncConfig = _charsEffectFuncConfig[..position+1]
        endif
        _charsEffectFunc[position] = _func
        _charsEffectFuncConfig[position] = config
    End Method

translates currently to:

void __base_gfx_bitmapfont_TBitmapFont_SetCharsEffectFunction(struct _base_gfx_bitmapfont_TBitmapFont_obj* o,BBINT bbt_position,struct _base_gfx_bitmapfont_TBitmapFontChar_obj*(* bbt__func)(struct _base_gfx_bitmapfont_TBitmapFont_obj*,BBSTRING,struct _base_gfx_bitmapfont_TBitmapFontChar_obj*,struct _base_util_data_TData_obj*),struct _base_util_data_TData_obj* bbt_config){
    bbt_position-=1;
    if((o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ->scales[0])<=bbt_position){
        o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc =bbArraySlice("*b",o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ,0,(bbt_position+1));
        o->__base_gfx_bitmapfont_tbitmapfont__charseffectfuncconfig =bbArraySlice(":",o->__base_gfx_bitmapfont_tbitmapfont__charseffectfuncconfig ,0,(bbt_position+1));
    }
    ((struct _base_gfx_bitmapfont_TBitmapFontChar_obj*(* )(struct _base_gfx_bitmapfont_TBitmapFont_obj*,BBSTRING,struct _base_gfx_bitmapfont_TBitmapFontChar_obj*,struct _base_util_data_TData_obj*))(((void**)BBARRAYDATA(o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ,o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ->dims))[bbt_position]))=bbt__func;
    ((struct _base_util_data_TData_obj**)BBARRAYDATA(o->__base_gfx_bitmapfont_tbitmapfont__charseffectfuncconfig ,o->__base_gfx_bitmapfont_tbitmapfont__charseffectfuncconfig ->dims))[bbt_position]=bbt_config;
}

Error:

/home/ronny/Arbeit/Programmieren/Projekte/Apps/Dig64/.bmx/base.gfx.bitmapfont.bmx.release.linux.x86.c:442:350: error: lvalue required as left operand of assignment
  ((struct _base_gfx_bitmapfont_TBitmapFontChar_obj*(* )(struct _base_gfx_bitmapfont_TBitmapFont_obj*,BBSTRING,struct _base_gfx_bitmapfont_TBitmapFontChar_obj*,struct _base_util_data_TData_obj*))(((void**)BBARRAYDATA(o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ,o->__base_gfx_bitmapfont_tbitmapfont__charseffectfunc ->dims))[bbt_position]))=bbt__func;

Local Variables

Need to rewrite local variable code to declare all those within a function block at the top/start of the function. This includes nested local variable declarations too (i.e. those within other block in the function).

This will allow easier integration with the debugger at a later stage as we will need access to their address on entry to the function.

Repeat-loop: cannot access method of returned class instance

SuperStrict
Framework BRL.StandardIO

Type TCarCollection
    Field cars:int = 10
    Global instance:TCarCollection

    Function GetInstance:TCarCollection()
        if not instance then instance = new TCarCollection
        return instance
    End Function


    Method Update:int()
        cars:-1
        print "cars left: "+cars
    End Method


    Method AllCarsUpdated:int()
        return (cars <= 0)
    End Method

End Type

Function GetCollectionInstance:TCarCollection()
    if not TCarCollection.instance then TCarCollection.instance = new TCarCollection
    return TCarCollection.instance
End Function



'FAILS
repeat
    TCarCollection.GetInstance().Update()
until TCarCollection.GetInstance().AllCarsUpdated()

'FAILS too
'repeat
'   TCarCollection.GetInstance().Update()
'until GetCollectionInstance().AllCarsUpdated()


'WORKS
'here we use the global "instance"
'repeat
'   TCarCollection.GetInstance().Update()
'until TCarCollection.instance.AllCarsUpdated()

As soon as I create a instance manually and then use that directly

TCarCollection.GetInstance() 'create instance
repeat
    TCarCollection.GetInstance().Update()
until TCarCollection.instance.AllCarsUpdated()

it successfully compiles. So it seems returned instances of a type cannot access their methods in while/repeat-loops (bcc translates both to while).

Type property initialization with previous declared properties

During initialization of a field one cannot assign a value of another field of the same type.

Does not compile:

    Type EndingScene Extends T2DDynamicGameScene
...
        Field TEXTS_COUNT = 23
        Field Texts:String[TEXTS_COUNT]

Does compile:

    Type EndingScene Extends T2DDynamicGameScene
...
        Field TEXTS_COUNT = 23
        Field Texts:String[23]

accessing (new MyType.property) returns nothing

When accessing a property of a "newly" created type instance, the created C-code is not correct.

SuperStrict

Framework BRL.StandardIO

Type MyObject
    Field x:Int = 1
    Field y:Int = 2

    Method Init:MyObject(x:Int, y:Int)
        self.x = x
        self.y = y
        return self
    End Method
End Type

'nothing is printed (expected: 2)
print (new MyObject.y)

'20 is printed (expected: 20)
local obj:MyObject = new MyObject.Init(10,20)
print obj.y

C-File:

//print (new MyObject.y)
brl_standardio_Print(bbObjectDowncast(bbObjectAtomicNew(&_new_03_MyObject),&bbStringClass));

//local obj:MyObject = new MyObject.Init(10,20)
struct _new_03_MyObject_obj* bbt_obj=_new_03_MyObject.md_Init((bbObjectAtomicNew(&_new_03_MyObject)),10,20);

//print obj.y
brl_standardio_Print(bbStringFromInt(bbt_obj->__new_03_myobject_y ));

So you see: the direct-print just creates a new object instance but does not access the property at all.

"SizeOf"-implementation

As Bruce suggested that sizeOf has to get restructured.

I checked the current implementation, and the approach there is to distinguish by "objectusage -> object". So it first checks if the object is a constant, a variable, a function call etc.
We could reorder it in the way it checks for the the object first, and afterwards checks the usage type.

so we go from

if var
  if objectType...
  elseif numericType 
     genericImplementationFittingForAll()
  elseif arrayType...
  ...
elseif const
  if numericType 
    genericImplementationFittingForAll()
  elsif arrayType
  ...
endif

to

if objectType
  if var ...
  elseif membervar ...
  ...
elseif numericType
  genericImplementationFittingForAll()
endif

Sorry for this a bit confused representation of the approaches, but the idea of the second one is to avoid writing things multiple times. So you might end up with a bit shorter code only writing specific portions once - but this costs something: structure and overview. I think the current approach fits best and the only idea I can come up regarding "optimization" is to remove unneeded casts (when accessing field-properties TExpr already implements).

Another Idea is to implement a "SizeOf" for each "ExprType" so we just call an anonymous function GetSize() and it takes care of everything needed within the extended expressions.

Means TObjectType knows how to calculate its size, TStringType too. But for this the GetSize() needs to know about the parent to access that too. Dunno how a TStringType.GetSize(expr:TExpr) adds cyclic dependencies.

Ideas?

Creating and Assigning a multidimensional Array

Another non-compileable module is

prime.mod/libply.mod/libply.bmx

        If property.is_list property.list=New String[][count]
Compiling:libply.bmx
Compile Error: Expression cannot be used as a statement.

DotDot right after symbol

The following code does not compile as it recognizes "Mod.." as single command and therefor expects a "identifier".

Local a:Int = 10
a:Mod..
10

Adding a space between Mod and DotDot then works as expected

Local a:Int = 10
a:Mod ..
10

I know that above is a really "constructed" example, maybe other things bug out similar to this.

"Super." in overridden functions leads to "Illegal use of super"

While trying to remove compilation errors in my game TVTower I come into contact with odd coding styles (happens when mixing function and methods :p).

Seems you cannot call "super" within a function of a type.

SuperStrict
Framework Brl.StandardIO


Type A
  Function call:Int()
  End Function
End Type

Type B Extends A
  'override
  Function call:Int()
   '"illegal call to super" while vanilla calls "call()" of
   'the type "A"
    Super.call()

   'of course this works as expected
   A.call()
  End Function
End Type

Assigning an expression to a String Var function parameter fails

This little snippet won't compile...

Strict

Function TestFunc(Str:String Var)
    Local valA:Int = 10
    Local valB:Int = 20

    str = Float(valA) + Float(valB)
EndFunction

Local Test:String
TestFunc(Test)
Print Test

produces...

Building untitled1
Compiling:untitled1.bmx
C:/BlitzMax_NG/tmp/.bmx/untitled1.bmx.console.release.win32.x86.c: In function '_untitled1_TestFunc':
C:/BlitzMax_NG/tmp/.bmx/untitled1.bmx.console.release.win32.x86.c:5:10: error: incompatible types when assigning to type 'BBSTRING' from type 'float'
  *bbt_Str=(((BBFLOAT)bbt_valA)+((BBFLOAT)bbt_valB));
          ^
Build Error: failed to compile C:/BlitzMax_NG/tmp/.bmx/untitled1.bmx.console.release.win32.x86.c
Process complete

Functionpointer as method argument is interpreted as Overriding method.

Functionspointer as method arguments are interpreted as methods.
Easiest example to reproduce this error:

SuperStrict
Framework brl.blitz

Type Test
    Method t(compare:Int(obj1:Object, obj2:Object))
    End Method
End Type

What's expected:
compiling with bcc works.
What actually happens:
bcc thinks "compare" (the argument) shall override "Method Object.Compare:Int(Local otherObject:Object)"

More details:
I tried to compile wxWidgets with bcc and after fixing lots of bugs i stumbled upon this (wx.mod/wxlistctrl.mod/wxlistctrl.bmx line 819):

    bbdoc: 
    End Rem
    Method SortItems:Int(compare:Int(item1:Object, item2:Object, data:Object), data:Object)
        callback = compare
        callbackData = data
        Return bmx_wxlistctrl_sortitems(wxObjectPtr)
    End Method

I've extended bcc to show which alternative there is when the "Overriding method does not match any overridden method." error is thrown.

Last output of bcc (those two lines beginning with "Did" are the ones generated by my addition to bcc to debug this Problem):

Compiling:wxlistctrl.bmx
Did not find "Function compare:Int(Local item1:Object,Local item2:Object,Local data:Object)"
Did you possibly mean: "Method Object.Compare:Int(Local otherObject:Object)"?
Compile Error: Overriding method does not match any overridden method.

It seems like bcc thinks "compare" (the function pointer) shall be a method of wxListCtrl.

Function pointer assignment failing with params

Current bcc/bmk fails to compile sdl.mod/sdlgraphics.mod because of this line:

sdlgraphics.bmx line 133:

' set mouse warp function
_sdl_WarpMouse = bmx_SDL_WarpMouseInWindow

bmx_SDL_WarpMouseInWindow is defined in common.bmx:

Extern
    ...
    Function bmx_SDL_WarpMouseInWindow(x:Int, y:Int)
    ...
End Extern

output of compiler:

Compiling:sdlgraphics.bmx
Compile Error: Missing function argument 'x'.
[/BlitzMaxNG/mod/sdl.mod/sdlgraphics.mod/sdlgraphics.bmx;133;0]

Seems bcc somehow thinks you want to assign the result function.

Same error bmx-ng/brl.mod#8.

[Co-Op] Documentation - Setup Instructions

Because the new TODO notes a better documentation and install instructions I will post my current state of the "bmx - setup" here.

Of course it includes more than just "bcc" so maybe we should create a "bmx" repo within "bmx-ng" to create something like "releases" there - and this release then include the complete documentation.

So if one of you feels brave enough we could try to improve the my sketch of an instruction file:

+===========================================+
| BLITZMAX NG                               |
+-------------------------------------------+
| SETUP INSTRUCTIONS                        |
+===========================================+

To make things work, some requirements have to get fulfilled first.
Do not be afraid, it is not that much to do. Within some minutes your
NG installation will be ready to get explored.




+===========================================+
| PREREQUISITES                             |
+===========================================+

WINDOWS
-------

- either an already installed MinGW is needed or you put a custom MinGW
  into the subfolder "MinGW32" of your BlitzMaxNG installation
- existing MinGW-installation:
  pay attention to have the environment variables ("MINGW") set correctly,
  same for the PATH variable
- if you do not have MinGW installed:
  - create the folder "MinGW32" in your BlitzMaxNG-folder
  - download it directly from:
      http://ftp.jaist.ac.jp/pub/sourceforge/t/project/td/tdm-gcc/TDM-GCC%20Installer/tdm64-gcc-4.9.2-3.exe
  - or via the original maintainer:
      http://tdm-gcc.tdragon.net/download 
    which leads to sourceforge / mirror selector:
      http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.9.2-3.exe/download
  - once downloaded:
    - execute the installation
    - uncheck the radio button "Check for updated ..."
    - click on the "create" button to create a new installation
    - accept licence
    - select the newly created "MinGW32" folder as installation directory
    - in the components selection screen uncheck "Start Menu items" and 
      "Add To Path"
    - start installation


LINUX
-----

- make sure you installed your GCC-toolchain of choice


MAC OS X
--------

- BRUCEY ?



+===========================================+
| FIRST STEPS / MODULE COMPILATION          |
+===========================================+

Before you are able to start coding, you will have to compile the included
modules first. 
The compilation might take some time. Windows users might need to make a 
coffee as MinGW needs slightly more time to do its job compared to its
compagnons on other OS.


Option A: MaxIDE (preferred way)
--------------------------------

- start MaxIDE[.exe]
- "Program" -> "Build Modules"


Option B: via Terminal / Command prompt
---------------------------------------
Windows users start their command prompt with executing "cmd"
(if you have a start menu. "Start" -> run -> "cmd").

  Linux/Mac
  ---------
  $ cd /path/to/BlitzMaxNG/bin
  $ ./bmk makemods

  Windows
  -------
  cd path/to/BlitzMaxNG/bin
  bmk.exe makemods

Both options will show you the progress of the compilation.




+===========================================+
| NEXT STEPS                                |
+===========================================+

There are none ... you are done now ... feel free to start coding as usual.

If you are interested in adding things (eg. specific target instructions) feel free to add them here until Brucey finds a nice spot to add all that things in a git-like-manner.

chaining parametrized methods with "new"

Try this:

  • will segfault the compiler
'test checks whether compiler splits "new" from rest
'without "params" in the chained method compilation works
'with param ... bcc fails
SuperStrict

Framework BRL.StandardIO

Type MyObject
    Field x:Float = 0

    Method Init:MyObject(x:float)
        self.x = x
        'adjust properties or something else
        return self
    End Method

    Method Copy:MyObject()
        'this line can be troublesome:
        return new MyObject.Init(x)
        'this works atm
        'return (new MyObject).Init()
    End Method

End Type

local obj:MyObject = new MyObject.Init(10)

tests: inheritance_01.bmx fails

Building inheritance_01
Compiling:inheritance_01.queue.bmx
Compiling:inheritance_01.extend.bmx
Compiling:inheritance_01.bmx
/bcc-ng/tests/framework/language/inheritance_01.bmx<13> : Error : Cannot convert from MyOtherType to MyType.
gcc: error: /bcc-ng/tests/framework/language/.bmx/inheritance_01.bmx.gui.release.linux.x86.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Build Error: failed to compile /bcc-ng/tests/framework/language/.bmx/inheritance_01.bmx.gui.release.linux.x86.c
Process complete

Segfaults when using "param:MyType var"

BlitzMax uses "pass by reference" automatically if the type is no simple one (no int, float, ...). BUT: it also does not complain if stated manually (I would use this to make clear: this variable is getting modified within the given function). Means: the following code works (read: compiles!) with BM vanilla, but not with BM-NG.

Whether this is something "intended" or not it might be needed if nearly 100% compatibility is tried to get achieved.

Framework brl.Standardio
local data:TData = new TData
LoadValuesToData(data)


Type TData
    Method Add(key:string)
    End Method
End Type


'"var" param segfaults
Function LoadValuesToData:Int(data:TData Var)
    data.Add("1")
End Function

'compiles
Function LoadValuesToDataNG:Int(data:TData)
    data.Add("1")
End Function

Dot Dot variable definition

dotdot_02.bmx

SuperStrict
Framework brl.StandardIO

Function MyFunc()
    Local a:Int, b:Int, ..
          c:Int
End Function
Building dotdot_02
Compiling:dotdot_02.bmx
Compile Error: Syntax error - expecting identifier.
[/BlitzMaxNG/BlitzMax_Compiler/bcc-ng/tests/framework/language/dotdot_02.bmx;5;0]

Using Booleans in Calculation (x<>null)*(x<>null)

The following lines should explain everything needed:

Global myString:String = "Hi"

'WORKS
Print (myString<>Null)*5

'DOES WORK
Print (myString<>Null)*5*(myString<>Null)

'DOES NOT WORK
Print (myString<>Null)*(myString<>Null)

As soon as the booleans are directly connected (does not matter if "*" or "+/-/:") it creates a

Building untitled1
Compiling:untitled1.bmx
Compile Error: Illegal expression type.
[/BlitzMaxNG/tmp/untitled1.bmx;10;0]

Invalid function call should fail

This should fail compilation because no parameter was provided :

SuperStrict

Framework brl.standardio

count

Function count:Int(a:Int)
    Return a + 1
End Function

Error should be "Missing function parameter 'a'"

Instead, the C compiler throws an error because the generated code is invalid.

"conflicting types for ‘bbObjectNew’" when reusing module code

In my framework I use a variation of the "extended reflection code" posted at the blitzmax forums some long time ago.

Basically it is a alternative to the "brl.reflection" code (it extends it some way). Because "brl.mod/reflection.mod" needed some rewrites for NG, I had to rewrite that portions in my code too.

At the end this means:

  • I copied "reflection.cpp" to my source dir
  • copied "reflection.bmx" too (without the module portion + added some extensions to add support for "const")

But while the old cold compiled fine in "vanilla", the new one spits out errors:

./bmk makeapp -r ../TVTower/TVTower.bmx
Compiling:reflection.bmx
In file included from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.c:1:0:
/BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.h:418:17: error: conflicting types for ‘bbObjectNew’
 extern BBOBJECT bbObjectNew(BBBYTE* bbt_class);
                 ^
In file included from /BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.h:34:0,
                 from /BlitzMaxNG/mod/brl.mod/blitz.mod/.bmx/blitz.bmx.release.linux.x86.h:4,
                 from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.h:4,
                 from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.c:1:
/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_object.h:46:11: note: previous declaration of ‘bbObjectNew’ was here
 BBObject* bbObjectNew( BBClass *t );
           ^
In file included from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.c:1:0:
/BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.h:419:15: error: conflicting types for ‘bbObjectRegisteredTypes’
 extern BBINT* bbObjectRegisteredTypes(BBINT* bbt_count);
               ^
In file included from /BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.h:34:0,
                 from /BlitzMaxNG/mod/brl.mod/blitz.mod/.bmx/blitz.bmx.release.linux.x86.h:4,
                 from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.h:4,
                 from /BlitzMaxNG/TVTower/source/Dig/external/reflectionExtended/.bmx/reflection.bmx.release.linux.x86.c:1:
/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_object.h:61:11: note: previous declaration of ‘bbObjectRegisteredTypes’ was here
 BBClass** bbObjectRegisteredTypes( int *count );
           ^

...
and so on

So somehow there are interferences.

BCC-Segfault when using Short/Byte/Double as For-Loop variable

Each of the following loops makes BCC segfault during compilation.

        For local x:short = 0 to 5
        Next
        For local y:byte = 0 to 5
        Next
        For local z:double = 0 to 5
        Next
Program received signal SIGSEGV, Segmentation fault.
0x08085eb7 in _bb_TForStmt_OnSemant ()

Int, Float and Long work as expected.

OnSemant() fails when trying to create the TBinaryExpr:

        Local assop:TAssignStmt=TAssignStmt( incr )
        Local addop:TBinaryExpr=TBinaryExpr( assop.rhs )

assop is this:

lhs: TVarExpr(Local x:Short)
op: =
rhs: TCastExpr(Short,(TCastExpr(Int,TVarExpr(Local x:Short)) + TConstExpr("1")))

Switching the expressions a bit (created an "int"-local and then manually used that varID):

lhs: TVarExpr(Local j:Int)
op: =
rhs: (TCastExpr(Int,TVarExpr(Local x:Short)) + TConstExpr("1"))

this does not segfault, so maybe this gives the right hint to solve the problem.

Failed global initialisation in method

Initialising a global array in a Type method generates incorrect code.

Type Class

    Method test()
        Global arr:Int[] = New Int[8]
    End Method

End Type

Array should be initialised on the first pass, and thereafter used as is.

Compile Error: Arrays cannot be compared.

Following code leads to error message "Compile Error: Arrays cannot be compared."

SuperStrict
Framework Brl.StandardIO


Global arrOne:Int[] = [1,2]
Global array:Int[] = arrOne
Global arrays:Int[][] = [arrOne]

'both fail
If arrays[0] = arrOne Then Print "absolutely true"
If array = arrOne Then Print "absolutely true too"

Seems BCC seems to error out because it does not know how to check individual entries of an array - but the comparison is more "is this the same array/reference" instead of "contains the same entries".

So if possible, the evaluation should be "true" if the both arrays are the same (reference wise).

Parsing Issue

Hey there,

Came across an issue trying to compile some modules:

While trying to build the entire scope, bcc threw a fit on this file:

https://github.com/kfprimm/prime.mod/blob/master/maxml.mod/maxml.bmx

root@blitzmax-build-env:~/BlitzMax/mod# bmk makemods 
Compiling:assetpacker.bmx
Compiling:maxml.bmx
Compile Error: Expecting expression but encountered 'next'
[/root/BlitzMax/mod/prime.mod/maxml.mod/maxml.bmx;673;0]
gcc: error: /root/BlitzMax/mod/prime.mod/maxml.mod/.bmx/maxml.bmx.debug.linux.x86.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Build Error: failed to compile (1) /root/BlitzMax/mod/prime.mod/maxml.mod/.bmx/maxml.bmx.debug.linux.x86.c

Build Error: failed to compile (1) /root/BlitzMax/mod/prime.mod/maxml.mod/.bmx/maxml.bmx.debug.linux.x86.croot@blitzmax-build-env:~/BlitzMax/mod# bmk makemods maxb3d

Of course, I know for a fact that the standard bcc can compile this file with no issues.

Running this on a fresh install of Ubuntu 14.04 x64.

Thanks!

negative sign before "var"-passed function parameter generates error

Another module not compiling:

Compiling:math3d.bmx
/BlitzMaxNG/mod/prime.mod/math3d.mod/.bmx/math3d.bmx.debug.linux.x86.c: In function ‘prime_math3d_TMatrix_Project’:
/BlitzMaxNG/mod/prime.mod/math3d.mod/.bmx/math3d.bmx.debug.linux.x86.c:1569:12: error: invalid type argument of unary ‘*’ (have ‘BBFLOAT’)
  *bbt_y=(((*-(*bbt_y))*0.5f)+0.5f);
            ^

The error is replicateable using this sample code:

type testtype
    field f:float

    Function test(f:float var)
        'fails
        f = -f*0.5
        'would work
        'f = -1 * f*0.5
    End Function
endtype

[vanilla-compatibility] unexpected ":" in call "super.MethodName:int()"

When extending a type and overriding a method you can call the parental method using "super.".

This uncommon call is not compiling:

SuperStrict
Import Brl.StandardIO

Type A
 Method call:Int()
 End Method
End Type

Type B Extends A
 Method call:Int()
   'failing with NG but possible with vanilla
   Super.call:Int()
 End Method
End Type

Not ignoring out of scope decls.

The example below does not compile because the local method is found first. However, in a function, a method is not in scope, and should be ignored.

SuperStrict

Framework brl.standardio

Local base:TBase = TBase.Create()

Type TBase

    Function Create:TBase()
        Local this:TBase = New TBase
        Build(this) ' call the function !
        Return this
    End Function

    Method Build(base:TBase) ' should be ignored because not in scope
        Print "M"
    End Method

End Type

Function Build(base:TBase)
    Print "F"
End Function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.