Skip to content

Commit 8b2bced

Browse files
author
Christophe Gragnic
committed
Tweak EmuLisp and Int then use them
1 parent d8aca6f commit 8b2bced

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

lib/emulisp_core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* 22dec15jk
22
* (c) Jon Kleiser
33
*/
4-
5-
var EMULISP_CORE = (function () {
4+
Int = require('./int')
5+
module.exports = EMULISP_CORE = (function () {
66

77
var VERSION = [2, 0, 7, 0],
88
MONLEN = [31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],

lib/index.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
console.log 'Starting atom-language-microalg'
22
MicroAlgView = require './microalg-view'
3+
EMULISP_CORE = require './emulisp_core'
34
{CompositeDisposable} = require 'atom'
45

56
module.exports = MicroAlg =
@@ -32,6 +33,9 @@ module.exports = MicroAlg =
3233
console.log 'MicroAlg exec-ed!'
3334

3435
if !@modalPanel.isVisible()
36+
editor = atom.workspace.getActiveTextEditor()
37+
result = EMULISP_CORE.eval(editor.getText())
38+
@MicroAlgView.setResult(result)
3539
@modalPanel.show()
3640

3741
hide_result: ->

lib/int.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
var Int = function(num) {
2+
module.exports = Int = function(num) {
33
// can be called as a function
44
if (!(this instanceof Int)) {
55
return new Int(num);

lib/microalg-view.coffee

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ class MicroAlgView
1616
getElement: ->
1717
@element
1818

19+
setResult: (src) ->
20+
@element.children[0].textContent = src

0 commit comments

Comments
 (0)