I cannot test more than gcc 9.3, I don't have higher gcc.
These builtin functions seem to reside in cc1.exe.
I can look for things with
Code: Select all
shell " MODE CON: COLS=170 LINES=500"
#include "file.bi"
#include "crt.bi"
Declare Function stats Cdecl Alias "_stat"(As zstring Ptr,As Any Ptr) As Integer
Function String_Split(s_in As String,chars As String,result() As String) As Long
Dim As Long ctr,ctr2,k,n,LC=Len(chars)
Dim As boolean tally(Len(s_in))
#macro check_instring()
n=0
While n<Lc
If chars[n]=s_in[k] Then
tally(k)=true
If (ctr2-1) Then ctr+=1
ctr2=0
Exit While
End If
n+=1
Wend
#endmacro
#macro split()
If tally(k) Then
If (ctr2-1) Then ctr+=1:result(ctr)=Mid(s_in,k+2-ctr2,ctr2-1)
ctr2=0
End If
#endmacro
'================== LOOP TWICE =======================
For k =0 To Len(s_in)-1
ctr2+=1:check_instring()
Next k
if ctr=0 then
if len(s_in) andalso instr(chars,chr(s_in[0])) then ctr=1':beep
end if
If ctr Then Redim result(1 To ctr): ctr=0:ctr2=0 Else Return 0
For k =0 To Len(s_in)-1
ctr2+=1:split()
Next k
'===================== Last one ========================
If ctr2>0 Then
Redim Preserve result(1 To ctr+1)
result(ctr+1)=Mid(s_in,k+1-ctr2,ctr2)
End If
Return Ubound(result)
End Function
Function _Remove(Byval Text As String,Char As String) As String
Var index = 0,asci=Asc(char)
For i As Integer = 0 To Len(Text) - 1
If Text[i] <> ASCi Then Text[index] = Text[i] : index =index+ 1
Next
Return Left(Text,index)
End Function
Function loadfile(file As String) As String
file= _remove(file,Chr(34))
If file="" Then Exit Function
If Fileexists(file)=0 Then Print file;" CAN'T READ (OR EMPTY FOLDER)":Exit Function
Var f=Freefile
Open file For Binary Access Read As #f
Dim As String text
If Lof(f) > 0 Then
text = String(Lof(f), 0)
Get #f, , text
End If
Close #f
Return text
End Function
Function isfolder(path As zstring Ptr) As Long
#define S_ISDIR(m) (((m) And &hF000) = &h4000)
Dim As stat statbuf
If (stats(path, @statbuf) <> 0) Then Return 0
Return S_ISDIR(statbuf.st_mode)
End Function
Function isfile(fname As String) As boolean
Return Iif(isfolder(fname),0,1)
End Function
Function pipeout(Byval s As String="") Byref As String
Var f=Freefile
Dim As String tmp
Open Pipe s For Input As #f
s=""
Do Until Eof(f)
Line Input #f,tmp
s+=tmp+Chr(10)
Loop
Close #f
Return s
End Function
Function tally (somestring As String,partstring As String) As Integer
Dim As Integer i,j,ln,lnp,count,num
ln=Len(somestring)
lnp=Len(partstring)
count=0
i=-1
Do
i+=1
If somestring[i] <> partstring[0] Then Goto skip
If somestring[i] = partstring[0] Then
For j=0 To lnp-1
If somestring[j+i]<>partstring[j] Then Goto skip
Next j
End If
count+=1
i=i+lnp-1
skip:
Loop Until i>=ln-1
Return count
End Function
function search(inputs As String,st As String,ext as string="") as long
st=Lcase(st)
dim as long dflag
'Redim As String tmp()
dim as string path
If isfile(inputs) Then 'for a single file or a drive:
if len(inputs)=2 and inputs[1]=asc(":") then dflag=1:goto skip
Var L=Lcase(loadfile(inputs))
If Instr(L,st) Then Print inputs:Return 1 Else Return 0
End If
skip:
Dim As String file
If Instr(inputs," ") Then inputs=Chr(34)+inputs+Chr(34)
Dim As String s=pipeout("dir /b " + inputs)
Dim As String a()
Static As Long counter
string_split(s,Chr(13,10),a())
inputs=_remove(inputs,Chr(34))
if dflag=0 then 'not a drive
redim as string tmp()
string_split(inputs,"\/",tmp())
if instr(tmp(ubound(tmp)),st) then print inputs;" >> (In folder name)":counter+=1
end if
For n As Long=Lbound(a) To Ubound(a)
path=(inputs+"\"+a(n)) '''
If isfile(path) Then
Redim As String tmp()
string_split(path,"\",tmp())
file= tmp(Ubound(tmp))
If Instr(file,st) Then Print path;" >> (In file name)":counter+=1
If Instr(file," ") Then file=Chr(34)+file+Chr(34)
' print path
if len(ext) then if instr(file,ext)=0 then goto nxt 'path
Var L=Lcase(loadfile(path))
If Len(L) Andalso Instr(L,st) Then Print path + " ("+ str(tally(L,st))+")":counter+=1
Else
search(path,st,ext) 'for nested folders
End If
nxt:
Next n
return counter
End function
'========================== fill this bit in ==================================
Dim As String location= "C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0"'
print "You are using fb version ";__fb_version__
print "output format:"
print "path to file (number of occurencies in the file)"
Print "Searching . . .";
print
'search(path,string to look for,file extension - example .txt, or leave blank)
var c=search(location,"builtin","")
Print "Done ",c; " locations"
Sleep
From the freebasic distribution (the location path)
My result for "builtin"
Code: Select all
You are using fb version 1.08.1
output format:
path to file (number of occurencies in the file)
Searching . . .
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\cc1.exe (4590)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\ld.exe (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\libgcc_s_sjlj-1.dll (4)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\libiconv-2.dll (4)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\libisl-22.dll (16)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\i686-w64-mingw32\9.3.0\libmpfr-6.dll (22)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\cc1.def (103)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\cc1.exe (4601)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\ld.exe (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\libgcc_s_sjlj-1.dll (4)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\libiconv-2.dll (4)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\libisl-22.dll (16)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\libexec\gcc\x86_64-w64-mingw32\9.3.0\libmpfr-6.dll (22)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win32\gcc.exe (19)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win32\ld.exe (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win64\gcc.exe (19)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win64\ld.exe (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\changelog.txt (10)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\examples\manual\proguide\pointers\builtin.bas >> (In file name)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\examples\manual\proguide\pointers\builtin.bas (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\examples\manual\proguide\typalias\builtin.bas >> (In file name)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\examples\manual\proguide\typalias\builtin.bas (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\examples\misc\trycatch\trycatch.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\fbc32.exe (44)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\fbc64.exe (44)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\allegro5\allegro_font.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\clang-c.bi (3)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\dos\sys\djtypes.bi (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\fbc-int\memory.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\ffi.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\gtk\gtk2.bi (5)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\gtk\gtk3.bi (4)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\jit.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\libxml\schemasInternals.bi (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\libxml\xmlschemastypes.bi (3)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\gdiplus-c.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\GdiplusImaging.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\intrin.bi (3)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\objidl.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winerror.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winnt.bi (34)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winspool.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\wx-c\defs.bi (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\crt2.o (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libgcc.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libgcc_eh.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libgmon.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libmincore.dll.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libmingw32.a (3)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libmingwex.a (62)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libmsvcrt-os.dll.a (20)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libmsvcrt.dll.a (20)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libstdc++.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libsupc++.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libucrt.dll.a (13)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libucrtbase.dll.a (13)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libws2_32.dll.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win32\libwsdapi.dll.a (5)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\crt2.o (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libgcc.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libgcc_eh.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libgmon.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libmincore.dll.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libmingw32.a (3)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libmingwex.a (62)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libmsvcrt-os.dll.a (20)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libmsvcrt.dll.a (20)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libnetui1.dll.a (20)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libnetui2.dll.a (10)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libstdc++.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libsupc++.a (1)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libucrt.dll.a (13)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libucrtbase.dll.a (13)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libws2_32.dll.a (2)
C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\libwsdapi.dll.a (5)
Done 75 locations
searching for "builtin_cpu" gives only 2 locations with 4 examples in each and the locations are in cc1.exe (both).
That's all I can help with just now.
I got all my complex functions from libmingwex.a
It is a hobby in it's own right, tracking down strange functions from the distribution.
I also use nm somefile now and then, if there are symbols then all the functions are listed, usually
T tags any usable things.
Also I see that gmp-10.dll (and others) are available, saves Googling for them.
Never a dull moment with freebasic.