home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / xref_v1.1.lha / XRef / Tools / rexx / loadxref.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-09  |  2.2 KB  |  98 lines

  1. /*
  2. ** $PROJECT: rexxxref.library
  3. **
  4. ** $VER: loadxref.c 1.1 (08.01.95)
  5. **
  6. ** by
  7. **
  8. ** Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
  9. **
  10. ** (C) Copyright 1995
  11. ** All Rights Reserved !
  12. **
  13. ** $HISTORY:
  14. **
  15. ** 08.01.95 : 001.001 : initial
  16. */
  17.  
  18. #include "rexxxref.h"
  19.  
  20. /*FS*/ /*"AutoDoc"*/
  21. /*GB*** rexxxref.library/LoadXRef ********************************************
  22. *
  23. *    NAME
  24. *        LoadXRef - loads a xreffile into memory
  25. *
  26. *    SYNOPSIS
  27. *        LoadXRef(FILE/A,XREFPRI/N,LOCK/S,INDEX/S)
  28. *
  29. *    FUNCTION
  30. *        This is the Rexx-Interface function to the xref.library XR_LoadXRef()
  31. *        function.
  32. *
  33. *    INPUTS
  34. *        FILE    - xreffile to load
  35. *        XREFPRI - priority to use for this xreffile (Enqueue())
  36. *        LOCK    - lock this xreffile
  37. *        INDEX   - create an index for this xreffile
  38. *
  39. *    RESULTS
  40. *        Set RC to RC_WARN, if the xreffile could not loaded. Otherwise
  41. *        set to RC_OK.
  42. *
  43. *    SEE ALSO
  44. *        FindXRef() ,ExpungeXRef() ,XR_LoadXRef()
  45. *
  46. ******************************************************************************
  47. *
  48. */
  49. /*FE*/
  50.  
  51. ULONG loadxref(struct ARexxFunction *func,struct RexxMsg *rmsg,STRPTR *argstr,struct RexxXRefBase *rxb)
  52. {
  53.    ULONG rc  = RC_OK;
  54.  
  55.    if(!rmsg->rm_Args[LX_FILE])
  56.       rc = RXERR_REQUIRED_ARG_MISSING;
  57.    else
  58.    {
  59.       struct TagItem tags[4];
  60.       UWORD tag = 0;
  61.  
  62.       if(rmsg->rm_Args[LX_XREFPRI])
  63.       {
  64.          tags[tag].ti_Tag  = XREFA_Priority;
  65.          StrToLong(rmsg->rm_Args[LX_XREFPRI],(LONG *) &tags[tag].ti_Data);
  66.          tag++;
  67.       }
  68.  
  69.       if(rmsg->rm_Args[LX_INDEX])
  70.          if(!Stricmp(rmsg->rm_Args[LX_INDEX],"INDEX"))
  71.          {
  72.             tags[tag].ti_Tag  = XREFA_Index;
  73.             tags[tag].ti_Data = TRUE;
  74.             tag++;
  75.          }
  76.  
  77.       if(rmsg->rm_Args[LX_LOCK])
  78.          if(!Stricmp(rmsg->rm_Args[LX_LOCK],"LOCK"))
  79.          {
  80.             tags[tag].ti_Tag  = XREFA_Lock;
  81.             tags[tag].ti_Data = TRUE;
  82.             tag++;
  83.          }
  84.  
  85.       tags[tag].ti_Tag = TAG_END;
  86.  
  87.       if(XR_LoadXRef(rmsg->rm_Args[LX_FILE],tags))
  88.       {
  89.          if(!(*argstr = CreateArgstring("1",1)))
  90.             rc = RXERR_NO_FREE_STORE;
  91.       } else
  92.          rc = RC_WARN;
  93.    }
  94.    return(rc);
  95. }
  96. /*FE*/
  97.  
  98.