//------------------- list2.h --------------------------- //------------ header file for unit list ---------------- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // C++ call by reference was used. // in order to succeed compelation, program file // must be save as cpp files. // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ //-------------------- Types & definitions ---------------------------- typedef int list_info_type; /* or anyt ather data type */ struct link_type { list_info_type info; struct link_type *next; }; typedef struct link_type *pos_type; typedef struct { pos_type anchor; /* more fields if needed */ } list_type; //----------------------- Prototypes ---------------------------------- list_type list_init (void); pos_type list_anchor (list_type list); pos_type list_end (list_type list); pos_type list_next (list_type list, pos_type pos); pos_type list_prev(list_type list, pos_type pos); void list_insert (list_type &list, pos_type pos, list_info_type x); void list_delete (list_type &list, pos_type &pos); list_info_type list_retrieve (list_type list, pos_type pos); int list_is_empty (list_type list); void list_update (list_type &list, pos_type pos, list_info_type x);