Commit 7412db2a authored by Mart Lubbers's avatar Mart Lubbers
Browse files

nitrile/clean-lang.org version v1.0

parent 2229a9c5
Pipeline #61152 passed with stage
in 1 minute and 23 seconds
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
image: isocyanoclean/clean-nc:0.2 image: cleanlang/nitrile:0.3
stages: [build, publish] stages: [build, publish]
......
# Changelog
# v1.0
- Initial nitrile version
CFLAGS?=-Wall -Wextra -Wno-unused-parameter
ifeq ($(OS), Windows_NT)
SUFFIX:=obj
else
SUFFIX:=o
endif
.PHONY: clean
all: buildLib buildDemo
buildLib:
$(MAKE) -C cdeps
mkdir -p src/Clean\ System\ Files
cp cdeps/libWrapper.o src/Clean\ System\ Files/libWrapper.$(SUFFIX)
ifeq ($(OS), Windows_NT)
cp cdeps/wolfMQTT/src/libwolfmqtt_la-mqtt_client.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_client.$(SUFFIX)
cp cdeps/wolfMQTT/src/libwolfmqtt_la-mqtt_packet.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_packet.$(SUFFIX)
cp cdeps/wolfMQTT/src/libwolfmqtt_la-mqtt_socket.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_socket.$(SUFFIX)
cp cdeps/_chkstk_ms.obj src/Clean\ System\ Files/
cp src-win/* src/
else
cp cdeps/wolfMQTT/src/.libs/libwolfmqtt_la-mqtt_client.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_client.$(SUFFIX)
cp cdeps/wolfMQTT/src/.libs/libwolfmqtt_la-mqtt_packet.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_packet.$(SUFFIX)
cp cdeps/wolfMQTT/src/.libs/libwolfmqtt_la-mqtt_socket.o src/Clean\ System\ Files/libwolfmqtt_la-mqtt_socket.$(SUFFIX)
cp src-posix/* src/
endif
buildDemo: buildLib
$(MAKE) -C demo
clean:
$(RM) -r $(addsuffix /Clean\ System\ Files, src src/MQTT)
$(RM) -r $(addprefix src/_MQTT., icl dcl)
$(MAKE) -C cdeps clean
$(MAKE) -C demo clean
# MQTTClient # Clean iTask mqtt client using [WolfMQTT](https://github.com/wolfSSL/wolfMQTT)
## Installation instructions ## Maintainer
1. Install [WolfMQTT](https://github.com/wolfSSL/wolfMQTT) (optionally with --enable-mqtt5 flag) Mart Lubbers (mart@cs.ru.nl)
2. Run the `make` command
\ No newline at end of file ## License
`itasks-mqtt` is licensed under the BSD 2-Clause "Simplified" License (see [LICENSE](LICENSE)).
`itasks-mqtt` uses WolfMQTT (is statically linked with) which is licensed under GPLv2.
{"packages":{"linux-x64":[{"name":"abc-interpreter" {"packages":{"linux-x64":[{"name":"abc-interpreter"
,"version":"1.0.2"} ,"version":"1.0.0"}
,{"name":"argenv" ,{"name":"argenv"
,"version":"1.0.2"} ,"version":"1.0.1"}
,{"name":"base" ,{"name":"base"
,"version":"1.1.2"} ,"version":"1.0.0"}
,{"name":"base-clm" ,{"name":"base-clm"
,"version":"1.4.2"} ,"version":"1.4.2"}
,{"name":"base-code-generator" ,{"name":"base-code-generator"
,"version":"1.1.0"} ,"version":"1.0.0"}
,{"name":"base-compiler" ,{"name":"base-compiler"
,"version":"2.0.0"} ,"version":"2.0.1"}
,{"name":"base-compiler-itasks" ,{"name":"base-compiler-itasks"
,"version":"1.0.3"} ,"version":"1.0.0"}
,{"name":"base-rts" ,{"name":"base-rts"
,"version":"1.0.4"} ,"version":"1.1.0"}
,{"name":"base-stdenv" ,{"name":"base-stdenv"
,"version":"1.0.4"} ,"version":"1.0.0"}
,{"name":"clean-platform"
,"version":"0.3.4"}
,{"name":"gast" ,{"name":"gast"
,"version":"0.1.2"} ,"version":"0.2.1"}
,{"name":"graph-copy" ,{"name":"graph-copy"
,"version":"1.0.1"} ,"version":"2.0.1"}
,{"name":"itasks" ,{"name":"itasks"
,"version":"0.1.4"} ,"version":"0.2.0"}
,{"name":"lib-compiler-itasks" ,{"name":"lib-compiler-itasks"
,"version":"2.0.0"} ,"version":"2.0.1"}
,{"name":"platform"
,"version":"0.1.13"}
,{"name":"tcpip" ,{"name":"tcpip"
,"version":"1.0.4"}]}} ,"version":"2.0.1"}]
\ No newline at end of file ,"windows-x64":[{"name":"abc-interpreter"
,"version":"1.0.0"}
,{"name":"argenv"
,"version":"1.0.1"}
,{"name":"base"
,"version":"1.0.0"}
,{"name":"base-clm"
,"version":"1.4.2"}
,{"name":"base-code-generator"
,"version":"1.0.0"}
,{"name":"base-compiler"
,"version":"2.0.1"}
,{"name":"base-compiler-itasks"
,"version":"1.0.0"}
,{"name":"base-linker"
,"version":"1.0.2"}
,{"name":"base-rts"
,"version":"1.1.0"}
,{"name":"base-stdenv"
,"version":"1.0.0"}
,{"name":"clean-platform"
,"version":"0.3.4"}
,{"name":"gast"
,"version":"0.2.1"}
,{"name":"graph-copy"
,"version":"2.0.1"}
,{"name":"itasks"
,"version":"0.2.0"}
,{"name":"lib-compiler-itasks"
,"version":"2.0.1"}
,{"name":"tcpip"
,"version":"2.0.1"}]}}
\ No newline at end of file
name: itask-mqttclient name: itasks-mqtt
url: https://gitlab.com/mtask/mqttclient url: https://gitlab.com/mtask/mqttclient
maintainer: Mart Lubbers maintainer: Mart Lubbers
contact_email: mart@cs.ru.nl contact_email: mart@cs.ru.nl
description: Library for MQTT using WolfMQTT description: iTasks library for MQTT using WolfMQTT
version: 1.0 version: 1.0
license: AGPL-3.0-only license: BSD-2-Clause
type: Library type: Library
clm_options: clm_options:
bytecode: prelinked
compiler: cocl-itasks compiler: cocl-itasks
export_local_labels: true
fusion: GenericFusion fusion: GenericFusion
bytecode: prelinked
generate_descriptors: true generate_descriptors: true
export_local_labels: true post_link: web-resource-collector
print_result: false
print_time: false
strip: false strip: false
# Dependencies
build_dependencies:
base: ^1.0
dependencies: dependencies:
platform: ^0.1.0 base: ^1.0.0
itasks: ^0.1.0 clean-platform: ^0.3.4
itasks: ^0.2.0
package: package:
core_modules: core_modules:
- _MQTT - iTasks.Extensions._MQTT
extra_files: extra_files:
- README.md - README.md
- LICENSE - LICENSE
# Tests
test_src:
- demo/
tests: tests:
compilation: compilation:
compilation: compilation:
{} {}
demo:
script:
- clm:
main: MQTTClient
heap: 500m
# Sources # Sources
src: src:
...@@ -89,3 +81,51 @@ rules: ...@@ -89,3 +81,51 @@ rules:
- libwolfmqtt_la-mqtt_packet.obj - libwolfmqtt_la-mqtt_packet.obj
- libwolfmqtt_la-mqtt_socket.obj - libwolfmqtt_la-mqtt_socket.obj
- _chkstk_ms.obj - _chkstk_ms.obj
---
name: itasks-mqtt-demo
url: https://gitlab.com/mlubbers/clean-itasks-mqtt
maintainer: Mart Lubbers
contact_email: mart@cs.ru.nl
description: Demo application for itasks-mqtt
version: 0.1
license: BSD-2-Clause
type: Application
dependencies:
base: ^1.0.0
base-compiler-itasks: ^1.0.0
clean-platform: ^0.3.4
itasks: ^0.2.0
clm_options:
bytecode: prelinked
compiler: cocl-itasks
export_local_labels: true
fusion: GenericFusion
generate_descriptors: true
heap: 500M
post_link: web-resource-collector
print_result: false
print_time: false
strip: false
src:
- examples
- src/clean-any
rules:
posix:
extra_src:
- src/clean-posix
windows:
extra_src:
- src/clean-windows
build:
demo:
script:
- nitrile build --name=itasks-mqtt
- clm:
main: MQTTClient
target: examples/MQTTClient
definition module iTasks.Extensions.MQTT.Errors definition module iTasks.Extensions.MQTT.Errors
errorCodeToString :: Int -> String errorCodeToString :: !Int -> String
...@@ -2,7 +2,7 @@ implementation module iTasks.Extensions.MQTT.Errors ...@@ -2,7 +2,7 @@ implementation module iTasks.Extensions.MQTT.Errors
import iTasks import iTasks
errorCodeToString :: Int -> String errorCodeToString :: !Int -> String
errorCodeToString 0 = "Success" errorCodeToString 0 = "Success"
errorCodeToString -7 = "Timeout" errorCodeToString -7 = "Timeout"
errorCodeToString -8 = "Network error" errorCodeToString -8 = "Network error"
......
...@@ -3,8 +3,8 @@ definition module iTasks.Extensions.MQTT.Util ...@@ -3,8 +3,8 @@ definition module iTasks.Extensions.MQTT.Util
import iTasks import iTasks
import iTasks.Extensions.MQTT import iTasks.Extensions.MQTT
createReceiveLens :: (SimpleSDSLens MQTTClient) -> (SimpleSDSLens [MQTTMsg]) createReceiveLens :: !(SimpleSDSLens MQTTClient) -> (SimpleSDSLens [MQTTMsg])
mqttSend :: MQTTMsg (SimpleSDSLens MQTTClient) -> Task () mqttSend :: !MQTTMsg !(SimpleSDSLens MQTTClient) -> Task ()
mqttSubscribe :: MQTTSubscribe (SimpleSDSLens MQTTClient) -> Task () mqttSubscribe :: !MQTTSubscribe !(SimpleSDSLens MQTTClient) -> Task ()
mqttUnsubscribe :: MQTTTopicFilter (SimpleSDSLens MQTTClient) -> Task () mqttUnsubscribe :: !MQTTTopicFilter !(SimpleSDSLens MQTTClient) -> Task ()
mqttDisconnect :: (SimpleSDSLens MQTTClient) -> Task () mqttDisconnect :: !(SimpleSDSLens MQTTClient) -> Task ()
...@@ -3,20 +3,19 @@ implementation module iTasks.Extensions.MQTT.Util ...@@ -3,20 +3,19 @@ implementation module iTasks.Extensions.MQTT.Util
import iTasks import iTasks
import iTasks.Extensions.MQTT import iTasks.Extensions.MQTT
createReceiveLens :: (SimpleSDSLens MQTTClient) -> (SimpleSDSLens [MQTTMsg]) createReceiveLens :: !(SimpleSDSLens MQTTClient) -> (SimpleSDSLens [MQTTMsg])
createReceiveLens sds = mapReadWrite (read, write) ?None sds createReceiveLens sds = mapReadWrite (read, write) ?None sds
where read r = r.received where read r = r.received
write received c = (?Just { c & received = received }) write received c = (?Just { c & received = received })
mqttSend :: MQTTMsg (SimpleSDSLens MQTTClient) -> Task () mqttSend :: !MQTTMsg !(SimpleSDSLens MQTTClient) -> Task ()
mqttSend msg sds = upd (\c. { c & send = c.send ++ [msg] }) sds @! () mqttSend msg sds = upd (\c. { c & send = c.send ++ [msg] }) sds @! ()
mqttSubscribe :: MQTTSubscribe (SimpleSDSLens MQTTClient) -> Task () mqttSubscribe :: !MQTTSubscribe !(SimpleSDSLens MQTTClient) -> Task ()
mqttSubscribe sub sds = upd (\c. { c & subscribe = c.subscribe ++ [sub] }) sds @! () mqttSubscribe sub sds = upd (\c. { c & subscribe = c.subscribe ++ [sub] }) sds @! ()
mqttUnsubscribe :: MQTTTopicFilter (SimpleSDSLens MQTTClient) -> Task () mqttUnsubscribe :: !MQTTTopicFilter !(SimpleSDSLens MQTTClient) -> Task ()
mqttUnsubscribe sub sds = upd (\c. { c & unsubscribe = c.unsubscribe ++ [sub] }) sds @! () mqttUnsubscribe sub sds = upd (\c. { c & unsubscribe = c.unsubscribe ++ [sub] }) sds @! ()
mqttDisconnect :: (SimpleSDSLens MQTTClient) -> Task () mqttDisconnect :: !(SimpleSDSLens MQTTClient) -> Task ()
mqttDisconnect sds = upd (\c. { c & disconnect = True }) sds @! () mqttDisconnect sds = upd (\c. { c & disconnect = True }) sds @! ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment