Quote:
Originally posted by gwross
You're talking about the editor you're writing, right? My guess is that you're sending the wrong buffer length to the tokenizer.
|
Yes, I am
I don't know if this will help, but here is the code I use to tokenize the code:
Code:
void CMainFrame::OnDlcode()
{
CMainFrame *pFrame = (CMainFrame*) AfxGetMainWnd(); // Get frame window class
CFIRSTEditorView *pView = (CFIRSTEditorView*) pFrame->GetActiveView();
char *szBuffer = new char[66356];
// Use if below fails to do memory right: char *szBuffer = new char[pView->GetWindowTextLength()]; // New 'char' pointer array based on window text length
pView->GetWindowText(szBuffer, pView->GetWindowTextLength()); // Get view window text
tModRec.SourceSize = strlen(szBuffer);
Compile(&tModRec, szBuffer, false, true);
if(tModRec.Succeeded == true){
StatusBarMessage("Tokenize successful!"); // Tell the user it went smoothly
}
else{
StatusBarMessage(tModRec.Error);
}
delete [] szBuffer;
}
char *szBuffer = new char[66356]; <-- 66356 is max amount of text that the TModuleRec source buffer can hold
pView->GetWindowText(szBuffer, pView->GetWindowTextLength()); // Get view window text <-- For some reason, I got a feeling it has to deal w/ this, or the szBuffer part.
This is in MFC also.
<<EDIT>>: I forgot to say that I was using the wrong way to do the STAMP, it's ' {$STAMP BS2p}, not ' {$STAMP S2p} :<</EDIT>>