Skip to content

Commit

Permalink
add licence
Browse files Browse the repository at this point in the history
Signed-off-by: martinvuyk <[email protected]>
  • Loading branch information
martinvuyk committed Nov 11, 2024
1 parent f66e81a commit 3e83143
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 4 deletions.
12 changes: 12 additions & 0 deletions stdlib/src/sys/ffi/__init__.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
"""Implements a foreign functions interface (FFI)."""


Expand Down
12 changes: 12 additions & 0 deletions stdlib/src/sys/ffi/c/__init__.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
"""FFI utils for the C programming language."""


Expand Down
12 changes: 12 additions & 0 deletions stdlib/src/sys/ffi/c/constants.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
"""Libc POSIX constants."""


Expand Down
16 changes: 14 additions & 2 deletions stdlib/src/sys/ffi/c/libc.mojo
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
"""Libc POSIX file syscalls."""
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
"""Libc POSIX implementation."""

from collections import Optional
from memory import UnsafePointer, stack_allocation
from sys.ffi import external_call, DLHandle
from sys.ffi.utils import external_call, DLHandle
from sys.info import os_is_windows, triple_is_nvidia_cuda

from .types import C
Expand Down
12 changes: 12 additions & 0 deletions stdlib/src/sys/ffi/c/types.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
"""C POSIX types."""

from sys.info import is_64bit, os_is_windows
Expand Down
4 changes: 2 additions & 2 deletions stdlib/src/sys/ffi/utils.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ from memory import UnsafePointer

from utils import StringRef

from .info import os_is_linux, os_is_windows, is_64bit, os_is_macos
from .intrinsics import _mlirtype_is_eq
from sys.info import os_is_linux, os_is_windows, is_64bit, os_is_macos
from sys.intrinsics import _mlirtype_is_eq

from sys._libc import dlerror, dlopen, dlclose, dlsym

Expand Down
12 changes: 12 additions & 0 deletions stdlib/test/sys/ffi/c/test_files.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
# RUN: %mojo %s


Expand Down
12 changes: 12 additions & 0 deletions stdlib/test/sys/ffi/c/test_logging.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
# RUN: %mojo %s

from testing import assert_equal, assert_false, assert_raises, assert_true
Expand Down
12 changes: 12 additions & 0 deletions stdlib/test/sys/ffi/c/test_networking.mojo
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===----------------------------------------------------------------------=== #
# RUN: %mojo %s

from testing import assert_equal, assert_false, assert_raises, assert_true
Expand Down

0 comments on commit 3e83143

Please sign in to comment.