changeset 1045:846b86ba2ccf draft

WIP: import minimal rust source
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Fri, 22 Jun 2018 13:06:11 -0400
parents a3965185623f
children 52a30124f991
files CMakeLists.txt rusty-bits.rs
diffstat 2 files changed, 47 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Feb 14 10:01:04 2024 -0500
+++ b/CMakeLists.txt	Fri Jun 22 13:06:11 2018 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016-2020,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+# Copyright (c) 2016-2020,2023-2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@
 set(JEFFPC_VERSION 0.22-rc1)
 
 enable_testing()
+#enable_language(Rust)
 
 add_definitions(
 	-D__EXTENSIONS__
@@ -90,6 +91,8 @@
 	COMPILE_FLAGS "-P sexpr_reader_")
 ADD_FLEX_BISON_DEPENDENCY(sexpr sexpr)
 
+#set_source_files_properties(rusty-bits.rs PROPERTIES LANGUAGE Rust)
+
 add_library(jeffpc SHARED
 	array.c
 	base64.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rusty-bits.rs	Fri Jun 22 13:06:11 2018 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018,2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#![feature(lang_items)]
+#![no_std]
+#![no_main]
+
+/*
+ * glue necessary for no_std build
+ */
+
+#[panic_handler]
+fn rust_panic(_info: &core::panic::PanicInfo) -> ! {
+    extern "C" {
+        pub fn panic(msg: *const u8) -> !;
+    }
+
+    unsafe {
+        panic(b"rust panic" as *const u8);
+    }
+}
+
+#[lang = "eh_personality"]
+extern "C" fn eh_personality() {}