Debian Codegraph @

terps/tads/tads3/vmsave.h

raw symbols SCIP
1 /* $Header$ */
2
3 /*
4 * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved.
5 *
6 * Please see the accompanying license file, LICENSE.TXT, for information
7 * on using and copying this software.
8 */
9 /*
10 Name
11 vmsave.h - save/restore VM state
12 Function
13 Saves/restores VM state to/from a file.
14 Notes
15
16 Modified
17 08/02/99 MJRoberts - Creation
18 */
19
20 #ifndef VMSAVE_H
21 #define VMSAVE_H
22
23 #include "vmglob.h"
24
25 /*
26 * Save/restore API. (This class is all static methods, so it's never
27 * instatiated; it's really just a namespace.)
28 */
29 class CVmSaveFile
30 {
31 public:
32 /*
33 * Save state to a file. Writes the state information to the given
34 * open file stream.
35 *
36 * 'metadata' is an optional LookupTable object containing
37 * string->string associations. We'll write each key/value pair to the
38 * save file in the metadata header section. This section allows the
39 * interpreter and external tools to display user-readable information
40 * on the saved game. For example, you could store things like the
41 * current location, chapter number, score, etc - things that would
42 * help the user identify the context of the saved game when looking
43 * for the one he/she wishes to restore.
44 */
45 static void save(VMG_ class CVmFile *fp,
46 class CVmObjLookupTable *metadata);
47
48 /*
49 * given a saved state file, read the name of the image file that
50 * created it
51 */
52 static int restore_get_image(osfildef *fp,
53 char *fname_buf, size_t fname_buf_len);
54
55 /*
56 * Restore state from a file. Returns zero on success, or a
57 * VMERR_xxx code indicating the problem on failure.
58 */
59 static int restore(VMG_ class CVmFile *fp);
60
61 /* reset the VM to the initial image file state */
62 static void reset(VMG0_);
63
64 protected:
65 };
66
67 #endif /* VMSAVE_H */