blob: d251be9a3576347783b42c7d74185e995f7bbab7 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 #include <include_list.h>
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstrad59c3892019-11-28 20:53:39 +01004 string * include_list()
Zesstra5481d492021-04-08 20:07:06 +02005 string * include_list(object|lwobject ob)
6 string * include_list(object|lwobject ob, int flags)
MG Mud User88f12472016-06-24 23:31:02 +02007
MG Mud User88f12472016-06-24 23:31:02 +02008
Zesstra715ec202025-07-09 22:18:31 +02009DESCRIPTION
10 Return information about all files included into the compilation
11 of <ob>, including <ob> program's own filename.
12 If <ob> is omitted, it defaults to the current object.
MG Mud User88f12472016-06-24 23:31:02 +020013
Zesstra715ec202025-07-09 22:18:31 +020014 In the resulting array(s), the information for one include file takes
15 up three elements:
MG Mud User88f12472016-06-24 23:31:02 +020016
Zesstra715ec202025-07-09 22:18:31 +020017 string [i+0]: the name as it appeared in the program, including the
18 delimiters ("" or <>, resp.).
19 string [i+1]: the absolute filename of the include file.
20 int [i+2]: the inclusion depth (usually 1, more for nested
21 includes).
MG Mud User88f12472016-06-24 23:31:02 +020022
Zesstra715ec202025-07-09 22:18:31 +020023 The first entry in the result is the program's own name in [i+0],
24 the other two elements [i+1] and [i+2] are 0.
MG Mud User88f12472016-06-24 23:31:02 +020025
Zesstra715ec202025-07-09 22:18:31 +020026 The <flag> determines the exact structure of the result:
27
28 <flag> = INCLIST_FLAT (0, default):
29 The result is a flat array of the entries, starting the with
30 the entry for <ob> itself, followed by the entries for all
31 included files in the order they were encountered.
32
33 <flag> = INCLIST_TREE (1):
34 The result is an array starting the with the entry
35 of <ob> itself, followed by the entries for all directly included
36 files. If one of the included files has no nested includes by itself,
37 then its information will be stored directly in the array.
38 If one included file has includes by itself, a subvector will
39 be created and stored in the result vector (again in [i+0], with
40 [i+1] and [i+2] being 0). These subvectors have the same
41 structure as the main result vector.
42
43 If objects, including <ob>, had been undergone a replace_program(),
44 the returned filenames will reflect the actual active program.
45
46 The returned proper include filenames always begin with '/' (absolute
47 path), even when the parser runs in COMPAT mode. The filename of
48 the object itself however does not begin with a '/' in COMPAT
49 mode.
MG Mud User88f12472016-06-24 23:31:02 +020050
Zesstrad59c3892019-11-28 20:53:39 +010051
Zesstra715ec202025-07-09 22:18:31 +020052EXAMPLES
53 Given this source code (and /sys as system include directory):
MG Mud User88f12472016-06-24 23:31:02 +020054
Zesstra715ec202025-07-09 22:18:31 +020055 a.c: #include "b.h"
56 #include <c.h>
57 b.h: #include "d.h"
58 c.h: #define BAR
59 d.h: #define FOO
MG Mud User88f12472016-06-24 23:31:02 +020060
Zesstra715ec202025-07-09 22:18:31 +020061 the efun will give these results:
MG Mud User88f12472016-06-24 23:31:02 +020062
Zesstra715ec202025-07-09 22:18:31 +020063 include_list(a, INCLIST_FLAT)
MG Mud User88f12472016-06-24 23:31:02 +020064 -> ({ "a.c", 0, 0
65 , "\"b.h\"", "/.../b.h", 1
66 , "\"d.h\"", "/.../d.h", 2
67 , "<c.h>", "/sys/c.h", 1
68 })
69
Zesstra715ec202025-07-09 22:18:31 +020070 include_list(a, INCLIST_TREE)
71 -> ({ "a.c", 0, 0
72 , ({ "\"b.h\"", "/.../b.h", 1
73 , "\"d.h\"", "/.../d.h", 2
74 }), 0, 0
75 , "<c.h>", "/sys/c.h", 1
76 })
MG Mud User88f12472016-06-24 23:31:02 +020077
MG Mud User88f12472016-06-24 23:31:02 +020078
Zesstra715ec202025-07-09 22:18:31 +020079HISTORY
80 Implemented in LDMud 3.2.9/3.3.128.
81
82SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020083 debug_info(E), inherit_list(E)