aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--Makefile80
-rw-r--r--csrc/smith.c15
-rw-r--r--csrc/smith.h6
-rw-r--r--go.mod5
-rw-r--r--main.go24
6 files changed, 137 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4d7c973
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.DS_Store
+.idea
+*.log
+tmp/
+csrc/obj
+libsmith.a
+go.sum
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6119205
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,80 @@
+#==============================================================================#
+# SMITH ( //
+# Makefile ( )/
+# by salade )(/
+# ________________ ( /)
+# ()__)____________))))) :^}
+#==============================================================================#
+# smith c/go makefile
+# @version 0.1
+#
+default: all
+
+#==============================================================================#
+#--------------------------------- SHELL --------------------------------------#
+#==============================================================================#
+SHELL := /bin/sh
+OS = $(shell uname)
+
+#==============================================================================#
+#------------------------------ DIRECTORIES -----------------------------------#
+#==============================================================================#
+C_DIR = csrc/
+SRCS_DIR = ${C_DIR}
+INCS_DIR = ${C_DIR}
+OBJS_DIR = ${C_DIR}obj/
+OUT_DIR = ./
+#==============================================================================#
+#------------------------------ FILES -----------------------------------------#
+#==============================================================================#
+SRCS_NAME = smith
+#------------------------------------------------------------------------------#
+SRCS = $(addprefix ${SRCS_DIR}, $(addsuffix .c, ${SRCS_NAME}))
+#------------------------------------------------------------------------------#
+INCS_NAME = smith
+#------------------------------------------------------------------------------#
+INCS = $(addprefix ${INCS_DIR}, $(addsuffix .h, ${INCS_NAME}))
+#------------------------------------------------------------------------------#
+OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS})
+
+#==============================================================================#
+#------------------------------ TARGETS ---------------------------------------#
+#==============================================================================#
+C_NAME = libsmith.a
+NAME = smith
+CC = clang
+GO = go
+#------------------------------------------------------------------------------#
+CFLAGS = -O2
+CFLAGS += -Wall -Werror -Wextra -pedantic
+CFLAGS += -finline -pipe
+
+#==============================================================================#
+#------------------------------ C TARGET --------------------------------------#
+#==============================================================================#
+LDFLAGS = -O2 -pipe -pedantic
+#------------------------------------------------------------------------------#
+${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS}
+ ${CC} -c ${CFLAGS} ${CDEFS} -o $@ $<
+#------------------------------------------------------------------------------#
+${OBJS_DIR}:
+ mkdir -p ${OBJS_DIR}
+#------------------------------------------------------------------------------#
+${C_NAME}: ${OBJS_DIR} ${OBJS} ${INCS}
+ ar rcs ${OUT_DIR}${C_NAME} ${OBJS}
+
+#==============================================================================#
+#------------------------------ ALL -------------------------------------------#
+#==============================================================================#
+#------------------------------------------------------------------------------#
+all: ${C_NAME}
+ go build
+#------------------------------------------------------------------------------#
+clean:
+ rm -rvf ${OBJS_DIR} ${OUT_DIR}${NAME}
+#------------------------------------------------------------------------------#
+fclean: clean
+ go clean
+#------------------------------------------------------------------------------#
+# end :^}
+#------------------------------------------------------------------------------#
diff --git a/csrc/smith.c b/csrc/smith.c
new file mode 100644
index 0000000..4ff5553
--- /dev/null
+++ b/csrc/smith.c
@@ -0,0 +1,15 @@
+/*********************************/
+/* SMITH ( // */
+/* smith ( )/ */
+/* by salade )(/ */
+/* ________________ ( /) */
+/* ()__)____________))))) :^} */
+/*********************************/
+
+#include "smith.h"
+
+char *
+mr_smith()
+{
+ return ("---SMITH_V0.0.0---");
+}
diff --git a/csrc/smith.h b/csrc/smith.h
new file mode 100644
index 0000000..b342e54
--- /dev/null
+++ b/csrc/smith.h
@@ -0,0 +1,6 @@
+#ifndef SMITH_H_
+#define SMITH_H_
+
+char * mr_smith();
+
+#endif // SMITH_H_
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..185d41c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module smith
+
+go 1.16
+
+require github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 // indirect
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..fc21770
--- /dev/null
+++ b/main.go
@@ -0,0 +1,24 @@
+// SMITH ( // /
+// main ( )/ /
+// by salade )(/ /
+// ________________ ( /) /
+// ()__)____________))))) :^} /
+
+package main
+
+import (
+ "github.com/rivo/tview"
+)
+
+// #include "csrc/smith.h"
+// #cgo LDFLAGS: -lsmith -L.
+import "C"
+
+func main() {
+ ctogo := C.mr_smith()
+ box := tview.NewBox().SetBorder(true).SetTitle(C.GoString(ctogo))
+
+ if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
+ panic(err)
+ }
+}