View Full Version : PBASIC Syntax Question
Raven_Writer
17-08-2003, 13:32
I'm not sure why this happening, but in my PBASIC editor, whenever I try to download the code (for testing), it always returns an error "201 - Expecting '}'", and here's the only thing I have in the code:
'{$STAMP BS2}
Even when I use the default code given, it still returns this error.
Anyone have an idea why this is happening?
<<EDIT>>: If I use the code from RoboEmu (File -> Write Code) in my program, it gives this error, but in the Parallax one it is perfect :<</EDIT>>
Greg Ross
18-08-2003, 13:18
You're talking about the editor you're writing, right? My guess is that you're sending the wrong buffer length to the tokenizer.
Raven_Writer
18-08-2003, 13:33
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:
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>>
Are you sure szBuffer contains the whole thing? Trying doing a
MessageBox(NULL, szBuffer, "Test", MB_OK);
and see what it spits out.
Raven_Writer
20-08-2003, 08:07
Originally posted by rbayer
Are you sure szBuffer contains the whole thing? Trying doing a
MessageBox(NULL, szBuffer, "Test", MB_OK);
and see what it spits out.
Sadly, it doesn't << cries >>.
Thanks for the help on that (should've known to do a test on that). Now to figure out why (which I have an idea).
<< EDIT >>: I found out why...it was because of the SETSEL LPARAM section was probably to small, and plus I needed a space after the '}' in my code for it to register it (argh!)
<< EDIT 2 >>: I can get it compile or whatever way you think of it (tokenize). Now, does anyone have a thing on making a progress bar move? (Sorry, MSDN is really buggin' me right now). If you wanna know, I used to get the 157 error. But I had to set the first compile boolean to true in order to tokenize successfully. Thanks for all your help people ;)
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.