Skip to content

Commit 05b9a81

Browse files
committed
unique type & support -dirs flag & change subdir.pub to llcppg.pub & merge all llcppg.pub for subdirs to merge.llcppg.pub
1 parent d92b035 commit 05b9a81

File tree

18 files changed

+470
-395
lines changed

18 files changed

+470
-395
lines changed

c/c.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type (
3333
Float = float32
3434
Double = float64
3535
Pointer = unsafe.Pointer
36-
FilePtr = *FILE //cname:*FILE
36+
FilePtr = *FILE
3737
)
3838

3939
type FILE struct {
@@ -57,20 +57,20 @@ type integer interface {
5757

5858
type SizeT = uintptr //cname:size_t
5959

60-
type IntptrT = uintptr //cname:intptr_t
61-
type UintptrT = uintptr
62-
type Int8T = int8
63-
type Int16T = int16
64-
type Int32T = int32
65-
type Int64T = int64
60+
type IntptrT = uintptr //cname:intptr_t
61+
type UintptrT = uintptr //cname:uintptr_t
62+
type Int8T = int8 //cname:int8_t
63+
type Int16T = int16 //cname:int16_t
64+
type Int32T = int32 //cname:int32_t
65+
type Int64T = int64 //cname:int64_t
6666

67-
type Uint8T = uint8
68-
type Uint16T = uint16
69-
type Uint32T = uint32
70-
type Uint64T = uint64
67+
type Uint8T = uint8 //cname:uint8_t
68+
type Uint16T = uint16 //cname:uint16_t
69+
type Uint32T = uint32 //cname:uint32_t
70+
type Uint64T = uint64 //cname:uint64_t
7171

72-
type IntmaxT = LongLong
73-
type UintmaxT = UlongLong
72+
type IntmaxT = LongLong //cname:intmax_t
73+
type UintmaxT = UlongLong //cname:uintmax_t
7474

7575
//go:linkname Str llgo.cstr
7676
func Str(string) *Char
@@ -261,13 +261,12 @@ func Perror(s *Char)
261261
func Usleep(useconds Uint) Int
262262

263263
// -----------------------------------------------------------------------------
264-
265264
type Option struct {
266265
Name *Char
267266
HasArg Int
268267
Flag *Int
269268
Val Int
270-
}
269+
} //cname:option
271270

272271
//go:linkname Argc __llgo_argc
273272
var Argc Int

c/c.pub

Lines changed: 0 additions & 16 deletions
This file was deleted.

c/llama2/llama2.pub

Lines changed: 0 additions & 8 deletions
This file was deleted.

c/net/net.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ type SockaddrIn struct {
113113
Port uint16
114114
Addr InAddr
115115
Zero [8]c.Char
116-
}
116+
} //cname:_
117117

118118
type SockaddrIn6 struct {
119119
Len uint8
@@ -122,37 +122,37 @@ type SockaddrIn6 struct {
122122
Flowinfo c.Uint
123123
Addr In6Addr
124124
ScopeId c.Uint
125-
}
125+
} //cname:_
126126

127127
type SockaddrStorage struct {
128128
Len uint8
129129
Family uint8
130130
pad1 [PAD1_SIZE]c.Char
131131
align c.LongLong
132132
pad2 [PAD2_SIZE]c.Char
133-
}
133+
} //cname:_
134134

135135
type InAddr struct {
136136
Addr c.Uint
137-
}
137+
} //cname:_
138138

139139
type In6Addr struct {
140140
U6Addr [16]uint8
141-
}
141+
} //cname:_
142142

143143
type SockAddr struct {
144144
Len uint8
145145
Family uint8
146146
Data [14]c.Char
147-
}
147+
} //cname:sockaddr
148148

149149
type Hostent struct {
150150
Name *c.Char // official name of host
151151
Aliases **c.Char // null-terminated array of alternate names for the host
152152
AddrType c.Int // host address type
153153
Length c.Int // length of address
154154
AddrList **c.Char // null-terminated array of addresses for the host
155-
}
155+
} //cname:hostent
156156

157157
//go:linkname Socket C.socket
158158
func Socket(domain c.Int, typ c.Int, protocol c.Int) c.Int
@@ -212,7 +212,7 @@ type AddrInfo struct {
212212
CanOnName *c.Char
213213
Addr *SockAddr
214214
Next *AddrInfo
215-
}
215+
} //cname:addrinfo
216216

217217
//go:linkname Getaddrinfo C.getaddrinfo
218218
func Getaddrinfo(host *c.Char, port *c.Char, addrInfo *AddrInfo, result **AddrInfo) c.Int

c/net/net.pub

Lines changed: 0 additions & 8 deletions
This file was deleted.

c/os/os.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ const (
5959
)
6060

6161
type (
62-
ModeT C.mode_t
63-
UidT C.uid_t
64-
GidT C.gid_t
65-
OffT C.off_t
66-
DevT C.dev_t
62+
ModeT C.mode_t //cname:mode_t
63+
UidT C.uid_t //cname:uid_t
64+
GidT C.gid_t //cname:gid_t
65+
OffT C.off_t //cname:off_t
66+
DevT C.dev_t //cname:dev_t
6767
)
6868

6969
type (
70-
StatT = syscall.Stat_t
70+
StatT = syscall.Stat_t //cname:Stat_t
7171
)
7272

7373
//go:linkname Errno C.llgoErrno
@@ -262,7 +262,7 @@ func Execvp(file *c.Char, argv **c.Char) c.Int
262262

263263
// -----------------------------------------------------------------------------
264264

265-
type PidT c.Int
265+
type PidT c.Int //cname:pid_t
266266

267267
//go:linkname Fork C.fork
268268
func Fork() PidT

c/pthread/pthread.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type aThread struct {
3636
type RoutineFunc func(c.Pointer) c.Pointer
3737

3838
// Thread represents a POSIX thread.
39-
type Thread = *aThread
39+
type Thread = *aThread //cname:pthread_t
4040

4141
// The pthread_exit() function terminates the calling thread and
4242
// returns a value via retval that (if the thread is joinable) is
@@ -63,7 +63,7 @@ type Attr struct {
6363
Detached byte
6464
SsSp *c.Char
6565
SsSize uintptr
66-
}
66+
} //cname:attr
6767

6868
// llgo:link (*Attr).Init C.pthread_attr_init
6969
func (attr *Attr) Init() c.Int { return 0 }
@@ -92,7 +92,7 @@ func (attr *Attr) SetStackAddr(stackAddr c.Pointer) c.Int { return 0 }
9292
// -----------------------------------------------------------------------------
9393
// Thread Local Storage
9494

95-
type Key c.Uint
95+
type Key c.Uint //cname:pthread_key_t
9696

9797
// llgo:link (*Key).Create C.pthread_key_create
9898
func (key *Key) Create(destructor func(c.Pointer)) c.Int { return 0 }

c/pthread/sync/sync.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const (
3434
// -----------------------------------------------------------------------------
3535

3636
// Once is an object that will perform exactly one action.
37-
type Once C.pthread_once_t
37+
type Once C.pthread_once_t //cname:pthread_once_t
3838

3939
//go:linkname OnceInit llgoSyncOnceInitVal
4040
var OnceInit Once
@@ -44,7 +44,7 @@ func (o *Once) Do(f func()) c.Int { return 0 }
4444

4545
// -----------------------------------------------------------------------------
4646

47-
type MutexType c.Int
47+
type MutexType c.Int //cname:_
4848

4949
const (
5050
MUTEX_NORMAL MutexType = C.PTHREAD_MUTEX_NORMAL
@@ -54,7 +54,7 @@ const (
5454
)
5555

5656
// MutexAttr is a mutex attribute object.
57-
type MutexAttr C.pthread_mutexattr_t
57+
type MutexAttr C.pthread_mutexattr_t //cname:pthread_mutexattr_t
5858

5959
// llgo:link (*MutexAttr).Init C.pthread_mutexattr_init
6060
func (a *MutexAttr) Init(attr *MutexAttr) c.Int { return 0 }
@@ -68,7 +68,7 @@ func (a *MutexAttr) SetType(typ MutexType) c.Int { return 0 }
6868
// -----------------------------------------------------------------------------
6969

7070
// Mutex is a mutual exclusion lock.
71-
type Mutex C.pthread_mutex_t
71+
type Mutex C.pthread_mutex_t //cname:pthread_mutex_t
7272

7373
// llgo:link (*Mutex).Init C.pthread_mutex_init
7474
func (m *Mutex) Init(attr *MutexAttr) c.Int { return 0 }
@@ -88,7 +88,7 @@ func (m *Mutex) Unlock() {}
8888
// -----------------------------------------------------------------------------
8989

9090
// RWLockAttr is a read-write lock attribute object.
91-
type RWLockAttr C.pthread_rwlockattr_t
91+
type RWLockAttr C.pthread_rwlockattr_t //cname:pthread_rwlockattr_t
9292

9393
// llgo:link (*RWLockAttr).Init C.pthread_rwlockattr_init
9494
func (a *RWLockAttr) Init(attr *RWLockAttr) c.Int { return 0 }
@@ -105,7 +105,7 @@ func (a *RWLockAttr) GetPShared(pshared *c.Int) c.Int { return 0 }
105105
// -----------------------------------------------------------------------------
106106

107107
// RWLock is a read-write lock.
108-
type RWLock C.pthread_rwlock_t
108+
type RWLock C.pthread_rwlock_t //cname:pthread_rwlock_t
109109

110110
// llgo:link (*RWLock).Init C.pthread_rwlock_init
111111
func (rw *RWLock) Init(attr *RWLockAttr) c.Int { return 0 }
@@ -134,7 +134,7 @@ func (rw *RWLock) Unlock() {}
134134
// -----------------------------------------------------------------------------
135135

136136
// CondAttr is a condition variable attribute object.
137-
type CondAttr C.pthread_condattr_t
137+
type CondAttr C.pthread_condattr_t //cname:pthread_condattr_t
138138

139139
// llgo:link (*CondAttr).Init C.pthread_condattr_init
140140
func (a *CondAttr) Init(attr *CondAttr) c.Int { return 0 }
@@ -151,7 +151,7 @@ func (a *CondAttr) GetClock(clock *time.ClockidT) c.Int { return 0 }
151151
// -----------------------------------------------------------------------------
152152

153153
// Cond is a condition variable.
154-
type Cond C.pthread_cond_t
154+
type Cond C.pthread_cond_t //cname:pthread_cond_t
155155

156156
// llgo:link (*Cond).Init C.pthread_cond_init
157157
func (c *Cond) Init(attr *CondAttr) c.Int { return 0 }

c/setjmp/setjmp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const (
3030
)
3131

3232
type (
33-
JmpBuf = C.jmp_buf
34-
SigjmpBuf = C.sigjmp_buf
33+
JmpBuf = C.jmp_buf //cname:jmp_buf
34+
SigjmpBuf = C.sigjmp_buf //cname:sigjmp_buf
3535
)
3636

3737
// -----------------------------------------------------------------------------

c/setjmp/setjmp.pub

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)