"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/readconfig.cpp" between
bed-3.0.3.src.tar.xz and bed-3.1.0.src.tar.xz

About: bed is an adjustable data format binary editor.

readconfig.cpp  (bed-3.0.3.src.tar.xz):readconfig.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 46 skipping to change at line 46
#endif #endif
extern int newfilesize; extern int newfilesize;
extern char macrodirectory[]; extern char macrodirectory[];
extern char datatypedirectory[] ; extern char datatypedirectory[] ;
extern char bedrcbin[]; extern char bedrcbin[];
#ifndef NOATTRIBUTES #ifndef NOATTRIBUTES
struct nametonum {char lab[8];int num;} colo[] = { {"black",COLOR_BLACK}, {"red" ,COLOR_RED}, {"green",COLOR_GREEN}, {"yellow",COLOR_YELLOW}, {"blue",COLOR_BLUE} , {"magentA",COLOR_MAGENTA}, {"cyan",COLOR_CYAN}, {"white",COLOR_WHITE},{"defaul t",-1}}; struct nametonum {char lab[8];int num;} colo[] = { {"black",COLOR_BLACK}, {"red" ,COLOR_RED}, {"green",COLOR_GREEN}, {"yellow",COLOR_YELLOW}, {"blue",COLOR_BLUE} , {"magentA",COLOR_MAGENTA}, {"cyan",COLOR_CYAN}, {"white",COLOR_WHITE},{"defaul t",-1}};
int nrcolors=sizeof(colo)/sizeof(struct nametonum); int nrcolors=sizeof(colo)/sizeof(struct nametonum);
struct attr { struct attr {
char lab[12]; const char lab[12];
int num; const chtype num;
char des[80]; const char des[80];
}; };
struct attr at[] = { struct attr at[] = {
{"normal",A_NORMAL,"Normal display (no highlight)"}, {"normal",A_NORMAL,"Normal display (no highlight)"},
{"standout",A_STANDOUT,"Best highlighting mode of the terminal."}, {"standout",A_STANDOUT,"Best highlighting mode of the terminal."},
{"underline",A_UNDERLINE,"Underlining"}, {"underline",A_UNDERLINE,"Underlining"},
{"reverse",A_REVERSE,"Reverse video"}, {"reverse",A_REVERSE,"Reverse video"},
{"blink",A_BLINK,"Blinking"}, {"blink",A_BLINK,"Blinking"},
{"dim",A_DIM,"Half bright"}, {"dim",A_DIM,"Half bright"},
{"bold",A_BOLD,"Extra bright or bold"}, {"bold",A_BOLD,"Extra bright or bold"},
{"protect",A_PROTECT,"Protected mode"}, {"protect",A_PROTECT,"Protected mode"},
skipping to change at line 70 skipping to change at line 70
{"altcharset",A_ALTCHARSET,"Alternate character set"}, {"altcharset",A_ALTCHARSET,"Alternate character set"},
{"chartext",A_CHARTEXT,"Bit-mask to extract a character"}}; {"chartext",A_CHARTEXT,"Bit-mask to extract a character"}};
int nrattr=sizeof(at)/sizeof(struct attr); int nrattr=sizeof(at)/sizeof(struct attr);
//s/{\([^}]*\)}/setfield(\1)/g //s/{\([^}]*\)}/setfield(\1)/g
#define setfield(name,var,col) {name,var,col,-1,-1} #define setfield(name,var,col) {name,var,col,-1,-1}
#ifdef COMPILECOLORS #ifdef COMPILECOLORS
#define setcolorfield(name,forg,backg,attr,col) {name,attr,col,forg,backg} #define setcolorfield(name,forg,backg,attr,col) {name,attr,col,forg,backg}
Fieldcol fieldcolor[] = { Fieldcol fieldcolor[] = {
setfield("text",0,1), setfield("text",0,1),
setfield("command",A_REVERSE,2), setfield("command",A_REVERSE,2),
#ifdef PDCURSES
//setcolorfield("bar",COLOR_RED,COLOR_WHITE|A_REVERSE,0,3),
setcolorfield("bar",COLOR_WHITE,COLOR_BLUE,A_BOLD,3),
#else
setcolorfield("bar",COLOR_WHITE,COLOR_BLUE,0,3), setcolorfield("bar",COLOR_WHITE,COLOR_BLUE,0,3),
#endif
#ifdef PDCURSES
setcolorfield("barkey",COLOR_BLACK,COLOR_WHITE,A_BOLD|A_UNDERLINE,4),
#else
setcolorfield("barkey",COLOR_BLUE,COLOR_YELLOW,A_BOLD|A_REVERSE,4), setcolorfield("barkey",COLOR_BLUE,COLOR_YELLOW,A_BOLD|A_REVERSE,4),
#endif
#ifdef PDCURSES
setcolorfield("menu",COLOR_WHITE,COLOR_BLUE, A_BOLD ,5),
#else
setcolorfield("menu",COLOR_WHITE,COLOR_BLUE, A_NORMAL ,5),
#endif
setcolorfield("menu",COLOR_WHITE,COLOR_BLUE,A_NORMAL,5), #ifdef PDCURSES
setcolorfield("menukey",COLOR_GREEN,COLOR_BLACK,A_REVERSE,6),
#else
setcolorfield("menukey",COLOR_BLUE,COLOR_YELLOW,A_BOLD|A_REVERSE,6), setcolorfield("menukey",COLOR_BLUE,COLOR_YELLOW,A_BOLD|A_REVERSE,6),
#endif
setcolorfield("menusel",COLOR_WHITE,COLOR_BLUE,A_REVERSE,7), setcolorfield("menusel",COLOR_WHITE,COLOR_BLUE,A_REVERSE,7),
setcolorfield("opentitle",COLOR_BLACK,COLOR_WHITE,A_BOLD,8), setcolorfield("opentitle",COLOR_BLACK,COLOR_WHITE,A_BOLD,8),
setcolorfield("openkey",COLOR_WHITE,COLOR_GREEN,A_BOLD|A_REVERSE,9), setcolorfield("openkey",COLOR_WHITE,COLOR_GREEN,A_BOLD|A_REVERSE,9),
#ifdef _WIN32 #ifdef _WIN32
setcolorfield("opennormal",COLOR_BLACK,COLOR_CYAN,A_NORMAL,10), setcolorfield("opennormal",COLOR_MAGENTA,COLOR_YELLOW,A_REVERSE|A_BOLD,10),
setcolorfield("openlist",COLOR_CYAN,COLOR_MAGENTA,A_BOLD,11), //setcolorfield("openlist",COLOR_CYAN,COLOR_MAGENTA,A_BOLD,11),
setcolorfield("openlistsel",COLOR_YELLOW,COLOR_BLACK,A_NORMAL,12), setcolorfield("openlist",COLOR_RED,COLOR_BLACK,A_BOLD|A_REVERSE,11),
setcolorfield("openlistact",COLOR_YELLOW,COLOR_GREEN,A_BOLD,13),
setcolorfield("openlistsel",COLOR_BLACK,COLOR_YELLOW,A_NORMAL,12),
//setcolorfield("openlistact",COLOR_YELLOW,COLOR_GREEN,A_BOLD,13),
setcolorfield("openlistact",COLOR_BLACK,COLOR_CYAN,A_NORMAL,13),
#else #else
setcolorfield("opennormal",COLOR_WHITE,COLOR_MAGENTA,A_BOLD,10), setcolorfield("opennormal",COLOR_WHITE,COLOR_MAGENTA,A_BOLD,10),
setcolorfield("openlist",COLOR_BLACK,COLOR_CYAN,A_BOLD,11), setcolorfield("openlist",COLOR_BLACK,COLOR_CYAN,A_BOLD,11),
setcolorfield("openlistsel",COLOR_GREEN,COLOR_MAGENTA,A_NORMAL,12), setcolorfield("openlistsel",COLOR_GREEN,COLOR_MAGENTA,A_NORMAL,12),
setcolorfield("openlistact",COLOR_RED,COLOR_WHITE,A_BOLD|A_REVERSE,13), setcolorfield("openlistact",COLOR_RED,COLOR_WHITE,A_BOLD|A_REVERSE,13),
#endif #endif
setcolorfield("showback",COLOR_BLUE,COLOR_WHITE,0,14), setcolorfield("showback",COLOR_BLUE,COLOR_WHITE,0,14),
setfield("selection",A_REVERSE,15), setfield("selection",A_REVERSE,15),
setcolorfield("cursor",COLOR_RED, COLOR_YELLOW,A_STANDOUT|A_BOLD|A_BLINK,16), setcolorfield("cursor",COLOR_RED, COLOR_YELLOW,A_STANDOUT|A_BOLD|A_BLINK,16),
setfield("selcursor",A_REVERSE|A_BLINK,17), setfield("selcursor",A_REVERSE|A_BLINK,17),
skipping to change at line 165 skipping to change at line 189
int colornr(char *name) { int colornr(char *name) {
int i; int i;
for(i=0;i<nrcolors;i++) { for(i=0;i<nrcolors;i++) {
if(!strcasecmp(colo[i].lab,name)) if(!strcasecmp(colo[i].lab,name))
return colo[i].num; return colo[i].num;
} }
return -2; return -2;
} }
#define NOATTR 0x4fff #define NOATTR 0x4fff
int attrnr(char *attr){ chtype attrnr(char *attr){
for(int i=0;i<nrattr;i++) for(int i=0;i<nrattr;i++)
if(!strcasecmp(at[i].lab,attr)) if(!strcasecmp(at[i].lab,attr))
return at[i].num; return at[i].num;
return 0; return 0;
} }
int getattr(char *str) { chtype getattr(char *str) {
if(!str) if(!str)
return 0; return 0;
char *at=next(str); char *at=next(str);
int val=getattr(at); chtype val=getattr(at);
int att=attrnr(str); chtype att=attrnr(str);
return val+((att==NOATTR)?0:att); return val+((att==NOATTR)?0:att);
} }
#define MESSSIZE 256 #define MESSSIZE 256
char mess[MESSSIZE]; char mess[MESSSIZE];
#include "varmacro.h" #include "varmacro.h"
#ifdef OLDGCCVARMACRO #ifdef OLDGCCVARMACRO
#define configmessage(for...) snprintf(mess,MESSSIZE,##for) VARMACRO #define configmessage(for...) snprintf(mess,MESSSIZE,##for) VARMACRO
#else #else
skipping to change at line 289 skipping to change at line 313
init_pair(colornr,COLOR_GREEN,COLOR_BLUE); init_pair(colornr,COLOR_GREEN,COLOR_BLUE);
textsameback=(fieldcolor[0].var&(~A_COLOR)) |COLOR_PAIR(colornr); textsameback=(fieldcolor[0].var&(~A_COLOR)) |COLOR_PAIR(colornr);
*/ */
#endif #endif
return 0; return 0;
} }
int makeattr(char *str) { int makeattr(char *str) {
if(!str) if(!str)
return -1; return -1;
char *fore,*back; char *fore,*back;
int val,i; chtype val;
int i;
for(;isspace(*str);str++) for(;isspace(*str);str++)
; ;
if(!*str||*str=='#') { if(!*str||*str=='#') {
return 1; return 1;
} }
if(!(fore=next(str))) { if(!(fore=next(str))) {
configmessage("Error after %s",str); configmessage("Error after %s",str);
return -1; return -1;
} }
for(i=0;i<colortypes;i++) { for(i=0;i<colortypes;i++) {
skipping to change at line 803 skipping to change at line 828
#undef initwordproc #undef initwordproc
#undef initwordname #undef initwordname
#undef initword #undef initword
#define initwordptr(name) realprocname(name) #define initwordptr(name) realprocname(name)
int outofcontext=0; int outofcontext=0;
int readconfig(char *file) { int readconfig(char *file) {
char gegsbuf[MAXLINE],*ptr,*gegs; char gegsbuf[MAXLINE],*ptr,*gegs;
FILE *fp=fopen(file,"rb"); FILE *fp=fopen(file,"rb");
#ifdef HAVE_SETENV //#ifdef HAVE_SETENV
#if 1
#ifdef PDCURSES #ifdef PDCURSES
setenv("CURSES_VERSION","PDCURSES",1); setenv("CURSES_VERSION","PDCURSES",1);
#else #else
#ifdef NCURSES_VERSION #ifdef NCURSES_VERSION
setenv("CURSES_VERSION","NCURSES",1); setenv("CURSES_VERSION","NCURSES",1);
#else #else
setenv("CURSES_VERSION","UNKNOWN",1); setenv("CURSES_VERSION","UNKNOWN",1);
#endif #endif
#endif #endif
#ifdef USE_KEYPAD #ifdef USE_KEYPAD
skipping to change at line 1116 skipping to change at line 1142
if(Editor::dynprocnr>0) { if(Editor::dynprocnr>0) {
myfree(olddynprocnames); myfree(olddynprocnames);
myfree(olddynproc); myfree(olddynproc);
} }
myfree(newdyn); myfree(newdyn);
Editor::dynprocnr=naar; Editor::dynprocnr=naar;
return 0; return 0;
} }
//#define TEST
#ifdef TEST #ifdef TEST
void main(int argc,char **argv) { int main(int argc,char **argv) {
initscr(); initscr();
clearok(stdscr,FALSE); clearok(stdscr,FALSE);
clearok(curscr,FALSE); clearok(curscr,FALSE);
noecho(); noecho();
cbreak(); cbreak();
nonl( ); nonl( );
clear(); clear();
hasc=has_colors(); bool hasc=has_colors();
if(hasc) if(hasc)
start_color(); start_color();
readconfig("/home/stolypin/.beditrc"); readconfig(argv[1]);
assume_default_colors(fieldcolor[0].forg,fieldcolor[0].back); assume_default_colors(fieldcolor[0].forg,fieldcolor[0].back);
refresh(); refresh();
for(int i=0;i<colortypes;i++) { for(int i=0;i<colortypes;i++) {
attrset(fieldcolor[i].var); attrset(fieldcolor[i].var);
move(i+10,0); move(i+10,0);
refresh(); refresh();
addstr(fieldcolor[i].text); addstr(fieldcolor[i].text);
refresh(); refresh();
} }
getch(); wgetch(stdscr);
}
endwin(); endwin();
} }
#endif #endif
 End of changes. 17 change blocks. 
19 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)