1 #ifndef EL__SESSION_HISTORY_H
2 #define EL__SESSION_HISTORY_H
8 /* The first list item is the first visited location. The last list
9 * item is the last location in the unhistory. The @current location is
10 * included in this list. */
11 struct list_head history
; /* -> struct location */
13 /* The current location. This is moveable pivot pointing somewhere at
14 * the middle of @history. */
15 struct location
*current
;
19 void create_history(struct ses_history
*history
);
20 void destroy_history(struct ses_history
*history
);
21 void clean_unhistory(struct ses_history
*history
);
23 void add_to_history(struct ses_history
*history
, struct location
*loc
);
24 void del_from_history(struct ses_history
*history
, struct location
*loc
);
27 /* Note that this function is dangerous, and its results are sort of
28 * unpredictable. If the document is cached and is permitted to be fetched from
29 * the cache, the effect of this function is immediate and you end up with the
30 * new location being cur_loc(). BUT if the cache entry cannot be used, the
31 * effect is delayed to the next main loop iteration, as the TASK_HISTORY
32 * session task (ses_history_move()) is executed not now but in the bottom-half
33 * handler. So, you MUST NOT depend on cur_loc() having an arbitrary value
34 * after call to this function (or the regents go_(un)back(), of course). */
35 void go_history(struct session
*ses
, struct location
*loc
);
37 /* Move back -n times if n is negative, forward n times if positive. */
38 void go_history_by_n(struct session
*ses
, int n
);
40 void go_back(struct session
*ses
);
41 void go_unback(struct session
*ses
);
43 void ses_history_move(struct session
*ses
);