Include Digger

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

It is set up to do any Freebasic compiler whether native to the system or not.
Can also do libraries.

In the menu:
Library -> Add external library

A dialog box will open to allow you to select the MAIN ".bi" file for the library. And then, yes, will parse that and any other "Included" files.
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

Version 1.1.1 July 9, 2019
-- Added fbc compiler version '1.07.0' to the list of available compilers.
---- Only for when adding a "non-native" compiler.
-- Added '.inc' to list of parsable files.
-- Fix load error for native compilers.

Source: https://github.com/bcohio2001/Freebasic-Include-Digger
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Include Digger

Post by MrSwiss »

There is nothing new on GitHub ... still the version of: Sept. 30th, 2018
(no changes since then, please check)
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

Ok. Check it now.

I am still trying to figure out GitHub.
Am using "GitHub Desktop" for the first time to update. Did not know that had to "Push" to update.
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

On a general note to all:

When adding the compiler, it takes a long time to process all the files.
Have a progress bar dialog to display progress, but bogs down and says that program is not responding.
Give it time ...
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Include Digger

Post by speedfixer »

Hi

I love support for large projects like this. It helps everyone, and shows that FB is a serious tool.
I haven't used/adapted this yet, but have been watching and will when I have a free point in time.

Is this project Windows only? I guess I missed that, somewhere. (I use Linux only.)

I peeked at Progress Bar.bi.
For your progress bar, maybe I missed it, but add a timer check. Update no quicker than every tenth second or so, whatever is pleasing/smooth.

(I just use a 'spinner' char set every 300 ms; less clutter/cleanup. To me, bars suggest you know when the process will end and your prediction has meaning. An activity indicator just says: "I'm not dead, yet.")
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

ANY help, comments will be gladly accepted.

Here is the sub which "Builds" the database.
Obviously not runnable.

Code: Select all

Sub Parser.Build(ReBuildFlag As Long)
	Dim As String PBTitle
	Dim As Long x, BumpFactor, NextBump
	'
	Select Case ReBuildFlag
		Case FBInc_Build_Init
			PBTitle = "Initial build of"
		Case FBInc_Build_Comp
			PBTitle = "Compiler change - Rebuilding"
		Case FBInc_Build_IncDiff
			PBTitle = "Include files change - Rebuilding"
		Case FBInc_Build_DBChange
			PBTitle = "Database storage change - Rebuilding"
		Case Else
			'FBInc_Build_User
			'this comes from main dlg (others from .Load())
			PBTitle = "Requested rebuild of"
			If CompType = CompType_Lib Then
				ReDim Preserve FileData(0) 'keep base file name
				'FileData(0).FileName = Mid(LibPath, LenPlace) 'remove Place/
				FileData(0).DataLoc = 0 'ensure cleared
				FileData(0).TimeStamp = FileDateTime(FBIncPath + FileData(0).FileName) 'might have new timestamp
				FileData(0).Count = -1 'mark not parsed
				ArrBound = 0
				'
				DB.BuildOpen() 'deletes database file
				Lib_PreBuild()
			Else
				For x = 0 To ArrBound
					FileData(x).Count = -1 'mark not parsed
					FileData(x).DataLoc = 0 'ensure cleared
				Next
			EndIf
	End Select
	'
	'progress dialog
	Dim As Long PBOpen 'flag if progress bar dlg created
	Dim As ProgBarDlg MyProgress = ProgBarDlg(PBTitle + " database - Parsing files")
	MyProgress.SetRange(1, ArrBound + 1)
	MyProgress.SetBackG(BGR(127, 127, 0))
	If ArrBound > 99 Then
		BumpFactor = ceil(ArrBound/100) '<-- crt/math.bi
	Else
		BumpFactor = 1
	EndIf
	NextBump = BumpFactor
	'
	' **** Initial build ****
	DB.BuildOpen() 'closes and deletes file if needed, then reopen for full access
	PBOpen = MyProgress.OpenIt()
	For x = 0 To ArrBound
		'Parse it
		Parse(x) 'NO MORE RECURSION ---
		'progress bar active and time for next inc of bar
		If PBOpen > 0 And x > NextBump Then
			MyProgress.BumpIt(x+1)
			NextBump += BumpFactor
		EndIf
	Next
	If PBOpen > 0 Then
		MyProgress.KillIt()
		PBOpen = 0
	EndIf
	'
	'identify "#Include"
	Dim As ItemDef I 'read into this
	Dim As Long y
	Dim As ULong Plat(ArrBound)
	Dim As UShort Prop(ArrBound)
	'
	MyProgress = ProgBarDlg(PBTitle + " database - Identify dependencies")
	MyProgress.SetRange(1, DB.ItemCount)
	MyProgress.SetBackG(BGR(127, 127, 0))
	If DB.ItemCount > 99 Then
		BumpFactor = ceil(DB.ItemCount/100) '<-- crt/math.bi
	Else
		BumpFactor = 1
	EndIf
	NextBump = BumpFactor
	'
	DB.PosInFile(1)
	PBOpen = MyProgress.OpenIt()
	For x = 1 To DB.ItemCount
		I = DB.ReadItem()
		If (I.ItemProperties And FBInc_Data_Inc) = FBInc_Data_Inc Then
			'#Include
			y = GetFileIndex(I.Name, I.FileNum) 'include this file
			If y >= 0 Then
				'file found
				'This file will be loaded with this Platform/Properties
				Plat(y) Or= I.Platform 'first time might be Win32 then later Linux....
				Prop(y) Or= (I.ItemProperties And (FBInc_Lang_Mask Or FBInc_Format_Mask)) 'only save last 4 bits
			EndIf
		EndIf
		If PBOpen > 0 And x > NextBump Then
			MyProgress.BumpIt(x+1)
			NextBump += BumpFactor
		EndIf
	Next
	If PBOpen > 0 Then
		MyProgress.KillIt()
		PBOpen = 0
	EndIf
	'
	'Assign
	'DB.PosInFile(1) 'top of file
	MyProgress = ProgBarDlg(PBTitle + " database - Assigning dependencies")
	MyProgress.SetRange(1, ArrBound + 1)
	MyProgress.SetBackG(BGR(127, 127, 0))
	If ArrBound > 99 Then
		BumpFactor = ceil(ArrBound/100) '<-- crt/math.bi
	Else
		BumpFactor = 1
	EndIf
	NextBump = BumpFactor
	PBOpen = MyProgress.OpenIt()
	Dim As ULong RewriteLoc
	For x = 0 To ArrBound
		'anything saved from this file
		If FileData(x).Count > 0 Then
			'if no dependancies found, skip
			If Plat(x) > 0 Or Prop(x) > 0 Then
				'position for start of this file
				DB.PosInFile(FileData(x).DataLoc)
				'NOTE: not changing length of "record", just changing ULong and UShort values
				For y = 1 To FileData(x).Count
					'store rewrite location
					RewriteLoc = DB.PosInFile()
					I = DB.ReadItem()
					'make changes, if needed
					If Plat(x) > 0 Then I.Platform = Plat(x)
					If Prop(x) > 0 Then I.ItemProperties = (I.ItemProperties And FBInc_Data_Mask) Or Prop(x)
					'reposition for rewrite
					DB.PosInFile(RewriteLoc)
					DB.WriteItem(I)
				Next
			EndIf
		EndIf
		'progress bar active and time for next inc of bar
		If PBOpen > 0 And x > NextBump Then
			MyProgress.BumpIt(x+1)
			NextBump += BumpFactor
		EndIf
	Next
	If PBOpen > 0 Then
		MyProgress.KillIt()
		PBOpen = 0
	EndIf
	'Reopen new database
	DB.RegOpen(DB.CurrV)
	DataAdded = TRUE
End Sub
As for running on Linux? It uses just general dlg commands, so I don't see why not.
I don't know anything about Linux to know if it would work.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Include Digger

Post by speedfixer »

At least the status bar uses the hwnd structure.

Your main include asks for 'windows.bi.'

That won't compile in Linux.

david
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Include Digger

Post by MrSwiss »

bcohio2001 wrote:As for running on Linux? It uses just general dlg commands, so I don't see why not.
DLG structs are part of WIN-API, which means automatically "Windows only".
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Include Digger

Post by speedfixer »

Thanks.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Include Digger

Post by TJF »

speedfixer wrote:I love support for large projects like this. It helps everyone, and shows that FB is a serious tool.
AFAICS this project provides a subset of the fbdoc features. And fbdoc is
  • documented (self-generating docs for Doxygen backend)
  • cross-platform
  • a text tool that can get integrated in the build management system
  • expandable by plugins, so it can generate any desired output format (examples: simple list of symbols, python ctypes wrapper)
Regards
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

MrSwiss wrote:DLG structs are part of WIN-API, which means automatically "Windows only".
I have seen postings of a "dialog" that did not look like "Window's" dialog. So I assumed that Linux has a way to create them.
As I said before, I know nothing of Linux.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Include Digger

Post by MrSwiss »

bcohio2001 wrote:So I assumed that Linux has a way to create them.
Yes there are, but you'd have to use a GFX lib. and hand-create them, yourself
(for multi platform), or use xWin (Linux/Unix equivalent of WIN-API).

The alternative is: OpenGL (which exists in both OS's).
bcohio2001
Posts: 556
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: Include Digger

Post by bcohio2001 »

Modifying now with FLTK … Going to be a while until done. But am working on it.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Include Digger

Post by speedfixer »

I appreciate the effort. Thank you.

I chose FB when I got back to (serious) programming when I retired because:
it was relatively cross-platform
it was relatively fast in execution
it was small in executable size
it was easily extensible (easy C linking) - which gives it lower level power
it was small
Large bonus: the community was nice, responsive, helpful, very aggressively being expertly developed. Very few trolls.
Very little 'guru' attitude of the helpers. (Easy to measure by the number and tone of RTM replies. AND the frequency that any 'developer' participated in the discussions.)

I had started with D, but when cataloging the keywords, I found:
--- it was not small
--- it was not finished enough
--- it was not self-consistent
--- it 'fixed' itself with too many properties and modifiers (leaning on RTTI, etc. will hurt FB later, I believe)
I quit when my inventory of keywords and exceptions hit 2500 and I was not even close to comprehensive
The process of my choice took well over a year.

I would NEVER choose that kind of learning load or ask it of anyone else. That's why c and c++ (burden of the syntax) were not a choice.

Bottom line: I only 'cherry pick' code and projects that all truly cross-platform.
Just ... my choice.

Porting to any non-Windows-only graphics library qualifies as cross-platform. Any effort like this lowers the bar for another to learn and promotes better programming style, generally, to my mind.

Again, thank you for the effort.

david
Post Reply