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
|
// Copyright 2020 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libc2 // import "modernc.org/sqlite/internal/libc2"
import (
"fmt"
"os"
"runtime"
"strings"
"modernc.org/libc"
"modernc.org/libc/sys/types"
)
func todo(s string, args ...interface{}) string { //TODO-
switch {
case s == "":
s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
default:
s = fmt.Sprintf(s, args...)
}
pc, fn, fl, _ := runtime.Caller(1)
f := runtime.FuncForPC(pc)
var fns string
if f != nil {
fns = f.Name()
if x := strings.LastIndex(fns, "."); x > 0 {
fns = fns[x+1:]
}
}
r := fmt.Sprintf("%s:%d:%s: TODOTODO %s", fn, fl, fns, s) //TODOOK
fmt.Fprintf(os.Stdout, "%s\n", r)
os.Stdout.Sync()
return r
}
func trc(s string, args ...interface{}) string { //TODO-
switch {
case s == "":
s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
default:
s = fmt.Sprintf(s, args...)
}
_, fn, fl, _ := runtime.Caller(1)
r := fmt.Sprintf("\n%s:%d: TRC %s", fn, fl, s)
fmt.Fprintf(os.Stdout, "%s\n", r)
os.Stdout.Sync()
return r
}
// int sched_yield(void);
func Xsched_yield(tls *libc.TLS) int32 {
panic(todo(""))
}
// int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
func Xpthread_create(tls *libc.TLS, thread, attr, start_routine, arg uintptr) int32 {
panic(todo(""))
}
// int pthread_detach(pthread_t thread);
func Xpthread_detach(tls *libc.TLS, thread types.Size_t) int32 {
panic(todo(""))
}
// int pthread_mutex_lock(pthread_mutex_t *mutex);
func Xpthread_mutex_lock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_signal(pthread_cond_t *cond);
func Xpthread_cond_signal(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_unlock(pthread_mutex_t *mutex);
func Xpthread_mutex_unlock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
func Xpthread_mutex_init(tls *libc.TLS, mutex, attr uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
func Xpthread_cond_init(tls *libc.TLS, cond, attr uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
func Xpthread_cond_wait(tls *libc.TLS, cond, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_destroy(pthread_cond_t *cond);
func Xpthread_cond_destroy(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_destroy(pthread_mutex_t *mutex);
func Xpthread_mutex_destroy(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_trylock(pthread_mutex_t *mutex);
func Xpthread_mutex_trylock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_broadcast(pthread_cond_t *cond);
func Xpthread_cond_broadcast(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
|