From 1349149922b282e74a77c7d51c316d883fba5b89 Mon Sep 17 00:00:00 2001 From: Jan Mercl <0xjnml@gmail.com> Date: Fri, 31 Jul 2020 14:18:38 +0200 Subject: use crt v3.24.9 --- internal/crt2/crt2.go | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 internal/crt2/crt2.go (limited to 'internal/crt2/crt2.go') diff --git a/internal/crt2/crt2.go b/internal/crt2/crt2.go new file mode 100644 index 0000000..bffe76b --- /dev/null +++ b/internal/crt2/crt2.go @@ -0,0 +1,130 @@ +// 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 crt2 // import "modernc.org/sqlite/internal/crt2" + +import ( + "fmt" + "os" + "runtime" + "strings" + + "modernc.org/crt/v3" +) + +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 *crt.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 *crt.TLS, thread, attr, start_routine, arg uintptr) int32 { + panic(todo("")) +} + +// int pthread_detach(pthread_t thread); +func Xpthread_detach(tls *crt.TLS, thread crt.Size_t) int32 { + panic(todo("")) +} + +// int ferror(FILE *stream); +func Xferror(tls *crt.TLS, stream uintptr) int32 { + panic(todo("")) +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat(tls *crt.TLS, fd int32, statbuf uintptr) int32 { + panic(todo("")) +} + +// // int rename(const char *oldpath, const char *newpath); +// func Xrename(tls *crt.TLS, oldpath, newpath uintptr) int32 { +// panic(todo("")) +// } + +// int pthread_mutex_lock(pthread_mutex_t *mutex); +func Xpthread_mutex_lock(tls *crt.TLS, mutex uintptr) int32 { + panic(todo("")) +} + +// int pthread_cond_signal(pthread_cond_t *cond); +func Xpthread_cond_signal(tls *crt.TLS, cond uintptr) int32 { + panic(todo("")) +} + +// int pthread_mutex_unlock(pthread_mutex_t *mutex); +func Xpthread_mutex_unlock(tls *crt.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 *crt.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 *crt.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 *crt.TLS, cond, mutex uintptr) int32 { + panic(todo("")) +} + +// int pthread_cond_destroy(pthread_cond_t *cond); +func Xpthread_cond_destroy(tls *crt.TLS, cond uintptr) int32 { + panic(todo("")) +} + +// int pthread_mutex_destroy(pthread_mutex_t *mutex); +func Xpthread_mutex_destroy(tls *crt.TLS, mutex uintptr) int32 { + panic(todo("")) +} + +// int pthread_mutex_trylock(pthread_mutex_t *mutex); +func Xpthread_mutex_trylock(tls *crt.TLS, mutex uintptr) int32 { + panic(todo("")) +} + +// int pthread_cond_broadcast(pthread_cond_t *cond); +func Xpthread_cond_broadcast(tls *crt.TLS, cond uintptr) int32 { + panic(todo("")) +} -- cgit v1.2.3-70-g09d2