ahk 0.2.0

The ahk language: a lexer, an AST, a parser and an interpreter for AutoHotkey-style scripts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
//! The names that the tree carries beside the dialect of v2.0.19.
//!
//! KeySharp speaks a dialect of its own: the AutoHotkey v2.1-alpha, and
//! beside it a set of names that are its own -- the members of the classes
//! of AutoHotkey that it adds, the functions of its `Ks` module and the
//! accessors of it. The tree speaks that dialect behind the `--dialect=ks`,
//! and this module is the table of the names of it.
//!
//! The dialect of v2.0.19 stays pure. A script that does not ask for the
//! `ks` sees the surface of the v2.0.19 and nothing else: a name that is
//! here is not in the surface of the v2.0.19, and the tree does not put it
//! there. The plan of the audit says the same
//! (`egm-review/keysharp-audit/plan-to-surpass-features.md`, guardrail 2):
//! the contract of the v2.0.19 stays pure, and a new name goes in the
//! extension namespace.
//!
//! The members are measured on the documentation of KeySharp
//! (`Keysharp/docs/reference.md`), which says what each one answers and
//! what it does with the index it starts at.


/// The members of the classes of AutoHotkey that the `ks` dialect adds.
///
/// The pair is the class and the member, both in the spelling of the lower
/// case, the way the table of the classes of the tree carries them.
pub const MEMBERS: &[(&str, &str)] = &[
    ("array", "contains"),
    ("array", "filter"),
    ("array", "findindex"),
    ("array", "indexof"),
    ("array", "join"),
    ("array", "map"),
    ("array", "remove"),
    ("array", "sort"),
    ("array", "tostring"),
    ("map", "tostring"),
    ("func", "isclosure"),
    ("func", "ismethod"),
    ("func", "params"),
    ("file", "flush"),
    ("scriptprocess", "hasexited"),
    ("scriptprocess", "exitcode"),
    ("scriptprocess", "exittime"),
    ("scriptprocess", "kill"),
    ("scriptprocess", "stdout"),
    ("scriptprocess", "stderr"),
    ("scriptprocess", "stdin"),
    ("varref", "empty"),
    ("struct", "at"),
    ("string", "startswith"),
    ("string", "endswith"),
    ("inputhook", "beforehotkeys"),
    ("inputhook", "bufferlengthmax"),
    ("inputhook", "endcharmode"),
    ("inputhook", "onmousedown"),
    ("inputhook", "onmousemove"),
    ("inputhook", "onmouseup"),
    ("inputhook", "transcribemodifiedkeys"),
    ("inputhook", "visiblemousemove"),
    ("thread", "id"),
    ("thread", "index"),
    ("thread", "isactive"),
    ("thread", "kind"),
    ("thread", "elapsed"),
    ("thread", "priority"),
    ("thread", "allowtimers"),
    ("thread", "critical"),
    ("thread", "paused"),
    ("thread", "isinterruptible"),
    ("thread", "underlying"),
    ("thread", "exitcode"),
    ("thread", "exit"),
];

/// The members the `ks` dialect adds, with the class, the name in the
/// spelling of the dialect and the number of the parameters: the smallest
/// and the largest.
///
/// The numbers are the ones of the documentation of KeySharp: every member
/// of this block takes none, and the members of the `Array` are the ones
/// the tables above already carry.
const THE_METHODS: &[(&str, &str, &str, i64, i64)] = &[
    ("array", "contains", "Contains", 1, 1),
    ("array", "filter", "Filter", 1, 2),
    ("array", "findindex", "FindIndex", 1, 2),
    ("array", "indexof", "IndexOf", 1, 2),
    ("array", "join", "Join", 0, 1),
    ("array", "map", "Map", 1, 2),
    ("array", "remove", "Remove", 0, 1),
    ("array", "sort", "Sort", 1, 1),
    ("array", "tostring", "ToString", 0, 0),
    ("map", "tostring", "ToString", 0, 0),
    ("func", "isclosure", "IsClosure", 0, 0),
    ("func", "ismethod", "IsMethod", 0, 0),
    ("func", "params", "Params", 0, 0),
    ("file", "flush", "Flush", 0, 0),
    ("thread", "id", "Id", 0, 0),
    ("thread", "index", "Index", 0, 0),
    ("thread", "isactive", "IsActive", 0, 0),
    ("thread", "kind", "Kind", 0, 0),
    ("thread", "elapsed", "Elapsed", 0, 0),
    ("thread", "priority", "Priority", 0, 0),
    ("thread", "allowtimers", "AllowTimers", 0, 0),
    ("thread", "critical", "Critical", 0, 0),
    ("thread", "paused", "Paused", 0, 0),
    ("thread", "isinterruptible", "IsInterruptible", 0, 0),
    ("thread", "underlying", "Underlying", 0, 0),
    ("thread", "exitcode", "ExitCode", 0, 0),
    ("thread", "exit", "Exit", 0, 1),
    ("struct", "at", "At", 1, 1),
];

/// Whether the `ks` dialect adds the member to the class.
///
/// The class and the member are the ones the script wrote, and the answer
/// does not care about the case.
pub fn carries_the_member(class: &str, member: &str) -> bool {
    let class = class.to_lowercase();
    let member = member.to_lowercase();
    MEMBERS
        .iter()
        .any(|(owner, name)| *owner == class && *name == member)
}

/// The member of the `ks` extensions that a class answers, with the name in
/// the spelling of the dialect and the numbers of the parameters.
///
/// The class and the member are the ones the script wrote, and the answer
/// does not care about the case. `None` is the answer for a member that the
/// extensions do not add, and for a class they do not touch.
pub fn the_method_of(class: &str, member: &str) -> Option<(&'static str, i64, i64)> {
    let class = class.to_lowercase();
    let member = member.to_lowercase();
    THE_METHODS
        .iter()
        .find(|(owner, name, _, _, _)| *owner == class && *name == member)
        .map(|(_, _, spelled, min, max)| (*spelled, *min, *max))
}

/// The accessors of the `Ks` module that the tree answers, in the lower
/// case without the `A_` prefix, the way the table of the built-in
/// variables of the tree carries a name.
///
/// The four of them are the ones the tree can answer honestly on every
/// machine: the two clocks read the clock of the machine, and the two
/// spellings are the ones the platform writes. The rest of the accessors
/// of KeySharp ask for a state the tree does not keep yet, and they are
/// not in the table until they answer.
pub const VARIABLES: &[&str] = &[
    "nowms",
    "hotif",
    "timers",
    "realthread",
    "nowutcms",
    "dirseparator",
    "newline",
    // The defaults of the hotstrings, the ones the KeySharp manager starts
    // with and the ones the documentation of AHK names.
    "defaulthotstringcasesensitive",
    "defaulthotstringconformtocase",
    "defaulthotstringdetectwheninsideword",
    "defaulthotstringdobackspace",
    "defaulthotstringdoreset",
    "defaulthotstringendcharrequired",
    "defaulthotstringendchars",
    "defaulthotstringkeydelay",
    "defaulthotstringnomouse",
    "defaulthotstringomitendchar",
    "defaulthotstringpriority",
    "defaulthotstringsendmode",
    "defaulthotstringsendraw",
    // The settings of the hotkeys and the threads, read out of the
    // defaults KeySharp starts with.
    "clipboardtimeout",
    "hotiftimeout",
    "maxthreads",
    "maxthreadsbuffer",
    "maxthreadsperhotkey",
    "peekfrequency",
    "persistent",
    "winactivateforce",
    "notrayicon",
    // The machine and the build.
    "osarch",
    "processarch",
    "ostype",
    "ksversion",
    "kscorepath",
    "guitheme",
    // The two booleans, the thread of the script, the two hooks and the
    // value of the last `Loop Reg`.
    "true",
    "false",
    "thread",
    "keybdhookinstalled",
    "mousehookinstalled",
    "loopregvalue",
];

/// Whether the `ks` dialect carries the variable of this name.
///
/// The name is the one the script wrote, with the `A_` prefix or without
/// it: the two spellings are the same variable, the way the built-in
/// variables of the v2 are.
pub fn carries_the_variable(name: &str) -> bool {
    let lowered = name.to_lowercase();
    let bare = lowered.strip_prefix('a').and_then(|rest| {
        // The prefix is `A_`, and only that one: a name that begins with
        // an `a` is a name of its own.
        rest.strip_prefix('_')
    });
    let bare = bare.unwrap_or(lowered.as_str());
    VARIABLES.contains(&bare)
}

/// The rows of the surface that the `ks` dialect adds to the surface of the
/// v2.0.19.
///
/// The shape of a row is the one of the table of the v2: the kind, the
/// class, the name, and the columns the kinds after the method do not use.
/// The variables carry the `A_` prefix, because that is the spelling the
/// scripts write and the one the audit reads; the state of every row is
/// answered at the run, the way the state of a name of the v2 is.
pub const SURFACE_ROWS: &str = concat!(
    "method\tArray\tContains\t\t\t\n",
    "method\tArray\tFilter\t\t\t\n",
    "method\tArray\tFindIndex\t\t\t\n",
    "method\tArray\tIndexOf\t\t\t\n",
    "method\tArray\tJoin\t\t\t\n",
    "method\tArray\tMap\t\t\t\n",
    "method\tArray\tRemove\t\t\t\n",
    "method\tArray\tSort\t\t\t\n",
    "method\tArray\tToString\t\t\t\n",
    "method\tMap\tToString\t\t\t\n",
    "method\tFunc\tIsClosure\t\t\t\n",
    "method\tFunc\tIsMethod\t\t\t\n",
    "method\tFunc\tParams\t\t\t\n",
    "method\tFile\tFlush\t\t\t\n",
    "variable\t\tA_DirSeparator\t\t\t\n",
    "variable\t\tA_NewLine\t\t\t\n",
    "variable\t\tA_NowMs\t\t\t\n",
    "variable\t\tA_HotIf\t\t\t\n",
    "variable\t\tA_Timers\t\t\t\n",
    "variable\t\tA_RealThread\t\t\t\n",
    "variable\t\tA_NowUTCMs\t\t\t\n",
    "class\t\tThread\t\t\t\n",
    "method\tThread\tId\t\t\t\n",
    "method\tThread\tIndex\t\t\t\n",
    "method\tThread\tIsActive\t\t\t\n",
    "method\tThread\tKind\t\t\t\n",
    "method\tThread\tElapsed\t\t\t\n",
    "method\tThread\tPriority\t\t\t\n",
    "method\tThread\tAllowTimers\t\t\t\n",
    "method\tThread\tCritical\t\t\t\n",
    "method\tThread\tPaused\t\t\t\n",
    "method\tThread\tIsInterruptible\t\t\t\n",
    "method\tThread\tUnderlying\t\t\t\n",
    "method\tThread\tExitCode\t\t\t\n",
    "method\tThread\tExit\t\t\t\n",
    "method\tInputHook\tBeforeHotkeys\t\t\t\n",
    "method\tString\tStartsWith\t\t\t\n",
    "method\tString\tEndsWith\t\t\t\n",
    "class\t\tScriptProcess\t\t\t\n",
    "method\tScriptProcess\tHasExited\t\t\t\n",
    "method\tScriptProcess\tExitCode\t\t\t\n",
    "method\tScriptProcess\tExitTime\t\t\t\n",
    "method\tScriptProcess\tKill\t\t\t\n",
    "method\tScriptProcess\tStdOut\t\t\t\n",
    "method\tScriptProcess\tStdErr\t\t\t\n",
    "method\tScriptProcess\tStdIn\t\t\t\n",
    "method\tInputHook\tBufferLengthMax\t\t\t\n",
    "method\tInputHook\tEndCharMode\t\t\t\n",
    "method\tInputHook\tOnMouseDown\t\t\t\n",
    "method\tInputHook\tOnMouseMove\t\t\t\n",
    "method\tInputHook\tOnMouseUp\t\t\t\n",
    "method\tInputHook\tTranscribeModifiedKeys\t\t\t\n",
    "method\tInputHook\tVisibleMouseMove\t\t\t\n",
    "variable\t\tA_ClipboardTimeout\t\t\t\n",
    "variable\t\tA_DefaultHotstringCaseSensitive\t\t\t\n",
    "variable\t\tA_DefaultHotstringConformToCase\t\t\t\n",
    "variable\t\tA_DefaultHotstringDetectWhenInsideWord\t\t\t\n",
    "variable\t\tA_DefaultHotstringDoBackspace\t\t\t\n",
    "variable\t\tA_DefaultHotstringDoReset\t\t\t\n",
    "variable\t\tA_DefaultHotstringEndCharRequired\t\t\t\n",
    "variable\t\tA_DefaultHotstringEndChars\t\t\t\n",
    "variable\t\tA_DefaultHotstringKeyDelay\t\t\t\n",
    "variable\t\tA_DefaultHotstringNoMouse\t\t\t\n",
    "variable\t\tA_DefaultHotstringOmitEndChar\t\t\t\n",
    "variable\t\tA_DefaultHotstringPriority\t\t\t\n",
    "variable\t\tA_DefaultHotstringSendMode\t\t\t\n",
    "variable\t\tA_DefaultHotstringSendRaw\t\t\t\n",
    "variable\t\tA_GuiTheme\t\t\t\n",
    "variable\t\tA_HotIfTimeout\t\t\t\n",
    "variable\t\tA_KsCorePath\t\t\t\n",
    "variable\t\tA_KsVersion\t\t\t\n",
    "variable\t\tA_MaxThreads\t\t\t\n",
    "variable\t\tA_MaxThreadsBuffer\t\t\t\n",
    "variable\t\tA_MaxThreadsPerHotkey\t\t\t\n",
    "variable\t\tA_NoTrayIcon\t\t\t\n",
    "variable\t\tA_OSArch\t\t\t\n",
    "variable\t\tA_OSType\t\t\t\n",
    "variable\t\tA_PeekFrequency\t\t\t\n",
    "variable\t\tA_Persistent\t\t\t\n",
    "variable\t\tA_ProcessArch\t\t\t\n",
    "variable\t\tA_WinActivateForce\t\t\t\n",
    "variable\t\tA_KeybdHookInstalled\t\t\t\n",
    "variable\t\tA_LoopRegValue\t\t\t\n",
    "variable\t\tA_MouseHookInstalled\t\t\t\n",
    "variable\t\tA_Thread\t\t\t\n",
    "variable\t\tFalse\t\t\t\n",
    "variable\t\tTrue\t\t\t\n",
    "function\t\tProps\t\t\t\n",
    "function\t\tCompileScript\t\t\t\n",
    "function\t\tGetKeyInfo\t\t\t\n",
    "function\t\tObjCreateWithDataPtr\t\t\t\n",
    "function\t\tObjGetDataPtr\t\t\t\n",
    "function\t\tObjGetDataSize\t\t\t\n",
    "function\t\tObjSetDataPtr\t\t\t\n",
    "function\t\tShowDebug\t\t\t\n",
    "function\t\tMail\t\t\t\n",
    "function\t\tRunScript\t\t\t\n",
    "method\tStruct\tAt\t\t\t\n",
    "function\t\tGetKeyboardLayout\t\t\t\n",
    "function\t\tClipCursor\t\t\t\n",
    "function\t\tWinFromPoint\t\t\t\n",
    "function\t\tWinGetAlwaysOnTop\t\t\t\n",
    "function\t\tWinGetEnabled\t\t\t\n",
    "function\t\tWinGetCapability\t\t\t\n",
    "function\t\tThrow\t\t\t\n",
    "function\t\tIsComponentAvailable\t\t\t\n",
    "function\t\tValidateScript\t\t\t\n",
    "function\t\tRequestCapabilities\t\t\t\n",
    "class\t\tVarRef\t\t\t\n",
    "method\tVarRef\tEmpty\t\t\t\n",
    "class\t\tPropRef\t\t\t\n",
    "class\t\tArgumentError\t\t\t\n",
    "class\t\tUnsupportedError\t\t\t\n",
    "method\tPropRef\tTarget\t\t\t\n",
    "method\tPropRef\tArgs\t\t\t\n",
    "class\t\tInt8\t\t\t\n",
    "class\t\tUInt8\t\t\t\n",
    "class\t\tInt16\t\t\t\n",
    "class\t\tUInt16\t\t\t\n",
    "class\t\tInt32\t\t\t\n",
    "class\t\tUInt32\t\t\t\n",
    "class\t\tInt64\t\t\t\n",
    "class\t\tIntPtr\t\t\t\n",
    "class\t\tFloat32\t\t\t\n",
    "class\t\tFloat64\t\t\t\n",
    "class\t\tStruct\t\t\t\n",
    "function\t\tATan2\t\t\t\n",
    "function\t\tSinh\t\t\t\n",
    "function\t\tCosh\t\t\t\n",
    "function\t\tTanh\t\t\t\n",
    "function\t\tRandomSeed\t\t\t\n",
    "function\t\tReplaceLineEndings\t\t\t\n",
    "function\t\tFileFullPath\t\t\t\n",
    "function\t\tFileCreateTemp\t\t\t\n",
    "function\t\tOutputDebugLine\t\t\t\n",
    "function\t\tCollect\t\t\t\n",
);

/// The functions the `ks` dialect adds beside the table of the v2.0.19.
///
/// They are the functions of the `Ks` module of KeySharp that the tree can
/// answer honestly on every machine: the four of the mathematics and the
/// three of the text and the paths are pure, and the three that touch the
/// machine ask the desktop. The rest of the module -- the ones that need a
/// network, a mailer, a compiler of scripts or a component of Windows --
/// is not in the table until it answers, the rule of the tree being that a
/// name in the table answers or refuses with the reason.
pub static KS_BUILTINS: &[crate::builtins::Builtin] = &[
    crate::builtins::Builtin {
        name: "ATan2",
        kind: crate::builtins::BuiltinKind::Function,
        min: 2,
        max: 2,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_atan2,
    },
    crate::builtins::Builtin {
        name: "Sinh",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_hyperbolic,
    },
    crate::builtins::Builtin {
        name: "Cosh",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 1,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_hyperbolic,
    },
    crate::builtins::Builtin {
        name: "Tanh",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 2,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_hyperbolic,
    },
    crate::builtins::Builtin {
        name: "RandomSeed",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_random_seed,
    },
    crate::builtins::Builtin {
        name: "ReplaceLineEndings",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 2,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_replace_line_endings,
    },
    crate::builtins::Builtin {
        name: "FileFullPath",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_file_full_path,
    },
    crate::builtins::Builtin {
        name: "FileCreateTemp",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 0,
        variant: 0,
        parameters: &[],
        handler: crate::builtins::ks_file_create_temp,
    },
    crate::builtins::Builtin {
        name: "OutputDebugLine",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_output_debug_line,
    },
    crate::builtins::Builtin {
        name: "Collect",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 0,
        variant: 0,
        parameters: &[],
        handler: crate::builtins::ks_collect,
    },
    crate::builtins::Builtin {
        name: "Throw",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_throw,
    },
    crate::builtins::Builtin {
        name: "Props",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_props,
    },
    crate::builtins::Builtin {
        name: "CompileScript",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_validate_script,
    },
    crate::builtins::Builtin {
        name: "GetKeyInfo",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 2,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_get_key_info,
    },
    crate::builtins::Builtin {
        name: "ObjCreateWithDataPtr",
        kind: crate::builtins::BuiltinKind::Function,
        min: 2,
        max: 2,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_obj_create_with_data_ptr,
    },
    crate::builtins::Builtin {
        name: "ObjGetDataPtr",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_obj_get_data_ptr,
    },
    crate::builtins::Builtin {
        name: "ObjGetDataSize",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_obj_get_data_size,
    },
    crate::builtins::Builtin {
        name: "ObjSetDataPtr",
        kind: crate::builtins::BuiltinKind::Function,
        min: 2,
        max: 2,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_obj_set_data_ptr,
    },
    crate::builtins::Builtin {
        name: "ShowDebug",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 0,
        variant: 0,
        parameters: &[],
        handler: crate::builtins::ks_show_debug,
    },
    crate::builtins::Builtin {
        name: "Mail",
        kind: crate::builtins::BuiltinKind::Function,
        min: 3,
        max: 4,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_mail,
    },
    crate::builtins::Builtin {
        name: "RunScript",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 6,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_run_script,
    },
    crate::builtins::Builtin {
        name: "GetKeyboardLayout",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 0,
        variant: 0,
        parameters: &[],
        handler: crate::builtins::ks_get_keyboard_layout,
    },
    crate::builtins::Builtin {
        name: "ClipCursor",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 4,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_clip_cursor,
    },
    crate::builtins::Builtin {
        name: "WinFromPoint",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 2,
        variant: 0,
        parameters: &[
            crate::builtins::Parameter::Value,
            crate::builtins::Parameter::Value,
        ],
        handler: crate::builtins::ks_win_from_point,
    },
    crate::builtins::Builtin {
        name: "WinGetAlwaysOnTop",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_win_get_always_on_top,
    },
    crate::builtins::Builtin {
        name: "WinGetEnabled",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_win_get_enabled,
    },
    crate::builtins::Builtin {
        name: "WinGetCapability",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_win_get_capability,
    },
    crate::builtins::Builtin {
        name: "IsComponentAvailable",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_is_component_available,
    },
    crate::builtins::Builtin {
        name: "ValidateScript",
        kind: crate::builtins::BuiltinKind::Function,
        min: 1,
        max: 1,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_validate_script,
    },
    crate::builtins::Builtin {
        name: "RequestCapabilities",
        kind: crate::builtins::BuiltinKind::Function,
        min: 0,
        max: 255,
        variant: 0,
        parameters: &[crate::builtins::Parameter::Value],
        handler: crate::builtins::ks_request_capabilities,
    },
];