home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / xaes_new / treecopy.h < prev    next >
Text File  |  1994-11-23  |  3KB  |  74 lines

  1. /*
  2.  * treecopy.h
  3.  *
  4.  * Contains the prototype for the function tree_copy in treecopy.c
  5.  * and the corresponding #define's.
  6.  *
  7.  * For copying and use of this routine see treecopy.c!
  8.  *
  9.  * History:
  10.  * 10/30/94: Creation
  11.  */
  12.  
  13. #include <aes.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <portab.h>
  17.  
  18. /*
  19.  * #define's for structures that should also be copied (like TEDINFOs,
  20.  * ICONBLK s etc.) Use | to combine them.
  21.  *
  22.  * Normally, tree_copy just dublicates the single OBJECTs, so all
  23.  * substructures remain the same (i.e., all TEDINFOs, ICONBLKs,
  24.  * BITBLKs and USERBLKs point to the same addresses). Use C_xxx (where
  25.  * xxx is TEDINFO, ICONBLK, BITBLK or USERBLK), if you want that the
  26.  * copy has it's own xxx-structure(s). TEDINFOs, ICONBLKs and BITBLKs
  27.  * also contain pointers to some data. You must also supply tree_copy
  28.  * the constants C_xxxPOINTER if you wish that the data is dublicated,
  29.  * too (otherwise, orginal and copy share the same pointers). Of
  30.  * course, C_xxxPOINTER implies C_xxx. When C_TITLEBUTTONSTRING is
  31.  * specified, tree_copy will create copies of all free_strings in
  32.  * the object-types G_TITLE, G_BUTTON or G_STRING. Otherwise, they
  33.  * will point to the same strings as in the original tree.
  34.  *
  35.  * It's a *must* to use the symbolic constants, not the values,
  36.  * because the values might change one day (for color-icon-support,
  37.  * mainly). 
  38.  */
  39. #define C_NONE                0x0000    /* both trees are identical */
  40. #define C_TEDINFO            0x0001    /* copy has own TEDINFOs */
  41. #define C_TEDINFOPOINTER    0x0002    /* copy has own te_ptexts, etc. */
  42. #define C_ICONBLK            0x0004    /* copy has own ICONBLKs */
  43. #define C_ICONBLKPOINTER    0x0008    /* copy has own ib_pdatas, etc. */
  44. #define C_BITBLK            0x0010    /* copy has own BITBLKs */
  45. #define C_BITBLKPOINTER        0x0020    /* copy has own bi_pdatas */
  46. #define C_USERBLK            0x0040    /* copy has own USERBLKs */
  47. #define C_TITLEBUTTONSTRING    0x0080  /* copy has own free_strings */
  48. #define C_ALL                0x00ff    /* copy has all of the above */
  49.  
  50. /*
  51.  * tree_copy
  52.  *
  53.  * Copy a complete object-tree including all substructures (optional).
  54.  * CAUTION: The object-tree *must* have the LASTOB-flag (0x20) set in
  55.  * it's physically last member.
  56.  * BUG: Up to now tree_copy won't copy the color-icon-structure,
  57.  * because I'm too lazy ;) Maybe I'll do that one day. If you need it
  58.  * urgently, contact me and force me to work... Btw, this doesn't mean
  59.  * that G_CICONs won't be copied at all, but the copied tree will
  60.  * share the CICONBLKs with the original.
  61.  *
  62.  * Input:
  63.  * tree: Pointer to tree which should be copied
  64.  * what: Specifies what substructures should be copied, too (see the
  65.  *       above C_xxx-definitions for details)
  66.  *
  67.  * Output:
  68.  * NULL: Tree couldn't be copied (due to lack of memory)
  69.  * otherwise: Pointer to copied tree, use free to dealloc it's memory
  70.  */
  71. OBJECT *tree_copy(OBJECT *tree, WORD what);
  72.  
  73. /* EOF */
  74.