X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: degoble AT gtech (David. E. Goble) Newsgroups: comp.os.linux.development.apps,comp.os.msdos.djgpp Subject: undeclared identifiers: one *c prog not recognising a shared *.h file Date: Sat, 11 May 2002 20:35:15 GMT Message-ID: <3cdd7e32.103647057@news.adelaide.on.net> X-Newsreader: Forte Free Agent 1.21/32.243 NNTP-Posting-Host: dialup-195.99.220.203.acc02-waym-adl.comindico.com.au X-Trace: duster.adelaide.on.net 1021149336 dialup-195.99.220.203.acc02-waym-adl.comindico.com.au (12 May 2002 06:05:36 +0950) Lines: 635 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi; /* listing 2 - menu.h */ /* screen dimensions*/ #define MAX_ROWS 24 #define MAX_COLUMNS 80 /* keystroke codes and color */ #ifdef HPUX #define UP_ARROW 3 #define DOWN_ARROW 2 #define LEFT_ARROW 4 #define RIGHT_ARROW 5 #define RETURN 10 #define ESCAPE 27 #endif #ifdef SUN #define UP_ARROW 65 #define DOWN_ARROW 66 #define LEFT_ARROW 68 #define RIGHT_ARROW 67 #define RETURN 10 #define ESCAPE 27 #endif #ifdef VMS #define UP_ARROW 274 #define DOWN_ARROW 275 #define LEFT_ARROW 276 #define RIGHT_ARROW 277 #define RETURN 13 #define ESCAPE 291 /* F11 */ #endif #ifdef BCC #define MAINCOLOR (F_RED | B_BLACK) #define DIALOGCOLOR (F_CYAN | B_BLACK) #define UP_ARROW 56 #define DOWN_ARROW 50 #define LEFT_ARROW 52 #define RIGHT_ARROW 54 #define RETURN 10 #define ESCAPE 27 #endif /* macros for portability */ #ifndef VMS #define BEGX _begx #define BEGY _begy #define MAXX _maxx #else #define BEGX _beg_x #define BEGY _beg_y #define MAXX _max_x #endif /* box characters */ #ifdef BCC #define SINGLE_SIDE -77 /* single bar */ #define SINGLE_ACROSS -60 #define DOUBLE_SIDE -70 /* double bar */ #define DOUBLE_ACROSS -51 #else #define SINGLE_SIDE '|' #define SINGLE_ACROSS '-' #define DOUBLE_SIDE '"' #define DOUBLE_ACROSS '=' #endif #define TCHOICES 3 /* menubar structure */ typedef struct mbar { char string[80]; char letter; int pos; }MENUBAR; /* pulldown menu choices */ typedef struct choices { char string[20]; char letter; int (*funcptr)(); } CHOICES; /* pulldown menu structure */ typedef struct pmenu { int num; int maxlength; CHOICES *ptr; } PULLDOWN; /* prototypes */ WINDOW *topbar(WINDOW *); WINDOW *pulldown(int,int,int,int); WINDOW *popup(int,int,int,int); void move_window(WINDOW *win,int y, int x); void print_string(WINDOW *,int, int, char *); void erase_window(WINDOW *); void delete_window(WINDOW *); void refresh_window(WINDOW *); int to_dialogue(char *); void clear_dialogue(void); void touch_window(WINDOW *); char *strmenu(int, MENUBAR *, int); char menu_choice(char *); int clean_up(void); void repaint(void); char do_pulldown(int,PULLDOWN *, MENUBAR *); void set_stdscr(void); void execute_command(int, int, PULLDOWN *); char do_menubar(WINDOW *, MENUBAR *); void strtoupper(char *); void strtolower(char *); void set_stdscr(void); char get_keystroke(void); /* listing3 - uilibs.c */ #include #include #include #include #include #ifdef VMS #include #endif #ifdef BCC #include #include #include #endif #include "curses.h" #include "menu.h" extern WINDOW *dialogue; extern WINDOW *tbar; static bar_size; /* size of menubar */ static int menu_pos; /* position in menubar */ /* display menubar */ WINDOW *topbar(WINDOW *win) { WINDOW *swin; int string_count, string_size; if((swin = subwin(win,3,(win->MAXX)-4,(win->BEGY)+1, (win->BEGX)+2)) == NULL) clean_up(); #ifdef BCC wattrset(swin, F_BLUE | B_GRAY); #endif box (swin, SINGLE_SIDE,SINGLE_ACROSS); bar_size = (swin->MAXX)-2; menu_pos=0; return (swin); } /* print string to menubar */ char do_menubar(WINDOW *swin, MENUBAR *menubar) { char * menu; char buffer[80]; int status; #ifdef VMS int keyboard; short term_code; #else char term_code; #endif #ifdef VMS if ( (( status = SMG$CREATE_VIRTUAL_KEYBOARD(&keyboard))&1)!=1) clean_up(); #endif term_code = 0; while (term_code != RETURN) { /* get the new menubar string */ menu = strmenu(bar_size, menubar, menu_pos); mvwaddstr(swin, 1, 1, menu); wrefresh(swin); /* get a single keystroke */ #ifdef VMS if ( (( status = SMG$READ_KEYSTROKE (&keyboard,&term_code))&1)!=1) clean_up(); #endif #ifdef BCC term_code = wgetch(swin); #endif #ifdef HPUX term_code = getch(); #endif #ifdef SUN term_code = getch(); if (term_code == ESCAPE) { getch(); term_code = getch(); } #endif /* process keystroke */ switch (term_code) { /* arrows check for wrap-around */ case LEFT_ARROW: if (menu_pos == 0) menu_pos = TCHOICES-1; else menu_pos--; break; case RIGHT_ARROW: if (menu_pos == TCHOICES-1) menu_pos = 0; else menu_pos++; break; /* do nothing */ case RETURN: break; /* exit program */ case ESCAPE: clean_up(); break; /* return keyboard input */ default : return (term_code); break; } } /* return highlighted option */ return (menubar[menu_pos].letter); } WINDOW *popup(int rows,int columns,int sy,int sx) { WINDOW *win; win = newwin(rows, columns, sy, sx); if(win == NULL) { endwin(); clean_up(); } #ifdef BCC wattrset(win, F_BLACK | B_GRAY); #endif box(win, SINGLE_SIDE, SINGLE_ACROSS); wrefresh(win); return (win); } /* erase windows and surrounding box */ void erase_window(WINDOW *win) { werase(win); box(win, ' ', ' '); wrefresh(win); } void delete_window(WINDOW *win) { delwin(win); } void refresh_window(WINDOW *win) { wrefresh(win); } void touch_window(WINDOW *win) { touchwin(win); wrefresh(win); } /* process pulldown menu options */ char do_pulldown (int i, PULLDOWN *pullmenu, MENUBAR *menubar) { WINDOW *subwin1; int j; int position, oldpos; char *ptr; int status; #ifdef VMS int keyboard; short term_code; #else char term_code; #endif #ifdef VMS if ( (( status = SMG$CREATE_VIRTUAL_KEYBOARD(&keyboard))&1)!=1) clean_up(); #endif subwin1 = popup( (pullmenu[i].num)+2, (pullmenu[i].maxlength)+2,stdscr->BEGY+3, (menubar[i].pos)+2 ); /* print pulldown options */ for (j=0;j