home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / GETKIND.MOD < prev    next >
Text File  |  1988-02-02  |  2KB  |  49 lines

  1. (*----------------------------------------------------------------------*)
  2. (*      Get_Key_Index --- Get index of function key from short name     *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. FUNCTION Get_Key_Index( Short_Name : AnyStr ) : INTEGER;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Get_Key_Index                                        *)
  10. (*                                                                      *)
  11. (*     Purpose:    Get index of function key from short name.           *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Get_Key_Index( Short_Name : AnyStr ) : INTEGER;               *)
  16. (*                                                                      *)
  17. (*           Short_Name --- Short version of function key name          *)
  18. (*                                                                      *)
  19. (*----------------------------------------------------------------------*)
  20.  
  21. VAR
  22.    I : INTEGER;
  23.  
  24. BEGIN (* Get_Key_Index *)
  25.                                       (* Evict blanks from key name *)
  26.    I := POS( ' ' , Short_Name );
  27.  
  28.    WHILE ( I > 0 ) DO
  29.       BEGIN
  30.          DELETE( Short_Name, I, 1 );
  31.          I := POS( ' ' , Short_Name );
  32.       END;
  33.  
  34.    Short_Name   := UpperCase( Short_Name );
  35.  
  36.                                    (* Assume key name not found *)
  37.    Get_Key_Index := 0;
  38.                                    (* Search for key name *)
  39.    FOR I := 0 TO Max_Key_Def DO
  40.       WITH Key_Definitions[I] DO
  41.          IF ( Name <> '' ) THEN
  42.             IF ( Name = Short_Name ) THEN
  43.                BEGIN
  44.                   Get_Key_Index := I;
  45.                   EXIT;
  46.                END;
  47.  
  48. END   (* Get_Key_Index *);
  49.