home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* XBBS SOURCE CODE copyright (c) 1990 by M. Kimes */
- /* All Rights Reserved */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the in the file LICENSE.XBS. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* XBBS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES */
- /* AT THE ADDRESS LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE */
- /* THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING */
- /* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH */
- /* M. KIMES */
- /* */
- /* */
- /* You can contact M. Kimes at the following address: */
- /* */
- /* M. Kimes 1:380/16.0@FidoNet */
- /* 542 Merrick (318)222-3455 data */
- /* Shreveport, LA 71104 */
- /* */
- /* */
- /* Please feel free to contact me at any time to share your comments about */
- /* my software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
-
- #include "msg.h"
- #include "xext.h"
- #include "awindow.h"
- #include "xkeys.h"
-
- void pascal do_pause (int tps);
-
-
- char * pascal ansi_interface (char *b) {
-
- char a,c;
- char *p;
- int oldx,oldy;
- char tempdisablesub;
-
- tempdisablesub=disablesub;
- disablesub=1;
- curr_cursor(&oldx,&oldy);
- stripcr(b);
- a=(char)atoi(strtok(b,","));
- b=strtok(0,"\n");
- switch ((int)a) {
- case 255: edit_user(1);
- break;
- case 254: other_options(1);
- break;
- case 1:
- case 2:
- case 3: error_message(b);
- do_pause(a-1);
- break;
- case 4:
- case 5:
- case 6: any_message(b);
- do_pause(a-4);
- break;
- case 7:
- case 8:
- case 9: p=strtok(b,",");
- _anymsg(p,strtok(0,"\n"));
- do_pause(a-7);
- break;
- case 10:
- case 11:
- case 12: p=strtok(b,",");
- find_help(p,strtok(0,"\n"),1);
- do_pause(a-10);
- break;
- case 13: {
-
- char *pp,*ppp,*pppp;
- int aa,aaa,aaaa,aaaaa;
-
- level=0;
- a=*b-'0';
- b++;
- if(a<0 || a>9) break;
- p=strtok(b,",");
- pp=strtok(0,",");
- ppp=strtok(0,",");
- pppp=strtok(0,",");
- aa=atoi(strtok(0,","));
- aaa=atoi(strtok(0,","));
- aaaa=atoi(strtok(0,","));
- aaaaa=atoi(strtok(0,","));
- b=strtok(0,",");
- if(b)c=*b;
- else c='a';
- p=do_input(p,pp,ppp,pppp,aa,aaa,aaaa,aaaaa,c);
- if(p) {
- strncpy(variable[a],p,81);
- variable[a][80]=0;
- }
- else level=1;
- cursor(oldx,oldy);
- disablesub=tempdisablesub;
- return p;
- }
- case 14: {
-
- WINDOW *wnd;
- int temp;
- int x,y,h,w;
- #ifdef DEBUG
- char s[133];
- #endif
-
- x=atoi(strtok(b,","));
- y=atoi(strtok(0,","));
- h=atoi(strtok(0,","));
- w=atoi(strtok(0,","));
- p=strtok(0,"\n");
- wnd=establish_screen(x,y,h,w);
- #ifdef DEBUG
- sprintf(s," SCROLL=%d HEIGHT=%d WIDTH=%d COL=%d ROW=%d ",SCROLL,HEIGHT,WIDTH,COL,ROW);
- any_message(s);
- sleep(1);
- clear_message();
- #endif
- temp=get_selection(wnd,0,p);
- delete_window(wnd);
- printm("\x1b[23;1H");
- level=temp;
- }
- disablesub=tempdisablesub;
- return NULL;
- case 15: {
-
- WINDOW *wnd;
- FIELD *fld;
- char temp;
- int x,y,fore,back;
- char s[81];
-
- a=*b-'0';
- b+=2;
- if(a<0 || a>9) break;
- temp=*b;
- b++;
- p=strtok(b,",");
- if(strlen(p)>78) p[77]=0;
- curr_cursor(&x,&y);
- if(y>22) {
- y=22;
- gprintf(0,"\x1b[%d;%dH\x1b[k",y,x);
- }
- wnd=establish_screen(x,y,1,80-x);
- SCROLL=0;
- init_template(wnd);
- strset(s,0);
- fld=establish_field(wnd,0,0,p,s,temp);
- prep_template(wnd);
- temp=(char)data_entry(wnd);
- if(temp!=ESC && temp!=CTRL_K) {
- rstrip(s);
- strcpy(variable[a],s);
- level=0;
- }
- else level=1;
- delete_window(wnd);
- printm("\x1b[23;1H");
- }
- disablesub=tempdisablesub;
- return NULL;
- }
- disablesub=tempdisablesub;
- cursor(oldx,oldy);
- return NULL;
- }
-
-
-
- void pascal do_pause (int tps) {
-
- unsigned long t;
-
- switch (tps) {
- case 0: t=(unsigned long)get_char(); /* Avoid warning */
- break;
- case 1: t=getxbbstime()+120L;
- while(!inkey() && t>getxbbstime());
- break;
- default: sleep(1);
- break;
- }
- }
-
-
-
- char * pascal do_input (char *title, char *prompt, char *mask, char *deflt, int fore, int back, int x, int y, char type) {
-
- WINDOW *wnd;
- FIELD *fld;
- int xsize,ysize;
- static char resp[81];
- char returncode;
-
- if(!mask) return NULL;
- if(fore==0 && back==0) {
- fore=WHITE;
- back=BLACK;
- }
- if(!title) title=" Input ";
- if(!prompt) prompt="";
- if(strlen(mask)>78) mask[77]=0;
- strset(resp,0);
- if(deflt) {
- strncpy(resp,deflt,79);
- resp[77]=0;
- }
- ysize=max(strlen(title),strlen(prompt));
- xsize=max(strlen(mask),ysize)+4;
- if(xsize>80)xsize=80;
- ysize=4;
- wnd=establish_window(x,y,ysize,xsize);
- set_title(wnd,title);
- set_colors(wnd,ALL,back,fore,BRIGHT);
- set_colors(wnd,ACCENT,fore,back,DIM);
- set_border(wnd,3);
- display_window(wnd);
- wcursor(wnd,(x<80),0);
- wprintf(wnd,prompt);
- init_template(wnd);
- fld=establish_field(wnd,(x<80),1,mask,resp,type);
- prep_template(wnd);
- returncode=data_entry(wnd);
- delete_window(wnd);
- if(returncode==ESC) return NULL;
- rstrip(resp);
- return resp;
- }
-
-