summaryrefslogtreecommitdiffstats
path: root/lib/c-utils.tcl
blob: 242008f3e8d4fe0bc8eb13116b3f93d4680e9daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if {[namespace exists c] && $::tcl_platform(os) eq "Linux"} {
    set handle [c create]
    $handle include <sys/syscall.h>
    $handle include <unistd.h>
    $handle proc getTid {} int {
        return syscall(SYS_gettid);
    }
    $handle compile
}

# FIXME: this shouldn't be global
proc ::defineImageType {cc} {
    set cc [uplevel {namespace current}]::$cc
    $cc struct image_t {
        uint32_t width;
        uint32_t height;
        int components;
        uint32_t bytesPerRow;

        uint8_t* data;
    }
}