Skip to content

Commit 260fd65

Browse files
committed
jule: rename cpp keyword as extend
1 parent 92aba1b commit 260fd65

40 files changed

+497
-497
lines changed

std/integ/c/c.jule

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// Use of this source code is governed by a BSD 3-Clause
33
// license that can be found in the LICENSE file.
44

5-
cpp use "std/integ/c/c.hpp"
5+
extern use "std/integ/c/c.hpp"

std/integ/c/mem.jule

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Use of this source code is governed by a BSD 3-Clause
33
// license that can be found in the LICENSE file.
44

5-
cpp fn malloc(size: uint): *unsafe
6-
cpp fn calloc(size: uint, n: uint): *unsafe
7-
cpp fn realloc(mut ptr: *unsafe, size: uint): *unsafe
8-
cpp fn free(mut ptr: *unsafe)
5+
extern fn malloc(size: uint): *unsafe
6+
extern fn calloc(size: uint, n: uint): *unsafe
7+
extern fn realloc(mut ptr: *unsafe, size: uint): *unsafe
8+
extern fn free(mut ptr: *unsafe)
99

1010
// Allocates size bytes of memory.
1111
// Memory does not initialize.
@@ -14,7 +14,7 @@ cpp fn free(mut ptr: *unsafe)
1414
// This function is part of the C-style memory management.
1515
// It might be very dangerous.
1616
fn Malloc(size: uint): *unsafe {
17-
ret cpp.malloc(size)
17+
ret extern.malloc(size)
1818
}
1919

2020
// Allocates n elements of size bytes each, all initialized to zero.
@@ -23,7 +23,7 @@ fn Malloc(size: uint): *unsafe {
2323
// This function is part of the C-style memory management.
2424
// It can be very dangerous.
2525
fn Calloc(size: uint, n: uint): *unsafe {
26-
ret cpp.calloc(size, n)
26+
ret extern.calloc(size, n)
2727
}
2828

2929
// Re-allocates the previously allocated block in ptr,
@@ -33,7 +33,7 @@ fn Calloc(size: uint, n: uint): *unsafe {
3333
// This function is part of the C-style memory management.
3434
// It can be very dangerous.
3535
fn Realloc(mut ptr: *unsafe, size: uint): *unsafe {
36-
ret cpp.realloc(ptr, size)
36+
ret extern.realloc(ptr, size)
3737
}
3838

3939
// Free a block allocated by malloc, realloc or calloc.
@@ -43,5 +43,5 @@ fn Realloc(mut ptr: *unsafe, size: uint): *unsafe {
4343
// This function is part of the C-style memory management.
4444
// It can be very dangerous.
4545
fn Free(mut ptr: *unsafe) {
46-
cpp.free(ptr)
46+
extern.free(ptr)
4747
}

std/integ/c/types.jule

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@
22
// Use of this source code is governed by a BSD 3-Clause
33
// license that can be found in the LICENSE file.
44

5-
cpp use "<stddef.h>"
6-
cpp use "<stdint.h>"
7-
8-
cpp type char: byte
9-
cpp type wchar_t: u16
10-
cpp type __jule_signed_char: i8
11-
cpp type __jule_unsigned_char: u8
12-
cpp type short: i16
13-
cpp type __jule_unsigned_short: u16
14-
cpp type signed: i32
15-
cpp type unsigned: u32
16-
cpp type long: i32
17-
cpp type __jule_unsigned_long: u32
18-
cpp type __jule_long_long: i64
19-
cpp type __jule_unsigned_long_long: u64
20-
cpp type float: f32
21-
cpp type double: f64
22-
cpp type __jule_long_double: f64
23-
cpp type size_t: uint
24-
cpp type uintptr_t: uint
25-
cpp type intptr_t: int
26-
cpp type ptrdiff_t: int
5+
extern use "<stddef.h>"
6+
extern use "<stdint.h>"
7+
8+
extern type char: byte
9+
extern type wchar_t: u16
10+
extern type __jule_signed_char: i8
11+
extern type __jule_unsigned_char: u8
12+
extern type short: i16
13+
extern type __jule_unsigned_short: u16
14+
extern type signed: i32
15+
extern type unsigned: u32
16+
extern type long: i32
17+
extern type __jule_unsigned_long: u32
18+
extern type __jule_long_long: i64
19+
extern type __jule_unsigned_long_long: u64
20+
extern type float: f32
21+
extern type double: f64
22+
extern type __jule_long_double: f64
23+
extern type size_t: uint
24+
extern type uintptr_t: uint
25+
extern type intptr_t: int
26+
extern type ptrdiff_t: int
2727

2828
// Type alias for char type.
29-
type Char: cpp.char
29+
type Char: extern.char
3030

3131
// Type alias for wchar_t type.
32-
type Wchar: cpp.wchar_t
32+
type Wchar: extern.wchar_t
3333

3434
// Type alias for signed char type.
35-
type SignedChar: cpp.__jule_signed_char
35+
type SignedChar: extern.__jule_signed_char
3636

3737
// Type alias for signed char type.
38-
type UnsignedChar: cpp.__jule_unsigned_char
38+
type UnsignedChar: extern.__jule_unsigned_char
3939

4040
// Type alias for short type.
41-
type Short: cpp.short
41+
type Short: extern.short
4242

4343
// Type alias for short int type.
4444
type ShortInt: Short
@@ -50,13 +50,13 @@ type SignedShort: Short
5050
type SignedShortInt: Short
5151

5252
// Type alias for unsigned short type.
53-
type UnsignedShort: cpp.__jule_unsigned_short
53+
type UnsignedShort: extern.__jule_unsigned_short
5454

5555
// Type alias for unsigned short int type.
5656
type UnsignedShortInt: UnsignedShort
5757

5858
// Type alias for int type.
59-
type Int: cpp.signed
59+
type Int: extern.signed
6060

6161
// Type alias for signed type.
6262
type Signed: Int
@@ -65,13 +65,13 @@ type Signed: Int
6565
type SignedInt: Int
6666

6767
// Type alias for unsigned type.
68-
type Unsigned: cpp.unsigned
68+
type Unsigned: extern.unsigned
6969

7070
// Type alias for unsigned int type.
7171
type UnsignedInt: Unsigned
7272

7373
// Type alias for long type.
74-
type Long: cpp.long
74+
type Long: extern.long
7575

7676
// Type alias for long int type.
7777
type LongInt: Long
@@ -83,13 +83,13 @@ type SignedLong: Long
8383
type SignedLongInt: Long
8484

8585
// Type alias for unsigned long type.
86-
type UnsignedLong: cpp.__jule_unsigned_long
86+
type UnsignedLong: extern.__jule_unsigned_long
8787

8888
// Type alias for unsigned long int type.
8989
type UnsignedLongInt: UnsignedLong
9090

9191
// Type alias for long long type.
92-
type LongLong: cpp.__jule_unsigned_long
92+
type LongLong: extern.__jule_unsigned_long
9393

9494
// Type alias for long long int type.
9595
type LongLongInt: LongLong
@@ -101,28 +101,28 @@ type SignedLongLong: LongLong
101101
type SignedLongLongInt: LongLong
102102

103103
// Type alias for unsigned long long type.
104-
type UnsignedLongLong: cpp.__jule_unsigned_long_long
104+
type UnsignedLongLong: extern.__jule_unsigned_long_long
105105

106106
// Type alias for unsigned long long int type.
107107
type UnsignedLongLongInt: UnsignedLongLong
108108

109109
// Type alias for float type.
110-
type Float: cpp.float
110+
type Float: extern.float
111111

112112
// Type alias for double type.
113-
type Double: cpp.double
113+
type Double: extern.double
114114

115115
// Type alias for long double type.
116-
type LongDouble: cpp.__jule_long_double
116+
type LongDouble: extern.__jule_long_double
117117

118118
// Type alias for size_t type.
119-
type Size: cpp.size_t
119+
type Size: extern.size_t
120120

121121
// Type alias for uintptr_t type.
122-
type Uintptr: cpp.uintptr_t
122+
type Uintptr: extern.uintptr_t
123123

124124
// Type alias for intptr_t type.
125-
type Intptr: cpp.intptr_t
125+
type Intptr: extern.intptr_t
126126

127127
// Type alias for ptrdiff_t type.
128-
type Ptrdiff: cpp.ptrdiff_t
128+
type Ptrdiff: extern.ptrdiff_t

std/internal/os/windows/symlink.jule

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use "std/sys"
66

77
#typedef
8-
cpp struct FILE_ATTRIBUTE_TAG_INFO{}
8+
extern struct FILE_ATTRIBUTE_TAG_INFO{}
99

10-
cpp type HANDLE: *unsafe
11-
cpp type DWORD: u32
10+
extern type HANDLE: *unsafe
11+
extern type DWORD: u32
1212

13-
cpp type FILE_INFO_BY_HANDLE_CLASS: int
13+
extern type FILE_INFO_BY_HANDLE_CLASS: int
1414

15-
cpp unsafe fn GetFileInformationByHandleEx(h: cpp.HANDLE, infoClass: cpp.FILE_INFO_BY_HANDLE_CLASS, fileInfo: *unsafe, bufferSize: cpp.DWORD): bool
15+
extern unsafe fn GetFileInformationByHandleEx(h: extern.HANDLE, infoClass: extern.FILE_INFO_BY_HANDLE_CLASS, fileInfo: *unsafe, bufferSize: extern.DWORD): bool
1616

1717
const FileAttributeTagInfo = 9
1818

@@ -22,5 +22,5 @@ struct FILE_ATTRIBUTE_TAG_INFO {
2222
}
2323

2424
unsafe fn GetFileInformationByHandleEx(h: sys::Handle, infoClass: int, fileInfo: *unsafe, bufferSize: u32): bool {
25-
ret cpp.GetFileInformationByHandleEx(cpp.HANDLE(h), cpp.FILE_INFO_BY_HANDLE_CLASS(infoClass), fileInfo, cpp.DWORD(bufferSize))
25+
ret extern.GetFileInformationByHandleEx(extern.HANDLE(h), extern.FILE_INFO_BY_HANDLE_CLASS(infoClass), fileInfo, extern.DWORD(bufferSize))
2626
}

std/internal/runtime/atomic/atomic.jule

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ const (
1414
)
1515

1616
#cdef
17-
cpp unsafe fn __atomic_store(*unsafe, *unsafe, MemoryOrder)
17+
extern unsafe fn __atomic_store(*unsafe, *unsafe, MemoryOrder)
1818

1919
#cdef
20-
cpp unsafe fn __atomic_load(*unsafe, *unsafe, MemoryOrder)
20+
extern unsafe fn __atomic_load(*unsafe, *unsafe, MemoryOrder)
2121

2222
#cdef
23-
cpp unsafe fn __atomic_exchange[T](*unsafe, *unsafe, *unsafe, MemoryOrder): T
23+
extern unsafe fn __atomic_exchange[T](*unsafe, *unsafe, *unsafe, MemoryOrder): T
2424

2525
#cdef
26-
cpp unsafe fn __atomic_compare_exchange_n[T](*unsafe, *unsafe, T, int, MemoryOrder, MemoryOrder): bool
26+
extern unsafe fn __atomic_compare_exchange_n[T](*unsafe, *unsafe, T, int, MemoryOrder, MemoryOrder): bool
2727

2828
#cdef
29-
cpp unsafe fn __atomic_fetch_add[T](*unsafe, T, MemoryOrder): T
29+
extern unsafe fn __atomic_fetch_add[T](*unsafe, T, MemoryOrder): T
3030

3131
// Atomically stores new value to p with memory order mo, and returns the old value.
3232
fn Swap[T](mut p: *T, new: T, mo: MemoryOrder): (old: T) {
@@ -66,15 +66,15 @@ fn Store[T](mut p: *T, val: T, mo: MemoryOrder) {
6666
// T1 is a base pointer type, T2 is the output type.
6767
fn SwapZ[T1, T2](mut p: *T1, new: T2, mo: MemoryOrder): (old: T2) {
6868
let mut tmp: T2
69-
unsafe { cpp.__atomic_exchange[T2](p, &new, &tmp, mo) }
69+
unsafe { extern.__atomic_exchange[T2](p, &new, &tmp, mo) }
7070
ret tmp
7171
}
7272

7373
// Atomically reads value of the p with memory order mo and returns.
7474
// T1 is a base pointer type, T2 is the output type.
7575
fn LoadZ[T1, T2](p: *T1, mo: MemoryOrder): T2 {
7676
let mut tmp: T2
77-
unsafe { cpp.__atomic_load(p, &tmp, mo) }
77+
unsafe { extern.__atomic_load(p, &tmp, mo) }
7878
ret tmp
7979
}
8080

@@ -84,7 +84,7 @@ fn LoadZ[T1, T2](p: *T1, mo: MemoryOrder): T2 {
8484
// T1 is a base pointer type, T2 is the output type.
8585
fn CompareAndSwapZ[T1, T2](mut p: *T1, old: T2, new: T2, succ: MemoryOrder, fail: MemoryOrder): (swapped: bool) {
8686
const Strong = 0 // strong atomicity
87-
ret unsafe { cpp.__atomic_compare_exchange_n[T2](p, &old, new, Strong, succ, fail) }
87+
ret unsafe { extern.__atomic_compare_exchange_n[T2](p, &old, new, Strong, succ, fail) }
8888
}
8989

9090
// Atomically reads value of the p and compares it with old.
@@ -93,17 +93,17 @@ fn CompareAndSwapZ[T1, T2](mut p: *T1, old: T2, new: T2, succ: MemoryOrder, fail
9393
// T1 is a base pointer type, T2 is the output type.
9494
fn CompareAndSwapWeakZ[T1, T2](mut p: *T1, old: T2, new: T2, succ: MemoryOrder, fail: MemoryOrder): (swapped: bool) {
9595
const Weak = 1 // weak atomicity
96-
ret unsafe { cpp.__atomic_compare_exchange_n[T2](p, &old, new, Weak, succ, fail) }
96+
ret unsafe { extern.__atomic_compare_exchange_n[T2](p, &old, new, Weak, succ, fail) }
9797
}
9898

9999
// Atomically adds delta to p with memory order mo and returns the new value.
100100
// T1 is a base pointer type, T2 is the output type.
101101
fn AddZ[T1, T2](mut p: *T1, delta: T2, mo: MemoryOrder): (new: T2) {
102-
ret unsafe { cpp.__atomic_fetch_add[T2](p, delta, mo) } + delta
102+
ret unsafe { extern.__atomic_fetch_add[T2](p, delta, mo) } + delta
103103
}
104104

105105
// Atomically stores new value to p with memory order mo.
106106
// T1 is a base pointer type, T2 is the output type.
107107
fn StoreZ[T1, T2](mut p: *T1, val: T2, mo: MemoryOrder) {
108-
unsafe { cpp.__atomic_store(p, &val, mo) }
108+
unsafe { extern.__atomic_store(p, &val, mo) }
109109
}

std/internal/runtime/syscall/syscall_linux.jule

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
// Deprecated: Use pure implementation like Assembly for direct syscalls instead of libc wrappers.
66

7-
cpp use "<errno.h>"
7+
extern use "<errno.h>"
88

9-
cpp let errno: int
9+
extern let errno: int
1010

11-
cpp fn syscall(num: uintptr, arg1: uintptr, arg2: uintptr, arg3: uintptr, arg4: uintptr, arg5: uintptr, arg6: uintptr): (r: int)
11+
extern fn syscall(num: uintptr, arg1: uintptr, arg2: uintptr, arg3: uintptr, arg4: uintptr, arg5: uintptr, arg6: uintptr): (r: int)
1212

1313
fn Syscall(num: uintptr, arg1: uintptr, arg2: uintptr, arg3: uintptr, arg4: uintptr, arg5: uintptr, arg6: uintptr): (r: uintptr, err: uintptr) {
1414
err = NO_ERROR
15-
r0 := cpp.syscall(num, arg1, arg2, arg3, arg4, arg5, arg6)
15+
r0 := extern.syscall(num, arg1, arg2, arg3, arg4, arg5, arg6)
1616
r = uintptr(r0)
1717
if r0 < 0 {
18-
err = uintptr(cpp.errno)
18+
err = uintptr(extern.errno)
1919
}
2020
ret
2121
}

0 commit comments

Comments
 (0)