MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | #include <include_list.h> |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 4 | string * include_list() |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 5 | string * include_list(object|lwobject ob) |
| 6 | string * include_list(object|lwobject ob, int flags) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 7 | |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 8 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 9 | DESCRIPTION |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 13 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 14 | In the resulting array(s), the information for one include file takes |
| 15 | up three elements: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 17 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 23 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 26 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 50 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 51 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 52 | EXAMPLES |
| 53 | Given this source code (and /sys as system include directory): |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 54 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 55 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 60 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 61 | the efun will give these results: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 62 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 63 | include_list(a, INCLIST_FLAT) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 64 | -> ({ "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 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 70 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 77 | |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 78 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 79 | HISTORY |
| 80 | Implemented in LDMud 3.2.9/3.3.128. |
| 81 | |
| 82 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 83 | debug_info(E), inherit_list(E) |