home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-06-27 | 3.0 KB | 151 lines | [TEXT/MPS ] |
- { *** =================================================== ***
-
- Purpose: Terminal tool's main validation
- code module. Validate and Default called through
- here. Basic functions simply include validating
- config requests from 'other' sources like changes
- in config strings, dialog items changing, etc.
-
- Module : tval.p
-
- Authors: Craig Hotchkiss, Alex Kazim, Byron Han,
- Carol Lee
- Apple Computer, Inc.
- Networks & Communications
- 20525 Mariani Drive
- Cupertino, CA 95014
-
- Version : 1.0d1
-
- Date : 9.may.89
-
- History :
- 9.may.89 Creation date
-
-
- ©1989 Apple Computer, Inc. All Rights Reserved.
- This software is proprietary to Apple Computer, Inc.
- It may not be copied, in whole or in part,
- without the written consent of Apple Computer, Inc.
-
- *** =================================================== *** }
-
-
-
-
- UNIT TERMINALtval;
-
-
- INTERFACE
-
-
- USES MemTypes,
- QuickDraw,
- OSIntf,
- ToolIntf,
- PasLibIntf,
- Lists,
- CRMSerialIntf,
- CRMIntf,
- CTBUtils,
- CMIntf,
- TMIntf,
- FTIntf,
- TerminalTool,
- TermGlobalUnit;
-
-
- FUNCTION tvalMAIN(hTerm: TermHandle; message: Integer;
- p1, p2, p3: LongInt) : LongInt;
-
-
- IMPLEMENTATION
-
-
- FUNCTION TermToolValidate(hTerm: TermHandle): LongInt;
- FORWARD;
- PROCEDURE TermToolDefault(pConfig: TerminalPtr);
- FORWARD;
-
-
- FUNCTION tvalMAIN(hTerm: TermHandle; message: Integer;
- p1, p2, p3: LongInt) : LongInt;
-
- { Here is our main module that simply directs the message
- paramater again. (Message is used by the toolbox to
- tell us what it wants the tool to do.) }
-
- VAR
- pConfig: TerminalPtr;
- result : LONGINT;
- BEGIN
- result := 0;
- CASE message OF
- TMValidateMsg:
- result := TermToolValidate(hTerm);
- TMDefaultMsg:
- BEGIN
-
- { If p2 is not zero, p1 can't be ready yet. }
-
- IF p2 <> 0 THEN
- BEGIN
- pConfig := TerminalPtr(NewPtr(SIZEOF(TerminalRecord)));
- BlockMove(Ptr(@pConfig), Ptr(p1), 4);
- IF pConfig = NIL THEN
- BEGIN
- hTerm^^.errCode := MemError;
- Exit(tvalMAIN);
- END;
- END
- ELSE
- { Okay to default now because p2 = 0 }
- BlockMove(Ptr(p1), Ptr(@pConfig), 4);
- TermToolDefault(pConfig);
- END;
- OTHERWISE
- SysBeep(5);
- END; {case}
- tvalMAIN := result;
- END;
-
-
-
- FUNCTION TermToolValidate(hTerm: TermHandle): LongInt;
-
- { This function always returns a validated message. Structures
- and tool functions should really be validated here. }
-
- VAR
- theState: SignedByte;
- pPrivate: TERMINALPrivatePtr;
- pConfig: TerminalPtr;
- theProcID: Integer;
- BEGIN
- theState := HGetState(Handle(hTerm));
- HLock(Handle(hTerm));
- pPrivate := TERMINALPrivatePtr(hTerm^^.tmPrivate);
- pConfig := TerminalPtr(hTerm^^.config);
- theProcID := (hTerm^^.procID);
- IF (theProcID < 3) OR (pConfig = NIL) OR (pPrivate = NIL) THEN
- DebugStr('The pipe is blocked from TermToolValidate');
- HSetState(Handle(hTerm), theState);
- END;
-
-
- PROCEDURE TermToolDefault(pConfig: TerminalPtr);
- { Simply set our default values . }
- BEGIN
- WITH pConfig^ DO
- BEGIN
- onlineBoolean := True;
- screenWidth := True;
- cursorStyle := True;
- END;
- END;
-
-
-
-
-
- END.