Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

Code-Beispiel

Code-Beispiele » Kleine Helferlein

FBC Redirect

Lizenz:Erster Autor:Letzte Bearbeitung:
k. A.MitgliedThePuppetMaster 19.10.2007

fbcr ist ein kleines kompaktes Tool, welches die bestehenden Kompilerprobleme durch den Aufruf von Geany-Hot-Keys behebt.

Beim Drücken von Shift+F9 werden dem FB-Compiler die nötigen Angaben zur Kompilierung übergeben, jedoch mit der Option "all", was den Compiler veranlasst, eine Fehlermeldung zurückzugeben.

fbcr übernimmt anstelle von fbc die Kommandozeichenkette, zerlegt diese, und setzt sie ohne den "all" Befehl zusammen. Durch die Zerlegung, Zusammensetzung und den öffentlichen Code ist es möglich spezifische Kommondosequenzen zu produzieren, um das Kompilieren zu vereinfachen.

Der Quellcode von fbcr wird kompiliert und in /usr/bin/ kopiert. Anschliessend gibt man im Geany Compiler-Path folgendes ein:
fbcr -cp fbc -cmd %1
Anschliessend kann mit Shift+F9 das Kompilieren durchgeführt werden.

declare sub F_SplitString(V_Data as string, B_DD() as string, byref B_DC as long, V_CutString as string, V_ClearArray as byte, V_Casesensitivity as Byte, V_AddEmpty as Byte)
declare Function F_CompareString(V_DD() as string, V_DC as long, V_SepString as string, V_StartItem as long, V_CountItem as Long) as string




Dim dd() as string
Dim dc as long
F_SplitString command,dd(),dc ," ",1,0,1
If dc = 0 then print "Syntaxerror! Benoetige Kommandozeilenparameter!":end
Dim x as long
dim y as long
Dim XCP as string
Dim Xcmd as string
for x = 1 to dc
    select case lcase(dd(x))
        case "-cp": Xcp = dd(x+1)
        case "-cmd"
            for y = x+1 to dc
                if lcase(dd(y)) = "all" then dd(y) = ""
            next
            xcmd = F_CompareString(dd(),dc," ",x+1,0)
            exit for
    end select
next
if xcp = "" then print "Syntaxerror! Benoetige Compiler-Name [-cp]!":end
if xcmd = "" then print "Syntaxerror! Benoetige Compiler-Parameter [-cmd]!":end
shell xcp & " " & xcmd


sub F_SplitString(V_Data as string, B_DD() as string, byref B_DC as long, V_CutString as string, V_ClearArray as byte, V_Casesensitivity as Byte, V_AddEmpty as Byte)
if V_ClearArray = 1 then b_dc = 0
redim preserve b_dd(b_dc) as string
Dim X as long
Dim Pos1 as long
Dim Pos2 as long
Dim SLen as long
Dim T as string
Dim S as string
Dim XOK as byte
s = v_cutstring
if V_Casesensitivity = 0 then s = lcase(v_cutstring)
SLen = len(s)
pos1 = 1
pos2 = 1
for x = 1 to len(v_data) - slen
    if V_Casesensitivity = 0 then
        if lcase(mid(v_data,x,slen)) = s then
            t = mid(v_data,pos1,x-pos1+slen-1)
            x+= slen-1
            pos1 = x+1
        endif
    else
        if mid(v_data,x,slen) = v_cutstring then
            t = mid(v_data,pos1,x-pos1+slen-1)
            x+= slen
            pos1 = x
        endif
    endif
    if pos1 <> pos2 or x = len(v_data) - slen then
        if pos1 = pos2 then t = mid(v_data,pos1)
        xok = 1
        if t = "" then if v_addempty = 0 then xok = 0
        if xok = 1 then
            b_dc+= 1
            redim preserve b_dd(b_dc) as string
            b_dd(b_dc) = t
        endif
        pos2 = pos1
    endif
next
end sub





Function F_CompareString(V_DD() as string, V_DC as long, V_SepString as string, V_StartItem as long, V_CountItem as Long) as string
Dim X as long
Dim X1 as long
Dim X2 as long
Dim D as string
X1 = V_StartItem
if X1 <= 0 then x1 = 1
X2 = X1 + V_CountItem - 1
if x2 < x1 then x2 = v_dc
if X2 <= 0 then x2 = v_dc
if X1 > V_DC then exit function
if X2 > v_dc then X2 = V_DC
for X = X1 to X2
    D = D & V_DD(X) & V_SepString
next
if len(D) > 0 then D = mid(D,1,len(D)-len(V_SepString))
F_CompareString = D
end function

Zusätzliche Informationen und Funktionen
  Bearbeiten Bearbeiten  

  Versionen Versionen