Home
Products
Community
Manuals
Contact
Login or Signup

BlitzMax update 1.26 now available!

BlitzMax Forums/BlitzMax Programming/BlitzMax update 1.26 now available!

marksibly(Posted 1+ years ago) #1
Hi,

BlitzMax Update 1.26 is now available from the 'Account/product updates' section.

Note: If you are building modules, you will need to upgrade MinGW to latest version: http://www.blitzbasic.com/Community/posts.php?topic=72892


SebHoll(Posted 1+ years ago) #2
BlitzMax Update 1.26 is now available from the 'Account/product updates' section.

Note: If you are building modules, you will need to upgrade MinGW to latest version - please read ReleaseNotes.doc.

Cool! Thanks Mark! Downloading now!!!


tonyg(Posted 1+ years ago) #3
Hmmm, my synchronise modules had garbage fields in them and now I can't connect to the server.
I started Bmax anyway and the command index seems to have gone (e.g. the alphabetical list of all commands).
I am guessing HotDocs isn't going to work nor the user doc that Brucey and Assari came up with. Oh well.
<edit> Is there any information on Reflection Support?
<edit2> Not sure if this was Community IDE but Proxy Server had BRL PUB in it. Got rid of that and syncmods OK
<edit3> Found some info on Reflection under 'Modules / Basic / Reflection'


Amon(Posted 1+ years ago) #4
Cool, thanks. Downloading now. :)


marksibly(Posted 1+ years ago) #5

Hmmm, my synchronise modules had garbage fields in them and now I can't connect to the server.


Try closing the ide, deleting cfg/ide.ini, and restarting the ide.


I started Bmax anyway and the command index seems to have gone (e.g. the alphabetical list of all commands).


Oops. Forgot to include latest build of ide - fixed now. Either rebuild ide or redownload update.


Abrexxes(Posted 1+ years ago) #6

&#9658;&#9658;&#9658;ERRORpub.freeaudio was not built
Build Error: failed to compile C:/Programme/BlitzMax/mod/pub.mod/freeaudio.mod/freeaudio.cpp



Any idea? minGW 5.1.3 XP (all the others are fine)

bye


tonyg(Posted 1+ years ago) #7
Was missing GUI doc until I remember to rebuild documentation after syncmods. HotDocs *does* still work once re-run.


marksibly(Posted 1+ years ago) #8
What is HotDocs?!?


GregBUG(Posted 1+ years ago) #9
wow! thanks mark!
100% perferct here! (win vista 32)


Abrexxes(Posted 1+ years ago) #10
Ok, i have deleted all previous .i .a and .bmx files, works fine now.

Good work Mark. Thanks. http://www.hotdocs.de.vu/


tonyg(Posted 1+ years ago) #11
What is HotDocs?!?

HotDocs
To be brutally honest it turned the original documentation into something useful.


flaith(Posted 1+ years ago) #12
Linux version still have version 1.24 in the About Box

bye :)


Dabz(Posted 1+ years ago) #13
This has totally screwed my BlitzMax installation, no home page in the IDE, links in the right hand side frame are dud... nothing will build and doc mods doesnt work... ReleaseNotes and Versions docs are still at 1.24!?!

On Vista HP... Updating to 1.24 worked without no hassle, though this one is unusable.

Not good.

Dabz

EDIT: EDIT: Done a syncmod... Got to Sync docs then Unhandled Memory Exception!?! WTF!!!


Abrexxes(Posted 1+ years ago) #14
Sorry, but i can really not compile freeaudio. I have re installed bmax..every time the same. Here the messaeg from the bm ide.


Compiling:freeaudio.cpp
Build Error: failed to compile c:/Programme/BlitzMax/mod/pub.mod/freeaudio.mod/freeaudio.cpp




Perturbatio(Posted 1+ years ago) #15
It's all working fine for me, although in the IDE, when I have "Use OS Specific Shortcut Keys" enabled, I can't use CTRL+TAB to switch tabs (which is the windows default).

I changed the code at line 5582 to:




marksibly(Posted 1+ years ago) #16

Sorry, but i can really not compile freeaudio. I have re installed bmax..every time the same. Here the messaeg from the bm ide.


Anyone else?

Works fine for me on XP and Vista.


Dreamora(Posted 1+ years ago) #17
Thanks Mark

Quite good timing, was already fearing that I need to use my method pointer hack-workaround ;-)


Dabz(Posted 1+ years ago) #18
*Hey, you deleted my post... what the hell for!!!!

Dabz


Tachyon(Posted 1+ years ago) #19
I installed it and compiled my extremely large project without any problems.


marksibly(Posted 1+ years ago) #20
Dabz, please calm down a bit.

It looks like your update has not worked properly for one reason or another, but flooding the threads with compile errors isn't going to help.

The fact you don't get docs/links or can makemods suggests something is wrong at a lower level.

Some things to try:
Installing over a clean 1.18 install.
Redownloading the update.
Making sure you have latest Mingw installed.

Failing that, stick with 1.24 until we have more info on what could be happening.


xlsior(Posted 1+ years ago) #21
Can someone post the list of changes in this update?


Dabz(Posted 1+ years ago) #22

Dabz, please calm down a bit.



Sorry Mark... but instead of removing the whole thing, you could of easily put a:-

*Quote Removed*

Dabz... ticky tick tock too - Mark!

Instead of removing it all together, then leaving nothing.

I've tried redownloading update, I havent a link to the newest MinGW because ReleaseNotes hasnt been updated and this is the last thing I can try... Now if you can provide a link to the newest build of MinGW either here or at the top of the post, I'll be extremely grateful!

Dabz


tonyg(Posted 1+ years ago) #23
New Mingw


Perturbatio(Posted 1+ years ago) #24


***** 1.26 Release *****

+ (MaxIDE) Fixed debugger =$ in strings causing crash.

+ (BCC) Added 'Not' to conditional compilation system, eg: ?Not Debug

+ (BCC/BRL.Reflection) Reflection support added

+ (BRL.Win32MaxGUI) Clamped selection length to actual text length

+ (BCC) Souped up auto arrays.

+ (BCC) Added array concatenation.

+ (BRL.Blitz) Added String.Join$( bits$[] ) and String.Split$[]( separator$ )





MrTAToad(Posted 1+ years ago) #25
All fine here with OSX and Windows - the only problem is that you still cant pass 'parameters' in the import command, thusly :

Import "-L/Users/nicholaskingsley/Documents/BlitzMax/FightTune"
Import "-lfmodex"
Import "-lz"
Import "/Users/nicholaskingsley/Documents/BlitzMax/FightTune/FMod.c"

For the Mac fails to compile - the BMK program will have to be modified again, unfortunately...


Abrexxes(Posted 1+ years ago) #26
ahhh damn.....

sorry, i have from the last update only installed C support for mingw (for NintendoDS), now with g++ also the c++ file of freeaudio works fine. XD


jhans0n(Posted 1+ years ago) #27
Hmmm... In the new version, a game I'm working on can't switch from full screen to windowed mode (or vice versa) on the fly anymore. When it does, the screen gets all garbled (including text from the DrawText command). Not cool.

This is on a G4 Mac.

Is there any easy way to roll back to 1.24, which works correctly?


dmaz(Posted 1+ years ago) #28
I would assume; uninstall BlitzMax, install 1.18 then upgrade to 1.24

always make a copy of the BlitzMax folder before upgrading.


jhans0n(Posted 1+ years ago) #29
Which of the 7 things in the change log has anything to do with video? Kind of makes me wonder what other undocumented changes were made.


Floyd(Posted 1+ years ago) #30
Is there any easy way to roll back to 1.24, which works correctly?

On Windows the installer makes a backup folder with each update. Updatebackup0, Updatebackup1 etc. are in the folder where BlitzMax is installed.

I don't know about OS X, but there is probably something similar.


VIP3R(Posted 1+ years ago) #31
Thanks, working fine here on Vista.


MGE(Posted 1+ years ago) #32
If things are working fine in 1.24 any reason to go out of our way to upgrade to 1.26? Any speed increase or obvious bug fixes?


marksibly(Posted 1+ years ago) #33

Which of the 7 things in the change log has anything to do with video? Kind of makes me wonder what other undocumented changes were made.


I think this change was from an earlier syncmods update.

If you can get a small crashing test app together and post it in bug reports, I'll get onto it ASAP.


If things are working fine in 1.24 any reason to go out of our way to upgrade to 1.26? Any speed increase or obvious bug fixes?


There is a fairly significant compiler speed increase.


Tachyon(Posted 1+ years ago) #34
Also, my main executable compiled slightly smaller with 1.26 than it did with 1.24. :)


H&K(Posted 1+ years ago) #35
@JGOware,
There was a thread last week. that found Bmax had slowed down by upto 30% on a sieve test. Mark said this also was going to be fixed. So I assume that although this doesnt give faster code than Originaly, its faster than 1.24 because whatever was wrong has been corrected.

@Mark, Yes/no?


skidracer(Posted 1+ years ago) #36
Just a note when installing MinGW (5.1.3?) , please include the gpp support option (c++) for building MaxGui and FreeAudio modules.


jhans0n(Posted 1+ years ago) #37
If you can get a small crashing test app together and post it in bug reports, I'll get onto it ASAP.


I just put it there now. I hope it helps!


H&K(Posted 1+ years ago) #38
I get an Internal error on the minGW Link


Abrexxes(Posted 1+ years ago) #39
http://sourceforge.net/project/downloading.php?group_id=2435&use_mirror=jaist&filename=MinGW-5.1.3.exe&2597933


Plash(Posted 1+ years ago) #40
So far i noticed the IDE is capitalizing maxgui keywords but not highlighting them only noticed it for maxgui but theres probably more..

EDIT: I had to rebuild my docs AFTER syncmodding, doh!


danvari(Posted 1+ years ago) #41
hmm, maxgui freezes for me when i click on "build" (i am using linux) for some seconds, 5 or so. did not happen in blitzmax 1.24. also some comments and functions (like "for" or "if") are not marked as they are in blitzmax 1.24. but that happens only _sometimes_...strange...full module synchronisation and all modules are rebuild.


amonite(Posted 1+ years ago) #42
Update went fine (windows 2000) :)
MaxIDE takes much longer to start than with the previous version.


Grisu(Posted 1+ years ago) #43
Thanks for the update.

- Why not include the newest flat assembler version as well?
- Any news from Skidracer on MaxGUI?


Plash(Posted 1+ years ago) #44
oh btw i noticed this version has reflection support(!!) do you have a good working example code using reflection?


Muttley(Posted 1+ years ago) #45
All updated here fine. New MinGW installed, modules recompiled, etc.

Getting corrupt graphics using the GLMax2D driver though (D3D7Max2DDriver is fine). Trying to narrow it down now to post a problem report.


Scaremonger(Posted 1+ years ago) #46
All good here too.

NB: If you use the MaxIDE Community Edition you'll have problems with the new document structure.


Grisu(Posted 1+ years ago) #47
Can someone explain this error message to me?

"C:/Programme/BlitzMax/bin/ld.exe: cannot find -lfmod
Build Error: Failed to link E:/DFA/dfa099_14_04.exe"

I can rebuild all modules fine, just compiling fails.
Have set the system path variables too.


Azathoth(Posted 1+ years ago) #48
I think it means it can't find the fmod lib or something


Grisu(Posted 1+ years ago) #49
Thanks Azathoth! Missed 1 file.


danvari(Posted 1+ years ago) #50
hmm, after a reboot, maxide compiles just as normal (does not freeze anymore)


ChristianK(Posted 1+ years ago) #51
The MinGW setup doesn't work. I get an error when downloading gcc: "Your connection appears to have dropped out.", but my connection is fine. oO

Will MinGW 5.1.2 work, too?


amonite(Posted 1+ years ago) #52
@ChristianK
I had the same problem, try again (i had to try several times to make it work) also don't download to your desktop as it won't extract the files correctly.


ChristianK(Posted 1+ years ago) #53
Thank you!

I tried it four more times and now it works. :)


H&K(Posted 1+ years ago) #54
also don't download to your desktop as it won't extract the files correctly
I assume thats Vista, cos I did download it to Desktop, and it did work.


VicViper(Posted 1+ years ago) #55
The update works fine here (windows 2000 and xp).

Thanks you


Brucey(Posted 1+ years ago) #56
ar.exe and ld.exe in BlitzMax/bin are not the ones for 5.1.3, so expect linking issues if you intend interfacing with C++ libraries compiled with 5.1.3.

This can be resolved by copying the said executables from the MinGW/bin folder.

:o)


Yan(Posted 1+ years ago) #57
Cheers Mark.

The SVN support is pretty groovy... 8o)


degac(Posted 1+ years ago) #58
Thanks Marks!

edit:

Let's go with the (stupid) questions! [Let me know 'where' post my requests please!]

What's the syntax (taken from Reflection's example)
update.Invoke obj,[String( .25 )] '<--- Square brakets?


This is a critic (I hope it will be considered 'positive')
In the help related to the new reflection support I have not found reference to the 'curly brackets' as posted a week ago! Now consider a new user that don't know this aspect: I think it's necessary to explain it; just a 'copy and paste' of the example given into the IDE-help could be helpful.


N(Posted 1+ years ago) #59
Yes! Oh God, yes! *Rolls around in gravy for disturbing effects*


Perturbatio(Posted 1+ years ago) #60

oh btw i noticed this version has reflection support(!!) do you have a good working example code using reflection?



There's some simple sample examples in help->modules->basic->reflection

What's the syntax (taken from Reflection's example)

update.Invoke obj,[String( .25 )] '<--- Square brakets?



it looks like an array to me.


Plash(Posted 1+ years ago) #61
ooh thanks, it uses an array to send params to the method


degac(Posted 1+ years ago) #62
Ohh!
I understand!
Method Invoke:Object( obj:Object,args:Object[] )

To cast an 'argument(s)' to the invoke method I can use [ ].
Well - I never though to this solution.


MGE(Posted 1+ years ago) #63
Upgraded to 1.2.6 all custom modules compiling fine. ;)


Curtastic(Posted 1+ years ago) #64

+ (MaxIDE) Fixed debugger =$ in strings causing crash.

+ (BCC) Added 'Not' to conditional compilation system, eg: ?Not Debug


Woohoo I make a difference!


dmaz(Posted 1+ years ago) #65
"C:/Programme/BlitzMax/bin/ld.exe: cannot find -lfmod
Build Error: Failed to link E:/DFA/dfa099_14_04.exe"

ok, how do I fix this?

[edit]I needed to put the libfmod.a into the BlitzMax/lib folder[/edit]

and

ar.exe and ld.exe in BlitzMax/bin are not the ones for 5.1.3, so expect linking issues if you intend interfacing with C++ libraries compiled with 5.1.3.

This can be resolved by copying the said executables from the MinGW/bin folder.
should I really do this?


H&K(Posted 1+ years ago) #66
12. Request: New Compiler directives

marksibly (Posted 2005-06-09)

Hi,

I think the tidiest way to clean these up initially would be to make them as Max like as possible - ie: add support for If/Else/EndIf, and simple logical ops such as And/Or/Not, eg:

?If Win32
...blah...
?Else If Not Linux
...etc...
?EndIf
...
...
?If Not Debug 'Same as ?If Release!
...release mode code...
?EndIf
Weird.
It was a good idea, did it take so long because it was of low importance, and forgotten about?

EDIt: I've gone and forgotten what I looked this up for now ;(


xlsior(Posted 1+ years ago) #67
Hm... Unfortunately it looks like this 1.26 upgrade broke Fabian Mokross' module framework thanks to some newly introduced duplicate identifiers in the official modules...

Bye bye systemtray applications. :-?

(The original 1.24 module works OK in debug mode, but in release mode it blows up with an Unhandled Memory Exception Error)


Picklesworth(Posted 1+ years ago) #68
In the mean-time, I believe you can access Fabian's module with modulename.blah, rather than Importing it. (At least that's what I think I remember reading once. Never have tried it in action).


ImaginaryHuman(Posted 1+ years ago) #69
In the community IDE the documentation is not there and there is almost no coloring of tokens in the IDE. I guess that entails a fix of the community IDE now? I was getting used to the handy `todo` `fix` and `code` panels. Oh well.


xlsior(Posted 1+ years ago) #70
In the community IDE the documentation is not there and there is almost no coloring of tokens in the IDE. I guess that entails a fix of the community IDE now?


It appears that the old version had the documentation under /doc while the new one has it in /docs. I don't know if the format changed as well, it's definitely not in the location anymore that is hardcoded in the IDE source itself.


Filax(Posted 1+ years ago) #71
Work fine here... I But where is the B3DSDK doc ?
after a synchonize doc, i can't see him?


Matthew Smith(Posted 1+ years ago) #72
In the community IDE the documentation is not there and there is almost no coloring of tokens in the IDE. I guess that entails a fix of the community IDE now?


The commandlist and help files are now totally different (in layout, content and location). Mark has outlined the process, so it shouldn't be too hard for the guys to update.


Mark Tiffany(Posted 1+ years ago) #73
In the community IDE the documentation is not there

Sorry everyone, I'm really busy at the moment and haven't had time to fix the CE IDE up with the new docs. If anyone else has some time, I don't think it's too involved and mark did post a while back with the required changes, so shouldn't be too hard (famous last words). SourceForge CVS details below.


iamnothing(Posted 1+ years ago) #74
Everything is working great here on my TabletPC. I haven't updated my Mac yet.


alligator(Posted 1+ years ago) #75
Just tried to rebuild all modules on intel mac & get the following error..

Compile Error
33: error AudioUnit/AudioUnit.h: No such file or directory

I deleted my Blitzmax folder & re-installed 1.18 but whenever I install either the 1.24 or 1.26 update and try a rebuild I still get this error.

Using OS X 10.4.10 (intel)

Which is the most stable BlitzMax for OSX?

regards
alligator


amramsey(Posted 1+ years ago) #76
Using OSX (Macbook pro SR) with 1.26 and it is working great for me. Installed over 1.24. Syncmod, then I rebuilt all the modules to recompile miniB3D and had no issues at all. First time I had played with miniB3D actually and I was amazed at the speed that I was getting from it.


Yan(Posted 1+ years ago) #77
I've hacked my V2.0 Alpha CE IDE to work with the new docs system.

I'm loathed to merge it with the main V2.0 branch as it's pretty nasty (I've completely ignored the localisation stuff, for example) and I don't want to pollute the repository.

[edit]
Now in the repository
[/edit]


alligator(Posted 1+ years ago) #78
hi

fixed my build problem on OSX by re-installing all of xcode2.4.1

thx


Mark Tiffany(Posted 1+ years ago) #79
in the help.bmx code above, the line

Local c% = l<i>

should have <i> replaced with [i]

I'm checking these mods out, and will probably check them into the maxide2 branch in a bit (initial check makes me confident in your work Yan).


degac(Posted 1+ years ago) #80
Well - maybe I'm the only one who cares, but I cant' find anymore the examples included in the help file (ie: GraphicsModes
The new 1.26 documentation for GraphicsModes
Function GraphicsModes:TGraphicsMode[]() 
Returns An array of TGraphicsMode objects  
Description Get graphics modes available under the current graphics driver 
Information A TGraphicsMode object contains the following fields: width, height, depth and hertz  

The old one
Function GraphicsModes:TGraphicsMode[]() 
Returns An array of TGraphicsMode objects. 
Description Get graphics modes available under the current graphics driver. 
Information A TGraphicsMode object contains the following fields: width, height, depth and hertz. 
Example
 Print "Available graphics modes:"

For mode:TGraphicsMode=EachIn GraphicsModes()
	Print mode.width+","+mode.height+","+mode.depth+","+mode.hertz
Next

Please note that 'Example' was (in 1.24 and previous) a external link to a .bmx file.
I have re-installed Bmax 1.18+Update 1.24 in a separate folder, sync, rebuild, rebuild-doc.
It is normal on the new version?
In this case is a back-step...


Mark Tiffany(Posted 1+ years ago) #81
CE IDE fixed in the source version maxide2, sorry no compiled versions as yet. Many thanks Yan!

And yes, all examples seem to have vanished? What gives?


degac(Posted 1+ years ago) #82
	Method EmitDecls( kind$ )

		Local list:TList=ChildList( kind )
		If Not list Return
		
		Emit "<h2>"+kind+" reference</h2>"
		
		For Local t:TDocNode=EachIn list
		
			Emit "<a name=~q"+t.id+"~q></a>"
		
			Emit "<p><table class=doc width=100% cellspacing=3>"
			Emit "<tr><td class=doctop colspan=2>"+t.proto+"</td></tr>"

			If t.returns
				Emit "<tr><td class=docleft width=1%>Returns</td><td class=docright>"+t.returns+"</td></tr>"
			EndIf

			If t.bbdoc
				Emit "<tr><td class=docleft width=1%>Description</td><td class=docright>"+t.bbdoc+"</td></tr>"
			EndIf

			If t.about
				Emit "<tr><td class=docleft width=1%>Information</td><td class=docright>"+t.about+"</td></tr>"
			EndIf
			
			If t.example 
				Local p$=t.example
			
'				If FileType( p )<>FILETYPE_FILE
'					Local f$=StripDir( p )
					'p=StripDir( ExtractDir( p ) )+"/"+f
'					Print "....DIR="+p
'				EndIf
'				If FileType( p )=FILETYPE_FILE
					Local link$="<a href=~q"+p+"~q>Example</a>"
					Local code$=LoadText( absDocDir+"/"+p ).Trim()

				code="~n{{~n"+code+"~n}}~n"
				
		
					Emit "<tr><td class=docleft width=1%>"+link+"</td><td class=docright>"+code+"</td></tr>"
			'	EndIf
			EndIf
				Emit "</table>"
	Next	
	End Method

I managed to 'resolve' the problem in the fredborgstyle.bmx file.
It seems to work now.


hub(Posted 1+ years ago) #83
i re-install blitzmax (all updates and synchronise for each server to 1.26). Maxgui syntax words are not highlighted and can't access (by f1) to the help. not found the help file for maxgui in the hierarchy ! But when i compile it works ? What can i do ? Thanks ! (i use the standard ide).


degac(Posted 1+ years ago) #84
Restart the IDE.


hub(Posted 1+ years ago) #85
not fix the pb. i never have this problem before ! Somebody have experimented the same thing ?


degac(Posted 1+ years ago) #86
Sorry - I misread a part of your post.
1. Sync
2. Rebuild Documentation
3. Restart

This *should* works


hub(Posted 1+ years ago) #87
thanks degac it works now.


Regular K(Posted 1+ years ago) #88
Thanks mark.

Reflection will be fun to play with


Matthew Smith(Posted 1+ years ago) #89
Degac,

Good stuff! Pretty much spot on with the beta release:

			If t.example
				Local link$="<a href=~q"+t.example+"~q>Example</a>"
				Local code$=LoadText( absDocDir+"/"+t.example ).Trim()
				code="~n{{~n"+code+"~n}}~n"
				Emit "<tr><td class=docleft width=1%>"+link+"</td><td class=docright>"+code+"</td></tr>"
			EndIf




Yan(Posted 1+ years ago) #90
From the release notes...
+ (BCC) Souped up auto arrays.
Could someone elaborate on this please?

I was hopping it'd be auto type casting to array type but, alas, not.


Grey Alien(Posted 1+ years ago) #91
Just wanted to let all my framework users know that V1.26 works fine, no changes to the framework are needed.

It installed fine on my PC and compiles faster too which is a bonus.

Thanks Mark.


ziggy(Posted 1+ years ago) #92
I have this problem in my Vista machinne after updating to 1.26:

Building columns
Compiling:columns.bmx
flat assembler version 1.66
4 passes, 0.1 seconds, 778994 bytes.
Linking:columns.debug.exe
C:/Program Files/BlitzMax/mod/brl.mod/reflection.mod/reflection.debug.win32.x86.a(reflection.bmx.debug.win32.x86.o)(code+0x2b31): undefined reference to `bbArrayConcat'
C:/Program Files/BlitzMax/mod/brl.mod/reflection.mod/reflection.debug.win32.x86.a(reflection.bmx.debug.win32.x86.o)(code+0x2b8d): undefined reference to `bbArrayConcat'
Build Error: Failed to link C:/Users/usuario/BlitzMax/Game Columns/columns.debug.exe
Process complete

any ideas?

I've run the set up as an administrator, and set the correct permissions to the blitzmax folder. I have no idea what is wrong here.

[EDIT] Disabling UAC made it work...


MacSven(Posted 1+ years ago) #93
Work's great on my Powerbook TI. Update and sync works. Build modules and it run!!!
Thanx Mark


Jim Teeuwen(Posted 1+ years ago) #94
Anyone else?

Works fine for me on XP and Vista.


I have the same problem on Ubuntu Feisty (7.xx).
Installed fresh 1.18 copy and applied the patch, but freeAudio refuses to build.

Anyhoo, I gave the reflection a whirl. It's nice stuff!
I found some inconsistencies though.

example:
type MyType
  Field x:int, y:int[2] ' <-- note the Array
end Type

local obj:MyType = new MyType;
local tid:TTypeID = TTypeId.ForObject(obj);

For Local fld:TField = EachIn tid.EnumFields()
   Print( fld.Name() + ": " + fld.TypeId().Name() );
Next


this Prints the following (as expected).
x:int
y:int[]


But, the problem arises when trying to perform some task based on the TypeID of the Array.

 Select (fld.TypeId())
  case ArrayTypeId;
    Print("We have an array!");

  case IntTypeId;
    Print("We have an int!");
 end Select


I would expect that my 'y:int[]' field is cought by the 'ArrayTypeId' case, but it's not. Infact it's not caught at all, not even as an ObjectTypeId, since apparently any array form is considered a distinctly seperate TypeId.

This makes checking for an Array of any type a bit of a mess, as I have to add a seperate handling block in the 'Default' case, that simply checks the typeiD.Name() field for the substring '[]'. Not very elegant :)

It would be nice if (at least for the primitive data structures), any array form get's the Typeid 'ArrayTypeID'.


marksibly(Posted 1+ years ago) #95
Hi,

Try:

If fld.TypeId() Extends ArrayTypeId
...'it's an array!
EndIf


N(Posted 1+ years ago) #96
O______o

Was not aware you could do that. Neat...


marksibly(Posted 1+ years ago) #97
Oops, that should be...

If fld.TypeId().ExtendsType( ArrayTypeId )
...it's an array...
EndIf


Jim Teeuwen(Posted 1+ years ago) #98
Cool, that did help :)


N(Posted 1+ years ago) #99
Curses. Other way was cooler.


Jim Teeuwen(Posted 1+ years ago) #100
I wrote a BinaryFormatter today while getting to grips with Reflection. It's working quite well. Even with deeply nested custum types.

I can prolly improove on it, specially the array handling is a bit dodgy, but for a first go it aint bad. Thanks for this Mark, me happy!

btw, here's the formatter code: http://rafb.net/p/ck3TfP57.html

Some possible improovements:
- The TYPETKN_ constants can prolly be removed alltogether, or at least converted to byte's
- Need to add checks for cyclic/duplicate object references. No need to write an object more than once.
- Error checking and handling. Maybe devise some Exceptions that can be thrown when the poo hits the proverbial fan.
- Support for other Output formats. Now that the basic structure for processing type's is done, I can adapt it to use several different Output classes. One for Binary as we have now. an XmlFormatter and plain Ascii may be handy.


Tom(Posted 1+ years ago) #101
Impressive Jim!


Jim Teeuwen(Posted 1+ years ago) #102
@Mark, There is one thing I would like to know: why do Numeric types not inherit from Object?

This makes writing some proper generic code a bit messy, since we have to provide separate implementations of a function for each numeric type and the rest which is castable to Object..

I suppose there is a reason for this, although I can't quite seem to find it. Speed perhaps? And is there any chance at all that this may be changed in some future patch? It would be great if Object becomes the ultimate base-type for everything.


DJ Scantron(Posted 1+ years ago) #103
I think numbers are primitive types for speed reasons,(so they can be allocated on the stack I believe) even java does this.


Jim Teeuwen(Posted 1+ years ago) #104
What exactly is the TTypeID.MetaData() method for?
It requires a Key parameter to make it return something, but i can't seem to find anything that will yield any results.

Also, traversing the Parameters ona TMethod instance.. Can it be changed to also include the Names of the parameters? Right now it only gives the parameter types.

I understand this requires putting the entire method signature in the final executable, but since we are already able to get Type, Field and Method names, the infrastructure to store this info is already present in the compiled Executables.

And from this, it should also be a small step to also include the actual Code in the methods.
I've run into a bit of a wall with reflection as we have no way to access/modify the code inside methods. This severely limits the usefullness of Reflection in general.
Dynamically creating types with fields and methods is one thing, but if we can't actually put any code in those methods, there isn't much use for it, other than the Serializers I Posted above.

The end result will be that the entire program's sourcecode is also present in the executable, which may be undesirable to some, but the way I see it is that you've allready made the first step towards doing just that.. Why not go all the way?


ps: For those interested, the following zip contains the code for the aforementioned BinaryFormatter, XmlFormatter and AsciiFormatter with some example code.

http://jimt.syntaxbomb.com/code/bmx/Serialization.zip


Azathoth(Posted 1+ years ago) #105
The key parameter is optional.
The metadata is put in the '{' '}' brackets

Type TTest {ABC}
	Field x {Z = "blah" Y = "blah"}
EndType

Local id:TTypeId=TTypeId.ForName( "TTest" )

Print id.MetaData()
For Local fld:TField=EachIn id.EnumFields()
	Print fld.Name()+":"+fld.TypeId().Name()
	Print fld.MetaData()
Next



Jim Teeuwen(Posted 1+ years ago) #106
mm that's an interesting way to do type attributes.
Thanks for the info.


Vlad(Posted 1+ years ago) #107
Congratulations, Mark. Very good update. Reflection is useful.
But I want to ask about metadata. Why format is {key= "value"}, but adding other keys, like this:{key1="value1", key2="value2"} is impossible? If only one keyname is accepted, then more useful format is just {"value"}.
BTW do u plan to improve bcc for set of keynames?

And how about official scripting module? Reflection is easily to implement it. And u already have a parsing code. Official scripting module will nice and useful. Just write some base functionality and compile it to an exe file. And put all logic to the external script files. Don't need to write an interface code from sources to external script engine.

I'm sry for my bad english ;/


Azathoth(Posted 1+ years ago) #108
See my example, you don't use a comma for multiple keys


Vlad(Posted 1+ years ago) #109
Tnx Azathoth.


Canali(Posted 1+ years ago) #110
Very glad to see that there is still support and fixing in BlitzMax.

This means that BltzResearch will still spend time on BlitzMax?


nawi(Posted 1+ years ago) #111
Nice, fixed the 'appstub.linux signal 11' error for me.