zsh/ported/modules/mod.rs
1//! Ports of zsh's loadable modules from `Src/Modules/*.c`.
2//!
3//! Each submodule maps 1:1 to its C-source counterpart. The names
4//! match `zsh/<modname>` as exposed by `zmodload`. See each file's
5//! header for the specific source-file citation and feature scope.
6//!
7//! For backwards-compat with the previous flat `crate::<modname>`
8//! layout, every entry is re-exported at this module's root so
9//! `crate::modules::datetime::...` and `crate::modules::*` both
10//! resolve. Top-level call sites should migrate to
11//! `crate::modules::<modname>::...` going forward.
12
13pub mod attr;
14/// `cap` submodule.
15pub mod cap;
16/// `clone` submodule.
17pub mod clone;
18/// `curses` submodule.
19pub mod curses;
20/// `datetime` submodule.
21pub mod datetime;
22/// `db_gdbm` submodule.
23pub mod db_gdbm;
24/// `example` submodule.
25pub mod example;
26/// `files` submodule.
27pub mod files;
28/// `hlgroup` submodule.
29pub mod hlgroup;
30/// `ksh93` submodule.
31pub mod ksh93;
32/// `langinfo` submodule.
33pub mod langinfo;
34/// `mapfile` submodule.
35pub mod mapfile;
36/// `mathfunc` submodule.
37pub mod mathfunc;
38/// `nearcolor` submodule.
39pub mod nearcolor;
40/// `newuser` submodule.
41pub mod newuser;
42/// `param_private` submodule.
43pub mod param_private;
44/// `parameter` submodule.
45pub mod parameter;
46/// `pcre` submodule.
47pub mod pcre;
48/// `random` submodule.
49pub mod random;
50/// `random_real` submodule.
51pub mod random_real;
52/// `regex` submodule.
53pub mod regex;
54/// `socket` submodule.
55pub mod socket;
56/// `stat` submodule.
57pub mod stat;
58/// `system` submodule.
59pub mod system;
60/// `tcp` submodule.
61pub mod tcp;
62/// `tcp_h` submodule.
63pub mod tcp_h;
64/// `termcap` submodule.
65pub mod termcap;
66/// `terminfo` submodule.
67pub mod terminfo;
68/// `watch` submodule.
69pub mod watch;
70/// `zftp` submodule.
71pub mod zftp;
72/// `zprof` submodule.
73pub mod zprof;
74/// `zpty` submodule.
75pub mod zpty;
76/// `zselect` submodule.
77pub mod zselect;
78/// `zutil` submodule.
79pub mod zutil;
80
81#[cfg(test)]
82mod tests {
83 use crate::zsh_h::{hashnode, param, PM_SCALAR};
84
85 /// `Src/Modules/parameter.c::paramtypestr` is consulted by every
86 /// `${(t)foo}` query and by scanpmparameters' callback emission.
87 /// The encoding is load-bearing: an integer param must report
88 /// "integer", a scalar "scalar", etc. — this cross-checks that
89 /// the dispatch the rest of the parameter introspection relies on
90 /// is intact.
91 #[test]
92 fn paramtypestr_reports_scalar_for_scalar() {
93 let _g = crate::test_util::global_state_lock();
94 let pm = param {
95 node: hashnode {
96 next: None,
97 nam: String::new(),
98 flags: PM_SCALAR as i32,
99 },
100 u_data: 0,
101 u_tied: None,
102 u_arr: None,
103 u_str: Some("v".to_string()),
104 u_val: 0,
105 u_dval: 0.0,
106 u_hash: None,
107 gsu_s: None,
108 gsu_i: None,
109 gsu_f: None,
110 gsu_a: None,
111 gsu_h: None,
112 base: 0,
113 width: 0,
114 env: None,
115 ename: None,
116 old: None,
117 level: 0,
118 };
119 let typ = super::parameter::paramtypestr(&pm);
120 assert_eq!(typ, "scalar");
121 }
122}