ACCEPT or DISPLAY AT COL without LINE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I've just joined.  I'm helping move a large suite of programs written in 
RM/COBOL's dialect to gnu-cobol, and it seems the simplest way to do 
that will be to modify cobc.  More on that later.

In gnu-cobol 2.0, including AT COLUMN in ACCEPT or DISPLAY without also 
including LINE results in "Unexpected tree tag 28".  This is because the 
pos parameter is tested using CB_PAIR_P, to differentiate between AT 
LINE y COL x and AT n, however, that is the wrong test.  A better test 
is CB_LIST_P.

This issue has been reported before, e.g. 
https://sourceforge.net/p/open-cobol/mailman/message/30759345/, but was 
incorrectly answered with, "You missed out line nn".

The cobc parser allows COL without LINE, and both the GNU COBOL 2.0 
Programmers Guide (p.6-38) and the OpenCOBOL 1.1 Programmers Guide (p. 
6-28) show that it is correct, as does the Final Committee Draft 
International Standard, ISO/IEC 1989:20xx FCD 1.0, which explicitly 
allows COLUMN without LINE (p. 446, clause 16.)  (Never mind that the 
run-time behaviour specified in this standard is very different to the 
behaviour in RM/COBOL, and I gather in most other implementations, too.)

I offer the patch, below.

Regards,

David

----8<-------- accept_display-col-without-line.patch -8<--------8<----
--- typeck.c.orig	2016-05-19 00:27:02.300887725 +0930
+++ typeck.c	2016-05-19 21:56:15.278873231 +0930
@@ -2888,7 +2888,7 @@
  			output_screen_from (CB_FIELD (cb_ref (var)), 0);
  			gen_screen_ptr = 1;
  			if (pos) {
-				if (CB_PAIR_P (pos)) {
+				if (CB_LIST_P (pos)) {
  					line = CB_PAIR_X (pos);
  					column = CB_PAIR_Y (pos);
  					cb_emit (cb_build_funcall_3 ("cob_screen_accept",
@@ -2909,7 +2909,7 @@
  					cb_emit (cb_build_funcall_7 ("cob_field_accept",
  						var, NULL, NULL, fgc, bgc,
  						scroll, cb_int (dispattrs)));
-				} else if (CB_PAIR_P (pos)) {
+				} else if (CB_LIST_P (pos)) {
  					line = CB_PAIR_X (pos);
  					column = CB_PAIR_Y (pos);
  					cb_emit (cb_build_funcall_7 ("cob_field_accept",
@@ -2935,7 +2935,7 @@
  			cb_emit (cb_build_funcall_7 ("cob_field_accept",
  				var, NULL, NULL, fgc, bgc, scroll,
  				cb_int (dispattrs)));
-		} else if (CB_PAIR_P (pos)) {
+		} else if (CB_LIST_P (pos)) {
  			line = CB_PAIR_X (pos);
  			column = CB_PAIR_Y (pos);
  			cb_emit (cb_build_funcall_7 ("cob_field_accept",
@@ -3408,7 +3408,7 @@
  		output_screen_from (CB_FIELD (cb_ref (x)), 0);
  		gen_screen_ptr = 1;
  		if (pos) {
-			if (CB_PAIR_P (pos)) {
+			if (CB_LIST_P (pos)) {
  				line = CB_PAIR_X (pos);
  				column = CB_PAIR_Y (pos);
  				if (line == NULL) {
@@ -3433,7 +3433,7 @@
  			cb_emit (cb_build_funcall_7 ("cob_field_display",
  				CB_VALUE (values), NULL, NULL, fgc, bgc,
  				scroll, cb_int (dispattrs)));
-		} else if (CB_PAIR_P (pos)) {
+		} else if (CB_LIST_P (pos)) {
  			line = CB_PAIR_X (pos);
  			column = CB_PAIR_Y (pos);
  			if (line == NULL) {



------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
open-cobol-list mailing list
open-cobol-list@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/open-cobol-list



[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux