home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
pibterm
/
pibt3sp1
/
getconfi.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-06-20
|
4KB
|
85 lines
(*--------------------------------------------------------------------------*)
(* Get_Config_File_Line --- Get one parameter line from config file *)
(*--------------------------------------------------------------------------*)
FUNCTION Get_Config_File_Line( VAR Param_Num: INTEGER;
VAR Param_Str: AnyStr;
VAR Param_Ival: INTEGER;
VAR Param_Rval: REAL ) : BOOLEAN;
(*--------------------------------------------------------------------------*)
(* *)
(* Function: Get_Config_File_Line *)
(* *)
(* Purpose: Reads and interprets one line of configuration file *)
(* *)
(* Calling Sequence: *)
(* *)
(* QGot := Get_Config_File_Line( VAR Param_Num: INTEGER; *)
(* VAR Param_Str: AnyStr; *)
(* VAR Param_Ival: INTEGER; *)
(* VAR Param_Rval: REAL ) : BOOLEAN; *)
(* *)
(* Param_Num --- parameter number of this line *)
(* Param_Str --- string value of parameter *)
(* Param_Ival --- Integer value of parameter *)
(* Param_Rval --- Real value of parameter *)
(* *)
(* Qgot --- TRUE if configuration line returned; *)
(* FALSE if end-of-file encountered on *)
(* configuration file. *)
(* *)
(* Calls: None *)
(* *)
(*--------------------------------------------------------------------------*)
VAR
I: INTEGER;
S: AnyStr;
PName: STRING[2];
R: REAL
BEGIN (* Get_Config_File_Line *)
(* Initialize parameter values *)
Param_Num := 0;
Param_Str := '';
Param_Ival := 0;
Param_Rval := 0;
IF NOT EOF( Config_File ) THEN
BEGIN
Get_Config_File_Line := TRUE;
(* Indicate line from configuration file *)
READLN( Config_File , S );
S := S + ' ';
I := 0;
PName := UpCase( S[1] ) + UpCase( S[2] );
Param_Str := TrimString( COPY( S, 4, LENGTH( S ) - 3 ) );
(* Search for parameter *)
REPEAT
I := I + 1;
UNTIL ( I > Max_Params ) OR ( PName = Param_Name[I] );
(* If found, convert to numeric if *)
(* appropriate *)
IF I <= Max_Params THEN
BEGIN
Param_Num := I;
FOR I := 1 TO LENGTH( Param_Str ) DO
IF Param_Str[I] IN ['0'..'9'] THEN
Param_Ival := Param_Ival * 10 + ORD( Param_Str[I] ) -
ORD( '0' );
Param_Rval := Param_Ival;
END;
END
ELSE
Get_Config_File_Line := FALSE;
END (* Get_Config_File_Line *);
ə