mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c17b1f10c | ||
|
|
d490fc303f | ||
|
|
20fdac95f6 | ||
|
|
234ee8b6d2 | ||
|
|
58ab593a64 | ||
|
|
ec1f6a4cd6 | ||
|
|
3eea8212f4 | ||
|
|
a1e09ae3e6 | ||
|
|
c1f76c26e5 | ||
|
|
0983f62e02 | ||
|
|
190e54c020 | ||
|
|
ded651159d | ||
|
|
acbab53198 | ||
|
|
fba4babdcd | ||
|
|
eb6a213921 | ||
|
|
5e2c79e950 | ||
|
|
e93f41f097 |
19
.gitmodules
vendored
19
.gitmodules
vendored
@@ -112,9 +112,6 @@
|
||||
[submodule "vendor/grammars/fancy-tmbundle"]
|
||||
path = vendor/grammars/fancy-tmbundle
|
||||
url = https://github.com/fancy-lang/fancy-tmbundle
|
||||
[submodule "vendor/grammars/dart-sublime-bundle"]
|
||||
path = vendor/grammars/dart-sublime-bundle
|
||||
url = https://github.com/guillermooo/dart-sublime-bundle
|
||||
[submodule "vendor/grammars/sublimetext-cuda-cpp"]
|
||||
path = vendor/grammars/sublimetext-cuda-cpp
|
||||
url = https://github.com/harrism/sublimetext-cuda-cpp
|
||||
@@ -387,7 +384,7 @@
|
||||
url = https://github.com/textmate/c.tmbundle
|
||||
[submodule "vendor/grammars/zephir-sublime"]
|
||||
path = vendor/grammars/zephir-sublime
|
||||
url = https://github.com/vmg/zephir-sublime
|
||||
url = https://github.com/phalcon/zephir-sublime
|
||||
[submodule "vendor/grammars/llvm.tmbundle"]
|
||||
path = vendor/grammars/llvm.tmbundle
|
||||
url = https://github.com/whitequark/llvm.tmbundle
|
||||
@@ -799,7 +796,7 @@
|
||||
url = https://github.com/perl6/atom-language-perl6
|
||||
[submodule "vendor/grammars/reason"]
|
||||
path = vendor/grammars/reason
|
||||
url = https://github.com/facebook/reason
|
||||
url = https://github.com/chenglou/sublime-reason
|
||||
[submodule "vendor/grammars/language-xcompose"]
|
||||
path = vendor/grammars/language-xcompose
|
||||
url = https://github.com/samcv/language-xcompose
|
||||
@@ -839,3 +836,15 @@
|
||||
[submodule "vendor/grammars/language-jolie"]
|
||||
path = vendor/grammars/language-jolie
|
||||
url = https://github.com/fmontesi/language-jolie
|
||||
[submodule "vendor/grammars/sublime-shen"]
|
||||
path = vendor/grammars/sublime-shen
|
||||
url = https://github.com/rkoeninger/sublime-shen
|
||||
[submodule "vendor/grammars/Sublime-Pep8"]
|
||||
path = vendor/grammars/Sublime-Pep8
|
||||
url = https://github.com/R4PaSs/Sublime-Pep8
|
||||
[submodule "vendor/grammars/dartlang"]
|
||||
path = vendor/grammars/dartlang
|
||||
url = https://github.com/dart-atom/dartlang
|
||||
[submodule "vendor/grammars/language-closure-templates"]
|
||||
path = vendor/grammars/language-closure-templates
|
||||
url = https://github.com/mthadley/language-closure-templates
|
||||
|
||||
12
grammars.yml
12
grammars.yml
@@ -100,6 +100,8 @@ vendor/grammars/Sublime-Modula-2:
|
||||
- source.modula2
|
||||
vendor/grammars/Sublime-Nit:
|
||||
- source.nit
|
||||
vendor/grammars/Sublime-Pep8/:
|
||||
- source.pep8
|
||||
vendor/grammars/Sublime-QML:
|
||||
- source.qml
|
||||
vendor/grammars/Sublime-REBOL:
|
||||
@@ -247,11 +249,9 @@ vendor/grammars/cython:
|
||||
- source.cython
|
||||
vendor/grammars/d.tmbundle:
|
||||
- source.d
|
||||
vendor/grammars/dart-sublime-bundle:
|
||||
vendor/grammars/dartlang:
|
||||
- source.dart
|
||||
- source.pubspec
|
||||
- text.dart-analysis-output
|
||||
- text.dart-doccomments
|
||||
- source.yaml-ext
|
||||
vendor/grammars/desktop.tmbundle:
|
||||
- source.desktop
|
||||
vendor/grammars/diff.tmbundle:
|
||||
@@ -358,6 +358,8 @@ vendor/grammars/language-click:
|
||||
- source.click
|
||||
vendor/grammars/language-clojure:
|
||||
- source.clojure
|
||||
vendor/grammars/language-closure-templates:
|
||||
- text.html.soy
|
||||
vendor/grammars/language-coffee-script:
|
||||
- source.coffee
|
||||
- source.litcoffee
|
||||
@@ -639,6 +641,8 @@ vendor/grammars/sublime-rexx:
|
||||
- source.rexx
|
||||
vendor/grammars/sublime-robot-plugin:
|
||||
- text.robot
|
||||
vendor/grammars/sublime-shen:
|
||||
- source.shen
|
||||
vendor/grammars/sublime-spintools:
|
||||
- source.regexp.spin
|
||||
- source.spin
|
||||
|
||||
@@ -57,7 +57,7 @@ module Linguist
|
||||
composer_lock? ||
|
||||
node_modules? ||
|
||||
go_vendor? ||
|
||||
npm_shrinkwrap? ||
|
||||
npm_shrinkwrap_or_package_lock? ||
|
||||
godeps? ||
|
||||
generated_by_zephir? ||
|
||||
minified_files? ||
|
||||
@@ -326,11 +326,11 @@ module Linguist
|
||||
!!name.match(/vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)/)
|
||||
end
|
||||
|
||||
# Internal: Is the blob a generated npm shrinkwrap file?
|
||||
# Internal: Is the blob a generated npm shrinkwrap or package lock file?
|
||||
#
|
||||
# Returns true or false.
|
||||
def npm_shrinkwrap?
|
||||
!!name.match(/npm-shrinkwrap\.json/)
|
||||
def npm_shrinkwrap_or_package_lock?
|
||||
name.match(/npm-shrinkwrap\.json/) || name.match(/package-lock\.json/)
|
||||
end
|
||||
|
||||
# Internal: Is the blob part of Godeps/,
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#
|
||||
# type - Either data, programming, markup, prose, or nil
|
||||
# aliases - An Array of additional aliases (implicitly
|
||||
# includes the lowercase name with spaces replaced
|
||||
# by dashes)
|
||||
# includes name.downcase)
|
||||
# ace_mode - A String name of the Ace Mode used for highlighting whenever
|
||||
# a file is edited. This must match one of the filenames in http://git.io/3XO_Cg.
|
||||
# Use "text" if a mode does not exist.
|
||||
@@ -456,7 +455,6 @@ C:
|
||||
- ".cats"
|
||||
- ".h"
|
||||
- ".idc"
|
||||
- ".w"
|
||||
interpreters:
|
||||
- tcc
|
||||
ace_mode: c_cpp
|
||||
@@ -590,6 +588,13 @@ CSV:
|
||||
extensions:
|
||||
- ".csv"
|
||||
language_id: 51
|
||||
CWeb:
|
||||
type: programming
|
||||
extensions:
|
||||
- ".w"
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
language_id: 657332628
|
||||
Cap'n Proto:
|
||||
type: programming
|
||||
tm_scope: source.capnp
|
||||
@@ -688,6 +693,18 @@ Clojure:
|
||||
filenames:
|
||||
- riemann.config
|
||||
language_id: 62
|
||||
Closure Templates:
|
||||
type: markup
|
||||
group: HTML
|
||||
ace_mode: soy_template
|
||||
codemirror_mode: soy
|
||||
codemirror_mime_type: text/x-soy
|
||||
alias:
|
||||
- soy
|
||||
extensions:
|
||||
- ".soy"
|
||||
tm_scope: text.html.soy
|
||||
language_id: 357046146
|
||||
CoffeeScript:
|
||||
type: programming
|
||||
tm_scope: source.coffee
|
||||
@@ -1360,6 +1377,8 @@ GLSL:
|
||||
- ".glslv"
|
||||
- ".gshader"
|
||||
- ".shader"
|
||||
- ".tesc"
|
||||
- ".tese"
|
||||
- ".vert"
|
||||
- ".vrx"
|
||||
- ".vsh"
|
||||
@@ -3160,6 +3179,14 @@ Pascal:
|
||||
codemirror_mode: pascal
|
||||
codemirror_mime_type: text/x-pascal
|
||||
language_id: 281
|
||||
Pep8:
|
||||
type: programming
|
||||
color: "#C76F5B"
|
||||
extensions:
|
||||
- ".pep"
|
||||
ace_mode: text
|
||||
tm_scope: source.pep8
|
||||
language_id: 840372442
|
||||
Perl:
|
||||
type: programming
|
||||
tm_scope: source.perl
|
||||
@@ -3740,6 +3767,7 @@ Roff:
|
||||
- ".me"
|
||||
- ".ms"
|
||||
- ".n"
|
||||
- ".nr"
|
||||
- ".rno"
|
||||
- ".roff"
|
||||
- ".tmac"
|
||||
@@ -4098,7 +4126,7 @@ Shen:
|
||||
color: "#120F14"
|
||||
extensions:
|
||||
- ".shen"
|
||||
tm_scope: none
|
||||
tm_scope: source.shen
|
||||
ace_mode: text
|
||||
language_id: 348
|
||||
Slash:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "5.0.9"
|
||||
VERSION = "5.0.11"
|
||||
end
|
||||
|
||||
404
samples/CWeb/sat-life.w
Normal file
404
samples/CWeb/sat-life.w
Normal file
@@ -0,0 +1,404 @@
|
||||
\datethis
|
||||
@*Intro. This program generates clauses for the transition relation
|
||||
from time $t$ to time $t+1$ in Conway's Game of Life, assuming that
|
||||
all of the potentially live cells at time $t$ belong to a pattern
|
||||
that's specified in |stdin|. The pattern is defined by one or more
|
||||
lines representing rows of cells, where each line has `\..' in a
|
||||
cell that's guaranteed to be dead at time~$t$, otherwise it has `\.*'.
|
||||
The time is specified separately as a command-line parameter.
|
||||
|
||||
The Boolean variable for cell $(x,y)$ at time $t$ is named by its
|
||||
so-called ``xty code,'' namely by the decimal value of~$x$, followed
|
||||
by a code letter for~$t$, followed by the decimal value of~$y$. For
|
||||
example, if $x=10$ and $y=11$ and $t=0$, the variable that indicates
|
||||
liveness of the cell is \.{10a11}; and the corresponding variable
|
||||
for $t=1$ is \.{10b11}.
|
||||
|
||||
Up to 19 auxiliary variables are used together with each xty code,
|
||||
in order to construct clauses that define the successor state.
|
||||
The names of these variables are obtained by appending one of
|
||||
the following two-character combinations to the xty code:
|
||||
\.{A2}, \.{A3}, \.{A4},
|
||||
\.{B1}, \.{B2}, \.{B3}, \.{B4},
|
||||
\.{C1}, \.{C2}, \.{C3}, \.{C4},
|
||||
\.{D1}, \.{D2},
|
||||
\.{E1}, \.{E2},
|
||||
\.{F1}, \.{F2},
|
||||
\.{G1}, \.{G2}.
|
||||
These variables are derived from the Bailleux--Boufkhad method
|
||||
of encoding cardinality constraints:
|
||||
The auxiliary variable \.{A$k$} stands for the condition
|
||||
``at least $k$ of the eight neighbors are alive.'' Similarly,
|
||||
\.{B$k$} stands for ``at least $k$ of the first four neighbors
|
||||
are alive,'' and \.{C$k$} accounts for the other four neighbors.
|
||||
Codes \.D, \.E, \.F, and~\.G refer to pairs of neighbors.
|
||||
Thus, for instance, \.{10a11C2} means that at least two of the
|
||||
last four neighbors of cell $(10,11)$ are alive.
|
||||
|
||||
Those auxiliary variables receive values by means of up to 77 clauses per cell.
|
||||
For example, if $u$ and~$v$ are the neighbors of cell~$z$ that correspond
|
||||
to a pairing of type~\.D, there are six clauses
|
||||
$$\bar u d_1,\quad
|
||||
\bar v d_1,\quad
|
||||
\bar u\bar v d_2,\quad
|
||||
u v\bar d_1,\quad
|
||||
u\bar d_2,\quad
|
||||
v\bar d_2.$$
|
||||
The sixteen clauses
|
||||
$$\displaylines{\hfill
|
||||
\bar d_1b_1,\quad
|
||||
\bar e_1b_1,\quad
|
||||
\bar d_2b_2,\quad
|
||||
\bar d_1\bar e_1b_2,\quad
|
||||
\bar e_2b_2,\quad
|
||||
\bar d_2\bar e_1b_3,\quad
|
||||
\bar d_1\bar e_2b_3,\quad
|
||||
\bar d_2\bar e_2b_4,
|
||||
\hfill\cr\hfill
|
||||
d_1e_1\bar b_1,\quad
|
||||
d_1e_2\bar b_2,\quad
|
||||
d_2e_1\bar b_2,\quad
|
||||
d_1\bar b_3,\quad
|
||||
d_2e_2\bar b_3,\quad
|
||||
e_1\bar b_3,\quad
|
||||
d_2\bar b_4,\quad
|
||||
e_2\bar b_4
|
||||
\hfill}$$
|
||||
define $b$ variables from $d$'s and $e$'s; and another sixteen
|
||||
define $c$'s from $f$'s and $g$'s in the same fashion.
|
||||
A similar set of 21 clauses will define the $a$'s from the $b$'s and $c$'s.
|
||||
|
||||
Once the $a$'s are defined, thus essentially counting the
|
||||
live neighbors of cell $z$, the next
|
||||
state~$z'$ is defined by five further clauses
|
||||
$$\bar a_4\bar z',\quad
|
||||
a_2\bar z',\quad
|
||||
a_3z\bar z',\quad
|
||||
\bar a_3a_4z',\quad
|
||||
\bar a_2a_4\bar zz'.$$
|
||||
For example, the last of these states that $z'$ will be true
|
||||
(i.e., that cell $z$ will be alive at time $t+1$) if
|
||||
$z$ is alive at time~$t$ and has $\ge2$ live neighbors
|
||||
but not $\ge4$.
|
||||
|
||||
Nearby cells can share auxiliary variables, according to a tricky scheme that
|
||||
is worked out below. In consequence, the actual number of auxiliary variables
|
||||
and clauses per cell is reduced from 19 and $77+5$ to 13 and $57+5$,
|
||||
respectively, except at the boundaries.
|
||||
|
||||
@ So here's the overall outline of the program.
|
||||
|
||||
@d maxx 50 /* maximum number of lines in the pattern supplied by |stdin| */
|
||||
@d maxy 50 /* maximum number of columns per line in |stdin| */
|
||||
|
||||
@c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
char p[maxx+2][maxy+2]; /* is cell $(x,y)$ potentially alive? */
|
||||
char have_b[maxx+2][maxy+2]; /* did we already generate $b(x,y)$? */
|
||||
char have_d[maxx+2][maxy+2]; /* did we already generate $d(x,y)$? */
|
||||
char have_e[maxx+2][maxy+4]; /* did we already generate $e(x,y)$? */
|
||||
char have_f[maxx+4][maxy+2]; /* did we already generate $f(x-2,y)$? */
|
||||
int tt; /* time as given on the command line */
|
||||
int xmax,ymax; /* the number of rows and columns in the input pattern */
|
||||
int xmin=maxx,ymin=maxy; /* limits in the other direction */
|
||||
char timecode[]="abcdefghijklmnopqrstuvwxyz"@|
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"@|
|
||||
"!\"#$%&'()*+,-./:;<=>?@@[\\]^_`{|}~"; /* codes for $0\le t\le83$ */
|
||||
@q$@>
|
||||
char buf[maxy+2]; /* input buffer */
|
||||
unsigned int clause[4]; /* clauses are assembled here */
|
||||
int clauseptr; /* this many literals are in the current clause */
|
||||
@<Subroutines@>@;
|
||||
main(int argc,char*argv[]) {
|
||||
register int j,k,x,y;
|
||||
@<Process the command line@>;
|
||||
@<Input the pattern@>;
|
||||
for (x=xmin-1;x<=xmax+1;x++) for (y=ymin-1;y<=ymax+1;y++) {
|
||||
@<If cell $(x,y)$ is obviously dead at time $t+1$, |continue|@>;
|
||||
a(x,y);
|
||||
zprime(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
@ @<Process the command line@>=
|
||||
if (argc!=2 || sscanf(argv[1],"%d",&tt)!=1) {
|
||||
fprintf(stderr,"Usage: %s t\n",argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
if (tt<0 || tt>82) {
|
||||
fprintf(stderr,"The time should be between 0 and 82 (not %d)!\n",tt);
|
||||
exit(-2);
|
||||
}
|
||||
|
||||
@ @<Input the pattern@>=
|
||||
for (x=1;;x++) {
|
||||
if (!fgets(buf,maxy+2,stdin)) break;
|
||||
if (x>maxx) {
|
||||
fprintf(stderr,"Sorry, the pattern should have at most %d rows!\n",maxx);
|
||||
exit(-3);
|
||||
}
|
||||
for (y=1;buf[y-1]!='\n';y++) {
|
||||
if (y>maxy) {
|
||||
fprintf(stderr,"Sorry, the pattern should have at most %d columns!\n",
|
||||
maxy);
|
||||
exit(-4);
|
||||
}
|
||||
if (buf[y-1]=='*') {
|
||||
p[x][y]=1;
|
||||
if (y>ymax) ymax=y;
|
||||
if (y<ymin) ymin=y;
|
||||
if (x>xmax) xmax=x;
|
||||
if (x<xmin) xmin=x;
|
||||
}@+else if (buf[y-1]!='.') {
|
||||
fprintf(stderr,"Unexpected character `%c' found in the pattern!\n",
|
||||
buf[y-1]);
|
||||
exit(-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ @d pp(xx,yy) ((xx)>=0 && (yy)>=0? p[xx][yy]: 0)
|
||||
|
||||
@<If cell $(x,y)$ is obviously dead at time $t+1$, |continue|@>=
|
||||
if (pp(x-1,y-1)+pp(x-1,y)+pp(x-1,y+1)+
|
||||
pp(x,y-1)+p[x][y]+p[x][y+1]+
|
||||
pp(x+1,y-1)+p[x+1][y]+p[x+1][y+1]<3) continue;
|
||||
|
||||
@ Clauses are assembled in the |clause| array (surprise), where we
|
||||
put encoded literals.
|
||||
|
||||
The code for a literal is an unsigned 32-bit quantity, where the leading
|
||||
bit is 1 if the literal should be complemented. The next three bits
|
||||
specify the type of the literal (0 thru 7 for plain and \.A--\.G);
|
||||
the next three bits specify an integer~$k$; and the next bit is zero.
|
||||
That leaves room for two 12-bit fields, which specify $x$ and $y$.
|
||||
|
||||
Type 0 literals have $k=0$ for the ordinary xty code. However, the
|
||||
value $k=1$ indicates that the time code should be for $t+1$ instead of~$t$.
|
||||
And $k=2$ denotes a special ``tautology'' literal, which is always true.
|
||||
If the tautology literal is complemented, we omit it from the clause;
|
||||
otherwise we omit the entire clause.
|
||||
Finally, $k=7$ denotes an auxiliary literal, used to avoid
|
||||
clauses of length~4.
|
||||
|
||||
Here's a subroutine that outputs the current clause and resets
|
||||
the |clause| array.
|
||||
|
||||
@d taut (2<<25)
|
||||
@d sign (1U<<31)
|
||||
|
||||
@<Sub...@>=
|
||||
void outclause(void) {
|
||||
register int c,k,x,y,p;
|
||||
for (p=0;p<clauseptr;p++)
|
||||
if (clause[p]==taut) goto done;
|
||||
for (p=0;p<clauseptr;p++) if (clause[p]!=taut+sign) {
|
||||
if (clause[p]>>31) printf(" ~");@+else printf(" ");
|
||||
c=(clause[p]>>28)&0x7;
|
||||
k=(clause[p]>>25)&0x7;
|
||||
x=(clause[p]>>12)&0xfff;
|
||||
y=clause[p]&0xfff;
|
||||
if (c) printf("%d%c%d%c%d",
|
||||
x,timecode[tt],y,c+'@@',k);
|
||||
else if (k==7) printf("%d%c%dx",
|
||||
x,timecode[tt],y);
|
||||
else printf("%d%c%d",
|
||||
x,timecode[tt+k],y);
|
||||
}
|
||||
printf("\n");
|
||||
done: clauseptr=0;
|
||||
}
|
||||
|
||||
@ And here's another, which puts a type-0 literal into |clause|.
|
||||
|
||||
@<Sub...@>=
|
||||
void applit(int x,int y,int bar,int k) {
|
||||
if (k==0 && (x<xmin || x>xmax || y<ymin || y>ymax || p[x][y]==0))
|
||||
clause[clauseptr++]=(bar? 0: sign)+taut;
|
||||
else clause[clauseptr++]=(bar? sign:0)+(k<<25)+(x<<12)+y;
|
||||
}
|
||||
|
||||
@ The |d| and |e| subroutines are called for only one-fourth
|
||||
of all cell addresses $(x,y)$. Indeed, one can show that
|
||||
$x$ is always odd, and that $y\bmod4<2$.
|
||||
|
||||
Therefore we remember if we've seen $(x,y)$ before.
|
||||
|
||||
Slight trick: If |yy| is not in range, we avoid generating the
|
||||
clause $\bar d_k$ twice.
|
||||
|
||||
@d newlit(x,y,c,k) clause[clauseptr++]=((c)<<28)+((k)<<25)+((x)<<12)+(y)
|
||||
@d newcomplit(x,y,c,k)
|
||||
clause[clauseptr++]=sign+((c)<<28)+((k)<<25)+((x)<<12)+(y)
|
||||
|
||||
@<Sub...@>=
|
||||
void d(int x,int y) {
|
||||
register x1=x-1,x2=x,yy=y+1;
|
||||
if (have_d[x][y]!=tt+1) {
|
||||
applit(x1,yy,1,0),newlit(x,y,4,1),outclause();
|
||||
applit(x2,yy,1,0),newlit(x,y,4,1),outclause();
|
||||
applit(x1,yy,1,0),applit(x2,yy,1,0),newlit(x,y,4,2),outclause();
|
||||
applit(x1,yy,0,0),applit(x2,yy,0,0),newcomplit(x,y,4,1),outclause();
|
||||
applit(x1,yy,0,0),newcomplit(x,y,4,2),outclause();
|
||||
if (yy>=ymin && yy<=ymax)
|
||||
applit(x2,yy,0,0),newcomplit(x,y,4,2),outclause();
|
||||
have_d[x][y]=tt+1;
|
||||
}
|
||||
}
|
||||
@#
|
||||
void e(int x,int y) {
|
||||
register x1=x-1,x2=x,yy=y-1;
|
||||
if (have_e[x][y]!=tt+1) {
|
||||
applit(x1,yy,1,0),newlit(x,y,5,1),outclause();
|
||||
applit(x2,yy,1,0),newlit(x,y,5,1),outclause();
|
||||
applit(x1,yy,1,0),applit(x2,yy,1,0),newlit(x,y,5,2),outclause();
|
||||
applit(x1,yy,0,0),applit(x2,yy,0,0),newcomplit(x,y,5,1),outclause();
|
||||
applit(x1,yy,0,0),newcomplit(x,y,5,2),outclause();
|
||||
if (yy>=ymin && yy<=ymax)
|
||||
applit(x2,yy,0,0),newcomplit(x,y,5,2),outclause();
|
||||
have_e[x][y]=tt+1;
|
||||
}
|
||||
}
|
||||
|
||||
@ The |f| subroutine can't be shared quite so often. But we
|
||||
do save a factor of~2, because $x+y$ is always even.
|
||||
|
||||
@<Sub...@>=
|
||||
void f(int x,int y) {
|
||||
register xx=x-1,y1=y,y2=y+1;
|
||||
if (have_f[x][y]!=tt+1) {
|
||||
applit(xx,y1,1,0),newlit(x,y,6,1),outclause();
|
||||
applit(xx,y2,1,0),newlit(x,y,6,1),outclause();
|
||||
applit(xx,y1,1,0),applit(xx,y2,1,0),newlit(x,y,6,2),outclause();
|
||||
applit(xx,y1,0,0),applit(xx,y2,0,0),newcomplit(x,y,6,1),outclause();
|
||||
applit(xx,y1,0,0),newcomplit(x,y,6,2),outclause();
|
||||
if (xx>=xmin && xx<=xmax)
|
||||
applit(xx,y2,0,0),newcomplit(x,y,6,2),outclause();
|
||||
have_f[x][y]=tt+1;
|
||||
}
|
||||
}
|
||||
|
||||
@ The |g| subroutine cleans up the dregs, by somewhat tediously
|
||||
locating the two neighbors that weren't handled by |d|, |e|, or~|f|.
|
||||
No sharing is possible here.
|
||||
|
||||
@<Sub...@>=
|
||||
void g(int x,int y) {
|
||||
register x1,x2,y1,y2;
|
||||
if (x&1) x1=x-1,y1=y,x2=x+1,y2=y^1;
|
||||
else x1=x+1,y1=y,x2=x-1,y2=y-1+((y&1)<<1);
|
||||
applit(x1,y1,1,0),newlit(x,y,7,1),outclause();
|
||||
applit(x2,y2,1,0),newlit(x,y,7,1),outclause();
|
||||
applit(x1,y1,1,0),applit(x2,y2,1,0),newlit(x,y,7,2),outclause();
|
||||
applit(x1,y1,0,0),applit(x2,y2,0,0),newcomplit(x,y,7,1),outclause();
|
||||
applit(x1,y1,0,0),newcomplit(x,y,7,2),outclause();
|
||||
applit(x2,y2,0,0),newcomplit(x,y,7,2),outclause();
|
||||
}
|
||||
|
||||
@ Fortunately the |b| subroutine {\it can\/} be shared (since |x| is always
|
||||
odd), thus saving half of the sixteen clauses generated.
|
||||
|
||||
@<Sub...@>=
|
||||
void b(int x,int y) {
|
||||
register j,k,xx=x,y1=y-(y&2),y2=y+(y&2);
|
||||
if (have_b[x][y]!=tt+1) {
|
||||
d(xx,y1);
|
||||
e(xx,y2);
|
||||
for (j=0;j<3;j++) for (k=0;k<3;k++) if (j+k) {
|
||||
if (j) newcomplit(xx,y1,4,j); /* $\bar d_j$ */
|
||||
if (k) newcomplit(xx,y2,5,k); /* $\bar e_k$ */
|
||||
newlit(x,y,2,j+k); /* $b_{j+k}$ */
|
||||
outclause();
|
||||
if (j) newlit(xx,y1,4,3-j); /* $d_{3-j}$ */
|
||||
if (k) newlit(xx,y2,5,3-k); /* $e_{3-k}$ */
|
||||
newcomplit(x,y,2,5-j-k); /* $\bar b_{5-j-k}$ */
|
||||
outclause();
|
||||
}
|
||||
have_b[x][y]=tt+1;
|
||||
}
|
||||
}
|
||||
|
||||
@ The (unshared) |c| subroutine handles the other four neighbors,
|
||||
by working with |f| and |g| instead of |d| and~|e|.
|
||||
|
||||
If |y=0|, the overlap rules set |y1=-1|, which can be problematic.
|
||||
I've decided to avoid this case by omitting |f| when it is
|
||||
guaranteed to be zero.
|
||||
|
||||
@<Sub...@>=
|
||||
void c(int x,int y) {
|
||||
register j,k,x1,y1;
|
||||
if (x&1) x1=x+2,y1=(y-1)|1;
|
||||
else x1=x,y1=y&-2;
|
||||
g(x,y);
|
||||
if (x1-1<xmin || x1-1>xmax || y1+1<ymin || y1>ymax)
|
||||
@<Set |c| equal to |g|@>@;
|
||||
else {
|
||||
f(x1,y1);
|
||||
for (j=0;j<3;j++) for (k=0;k<3;k++) if (j+k) {
|
||||
if (j) newcomplit(x1,y1,6,j); /* $\bar f_j$ */
|
||||
if (k) newcomplit(x,y,7,k); /* $\bar g_k$ */
|
||||
newlit(x,y,3,j+k); /* $c_{j+k}$ */
|
||||
outclause();
|
||||
if (j) newlit(x1,y1,6,3-j); /* $f_{3-j}$ */
|
||||
if (k) newlit(x,y,7,3-k); /* $g_{3-k}$ */
|
||||
newcomplit(x,y,3,5-j-k); /* $\bar c_{5-j-k}$ */
|
||||
outclause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ @<Set |c| equal to |g|@>=
|
||||
{
|
||||
for (k=1;k<3;k++) {
|
||||
newcomplit(x,y,7,k),newlit(x,y,3,k),outclause(); /* $\bar g_k\lor c_k$ */
|
||||
newlit(x,y,7,k),newcomplit(x,y,3,k),outclause(); /* $g_k\lor\bar c_k$ */
|
||||
}
|
||||
newcomplit(x,y,3,3),outclause(); /* $\bar c_3$ */
|
||||
newcomplit(x,y,3,4),outclause(); /* $\bar c_4$ */
|
||||
}
|
||||
|
||||
@ Totals over all eight neighbors are then deduced by the |a|
|
||||
subroutine.
|
||||
|
||||
@<Sub...@>=
|
||||
void a(int x,int y) {
|
||||
register j,k,xx=x|1;
|
||||
b(xx,y);
|
||||
c(x,y);
|
||||
for (j=0;j<5;j++) for (k=0;k<5;k++) if (j+k>1 && j+k<5) {
|
||||
if (j) newcomplit(xx,y,2,j); /* $\bar b_j$ */
|
||||
if (k) newcomplit(x,y,3,k); /* $\bar c_k$ */
|
||||
newlit(x,y,1,j+k); /* $a_{j+k}$ */
|
||||
outclause();
|
||||
}
|
||||
for (j=0;j<5;j++) for (k=0;k<5;k++) if (j+k>2 && j+k<6 && j*k) {
|
||||
if (j) newlit(xx,y,2,j); /* $b_j$ */
|
||||
if (k) newlit(x,y,3,k); /* $c_k$ */
|
||||
newcomplit(x,y,1,j+k-1); /* $\bar a_{j+k-1}$ */
|
||||
outclause();
|
||||
}
|
||||
}
|
||||
|
||||
@ Finally, as mentioned at the beginning, $z'$ is determined
|
||||
from $z$, $a_2$, $a_3$, and $a_4$.
|
||||
|
||||
I actually generate six clauses, not five, in order to stick to
|
||||
{\mc 3SAT}.
|
||||
|
||||
@<Sub...@>=
|
||||
void zprime(int x,int y) {
|
||||
newcomplit(x,y,1,4),applit(x,y,1,1),outclause(); /* $\bar a_4\bar z'$ */
|
||||
newlit(x,y,1,2),applit(x,y,1,1),outclause(); /* $a_2\bar z'$ */
|
||||
newlit(x,y,1,3),applit(x,y,0,0),applit(x,y,1,1),outclause();
|
||||
/* $a_3z\bar z'$ */
|
||||
newcomplit(x,y,1,3),newlit(x,y,1,4),applit(x,y,0,1),outclause();
|
||||
/* $\bar a_3a_4z'$ */
|
||||
applit(x,y,0,7),newcomplit(x,y,1,2),newlit(x,y,1,4),outclause();
|
||||
/* $x\bar a_2a_4$ */
|
||||
applit(x,y,1,7),applit(x,y,1,0),applit(x,y,0,1),outclause();
|
||||
/* $\bar x\bar zz'$ */
|
||||
}
|
||||
|
||||
@*Index.
|
||||
24
samples/Closure Templates/example.soy
Normal file
24
samples/Closure Templates/example.soy
Normal file
@@ -0,0 +1,24 @@
|
||||
{namespace Exmaple}
|
||||
|
||||
/**
|
||||
* Example
|
||||
*/
|
||||
{template .foo}
|
||||
{@param count: string}
|
||||
{@param? name: int}
|
||||
|
||||
{if isNonnull($name)}
|
||||
<h1>{$name}</h1>
|
||||
{/if}
|
||||
|
||||
<div class="content">
|
||||
{switch count}
|
||||
{case 0}
|
||||
{call Empty.view}
|
||||
{param count: $count /}
|
||||
{/call}
|
||||
{default}
|
||||
<h2>Wow, so many!</h2>
|
||||
{/switch}
|
||||
</div>
|
||||
{/template}
|
||||
98
samples/GLSL/pntriangles.tesc
Normal file
98
samples/GLSL/pntriangles.tesc
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Sascha Willems
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
// PN patch data
|
||||
struct PnPatch
|
||||
{
|
||||
float b210;
|
||||
float b120;
|
||||
float b021;
|
||||
float b012;
|
||||
float b102;
|
||||
float b201;
|
||||
float b111;
|
||||
float n110;
|
||||
float n011;
|
||||
float n101;
|
||||
};
|
||||
|
||||
// tessellation levels
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
float tessLevel;
|
||||
} ubo;
|
||||
|
||||
layout(vertices=3) out;
|
||||
|
||||
layout(location = 0) in vec3 inNormal[];
|
||||
layout(location = 1) in vec2 inUV[];
|
||||
|
||||
layout(location = 0) out vec3 outNormal[3];
|
||||
layout(location = 3) out vec2 outUV[3];
|
||||
layout(location = 6) out PnPatch outPatch[3];
|
||||
|
||||
float wij(int i, int j)
|
||||
{
|
||||
return dot(gl_in[j].gl_Position.xyz - gl_in[i].gl_Position.xyz, inNormal[i]);
|
||||
}
|
||||
|
||||
float vij(int i, int j)
|
||||
{
|
||||
vec3 Pj_minus_Pi = gl_in[j].gl_Position.xyz
|
||||
- gl_in[i].gl_Position.xyz;
|
||||
vec3 Ni_plus_Nj = inNormal[i]+inNormal[j];
|
||||
return 2.0*dot(Pj_minus_Pi, Ni_plus_Nj)/dot(Pj_minus_Pi, Pj_minus_Pi);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// get data
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
outNormal[gl_InvocationID] = inNormal[gl_InvocationID];
|
||||
outUV[gl_InvocationID] = inUV[gl_InvocationID];
|
||||
|
||||
// set base
|
||||
float P0 = gl_in[0].gl_Position[gl_InvocationID];
|
||||
float P1 = gl_in[1].gl_Position[gl_InvocationID];
|
||||
float P2 = gl_in[2].gl_Position[gl_InvocationID];
|
||||
float N0 = inNormal[0][gl_InvocationID];
|
||||
float N1 = inNormal[1][gl_InvocationID];
|
||||
float N2 = inNormal[2][gl_InvocationID];
|
||||
|
||||
// compute control points
|
||||
outPatch[gl_InvocationID].b210 = (2.0*P0 + P1 - wij(0,1)*N0)/3.0;
|
||||
outPatch[gl_InvocationID].b120 = (2.0*P1 + P0 - wij(1,0)*N1)/3.0;
|
||||
outPatch[gl_InvocationID].b021 = (2.0*P1 + P2 - wij(1,2)*N1)/3.0;
|
||||
outPatch[gl_InvocationID].b012 = (2.0*P2 + P1 - wij(2,1)*N2)/3.0;
|
||||
outPatch[gl_InvocationID].b102 = (2.0*P2 + P0 - wij(2,0)*N2)/3.0;
|
||||
outPatch[gl_InvocationID].b201 = (2.0*P0 + P2 - wij(0,2)*N0)/3.0;
|
||||
float E = ( outPatch[gl_InvocationID].b210
|
||||
+ outPatch[gl_InvocationID].b120
|
||||
+ outPatch[gl_InvocationID].b021
|
||||
+ outPatch[gl_InvocationID].b012
|
||||
+ outPatch[gl_InvocationID].b102
|
||||
+ outPatch[gl_InvocationID].b201 ) / 6.0;
|
||||
float V = (P0 + P1 + P2)/3.0;
|
||||
outPatch[gl_InvocationID].b111 = E + (E - V)*0.5;
|
||||
outPatch[gl_InvocationID].n110 = N0+N1-vij(0,1)*(P1-P0);
|
||||
outPatch[gl_InvocationID].n011 = N1+N2-vij(1,2)*(P2-P1);
|
||||
outPatch[gl_InvocationID].n101 = N2+N0-vij(2,0)*(P0-P2);
|
||||
|
||||
// set tess levels
|
||||
gl_TessLevelOuter[gl_InvocationID] = ubo.tessLevel;
|
||||
gl_TessLevelInner[0] = ubo.tessLevel;
|
||||
}
|
||||
103
samples/GLSL/pntriangles.tese
Normal file
103
samples/GLSL/pntriangles.tese
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Sascha Willems
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
// PN patch data
|
||||
struct PnPatch
|
||||
{
|
||||
float b210;
|
||||
float b120;
|
||||
float b021;
|
||||
float b012;
|
||||
float b102;
|
||||
float b201;
|
||||
float b111;
|
||||
float n110;
|
||||
float n011;
|
||||
float n101;
|
||||
};
|
||||
|
||||
layout (binding = 1) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
float tessAlpha;
|
||||
} ubo;
|
||||
|
||||
layout(triangles, fractional_odd_spacing, ccw) in;
|
||||
|
||||
layout(location = 0) in vec3 iNormal[];
|
||||
layout(location = 3) in vec2 iTexCoord[];
|
||||
layout(location = 6) in PnPatch iPnPatch[];
|
||||
|
||||
layout(location = 0) out vec3 oNormal;
|
||||
layout(location = 1) out vec2 oTexCoord;
|
||||
|
||||
#define uvw gl_TessCoord
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 uvwSquared = uvw * uvw;
|
||||
vec3 uvwCubed = uvwSquared * uvw;
|
||||
|
||||
// extract control points
|
||||
vec3 b210 = vec3(iPnPatch[0].b210, iPnPatch[1].b210, iPnPatch[2].b210);
|
||||
vec3 b120 = vec3(iPnPatch[0].b120, iPnPatch[1].b120, iPnPatch[2].b120);
|
||||
vec3 b021 = vec3(iPnPatch[0].b021, iPnPatch[1].b021, iPnPatch[2].b021);
|
||||
vec3 b012 = vec3(iPnPatch[0].b012, iPnPatch[1].b012, iPnPatch[2].b012);
|
||||
vec3 b102 = vec3(iPnPatch[0].b102, iPnPatch[1].b102, iPnPatch[2].b102);
|
||||
vec3 b201 = vec3(iPnPatch[0].b201, iPnPatch[1].b201, iPnPatch[2].b201);
|
||||
vec3 b111 = vec3(iPnPatch[0].b111, iPnPatch[1].b111, iPnPatch[2].b111);
|
||||
|
||||
// extract control normals
|
||||
vec3 n110 = normalize(vec3(iPnPatch[0].n110, iPnPatch[1].n110, iPnPatch[2].n110));
|
||||
vec3 n011 = normalize(vec3(iPnPatch[0].n011, iPnPatch[1].n011, iPnPatch[2].n011));
|
||||
vec3 n101 = normalize(vec3(iPnPatch[0].n101, iPnPatch[1].n101, iPnPatch[2].n101));
|
||||
|
||||
// compute texcoords
|
||||
oTexCoord = gl_TessCoord[2]*iTexCoord[0] + gl_TessCoord[0]*iTexCoord[1] + gl_TessCoord[1]*iTexCoord[2];
|
||||
|
||||
// normal
|
||||
// Barycentric normal
|
||||
vec3 barNormal = gl_TessCoord[2]*iNormal[0] + gl_TessCoord[0]*iNormal[1] + gl_TessCoord[1]*iNormal[2];
|
||||
vec3 pnNormal = iNormal[0]*uvwSquared[2] + iNormal[1]*uvwSquared[0] + iNormal[2]*uvwSquared[1]
|
||||
+ n110*uvw[2]*uvw[0] + n011*uvw[0]*uvw[1]+ n101*uvw[2]*uvw[1];
|
||||
oNormal = ubo.tessAlpha*pnNormal + (1.0-ubo.tessAlpha) * barNormal;
|
||||
|
||||
// compute interpolated pos
|
||||
vec3 barPos = gl_TessCoord[2]*gl_in[0].gl_Position.xyz
|
||||
+ gl_TessCoord[0]*gl_in[1].gl_Position.xyz
|
||||
+ gl_TessCoord[1]*gl_in[2].gl_Position.xyz;
|
||||
|
||||
// save some computations
|
||||
uvwSquared *= 3.0;
|
||||
|
||||
// compute PN position
|
||||
vec3 pnPos = gl_in[0].gl_Position.xyz*uvwCubed[2]
|
||||
+ gl_in[1].gl_Position.xyz*uvwCubed[0]
|
||||
+ gl_in[2].gl_Position.xyz*uvwCubed[1]
|
||||
+ b210*uvwSquared[2]*uvw[0]
|
||||
+ b120*uvwSquared[0]*uvw[2]
|
||||
+ b201*uvwSquared[2]*uvw[1]
|
||||
+ b021*uvwSquared[0]*uvw[1]
|
||||
+ b102*uvwSquared[1]*uvw[2]
|
||||
+ b012*uvwSquared[1]*uvw[0]
|
||||
+ b111*6.0*uvw[0]*uvw[1]*uvw[2];
|
||||
|
||||
// final position and normal
|
||||
vec3 finalPos = (1.0-ubo.tessAlpha)*barPos + ubo.tessAlpha*pnPos;
|
||||
gl_Position = ubo.projection * ubo.model * vec4(finalPos,1.0);
|
||||
}
|
||||
34
samples/Pep8/div.pep
Normal file
34
samples/Pep8/div.pep
Normal file
@@ -0,0 +1,34 @@
|
||||
main: SUBSP 8, i
|
||||
DECI 0, s
|
||||
DECI 2, s
|
||||
CALL div
|
||||
DECO 4, s
|
||||
CHARO '\n', i
|
||||
DECO 6, s
|
||||
CHARO '\n', i
|
||||
STOP
|
||||
|
||||
; Divides two numbers following the euclidian method
|
||||
;
|
||||
; Parameters:
|
||||
; SP + 2: Dividend
|
||||
; SP + 4: Divider
|
||||
; Returns:
|
||||
; SP + 6: Quotient
|
||||
; SP + 8: Remain
|
||||
div: LDX 0, i
|
||||
LDA dividend, s
|
||||
divlp: CPA divider, s
|
||||
BRLT divout
|
||||
ADDX 1, i
|
||||
SUBA divider, s
|
||||
BR divlp
|
||||
divout: STX quot, s
|
||||
STA rem, s
|
||||
RET0
|
||||
dividend: .EQUATE 2
|
||||
divider: .EQUATE 4
|
||||
quot: .EQUATE 6
|
||||
rem: .EQUATE 8
|
||||
|
||||
.END
|
||||
23
samples/Pep8/flag.pep
Normal file
23
samples/Pep8/flag.pep
Normal file
@@ -0,0 +1,23 @@
|
||||
_start: LDA 0,i
|
||||
LDX 0,i
|
||||
LDA 20, i
|
||||
ADDA 51, i
|
||||
CPA 0,i
|
||||
BRLT s3
|
||||
BR s4
|
||||
s1: LDBYTEA s3, x
|
||||
NOTA
|
||||
STBYTEA s3, x
|
||||
ADDX 1,i
|
||||
CPX 12, i
|
||||
BRNE s1
|
||||
s2: STOP
|
||||
s4: LDA 31, d
|
||||
LDX 50, d
|
||||
RET0
|
||||
STOP
|
||||
s3: CPX -27746, d
|
||||
ANDX -8241, i
|
||||
SUBA -12337, sxf
|
||||
LDX -12289, sx
|
||||
.END
|
||||
675
samples/Pep8/linked.pep
Normal file
675
samples/Pep8/linked.pep
Normal file
@@ -0,0 +1,675 @@
|
||||
; Linked list of integers API
|
||||
;
|
||||
; Contains the basis of the structure and a
|
||||
; variety of available functions to call on it.
|
||||
;
|
||||
; Calling conventions:
|
||||
;
|
||||
; - When the number of arguments is <= 2, the fastcall convention will be used:
|
||||
; Arguments will be passed by registers, no assumption is made concerning the
|
||||
; state of the registers during execution, they will need to be saved.
|
||||
;
|
||||
; - When the number of arguments exceeds 2, the cdecl convention will be used:
|
||||
; Arguments will be passed on the stack, no assumption is made concerning the
|
||||
; state of the registers during execution, they will need to be saved.
|
||||
|
||||
; Simple test program, do no include when using the library
|
||||
main: SUBSP 4, i
|
||||
DECI mnelmt, s
|
||||
CALL newlst
|
||||
LDX mnlst, s
|
||||
CALL lstgetst
|
||||
LDX mnlst, s
|
||||
CALL lstsetst
|
||||
LDX mnlst, s
|
||||
CALL lstgetst
|
||||
LDX mnlst, s
|
||||
CALL shftest
|
||||
LDX mnlst, s
|
||||
CALL ushftest
|
||||
LDX mnlst, s
|
||||
CALL shftest
|
||||
ADDSP 4, i
|
||||
STOP
|
||||
; Pointer to the list
|
||||
mnlst: .EQUATE 0
|
||||
; Element read
|
||||
mnelmt: .EQUATE 2
|
||||
|
||||
; TESTS
|
||||
|
||||
; Simple test for the get operation
|
||||
; Gets the first element of the list and prints it
|
||||
;
|
||||
; REQUIRES: Non-empty list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
lstgetst: SUBSP 2, i
|
||||
LDA 0, i
|
||||
CALL lstget
|
||||
STA 0, s
|
||||
DECO 0, s
|
||||
CHARO '\n', i
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
|
||||
; Test for the set operation
|
||||
; Sets the first element of the list to a given value
|
||||
; The value is read from stdin
|
||||
;
|
||||
; REQUIRES: Non-empty list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
lstsetst: SUBSP 6, i
|
||||
STX 0, s
|
||||
DECI 4, s
|
||||
LDA 0, i
|
||||
STA 2, s
|
||||
CALL lstset
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
|
||||
; Tests shift operation on a list
|
||||
; Gets the last element of the list and prints it
|
||||
;
|
||||
; REQUIRES: Non-empty list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
shftest: SUBSP 2, i
|
||||
CALL lstshft
|
||||
STA 0, s
|
||||
DECO 0, s
|
||||
CHARO '\n', i
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
|
||||
; Tests unshift operation on a list
|
||||
; Unshifts a new element read from keyboard
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
ushftest: SUBSP 2, i
|
||||
DECI 0, s
|
||||
LDA 0, s
|
||||
CALL lstunshf
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
|
||||
; LIBRARY
|
||||
|
||||
; Creates a new list with `element` as head
|
||||
;
|
||||
; Parameters:
|
||||
; SP + 4: Element
|
||||
;
|
||||
; Returns:
|
||||
; SP + 2: Pointer to the list
|
||||
newlst: LDA lstlen, i
|
||||
CALL new
|
||||
STX 2, s
|
||||
CALL newnode
|
||||
SUBSP 2, i
|
||||
STX 0, s
|
||||
LDX nodeelmt, i
|
||||
LDA 6, s
|
||||
STA 0, sxf
|
||||
LDA 0, s
|
||||
LDX lsthead, i
|
||||
STA 4, sxf
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
|
||||
; Gets a node at specified index in a list
|
||||
;
|
||||
; Parameters:
|
||||
; - A: Index
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; - A: Error code (0 if no error was produced)
|
||||
; - X: Pointer to the node
|
||||
;
|
||||
; Errors:
|
||||
; -1: Index < 0
|
||||
; -2: Index >= list.length
|
||||
nodeat: SUBSP 10, i
|
||||
STA ndaind, s
|
||||
STX ndalst, s
|
||||
LDX lsthead, i
|
||||
LDA ndalst, sxf
|
||||
STA ndanode, s
|
||||
LDA ndaind, s
|
||||
CPA 0, i
|
||||
LDA 0, i
|
||||
STA ndacurri, s
|
||||
BRGE ndagez
|
||||
LDA -1, i
|
||||
ADDSP 10, i
|
||||
RET0
|
||||
ndagez: LDX ndalst, s
|
||||
CALL listlen
|
||||
STA ndalstln, s
|
||||
LDA ndaind, s
|
||||
CPA ndalstln, s
|
||||
BRLT ndalp
|
||||
LDA -2, i
|
||||
ADDSP 10, i
|
||||
RET0
|
||||
ndalp: LDA ndacurri, s
|
||||
CPA ndaind, s
|
||||
BREQ ndaout
|
||||
LDX nodenxt, i
|
||||
LDA ndanode, sxf
|
||||
STA ndanode, s
|
||||
LDA ndacurri, s
|
||||
ADDA 1, i
|
||||
STA ndacurri, s
|
||||
BR ndalp
|
||||
ndaout: LDX ndanode, s
|
||||
LDA 0, i
|
||||
ADDSP 10, i
|
||||
RET0
|
||||
ndaind: .EQUATE 0
|
||||
ndanode: .EQUATE 2
|
||||
ndalst: .EQUATE 4
|
||||
ndalstln: .EQUATE 6
|
||||
ndacurri: .EQUATE 8
|
||||
|
||||
; Length of the list passed as a parameter
|
||||
;
|
||||
; Parameters:
|
||||
; - X: List
|
||||
;
|
||||
; Returns:
|
||||
; - A: Length
|
||||
listlen: SUBSP 4, i
|
||||
STX lenode, s
|
||||
LDX lenode, sf
|
||||
STX lenode, s
|
||||
LDA 0, i
|
||||
STA lencpt, s
|
||||
llenlp: LDA lenode, s
|
||||
CPA 0, i
|
||||
BREQ lenout
|
||||
LDA lencpt, s
|
||||
ADDA 1, i
|
||||
STA lencpt, s
|
||||
LDX nodenxt, i
|
||||
LDA lenode, sxf
|
||||
STA lenode, s
|
||||
BR llenlp
|
||||
lenout: LDA lencpt, s
|
||||
ADDSP 4, i
|
||||
RET0
|
||||
lenode: .EQUATE 0
|
||||
lencpt: .EQUATE 2
|
||||
|
||||
; Gets an element in a list at a specified index
|
||||
;
|
||||
; Parameters:
|
||||
; - A: Index
|
||||
; - X: Address of the list
|
||||
;
|
||||
; Returns:
|
||||
; - A: Element value
|
||||
;
|
||||
; Error:
|
||||
; If out of bounds, prints an error message and stops the program
|
||||
lstget: SUBSP 2, i
|
||||
STA 0, s
|
||||
CALL nodeat
|
||||
CPA 0, i
|
||||
BRNE getoob
|
||||
LDA 0, x
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
; Out of bounds
|
||||
getoob: STRO getstrob, d
|
||||
DECO 0, s
|
||||
CHARO '\n', i
|
||||
STOP
|
||||
; String for out of bounds error
|
||||
getstrob: .ASCII "Invalid index on get, index = \x00"
|
||||
|
||||
; Sets an element in a list at a specified index to a new value
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Pointer to the list
|
||||
; - SP + 4: Index
|
||||
; - SP + 6: Element
|
||||
;
|
||||
; Returns:
|
||||
; - A: 0 if all went well, an error code otherwise (analogous to the error codes in nodeat)
|
||||
lstset: CHARO '\n', i
|
||||
DECO lstsetlp, s
|
||||
CHARO ' ', i
|
||||
DECO lstsetin, s
|
||||
CHARO ' ', i
|
||||
DECO lstsetel, s
|
||||
CHARO '\n', i
|
||||
SUBSP 2, i
|
||||
LDX lstsetlp, s
|
||||
LDA lstsetin, s
|
||||
CALL nodeat
|
||||
CPA 0, i
|
||||
BRNE lstsetrt
|
||||
STX lstsetnp, s
|
||||
LDA lstsetel, s
|
||||
LDX nodeelmt, i
|
||||
STA lstsetnp, sxf
|
||||
LDA 0, i
|
||||
lstsetrt: ADDSP 2, i
|
||||
RET0
|
||||
; Pointer to the list
|
||||
lstsetlp: .EQUATE 4
|
||||
; Element to set the value at
|
||||
lstsetel: .EQUATE 8
|
||||
; Index of the node
|
||||
lstsetin: .EQUATE 6
|
||||
; Pointer to the node
|
||||
lstsetnp: .EQUATE 0
|
||||
|
||||
; Removes the first element of the list in parameter and returns its value
|
||||
;
|
||||
; REQUIRES: Non-empty list
|
||||
;
|
||||
; Parameters:
|
||||
; ⁻ X: Pointer to the list
|
||||
;
|
||||
; Returns :
|
||||
; - A: Element removed
|
||||
lstshft: SUBSP 8, i
|
||||
STX lshflp, s
|
||||
LDX lsthead, i
|
||||
LDA lshflp, sxf
|
||||
CPA 0, i
|
||||
BREQ shfterr
|
||||
STA lshfohd, s
|
||||
LDX nodenxt, i
|
||||
LDA lshfohd, sxf
|
||||
STA lshfnhd, s
|
||||
LDX lsthead, i
|
||||
STA lshflp, sxf
|
||||
LDX nodeelmt, i
|
||||
LDA lshfohd, sxf
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
shfterr: STRO shfterrm, d
|
||||
STOP
|
||||
; Pointer to the list
|
||||
lshflp: .EQUATE 0
|
||||
; Pointer to the old head
|
||||
lshfohd: .EQUATE 2
|
||||
; Old head's element
|
||||
lshfhdel: .EQUATE 4
|
||||
; Pointer to the new head
|
||||
lshfnhd: .EQUATE 6
|
||||
; Error message on shift
|
||||
shfterrm: .ASCII "Cannot do shift on empty list.\n\x00"
|
||||
|
||||
; Inserts a new element at the beginning of a list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
; - A: Element to add to the list
|
||||
;
|
||||
; Returns:
|
||||
; - A: Error code, 0 if all right, a code otherwise
|
||||
lstunshf: SUBSP 8, i
|
||||
STA lunshelm, s
|
||||
STX lunslp, s
|
||||
CALL newnode
|
||||
STX lunsnhd, s
|
||||
LDX lsthead, i
|
||||
LDA lunslp, sxf
|
||||
STA lunsohd, s
|
||||
LDX nodenxt, i
|
||||
LDA lunsohd, s
|
||||
STA lunsnhd, sxf
|
||||
LDA lunshelm, s
|
||||
LDX nodeelmt, i
|
||||
STA lunsohd, sxf
|
||||
LDX lsthead, i
|
||||
LDA lunsnhd, s
|
||||
STA lunslp, sxf
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
; Pointer to the list
|
||||
lunslp: .EQUATE 0
|
||||
; Pointer to the old head
|
||||
lunsohd: .EQUATE 2
|
||||
; Pointer to the new head
|
||||
lunsnhd: .EQUATE 4
|
||||
; Element to add
|
||||
lunshelm: .EQUATE 6
|
||||
|
||||
; Finds whether or not an element is present in a list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
; - A: Element to be found
|
||||
;
|
||||
; Returns:
|
||||
; - A: 0 if element was not found, 1 if it was
|
||||
lstfnd: SUBSP 6, i
|
||||
STX lstfndlp, s
|
||||
STA lstfndel, s
|
||||
LDX lsthead, i
|
||||
LDA lstfndlp, sxf
|
||||
STA lstfndnd, s
|
||||
fndloop: CPA 0, i
|
||||
BREQ notfnd
|
||||
LDX nodeelmt, i
|
||||
LDA lstfndnd, sxf
|
||||
CPA lstfndel, s
|
||||
BREQ found
|
||||
LDX nodenxt, i
|
||||
LDA lstfndnd, sxf
|
||||
STA lstfndnd, s
|
||||
BR fndloop
|
||||
notfnd: LDA 0, i
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
found: LDA 1, i
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
; Pointer to the list
|
||||
lstfndlp: .EQUATE 0
|
||||
; Element to search
|
||||
lstfndel: .EQUATE 2
|
||||
; Current node
|
||||
lstfndnd: .EQUATE 4
|
||||
|
||||
; Pushes a new element at the end of the list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
; - A: Element to push
|
||||
;
|
||||
; Returns:
|
||||
; - A: 0 if all went well, an error code otherwise
|
||||
lstpsh: SUBSP 8, i
|
||||
STX lpshlp, s
|
||||
STA lpshel, s
|
||||
CALL newnode
|
||||
STX lpshnd, s
|
||||
LDX lpshlp, s
|
||||
CALL listlen
|
||||
CPA 0, i
|
||||
BREQ lpshshft
|
||||
SUBA 1, i
|
||||
LDX lpshlp, s
|
||||
CALL nodeat
|
||||
STX lpshlnd, s
|
||||
LDX nodenxt, i
|
||||
LDA lpshnd, s
|
||||
STA lpshlnd, sxf
|
||||
LDA lpshel, s
|
||||
LDX nodeelmt, i
|
||||
STA lpshnd, sxf
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
lpshshft: LDX lpshlp, s
|
||||
LDA lpshel, s
|
||||
CALL lstunshf
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
; Pointer to the list
|
||||
lpshlp: .EQUATE 0
|
||||
; Element to add to the list
|
||||
lpshel: .EQUATE 2
|
||||
; Node to add to the list
|
||||
lpshnd: .EQUATE 4
|
||||
; Node to append
|
||||
lpshlnd: .EQUATE 6
|
||||
|
||||
; Pops the last element of a list
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
;
|
||||
; Returns:
|
||||
; - A: Element removed from the list
|
||||
lstpop: SUBSP 6, i
|
||||
STX lpoplp, s
|
||||
CALL listlen
|
||||
CPA 0, i
|
||||
BRNE poperrem
|
||||
CPA 1, i
|
||||
BREQ popshft
|
||||
SUBA 2, i
|
||||
LDX lpoplp, s
|
||||
CALL nodeat
|
||||
STX lpopndpr, s
|
||||
LDX nodenxt, i
|
||||
LDA lpopndpr, sxf
|
||||
LDA 0, i
|
||||
LDX nodenxt, i
|
||||
STA lpopndpr, sxf
|
||||
STA lpoplnd, s
|
||||
LDX nodeelmt, i
|
||||
LDA lpoplnd, s
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
poperrem: STRO poperrsm, d
|
||||
STOP
|
||||
popshft: LDX lpoplp, s
|
||||
CALL lstshft
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
; Pointer to the list
|
||||
lpoplp: .EQUATE 0
|
||||
; Node to remove
|
||||
lpoplnd: .EQUATE 2
|
||||
;New last node
|
||||
lpopndpr: .EQUATE 4
|
||||
; Message to print when popping an empty list
|
||||
poperrsm: .ASCII "Error: cannot pop an empty list.\n\x00"
|
||||
|
||||
; Inserts an element in a list at a given position
|
||||
;
|
||||
; REQUIRES: Non-empty list
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Pointer to the list
|
||||
; - SP + 4: Index to insert at
|
||||
; - SP + 6: Element to add
|
||||
;
|
||||
; Returns:
|
||||
; - A: Error code: 0 if all went well, -1 if index < 0, -2 if index > list.length
|
||||
lstinsat: SUBSP 6, i
|
||||
LDA lstinsid, s
|
||||
CPA 0, i
|
||||
BRLT lstinslz
|
||||
BREQ lstinush
|
||||
LDX lstinslp, s
|
||||
CALL listlen
|
||||
CPA lstinsel, s
|
||||
BRLT lstinsgl
|
||||
BREQ lstinpsh
|
||||
LDX lstinslp, s
|
||||
LDA lstinsel, s
|
||||
SUBA 1, i
|
||||
CALL nodeat
|
||||
STX lstinsnd, s
|
||||
LDX nodenxt, i
|
||||
LDA lstinsnd, sxf
|
||||
STA lstinscx, s
|
||||
CALL newnode
|
||||
STX lstinscn, s
|
||||
LDX nodeelmt, i
|
||||
LDA lstinsel, s
|
||||
STA lstinscn, sxf
|
||||
LDX nodenxt, i
|
||||
LDA lstinscx, s
|
||||
STA lstinscn, sxf
|
||||
LDA lstinscn, s
|
||||
LDX nodenxt, i
|
||||
STA lstinsnd, sxf
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
lstinush: LDX lstinslp, s
|
||||
LDA lstinsel, s
|
||||
CALL lstunshf
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
lstinpsh: LDX lstinslp, s
|
||||
LDA lstinsel, s
|
||||
CALL lstpsh
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
; Insert with index < 0
|
||||
lstinslz: LDA -1, i
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
; Insert with index > list.length
|
||||
lstinsgl: LDA -2, i
|
||||
ADDSP 6, i
|
||||
RET0
|
||||
; List pointer
|
||||
lstinslp: .EQUATE 8
|
||||
; Index of the newly created node
|
||||
lstinsid: .EQUATE 10
|
||||
; Element to add
|
||||
lstinsel: .EQUATE 12
|
||||
; Node to change the pointer to the next
|
||||
lstinsnd: .EQUATE 0
|
||||
; Node to insert
|
||||
lstinscn: .EQUATE 2
|
||||
; Pointer to the node after the created one (might be null)
|
||||
lstinscx: .EQUATE 4
|
||||
|
||||
; Removes a node at a given index in a list,
|
||||
; returns the element previously contained
|
||||
;
|
||||
; Parameters:
|
||||
; - X: Pointer to the list
|
||||
; - A: Index of the element
|
||||
;
|
||||
; Returns:
|
||||
; - A: Element removed
|
||||
;
|
||||
; Error:
|
||||
; In case of error, the program aborts with an error message
|
||||
lstremat: SUBSP 8, i
|
||||
STX lremlp, s
|
||||
STA lremid, s
|
||||
CPA 0, i
|
||||
BRLT lstremob
|
||||
BREQ lstremz
|
||||
CALL listlen
|
||||
CPA lremid, s
|
||||
BRGE lstremob
|
||||
SUBA 1, i
|
||||
CPA lremid, s
|
||||
BREQ lrempop
|
||||
LDA lremid, s
|
||||
LDX lremlp, s
|
||||
CALL nodeat
|
||||
STX lremnd, s
|
||||
LDA lremid, s
|
||||
SUBA 1, i
|
||||
LDX lremlp, s
|
||||
CALL nodeat
|
||||
STX lrempnd, s
|
||||
LDX nodenxt, i
|
||||
LDA lremnd, sxf
|
||||
STA lrempnd, sxf
|
||||
LDX nodeelmt, i
|
||||
LDA lremnd, sxf
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
lstremz: LDX lremlp, s
|
||||
CALL lstshft
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
lrempop: LDX lremlp, s
|
||||
CALL lstpop
|
||||
ADDSP 8, i
|
||||
RET0
|
||||
lstremob: STRO lremobst, d
|
||||
DECO lremid, s
|
||||
CHARO '\n', i
|
||||
STOP
|
||||
; Pointer to the list
|
||||
lremlp: .EQUATE 0
|
||||
; Index to remove an element at
|
||||
lremid: .EQUATE 2
|
||||
; Pointer to the node before the removed element
|
||||
lrempnd: .EQUATE 4
|
||||
; Pointer to the node to remove
|
||||
lremnd: .EQUATE 6
|
||||
; Error out of bounds string for remove_at
|
||||
lremobst: .ASCII "Error: Out of bounds in remove_at, index = \x00"
|
||||
|
||||
; Creates a new node from scratch
|
||||
; Sets its content to 0/NULL
|
||||
;
|
||||
; Parameters:
|
||||
; void
|
||||
;
|
||||
; Return:
|
||||
; - X: Address of the node
|
||||
newnode: LDA nodeln, i
|
||||
SUBSP 2, i
|
||||
CALL new
|
||||
STX 0, s
|
||||
LDA 0, i
|
||||
LDX nodenxt, i
|
||||
STA 0, sxf
|
||||
LDX nodeelmt, i
|
||||
STA 0, sxf
|
||||
LDX 0, s
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
|
||||
; Allocates a new structure in the heap
|
||||
;
|
||||
; Parameters:
|
||||
; - A: Length of the structure to allocate (bytes)
|
||||
;
|
||||
; Returns:
|
||||
; - X: Address of the allocated structure
|
||||
new: ADDA hpptr, d
|
||||
LDX hpptr, d
|
||||
STA hpptr, d
|
||||
RET0
|
||||
|
||||
; Node in a linked list
|
||||
;
|
||||
; Contains two fields:
|
||||
; - Element: Offset 0
|
||||
; - Next: Offset 2
|
||||
;
|
||||
nodeln: .EQUATE 4
|
||||
nodeelmt: .EQUATE 0
|
||||
nodenxt: .EQUATE 2
|
||||
|
||||
; Linked list capsule
|
||||
;
|
||||
; Contains one field:
|
||||
; - Head: Offset 0
|
||||
;
|
||||
lstlen: .EQUATE 2
|
||||
lsthead: .EQUATE 0
|
||||
|
||||
; Pointer to the next available byte on the heap
|
||||
hpptr: .ADDRSS heap
|
||||
; Start of the heap
|
||||
heap: .BLOCK 1
|
||||
.END
|
||||
434
samples/Pep8/msq.pep
Normal file
434
samples/Pep8/msq.pep
Normal file
@@ -0,0 +1,434 @@
|
||||
; Reads a square from stdin, then computes whether it is a magic square or not.
|
||||
;
|
||||
; A Magic Square is a square following a specific set of rules, namely:
|
||||
; - The sum of each row must be the same as the sum of the diagonal
|
||||
; - The sum of the anti-diagonal must be the same as the sum of the diagonal
|
||||
; - The sum of each column must be the same as the sum of the diagonal
|
||||
;
|
||||
; If any column, row, or anti-diagonal does not follow the aformented rules,
|
||||
; the program will output its number to stdout.
|
||||
;
|
||||
; Columns are identified by a negative digit, ranging from -1 to -n
|
||||
; The anti-diagonal is identified by the number 0.
|
||||
; Finally, rows are identified by a positive integer, ranging from 1 to n.
|
||||
;
|
||||
; Formatting:
|
||||
; First a number `n` is read from Stdin, it will determine the size of the square
|
||||
; Then, enter the data for the square, `n` entries will be read
|
||||
; The data is sequentially added to the square in memory, from the upper-left corner
|
||||
; to the lower-right corner, in a zig-zag pattern
|
||||
;
|
||||
; Example:
|
||||
; 3
|
||||
; 4 9 3
|
||||
; 3 5 7
|
||||
; 8 1 6
|
||||
;
|
||||
; Limitation: Since there is no dynamic allocation, the size
|
||||
; of the square is capped at a maximum of 32*32.
|
||||
; Any size lower than 1 or higher than 32 will produce
|
||||
; an error and the termination of the program.
|
||||
|
||||
;_start
|
||||
DECI sidelen, d
|
||||
LDA sidelen, d
|
||||
CPA 1, i
|
||||
BRLT sderror
|
||||
CPA 32, i
|
||||
BRGT sderror
|
||||
LDX sidelen, d
|
||||
CALL mult
|
||||
STA sqlen, d
|
||||
CALL fillsq
|
||||
LDA sidelen, d
|
||||
LDX square, i
|
||||
CALL diagsum
|
||||
STA dgsm, d
|
||||
CALL colsums
|
||||
LDA sidelen, d
|
||||
LDX square, i
|
||||
CALL cdiagsum
|
||||
CPA dgsm, d
|
||||
BREQ cnt
|
||||
DECO 0, i
|
||||
CHARO '\n', i
|
||||
cnt: STA cdsm, d
|
||||
CALL rowsums
|
||||
STOP
|
||||
el: .BLOCK 2
|
||||
; Length of a side of the square
|
||||
sidelen: .WORD 0
|
||||
; Total length of the square
|
||||
sqlen: .BLOCK 2
|
||||
; 32 * 32 square of integers
|
||||
square: .BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 255
|
||||
.BLOCK 8
|
||||
|
||||
; Prints an error and terminates the program
|
||||
sderror: STRO stderr, d
|
||||
STOP
|
||||
|
||||
; Parameters: A: Size of a side of the square
|
||||
; X: Base address of the square
|
||||
; cscolid: Identifier of the column (0-based)
|
||||
|
||||
; Computes the sum of each column
|
||||
; If the sum is not the same as dgsm, its index will be printed (in negative form)
|
||||
;
|
||||
; Parameters: A: Size of a side of the square
|
||||
; X: Address of the square
|
||||
;
|
||||
; Return: void
|
||||
colsums:STA clsmsqsz, d
|
||||
STX clsmsqad, d
|
||||
SUBA 1, i
|
||||
STA clsmyp, d
|
||||
clssmlp:CPA 0 ,i
|
||||
BRLT clsmout
|
||||
STA cscolid, d
|
||||
LDA clsmsqsz, d
|
||||
LDX clsmsqsz, d
|
||||
CALL colsum
|
||||
CPA dgsm, d
|
||||
BREQ clsdecpt
|
||||
LDX clsmyp, d
|
||||
NEGX
|
||||
STX clsmyp, d
|
||||
DECO clsmyp, d
|
||||
CHARO '\n', i
|
||||
LDX clsmyp, d
|
||||
NEGX
|
||||
STX clsmyp, d
|
||||
clsdecpt: LDA clsmyp, d
|
||||
SUBA 1, i
|
||||
STA clsmyp, d
|
||||
BR clssmlp
|
||||
clsmout: RET0
|
||||
clsmsqad: .BLOCK 2
|
||||
clsmsqsz: .BLOCK 2
|
||||
clsmyp_: .BLOCK 2
|
||||
|
||||
; Compute the sum of each row
|
||||
; Prints its index if the value does not match dgsum
|
||||
;
|
||||
; Parameters: A: Size of a side of the square
|
||||
; X: Address of the square
|
||||
;
|
||||
; Returns: void
|
||||
rowsums: STA maxrows, d
|
||||
STX rowssqad, d
|
||||
LDA 0, i
|
||||
STA tmprwsm, d
|
||||
STA rowid, d
|
||||
rwsmslp: CPA maxrows, d
|
||||
BRGE rwsmsout
|
||||
STA rwxpos, d
|
||||
LDA maxrows, d
|
||||
LDX rowssqad, d
|
||||
CALL rowsum
|
||||
CPA dgsm, d
|
||||
STA tmprwsm, d
|
||||
BREQ rwinccpt
|
||||
DECO rowid, d
|
||||
CHARO '\n', i
|
||||
rwinccpt: LDA rowid, d
|
||||
ADDA 1, i
|
||||
STA rowid, d
|
||||
BR rwsmslp
|
||||
rwsmsout: RET0
|
||||
; Number of rows to compute
|
||||
maxrows: .BLOCK 2
|
||||
; Square address
|
||||
rowssqad: .BLOCK 2
|
||||
; Current rowid
|
||||
rowid: .BLOCK 2
|
||||
; Current rowsum
|
||||
tmprwsm: .BLOCK 2
|
||||
|
||||
; Gets an element at the indexes given as parameter
|
||||
; The square is supposed to contain only integers
|
||||
; No check will be made on the correctness of the indexes
|
||||
;
|
||||
; Parameters: A: Size of a side of the square (in elements)
|
||||
; X: Base address of the square
|
||||
; xpos: Position in X for the element (0-indexed)
|
||||
; ypos: Position in Y for the element (0-indexed)
|
||||
;
|
||||
; Return: A will contain the element
|
||||
;
|
||||
; Side-effects: Registers A and X will neither be saved nor restored upon call
|
||||
; ypos will be altered
|
||||
elemat: STX elsqaddr, d
|
||||
ASLA
|
||||
LDX xpos, d
|
||||
CALL mult
|
||||
STA xpos, d
|
||||
LDX ypos, d
|
||||
ASLX
|
||||
STX ypos, d
|
||||
ADDA ypos, d
|
||||
ADDA elsqaddr, d
|
||||
STA elsqaddr, d
|
||||
LDX elsqaddr, d
|
||||
LDA 0, x
|
||||
RET0
|
||||
; X-index in square (in elements)
|
||||
xpos: .BLOCK 2
|
||||
; Y-index in square (in elements)
|
||||
ypos: .BLOCK 2
|
||||
; Address to fetch elements at
|
||||
elsqaddr: .BLOCK 2
|
||||
|
||||
; Fills the square with input from the user
|
||||
;
|
||||
; Pass via register A the number of inputs to be read
|
||||
fillsq: LDX 0, i
|
||||
filloop: SUBA 1, i
|
||||
CPA 0, i
|
||||
BRLT fillout
|
||||
DECI square, x
|
||||
ADDX 2, i
|
||||
BR filloop
|
||||
fillout: RET0
|
||||
|
||||
; Computes the sum of the digits of a column
|
||||
; The square is supposed to contain integers only
|
||||
;
|
||||
; Parameters: A: Size of a side of the square
|
||||
; X: Base address of the square
|
||||
; cscolid: Identifier of the column (0-based)
|
||||
;
|
||||
; Return: A: Sum of the digits of the column
|
||||
colsum: STA csclsqsz, d
|
||||
STX csclsqad, d
|
||||
LDA 0, i
|
||||
STA csclsum, d
|
||||
STA csclxpos, d
|
||||
clsmloop: CPA csclsqsz, d
|
||||
BRGE colout
|
||||
LDA cscolid, d
|
||||
STA ypos, d
|
||||
LDA csclxpos, d
|
||||
STA xpos, d
|
||||
LDA csclsqsz, d
|
||||
LDX csclsqad, d
|
||||
CALL elemat
|
||||
ADDA csclsum, d
|
||||
STA csclsum, d
|
||||
LDA csclxpos, d
|
||||
ADDA 1, i
|
||||
STA csclxpos, d
|
||||
BR clsmloop
|
||||
colout: LDA csclsum, d
|
||||
RET0
|
||||
; Identifier of the column which sum is to be computed
|
||||
cscolid: .BLOCK 2
|
||||
; Temporary for x position
|
||||
csclxpos: .BLOCK 2
|
||||
; Base address of the square
|
||||
csclsqad: .BLOCK 2
|
||||
; Size of a side of the square
|
||||
csclsqsz: .BLOCK 2
|
||||
; Sum of the column
|
||||
csclsum: .BLOCK 2
|
||||
|
||||
; Computes the sum of the digits of a row
|
||||
; The square is supposed to contain integers only
|
||||
;
|
||||
; Parameters: A: Size of a side of the square
|
||||
; X: Base address of the square
|
||||
; rwxpos: Row index (0-based)
|
||||
;
|
||||
; Returns: A: Sum of the digits of the row
|
||||
rowsum: STA rwsqsz, d
|
||||
STX rwbsqadr, d
|
||||
LDA 0,i
|
||||
STA rwsum, d
|
||||
STA rwypos, d
|
||||
rwsumlp: LDA rwypos, d
|
||||
CPA rwsqsz, d
|
||||
BRGE rwsumout
|
||||
STA ypos, d
|
||||
LDA rwxpos, d
|
||||
STA xpos, d
|
||||
LDA rwsqsz, d
|
||||
LDX rwbsqadr, d
|
||||
CALL elemat
|
||||
ADDA rwsum, d
|
||||
STA rwsum, d
|
||||
LDA rwypos, d
|
||||
ADDA 1, i
|
||||
STA rwypos, d
|
||||
BR rwsumlp
|
||||
rwsumout: LDA rwsum, d
|
||||
RET0
|
||||
; Square size (in elements)
|
||||
rwsqsz: .BLOCK 2
|
||||
; Square base address
|
||||
rwbsqadr: .BLOCK 2
|
||||
; Position of the row to compute
|
||||
rwxpos: .BLOCK 2
|
||||
; Current column visited
|
||||
rwypos: .BLOCK 2
|
||||
; Sum of the row
|
||||
rwsum: .BLOCK 2
|
||||
|
||||
; Computes the sum for the antidiagonal of a square
|
||||
; The square is supposed to contain integers only
|
||||
;
|
||||
; Parameters: A: Size of a side of the square (elements)
|
||||
; X: Base address of the square
|
||||
;
|
||||
; Returns: A: Sum of the antidiagonal
|
||||
cdiagsum: STA cdsqsz, d
|
||||
SUBA 1,i
|
||||
STA cdtmpy, d
|
||||
LDA 0, i
|
||||
STA cdtmpx, d
|
||||
STA cdsum, d
|
||||
STX cdsqaddr, d
|
||||
cdiaglp: LDA cdtmpx, d
|
||||
STA xpos, d
|
||||
LDA cdtmpy, d
|
||||
STA ypos, d
|
||||
CPA 0, i
|
||||
BRLT cdout
|
||||
LDA cdsqsz, d
|
||||
LDX cdsqaddr, d
|
||||
CALL elemat
|
||||
ADDA cdsum, d
|
||||
STA cdsum,d
|
||||
LDA cdtmpx, d
|
||||
ADDA 1, i
|
||||
STA cdtmpx, d
|
||||
LDA cdtmpy, d
|
||||
SUBA 1, i
|
||||
STA cdtmpy, d
|
||||
BR cdiaglp
|
||||
cdout: LDA cdsum, d
|
||||
RET0
|
||||
; Temporary handle for square size (elements)
|
||||
cdsqsz: .BLOCK 2
|
||||
; Square address
|
||||
cdsqaddr: .BLOCK 2
|
||||
; Keep x address
|
||||
cdtmpx: .BLOCK 2
|
||||
; Keep y address
|
||||
cdtmpy: .BLOCK 2
|
||||
; Sum of antidiagonal
|
||||
cdsum: .BLOCK 2
|
||||
|
||||
; Computes the sum for the diagonal of a square
|
||||
; The square is supposed to contain integers only
|
||||
;
|
||||
; Parameters: A: Size of a side of the square (elements)
|
||||
; X: Base address of the square
|
||||
;
|
||||
; Returns: A: Sum of the diagonal
|
||||
;
|
||||
diagsum: STA dsqsz, d
|
||||
STX dsqaddr, d
|
||||
LDA 0, i
|
||||
STA tmpsum, d
|
||||
STA curra, d
|
||||
dglp: CPA dsqsz, d
|
||||
BRGE dglpout
|
||||
STA xpos, d
|
||||
STA ypos, d
|
||||
LDA dsqsz, d
|
||||
LDX dsqaddr, d
|
||||
CALL elemat
|
||||
ADDA tmpsum, d
|
||||
STA tmpsum, d
|
||||
LDA curra, d
|
||||
ADDA 1, i
|
||||
STA curra, d
|
||||
BR dglp
|
||||
dglpout: LDA tmpsum, d
|
||||
RET0
|
||||
; Address of the square
|
||||
dsqaddr: .BLOCK 2
|
||||
; Size of a side of the square (elements)
|
||||
dsqsz: .BLOCK 2
|
||||
; Current value of the x and y indexes
|
||||
curra: .BLOCK 2
|
||||
; Sum of the values
|
||||
tmpsum: .BLOCK 2
|
||||
|
||||
; Muliplies two ints
|
||||
;
|
||||
; Parameters:
|
||||
; Register A : Left part of the multiplication
|
||||
; Register X : Right part of the multiplication
|
||||
;
|
||||
; Return:
|
||||
; Register A : Result of the multiplication
|
||||
;
|
||||
; Side-effects:
|
||||
; Uses multmp as a temporary value
|
||||
mult: STA multmp, d
|
||||
LDA 0, i
|
||||
muloop: CPX 0, i
|
||||
BRLE mulout
|
||||
ADDA multmp, d
|
||||
SUBX 1, i
|
||||
BR muloop
|
||||
mulout: RET0
|
||||
; Temporary variable for mult function
|
||||
; Holds the initial value of A
|
||||
multmp: .WORD 0
|
||||
|
||||
; For debugging purposes
|
||||
; Prints the content of the square to stdout
|
||||
;
|
||||
; Parameters: A: Size of a side
|
||||
; X: Base address of square
|
||||
;
|
||||
; Side-effects:
|
||||
; Consider variables sidesz, sqaddr, sqmaxa as local, they will be written
|
||||
; Registers A and X will not be saved nor restored upon call
|
||||
printsq: STA sidesz, d
|
||||
STX sqaddr, d
|
||||
LDX sidesz, d
|
||||
CALL mult
|
||||
ASLA
|
||||
ADDA sqaddr, d
|
||||
STA sqmaxa, d
|
||||
LDX sqaddr, d
|
||||
LDA 0, i
|
||||
priloop: DECO 0, x
|
||||
CHARO ' ', i
|
||||
ADDX 2, i
|
||||
CPX sqmaxa, d
|
||||
BREQ priout
|
||||
ADDA 1, i
|
||||
CPA sidesz, d
|
||||
BRLT priloop
|
||||
LDA 0, i
|
||||
CHARO '\n', i
|
||||
BR priloop
|
||||
priout: RET0
|
||||
; Size of a side of the square
|
||||
sidesz: .BLOCK 2
|
||||
; Address of the square
|
||||
sqaddr: .BLOCK 2
|
||||
; Maximum address to iterate upon
|
||||
sqmaxa: .BLOCK 2
|
||||
|
||||
; ------------------ GLOBALLY ACCESSIBLE SYMBOLS -------------------- ;
|
||||
;
|
||||
; Sum of the diagonal for the square
|
||||
; Reference value for magic-square
|
||||
dgsm: .WORD 0
|
||||
; Sum of the counter-diagonal
|
||||
cdsm: .WORD 0
|
||||
; Input error string
|
||||
stderr: .ASCII "A number between 1 and 32 (both inclusive) must be entered as value for the size of the square for the program to work.\n\x00"
|
||||
.END
|
||||
227
samples/Pep8/qsort.pep
Normal file
227
samples/Pep8/qsort.pep
Normal file
@@ -0,0 +1,227 @@
|
||||
; Sorts a statically defined array using the recursive implementation
|
||||
; of the quicksort algorithm.
|
||||
;
|
||||
; In this implementation, the pivot is supposed to be the rightmost
|
||||
; value of the slice of the array being sorted.
|
||||
;
|
||||
; Note that the code presented below should work on any array,
|
||||
; whether defined statically or dynamically.
|
||||
;
|
||||
; Calling conventions:
|
||||
; Except when mentionned otherwise, every parameter is to be passed on the stack.
|
||||
; The return values are also on the stack.
|
||||
; No assumption is to be made on the content of a register on a function call.
|
||||
; The values of the registers are to be locally saved for further use if necessary.
|
||||
main: SUBSP 4, i
|
||||
LDA 11, i
|
||||
ASLA
|
||||
STA 2, s
|
||||
LDA arr, i
|
||||
STA 0, s
|
||||
CALL printarr
|
||||
SUBSP 2, i
|
||||
LDA arr, i
|
||||
STA 0, s
|
||||
LDA 0, i
|
||||
STA 2, s
|
||||
LDA 10, i
|
||||
STA 4, s
|
||||
CALL qsort
|
||||
ADDSP 2, i
|
||||
CHARO '\n', i
|
||||
LDA 11, i
|
||||
ASLA
|
||||
STA 2, s
|
||||
LDA arr, i
|
||||
STA 0, s
|
||||
CALL printarr
|
||||
STOP
|
||||
|
||||
; Sorts an array using the quicksort algorithm
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Address of the array
|
||||
; - SP + 4: Left bound
|
||||
; - SP + 6: Right bound
|
||||
; Returns:
|
||||
; void
|
||||
qsort: SUBSP 2, i
|
||||
LDA qsarrlb, s
|
||||
CPA qsarrrb, s
|
||||
BRGE qsortout
|
||||
SUBSP 6, i
|
||||
LDA 10, s
|
||||
STA 0, s
|
||||
LDA 12, s
|
||||
STA 2, s
|
||||
LDA 14, s
|
||||
STA 4, s
|
||||
CALL part
|
||||
LDA 10, s
|
||||
STA 0, s
|
||||
LDA 12, s
|
||||
STA 2, s
|
||||
LDA 6, s
|
||||
SUBA 1, i
|
||||
STA 4, s
|
||||
CALL qsort
|
||||
LDA 10, s
|
||||
STA 0, s
|
||||
LDA 6, s
|
||||
ADDA 1, i
|
||||
STA 2, s
|
||||
LDA 14, s
|
||||
STA 4, s
|
||||
CALL qsort
|
||||
ADDSP 6, i
|
||||
qsortout: ADDSP 2, i
|
||||
RET0
|
||||
; Address of the array
|
||||
qsarradd: .EQUATE 4
|
||||
; Left bound
|
||||
qsarrlb: .EQUATE 6
|
||||
; Right bound
|
||||
qsarrrb: .EQUATE 8
|
||||
; Pivot value returned by the part command
|
||||
qsortp: .EQUATE 0
|
||||
|
||||
; Partitions an array in two following the quicksort rules.
|
||||
;
|
||||
; All the lower values compared to the pivot will be on the left
|
||||
; All the upper values compared to the pivot will be on the right
|
||||
; The pivot's final index is then returned
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Address of the array
|
||||
; - SP + 4: Left bound
|
||||
; - SP + 6: Right bound
|
||||
;
|
||||
; Returns:
|
||||
; - SP + 8: Pivot final index
|
||||
part: SUBSP 8, i
|
||||
LDA parrrb, s
|
||||
STA partpiv, s
|
||||
LDA parrlb, s
|
||||
STA pstind, s
|
||||
STA piter, s
|
||||
partflp: CPA parrrb, s
|
||||
BRGE partout
|
||||
LDX piter, s
|
||||
ASLX
|
||||
LDA paraddr, sxf
|
||||
STA parrival, s
|
||||
LDX partpiv, s
|
||||
ASLX
|
||||
LDA paraddr, sxf
|
||||
CPA parrival, s
|
||||
BRLT parlpinc
|
||||
SUBSP 6, i ; Call swap(arr, i, st_index)
|
||||
LDA 16, s
|
||||
STA 0, s
|
||||
LDA 8, s
|
||||
STA 2, s
|
||||
LDA 10, s
|
||||
STA 4, s
|
||||
CALL swap
|
||||
ADDSP 6, i
|
||||
LDA pstind, s
|
||||
ADDA 1, i
|
||||
STA pstind, s
|
||||
parlpinc: LDA piter, s
|
||||
ADDA 1, i
|
||||
STA piter, s
|
||||
BR partflp
|
||||
partout: SUBSP 6, i ; Call swap(arr, piv, st_index)
|
||||
LDA 16, s
|
||||
STA 0, s
|
||||
LDA 12, s
|
||||
STA 2, s
|
||||
LDA 10, s
|
||||
STA 4, s
|
||||
CALL swap
|
||||
ADDSP 6, i
|
||||
LDA pstind, s
|
||||
ADDSP 8, i
|
||||
STA 8, s
|
||||
RET0
|
||||
; Address of the array
|
||||
paraddr: .EQUATE 10
|
||||
; Left bound
|
||||
parrlb: .EQUATE 12
|
||||
; Right bound
|
||||
parrrb: .EQUATE 14
|
||||
; Pivot value
|
||||
partpiv: .EQUATE 6
|
||||
; st_index
|
||||
pstind: .EQUATE 4
|
||||
; For iterator value
|
||||
piter: .EQUATE 2
|
||||
; arr[i] value
|
||||
parrival: .EQUATE 0
|
||||
|
||||
; Swaps the value of two elements of an array of integers
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Address of the array
|
||||
; - SP + 4: Index of the 1st element to swap
|
||||
; - SP + 6: Index of the 2nd element to swap
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
swap: SUBSP 2, i
|
||||
LDX fstelind, s
|
||||
ASLX
|
||||
LDA arraddr, sxf
|
||||
STA swaptmp, s
|
||||
LDX secelind, s
|
||||
ASLX
|
||||
LDA arraddr, sxf
|
||||
LDX fstelind, s
|
||||
ASLX
|
||||
STA arraddr, sxf
|
||||
LDA swaptmp, s
|
||||
LDX secelind, s
|
||||
ASLX
|
||||
STA arraddr, sxf
|
||||
ADDSP 2, i
|
||||
RET0
|
||||
; Temporary value for the swap
|
||||
swaptmp: .EQUATE 0
|
||||
; Address of the array on which the swap is done
|
||||
arraddr: .EQUATE 4
|
||||
; Index of the first element
|
||||
fstelind: .EQUATE 6
|
||||
; Index of the second element
|
||||
secelind: .EQUATE 8
|
||||
|
||||
; Prints the content of an array
|
||||
;
|
||||
; Parameters:
|
||||
; SP + 2: Address of the array
|
||||
; SP + 4: Length of the array
|
||||
;
|
||||
; Returns:
|
||||
; void
|
||||
printarr: LDX 0, i
|
||||
parrlp: CPX 4, s
|
||||
BRGE parrout
|
||||
DECO 2, sxf
|
||||
CHARO ' ', i
|
||||
ADDX 2, i
|
||||
BR parrlp
|
||||
parrout: RET0
|
||||
|
||||
; Unsorted array for testing purposes
|
||||
arr: .WORD 9
|
||||
.WORD 5
|
||||
.WORD 8
|
||||
.WORD 10
|
||||
.WORD 4
|
||||
.WORD 7
|
||||
.WORD 0
|
||||
.WORD 3
|
||||
.WORD 2
|
||||
.WORD 1
|
||||
.WORD 6
|
||||
|
||||
.END
|
||||
61
samples/Pep8/stri_buf.pep
Normal file
61
samples/Pep8/stri_buf.pep
Normal file
@@ -0,0 +1,61 @@
|
||||
main:
|
||||
|
||||
; Reads a string in stdin, returns the buffer it was read in
|
||||
; Stops reading at the first encounter of a \n character.
|
||||
;
|
||||
; Parameters:
|
||||
; void
|
||||
;
|
||||
; Returns:
|
||||
; - X: Address of the buffer
|
||||
stri: SUBSP 2, i
|
||||
LDA 32, i
|
||||
CALL new
|
||||
CPX buflen, s
|
||||
BRGE strinlrg
|
||||
strinlrg: LDA buflen, d
|
||||
LDX 2, i
|
||||
CALL mult
|
||||
STA buflen
|
||||
CALL new
|
||||
|
||||
buflen: .EQUATE 0
|
||||
|
||||
; Copies the content of a buffer to another one
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: Destination buffer
|
||||
; - SP + 4: Source buffer
|
||||
; - SP + 6: Length to copy
|
||||
memcpy: LDX 0, i
|
||||
memcplp: CPX cpylen, s
|
||||
BREQ memcpout
|
||||
LDBYTEA srcbuf, sxf
|
||||
STBYTEA dstbuf, sxf
|
||||
ADDX 1, i
|
||||
BR memcplp
|
||||
memcpout: RET0
|
||||
; Destination buffer
|
||||
dtsbuf: .EQUATE 2
|
||||
; Source buffer
|
||||
srcbuf: .EQUATE 4
|
||||
; Copy length
|
||||
cpylen: .EQUATE 6
|
||||
|
||||
; Allocates a new structure in the heap
|
||||
;
|
||||
; Parameters:
|
||||
; - A: Length of the structure to allocate (bytes)
|
||||
;
|
||||
; Returns:
|
||||
; - X: Address of the allocated structure
|
||||
new: ADDA hpptr, d
|
||||
LDX hpptr, d
|
||||
STA hpptr, d
|
||||
RET0
|
||||
|
||||
; Pointer to the next available byte on the heap
|
||||
hpptr: .ADDRSS heap
|
||||
; Start of the heap
|
||||
heap: .BLOCK 1
|
||||
.END
|
||||
50
samples/Pep8/stristack.pep
Normal file
50
samples/Pep8/stristack.pep
Normal file
@@ -0,0 +1,50 @@
|
||||
main: SUBSP 34, i
|
||||
LDA 31, i
|
||||
STA 0, s
|
||||
CALL fgets
|
||||
ADDSP 2, i
|
||||
CALL ststro
|
||||
STOP
|
||||
|
||||
; Reads a string from stdin, stops reading when one of the following is true:
|
||||
; - Read a \n
|
||||
; - Read a maximum of `max` chars
|
||||
;
|
||||
; Parameters:
|
||||
; - SP + 2: `max`, the maximum number of chars to read
|
||||
; - SP + 4: `buffer` of length `max` + 1
|
||||
; Returns:
|
||||
; void
|
||||
fgets: LDX 0, i
|
||||
LDA 0, i
|
||||
fgetslp: CHARI buffer, sx
|
||||
LDBYTEA buffer, sx
|
||||
CPA '\n', i
|
||||
BREQ fout
|
||||
CPX max, s
|
||||
BREQ fout
|
||||
ADDX 1, i
|
||||
BR fgetslp
|
||||
fout: LDA '\x00', i
|
||||
STBYTEA buffer, sx
|
||||
RET0
|
||||
max: .EQUATE 2
|
||||
buffer: .EQUATE 4
|
||||
|
||||
; Prints a string stored in stack
|
||||
;
|
||||
; Parameters:
|
||||
; SP + 2: `string`
|
||||
; Returns:
|
||||
; void
|
||||
ststro: LDX 0, i
|
||||
LDA 0, i
|
||||
strolp: LDBYTEA string, sx
|
||||
CPA '\x00', i
|
||||
BREQ strout
|
||||
CHARO string, sx
|
||||
ADDX 1, i
|
||||
BR strolp
|
||||
strout: RET0
|
||||
string: .EQUATE 2
|
||||
.END
|
||||
897
samples/Roff/trekmanual.nr
Normal file
897
samples/Roff/trekmanual.nr
Normal file
@@ -0,0 +1,897 @@
|
||||
.\" $FreeBSD: src/games/trek/DOC/trekmanual.nr,v 1.1.1.1.14.1 2002/08/15 18:10:56 schweikh Exp $
|
||||
.\" $DragonFly: src/games/trek/DOC/trekmanual.nr,v 1.2 2003/06/17 04:25:25 dillon Exp $
|
||||
.br
|
||||
.po 10
|
||||
.if n \!.
|
||||
.sp 15
|
||||
.tr ^ \"
|
||||
.ce 88
|
||||
^****^^^^*****^^^^^^*^^^^^^****^
|
||||
*^^^^^^^^^^*^^^^^^^*^*^^^^^*^^^*
|
||||
^***^^^^^^^*^^^^^^*****^^^^****^
|
||||
^^^^*^^^^^^*^^^^^^*^^^*^^^^*^^*^
|
||||
****^^^^^^^*^^^^^^*^^^*^^^^*^^^*
|
||||
|
||||
|
||||
*****^^^^****^^^^^*****^^^^*^^^*
|
||||
^^*^^^^^^*^^^*^^^^*^^^^^^^^*^^*^
|
||||
^^*^^^^^^****^^^^^***^^^^^^***^^
|
||||
^^*^^^^^^*^^*^^^^^*^^^^^^^^*^^*^
|
||||
^^*^^^^^^*^^^*^^^^*****^^^^*^^^*
|
||||
|
||||
|
||||
by
|
||||
|
||||
Eric Allman
|
||||
University of California
|
||||
Berkeley
|
||||
.ce 0
|
||||
.tr ^^
|
||||
.de HE
|
||||
'sp 4
|
||||
'tl 'STAR TREK''%'
|
||||
'sp 3
|
||||
..
|
||||
.de FO
|
||||
'bp
|
||||
..
|
||||
.wh 0 HE
|
||||
.wh -5 FO
|
||||
.de pp
|
||||
.sp
|
||||
.ti +4
|
||||
..
|
||||
.bp 1
|
||||
.ce
|
||||
INTRODUCTION
|
||||
.pp
|
||||
Well, the federation is once again at war with the Klingon empire.
|
||||
It is up to you,
|
||||
as captain of the U.S.S. Enterprise,
|
||||
to wipe out the invasion fleet and save the Federation.
|
||||
.pp
|
||||
For the purposes of the game
|
||||
the galaxy is divided into 64 quadrants
|
||||
on an eight by eight grid,
|
||||
with quadrant 0,0 in the upper left hand corner.
|
||||
Each quadrant is divided into 100 sectors
|
||||
on a ten by ten grid.
|
||||
Each sector contains one object
|
||||
(e.g., the Enterprise, a Klingon, or a star).
|
||||
.pp
|
||||
Navigation is handled in degrees,
|
||||
with zero being straight up
|
||||
and ninety being to the right.
|
||||
Distances are measured in quadrants.
|
||||
One tenth quadrant is one sector.
|
||||
.pp
|
||||
The galaxy contains starbases,
|
||||
at which you can dock to refuel,
|
||||
repair damages, etc.
|
||||
The galaxy also contains stars.
|
||||
Stars usually have a knack for getting in your way,
|
||||
but they can be triggered into going nova
|
||||
by shooting a photon torpedo at one,
|
||||
thereby (hopefully) destroying any adjacent Klingons.
|
||||
This is not a good practice however,
|
||||
because you are penalized for destroying stars.
|
||||
Also, a star will sometimes go supernova,
|
||||
which obliterates an entire quadrant.
|
||||
You must never stop in a supernova quadrant,
|
||||
although you may "jump over" one.
|
||||
.pp
|
||||
Some starsystems
|
||||
have inhabited planets.
|
||||
Klingons can attack inhabited planets
|
||||
and enslave the populace,
|
||||
which they then put to work building more Klingon battle cruisers.
|
||||
.bp
|
||||
.ce
|
||||
STARTING UP THE GAME
|
||||
.pp
|
||||
To request the game, issue the command
|
||||
.sp
|
||||
.ti +12
|
||||
/usr/games/trek
|
||||
.sp
|
||||
from the shell.
|
||||
If a filename is stated,
|
||||
a log of the game is written
|
||||
onto that file.
|
||||
If omitted,
|
||||
the file is not written.
|
||||
If the "-a" flag is stated before the filename,
|
||||
that file is appended to
|
||||
rather than created.
|
||||
.pp
|
||||
The game will ask you what length game
|
||||
you would like.
|
||||
Valid responses are "short", "medium", and "long".
|
||||
Ideally the length of the game does not
|
||||
affect the difficulty,
|
||||
but currently the shorter games
|
||||
tend to be harder than the longer ones.
|
||||
You may also type "restart",
|
||||
which restarts a previously saved game.
|
||||
.pp
|
||||
You will then be prompted for the skill,
|
||||
to which you must respond
|
||||
"novice", "fair", "good", "expert",
|
||||
"commodore", or "impossible".
|
||||
You should start out with a novice
|
||||
and work up,
|
||||
but if you really want to see how fast
|
||||
you can be slaughtered,
|
||||
start out with an impossible game.
|
||||
.pp
|
||||
In general,
|
||||
throughout the game,
|
||||
if you forget what is appropriate
|
||||
the game will tell you what it expects
|
||||
if you just type in
|
||||
a question mark.
|
||||
.pp
|
||||
To get a copy of these rules,
|
||||
execute the command
|
||||
.sp
|
||||
.ti +12
|
||||
nroff /usr/games/trekmanual.nr
|
||||
.sp
|
||||
.bp
|
||||
.ce
|
||||
ISSUING COMMANDS
|
||||
.pp
|
||||
If the game expects you to enter a command,
|
||||
.hc ^
|
||||
it will say ^"Command:\ "
|
||||
and wait for your response.
|
||||
Most commands can be abbreviated.
|
||||
.pp
|
||||
At almost any time you can type more than one thing on a line.
|
||||
For example,
|
||||
to move straight up one quadrant,
|
||||
you can type
|
||||
.ti +12
|
||||
move 0 1
|
||||
.br
|
||||
or you could just type
|
||||
.ti +12
|
||||
move
|
||||
.br
|
||||
and the game would prompt you with
|
||||
.ti +12
|
||||
Course:
|
||||
.br
|
||||
to which you could type
|
||||
.ti +12
|
||||
0 1
|
||||
.br
|
||||
The "1" is the distance,
|
||||
which could be put on still another line.
|
||||
Also, the "move" command
|
||||
could have been abbreviated
|
||||
"mov", "mo", or just "m".
|
||||
.pp
|
||||
If you are partway through a command
|
||||
and you change your mind,
|
||||
you can usually type "-1"
|
||||
to cancel the command.
|
||||
.pp
|
||||
Klingons generally cannot hit you
|
||||
if you don't consume anything
|
||||
(e.g., time or energy),
|
||||
so some commands are considered "free".
|
||||
As soon as you consume anything though -- POW!
|
||||
.bp
|
||||
.de **
|
||||
.if \\n+l .**
|
||||
.as x *
|
||||
..
|
||||
.de bl
|
||||
.nr l \\w'\\$1' -\\w'*'
|
||||
.ds x ****
|
||||
.**
|
||||
.sp 3
|
||||
.ne 3
|
||||
\\*x
|
||||
.br
|
||||
.if t *\h'\w'*'u'\fB\\$1\fP\h'\w'*'u'*
|
||||
.if n * \\$1 *
|
||||
.br
|
||||
\\*x
|
||||
.sp
|
||||
.in +8
|
||||
.nf
|
||||
..
|
||||
.de FF
|
||||
.in -8
|
||||
.fi
|
||||
..
|
||||
.if !\n(.V .ta \w'Full Commands: '+1
|
||||
.if \n(.V .ta \w'Full Commands: 'u
|
||||
.ce
|
||||
THE COMMANDS
|
||||
.bl "Short Range Scan"
|
||||
Mnemonic: srscan
|
||||
Shortest Abbreviation: s
|
||||
Full Commands: srscan
|
||||
srscan yes/no
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
The short range scan
|
||||
gives you a picture
|
||||
of the quadrant you are in,
|
||||
and (if you say "yes")
|
||||
a status report
|
||||
which tells you
|
||||
a whole bunch
|
||||
of interesting stuff.
|
||||
You can get a status report alone
|
||||
by using the
|
||||
.ul
|
||||
status
|
||||
command.
|
||||
An example follows:
|
||||
.sp
|
||||
.nf
|
||||
.in +4
|
||||
Short range sensor scan
|
||||
0 1 2 3 4 5 6 7 8 9
|
||||
0 . . . . . . . * . * 0 stardate 3702.16
|
||||
1 . . E . . . . . . . 1 condition RED
|
||||
2 . . . . . . . . . * 2 position 0,3/1,2
|
||||
3 * . . . . # . . . . 3 warp factor 5.0
|
||||
4 . . . . . . . . . . 4 total energy 4376
|
||||
5 . . * . * . . . . . 5 torpedoes 9
|
||||
6 . . . @ . . . . . 6 shields down, 78%
|
||||
7 . . . . . . . . . . 7 Klingons left 3
|
||||
8 . . . K . . . . . . 8 time left 6.43
|
||||
9 . . . . . . * . . . 9 life support damaged, reserves = 2.4
|
||||
0 1 2 3 4 5 6 7 8 9
|
||||
Distressed Starsystem Marcus XII
|
||||
|
||||
.in +8
|
||||
.ti -8
|
||||
The cast of characters is as follows:
|
||||
E the hero
|
||||
K the villain
|
||||
# the starbase
|
||||
* stars
|
||||
@ inhabited starsystem
|
||||
\&. empty space
|
||||
a black hole
|
||||
.in -12
|
||||
.fi
|
||||
.pp
|
||||
The name of the starsystem is listed underneath
|
||||
the short range scan.
|
||||
The word "distressed", if present,
|
||||
means that the starsystem
|
||||
is under attack.
|
||||
.pp
|
||||
Short range scans are absolutely free.
|
||||
They use no time, no energy,
|
||||
and they don't give the Klingons
|
||||
another chance to hit you.
|
||||
.bl "Status Report"
|
||||
Mnemonic: status
|
||||
Shortest Abbreviation: st
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
This command gives you information
|
||||
about the current status
|
||||
of the game and your ship, as follows:
|
||||
.in +8
|
||||
.de qq
|
||||
.sp
|
||||
.ti -4
|
||||
..
|
||||
.qq
|
||||
Stardate -- The current stardate.
|
||||
.qq
|
||||
Condition -- as follows:
|
||||
.in +4
|
||||
.nf
|
||||
RED -- in battle
|
||||
YELLOW -- low on energy
|
||||
GREEN -- normal state
|
||||
DOCKED -- docked at starbase
|
||||
CLOAKED -- the cloaking device is activated
|
||||
.fi
|
||||
.in -4
|
||||
.qq
|
||||
Position -- Your current quadrant and sector.
|
||||
.qq
|
||||
Warp Factor -- The speed you will move at
|
||||
when you move under warp power
|
||||
(with the
|
||||
.ul
|
||||
move
|
||||
command).
|
||||
.qq
|
||||
Total Energy -- Your energy reserves.
|
||||
If they drop to zero,
|
||||
you die.
|
||||
Energy regenerates,
|
||||
but the higher the skill of the game,
|
||||
the slower it regenerates.
|
||||
.qq
|
||||
Torpedoes -- How many photon torpedoes you have left.
|
||||
.qq
|
||||
Shields -- Whether your shields are up or down,
|
||||
and how effective they are if up
|
||||
(what percentage of a hit they will absorb).
|
||||
.qq
|
||||
Klingons Left -- Guess.
|
||||
.qq
|
||||
Time Left -- How long the Federation can hold out
|
||||
if you sit on your fat ass and do nothing.
|
||||
If you kill Klingons quickly,
|
||||
this number goes up,
|
||||
otherwise,
|
||||
it goes down.
|
||||
If it hits zero,
|
||||
the Federation is conquered.
|
||||
.qq
|
||||
Life Support -- If "active", everything is fine.
|
||||
If "damaged", your reserves tell you
|
||||
how long you have
|
||||
to repair your life support
|
||||
or get to a starbase
|
||||
before you starve, suffocate,
|
||||
or something equally unpleasant.
|
||||
.qq
|
||||
Current Crew -- The number of crew members
|
||||
left.
|
||||
This figures does not include officers.
|
||||
.qq
|
||||
Brig Space -- The space left in your brig
|
||||
for Klingon captives.
|
||||
.qq
|
||||
Klingon Power -- The number of units
|
||||
needed to kill a Klingon.
|
||||
Remember, as Klingons fire at you
|
||||
they use up their own energy,
|
||||
so you probably need somewhat less
|
||||
than this.
|
||||
.qq
|
||||
Skill, Length -- The skill and length
|
||||
of the game you are playing.
|
||||
.in -8
|
||||
.pp
|
||||
Status information is absolutely free.
|
||||
.bl "Long Range Scan"
|
||||
Mnemonic: lrscan
|
||||
Shortest Abbreviation: l
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
Long range scan gives you information about the
|
||||
eight quadrants
|
||||
that surround the quadrant
|
||||
you're in.
|
||||
A sample long range scan follows:
|
||||
.sp
|
||||
.in +12
|
||||
.nf
|
||||
Long range scan for quadrant 0,3
|
||||
|
||||
2 3 4
|
||||
-------------------
|
||||
! * ! * ! * !
|
||||
-------------------
|
||||
0 ! 108 ! 6 ! 19 !
|
||||
-------------------
|
||||
1 ! 9 ! /// ! 8 !
|
||||
-------------------
|
||||
.sp
|
||||
.in -12
|
||||
.fi
|
||||
.pp
|
||||
The three digit numbers
|
||||
tell the number of objects
|
||||
in the quadrants.
|
||||
The units digit tells the number of stars,
|
||||
the tens digit the number of starbases,
|
||||
and the hundreds digit is the number of Klingons.
|
||||
"*" indicates the negative energy barrier
|
||||
at the edge of the galaxy,
|
||||
which you cannot enter.
|
||||
"///" means that that is a supernova quadrant
|
||||
and must not be entered.
|
||||
.bl "Damage Report"
|
||||
Mnemonic: damages
|
||||
Shortest Abbreviation: da
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
A damage report tells you what devices are damaged
|
||||
and how long it will take to repair them.
|
||||
Repairs proceed faster
|
||||
when you are docked
|
||||
at a starbase.
|
||||
.bl "Set Warp Factor"
|
||||
Mnemonic: warp
|
||||
Shortest Abbreviation: w
|
||||
Full Command: warp factor
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
The warp factor tells the speed of your starship
|
||||
when you move under warp power
|
||||
(with the
|
||||
.ul
|
||||
move
|
||||
command).
|
||||
The higher the warp factor,
|
||||
the faster you go,
|
||||
and the more energy you use.
|
||||
.pp
|
||||
The minimum warp factor is 1.0
|
||||
and the maximum is 10.0.
|
||||
At speeds above warp 6
|
||||
there is danger of the warp engines
|
||||
being damaged.
|
||||
The probability of this
|
||||
increases at higher warp speeds.
|
||||
Above warp 9.0 there is a chance of entering
|
||||
a time warp.
|
||||
.bl "Move Under Warp Power"
|
||||
Mnemonic: move
|
||||
Shortest Abbreviation: m
|
||||
Full Command: move course distance
|
||||
Consumes: time and energy
|
||||
.FF
|
||||
.pp
|
||||
This is the usual way of moving.
|
||||
The course is in degrees and the distance is in quadrants.
|
||||
To move one sector specify a distance of 0.1.
|
||||
.pp
|
||||
Time is consumed proportionately to
|
||||
the inverse of the warp factor squared,
|
||||
and directly to the distance.
|
||||
Energy is consumed as the warp factor cubed,
|
||||
and directly to the distance.
|
||||
If you move with your shields up
|
||||
it doubles the amount of energy consumed.
|
||||
.pp
|
||||
When you move in a quadrant containing Klingons,
|
||||
they get a chance to attack you.
|
||||
.pp
|
||||
The computer detects navigation errors.
|
||||
If the computer is out,
|
||||
you run the risk of running into things.
|
||||
.pp
|
||||
The course is determined by the
|
||||
Space Inertial Navigation System
|
||||
[SINS].
|
||||
As described in
|
||||
Star Fleet Technical Order TO:02:06:12,
|
||||
the SINS is calibrated,
|
||||
after which it becomes the base for navigation.
|
||||
If damaged,
|
||||
navigation becomes inaccurate.
|
||||
When it is fixed,
|
||||
Spock recalibrates it,
|
||||
however,
|
||||
it cannot be calibrated extremely accurately
|
||||
until you dock at starbase.
|
||||
.bl "Move Under Impulse Power"
|
||||
Mnemonic: impulse
|
||||
Shortest Abbreviation: i
|
||||
Full Command: impulse course distance
|
||||
Consumes: time and energy
|
||||
.FF
|
||||
.pp
|
||||
The impulse engines give you a chance to maneuver
|
||||
when your warp engines are damaged;
|
||||
however, they are incredibly slow
|
||||
(0.095 quadrants/stardate).
|
||||
They require 20 units of energy to engage,
|
||||
and ten units per sector to move.
|
||||
.pp
|
||||
The same comments about the computer and the SINS
|
||||
apply as above.
|
||||
.pp
|
||||
There is no penalty to move under impulse power
|
||||
with shields up.
|
||||
.bl "Deflector Shields"
|
||||
Mnemonic: shields
|
||||
Shortest Abbreviation: sh
|
||||
Full Command: shields up/down
|
||||
Consumes: energy
|
||||
.FF
|
||||
.pp
|
||||
Shields protect you from Klingon attack
|
||||
and nearby novas.
|
||||
As they protect you,
|
||||
they weaken.
|
||||
A shield which is 78% effective
|
||||
will absorb 78% of a hit
|
||||
and let 22% in to hurt you.
|
||||
.pp
|
||||
The Klingons have a chance to attack you
|
||||
every time you raise or lower shields.
|
||||
Shields do not rise and lower
|
||||
instantaneously,
|
||||
so the hit you receive
|
||||
will be computed with the shields
|
||||
at an intermediate effectiveness.
|
||||
.pp
|
||||
It takes energy to raise shields,
|
||||
but not to drop them.
|
||||
.bl "Cloaking Device"
|
||||
Mnemonic: cloak
|
||||
Shortest Abbreviation: cl
|
||||
Full Command: cloak up/down
|
||||
Consumes: energy
|
||||
.FF
|
||||
.pp
|
||||
When you are cloaked,
|
||||
Klingons cannot see you,
|
||||
and hence they do not fire at you.
|
||||
They are useful for entering
|
||||
a quadrant
|
||||
and selecting a good position,
|
||||
however,
|
||||
weapons cannot be fired through
|
||||
the cloak
|
||||
due to the huge energy drain
|
||||
that it requires.
|
||||
.pp
|
||||
The cloak up command
|
||||
only starts the cloaking process;
|
||||
Klingons will continue
|
||||
to fire at you
|
||||
until you do something
|
||||
which consumes time.
|
||||
.bl "Fire Phasers"
|
||||
Mnemonic: phasers
|
||||
Shortest Abbreviation: p
|
||||
Full Commands: phasers automatic amount
|
||||
phasers manual amt1 course1 spread1 ...
|
||||
Consumes: energy
|
||||
.FF
|
||||
.pp
|
||||
Phasers are energy weapons;
|
||||
the energy comes from your ship's reserves
|
||||
("total energy" on a srscan).
|
||||
It takes about 250 units of hits
|
||||
to kill a Klingon.
|
||||
Hits are cumulative as long as you stay
|
||||
in the quadrant.
|
||||
.pp
|
||||
Phasers become less effective
|
||||
the further from a Klingon you are.
|
||||
Adjacent Klingons receive about
|
||||
90% of what you fire,
|
||||
at five sectors about 60%,
|
||||
and at ten sectors about 35%.
|
||||
They have no effect outside of the quadrant.
|
||||
.pp
|
||||
Phasers cannot be fired while shields are up;
|
||||
to do so would fry you.
|
||||
They have no effect on starbases or stars.
|
||||
.pp
|
||||
In automatic mode
|
||||
the computer decides how to divide up the energy
|
||||
among the Klingons present;
|
||||
in manual mode you do that yourself.
|
||||
.pp
|
||||
In manual mode firing
|
||||
you specify a direction,
|
||||
amount (number of units to fire)
|
||||
and spread (0 -> 1.0)
|
||||
for each of the six phaser banks.
|
||||
A zero amount
|
||||
terminates the manual input.
|
||||
.bl "Fire Photon Torpedoes"
|
||||
Mnemonic: torpedo
|
||||
Shortest Abbreviation: t
|
||||
Full Command: torpedo course [yes/no] [burst angle]
|
||||
Consumes: torpedoes
|
||||
.FF
|
||||
.pp
|
||||
Torpedoes are projectile weapons -- there are no partial hits.
|
||||
You either hit your target or you don't.
|
||||
A hit on a Klingon destroys him.
|
||||
A hit on a starbase destroys that starbase
|
||||
(woops!).
|
||||
Hitting a star usually causes it to go nova,
|
||||
and occasionally supernova.
|
||||
.pp
|
||||
Photon torpedoes cannot be aimed precisely.
|
||||
They can be fired with shields up,
|
||||
but they get even more random
|
||||
as they pass through the shields.
|
||||
.pp
|
||||
Torpedoes may be fired in bursts of three.
|
||||
If this is desired,
|
||||
the burst angle is the angle
|
||||
between the three shots,
|
||||
which may vary from one to fifteen.
|
||||
The word "no"
|
||||
says that a burst is not wanted;
|
||||
the word "yes"
|
||||
(which may be omitted
|
||||
if stated on the same line as the course)
|
||||
says that a burst is wanted.
|
||||
.pp
|
||||
Photon torpedoes
|
||||
have no effect
|
||||
outside the quadrant.
|
||||
.bl "Onboard Computer Request"
|
||||
Mnemonic: computer
|
||||
Shortest Abbreviation: c
|
||||
Full Command: computer request; request;...
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
The computer command gives you access to the facilities
|
||||
of the onboard computer,
|
||||
which allows you to do all sorts of fascinating stuff.
|
||||
Computer requests are:
|
||||
.in +8
|
||||
.qq
|
||||
score -- Shows your current score.
|
||||
.qq
|
||||
course quad/sect -- Computes the course and distance from wherever
|
||||
you are to the given location.
|
||||
If you type "course /x,y"
|
||||
you will be given the course
|
||||
to sector x,y in the current quadrant.
|
||||
.qq
|
||||
move quad/sect -- Identical to the course
|
||||
request,
|
||||
except that the move is executed.
|
||||
.qq
|
||||
chart -- prints a chart of the known galaxy,
|
||||
i.e.,
|
||||
everything that you have seen with a long range scan.
|
||||
The format is the same as on a long range scan,
|
||||
except that "..." means
|
||||
that you don't yet know what is there,
|
||||
and ".1." means that you know that a starbase
|
||||
exists, but you don't know anything else.
|
||||
"$$$" mans the quadrant
|
||||
that you are currently in.
|
||||
.qq
|
||||
trajectory -- prints the course and distance
|
||||
to all the Klingons in the quadrant.
|
||||
.qq
|
||||
warpcost dist warp_factor -- computes the cost in time and energy
|
||||
to move `dist' quadrants at warp `warp_factor'.
|
||||
.qq
|
||||
impcost dist -- same as warpcost for impulse engines.
|
||||
.qq
|
||||
pheff range -- tells how effective your phasers are
|
||||
at a given range.
|
||||
.qq
|
||||
distresslist -- gives a list of currently distressed
|
||||
starbases
|
||||
and starsystems.
|
||||
.in -8
|
||||
.pp
|
||||
More than one request may be stated
|
||||
on a line
|
||||
by separating them
|
||||
with semicolons.
|
||||
.bl "Dock at Starbase"
|
||||
Mnemonic: dock
|
||||
Shortest Abbreviation: do
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
You may dock at a starbase
|
||||
when you are in one of the eight
|
||||
adjacent sectors.
|
||||
.pp
|
||||
When you dock you are resupplied
|
||||
with energy, photon torpedoes, and life support reserves.
|
||||
Repairs are also done faster at starbase.
|
||||
Any prisoners you have taken
|
||||
are unloaded.
|
||||
You do not receive points
|
||||
for taking prisoners
|
||||
until this time.
|
||||
.pp
|
||||
Starbases have their own deflector shields,
|
||||
so you are safe from attack while docked.
|
||||
.bl "Undock from Starbase"
|
||||
Mnemonic: undock
|
||||
Shortest Abbreviation: u
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
This just allows you to leave starbase
|
||||
so that you may proceed on your way.
|
||||
.bl "Rest"
|
||||
Mnemonic: rest
|
||||
Shortest Abbreviation: r
|
||||
Full Command: rest time
|
||||
Consumes: time
|
||||
.FF
|
||||
.pp
|
||||
This command allows you to rest to repair damages.
|
||||
It is not advisable to rest while under attack.
|
||||
.bl "Call Starbase For Help"
|
||||
Mnemonic: help
|
||||
Shortest Abbreviation: help
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
You may call starbase for help via your subspace radio.
|
||||
Starbase has long range transporter beams to get you.
|
||||
Problem is,
|
||||
they can't always rematerialize you.
|
||||
.pp
|
||||
You should avoid using this command unless absolutely necessary,
|
||||
for the above reason and because it counts heavily against you
|
||||
in the scoring.
|
||||
.bl "Capture Klingon"
|
||||
Mnemonic: capture
|
||||
Shortest Abbreviation: ca
|
||||
Consumes: time
|
||||
.FF
|
||||
.pp
|
||||
You may request that a Klingon surrender
|
||||
to you.
|
||||
If he accepts,
|
||||
you get to take captives
|
||||
(but only as many as your brig
|
||||
can hold).
|
||||
It is good if you do this,
|
||||
because you get points for captives.
|
||||
Also,
|
||||
if you ever get captured,
|
||||
you want to be sure that the Federation
|
||||
has prisoners to exchange for you.
|
||||
.pp
|
||||
You must go to a starbase
|
||||
to turn over your prisoners
|
||||
to Federation authorities.
|
||||
.bl "Visual Scan"
|
||||
Mnemonic: visual
|
||||
Shortest Abbreviation: v
|
||||
Full Command: visual course
|
||||
Consumes: time
|
||||
.FF
|
||||
.pp
|
||||
When your short range scanners are out,
|
||||
you can still see what is out "there"
|
||||
by doing a visual scan.
|
||||
Unfortunately,
|
||||
you can only see three sectors at one time,
|
||||
and it takes 0.005 stardates to perform.
|
||||
.pp
|
||||
The three sectors in the general direction
|
||||
of the course specified
|
||||
are examined
|
||||
and displayed.
|
||||
.bl "Abandon Ship"
|
||||
Mnemonic: abandon
|
||||
Shortest Abbreviation: abandon
|
||||
Consumes: nothing
|
||||
.FF
|
||||
.pp
|
||||
The officers escape the Enterprise in the shuttlecraft.
|
||||
If the transporter is working
|
||||
and there is an inhabitable starsystem
|
||||
in the area,
|
||||
the crew beams down,
|
||||
otherwise you leave them to die.
|
||||
You are given an old but still usable ship,
|
||||
the Faire Queene.
|
||||
.bl "Ram"
|
||||
Mnemonic: ram
|
||||
Shortest Abbreviation: ram
|
||||
Full Command: ram course distance
|
||||
Consumes: time and energy
|
||||
.FF
|
||||
.pp
|
||||
This command is identical to "move",
|
||||
except that the computer
|
||||
doesn't stop you
|
||||
from making navigation errors.
|
||||
.pp
|
||||
You get very nearly slaughtered
|
||||
if you ram anything.
|
||||
.bl "Self Destruct"
|
||||
Mnemonic: destruct
|
||||
Shortest Abbreviation: destruct
|
||||
Consumes: everything
|
||||
.FF
|
||||
.pp
|
||||
Your starship is self-destructed.
|
||||
Chances are you will destroy
|
||||
any Klingons
|
||||
(and stars,
|
||||
and starbases)
|
||||
left in your quadrant.
|
||||
.bl "Terminate the Game"
|
||||
Mnemonic: terminate
|
||||
Shortest Abbreviation: terminate
|
||||
Full Command: terminate yes/no
|
||||
.FF
|
||||
.pp
|
||||
Cancels the current game.
|
||||
No score is computed.
|
||||
If you answer yes,
|
||||
a new game will be started,
|
||||
otherwise trek exits.
|
||||
.bl "Call the Shell"
|
||||
Mnemonic: shell
|
||||
Shortest Abbreviation: shell
|
||||
.FF
|
||||
.pp
|
||||
Temporarily escapes to the shell.
|
||||
When you log out of the shell
|
||||
you will return to the game.
|
||||
.bp
|
||||
.ce
|
||||
SCORING
|
||||
.in +4
|
||||
.pp
|
||||
The scoring algorithm is rather complicated.
|
||||
Basically,
|
||||
you get points for each Klingon you kill,
|
||||
for your Klingon per stardate kill rate,
|
||||
and a bonus if you win the game.
|
||||
You lose
|
||||
points for the number of Klingons left
|
||||
in the galaxy
|
||||
at the end of the game,
|
||||
for getting killed,
|
||||
for each star, starbase, or inhabited starsystem
|
||||
you destroy,
|
||||
for calling for help,
|
||||
and for each casualty you incur.
|
||||
.pp
|
||||
You will be promoted
|
||||
if you play very well.
|
||||
You will never get a promotion if you
|
||||
call for help,
|
||||
abandon the Enterprise,
|
||||
get killed,
|
||||
destroy a starbase or inhabited starsystem,
|
||||
or destroy too many stars.
|
||||
.bp
|
||||
.ce
|
||||
REFERENCE PAGE
|
||||
.sp 2
|
||||
.ta 36 56
|
||||
.nf
|
||||
.ul
|
||||
Command Uses Consumes
|
||||
|
||||
ABANDON shuttlecraft, -
|
||||
transporter
|
||||
CApture subspace radio time
|
||||
CLoak Up/Down cloaking device energy
|
||||
Computer request; request;... computer -
|
||||
DAmages - -
|
||||
DESTRUCT computer -
|
||||
DOck - -
|
||||
HELP subspace radio -
|
||||
Impulse course distance impulse engines, time, energy
|
||||
computer, SINS
|
||||
Lrscan L.R. sensors -
|
||||
Move course distance warp engines, time, energy
|
||||
computer, SINS
|
||||
Phasers Automatic amount phasers, computer energy
|
||||
Phasers Manual amt1 course1 spread1 ... phasers energy
|
||||
Torpedo course [Yes] angle/No torpedo tubes torpedoes
|
||||
RAM course distance warp engines, time, energy
|
||||
computer, SINS
|
||||
Rest time - time
|
||||
SHELL - -
|
||||
SHields Up/Down shields energy
|
||||
Srscan [Yes/No] S.R. sensors -
|
||||
STatus - -
|
||||
TERMINATE Yes/No - -
|
||||
Undock - -
|
||||
Visual course - time
|
||||
Warp warp_factor - -
|
||||
.fi
|
||||
@@ -58,6 +58,7 @@ class TestGenerated < Minitest::Test
|
||||
|
||||
# npm shrinkwrap file
|
||||
generated_sample_without_loading_data("Dummy/npm-shrinkwrap.json")
|
||||
generated_sample_without_loading_data("Dummy/package-lock.json")
|
||||
|
||||
# Godep saved dependencies
|
||||
generated_sample_without_loading_data("Godeps/Godeps.json")
|
||||
|
||||
2
vendor/CodeMirror
vendored
2
vendor/CodeMirror
vendored
Submodule vendor/CodeMirror updated: 41da8714dd...5600b5ed14
11
vendor/README.md
vendored
11
vendor/README.md
vendored
@@ -59,6 +59,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Click:** [stenverbois/language-click](https://github.com/stenverbois/language-click)
|
||||
- **CLIPS:** [psicomante/CLIPS-sublime](https://github.com/psicomante/CLIPS-sublime)
|
||||
- **Clojure:** [atom/language-clojure](https://github.com/atom/language-clojure)
|
||||
- **Closure Templates:** [mthadley/language-closure-templates](https://github.com/mthadley/language-closure-templates)
|
||||
- **CMake:** [textmate/cmake.tmbundle](https://github.com/textmate/cmake.tmbundle)
|
||||
- **COBOL:** [bitbucket:bitlang/sublime_cobol](https://bitbucket.org/bitlang/sublime_cobol)
|
||||
- **CoffeeScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script)
|
||||
@@ -82,7 +83,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle)
|
||||
- **D:** [textmate/d.tmbundle](https://github.com/textmate/d.tmbundle)
|
||||
- **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle)
|
||||
- **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle)
|
||||
- **Dart:** [dart-atom/dartlang](https://github.com/dart-atom/dartlang)
|
||||
- **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle)
|
||||
- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle)
|
||||
- **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams)
|
||||
@@ -167,6 +168,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **JFlex:** [jflex-de/jflex.tmbundle](https://github.com/jflex-de/jflex.tmbundle)
|
||||
- **Jison:** [cdibbs/language-jison](https://github.com/cdibbs/language-jison)
|
||||
- **Jison Lex:** [cdibbs/language-jison](https://github.com/cdibbs/language-jison)
|
||||
- **Jolie:** [fmontesi/language-jolie](https://github.com/fmontesi/language-jolie)
|
||||
- **JSON:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle)
|
||||
- **JSON5:** [atom/language-javascript](https://github.com/atom/language-javascript)
|
||||
- **JSONiq:** [wcandillon/language-jsoniq](https://github.com/wcandillon/language-jsoniq)
|
||||
@@ -251,6 +253,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Parrot Internal Representation:** [textmate/parrot.tmbundle](https://github.com/textmate/parrot.tmbundle)
|
||||
- **Pascal:** [textmate/pascal.tmbundle](https://github.com/textmate/pascal.tmbundle)
|
||||
- **PAWN:** [Southclaw/pawn-sublime-language](https://github.com/Southclaw/pawn-sublime-language)
|
||||
- **Pep8:** [R4PaSs/Sublime-Pep8](https://github.com/R4PaSs/Sublime-Pep8)
|
||||
- **Perl:** [textmate/perl.tmbundle](https://github.com/textmate/perl.tmbundle)
|
||||
- **Perl6:** [perl6/atom-language-perl6](https://github.com/perl6/atom-language-perl6)
|
||||
- **PHP:** [textmate/php.tmbundle](https://github.com/textmate/php.tmbundle)
|
||||
@@ -282,7 +285,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Rascal:** [usethesource/rascal-syntax-highlighting](https://github.com/usethesource/rascal-syntax-highlighting)
|
||||
- **RDoc:** [joshaven/RDoc.tmbundle](https://github.com/joshaven/RDoc.tmbundle)
|
||||
- **REALbasic:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax)
|
||||
- **Reason:** [facebook/reason](https://github.com/facebook/reason)
|
||||
- **Reason:** [chenglou/sublime-reason](https://github.com/chenglou/sublime-reason)
|
||||
- **Rebol:** [Oldes/Sublime-REBOL](https://github.com/Oldes/Sublime-REBOL)
|
||||
- **Red:** [Oldes/Sublime-Red](https://github.com/Oldes/Sublime-Red)
|
||||
- **Regular Expression:** [Alhadis/language-regexp](https://github.com/Alhadis/language-regexp)
|
||||
@@ -307,8 +310,10 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Scheme:** [textmate/scheme.tmbundle](https://github.com/textmate/scheme.tmbundle)
|
||||
- **Scilab:** [textmate/scilab.tmbundle](https://github.com/textmate/scilab.tmbundle)
|
||||
- **SCSS:** [MarioRicalde/SCSS.tmbundle](https://github.com/MarioRicalde/SCSS.tmbundle)
|
||||
- **ShaderLab:** [tgjones/shaders-tmLanguage](https://github.com/tgjones/shaders-tmLanguage)
|
||||
- **Shell:** [atom/language-shellscript](https://github.com/atom/language-shellscript)
|
||||
- **ShellSession:** [atom/language-shellscript](https://github.com/atom/language-shellscript)
|
||||
- **Shen:** [rkoeninger/sublime-shen](https://github.com/rkoeninger/sublime-shen)
|
||||
- **Slash:** [slash-lang/Slash.tmbundle](https://github.com/slash-lang/Slash.tmbundle)
|
||||
- **Slim:** [slim-template/ruby-slim.tmbundle](https://github.com/slim-template/ruby-slim.tmbundle)
|
||||
- **Smali:** [ShaneWilton/sublime-smali](https://github.com/ShaneWilton/sublime-smali)
|
||||
@@ -381,4 +386,4 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Yacc:** [textmate/bison.tmbundle](https://github.com/textmate/bison.tmbundle)
|
||||
- **YAML:** [atom/language-yaml](https://github.com/atom/language-yaml)
|
||||
- **YANG:** [DzonyKalafut/language-yang](https://github.com/DzonyKalafut/language-yang)
|
||||
- **Zephir:** [vmg/zephir-sublime](https://github.com/vmg/zephir-sublime)
|
||||
- **Zephir:** [phalcon/zephir-sublime](https://github.com/phalcon/zephir-sublime)
|
||||
|
||||
2
vendor/grammars/Elm
vendored
2
vendor/grammars/Elm
vendored
Submodule vendor/grammars/Elm updated: 195e71c6a7...556f669c79
2
vendor/grammars/MagicPython
vendored
2
vendor/grammars/MagicPython
vendored
Submodule vendor/grammars/MagicPython updated: ed68ac42c5...68c88ccfc2
2
vendor/grammars/Modelica
vendored
2
vendor/grammars/Modelica
vendored
Submodule vendor/grammars/Modelica updated: 10c5dc6484...e9cf6f5bfb
2
vendor/grammars/NimLime
vendored
2
vendor/grammars/NimLime
vendored
Submodule vendor/grammars/NimLime updated: 80787e7eee...61d59cb352
1
vendor/grammars/Sublime-Pep8
vendored
Submodule
1
vendor/grammars/Sublime-Pep8
vendored
Submodule
Submodule vendor/grammars/Sublime-Pep8 added at be653c638b
2
vendor/grammars/Sublime-SQF-Language
vendored
2
vendor/grammars/Sublime-SQF-Language
vendored
Submodule vendor/grammars/Sublime-SQF-Language updated: 0dffdffaaa...5f7dd13f59
2
vendor/grammars/SublimePuppet
vendored
2
vendor/grammars/SublimePuppet
vendored
Submodule vendor/grammars/SublimePuppet updated: e804328fc9...b523a061c1
2
vendor/grammars/TLA
vendored
2
vendor/grammars/TLA
vendored
Submodule vendor/grammars/TLA updated: 5dc130cab3...6151a16cab
2
vendor/grammars/Terraform.tmLanguage
vendored
2
vendor/grammars/Terraform.tmLanguage
vendored
Submodule vendor/grammars/Terraform.tmLanguage updated: cc9fb7e028...0594ba9ec7
2
vendor/grammars/atom-language-perl6
vendored
2
vendor/grammars/atom-language-perl6
vendored
Submodule vendor/grammars/atom-language-perl6 updated: cf2e204ddf...2519ab86da
2
vendor/grammars/atom-language-rust
vendored
2
vendor/grammars/atom-language-rust
vendored
Submodule vendor/grammars/atom-language-rust updated: 2f736b3ce3...c24ef01b9f
2
vendor/grammars/d.tmbundle
vendored
2
vendor/grammars/d.tmbundle
vendored
Submodule vendor/grammars/d.tmbundle updated: d44b42bdb7...8017dc8419
1
vendor/grammars/dart-sublime-bundle
vendored
1
vendor/grammars/dart-sublime-bundle
vendored
Submodule vendor/grammars/dart-sublime-bundle deleted from d891fb36c9
1
vendor/grammars/dartlang
vendored
Submodule
1
vendor/grammars/dartlang
vendored
Submodule
Submodule vendor/grammars/dartlang added at b2d27b5bc9
2
vendor/grammars/html.tmbundle
vendored
2
vendor/grammars/html.tmbundle
vendored
Submodule vendor/grammars/html.tmbundle updated: d66526c5f6...a723f08ebd
2
vendor/grammars/language-batchfile
vendored
2
vendor/grammars/language-batchfile
vendored
Submodule vendor/grammars/language-batchfile updated: 100b682992...cc64309fe7
2
vendor/grammars/language-blade
vendored
2
vendor/grammars/language-blade
vendored
Submodule vendor/grammars/language-blade updated: ba08897c64...22c66ef641
2
vendor/grammars/language-clojure
vendored
2
vendor/grammars/language-clojure
vendored
Submodule vendor/grammars/language-clojure updated: 82ff056df3...bcba97a0c4
1
vendor/grammars/language-closure-templates
vendored
Submodule
1
vendor/grammars/language-closure-templates
vendored
Submodule
Submodule vendor/grammars/language-closure-templates added at e3bcd5d223
2
vendor/grammars/language-crystal
vendored
2
vendor/grammars/language-crystal
vendored
Submodule vendor/grammars/language-crystal updated: cbe3a5504f...31d39fe57c
2
vendor/grammars/language-csound
vendored
2
vendor/grammars/language-csound
vendored
Submodule vendor/grammars/language-csound updated: c8cc446094...aba3e06378
2
vendor/grammars/language-css
vendored
2
vendor/grammars/language-css
vendored
Submodule vendor/grammars/language-css updated: 07b4b81d7c...4caa553815
2
vendor/grammars/language-gfm
vendored
2
vendor/grammars/language-gfm
vendored
Submodule vendor/grammars/language-gfm updated: 748a31c505...54955eb48d
2
vendor/grammars/language-graphql
vendored
2
vendor/grammars/language-graphql
vendored
Submodule vendor/grammars/language-graphql updated: 42f7f6422e...fce0f6a54e
2
vendor/grammars/language-haml
vendored
2
vendor/grammars/language-haml
vendored
Submodule vendor/grammars/language-haml updated: 301625dff4...15b119a6b2
2
vendor/grammars/language-javascript
vendored
2
vendor/grammars/language-javascript
vendored
Submodule vendor/grammars/language-javascript updated: 2ba9a9891f...f99edc1200
2
vendor/grammars/language-jison
vendored
2
vendor/grammars/language-jison
vendored
Submodule vendor/grammars/language-jison updated: ba9dc85e38...dc99f6e3e5
2
vendor/grammars/language-less
vendored
2
vendor/grammars/language-less
vendored
Submodule vendor/grammars/language-less updated: 81e2ef24bf...c7ae276c12
2
vendor/grammars/language-shellscript
vendored
2
vendor/grammars/language-shellscript
vendored
Submodule vendor/grammars/language-shellscript updated: 29eecbc416...92cc4cd253
2
vendor/grammars/language-xbase
vendored
2
vendor/grammars/language-xbase
vendored
Submodule vendor/grammars/language-xbase updated: 4e4363052d...78039d349e
2
vendor/grammars/language-yaml
vendored
2
vendor/grammars/language-yaml
vendored
Submodule vendor/grammars/language-yaml updated: d39aff110e...9edc8bab02
2
vendor/grammars/lua.tmbundle
vendored
2
vendor/grammars/lua.tmbundle
vendored
Submodule vendor/grammars/lua.tmbundle updated: 6cac1887dc...3a40a67855
2
vendor/grammars/reason
vendored
2
vendor/grammars/reason
vendored
Submodule vendor/grammars/reason updated: 39bb6cb78c...c7d2374532
2
vendor/grammars/sas.tmbundle
vendored
2
vendor/grammars/sas.tmbundle
vendored
Submodule vendor/grammars/sas.tmbundle updated: 6a4d632977...75f553843f
1
vendor/grammars/sublime-shen
vendored
Submodule
1
vendor/grammars/sublime-shen
vendored
Submodule
Submodule vendor/grammars/sublime-shen added at f2817863a5
2
vendor/grammars/zephir-sublime
vendored
2
vendor/grammars/zephir-sublime
vendored
Submodule vendor/grammars/zephir-sublime updated: 5b1d75b565...cf17257d31
18
vendor/licenses/grammar/Sublime-Pep8.txt
vendored
Normal file
18
vendor/licenses/grammar/Sublime-Pep8.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
type: grammar
|
||||
name: Sublime-Pep8
|
||||
license: wtfpl
|
||||
---
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
@@ -1,21 +1,23 @@
|
||||
---
|
||||
type: grammar
|
||||
name: dart-sublime-bundle
|
||||
name: dartlang
|
||||
license: bsd-3-clause
|
||||
---
|
||||
Copyright (c) 2014, Guillermo López-Anglada. All rights reserved.
|
||||
Copyright 2015, the Dart project authors. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of this software nor the names of its
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -26,4 +28,4 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
26
vendor/licenses/grammar/language-closure-templates.txt
vendored
Normal file
26
vendor/licenses/grammar/language-closure-templates.txt
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
type: grammar
|
||||
name: language-closure-templates
|
||||
license: mit
|
||||
---
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Michael T. Hadley
|
||||
|
||||
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.
|
||||
34
vendor/licenses/grammar/sublime-shen.txt
vendored
Normal file
34
vendor/licenses/grammar/sublime-shen.txt
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
type: grammar
|
||||
name: sublime-shen
|
||||
license: bsd-3-clause
|
||||
---
|
||||
License
|
||||
------------
|
||||
|
||||
Copyright (c) 2017, Robert Koeninger
|
||||
All rights reserved.
|
||||
|
||||
https://opensource.org/licenses/BSD-3-Clause
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Reference in New Issue
Block a user