gitlab.com/CoiaPrant/sqlite3@v1.19.1/internal/libc2/libc2_unix.go (about)

     1  // Copyright 2020 The Sqlite Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build darwin
     6  // +build darwin
     7  
     8  package libc2 // import "gitlab.com/CoiaPrant/sqlite3/internal/libc2"
     9  
    10  import (
    11  	"fmt"
    12  	"os"
    13  	"runtime"
    14  	"strings"
    15  
    16  	"modernc.org/libc"
    17  	"modernc.org/libc/sys/types"
    18  )
    19  
    20  func todo(s string, args ...interface{}) string { //TODO-
    21  	switch {
    22  	case s == "":
    23  		s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
    24  	default:
    25  		s = fmt.Sprintf(s, args...)
    26  	}
    27  	pc, fn, fl, _ := runtime.Caller(1)
    28  	f := runtime.FuncForPC(pc)
    29  	var fns string
    30  	if f != nil {
    31  		fns = f.Name()
    32  		if x := strings.LastIndex(fns, "."); x > 0 {
    33  			fns = fns[x+1:]
    34  		}
    35  	}
    36  	r := fmt.Sprintf("%s:%d:%s: TODOTODO %s", fn, fl, fns, s) //TODOOK
    37  	fmt.Fprintf(os.Stdout, "%s\n", r)
    38  	os.Stdout.Sync()
    39  	return r
    40  }
    41  
    42  func trc(s string, args ...interface{}) string { //TODO-
    43  	switch {
    44  	case s == "":
    45  		s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
    46  	default:
    47  		s = fmt.Sprintf(s, args...)
    48  	}
    49  	_, fn, fl, _ := runtime.Caller(1)
    50  	r := fmt.Sprintf("\n%s:%d: TRC %s", fn, fl, s)
    51  	fmt.Fprintf(os.Stdout, "%s\n", r)
    52  	os.Stdout.Sync()
    53  	return r
    54  }
    55  
    56  // int sched_yield(void);
    57  func Xsched_yield(tls *libc.TLS) int32 {
    58  	panic(todo(""))
    59  }
    60  
    61  // int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
    62  func Xpthread_create(tls *libc.TLS, thread, attr, start_routine, arg uintptr) int32 {
    63  	panic(todo(""))
    64  }
    65  
    66  // int pthread_detach(pthread_t thread);
    67  func Xpthread_detach(tls *libc.TLS, thread types.Pthread_t) int32 {
    68  	panic(todo(""))
    69  }
    70  
    71  // int pthread_mutex_lock(pthread_mutex_t *mutex);
    72  func Xpthread_mutex_lock(tls *libc.TLS, mutex uintptr) int32 {
    73  	panic(todo(""))
    74  }
    75  
    76  // int pthread_cond_signal(pthread_cond_t *cond);
    77  func Xpthread_cond_signal(tls *libc.TLS, cond uintptr) int32 {
    78  	panic(todo(""))
    79  }
    80  
    81  // int pthread_mutex_unlock(pthread_mutex_t *mutex);
    82  func Xpthread_mutex_unlock(tls *libc.TLS, mutex uintptr) int32 {
    83  	panic(todo(""))
    84  }
    85  
    86  // int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
    87  func Xpthread_mutex_init(tls *libc.TLS, mutex, attr uintptr) int32 {
    88  	panic(todo(""))
    89  }
    90  
    91  // int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
    92  func Xpthread_cond_init(tls *libc.TLS, cond, attr uintptr) int32 {
    93  	panic(todo(""))
    94  }
    95  
    96  // int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
    97  func Xpthread_cond_wait(tls *libc.TLS, cond, mutex uintptr) int32 {
    98  	panic(todo(""))
    99  }
   100  
   101  // int pthread_cond_destroy(pthread_cond_t *cond);
   102  func Xpthread_cond_destroy(tls *libc.TLS, cond uintptr) int32 {
   103  	panic(todo(""))
   104  }
   105  
   106  // int pthread_mutex_destroy(pthread_mutex_t *mutex);
   107  func Xpthread_mutex_destroy(tls *libc.TLS, mutex uintptr) int32 {
   108  	panic(todo(""))
   109  }
   110  
   111  // int pthread_mutex_trylock(pthread_mutex_t *mutex);
   112  func Xpthread_mutex_trylock(tls *libc.TLS, mutex uintptr) int32 {
   113  	panic(todo(""))
   114  }
   115  
   116  // int pthread_cond_broadcast(pthread_cond_t *cond);
   117  func Xpthread_cond_broadcast(tls *libc.TLS, cond uintptr) int32 {
   118  	panic(todo(""))
   119  }