12-09-2004, 08:52 AM
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:
[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]