Pancake Development Kit Readme

This is just a short file explaining what the built in procedures do. Those familar with writing externals for other BBS systems will be used to how Pancake Externals are written.

procedure Write (str: string);

Outputs text to the screen. Adds a LF to any CRs it finds. The normal way you should output a string.

procedure Writeln (str: string);

Same as about but adds a CR/LF to the end.

procedure WriteHand (hand: Handle);

Same as Write but works with a handle. Handle is not disposed of. It is returned to you, BUT has LFs appenped to all CRs.

procedure ListResFile (name: string);

When given the name of a TEXT resource in your res fork, or pancake's res fork it will display it with pauses.

procedure SetNodeAction (action: NodeActionType);

nodeActionType = (None, Prompting, Listing, Chatting, LineChatting, Transfering, Editor, Extern, Menu);

Node action is used to tell Pancake what a node is currently doing. You will probably not need to use this procedure.

procedure RestoreNodeAction;

Restores the node action to value previous to being set my SetNodeAction. This is key to quiting your external. It will change it from Extern (running an external) to what the user was previously doing.

procedure JumpTo (x, y: integer);

This will output a VT100 (same as ANSI) string which is optimized to change the cursor to the asked position with the least amount of characters.

procedure Out (str: string);

Just like Write, but LFs are NOT added to CRs. Useful when you want to overwrite what currenly on the same line (CR by itself moves the cursor to the leftmost column but doesn't advance a line).

procedure OutPtr (buf: ptr; size: longint);

Same as Out but works with a Ptr;

procedure Report (where: integer; str: string);

Bounces = 1; {Report where consts}
Callers = 2;
Schedular = 3;
Errors = 4;
Events = 5;
LogFail = 6;
Mail = 7;
Net = 8;
Transfers = 9;

This will log an to whichever log you desire. Most commonly used is Errors.

function GetVarPtr (which: integer): ptr;

This will return a pointer to a specified nodeGlobs variable. This is prefered over accessing the nodeGlobs directly, since ptr will be correct with every new release of Pancake, nodeGlobs WILL change. If you need a variable not included here ask and you shall receive.

Possible NodeGlobs variables:

vCurTextHand = 1; {ptr to a handle}

Used to list files or resources. Modified by ListResHand. For editors it contains a handle of what to edit (nil if empty).

vKeyBuf = 2; {ptr to a string}

This is where you will get your keypresses manually. Only needed when a built-in prompt won't do what you want it too (even then you can make your own prompt) but this allows real-time characters (something Hermes never would, and I hated it!) Very useful for writing an online Tetris.

vNodeAction = 3; {ptr to a NodeActionType}

This is the current NodeAction.

vCurAnswer = 4; {ptr to a string}

The answer to the last prompt.

vCurCommand = 5; {ptr to a string}

The answer to the last prompt all capitals.

vCurParams = 6; {ptr to a string}

The answer to the last prompt with first word removed.

vNumParams = 7; {ptr to a string}

The number of space seperated words there are in CurParams.

vThisUser = 8; {ptr to a userRec}

The userRec for the current user. You can read, and even change data if you feel so inclined.

vNoReturn = 9; {ptr to boolean}

If this is set pancake will not output a CR/LF that it otherwise would have. Used to make things look better in some cases. Also used with prompts, so that a CR/LF isn't outputed so you can write over the prompt or add something to the end.

vCurPath = 10;

The pathname to the current directory the user is in. If a normal user it will always be his user directory. If sysop it could be anywhere on his Hard Drive.

vCx = 11;

The current Column the screen is at.

vCy = 12;

The current Row the screen is at.

procedure ListHand (hand: handle);

This does the same thing as ListResFile but works on a handle. Handle is not valid after return. Use HandAndHand to make a duplicate if you want to still use it.

function ListTextFile (pathname, filename: string): OSErr;

Same as ListResFile but with a text file.

procedure LettersPrompt (prompt, possible: string; len: byte);

Your basic prompt asking for a line of characters. Prompt is what to display. Possible is what characters should be allowed to be entered.

PossTypeable is all characters that can be made with the keyboard
PossPrintable is all characters that can be made that are printable.
PossUsername is A..Z a..z 0..9.
PossFilename is A..Z a..z 0..9 !@#$%^&*()-_+={}[];"<,>.?/|\~` '

Notice PossFilename doesn't have a : which is the pathname designator on a mac, which would be dangerous to let a user use in a filename. Len is the length of the prompt.

procedure PasswordPrompt (prompt, possible: string; len: byte);

Same as LettersPrompt, but doesn't echo (or echos X's if set that way).

procedure NumbersPrompt (prompt, possible: string; max: longint);

Takes either a one letter answer, or a number that is max or below. 0..Z is not needed for possible. Only include in possible the chars you have commands implemented for.

procedure AutoPrompt (prompt, possible: string);

Takes a one letter answer. As with Numbers only include the chars you have commands implemented for.

procedure YesNoPrompt (prompt: string; yesDefault: boolean);

Yes or no answer. YesDefault makes Yes the defaul on carrige return, else No is the default.

procedure DatePrompt (prompt: string);

Date prompt.

procedure PhonePrompt (prompt: string);

Phone prompt follows Phone Format string, or a free form phone entry.

procedure ClrScr;

Clears the Screen;

function ReplacePercents (str: string; replaceProc: procPtr; user: userRecPtr): string;

Replaces all %a .. %z with values. If replaceProc is nil it uses the builtin percent procedure, if procPtr(1) it uses a bult-in percent procedure that uses the userRecPtr to replace the percents. If replaceProc points to a procedure in the form of:

function MyReplaceOne (ch: char): string;

It will be called for all percents found. UserRecPtr can be set to nil for all except replaceProc equaling procPtr(1);

function HasAccess (acs: string): boolean;

Gived an acs string it will be true if the current user has access.

function SendFile (protocol: char; forceMacbinary: boolean; path, filename: string): OSErr;

Will send a file to user. Protocol is X..Z. ForceMacbinary will send text files as MacBinary (usually set this to false).

function ReceiveFile (protocol: char; forceMacbinary: boolean; path, filename: string; theRout: ProcPtr): OSErr;

Will receive a file. Same as SendFile (forceMacbinary does nothing for receive);