Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/images/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/www/fsm.js
test
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
MIT License

Copyright (c) 2010 Evan Wallace

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.

---

Additional Contributions by John (2025)

All contributions made by John are also licensed under the MIT License.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# Finite State Machine Designer

http://madebyevan.com/fsm/
![Finite State Machine Image](./.github/images/image.png)

**Original Website**: [http://madebyevan.com/fsm/](http://madebyevan.com/fsm/)

**Updated Website**: [https://raredrops.github.io/fsm](https://raredrops.github.io/fsm/)

## Description

The Finite State Machine Designer is a JavaScript-based application that allows users to create and manipulate finite state machines (FSMs) visually. It provides functionality for converting LaTeX commands into their corresponding Unicode characters, rendering mathematical symbols, and exporting drawings in LaTeX format.

## Features

- **LaTeX Command Conversion**: Converts common LaTeX commands (e.g., Greek letters, mathematical operators) into Unicode characters.
- **Drawing Capabilities**: Allows users to create and manipulate drawings using a canvas, with support for exporting to LaTeX.
- **Export to LaTeX**: Provides functionality to export drawings as LaTeX code, suitable for use in LaTeX documents.
- **Customizable**: Easily extendable to add more LaTeX shortcuts or drawing features.

## Changelog

* **1.1.0** - Added LaTeX typing functionalities, including support for Greek letters and mathematical operators.
* **1.0.0** - Initial release of the Finite State Machine Designer by Evan Wallace(Original Creator).

## Contributing

Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.

## License

MIT © [RareDrop](https://github.com/RareDrops/fsm)

## Acknowledgments

- Thanks to [Evan Wallace](http://madebyevan.com) for creating this amazing tool!
19 changes: 14 additions & 5 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os, time, sys

Expand All @@ -7,11 +8,19 @@ def sources():
return [os.path.join(base, f) for base, folders, files in os.walk(path) for f in files if f.endswith('.js')]

def build():
path = './www/fsm.js'
data = '\n'.join(open(file, 'r').read() for file in sources())
with open(path, 'w') as f:
f.write(data)
print 'built %s (%u bytes)' % (path, len(data))
path = './public/fsm.js'
try:
data = '\n'.join(open(file, 'r', encoding='utf-8').read() for file in sources())
with open(path, 'w', encoding='utf-8') as f:
f.write(data)
print('built %s (%u bytes)' % (path, len(data)))
except Exception as e:
print('Error:', str(e))
# Try alternative encoding if utf-8 fails
data = '\n'.join(open(file, 'r', encoding='latin-1').read() for file in sources())
with open(path, 'w', encoding='utf-8') as f:
f.write(data)
print('built %s (%u bytes) using latin-1 fallback' % (path, len(data)))

def stat():
return [os.stat(file).st_mtime for file in sources()]
Expand Down
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0; url=public/index.html">
<title>Finite State Machine Designer</title>
</head>
<body>

</body>
</html>
23 changes: 23 additions & 0 deletions latex_shortcut_support.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const greekLetters = {
'\\alpha': '\u03B1', '\\beta': '\u03B2', '\\gamma': '\u03B3', '\\delta': '\u03B4', '\\epsilon': '\u03B5',
'\\zeta': '\u03B6', '\\eta': '\u03B7', '\\theta': '\u03B8', '\\iota': '\u03B9', '\\kappa': '\u03BA',
'\\lambda': '\u03BB', '\\mu': '\u03BC', '\\nu': '\u03BD', '\\xi': '\u03BE', '\\pi': '\u03C0',
'\\rho': '\u03C1', '\\sigma': '\u03C3', '\\tau': '\u03C4', '\\upsilon': '\u03C5', '\\phi': '\u03C6',
'\\chi': '\u03C7', '\\psi': '\u03C8', '\\omega': '\u03C9',
'\\Gamma': '\u0393', '\\Delta': '\u0394', '\\Theta': '\u0398', '\\Lambda': '\u039B', '\\Xi': '\u039E',
'\\Pi': '\u03A0', '\\Sigma': '\u03A3', '\\Phi': '\u03A6', '\\Psi': '\u03A8', '\\Omega': '\u03A9'
};

// Mathematical operators
const operators = {
'\\times': '\u00D7', '\\div': '\u00F7', '\\pm': '\u00B1', '\\mp': '\u2213',
'\\leq': '\u2264', '\\geq': '\u2265', '\\neq': '\u2260', '\\approx': '\u2248',
'\\infty': '\u221E', '\\sum': '\u2211', '\\prod': '\u220F', '\\int': '\u222B',
// Set theory symbols
'\\cup': '\u222A', '\\cap': '\u2229', '\\subset': '\u2282', '\\supset': '\u2283',
'\\subseteq': '\u2286', '\\supseteq': '\u2287', '\\in': '\u2208', '\\notin': '\u2209',
'\\emptyset': '\u2205', '\\varnothing': '\u2205',
// Additional operators
'\\cdot': '\u22C5', '\\bullet': '\u2022', '\\circ': '\u2218', '\\oplus': '\u2295',
'\\otimes': '\u2297', '\\setminus': '\u2216', '\\subsetneq': '\u228A', '\\supsetneq': '\u228B'
};
Loading