|
First, here's a link I used on creating a patch <http://www.kegel.com/academy/opensource.html> I used Cygwin diff to create the patch, specifying the original source tree first. This is my first C code in many years, so I know I'll need some pointers. Did I just say that? Here's the patch: Only in /cygdrive/c/tn5250/tn5250-0.16.5: Makefile diff -bur /cygdrive/c/buck/cvs/tn5250/src/dbuffer.c /cygdrive/c/tn5250/tn5250-0.16.5/src/dbuffer.c --- /cygdrive/c/buck/cvs/tn5250/src/dbuffer.c 2002-03-20 02:50:36.000000000 -0500 +++ /cygdrive/c/tn5250/tn5250-0.16.5/src/dbuffer.c 2003-04-07 16:32:10.000000000 -0400 @@ -770,3 +770,107 @@ ASSERT_VALID(This); } +/* beginning of previous field - Buck */ +/****f* lib5250/tn5250_dbuffer_prevfld + * NAME + * tn5250_dbuffer_prevfld + * SYNOPSIS + * tn5250_dbuffer_prevfld (This); + * INPUTS + * Tn5250DBuffer * This - + * DESCRIPTION + * Move the cursor backward to the beginning of the previous non-blank + * or input field. The intent is to emulate the dbuffer_prevword function + * and add the additional functionality of stopping at a (possibly blank) + * input-capable field as well. + *****/ +void tn5250_dbuffer_prevfld(Tn5250DBuffer * This) +{ + int foundblank=0; + int state=0; + int maxiter; + Tn5250Field *field; + + TN5250_LOG (("dbuffer_prevfld: entered.\n")); + + maxiter = (This->w * This->h); + TN5250_ASSERT(maxiter>0); + + while (--maxiter) { + tn5250_dbuffer_left(This); + + /* If at the start of a field, exit */ + field = tn5250_display_current_field(This); + if ((field != NULL) && + (tn5250_field_start_row(field) == This->cy) && + (tn5250_field_start_col(field) == This->cx)) + { + break; + } + + switch (state) { + case 0: + if (This->data[This->cy * This->w + This->cx] <= 0x40) state++; + break; + case 1: + if (This->data[This->cy * This->w + This->cx] > 0x40) state++; + break; + case 2: + if (This->data[This->cy * This->w + This->cx] <= 0x40) { + tn5250_dbuffer_right(This, 1); + return; + } + break; + } + } + +} + +/* beginning of next field - Buck */ +/****f* lib5250/tn5250_dbuffer_nextfld + * NAME + * tn5250_dbuffer_nextfld + * SYNOPSIS + * tn5250_dbuffer_nextfld (This); + * INPUTS + * Tn5250DBuffer * This - + * DESCRIPTION + * Move the cursor forward to the beginning of the next non-blank + * or input field. The intent is to emulate the dbuffer_nextword function + * and add the additional functionality of stopping at a (possibly blank) + * input-capable field as well. + *****/ +void tn5250_dbuffer_nextfld(Tn5250DBuffer * This) +{ + int foundblank=0; + int maxiter; + Tn5250Field *field; + int gx, gy; + + TN5250_LOG (("dbuffer_nextfld: entered.\n")); + + maxiter = (This->w * This->h); + TN5250_ASSERT(maxiter>0); + + while (--maxiter) { + tn5250_dbuffer_right(This, 1); + if (This->data[This->cy * This->w + This->cx] <= 0x40) foundblank++; + + /* If found a blank previously and a non-blank now, exit */ + if ((foundblank) && (This->data[This->cy * This->w + This->cx] > 0x40)) { + break; + } + + /* If at the start of a field, exit */ + field = tn5250_display_current_field(This); + if ((field != NULL) && + (tn5250_field_start_row(field) == This->cy) && + (tn5250_field_start_col(field) == This->cx)) + { + break; + } + } + + ASSERT_VALID(This); +} + diff -bur /cygdrive/c/buck/cvs/tn5250/src/display.c /cygdrive/c/tn5250/tn5250-0.16.5/src/display.c --- /cygdrive/c/buck/cvs/tn5250/src/display.c 2002-08-01 16:40:50.000000000 -0400 +++ /cygdrive/c/tn5250/tn5250-0.16.5/src/display.c 2003-04-04 14:34:28.000000000 -0500 @@ -1010,6 +1010,16 @@ tn5250_display_kf_prevword(This); break; + /* beginning of next field - Buck */ + case K_NEXTFLD: + tn5250_display_kf_nextfld(This); + break; + + /* beginning of previous field - Buck */ + case K_PREVFLD: + tn5250_display_kf_prevfld(This); + break; + case K_FIELDHOME: tn5250_display_kf_fieldhome(This); break; @@ -1681,6 +1691,40 @@ tn5250_dbuffer_nextword(This->display_buffers); } +/* beginning of previous field - Buck */ +/****f* lib5250/tn5250_display_kf_prevfld + * NAME + * tn5250_display_kf_prevfld + * SYNOPSIS + * tn5250_display_kf_prevfld (This); + * INPUTS + * Tn5250Display * This - + * DESCRIPTION + * Move cursor to the last non-blank character or + * input-capable field. + *****/ +void tn5250_display_kf_prevfld (Tn5250Display *This) +{ + tn5250_dbuffer_prevfld(This->display_buffers); +} + +/* beginning of next field - Buck */ +/****f* lib5250/tn5250_display_kf_nextfld + * NAME + * tn5250_display_kf_nextfld + * SYNOPSIS + * tn5250_display_kf_nextfld (This); + * INPUTS + * Tn5250Display * This - + * DESCRIPTION + * Move cursor to the next non-blank character or + * input-capable field. + *****/ +void tn5250_display_kf_nextfld (Tn5250Display *This) +{ + tn5250_dbuffer_nextfld(This->display_buffers); +} + /****f* lib5250/tn5250_display_kf_fieldhome * NAME * tn5250_display_kf_fieldhome diff -bur /cygdrive/c/buck/cvs/tn5250/src/display.h /cygdrive/c/tn5250/tn5250-0.16.5/src/display.h --- /cygdrive/c/buck/cvs/tn5250/src/display.h 2002-08-01 16:40:50.000000000 -0400 +++ /cygdrive/c/tn5250/tn5250-0.16.5/src/display.h 2003-04-04 14:32:06.000000000 -0500 @@ -156,6 +156,10 @@ extern void tn5250_display_kf_delete (Tn5250Display *This); extern void tn5250_display_kf_prevword (Tn5250Display *This); extern void tn5250_display_kf_nextword (Tn5250Display *This); +/* beginning of previous field - Buck */ +extern void tn5250_display_kf_prevfld (Tn5250Display *This); +/* beginning of next field - Buck */ +extern void tn5250_display_kf_nextfld (Tn5250Display *This); extern void tn5250_display_kf_fieldhome (Tn5250Display *This); extern void tn5250_display_kf_newline (Tn5250Display *This); diff -bur /cygdrive/c/buck/cvs/tn5250/src/terminal.h /cygdrive/c/tn5250/tn5250-0.16.5/src/terminal.h --- /cygdrive/c/buck/cvs/tn5250/src/terminal.h 2002-04-01 03:21:16.000000000 -0500 +++ /cygdrive/c/tn5250/tn5250-0.16.5/src/terminal.h 2003-04-04 14:32:40.000000000 -0500 @@ -99,6 +99,10 @@ #define K_FIELDPLUS 0520 /* curses KEY_SF */ #define K_PREVWORD 0611 /* curses KEY_SLEFT (as good as any) */ #define K_NEXTWORD 0622 /* curses KEY_SRIGHT (as good as any) */ +/* beginning of previous field - Buck */ +#define K_PREVFLD 0xfffb /* no similar curses key */ +/* beginning of next field - Buck */ +#define K_NEXTFLD 0xfffc /* no similar curses key */ #define K_FIELDHOME 0607 /* curses KEY_SHOME (as good as any) */ #define K_COPY_TEXT 0xfffd /* no similar curses key */ #define K_PASTE_TEXT 0xfffe /* no similar curses key */ Only in /cygdrive/c/tn5250/tn5250-0.16.5: tn5250rc Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: AUTHORS.txt Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: COPYING.txt Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: Makefile Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: buffer.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: conf.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: config.h Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: cursesterm.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: dbuffer.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: debug.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: dftmap.exe Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: dftmap.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: display.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: field.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: lib5250.a Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: lib5250.def Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: lib5250.dll Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: lp5250d-win.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: lp5250d.exe Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: mkconfig.exe Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: printsession.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: record.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: scs.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: session.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: slangterm.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: sslstream.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: stream.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: telnetstr.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250-config.h Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250-res.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250-win.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250.exe Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250_innosetup.iss Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: tn5250rc Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: utility.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: version.o diff -bur /cygdrive/c/buck/cvs/tn5250/win32/winterm.c /cygdrive/c/tn5250/tn5250-0.16.5/win32/winterm.c --- /cygdrive/c/buck/cvs/tn5250/win32/winterm.c 2002-04-29 19:48:28.000000000 -0400 +++ /cygdrive/c/tn5250/tn5250-0.16.5/win32/winterm.c 2003-04-04 15:18:53.000000000 -0500 @@ -239,6 +239,7 @@ static keystroke_to_msg keydown2msg[] = { +/* Buck adds definitions for NEXTFLD, PREVFLD and NEWLINE */ /* KeyState Win32 VirtKey 5250 key ctx ext */ { VK_SHIFT, VK_TAB, K_BACKTAB, 0, 0 }, { VK_SHIFT, VK_F1, K_F13 , 0, 0 }, @@ -255,6 +256,9 @@ { VK_SHIFT, VK_F12, K_F24 , 0, 0 }, { VK_SHIFT, VK_INSERT, K_PASTE_TEXT, 0, 1 }, { VK_SHIFT, VK_DELETE, K_COPY_TEXT, 0, 1 }, + { VK_CONTROL, VK_LEFT, K_PREVFLD, 0, 1 }, + { VK_CONTROL, VK_RIGHT, K_NEXTFLD, 0, 1 }, + { VK_SHIFT, K_ENTER, K_NEWLINE, 0, 1 }, { 0, VK_F1, K_F1 , 0, 0 }, { 0, VK_F2, K_F2 , 0, 0 }, { 0, VK_F3, K_F3 , 0, 0 }, Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: winterm.o Only in /cygdrive/c/tn5250/tn5250-0.16.5/win32: wtd.o
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.