- [Go lang](#go-lang)
- [OCAML lang](#ocaml-lang)
- [Rust lang](#rust-lang)
+- [Assembly](#assembly)
- [Wish list](#wish-list)
---
## Rust lang
-By default I decided not to include Rust lang, but this doesn't mean you cannot do it by hand:
+The source code that you should edit is in **src/pinky.rs**, but you'll have to edit **src/Makefail.skel** and add the following to:
-**lib.rs**
-
-```rust
-#![crate_type = "staticlib"]
-
-use std::os::raw::c_char;
-use std::ffi::CString;
-
-#[no_mangle]
-pub extern fn hello() -> *mut c_char {
- let mut str = String::from("Hello World");
-
- let c_str = CString::new(str).unwrap();
- c_str.into_raw()
-}
-
-#[no_mangle]
-pub extern fn Rfree(s: *mut c_char) {
- unsafe {
- if s.is_null() { return }
- CString::from_raw(s)
- };
-}
+```bash
+pinkybar_LDADD = pinky.a
```
-Compile with `rustc --crate-type=staticlib lib.rs`
+Make sure that you do not use Assembly in the same time.
-**test.c**
+---
-```c
-#include <stdio.h>
+## Assembly
-extern char *hello(void);
-extern void Rfree(char *);
+The source code that you should edit is in **extra/scripts/pinky.s**, but you'll have to edit **src/Makefail.skel** and add the following to:
-int main(void) {
- char *str = hello();
- printf("%s\n", str);
- Rfree(str);
-}
+```bash
+pinkybar_SOURCES = extra/scripts/pinky.s
```
-Compile with `gcc liblib.a test.c -o test -lpthread -ldl`
-
----
+Make sure that you do not use Rust in the same time.
## Wish list
AM_INIT_AUTOMAKE([1.13 -Wall no-define foreign subdir-objects dist-xz no-dist-gzip std-options])
AM_SILENT_RULES([yes])
-m4_define([cuRos],[GENTOO]) m4_define([LINUKS], [cryMeAriver])
+{perl will replace this line}
# With the addition of more runtime compile and
# link tests, this option is no longer necessary.
TEST_ASSEMBLY
TEST_ECL
TEST_OCAML
+TEST_RUST
AC_CONFIG_FILES([
Makefile
echo
echo 'Now type \"make\" and \"make install\" afterwards'
-echo
\ No newline at end of file
+echo
* * * * *
.SS Rust lang
.PP
-By default I decided not to include Rust lang, but this doesn't mean you
-cannot do it by hand:
-.PP
-\f[B]lib.rs\f[]
+The source code that you should edit is in \f[B]src/pinky.rs\f[], but
+you'll have to edit \f[B]src/Makefail.skel\f[] and add the following to:
.IP
.nf
\f[C]
-#![crate_type\ =\ "staticlib"]
-
-use\ std::os::raw::c_char;
-use\ std::ffi::CString;
-
-#[no_mangle]
-pub\ extern\ fn\ hello()\ \->\ *mut\ c_char\ {
-\ \ let\ mut\ str\ =\ String::from("Hello\ World");
-
-\ \ let\ c_str\ =\ CString::new(str).unwrap();
-\ \ c_str.into_raw()
-}
-
-#[no_mangle]
-pub\ extern\ fn\ Rfree(s:\ *mut\ c_char)\ {
-\ \ unsafe\ {
-\ \ \ \ if\ s.is_null()\ {\ return\ }
-\ \ \ \ CString::from_raw(s)
-\ \ };
-}
+pinkybar_LDADD\ =\ pinky.a
\f[]
.fi
.PP
-Compile with \f[C]rustc\ \-\-crate\-type=staticlib\ lib.rs\f[]
+Make sure that you do not use Assembly in the same time.
.PP
-\f[B]test.c\f[]
+ * * * * *
+.SS Assembly
+.PP
+The source code that you should edit is in
+\f[B]extra/scripts/pinky.s\f[], but you'll have to edit
+\f[B]src/Makefail.skel\f[] and add the following to:
.IP
.nf
\f[C]
-#include\ <stdio.h>
-
-extern\ char\ *hello(void);
-extern\ void\ Rfree(char\ *);
-
-int\ main(void)\ {
-\ \ char\ *str\ =\ hello();
-\ \ printf("%s\\n",\ str);
-\ \ Rfree(str);
-}
+pinkybar_SOURCES\ =\ extra/scripts/pinky.s
\f[]
.fi
.PP
-Compile with
-\f[C]gcc\ liblib.a\ test.c\ \-o\ test\ \-lpthread\ \-ldl\f[]
-.PP
- * * * * *
+Make sure that you do not use Rust in the same time.
.SS Wish list
.PP
It would be great if I had *BSD compatible usb wifi dongle or wireless
* Go lang::
* OCAML lang::
* Rust lang::
+* Assembly::
* Wish list::
@end menu
@node Rust lang
@section Rust lang
@anchor{#rust-lang}
-By default I decided not to include Rust lang, but this doesn't mean you
-cannot do it by hand:
-
-@strong{lib.rs}
+The source code that you should edit is in @strong{src/pinky.rs}, but
+you'll have to edit @strong{src/Makefail.skel} and add the following to:
@verbatim
-#![crate_type = "staticlib"]
-
-use std::os::raw::c_char;
-use std::ffi::CString;
-
-#[no_mangle]
-pub extern fn hello() -> *mut c_char {
- let mut str = String::from("Hello World");
-
- let c_str = CString::new(str).unwrap();
- c_str.into_raw()
-}
-
-#[no_mangle]
-pub extern fn Rfree(s: *mut c_char) {
- unsafe {
- if s.is_null() { return }
- CString::from_raw(s)
- };
-}
+pinkybar_LDADD = pinky.a
@end verbatim
-Compile with @code{rustc --crate-type=staticlib lib.rs}
-
-@strong{test.c}
-
-@verbatim
-#include <stdio.h>
-
-extern char *hello(void);
-extern void Rfree(char *);
-
-int main(void) {
- char *str = hello();
- printf("%s\n", str);
- Rfree(str);
-}
-@end verbatim
-
-Compile with @code{gcc liblib.a test.c -o test -lpthread -ldl}
+Make sure that you do not use Assembly in the same time.
@iftex
@bigskip@hrule@bigskip
------------------------------------------------------------------------
@end ifnottex
+@node Assembly
+@section Assembly
+@anchor{#assembly}
+The source code that you should edit is in
+@strong{extra/scripts/pinky.s}, but you'll have to edit
+@strong{src/Makefail.skel} and add the following to:
+
+@verbatim
+pinkybar_SOURCES = extra/scripts/pinky.s
+@end verbatim
+
+Make sure that you do not use Rust in the same time.
+
@node Wish list
@section Wish list
@anchor{#wish-list}
dnl TEST_ECL() function in configure.ac
dnl
-dnl Substitute ECL related linker
+dnl Substitute ECL related linker flags
dnl to the variable ECL_LIBS if
-dnl the user enabled the --with-r switch
+dnl the user enabled the --with-lisp switch
AC_DEFUN([TEST_ECL],[
ECL_LIBS=""
WITH_ECL=0
AC_SUBST(OCAML_CF)
AC_DEFINE_UNQUOTED([WITH_OCAML],[$WITH_OCAML],[Extend the program via ocaml scripts])
])
+
+
+dnl TEST_RUST() function in configure.ac
+dnl
+dnl Substitute ECL related linker flags
+dnl to the variable ECL_LIBS if
+dnl the user enabled the --with-rust switch
+AC_DEFUN([TEST_RUST],[
+ RUST_LIBS=""
+ WITH_RUST=0
+
+ AC_ARG_WITH([rust],
+ AS_HELP_STRING([--with-rust],
+ [Extend the program via rust scripts]),
+ [],
+ [with_rust=no]
+ )
+
+ AS_IF([test "x$with_rust" = "xyes"], [
+ CHECK_CFLAGZ([-O0])
+
+ RUST_LIBS="-lpthread -ldl"
+ WITH_RUST=1
+
+ ])
+
+ AC_SUBST(RUST_LIBS)
+ AC_DEFINE_UNQUOTED([WITH_RUST],[$WITH_RUST],[Extend the program via rust scripts])
+])
+
+
bin_PROGRAMS = pinkybar
-pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) {bzdlibs}
-
+pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(LUA_LIBS) $(PYTHON_LZ) $(RUBY_LZ) $(R_LZ) $(ECL_LIBS) $(OCAML_LZ) $(RUST_LIBS) {bzdlibs}
pinkybar_SOURCES = main.c \
ocaml.c \
ecl.c \
perl.c \
lua.c \
ruby.c \
- ../extra/scripts/pinky.s \
+ rust.c \
python.c \
R.c \
prototypes/ecl.h \
.ml.o:
ocamlc -output-obj $< -o $@
+
+pinky.a:
+ rustc --crate-type=staticlib pinky.rs -o pinky.a
#include "prototypes/R.h"
#include "prototypes/ecl.h"
#include "prototypes/ocaml.h"
+#include "prototypes/rust.h"
/* Because we ran out of a-z A-Z options,
* only long ones will be supported from now on.
ASSEMBLY,
LISP,
OCAML,
+ RUST,
BULLSHIFT
};
const char *argp_program_version = PACKAGE_STRING;
#endif /* WITH_ECL */
#if WITH_OCAML == 1
- { .name = "ocaml", .key = OCAML, .doc = "Extend the program with lisp, read README." },
+ { .name = "ocaml", .key = OCAML, .doc = "Extend the program with ocaml, read README." },
#endif /* WITH_OCAML */
+#if WITH_RUST == 1
+ { .name = "rust", .key = RUST, .doc = "Extend the program with rust, read README." },
+#endif /* WITH_RUST */
+
#if WITH_WEATHER == 1
{ .name = "weather", .key = 'q', .arg = "London,uk", .doc = "The temperature outside." },
#endif /* WITH_WEATHER */
NEW_ARG_LABEL(LISP, char ecl[VLA], ecl, FMT_KERN);
#endif /* WITH_ECL */
+
#if WITH_OCAML == 1
NEW_LABEL(OCAML, char ocaml[VLA], ocaml, FMT_KERN);
#endif /* WITH_OCAML */
+#if WITH_RUST == 1
+ NEW_LABEL(RUST, char rust[VLA], rust, FMT_KERN);
+#endif /* WITH_RUST */
+
+
#if WITH_WEATHER == 1
NEW_ARG_LABEL('q', char weather[VLA], weather, OUT_STR YELLOW STR_SPEC" ");
#endif /* WITH_WEATHER */
--- /dev/null
+#![crate_type = "staticlib"]
+
+use std::os::raw::c_char;
+use std::ffi::CString;
+
+#[no_mangle]
+pub extern fn uzer_func() -> *mut c_char {
+ let mut str = String::from("Hello World");
+
+ let c_str = CString::new(str).unwrap();
+ c_str.into_raw()
+}
+
+#[no_mangle]
+pub extern fn Rfree(s: *mut c_char) {
+ unsafe {
+ if s.is_null() { return }
+ CString::from_raw(s)
+ };
+}
/*
- 06/16/2016
+ 06/16/2017
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- /dev/null
+/*
+ 06/22/2017
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+*/
+
+#ifndef RUST_H_
+#define RUST_H_
+
+#if WITH_RUST == 1
+void get_rust(char *);
+#endif /* WITH_RUST */
+
+#endif /* RUST_H_ */
--- /dev/null
+/*
+ 06/22/2017
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+*/
+
+#include "config.h" /* Auto-generated */
+
+#if WITH_RUST == 1
+#include "include/headers.h"
+#endif /* WITH_RUST */
+
+#include "prototypes/rust.h"
+
+#if WITH_RUST == 1
+extern char *uzer_func(void);
+extern void Rfree(char *);
+
+void
+get_rust(char *str1) {
+ char *str = uzer_func();
+ FILL_STR_ARR(1, str1, str);
+ Rfree(str);
+}
+#else
+char *rust9;
+#endif /* WITH_RUST */