Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FBI - FreeBasicIDE
#11
that's how I do (dunno go through the code yourself)
[syntax="C"]int AppFrame::Compile() {
//Check if is unsaved
if (m_edit->GetLength()==0) {
wxMessageBox (_("Nothing to compile!"), _("Error"));
return 1;
}
if (m_edit->Modified()) {
if (wxMessageBox (_("File has been modified! To Compile you need first to save it. Contunue?"), _("Close"),
wxYES | wxCANCEL | wxICON_QUESTION) == wxYES)
m_edit->SaveFile();
else return false;
}

//Read Cmd line:
wxString Temp=GetCompileData();

if (Temp=="") return false;
Temp+=" > compile.log";

int answer = wxShell(Temp);
unsigned long LineNumber=0;
wxString NumTemp;
Temp="";
if (answer==0) {
wxTextFile inifile;
inifile.Open("compile.log");
for (unsigned int i=0;i<inifile.GetLineCount();i++) {
Temp+= inifile[i];
Temp+="\n";
}
inifile.Close();
if (Temp=="") Temp=("Unknown error. Suggestions:\n you didn't save file as .bas \n \
some library/include header is not linked \n");
else
for (unsigned int i=0; i<Temp.Len();i++) {
if (Temp.Mid(i,1)=="(") {
for (unsigned int x=i+1;x<Temp.Len();x++) {
if (Temp.Mid(x,1)==")") break;
NumTemp+=Temp.Mid(x,1);
}
break;
}
}
if(NumTemp.IsNumber()) {
Temp+="On Line: ";
Temp+=NumTemp;
m_edit->GotoLine(m_edit->GetLineCount());
NumTemp.ToULong(&LineNumber);
LineNumber--;
m_edit->GotoLine((int)LineNumber);
m_edit->MarkerAdd((int)LineNumber, 0);
}
wxMessageDialog errorwindow (this, Temp, "Compile Error");
errorwindow.ShowModal();
return 1;
}
return 0;
}[/syntax]Please no comments about waay to bad code :wink: it's 5:52 am here and I'm not in the mood. :evil:
url]http://fbide.sourceforge.net/[/url]
Reply
#12
Everyone codes their own way. The only "bad" code is the code that doesn't execute.
I'd knock on wood, but my desk is particle board.
Reply
#13
Quote:Everyone codes their own way. The only "bad" code is the code that doesn't execute.

like mine for instance LMAO!

anyways yea the problem is that no output file is outputted. i even changed the output file to say "c:\out.txt" and it STILL no worky.

lemme sort through taht code though..
earn.
Reply
#14
wtf!. this doesnt even work:

Code:
Private Sub Command1_Click()
    Shell "c:\freebasic\fbc.exe tmpname.bas > c:\test.txt", vbNormalFocus
End Sub
earn.
Reply
#15
dunno anything about vb
url]http://fbide.sourceforge.net/[/url]
Reply
#16
seph: stop using the intrinsic Shell and look up the ShellExecute API function.
I'd knock on wood, but my desk is particle board.
Reply
#17
Code:
MsgBox ShellExecute(myh&, "open", FbPath, tmpname$ & "bas > c:\compile.log", CurDir, 0)

this also does not return the right file. btw it returns 42.... Big Grin

[edit]goddamnit this also does not work

Code:
MsgBox ShellExecute(myh&, "open", "c:\freebasic\fbc.exe", "tmpname.bas > c:\test335.txt", CurDir, 0)
earn.
Reply
#18
How about creating a batch file, then spawning that?
I'd knock on wood, but my desk is particle board.
Reply
#19
brilliant! why didnt i effing think of that!? oh wait, i did, thencast it off as a stupid suggestion. but now that you say it, its double-enforced. so BRB
earn.
Reply
#20
fukc it. heres the code. hope it helps someone

http://junk.w00tish.com/fbxide.zip
earn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)