This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| // Copy any modified settings to `User/upload-to-gist.sublime-settings` | |
| // otherwise modifications will not survive updates. | |
| // "login": "itsbth", | |
| // "token": "", | |
| "public": true, | |
| "description": "Uploaded by UploadToGist for Sublime Text 2" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib2 | |
| from subprocess import Popen, PIPE | |
| from os import path | |
| import json | |
| import httplib | |
| CREATE_URL = u'https://gist.github.com/gists' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local Vector | |
| do | |
| local V_MT, sqrt, type, unpack, setmetatable = {}, math.sqrt, type, unpack, setmetatable | |
| V_MT.__index = V_MT | |
| function V_MT:__add(b) | |
| return Vector(self.x + b.x, self.y + b.y) | |
| end | |
| function V_MT:__sub(b) | |
| return Vector(self.x - b.x, self.y - b.y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "vm.h" | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #include <assert.h> | |
| #define VM_REG_MASK (1<<31) | |
| #define VM_CODE_MASK (1<<30) | |
| #define VM_DATA_MASK ((1<<16)-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # c.py - sublimelint package for checking c files | |
| import re | |
| from base_linter import BaseLinter | |
| CONFIG = { | |
| 'language': 'c', | |
| 'executable': 'clang', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "vm.h" | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #include <assert.h> | |
| #define VM_REG_MASK (1<<31) | |
| #define VM_CODE_MASK (1<<30) | |
| #define VM_DATA_MASK ((1<<16)-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ➜ radevm ./main | |
| 0: MOV VM_REG(0x0), VM_CODE(0x9) [0, 10] | |
| 3: ADDI VM_REG(0x0), VM_CODE(0xa) [10, 20] | |
| 6: INT VM_CODE(0xb), 0x0 [1, 0] | |
| Interrupt: 1 | |
| 10 + 20 = 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "vm.h" | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #include <assert.h> | |
| struct _vm_state { | |
| int regi[8]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdbool.h> | |
| #define VERBOSE | |
| #include "vm.h" | |
| unsigned int code[] = { | |
| /*0*/ INSTR_MOV, VM_REG(0), VM_CODE(9), | |
| /*3*/ INSTR_ADDI, VM_REG(0), VM_CODE(10), | |
| /*6*/ INSTR_INT, VM_CODE(11), 0, | |
| /*9*/ 10, 20, 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1 "vm.c" | |
| # 1 "vm.c" 1 | |
| # 1 "<built-in>" 1 | |
| # 1 "<built-in>" 3 | |
| # 131 "<built-in>" 3 | |
| # 1 "<command line>" 1 | |
| # 1 "<built-in>" 2 | |
| # 1 "vm.c" 2 | |
| # 1 "./vm.h" 1 | |
| # 27 "./vm.h" |