Linked List Syntax

BlitzMax Forums/BlitzMax Beginners Area/Linked List Syntax

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

you can look for yourself in the mods directory. Cool thing about BMAX is that it is written in BMAX.



' LIST METHODS
strict
global n$ 
global list$
global mylist:Tlist
Global this_func = 1
Global link_count
Global this_link:Tlink
Global total_funcs = 5
global listfunction$
Local timer
Const WAIT_TIME = 25


Global GH = 640 ; Global GW = 480 ; Global GD = 0
Graphics( GH,GH,GD )

GLobal a$[] = ["one","two","three","four"]
mylist:Tlist = ListFromArray(a$)

For n$ = EachIn mylist
	list$ = list$ + n$ + " "
Next

listfunction$ = "ListFromArray"
Repeat
cls
	timer:-1
	If timer < 0 Then timer = 0
	
	
	
	If Mousedown(1) And timer = 0
	 	changefunction()
		timer = WAIT_TIME
	endif
	
	SetScale 1,1
	SetColor 255,255,255
	DrawText "Click Mouse",MouseX(),MouseY()-48
	SetColor 255,255,255
	DrawText this_func,MouseX(),MouseY()-32
	SetColor 255,255,0
	DrawText listfunction$,MouseX(),MouseY()-16
	SetScale 1.5,1.5
	SetColor 255,0,0
	DrawText list$,MouseX(),MouseY()

flip
Until KeyHit(KEY_ESCAPE)

Function changefunction()
	
	
	this_func:+1
	If this_func > total_funcs Then this_func = 1
	
	Select this_func
		Case 1
			mylist:Tlist = ListFromArray(a$)
			listfunction$ = "Mylst.ListFromArray(Array)"

		Case 2
			
			this_link:Tlink = ListFindLink(mylist,"three")
			mylist.insertbeforelink("2-1/2",this_link)
			listfunction$ = "Mylist.InsertBeforeLink(object,link--'three')"
		Case 3
			this_link:Tlink = ListFindLink(mylist,"three")
			mylist.insertafterlink("3-1/2",this_link)
			listfunction$ = "Mylist.InsertBeforeLink(object,link--'three')"

		Case 4
			mylist:Tlist = ListFromArray(a$)
			listfunction$ = "Mylist.ListFromArray(Array)"

			mylist.remove("three")
			listfunction$ = "remove('three')"

		Case 5
			mylist:Tlist = ListFromArray(a$)
			link_count = mylist.count()
			listfunction$ = "Mylist.count() = "+link_count

			
			

	End Select
	
	list$ = ""
	For n$ = EachIn mylist
			list$ = list$ + n$ + " "
	Next


End Function



as far as Documentation, Mr Sibly has often admitted that he *Strongly Dislikes* doing the docs. As a result it appears that he implemented the BBDOCS system to make it simpler to do on the fly documentation.

BMAX docs are 10X better than Blitz3D docs were at launch.

I think Skidracer is working on alot of the docs at the moment as well, so while we probably won't get "war and peace", we'll likely have pretty good docs to start out with (remember folks, this is beta!)