File: stdlib.cfg

package info (click to toggle)
redeclipse 1.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,980 kB
  • sloc: cpp: 99,295; ansic: 2,398; sh: 929; makefile: 691; objc: 361; awk: 167; sql: 102
file content (37 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (9)
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
// console language standard library

// creates a macro whose body is a format str
// i.e. macro greet [ say Hi, %1! ]
macro = [$arg1 = (concat [format [@@arg2]] (loopconcat i $numargs [result [$arg@(+ $i 1)]]))]

append = [$arg1 = (concat (getalias $arg1) $arg2)]

swapval = [
    local tmp
    tmp = $$arg1
    $arg1 = $$arg2
    $arg2 = $tmp
]

// binds a key so that it will toggle a variable
// i.e. bindvar 9 thirdperson
bindvar = [
    bind $arg1 [@arg2 (= $@arg2 0); if (= $@arg2 0) [echo @@arg2 OFF] [ echo @@arg2 ON]]
]; setcomplete bindvar 1

// same as above, but only binds for edit mode
editbindvar = [
    editbind $arg1 [@arg2 (= $@arg2 0); if (= $@arg2 0) [echo @@arg2 OFF] [ echo @@arg2 ON]]
]; setcomplete editbindvar 1

// binds a key so that it will set a modifier while held down
bindmod = [
    bind $arg1 [@arg2 1; onrelease [@@arg2 0]]
]; setcomplete bindmod 1

// same as above, but only binds for edit mode
editbindmod = [
    editbind $arg1 [@arg2 1; onrelease [@@arg2 0]]
]; setcomplete editbindmod 1

quine = [ echo (format "quine = [%1]" $quine) ]; setcomplete quine 1