/* * treecopy.h * * Contains the prototype for the function tree_copy in treecopy.c * and the corresponding #define's. * * For copying and use of this routine see treecopy.c! * * History: * 10/30/94: Creation */ #include #include #include #include /* * #define's for structures that should also be copied (like TEDINFOs, * ICONBLK s etc.) Use | to combine them. * * Normally, tree_copy just dublicates the single OBJECTs, so all * substructures remain the same (i.e., all TEDINFOs, ICONBLKs, * BITBLKs and USERBLKs point to the same addresses). Use C_xxx (where * xxx is TEDINFO, ICONBLK, BITBLK or USERBLK), if you want that the * copy has it's own xxx-structure(s). TEDINFOs, ICONBLKs and BITBLKs * also contain pointers to some data. You must also supply tree_copy * the constants C_xxxPOINTER if you wish that the data is dublicated, * too (otherwise, orginal and copy share the same pointers). Of * course, C_xxxPOINTER implies C_xxx. When C_TITLEBUTTONSTRING is * specified, tree_copy will create copies of all free_strings in * the object-types G_TITLE, G_BUTTON or G_STRING. Otherwise, they * will point to the same strings as in the original tree. * * It's a *must* to use the symbolic constants, not the values, * because the values might change one day (for color-icon-support, * mainly). */ #define C_NONE 0x0000 /* both trees are identical */ #define C_TEDINFO 0x0001 /* copy has own TEDINFOs */ #define C_TEDINFOPOINTER 0x0002 /* copy has own te_ptexts, etc. */ #define C_ICONBLK 0x0004 /* copy has own ICONBLKs */ #define C_ICONBLKPOINTER 0x0008 /* copy has own ib_pdatas, etc. */ #define C_BITBLK 0x0010 /* copy has own BITBLKs */ #define C_BITBLKPOINTER 0x0020 /* copy has own bi_pdatas */ #define C_USERBLK 0x0040 /* copy has own USERBLKs */ #define C_TITLEBUTTONSTRING 0x0080 /* copy has own free_strings */ #define C_ALL 0x00ff /* copy has all of the above */ /* * tree_copy * * Copy a complete object-tree including all substructures (optional). * CAUTION: The object-tree *must* have the LASTOB-flag (0x20) set in * it's physically last member. * BUG: Up to now tree_copy won't copy the color-icon-structure, * because I'm too lazy ;) Maybe I'll do that one day. If you need it * urgently, contact me and force me to work... Btw, this doesn't mean * that G_CICONs won't be copied at all, but the copied tree will * share the CICONBLKs with the original. * * Input: * tree: Pointer to tree which should be copied * what: Specifies what substructures should be copied, too (see the * above C_xxx-definitions for details) * * Output: * NULL: Tree couldn't be copied (due to lack of memory) * otherwise: Pointer to copied tree, use free to dealloc it's memory */ OBJECT *tree_copy(OBJECT *tree, WORD what); /* EOF */