home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0636.ZIP / CCE_0636 / GEMLIB / GMLIBS30.ZOO / aesrsrc.c < prev    next >
C/C++ Source or Header  |  1991-09-05  |  3KB  |  130 lines

  1. /*
  2.  *    Aes resource library interface
  3.  *
  4.  *        rsrc_load        Load a resource into memory
  5.  *        rsrc_free        Free memory allocated by rsrc_load
  6.  *        rsrc_gaddr      Gets the address of a resource tree
  7.  *        rsrc_saddr      Stores the address of a resource in memory
  8.  *        rsrc_obfix      Converts Char to Pixel coordinate for obj loc.
  9.  *
  10.  *        ++jrb    bammi@cadence.com
  11.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  12.  */
  13.  
  14. #include "common.h"
  15.  
  16. /* Load a resource file into memory
  17.  *    return =0 on error    >0 no error
  18.  */
  19.  
  20. #ifdef __DEF_ALL__
  21.  
  22. #define L_rsrc_loa
  23. #define L_rsrc_fre
  24. #define L_rsrc_gad
  25. #define L_rsrc_sad
  26. #define L_rsrc_obf
  27.  
  28. #endif /* __DEF_ALL__ */
  29.  
  30.  
  31. #ifdef L_rsrc_loa
  32.  
  33. int rsrc_load(char *Name)
  34. {
  35.     _addrin[0] = Name;
  36.     return __aes__(AES_CONTROL_ENCODE(110, 0, 1, 1));
  37. }
  38. #endif /* L_rsrc_loa */
  39.  
  40. #ifdef L_rsrc_fre
  41.  
  42. /* Free memory allocated by rsrc_load
  43.  *    return =0 error    >0 no error
  44.  */
  45. int rsrc_free(void)
  46. {
  47.     return __aes__(AES_CONTROL_ENCODE(111, 0, 1, 0));
  48. }
  49. #endif /* L_rsrc_fre */
  50.  
  51.  
  52. #ifdef L_rsrc_gad
  53.  
  54. /* get the address of resource in mem
  55.  *
  56.  * Type: see object types below
  57.  *    returns 0 on error    >0 no error
  58.  */
  59. int rsrc_gaddr(int Type, int Index,    /* inputs  */
  60.            void **Address)        /* outputs */
  61. {
  62.     int retval;
  63.     
  64.     _int_in[0] = Type;    /* type of object (see below) */
  65.     _int_in[1] = Index;
  66.  
  67. #ifdef __OLD__
  68.     /* see hack in common.c for control[4] */
  69.     retval =  __aes__(AES_CONTROL_ENCODE(112, 2, 1, 0));
  70. #else
  71.     _control[4] = 1;
  72.     retval =  __aes__(AES_CONTROL_ENCODE(112, 2, 1, 0));
  73.     _control[4] = 0;
  74. #endif
  75.     *Address = _addrout[0];
  76.     return retval;
  77. }
  78. #endif /* L_rsrc_gad */
  79.  
  80. #ifdef L_rsrc_sad
  81.  
  82. /* store addr of data struct in mem
  83.  *    return    =0 error    >0 no error
  84.  */
  85. int rsrc_saddr(int Type, int Index, void *Address)
  86. {
  87.     _int_in[0] = Type;
  88.     _int_in[1] = Index;
  89.     _addrin[0] = Address;
  90.     return __aes__(AES_CONTROL_ENCODE(113, 2, 1, 1));
  91. }
  92. #endif /* L_rsrc_sad */
  93.  
  94. #ifdef L_rsrc_obf
  95.  
  96. /* Fix pixel coordinate of Object
  97.  *    always returns 1
  98.  */
  99. int rsrc_obfix(void *Tree, int Index)
  100. {
  101.     _int_in[0] = Index;      /* Index of Object in Tree */
  102.     _addrin[0] = Tree;    /* Address of Tree containing Object */
  103.     return __aes__(AES_CONTROL_ENCODE(114, 1, 1, 1));
  104. }
  105. #endif /* L_rsrc_obf */
  106.  
  107.  
  108. /*
  109.  *    Object Types
  110.  *    0    Tree
  111.  *    1    Object
  112.  *    2    TedInfo    (for any object containing an editable string)
  113.  *    3    IconBlk
  114.  *    4    BitBlock
  115.  *    5    string
  116.  *    6    image data
  117.  *    7    obspec
  118.  *    8    te_ptext    text field of a Tedinfo
  119.  *    9    te_ptmplt    template field of a TedInfo
  120.  *    10    te_pvalid    valid field of a TedInfo
  121.  *    11    ib_pmask    for Icon Block
  122.  *    12    ib_pdata
  123.  *    13    ib_ptext
  124.  *    14    bi_pdata    for BitBlock
  125.  *    15    ad_frstr    address of pointer to free string
  126.  *    16    ad_frimg    address of pointer to free image
  127.  */
  128.  
  129. /* - eof - */    
  130.