1
0
Fork
You've already forked smear
0
forked from smudgelang/smear
Smudge Environment and Runtime
  • C 91.9%
  • Makefile 8.1%
Find a file
Nathan Michaels 9baa2f8d7d
Add a timed wait so mainloop doesn't just spin all the time. ( #26 )
* Add a timed wait so mainloop doesn't just spin all the time.
* Add clock time and time manipulation interface. (NB)
The goal here is to cause mainloop to yield for some time so as to not
starve the other processes.
2019年02月04日 00:45:12 -05:00
debian Release 0.1.1 2018年10月10日 09:57:28 -04:00
include/smear Allow linking from C++ programs. 2018年10月23日 21:38:48 -04:00
obj Add obj directory. 2018年06月16日 17:50:28 -04:00
src Add a timed wait so mainloop doesn't just spin all the time. ( #26 ) 2019年02月04日 00:45:12 -05:00
tests Add a timed wait so mainloop doesn't just spin all the time. ( #26 ) 2019年02月04日 00:45:12 -05:00
.appveyor.yml Appveyor apparently defines CC as cc by default. 2018年10月23日 21:56:05 -04:00
.travis.yml Fix 2 bugs with wait_for_empty. ( #25 ) 2018年12月20日 15:58:45 -05:00
CHANGES Release 0.1.1 2018年10月10日 09:57:28 -04:00
LICENSE Licenses! BSD 3-clause because yes. 2018年06月17日 19:34:19 -04:00
Makefile Add a timed wait so mainloop doesn't just spin all the time. ( #26 ) 2019年02月04日 00:45:12 -05:00
README.md Add reference to debian repo. 2018年10月09日 21:09:33 -04:00

Linux Build Status Windows Build Status

The Smear Library

Smear is the SMudge Environment And Runtime, a standard library for the Smudge state machine programming language.

Getting Smear

Splat

Instead of installing Smear by itself, most people will want to install Splat, the Smudge Platform, which bundles together everything you need to use Smudge. To download, go to the Splat releases page for the latest platform release.

Binaries

If you really want to install the Smear library by itself, there are binary releases available for Windows and Linux available on the Smear releases page.

Users of Debian and derivatives can add the Smudge package repository and keep smear installations current by following these directions. The package for Smear itself is called libsmear-dev.

Building and Linking

To use this package in your own Smudge projects, build libsmear.a. In your shell of choice, run:

$ make

Put the library in your library include path. Then link your code with -lsmear -pthread. Also put include/smear/* in your include path.

Using Smear

Autogenerate Smear Bindings

To get Smudge to generate bindings directly to smear for your project, along with a minimal main, run:

$ smudge --c-smear --c-stubs machine.smudge

Manual Smear Bindings

Smear implements all the functions whose names start with SMUDGE_, and has handy macros for generating your event handlers. Put this in one of your .c files:

#include <smear.h>
// Call this macro once per Smudge state machine. This is how you
// would call it for a machine called "machine".
SRT_HANDLERS(machine)
// And this is how you'd call it for another machine called
// "traffic_light".
SRT_HANDLERS(traffic_light)

Then, before you send any events in your program, call SRT_init(). Once your program is initialized, you can call SRT_run() to start processing events. If you ever want to stop the state machines, you can call SRT_stop() and if you want to run forever in a happy little Smudge world, you can call SRT_join().