home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / gt_alias.prg < prev    next >
Text File  |  1993-10-14  |  1KB  |  68 lines

  1. /*
  2.     File......: GT_Alias.prg
  3.     Author....: Martin Bryant
  4.     BBS.......: The Dark Knight Returns
  5.     Net/Node..: 050/069
  6.     User Name.: Martin Bryant
  7.     Date......: 11/02/93
  8.     Revision..: 1.0
  9.  
  10.     This is an original work by Martin Bryant and is placed
  11.     in the public domain.
  12.  
  13.     Modification history:
  14.     ---------------------
  15.  
  16.     Rev 1.0 11/02/93
  17.     PD Revision.
  18. */
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *      GT_ALIAS()
  23.  *  $CATEGORY$
  24.  *      General
  25.  *  $ONELINER$
  26.  *      Find the workarea of an alias
  27.  *  $SYNTAX$
  28.  *      GT_Alias(<cAlias>) -> nArea
  29.  *  $ARGUMENTS$
  30.  *      <cAlias> is the alias to find.
  31.  *  $RETURNS$
  32.  *      nArea
  33.  *  $DESCRIPTION$
  34.  *      Find the workarea of an alias
  35.  *  $EXAMPLES$
  36.  *      // Which area contains the invoices file ?
  37.  *      nArea := GT_Alias('INVOICES')
  38.  *  $SEEALSO$
  39.  *
  40.  *  $INCLUDE$
  41.  *
  42.  *  $END$
  43.  */
  44.  
  45. #include "GT_LIB.ch"
  46.  
  47. FUNCTION GT_Alias(cAlias)
  48.  
  49. LOCAL nArea := 1
  50.  
  51. //  Upper case
  52. cAlias := UPPER(cAlias)
  53.  
  54. //  Find
  55. DO WHILE (UPPER(ALIAS(nArea)) != cAlias) .AND. .NOT. EMPTY(ALIAS(nArea))
  56.     nArea ++
  57. ENDDO
  58.  
  59. //  Errors ?
  60. IF ALIAS(nArea) != cAlias
  61.     nArea := 0
  62. ENDIF
  63.  
  64. /*
  65.     End of GT_Alias()
  66. */
  67. RETURN(nArea)
  68.