Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
work on parsers, dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
GeneralGuy4872 committed Sep 28, 2019
1 parent 50f7fd6 commit 67553bb
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 134 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@ Depends (libraries by header):
- <CODE>\<string.h\></CODE>
- <CODE>\<ctype.h\></CODE>
- <CODE>\<uchar.h\></CODE>

- <CODE>\<dlfcn.h\></CODE>
- <CODE>\<unistd.h\></CODE>
- <CODE>\<signal.h\></CODE>
- <CODE>\<locale.h\></CODE>
- <CODE>\<regex.h\></CODE>
- <CODE>\<glob.h\></CODE>
- <CODE>\<sys/types.h\></CODE>
- <CODE>\<sys/ioctl.h\></CODE>
- <CODE>\<fcntl.h\></CODE>
- <CODE>\<sys/stat.h\></CODE>

- <CODE>\<regex.h\></CODE> probably
- <CODE>\<glob.h\></CODE> probably
- <CODE>\<sys/types.h\></CODE> maybe?
- <CODE>\<sys/ioctl.h\></CODE> maybe?
- <CODE>\<fcntl.h\></CODE> probably
- <CODE>\<sys/stat.h\></CODE> probably
- <CODE>\<errno.h\><\CODE> maybe?
- <CODE>\<libtar.h\></CODE>
- <CODE>\<zlib.h\></CODE>
- <CODE>\<libbz2.h\></CODE>

- <CODE>\<ncursesw/ncurses.h\></CODE>
- <CODE>\<menu.h\></CODE>
- <CODE>\<forms.h\></CODE>
- <CODE>\<menu.h\></CODE> maybe?
- <CODE>\<forms.h\></CODE> maybe?

Recommends:
- <CODE>xterm</CODE>, unicode, color
Expand All @@ -83,8 +81,9 @@ Doc Depends:
- <CODE>man</CODE>
- <CODE>info</CODE>

Doc Meta-depends:
Doc Build Deps:
- <CODE>mandb</CODE>
- <CODE>makeinfo</CODE>
- <CODE>install-info</CODE>
- <CODE>cp</CODE>

Expand Down
16 changes: 9 additions & 7 deletions manual/plaintext/midibasic
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
slightly depricated

/*
syntax:

SPEED <HEX/OCTAL/NUMBER> : number of pulses per second. there are 24 pulses in a quarter note.
SPEED <NUMBER> : number of pulses per second. there are 24 pulses in a quarter note.

VOLUME <HEX/OCTAL/NUMBER channel> <HEX/OCTAL/NUMBER volume> : set how loud a channel is
VOLUME <NUMBER channel> <NUMBER volume> : set how loud a channel is

SPEED++ <HEX/OCTAL/NUMBER channel amount> , VOLUME++ <HEX/OCTAL/NUMBER channel amount> , DETUNE++ <HEX/OCTAL/NUMBER channel> <HEX/OCTAL/NUMBER channel amount> : increase a paramater
SPEED++ <NUMBER> , VOLUME++ <NUMBER channel> <NUMBER amount> , DETUNE++ <NUMBER channel> <NUMBER amount> : increase a paramater

SPEED-- <HEX/OCTAL/NUMBER channel amount> , VOLUME-- <HEX/OCTAL/NUMBER channel amount> , DETUNE-- <HEX/OCTAL/NUMBER channel> <HEX/OCTAL/NUMBER channel amount> : decrease a paramater
SPEED-- <NUMBER> , VOLUME-- <NUMBER channel> <NUMBER amount> , DETUNE-- <NUMBER channel> <NUMBER amount> : decrease a paramater

MUTE <HEX/OCTAL/NUMBER channel> : set volume to zero
MUTE <NUMBER channel> : set volume to zero

FORTE <HEX/OCTAL/NUMBER channel> : set volume to maximum
FORTE <NUMBER channel> : set volume to maximum

KEY <HEX/OCTAL/NUMBER channel> <KEYSIG> : change the key. default key is C major

Expand Down Expand Up @@ -43,4 +45,4 @@ LOOP
REPEAT : loop a portion of the song indefinately.

RAW <HEX> : a raw packet
*/
*/
13 changes: 6 additions & 7 deletions src/extensionlanguage/extensionlang.lex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ BOOLEAN ("T"|[Tt]("RUE"|"rue")|[Nn]("IL"|"il")|[Ff]("ALSE"|"alse"))
NAME [A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]*
VAR $([A-SU-Za-z]|[A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]+)
PTRVAR [\*&]+([A-SU-Za-z]|[A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]+)
NUMBER [0-9]+
SIGNED -[0-9]+
NUMBER -?[0-9]+
FLOAT -?([0-9]+)?\.[0-9]+
NANTOK (-?[Ii]("NFINITY"|"nfinity")|[Nn][Aa][Nn])
HEX ("0x")[0-9a-fA-F]+
Expand Down Expand Up @@ -102,13 +101,12 @@ FI [Ff][Ii]
{NAME} yyval.string = strdup(yytext);return(NAME);
{VAR} yyval.string = strdup(&(yytext[1]));return(VAR);
{PTRVAR} yyval.string = strdup(yytext);return(VAR);
{NUMBER} yyval.number = strtoul(yytext,NULL,10);return(NUMBER);
{SIGNED} yyval.number = atoi(yytext);return(SIGNED);
{NUMBER} yyval.number = atoi(yytext);return(NUMBER);
{FLOAT} yyval.dval = atof(yytext);return(FLOAT);
{NANTOK} yyval.dval = atof(yytext);return(NANTOK);
{HEX} yyval.number = strtoul(yytext,NULL,16);return(RAW);
{OCTAL} yyval.number = strtoul(yytext,NULL,8);return(RAW);
{BOOLEAN} yyval.number = !(strcmp(yytext,"T") || strcmp(toupper(yytext),"TRUE"));return(BOOLEAN);
{HEX} yyval.deadbeef = strtoul(yytext,NULL,16);return(RAW);
{OCTAL} yyval.deadbeef = strtoul(yytext,NULL,8);return(RAW);
{BOOLEAN} yyval.boolean = !(strcmp(yytext,"T") || strcmp(toupper(yytext),"TRUE"));return(BOOLEAN);
{ERRVAL} yyval.number = -(!(strcmp(toupper(yytext),"ERR"))));return(ERRVAL);
{NULLTOK} return(NULLTOK);
"+" return '+';
Expand Down Expand Up @@ -136,6 +134,7 @@ FI [Ff][Ii]
{APPROX} return(APPROX);
{BITNOR} return(BITNOR);
"~" return '~';
"¬" return "~";
{LOGAND} return(LOGAND);
"&" return '&';
{LOGOR} return(LOGOR);
Expand Down
24 changes: 12 additions & 12 deletions src/extensionlanguage/extensionlang.y
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
%token LSTRUCT STRUCTPTR BITLEFT LE BITRIGHT GE LOGAND LOGOR LOGNAND LOGNOR LOGIFF LOGXOR EQ EQUALS APPROX BITNOR NE ASSIGN NULLTOK HUP SWITCH CASE IF THEN ELSE WHILE UNTIL FOR FOREVER DO AFTER BREAK RETURN FI BEGIN END
%token <number> BOOLEAN RAW NUMBER SIGNED ERRVAL
%token <number> NUMBER ERRVAL
%token <deadbeef> RAW
%token <boolean> BOOLEAN
%token <string> NAME VAR TEXT UTF8 TYPENAME
%token <dval> FLOAT NANTOK
%token <dval> FLOAT NANTOK

%top {
#include stuff here
Expand All @@ -10,9 +12,12 @@

%union
{
intptr_t number;
bool boolean;
int number;
char* string;
double dval;
intptr_t deadbeef;
void* ptr;
}

%%
Expand Down Expand Up @@ -52,7 +57,7 @@ variable
: VAR {$$ = runtime__fetch($1)}
| variable STRUCTPTR NAME {$$ = runtime__struct_pointer($1,$3)}
| variable '.' NAME {$$ = runtime__struct($1,$3)}
| variable '[' unsigned ']' {$$ = runtime__arraysub($1,$3)}
| variable '[' intergaliteral ']' {$$ = runtime__arraysub($1,$3)}
| variable '[' literalparenth ']' {$$ = runtime__arraysub($1,$3)}
| variable '[' anything ']' {$$ = runtime__arraysub_noncon($1,$3)}
;
Expand Down Expand Up @@ -109,16 +114,11 @@ intergal
;

intergaliteral
: SIGNED
: NUMBER
| BOOLEAN
| RAW
| ERRVAL
| NULLTOK {$$ = NULL}
| unsigned
;

unsigned
: BOOLEAN
| RAW
| NUMBER
;

real
Expand Down
3 changes: 2 additions & 1 deletion src/extensionlanguage/precedanceprelim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
→ multiplication, bitwise and
← modulo
← tetriation, expotentiation
→ factorial
← negative, not, bitwise not, prefix ++, --
X functions, parenthases

(note: pointers and derefs are either a cast or part of the variable token itself)
(note: pointers and derefs are either a cast or part of the variable token itself)
90 changes: 46 additions & 44 deletions src/iwannaflycurses.messy
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,38 @@
*
* a game compiled for the engine should obey the following conventions:
* - it should provide the bulk of it's functions in a shared library in a private
* application directory
* application directory
* - it should provide special use functions, such as events, as seperate shared objects,
* to be dynamically loaded at runtime.
* to be dynamically loaded at runtime.
* - it should provide special use constants likewise
* blocks of text, however, should be regular nfo or txt
* blocks of text, however, should be regular nfo or txt
* - it should store any dynamic constants in the savefile, as r<wordsize>, hex, tsv, csv, ini, txt, nfo
* - it should provide at least the following applications (in $PATH) :
* - the game itself
* - a seperate program for generating a new savefile
* - the game itself
* - a seperate program for generating a new savefile
* - should use (int argc, char *argv[]) to provide bypassing of dotfile,
* path to a non-default dotfile, overrides of race, class, alignment prefs,
* and other flags as desired. parsed by a different parser from the dotfile.
* - a savefile editor
* - a savefile editor
*
* enviromental requirements:
* - UTF-8 terminal of at least 24*80 characters
* "Fixed" font is recommended (specifically because
* it is a raster font; monospaced raster fonts are more uniform in width than the majority of vector so-called "monospaced" fonts;
* it is unicode, having a wide range of characters; and
* it is extreamly common, being the default font for the linux console, xterm, and urxvt)
* it is a raster font; monospaced raster fonts are more uniform in width than the majority of vector so-called "monospaced" fonts;
* it is unicode, having a wide range of characters; and
* it is extreamly common, being the default font for the linux console, xterm, and urxvt)
* - ANSI SGR escape codes and 16 colors outside of NCurses
* The engine will recognise the term enviroment and can sent xterm-style OSC strings if they are supported as well
* - NCurses with support for A_BOLD, A_ITALIC, A_UNDERLINE, A_DIM, A_BLINK, A_REVERSE, A_INVIS, 8 colors, and 64 color pairs
* - Full Keyboard
* (most keyboard layouts with all ASCII characters *should*
* work, but only QWERTY (US-ANSI) was used in design because
* I don't have access to any others, so at best controls may
* be strange on them.
* want to eventually guaruntee support for other keymappings;
* not just for other QWERTY layouts, but also for QWERTZ, AZERTY,
* and Dvorak, by request and/or the ability to remap keys
* by dotfiles.)
* (most keyboard layouts with all ASCII characters *should*
* work, but only QWERTY (US-ANSI) was used in design because
* I don't have access to any others, so at best controls may
* be strange on them.
* want to eventually guaruntee support for other keymappings;
* not just for other QWERTY layouts, but also for QWERTZ, AZERTY,
* and Dvorak, by request and/or the ability to remap keys
* by dotfiles.)
* - Mouse (once pseudo-raycasting is implemented for looking afar)
*
* XTerm is the recommended X Terminal Emulator (the primary one used in testing),
Expand Down Expand Up @@ -102,11 +102,11 @@
* This program is divided into 3 layers:
*
* the API layer is the part that provides functions to help with events.
* this is the only part you should need to know to compile your own
* games that can get fairly complex. these alse include the internal
* utilitys for character encoding conversion, input buffering, room
* generation and pathfinding algorithems, dice, warping, dying, error,
* and the internal implementation of cat.
* this is the only part you should need to know to compile your own
* games that can get fairly complex. these alse include the internal
* utilitys for character encoding conversion, input buffering, room
* generation and pathfinding algorithems, dice, warping, dying, error,
* and the internal implementation of cat.
*
* while the API functions have a simple enough calling convention,
* there is no garuntee that the code underneath is not hundreds of lines long.
Expand All @@ -121,24 +121,24 @@
* engineloop()
*
* the middle layer, or the guts, is where the engine actually happens, and
* it isn't pretty. if you want to change how the game works,
* it's going to get messy. this is where the functions for
* the RPG system itself, loading and saving, turns, shadows,
* 3D rendering, and room changing are placed. these should not
* usually called directly by events, only by other builtin
* it isn't pretty. if you want to change how the game works,
* it's going to get messy. this is where the functions for
* the RPG system itself, loading and saving, turns, shadows,
* 3D rendering, and room changing are placed. these should not
* usually called directly by events, only by other builtin
* functions; some are only called by main.
*
* the backend consists of shims between generalized internal representations of
* a thing, and the actual way that a library or driver expects it to be
* formatted. the following are/will be considered part of this layer:
* a thing, and the actual way that a library or driver expects it to be
* formatted. the following are/will be considered part of this layer:
* - anything underneath a call to a parser
* - what goes on inside of the midi threads
* - the code underneath the savefile handling calls
*
* The API should always be backwards-compatable with all versions, from beta to doomsday.
* The Guts may have breaking changes between MAJOR versions, but not otherwise.
* The Backend depends on things beyond my control, and should be considered non-dependable.
* special cases should be noted, that the savefile format and language version have
* special cases should be noted, that the savefile format and language version have
* their own versioning system. this still may be broken if the flex-yacc or
* compression libraries of the build enviroment are changed from expectations,
* but is a good start.
Expand Down Expand Up @@ -191,6 +191,7 @@
//#include <sys/ioctl.h>
//#include <fcntl.h>
//#include <sys/stat.h>
//#include <errno.h>

/**compression libraries**/
#include <libtar.h>
Expand Down Expand Up @@ -242,16 +243,17 @@ addnwstr(&wch,1);
* using narrow characters with printw or addch
* using wide characters with these functions
* setting attributes with attrset, attron, attroff, and chgat
* uses A_DIM, A_BOLD, A_ITALIC, A_UNDERLINE, A_REVERSE, A_BLINK, A_INVIS,
* and 64 color pairs made from 8 colors
* uses A_DIM, A_BOLD, A_ITALIC, A_UNDERLINE, A_REVERSE, A_BLINK, A_INVIS,
* and 64 color pairs made from 8 colors
* using the above custom functions to put wide characters on
* the screen using addstr, addnstr, addwstr, addnwstr to print strings
* pausing curses and dumping an entire file with printf
*/

/*ENVIROMENTALS*/
#define BUFFER_MAX 512
#define FLOPPYDISK 1474560
#define FLOPPYSIZE 1474560
#define DRUMSIZE 16384
#define BGCOLORS 8
#define FGCOLORS 8
char16_t TILDEWIDE
Expand Down Expand Up @@ -326,15 +328,15 @@ char* TERM

//anonomous pointers, could be anything. they're anonomous.
struct drum {
char data[FLOPPYDISK]
smint top
char data[DRUMSIZE]
sshort top
}

void* drumalloc (ptr,amount)
struct drum ptr
size_t amount
{
if ((ptr→top + amount) ≤ (FLOPPYDISK + 1)) {
if ((ptr→top + amount) ≤ (DRUMSIZE)) {
void* output = ptr→data[ptr→top]
ptr→top += amount
return output
Expand Down Expand Up @@ -1736,14 +1738,14 @@ bool sleepproof : 1
bool poisonproof : 1

struct sensetyp:
trouble
invis
infra
blind
good
evil
law
chaos
bool trouble : 1
bool invis : 1
bool infra : 1
bool blind : 1
bool good : 1
bool evil : 1
bool law : 1
bool chaos : 1

struct effectyp:
the8stats eight
Expand Down
Loading

0 comments on commit 67553bb

Please sign in to comment.