initiaql check-in, moved repository -- no-longer a fork of
haikuarchives/yab
This commit is contained in:
77
yab-IDE/BuildFactory/AutoFooter.mak
Normal file
77
yab-IDE/BuildFactory/AutoFooter.mak
Normal file
@@ -0,0 +1,77 @@
|
||||
##
|
||||
## GCC Options
|
||||
##
|
||||
|
||||
SH=$(shell finddir B_SYSTEM_HEADERS_DIRECTORY)
|
||||
UH= $(shell finddir B_USER_HEADERS_DIRECTORY)
|
||||
GCC = gcc
|
||||
GCC_OPT = $(DBG) $(OPT) -I. $(addprefix -I,$(SH)) $(addprefix -I,$(UH)) -DHAVE_CONFIG -DUNIX $(HAIKUOPT)
|
||||
GPP = g++
|
||||
GPP_OPT = $(DBG) $(OPT) -I. -DHAVE_CONFIG -DUNIX $(HAIKUOPT)
|
||||
|
||||
|
||||
##
|
||||
## Compile and link
|
||||
##
|
||||
yab: YabMain.o YabInterface.o YabWindow.o YabView.o YabBitmapView.o YabFilePanel.o YabFilePanelLooper.o YabList.o \
|
||||
YabText.o flex.o bison.o symbol.o function.o graphic.o io.o main.o $(COLUMN) column/YabColumnType.o column/ColorTools.o YabStackView.o SplitPane.o URLView.o YabControlLook.o \
|
||||
$(HAIKUTAB) Spinner.o column/ColumnListView.o CalendarControl.o
|
||||
$(GPP) $(GPP_OPT) -o $(TARGET) YabMain.o YabInterface.o YabWindow.o YabView.o YabBitmapView.o YabText.o YabFilePanel.o \
|
||||
YabFilePanelLooper.o YabList.o main.o function.o io.o graphic.o symbol.o bison.o flex.o $(COLUMN) column/YabColumnType.o column/ColorTools.o \
|
||||
YabStackView.o SplitPane.o URLView.o YabControlLook.o $(HAIKUTAB) Spinner.o $(TABLIB) CalendarControl.o \
|
||||
$(LIBPATH) $(LIB)
|
||||
YabMain.o: YabMain.cpp
|
||||
$(GPP) $(GPP_OPT) -c YabMain.cpp -o YabMain.o
|
||||
YabInterface.o: YabInterface.cpp YabInterface.h global.h YabMenu.h
|
||||
$(GPP) $(GPP_OPT) -c YabInterface.cpp -o YabInterface.o
|
||||
YabWindow.o: YabWindow.cpp YabWindow.h global.h
|
||||
$(GPP) $(GPP_OPT) -c YabWindow.cpp -o YabWindow.o
|
||||
YabView.o: YabView.cpp YabView.h
|
||||
$(GPP) $(GPP_OPT) -c YabView.cpp -o YabView.o
|
||||
YabBitmapView.o: YabBitmapView.cpp YabBitmapView.h
|
||||
$(GPP) $(GPP_OPT) -c YabBitmapView.cpp -o YabBitmapView.o
|
||||
YabFilePanel.o: YabFilePanel.cpp YabFilePanel.h
|
||||
$(GPP) $(GPP_OPT) -c YabFilePanel.cpp -o YabFilePanel.o
|
||||
YabFilePanelLooper.o: YabFilePanelLooper.cpp YabFilePanelLooper.h
|
||||
$(GPP) $(GPP_OPT) -c YabFilePanelLooper.cpp -o YabFilePanelLooper.o
|
||||
YabList.o: YabList.cpp YabList.h
|
||||
$(GPP) $(GPP_OPT) -c YabList.cpp -o YabList.o
|
||||
YabText.o: YabText.cpp YabText.h
|
||||
$(GPP) $(GPP_OPT) -c YabText.cpp -o YabText.o
|
||||
bison.o: bison.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c bison.c -o bison.o
|
||||
flex.o: flex.c bison.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c flex.c -o flex.o
|
||||
function.o: function.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c function.c -o function.o
|
||||
io.o: io.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c io.c -o io.o
|
||||
graphic.o: graphic.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c graphic.c -o graphic.o
|
||||
symbol.o: symbol.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c symbol.c -o symbol.o
|
||||
main.o: main.c yabasic.h config.h
|
||||
$(GCC) $(GCC_OPT) -c main.c -o main.o
|
||||
YabStackView.o: YabStackView.cpp YabStackView.h
|
||||
$(GPP) $(GPP_OPT) -c YabStackView.cpp -o YabStackView.o
|
||||
SplitPane.o: SplitPane.cpp SplitPane.h
|
||||
$(GPP) $(GPP_OPT) -c SplitPane.cpp -o SplitPane.o
|
||||
URLView.o: URLView.cpp URLView.h
|
||||
$(GPP) $(GPP_OPT) -c URLView.cpp -o URLView.o
|
||||
Spinner.o: Spinner.cpp Spinner.h
|
||||
$(GPP) $(GPP_OPT) -c Spinner.cpp -o Spinner.o
|
||||
column/ColumnListView.o: column/ColumnListView.cpp column/ColumnListView.h column/ObjectList.h
|
||||
$(GPP) $(GPP_OPT) -c column/ColumnListView.cpp -o column/ColumnListView.o
|
||||
column/ColorTools.o: column/ColorTools.cpp column/ColorTools.h
|
||||
$(GPP) $(GPP_OPT) -c column/ColorTools.cpp -o column/ColorTools.o
|
||||
column/YabColumnType.o: column/YabColumnType.cpp column/YabColumnType.h
|
||||
$(GPP) $(GPP_OPT) -c column/YabColumnType.cpp -o column/YabColumnType.o
|
||||
$(HAIKUTAB): YabTabView.cpp YabTabView.h
|
||||
$(GPP) $(GPP_OPT) -c YabTabView.cpp -o YabTabView.o
|
||||
CalendarControl.o: CalendarControl.cpp CalendarControl.h DateTextView.cpp MonthWindow.cpp MonthView.cpp MouseSenseStringView.cpp
|
||||
$(GPP) $(GPP_OPT) -c CalendarControl.cpp -o CalendarControl.o
|
||||
YabControlLook.o: YabControlLook.h YabControlLook.cpp
|
||||
$(GPP) $(GPP_OPT) -c YabControlLook.cpp -o YabControlLook.o
|
||||
|
||||
clean:
|
||||
rm -f core *.o column/*.o yabasic.output
|
||||
40
yab-IDE/BuildFactory/AutoHeader.mak
Normal file
40
yab-IDE/BuildFactory/AutoHeader.mak
Normal file
@@ -0,0 +1,40 @@
|
||||
##
|
||||
## yab Haiku BuildFactory Makefile
|
||||
##
|
||||
## (c) Jan Bungeroth 2009 - 2011
|
||||
## Artistic License.
|
||||
##
|
||||
|
||||
##
|
||||
## Haiku stuff
|
||||
##
|
||||
HAIKUTAB = YabTabView.o
|
||||
HAIKUOPT = -DHAIKU
|
||||
|
||||
##
|
||||
## Use our own column list view
|
||||
##
|
||||
COLUMN = column/ColumnListView.o
|
||||
|
||||
##
|
||||
## enable debug
|
||||
##
|
||||
# DBG = -g
|
||||
#
|
||||
|
||||
##
|
||||
## enable optimization
|
||||
##
|
||||
OPT = -O
|
||||
#
|
||||
|
||||
##
|
||||
## Libraries
|
||||
##
|
||||
##LIBPATH = -L/boot/home/config/lib
|
||||
##LIBPATH = -L/boot/system/lib
|
||||
LIBPATHS = $(shell findpaths B_FIND_PATH_DEVELOP_LIB_DIRECTORY)
|
||||
LIBPATH=$(addprefix -L,$(LIBPATHS))
|
||||
|
||||
LIB = -lbe -lroot -ltranslation -ltracker -lmedia -lz
|
||||
|
||||
488
yab-IDE/BuildFactory/BuildFactory.yab
Executable file
488
yab-IDE/BuildFactory/BuildFactory.yab
Executable file
@@ -0,0 +1,488 @@
|
||||
#!yab
|
||||
|
||||
//////////////////////////////////////
|
||||
// BuildFactory v 2.4
|
||||
//////////////////////////////////////
|
||||
|
||||
// find out in which directory we are
|
||||
if (peek("isbound")) then
|
||||
This_dir$ = peek$("directory")+"/"
|
||||
else
|
||||
This_dir$ = trim$(system$("pwd"))+"/"
|
||||
fi
|
||||
|
||||
if (system("test -e \""+This_dir$+"yab\"")) then
|
||||
YAB$ = "yab"
|
||||
else
|
||||
YAB$ = This_dir$+"yab"
|
||||
fi
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// if yab gives us its version, we know that it exists.
|
||||
// Otherwise we tell the user to make sure that there is one
|
||||
/////////////////////////////////////////////////////////////
|
||||
if (system(YAB$+" -version")) then
|
||||
print "Please make sure you have a yab binary in"
|
||||
print "\t"+left$(This_dir$, len(This_dir$)-1)
|
||||
print "or"
|
||||
print "\t/home/config/bin"
|
||||
print "or"
|
||||
print "\t/system/bin\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
// set some global variables here
|
||||
AppName$ = "BuildFactory"
|
||||
VERSION$ = " 2.4.1"
|
||||
TMP_folder$ = "/boot/var/tmp/BUILD_FACTORY_TMP/"
|
||||
Lib_path$ = "/boot/home/config/settings/yab/"
|
||||
|
||||
dim Library$(1)
|
||||
dim Is_in_lib_path(1)
|
||||
dim Found_sub$(1)
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Program starts here
|
||||
//
|
||||
|
||||
if (not open(1,"flex.c")) then
|
||||
system("yab flex-bison.yab") // make flex.c and modify it for BuildFactory
|
||||
else
|
||||
close #1
|
||||
endif
|
||||
|
||||
if (peek("argument") < 2) then
|
||||
UsageAdvise(1)
|
||||
fi
|
||||
|
||||
// in- and outputfiles
|
||||
Output_file$ = peek$("argument")
|
||||
Input_file$ = peek$("argument")
|
||||
appsig$ = peek$("argument")
|
||||
run_from_ide$ = peek$("argument")
|
||||
if appsig$="" appsig$="application/x-vnd.yab-app"
|
||||
SetAppSig(appsig$)
|
||||
|
||||
Input_dir$ = left$(Input_file$, rinstr(Input_file$, "/"))
|
||||
Library$(0) = right$(Input_file$, len(Input_file$)-rinstr(Input_file$, "/"))
|
||||
|
||||
if (trim$(Input_dir$) = "") Input_dir$ = This_dir$
|
||||
|
||||
// create the temp folder
|
||||
if (system("test -d \""+TMP_folder$+"\"")) then
|
||||
if (system("mkdir -p \""+TMP_folder$+"\"")) then
|
||||
print "-- Error while creating temp folder!"
|
||||
UsageAdvise(1)
|
||||
fi
|
||||
fi
|
||||
|
||||
// We clean up all the files including the libs, if existing
|
||||
for NL = 0 to num_lib
|
||||
if (Is_in_lib_path(NL)) then
|
||||
lib$ = Lib_path$+Library$(NL)
|
||||
else
|
||||
lib$ = Input_dir$+Library$(NL)
|
||||
fi
|
||||
num_lib = CleanUpCode(lib$)
|
||||
next NL
|
||||
|
||||
// writing all the libs into the mainfile
|
||||
// because the BuildFactory can not handle libs
|
||||
err = JoinFiles(Output_file$+"_bf.yab")
|
||||
|
||||
// here it comes - the BuildFactory
|
||||
BuildFactory(Output_file$+"_bf.yab")
|
||||
|
||||
// cleaning up
|
||||
RmErr = RemoveTemp()
|
||||
system ("RdefApply parts/YAB.bf.rdef "+Output_file$)
|
||||
system ("addattr -t mime BEOS:APP_SIG "+appsig$+" "+Output_file$)
|
||||
system ("addattr -t mime BEOS:TYPE application/x-vnd.be-elfexecutable "+Output_file$)
|
||||
|
||||
|
||||
// check if the BuildFactory was envoked by the yab-ide.
|
||||
// if so, copy the output file to the inmputfile's directory and open the directory.
|
||||
// the IDE will delete the output file from the BuildFactory directory.
|
||||
|
||||
|
||||
if run_from_ide$ = "yab-ide" then
|
||||
system ("cp "+Output_file$+" "+Input_dir$)
|
||||
system ("open "+Input_dir$)
|
||||
endif
|
||||
|
||||
print "--------"
|
||||
print "-- Info:"
|
||||
print "\tNumber of libs:\t\t", num_lib
|
||||
print "\tNumber of subs:\t\t", num_sub
|
||||
print "\tNumber of lines:\t", num_line
|
||||
|
||||
exit
|
||||
|
||||
//
|
||||
// programm ends here
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////
|
||||
// joining all files to one
|
||||
///////////////////////////////////////////
|
||||
sub JoinFiles(the_file$)
|
||||
local in_file, out_file
|
||||
|
||||
out_file = OpenWriteFile(the_file$)
|
||||
for NL = 0 to num_lib
|
||||
// contents of each file is written to our joined temp file
|
||||
in_file = OpenReadFile(TMP_folder$+Library$(NL))
|
||||
while (not eof(in_file))
|
||||
print #out_file LineInput$(in_file)
|
||||
num_line = num_line + 1
|
||||
wend
|
||||
close in_file
|
||||
next NL
|
||||
close out_file
|
||||
|
||||
return
|
||||
end sub
|
||||
|
||||
///////////////////////////////////////////
|
||||
// here we are cleaning up the files
|
||||
///////////////////////////////////////////
|
||||
sub CleanUpCode(the_file$)
|
||||
local the_filename$, out_file$
|
||||
local in_file, out_file
|
||||
local Current_line$
|
||||
|
||||
the_filename$ = right$(the_file$, len(the_file$)-rinstr(the_file$, "/"))
|
||||
out_file$ = TMP_folder$+the_filename$
|
||||
|
||||
out_file = OpenWriteFile(out_file$)
|
||||
in_file = OpenReadFile(the_file$)
|
||||
|
||||
if (min(out_file, in_file) = 0) return -1
|
||||
|
||||
print "\t-- removing not needed stuff ..."
|
||||
while (not eof(in_file))
|
||||
Current_line$ = LineInput$(in_file)
|
||||
|
||||
if (double_sub) then
|
||||
if (upper$(left$(Current_line$, 7)) = "END SUB") double_sub = false
|
||||
continue
|
||||
fi
|
||||
|
||||
// remove empty lines and commented lines and stuff
|
||||
if (Current_line$ = "") continue
|
||||
if (left$(Current_line$, 2) = "//") continue
|
||||
if (left$(Current_line$, 1) = "#") continue
|
||||
if (upper$(left$(Current_line$, 11)) = "EXPORT SUB ") then
|
||||
Current_line$ = trim$(right$(Current_line$, len(Current_line$)-6))
|
||||
fi
|
||||
Current_line$ = CheckOnLineComments$(Current_line$)
|
||||
if (upper$(left$(Current_line$, 4)) = "SUB ") then
|
||||
curr_sub$ = right$(Current_line$, len(Current_line$)-4)
|
||||
curr_sub$ = left$(curr_sub$, instr(curr_sub$, "("))
|
||||
for NS = 0 to num_sub
|
||||
if (Found_sub$(NS) = curr_sub$) then
|
||||
double_sub = true
|
||||
break
|
||||
fi
|
||||
next NS
|
||||
|
||||
if (double_sub) then
|
||||
continue
|
||||
else
|
||||
num_sub = num_sub + 1
|
||||
dim Found_sub$(num_sub+1)
|
||||
Found_sub$(num_sub) = curr_sub$
|
||||
fi
|
||||
fi
|
||||
if (upper$(left$(Current_line$, 6)) = "IMPORT") then
|
||||
found_lib = FindLibraries(Current_line$)
|
||||
continue
|
||||
fi
|
||||
if (upper$(Current_line$) = "ENDIF") Current_line$ = "fi"
|
||||
|
||||
print #out_file Current_line$
|
||||
wend
|
||||
|
||||
close in_file
|
||||
close out_file
|
||||
|
||||
return found_lib
|
||||
end sub
|
||||
|
||||
////////////////////////////////////////////
|
||||
// search for comments behind a needed line
|
||||
// if found, remove it. Exept there is a "
|
||||
////////////////////////////////////////////
|
||||
sub CheckOnLineComments$(the_line$)
|
||||
D = instr(the_line$, "//")
|
||||
|
||||
if (D) then
|
||||
local is_comment
|
||||
local A : local B
|
||||
local C : local E
|
||||
|
||||
for B = 1 to len(the_line$)
|
||||
A = asc(mid$(the_line$, B, 1))
|
||||
if (B > D) then
|
||||
if (A = 34 and is_comment) then
|
||||
C = true
|
||||
break
|
||||
fi
|
||||
else
|
||||
E = asc(mid$(the_line$, B+1, 1))
|
||||
if (E = 34 and not A = 92) then
|
||||
if (is_comment) then
|
||||
is_comment = false
|
||||
else
|
||||
is_comment = true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
next B
|
||||
|
||||
if (not C) the_line$ = left$(the_line$, D-1)
|
||||
fi
|
||||
|
||||
return trim$(the_line$)
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// search for libraries, to prepare them as well
|
||||
/////////////////////////////////////////////////
|
||||
sub FindLibraries(the_line$)
|
||||
local Library$
|
||||
|
||||
Library$ = right$(the_line$, len(the_line$)-7)
|
||||
|
||||
if (upper$(right$(Library$, 4)) <> ".YAB") then
|
||||
Library$ = Library$+".yab"
|
||||
fi
|
||||
|
||||
num_lib = num_lib + 1
|
||||
dim Library$(num_lib+1)
|
||||
dim Is_in_lib_path(num_lib+1)
|
||||
|
||||
if (system("test -e \""+Input_dir$+Library$+"\"")) then
|
||||
if (system("test -e \""+Lib_path$+Library$+"\"")) then
|
||||
print "-- Could not find lib\n\t"+Library$
|
||||
num_lib = num_lib - 1
|
||||
return num_lib
|
||||
else
|
||||
Is_in_lib_path(num_lib) = true
|
||||
fi
|
||||
fi
|
||||
|
||||
Library$(num_lib) = Library$
|
||||
|
||||
print "-- Found lib: "+Library$
|
||||
return num_lib
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// open the inputfile for reading
|
||||
/////////////////////////////////////////////////////////////
|
||||
sub OpenReadFile(the_file$)
|
||||
local READ_FILE
|
||||
READ_FILE = 22
|
||||
|
||||
if (not open(#READ_FILE,the_file$,"r")) then
|
||||
print "-- Could not open "+the_file$
|
||||
print "-- for reading!"
|
||||
exit
|
||||
fi
|
||||
|
||||
return READ_FILE
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// open the outputfile for writing
|
||||
/////////////////////////////////////////////////////////////
|
||||
sub OpenWriteFile(the_file$)
|
||||
local WRITE_FILE
|
||||
WRITE_FILE = 23
|
||||
|
||||
if (not open(#WRITE_FILE,the_file$,"w")) then
|
||||
print "-- Could not open "+the_file$
|
||||
print "-- for writing!"
|
||||
exit
|
||||
fi
|
||||
|
||||
return WRITE_FILE
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////
|
||||
// read in one line from the given file
|
||||
/////////////////////////////////////////
|
||||
sub LineInput$(n)
|
||||
local tmp : local tmp$
|
||||
while (tmp <> 10)
|
||||
tmp = peek(n)
|
||||
if (tmp < 0) continue
|
||||
tmp$ = tmp$ + chr$(tmp)
|
||||
wend
|
||||
|
||||
return trim$(tmp$)
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Remove our tempfolder
|
||||
/////////////////////////////////////////////////////////////
|
||||
sub RemoveTemp()
|
||||
if (not system("test -d \""+TMP_folder$+"\"")) then
|
||||
RmErr = system("rm -rf \""+TMP_folder$+"\"")
|
||||
fi
|
||||
|
||||
return RmErr
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// tell the user how to use this app
|
||||
/////////////////////////////////////////////////////////////
|
||||
sub UsageAdvise(n)
|
||||
print "\n"+AppName$+VERSION$
|
||||
print "Usage:"
|
||||
print "\t"+AppName$+" outputfile inputfile < applicationsignature >\n"
|
||||
print "\tFilenames may have no spaces!\n"
|
||||
print "\tapplicationsignature default is: application/x-vnd.yab-app\n"
|
||||
RemoveTemp()
|
||||
|
||||
exit n
|
||||
end sub
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// set the application signature in YabMain.cpp
|
||||
/////////////////////////////////////////////////////////////
|
||||
sub SetAppSig(sig$)
|
||||
app_sig$="\n\tBString tmp(\""+sig$+"\");\n"
|
||||
open #1, This_dir$+"parts/YabMain.cpp.appsig","w"
|
||||
print #1 app_sig$
|
||||
close #1
|
||||
cmd$="cat "+This_dir$+"parts/YabMain.cpp.start "+This_dir$+"parts/YabMain.cpp.appsig "+This_dir$+"parts/YabMain.cpp.end > "+This_dir$+"YabMain.cpp"
|
||||
system(cmd$)
|
||||
|
||||
end sub
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
// the BuildFactory starts here
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
sub BuildFactory(f$)
|
||||
handle = open(f$, "r")
|
||||
if(not handle) then
|
||||
print "Error: Could not open file "+f$
|
||||
exit(1)
|
||||
endif
|
||||
|
||||
print "Reading file "+f$+"..."
|
||||
print
|
||||
|
||||
while(not eof(handle))
|
||||
numRead = numRead + 1
|
||||
dim line$(numRead)
|
||||
line$(numRead) = GetLine$(handle)
|
||||
wend
|
||||
close(handle)
|
||||
|
||||
print "Dumping file..."
|
||||
print
|
||||
DumpProg(f$)
|
||||
|
||||
// times have changed :)
|
||||
hasZeta = false
|
||||
|
||||
print "This yab version was compiled on "+peek$("os")+"."
|
||||
realOS$ = upper$(system$("uname -o"))
|
||||
realOS$ = left$(realOS$, len(realOS$)-1)
|
||||
print "This system is running "+realOS$
|
||||
|
||||
print "Writing Automakefile and global.h..."
|
||||
print
|
||||
|
||||
system("cp AutoHeader.mak Automakefile")
|
||||
|
||||
handle = open("Automakefile", "a")
|
||||
if(not handle) then
|
||||
print "Error: Could not write file Automakefile"
|
||||
exit(1)
|
||||
endif
|
||||
|
||||
print #handle "TARGET = "+left$(f$, len(f$)-7)
|
||||
|
||||
close(handle)
|
||||
|
||||
system("cat AutoFooter.mak >> Automakefile")
|
||||
|
||||
print "Starting make (ignore warnings)..."
|
||||
print
|
||||
system("make -f Automakefile clean")
|
||||
system("make -f Automakefile")
|
||||
system("make -f Automakefile clean")
|
||||
system("rm -f program.h Automakefile "+f$)
|
||||
print
|
||||
print "Finished"
|
||||
print
|
||||
|
||||
return
|
||||
end sub
|
||||
|
||||
sub GetFirstCommand$(line$)
|
||||
local t$: local ret$
|
||||
local i
|
||||
|
||||
t$ = ltrim$(line$)
|
||||
for i=1 to len(t$)
|
||||
if(mid$(t$,i,1) = " " or mid$(t$,i,1) = "\t" or mid$(t$,i,1) = "\n" or mid$(t$,i,1) = "(") break
|
||||
ret$ = ret$ + mid$(t$,i,1)
|
||||
next i
|
||||
return ret$
|
||||
end sub
|
||||
|
||||
sub DumpProg(fileName$)
|
||||
local handle
|
||||
local t$
|
||||
local i
|
||||
|
||||
if(val(system$("wc -c "+fileName$)) < 100) then
|
||||
print "WARNING: File too small, filling up program with comments"
|
||||
handle = open(fileName$, "a")
|
||||
if(handle) then
|
||||
print #handle "rem ~~ This comment was added by the ~~"
|
||||
print #handle "rem ~~ BuildFactory because your program ~~"
|
||||
print #handle "rem ~~ was too small. ~~"
|
||||
close(handle)
|
||||
else
|
||||
print "ERROR: Could not add comments, is "+fileName$+" write-protected?"
|
||||
exit(1)
|
||||
endif
|
||||
endif
|
||||
|
||||
system("yab-compress "+fileName$)
|
||||
handle = open("program.h", "a")
|
||||
if(handle) then
|
||||
print #handle "#define PROGLEN ";
|
||||
t$ = system$("wc -c "+fileName$)
|
||||
i = 1
|
||||
while(mid$(t$,i,1) = " ")
|
||||
i = i + 1
|
||||
wend
|
||||
if(i>1) t$ = right$(t$,len(t$)-i+1)
|
||||
t$ = left$(t$, instr(t$, " ")-1)
|
||||
print #handle t$
|
||||
close(handle)
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub GetLine$(handle)
|
||||
local tmp$
|
||||
local retString$
|
||||
|
||||
while(tmp$<>chr$(10) and tmp$<>chr$(13) and not eof(handle))
|
||||
tmp$ = chr$(peek(handle))
|
||||
retString$ = retString$ + tmp$
|
||||
wend
|
||||
|
||||
return retString$
|
||||
end sub
|
||||
|
||||
64
yab-IDE/BuildFactory/README
Normal file
64
yab-IDE/BuildFactory/README
Normal file
@@ -0,0 +1,64 @@
|
||||
-- English -- Englisch -- -- German below -- Deutsch unten --
|
||||
|
||||
Some rules you have to know:
|
||||
|
||||
Names of sub functions are only to be used once. This is for all affected files.
|
||||
If there are subs with the same name, only the first one will be taken over while
|
||||
the second will simply be ignored!
|
||||
|
||||
|
||||
In libraries only subs and export subs are to be entered. Additional code not within
|
||||
a sub or export sub are senseless later on, because libraries are simply added at the
|
||||
end of the main file, so that one big file is generated.
|
||||
So such additional lines are between the subs and are never read.
|
||||
|
||||
All libraries that are imported with import are recognized. Also libraries that were
|
||||
imported from within libraries.
|
||||
|
||||
Libraries have to be placed either in the folder of the main file or in the yab lib
|
||||
folder "/boot/home/config/settings/yab"!
|
||||
|
||||
The BuildFactory is to be used as follows:
|
||||
|
||||
yab BuildFactory Outputfile Inputfile.yab < applicationsig >
|
||||
|
||||
from within the folder of the BuildFactory. The Outputfile is also placed there at the end.
|
||||
The Inputfile has to have its relative or complete path included of course.
|
||||
|
||||
The file which contains the total of the code is also stored in the folder of the BuildFactory,
|
||||
for the case the created binary gives out error messages with line number. Those are of course
|
||||
regarded to this certain file.
|
||||
|
||||
|
||||
-- German -- Deutsch --
|
||||
|
||||
Ein paar Regeln, die man befolgen muss:
|
||||
|
||||
Namen für sub-Funktionen dürfen nur einmal vergeben werden. Das gilt für
|
||||
den Umfang aller Dateien. Sollten zwei subs mit gleichem Namen vorkommen,
|
||||
wird nur das erste eingebaut, während das zweite einfach ignoriert wird!
|
||||
|
||||
In libraries dürfen nur subs und export subs vorkommen. Zusätzliche
|
||||
Funktionen, die nicht in einer Sub-Funktion stehen machen später keinen
|
||||
Sinn, dadurch dass die libs einfach hinten an die Hauptdatei angefügt
|
||||
werden, so dass eine einzige Datei entsteht.
|
||||
Also sind zusätzliche Funktionen zwischen den subs und werden nie gelesen.
|
||||
|
||||
Alle libraries, die mit import importiert werden, werden beachtet. Auch
|
||||
Libraries, die aus Libraries heraus importiert werden.
|
||||
|
||||
Libraries haben entweder in dem Verzeichnis der Hauptdatei oder in dem
|
||||
yab-lib-Ordner "/boot/home/config/settings/yab/" zu liegen!
|
||||
|
||||
Aufgerufen muss die BuildFactory wie folgt:
|
||||
|
||||
yab BuildFactory.yab OutputFile InputFile.yab < applicationsig >
|
||||
|
||||
aus dem Verzeichnis der BuildFactory heraus. Dort landet auch das
|
||||
OutputFile. Zu dem InputFile.yab muss natürlich ein relativer oder
|
||||
vollständiger Pfad angegeben werden.
|
||||
|
||||
Die Datei, in dem der gesamte Source zusammengefasst ist, wird ebenfalls in
|
||||
dem Verzeichnis der BuildFactory abgelegt, für den Fall, dass das erzeugte
|
||||
Binary Fehler mit Zeilenangabe ausgibt. Diese beziehen sich dann natürlich
|
||||
auf jene Datei.
|
||||
138
yab-IDE/BuildFactory/flex-bison.yab
Normal file
138
yab-IDE/BuildFactory/flex-bison.yab
Normal file
@@ -0,0 +1,138 @@
|
||||
#!yab
|
||||
|
||||
doc This program modifies flex.c and main.c for the Buildfactory
|
||||
doc It accomplishes the seteps documented in HowToMakeABuildFactory.txt.
|
||||
doc The BuildFactory calls this program if flex.c is missing.
|
||||
doc
|
||||
doc by Jim Saxton, 2015, Artistic license
|
||||
|
||||
system("flex -i -I -L -s -t yabasic.flex >flex.c")
|
||||
system("perl -i -n -e 'if (!/^\#include\s+<unistd.h>\s+$$/) {print if $$i;$$i++}' flex.c")
|
||||
system("bison -d -l -t -v --output-file bison.c yabasic.bison ")
|
||||
system ("mv flex.c tmpflex.c")
|
||||
|
||||
open #1, "tmpflex.c", "r"
|
||||
open #2, "outflex.c", "w"
|
||||
|
||||
while (a$<>"#include <stdlib.h>")
|
||||
line input #1 a$
|
||||
print #2 a$
|
||||
wend
|
||||
|
||||
print #2 "#include <zlib.h>"
|
||||
print #2 "#include "+chr$(34)+"program.h"+chr$(34)
|
||||
print #2 "static int isparsed = 0;"
|
||||
|
||||
while (a$<>"#define YY_BUF_SIZE 16384")
|
||||
line input #1 a$
|
||||
if (a$<>"#define YY_BUF_SIZE 16384") print #2 a$
|
||||
wend
|
||||
|
||||
print #2 "#define YY_BUF_SIZE PROGLEN"
|
||||
|
||||
found=0
|
||||
|
||||
while (found=0)
|
||||
line input #1 a$
|
||||
if (!instr(a$,"while ( (result = fread"))then
|
||||
print #2 a$
|
||||
else
|
||||
found=1
|
||||
endif
|
||||
wend
|
||||
|
||||
print #2 " while ( (result = zread(buf, 1, max_size, yyin))==0 && ferror(yyin)) "+chr$(92)
|
||||
found=0
|
||||
|
||||
while (found=0)
|
||||
line input #1 a$
|
||||
if (!instr(a$,"int ret_val;")) then
|
||||
print #2 a$
|
||||
else
|
||||
found=1
|
||||
endif
|
||||
wend
|
||||
|
||||
print #2 a$
|
||||
print #2 " if(isparsed) return EOB_ACT_END_OF_FILE;"
|
||||
|
||||
while (! eof(#1))
|
||||
line input #1 a$
|
||||
print #2 a$
|
||||
wend
|
||||
|
||||
print #2 "int zread(char* dest, size_t memb_size, size_t num_memb, FILE *file)"
|
||||
print #2 "{"
|
||||
print #2 " long destlen = PROGLEN;"
|
||||
print #2 " if(isparsed==1)"
|
||||
print #2 " return 0;"
|
||||
print #2 " isparsed = 1;"
|
||||
print #2 " uncompress(dest,&destlen,myProg,sizeof(myProg));"
|
||||
print #2 " return destlen;"
|
||||
print #2 "}"
|
||||
|
||||
system("mv outflex.c flex.c")
|
||||
system("rm tmpflex.c")
|
||||
|
||||
close #1
|
||||
close #2
|
||||
|
||||
// fix main.c
|
||||
|
||||
system ("mv main.c tmpmain.c")
|
||||
|
||||
open #1, "tmpmain.c", "r"
|
||||
open #2, "outmain.c", "w"
|
||||
|
||||
found=0
|
||||
|
||||
while (found = 0)
|
||||
line input #1 a$
|
||||
if (not instr(a$, "int isbound(void)")) then
|
||||
print #2 a$
|
||||
else
|
||||
found=1
|
||||
print #2 a$
|
||||
end if
|
||||
wend
|
||||
|
||||
print #2 "{"
|
||||
print #2 " FILE *interpreter;"
|
||||
print #2 " if (!interpreter_path || !interpreter_path[0]) {"
|
||||
print #2 " error(FATAL,"+chr$(34)+"interpreter_path is not set !"+chr$(34)+");"
|
||||
print #2 " return 0;"
|
||||
print #2 " }"
|
||||
print #2 " if (!(interpreter=fopen(interpreter_path,"+chr$(34)+"r"+chr$(34)+"))) {"
|
||||
print #2 " sprintf(string,"+chr$(34)+"Couldn't open '%s' to check, if it is bound: %s"+chr$(34)+",interpreter_path,my_strerror(errno));"
|
||||
print #2 " error(WARNING,string);"
|
||||
print #2 " return 0;"
|
||||
print #2 " }"
|
||||
print #2 " return 1;"
|
||||
print #2 "}"
|
||||
print #2 ""
|
||||
print #2 ""
|
||||
|
||||
found = 0
|
||||
|
||||
while (found = 0)
|
||||
line input #1 a$
|
||||
if (not instr(a$, "static int mybind(char *bound)")) then
|
||||
found = 0
|
||||
else
|
||||
found = 1
|
||||
print #2 a$
|
||||
end if
|
||||
wend
|
||||
|
||||
while (not eof(1))
|
||||
line input #1 a$
|
||||
print #2 a$
|
||||
wend
|
||||
|
||||
close #1
|
||||
close #2
|
||||
system("mv outmain.c main.c")
|
||||
system("rm tmpmain.c")
|
||||
|
||||
|
||||
|
||||
38
yab-IDE/BuildFactory/parts/YAB-IDE.bf.rdef
Normal file
38
yab-IDE/BuildFactory/parts/YAB-IDE.bf.rdef
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7"
|
||||
$"F5FF6B94DD03EC66660200060238C5F1BB105D3DFDC23B9CD045487847B50700"
|
||||
$"FFFFFFFFC1CCFF020006023B3049396B0ABA90833C646E4A101543299500FFFF"
|
||||
$"FFFFEBEFFF020006023C71E33A0C78BA15E43C7D2149055549455700E3EDFFFF"
|
||||
$"9EC2FF03FFACAC0200060239D53438FFCBBBC1973C666F4ADC3246DC6C00C1CC"
|
||||
$"FFFFFFFFFF03003CB0020006023C0AE63B3927BC611E3D03FF4C25624A1A9600"
|
||||
$"A3043CFFFF90AF03C93B3B030D296402000602BD498B3E1159BF219BBE7D2F4C"
|
||||
$"1B8F4A331300BD0F0FFFE98484040174100A08325E385E40564E5E545E605058"
|
||||
$"4C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E453E320A042E2C3E"
|
||||
$"324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A0622422254325C3E"
|
||||
$"513E402E3A0A0422422254325C32490A04224232493E402E3A0A043249325C3E"
|
||||
$"513E400A063E423E544E5C5A505A3F4A390A04C222C20F4E495A3F523C0A043E"
|
||||
$"42C222C20F523C4A390A054151C08BC8834E5C4E49C22AC2130A053E423E54C0"
|
||||
$"8BC8834151C22AC2130A044E494E5C5A505A3F110A0D0100000A0001061815FF"
|
||||
$"01178400040A00010618001501178600040A010107000A080109000A0B010520"
|
||||
$"20210A050108000A00010A1001178400040A02010D000A0A010E000A0902040F"
|
||||
$"000A06010B000A0C010C000A0001011001178400040A030102000A040103000A"
|
||||
$"07010400"
|
||||
};
|
||||
|
||||
|
||||
resource app_signature "application/x-vnd.yab-IDE";
|
||||
|
||||
resource app_version {
|
||||
major = 2,
|
||||
middle = 2,
|
||||
minor = 4,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 1,
|
||||
|
||||
short_info = "yab IDE",
|
||||
long_info = "An integrated development environment for yab."
|
||||
};
|
||||
|
||||
resource app_flags 1;
|
||||
38
yab-IDE/BuildFactory/parts/YAB.bf.rdef
Normal file
38
yab-IDE/BuildFactory/parts/YAB.bf.rdef
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7"
|
||||
$"F5FF6B94DD03EC66660200060238C5F1BB105D3DFDC23B9CD045487847B50700"
|
||||
$"FFFFFFFFC1CCFF020006023B3049396B0ABA90833C646E4A101543299500FFFF"
|
||||
$"FFFFEBEFFF020006023C71E33A0C78BA15E43C7D2149055549455700E3EDFFFF"
|
||||
$"9EC2FF03FFACAC0200060239D53438FFCBBBC1973C666F4ADC3246DC6C00C1CC"
|
||||
$"FFFFFFFFFF03003CB0020006023C0AE63B3927BC611E3D03FF4C25624A1A9600"
|
||||
$"A3043CFFFF90AF03C93B3B030D296402000602BD498B3E1159BF219BBE7D2F4C"
|
||||
$"1B8F4A331300BD0F0FFFE98484040174100A08325E385E40564E5E545E605058"
|
||||
$"4C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E453E320A042E2C3E"
|
||||
$"324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A0622422254325C3E"
|
||||
$"513E402E3A0A0422422254325C32490A04224232493E402E3A0A043249325C3E"
|
||||
$"513E400A063E423E544E5C5A505A3F4A390A04C222C20F4E495A3F523C0A043E"
|
||||
$"42C222C20F523C4A390A054151C08BC8834E5C4E49C22AC2130A053E423E54C0"
|
||||
$"8BC8834151C22AC2130A044E494E5C5A505A3F110A0D0100000A0001061815FF"
|
||||
$"01178400040A00010618001501178600040A010107000A080109000A0B010520"
|
||||
$"20210A050108000A00010A1001178400040A02010D000A0A010E000A0902040F"
|
||||
$"000A06010B000A0C010C000A0001011001178400040A030102000A040103000A"
|
||||
$"07010400"
|
||||
};
|
||||
|
||||
|
||||
resource app_signature "application/x-vnd.yab-app";
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 7,
|
||||
minor = 4,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 1,
|
||||
|
||||
short_info = "Yab BASIC programming language",
|
||||
long_info = "Yab allows fast prototyping with simple and clean code. yab contains a large number of BeAPI specific commands for GUI creation and much, much more."
|
||||
};
|
||||
|
||||
resource app_flags 1;
|
||||
3
yab-IDE/BuildFactory/parts/YabMain.cpp.appsig
Normal file
3
yab-IDE/BuildFactory/parts/YabMain.cpp.appsig
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
BString tmp("application/x-vnd.yab-app");
|
||||
|
||||
43
yab-IDE/BuildFactory/parts/YabMain.cpp.end
Normal file
43
yab-IDE/BuildFactory/parts/YabMain.cpp.end
Normal file
@@ -0,0 +1,43 @@
|
||||
for(int i=1; i<argc; i++)
|
||||
{
|
||||
if(argv[i][0]!='-')
|
||||
{
|
||||
BFile file(argv[i], B_READ_ONLY);
|
||||
if(file.InitCheck()==B_OK)
|
||||
{
|
||||
char readData[1024];
|
||||
int pos;
|
||||
file.Read(readData,1024);
|
||||
BString tmpString(readData);
|
||||
pos = tmpString.IFindFirst("MIMETYPE");
|
||||
if(pos!=B_ERROR)
|
||||
{
|
||||
int quote1, quote2;
|
||||
quote1 = tmpString.FindFirst("\"",pos);
|
||||
if(quote1!=B_ERROR)
|
||||
{
|
||||
quote2 = tmpString.FindFirst("\"",quote1+1);
|
||||
if(quote2!=B_ERROR)
|
||||
{
|
||||
tmp.SetTo("");
|
||||
tmpString.CopyInto(tmp,quote1+1,quote2-quote1-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
strcpy(t,tmp.String());
|
||||
return (const char*)t;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ret;
|
||||
YabInterface *yabInterface = new YabInterface(argc, argv, readSignature(argc, argv));
|
||||
yabInterface->Run();
|
||||
ret = yabInterface->GetErrorCode();
|
||||
delete yabInterface;
|
||||
return ret;
|
||||
}
|
||||
8
yab-IDE/BuildFactory/parts/YabMain.cpp.start
Normal file
8
yab-IDE/BuildFactory/parts/YabMain.cpp.start
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <File.h>
|
||||
#include <String.h>
|
||||
#include <stdio.h>
|
||||
#include "YabInterface.h"
|
||||
|
||||
char t[1024];
|
||||
const char* readSignature(int argc, char** argv)
|
||||
{
|
||||
50
yab-IDE/BuildFactory/srcfiles
Normal file
50
yab-IDE/BuildFactory/srcfiles
Normal file
@@ -0,0 +1,50 @@
|
||||
CalendarControl.cpp
|
||||
CalendarControl.h
|
||||
config.h
|
||||
ControlLook.cpp
|
||||
DateTextView.cpp
|
||||
function.c
|
||||
global.h
|
||||
graphic.c
|
||||
io.c
|
||||
main.c
|
||||
MonthView.cpp
|
||||
MonthWindow.cpp
|
||||
MouseSenseStringView.cpp
|
||||
README.Compile
|
||||
RdefApply
|
||||
Spinner.cpp
|
||||
Spinner.h
|
||||
SplitPane.cpp
|
||||
SplitPane.h
|
||||
symbol.c
|
||||
URLView.cpp
|
||||
URLView.h
|
||||
yabasic.bison
|
||||
yabasic.flex
|
||||
yabasic.h
|
||||
YabBitmapView.cpp
|
||||
YabBitmapView.h
|
||||
YabControlLook.cpp
|
||||
YabControlLook.h
|
||||
YabFilePanel.cpp
|
||||
YabFilePanel.h
|
||||
YabFilePanelLooper.cpp
|
||||
YabFilePanelLooper.h
|
||||
YabInterface.cpp
|
||||
YabInterface.h
|
||||
YabList.cpp
|
||||
YabList.h
|
||||
YabMain.cpp
|
||||
YabMenu.h
|
||||
YabStackView.cpp
|
||||
YabStackView.h
|
||||
YabTabView.cpp
|
||||
YabTabView.h
|
||||
YabText.cpp
|
||||
YabText.h
|
||||
YabToolTip.cpp
|
||||
YabView.cpp
|
||||
YabView.h
|
||||
YabWindow.cpp
|
||||
YabWindow.h
|
||||
50
yab-IDE/BuildFactory/yab-compress.c
Normal file
50
yab-IDE/BuildFactory/yab-compress.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <zlib.h>
|
||||
|
||||
unsigned long file_size(char *filename)
|
||||
{
|
||||
unsigned long size;
|
||||
FILE *pFile = fopen(filename, "rb");
|
||||
fseek (pFile, 0, SEEK_END);
|
||||
size = ftell(pFile);
|
||||
fclose (pFile);
|
||||
return size;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned long filesize;
|
||||
char *buffer;
|
||||
FILE *fi, *fo;
|
||||
char *dest;
|
||||
unsigned long destlen;
|
||||
unsigned long i;
|
||||
|
||||
if(argc != 2) {
|
||||
printf("Usage: yab-compress <file.yab>\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
filesize = file_size(argv[1]);
|
||||
buffer = (char*)malloc(filesize);
|
||||
dest = (char*)malloc(filesize);
|
||||
|
||||
// read source file into buffer
|
||||
fi = fopen(argv[1], "r");
|
||||
fread(buffer, sizeof(char), filesize, fi);
|
||||
fclose(fi);
|
||||
|
||||
// compress buffer
|
||||
compress(dest, &destlen, buffer, filesize);
|
||||
|
||||
// write compressed buffer to output
|
||||
fo = fopen("program.h", "w");
|
||||
fprintf(fo, "const char myProg[] = {");
|
||||
for(i=0; i < destlen; i++)
|
||||
fprintf(fo, "%i,", dest[i]);
|
||||
fprintf(fo, "' ' };\n");
|
||||
fclose(fo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user