Commit 0ea29264 authored by Zack Wong's avatar Zack Wong
Browse files

Add comment blocks

parent e11003a5
/**brief**************************************************************/
/* */
/* MEMBER: PANE TYPE: C11SCE */
/* PROGRAMMER: COFFEE <[email protected]> */
/* */
/* PURPOSE: */
/* */
/*********************************************************************/
/**OUTLINE************************************************************/
/* */
/*********************************************************************/
/*********************************************************************/
/* INCLUDES */
/*********************************************************************/
#include "pane.h"
#define INPT A_UNDERLINE | COLOR_PAIR(6)
#define TEXT(c) A_PROTECT | COLOR_PAIR(c)
/*********************************************************************/
/* CONSTANT LITERALS */
/*********************************************************************/
#define HGT 23
struct {
/*********************************************************************/
/* FUNCTION DECLARATIONS */
/*********************************************************************/
void draw(Screen *scr);
/*********************************************************************/
/* LOCAL DECLARATIONS */
/*********************************************************************/
struct STATUS{
bool isInsert;
char inhibit[9];
char *inhibit;
}status = {
false,
"",
};
/*********************************************************************/
/* PANE_A100_DRAW */
/*********************************************************************/
void draw(Screen *scr) {
size_t oldy, oldx;
getyx(stdscr, oldy, oldx);
......@@ -70,42 +98,23 @@ void init() {
}
void draw_status(int y, int x) {
void draw_status() {
int x, y;
getyx(stdscr,y, x);
attron(TEXT(2));
mvhline(HGT,0,'_',80);
mvaddstr(HGT + 1, 8, status.inhibit);
mvaddstr(HGT + 1, 52, (status.isInsert ? "I" : "OVR"));
mvprintw(HGT+1, 74, "%02i,%02i", y + 1, x + 1);
standend();
move(y,x);
refresh();
}
#define TXTOPT "Option ===>"
#define TXTCMD "Command ===>"
#define TXTHDR "ISPF Primary Option Menu"
Field menuFlds[] = {
/* TYPE |ROW|COL|LEN| TXET | ATTR | NXT */
/******************* MENU BAR **********************/
{ BTN , 0, 3, 0,"Menu" , A_NORMAL , },
{ BTN , 0, 9, 0,"Utilities" , A_NORMAL , },
{ BTN , 0, 20, 0,"Compilers" , A_NORMAL , },
{ BTN , 0, 31, 0,"Options" , A_NORMAL , },
{ BTN , 0, 40, 0,"Status" , A_NORMAL , },
{ BTN , 0, 48, 0,"Help" , A_NORMAL , },
/******************** INPUTS ***********************/
{ INP , 3, 13, 66, "" , INPT , -1 },
/******************** LABELS ***********************/
{ LBL , 2, 28, 0,TXTHDR , TEXT(4) , },
{ LBL , 3, 1, 0,TXTOPT , TEXT(2) , },
/******************** RULERS ***********************/
{ RLR, 1, 1, 78, "q" , TEXT(4) , },
{END}
};
Screen* init_screen(Field *fields) {
Screen* buildScreen(Field *fields) {
Screen* scr;
scr = (Screen*) calloc(1, sizeof(Screen));
......@@ -119,24 +128,21 @@ Screen* init_screen(Field *fields) {
}
int start() {
int start(Screen *scr) {
init();
Screen *menu = init_screen(menuFlds);
draw(menu);
draw(scr);
int x, y;
move(3, 13);
getyx(stdscr,y, x);
draw_status(y, x);
draw_status();
int chr = mvinch(y,x); // save attr
chtype clr = chr & A_COLOR;
chtype attr = chr & A_ATTRIBUTES;
chgat(1, A_REVERSE | attr, 0, NULL); // set block
while (1) {
int ch = getch();
//chgat(1, attr, clr, NULL);
switch (ch) {
case KEY_LEFT:
......@@ -159,20 +165,29 @@ int start() {
case KEY_STAB:
case KEY_BTAB:
case KEY_END:
case 10:
case KEY_ENTER:
status.inhibit = "X - SYSTEM";
draw_status();
scr = scr->submit(scr);
status.inhibit = " ";
draw_status();
break;
case 'q':
goto cleanup;
default:
break;
}
addch(chr);
draw_status(y, x);
chr = mvinch(y,x); // save attr
clr = chr & A_COLOR;
attr = chr & A_ATTRIBUTES;
chgat(1, A_REVERSE | attr, 0, NULL);
refresh();
draw_status();
}
cleanup:
endwin();
return 0;
}
\ No newline at end of file
}
/**COPY***************************************************************/
/* */
/* COPYRIGHT (C) 2019 ZACK WONG */
/* THIS PROGRAM IS FREE SOFTWARE: YOU CAN REDISTRIBUTE IT AND/OR */
/* MODIFY IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS */
/* BIN PUBLISHED BY THE FREE SOFTWARE FOUNDATION, EITHER VERSION 3 */
/* OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. */
/* */
/* THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, */
/* BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF */
/* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE */
/* GNU GENERAL PUBLIC LICENSE FOR MORE DETAILS. */
/* */
/* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC */
/* LICENSE ALONG WITH THIS PROGRAM. IF NOT, SEE */
/* <HTTPS://WWW.GNU.ORG/LICENSES/>. */
/* */
/*********************************************************************/
/**BRIEF**************************************************************/
/* */
/* MEMBER : PANE TYPE: C11HDR */
/* PROGRAMMER : COFFEE DATE: 28 JUL 2019 */
/* CONTACT : <[email protected]> */
/* */
/* DESCRIPTION : ISPF MAIN MENU AND ENTRY POINT. */
/* */
/*********************************************************************/
/**OUTLINE************************************************************/
/* */
/*********************************************************************/
/**MAINTAINANCE HISTORY***********************************************/
/* DD MMM YYYY NNNNNNNNN <XXXXXXXXXXXXXXXXXXXXXXXXX> */
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
/* */
/*********************************************************************/
#ifndef PANE_H
#define PANE_H
/*********************************************************************/
/* INCLUDES */
/*********************************************************************/
#include <curses.h>
#include <stdint.h>
#include <malloc.h>
#include <string.h>
#include <stdbool.h>
/*********************************************************************/
/* PREPROCESSOR DEFS */
/*********************************************************************/
#define TEXT(c) A_PROTECT | COLOR_PAIR(c)
#define INPT A_UNDERLINE | COLOR_PAIR(6)
/*********************************************************************/
/* CONSTANT LITERALS */
/*********************************************************************/
#define LBL 0
#define BTN 1
#define RLR 2
#define INP 3
#define END 0b1111
/*********************************************************************/
/* TYPE DEFINITIONS */
/*********************************************************************/
typedef unsigned char byte;
typedef struct Field {
......@@ -38,10 +88,15 @@ typedef struct Screen {
Field* inps;
Mask cell[80][43];
void (*submit)(char*);
bool update;
struct Screen* (*submit)(struct Screen*);
}Screen;
extern int start();
void draw(Screen *scr);
#endif
\ No newline at end of file
/*********************************************************************/
/* EXPORTS */
/*********************************************************************/
extern void init();
extern int start(Screen* scr);
extern Screen* buildScreen(Field *fields);
#endif
......@@ -14,7 +14,7 @@ Field src/pane.h /^} Field;$/;" t typeref:struct:Field
HEADERS Makefile /^HEADERS = $(wildcard src\/*.h)$/;" m
HGT src/pane.c /^#define HGT /;" d file:
INP src/pane.h /^#define INP /;" d
INPT src/pane.c /^#define INPT /;" d file:
INPT src/pane.h /^#define INPT /;" d
LBL src/pane.h /^#define LBL /;" d
Mask src/pane.h /^typedef struct Mask {$/;" s
Mask src/pane.h /^}Mask;$/;" t typeref:struct:Mask
......@@ -23,14 +23,12 @@ PANE_H src/pane.h /^#define PANE_H$/;" d
PROJECT Makefile /^PROJECT = icpl$/;" m
RLR src/pane.h /^#define RLR /;" d
SRC Makefile /^SRC = $(wildcard src\/*.c)$/;" m
STATUS src/pane.c /^struct STATUS{$/;" s file:
Screen src/pane.h /^typedef struct Screen {$/;" s
Screen src/pane.h /^}Screen;$/;" t typeref:struct:Screen
TEXT src/pane.c /^#define TEXT(/;" d file:
TXTCMD src/pane.c /^#define TXTCMD /;" d file:
TXTHDR src/pane.c /^#define TXTHDR /;" d file:
TXTOPT src/pane.c /^#define TXTOPT /;" d file:
__anon7198f2f10108 src/pane.c /^struct {$/;" s file:
TEXT src/pane.h /^#define TEXT(/;" d
attr src/pane.h /^ chtype attr;$/;" m struct:Field typeref:typename:chtype
buildScreen src/pane.c /^Screen* buildScreen(Field *fields) {$/;" f typeref:typename:Screen *
byte src/pane.h /^typedef unsigned char byte;$/;" t typeref:typename:unsigned char
callback src/pane.h /^ void* (*callback)(char*);$/;" m struct:Field typeref:typename:void * (*)(char *)
cell src/pane.h /^ Mask cell[80][43];$/;" m struct:Screen typeref:typename:Mask[80][43]
......@@ -38,17 +36,14 @@ clean Makefile /^clean:$/;" t
debug Makefile /^debug: $(PROJECT)$/;" t
debug Makefile /^debug: CFLAGS += -g$/;" t
draw src/pane.c /^void draw(Screen *scr) {$/;" f typeref:typename:void
draw_status src/pane.c /^void draw_status(int y, int x) {$/;" f typeref:typename:void
draw_status src/pane.c /^void draw_status() {$/;" f typeref:typename:void
fldid src/pane.h /^ short fldid;$/;" m struct:Mask typeref:typename:short
flds src/pane.h /^ Field* flds;$/;" m struct:Screen typeref:typename:Field *
inhibit src/pane.c /^ char inhibit[9];$/;" m struct:__anon7198f2f10108 typeref:typename:char[9] file:
inhibit src/pane.c /^ char *inhibit;$/;" m struct:STATUS typeref:typename:char * file:
init src/pane.c /^void init() {$/;" f typeref:typename:void
init_screen src/pane.c /^Screen* init_screen(Field *fields) {$/;" f typeref:typename:Screen *
inps src/pane.h /^ Field* inps;$/;" m struct:Screen typeref:typename:Field *
isInsert src/pane.c /^ bool isInsert;$/;" m struct:__anon7198f2f10108 typeref:typename:bool file:
isInsert src/pane.c /^ bool isInsert;$/;" m struct:STATUS typeref:typename:bool file:
len src/pane.h /^ , len;$/;" m struct:Field typeref:typename:size_t
main src/pane.c /^int main() {$/;" f typeref:typename:int
menuFlds src/pane.c /^Field menuFlds[] = {$/;" v typeref:typename:Field[]
nxfld src/pane.h /^ short nxfld;$/;" m struct:Field typeref:typename:short
obj/ Makefile /^obj\/:$/;" t
obj/%.o Makefile /^obj\/%.o : %.c $(HEADERS) | obj\/$/;" t
......@@ -59,10 +54,12 @@ profile Makefile /^profile: CFLAGS += -g -pg$/;" t
rebuild Makefile /^rebuild: clean release$/;" t
release Makefile /^release: $(PROJECT)$/;" t
release Makefile /^release: CFLAGS += -O3$/;" t
status src/pane.c /^}status = {$/;" v typeref:struct:__anon7198f2f10108
submit src/pane.h /^ void (*submit)(char*);$/;" m struct:Screen typeref:typename:void (*)(char *)
start src/pane.c /^int start(Screen *scr) {$/;" f typeref:typename:int
status src/pane.c /^}status = {$/;" v typeref:struct:STATUS
submit src/pane.h /^ struct Screen* (*submit)(struct Screen*);$/;" m struct:Screen typeref:struct:Screen * (*)(struct Screen *)
text src/pane.h /^ char* text;$/;" m struct:Field typeref:typename:char *
type src/pane.h /^ byte type : 4;$/;" m struct:Field typeref:typename:byte:4
type src/pane.h /^ char type:4;$/;" m struct:Mask typeref:typename:char:4
update src/pane.h /^ bool update;$/;" m struct:Screen typeref:typename:bool
x src/pane.h /^ , x : 16$/;" m struct:Field typeref:typename:size_t:16
y src/pane.h /^ size_t y : 16$/;" m struct:Field typeref:typename:size_t:16
/**COPY***************************************************************/
/* */
/* COPYRIGHT (C) 2019 ZACK WONG */
/* THIS PROGRAM IS FREE SOFTWARE: YOU CAN REDISTRIBUTE IT AND/OR */
/* MODIFY IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS */
/* BIN PUBLISHED BY THE FREE SOFTWARE FOUNDATION, EITHER VERSION 3 */
/* OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. */
/* */
/* THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, */
/* BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF */
/* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE */
/* GNU GENERAL PUBLIC LICENSE FOR MORE DETAILS. */
/* */
/* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC */
/* LICENSE ALONG WITH THIS PROGRAM. IF NOT, SEE */
/* <HTTPS://WWW.GNU.ORG/LICENSES/>. */
/* */
/*********************************************************************/
/**BRIEF**************************************************************/
/* */
/* MEMBER : MAIN TYPE: C11SCE */
/* PROGRAMMER : COFFEE DATE: 28 JUL 2019 */
/* CONTACT : <[email protected]> */
/* */
/* DESCRIPTION : ISPF MAIN MENU AND ENTRY POINT. */
/* */
/*********************************************************************/
/**OUTLINE************************************************************/
/* */
/*********************************************************************/
/**MAINTAINANCE HISTORY***********************************************/
/* DD MMM YYYY NNNNNNNNN <XXXXXXXXXXXXXXXXXXXXXXXXX> */
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
/* */
/*********************************************************************/
/*********************************************************************/
/* INCLUDES */
/*********************************************************************/
#include "../../icpl/src/pane.h"
#include <stdbool.h> /* STDLIB BOOLEANS TYPE */
/*********************************************************************/
/* PREPROCESSOR DEFS */
/*********************************************************************/
/*********************************************************************/
/* CONSTANT LITERALS */
/*********************************************************************/
#define TXTOPT "Option ===>"
#define TXTCMD "Command ===>"
#define TXTHDR "ISPF Primary Option Menu"
enum FLDNUM {
BTN0,
BTN1,
BTN2,
BTN3,
BTN4,
BTN5,
INP0,
OUT0
} ;
/*********************************************************************/
/* FUNCTION DECLARATIONS */
/*********************************************************************/
Screen* MAIN_A100_SUBMIT (Screen*);
void MAIN_B130_GET_NEXT_SCREEN ();
void MAIN_B120_VALIDATE_MENU ();
/*********************************************************************/
/* LOCAL DECLARATIONS */
/*********************************************************************/
Field MENUFLDS[] = { /* ISPF PRIMARY OPTION MENU */
/*FLDID | TYPE |ROW|COL|LEN| TEXT | ATTR | NXT */
/************************ MENU BAR **************************/
[BTN0] = { BTN , 0, 3, 0,"Menu" , A_NORMAL , },
[BTN1] = { BTN , 0, 9, 0,"Utilities" , A_NORMAL , },
[BTN2] = { BTN , 0, 20, 0,"Compilers" , A_NORMAL , },
[BTN3] = { BTN , 0, 31, 0,"Options" , A_NORMAL , },
[BTN4] = { BTN , 0, 40, 0,"Status" , A_NORMAL , },
[BTN5] = { BTN , 0, 48, 0,"Help" , A_NORMAL , },
/************************* INPUTS ***************************/
[INP0] = { INP , 3, 13, 66, "" , INPT , -1 },
/************************* LABELS ***************************/
[OUT0] = { LBL , 3, 1, 0, "" , TEXT(2) , },
/*AUTO*/ { LBL , 2, 28, 0,TXTHDR , TEXT(4) , },
/*AUTO*/ { LBL , 3, 1, 0,TXTOPT , TEXT(2) , },
/************************* RULERS ***************************/
/*AUTO*/ { RLR, 1, 1, 78, "q" , TEXT(4) , },
/*AUTO*/ {END}
};
int main() {
/*********************************************************************/
/* WK_STORAGE */
/*********************************************************************/
bool WK_IS_VALID;
start();
/*********************************************************************/
/* MAIN_A000_INIT */
/*********************************************************************/
#define MAIN_A000_INIT main
int MAIN_A000_INIT() {
init();
Screen *mainmenu = buildScreen(MENUFLDS);
mainmenu->submit = MAIN_A100_SUBMIT;
start(mainmenu);
return 0;
}
\ No newline at end of file
} /* MAIN_A000_INIT */
/*********************************************************************/
/* MAIN_MAINMENU_UPD */
/*********************************************************************/
/*********************************************************************/
/* MAIN_A100_SUBMIT */
/*********************************************************************/
Screen* MAIN_A100_SUBMIT (Screen* self) {
int y, x;
getyx(stdscr, y, x);
if (self->cell[y][x].type == BTN){
/* MAIN_A110_ADD_SUBMENU();*/
return self;
}
MAIN_B120_VALIDATE_MENU();
if (WK_IS_VALID) {
MAIN_B130_GET_NEXT_SCREEN();
}
else {
}
return self;
} /* MAIN_A100_SUBMIT */
/*********************************************************************/
/* MAIN_B120_VALIDATE_MENU */
/*********************************************************************/
void MAIN_B120_VALIDATE_MENU (){
return;
} /* MAIN_B120_VALIDATE_MENU */
/*********************************************************************/
/* MAIN_B130_GET_NEXT_SCREEN */
/*********************************************************************/
void MAIN_B130_GET_NEXT_SCREEN (){
return;
} /* MAIN_B130_GET_NEXT_SCREEN */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment