! 
! @OPENGROUP_COPYRIGHT@
! COPYRIGHT NOTICE
! Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
! Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
! ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
! the full copyright text.
! 
! This software is subject to an open license. It may only be
! used on, with or for operating systems which are themselves open
! source systems. You must contact The Open Group for a license
! allowing distribution and sublicensing of this software on, with,
! or for operating systems which are not Open Source programs.
! 
! See http://www.opengroup.org/openmotif/license for full
! details of the license agreement. Any use, reproduction, or
! distribution of the program constitutes recipient's acceptance of
! this agreement.
! 
! EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
! PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
! KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
! WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
! OR FITNESS FOR A PARTICULAR PURPOSE
! 
! EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
! NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
! INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
! AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
! ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
! EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGES.
! 
! 
! HISTORY
! 
!   $XConsortium: validator.uil /main/4 1995/07/13 20:36:10 drk $
!*  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!*******************************************************************************

module validator
	version = 'v1.0'
	names = case_sensitive

procedure
	ArmMe ();
	DisarmMe ();
	ActivateMe ();
	ExecuteMe ();
	CreationProc ();

!
!test for P2869
!  this test needs to be at the beginning of this file
!  because it results in memory corruption, and if at
!  the end, the corruption might not produce the desired
!  core dump.
!

value  toggle_icon_Y     : imported icon;
value  toggle_icon_N     : imported icon;
				  
object
Gbutton1    : XmToggleButton {
      arguments {
         XmNlabelType = XmPIXMAP;
         XmNselectPixmap = toggle_icon_Y;
         XmNlabelPixmap = toggle_icon_N;
         XmNindicatorOn = false;
!        XmNlabelString = "";
      };
   };

object
Gbutton2 : XmToggleButton {
      arguments {
         XmNlabelType = XmPIXMAP;
         XmNselectPixmap = toggle_icon_Y;
         XmNlabelPixmap = toggle_icon_N;
         XmNindicatorOn = false;
!        XmNlabelString = "";
      };
   };

object
Gbutton3 : XmToggleButton {
      arguments {
         XmNlabelType = XmPIXMAP;
         XmNselectPixmap = toggle_icon_Y;
         XmNlabelPixmap = toggle_icon_N;
         XmNindicatorOn = false;
!        XmNlabelString = "";
      };
   };

!
!comment tests
!
!	valid
/*	comment should be allowed */
/*	there are many of these
	comments which can span multiple lines */
!	this also, as we've seen!
!
!	invalid		
!
/*	nested /* comments */ are out */
;
!	semi colon above just to break out of error
!	this type of comment
	cannot span multiple lines
;
!	semi colon above just to break out of error
!
!value tests
!

value
!	valid name	value unimportant
	abd_ef		:	0;
	$dext		:	1;
	low1$2		:	0;
	MARKa		:	1;
	_peg		:	0;
	conTROLS	:	1;
!
!	invalid name
	9zhe		:	1;
	blha)t		:	0;
	m-fg		:	1;
	END		:	0;
	MODULE		:	1;
value
!integer values		valid
!
	foo1		:	0;
	foo2		:	-942343;
	foo3		:	2147483647;

!
!
!			invalid
	foo4		:	2147483648;
	foo5		:	9 0;
	foo6		:	-2,234;
value
!strings		valid
	bar1		:	'1234a';
	bar2		:	'	    ';
	bar3		:	'/f';
	bar4		:	'two \
				lines';
!			invalid
	bar5		:	'xyz;
	bar6		:		;
	bar7		:	94';
!	next one to break out of error above
	bar7a		:	;
	bar8		:	'\389';
value
!booleans		valid
	bool1		:	true;
	bool2		:	false;
	bool3		:	on;
	bool4		:	off;
!			invalid
	bool5		:	yes;
	bool6		:	no;
!
value
!float			valid
	frizz1		:	1.0;
	frizz2		:	.1;
	frizz3		:	3.1415E-2;
	frizz3a		:	-6.2e7;
!			invalid
	frizz4		:	1e1;
	frizz5		:	E-1;
	frizz6		:	2.87 e6;
!	32-bit floats will fail
	frizz7a		:	2.0e38;
!	64-bit floats will fail
	frizz7b		:	1.8308E308;
!	should fail on most machines; maybe not mips machines
	frizz7		:	2.0e2000;
value
!unary expressions		valid
	lala1		:	~true;
	lala2		:	~7;
	lala3		:	-2.73e7;
	lala4		:	--3829;
	lala5		:	-lala4;
!			invalid
	lala6		:	~3.1427;
	lala7		:	2~23;
	lala8		:	-false;
	lala9		:	-'bar';
	lala10		:	+true;
value
! binary		valid
	zpp1		:	2*9.00004e4;
	zpp2		:	0*1;
	zpp3		:	8.7/-2.1E14;
	zpp4		:	2.1/8;
	zpp5		:	211+-317;
	zpp6		:	1111 - 2.7e17;
!			invalid
	zpp7		:	6 * true;
	zpp8		:	*2, 3;
	zpp9		:	*8.7;
	zpp10		:	17/'string2';
	zpp11		:	3111/;
	zpp12		:	7 + off;
	zpp13		:	3.184 + ;

! test for PIR 2812, very long names
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffoo : 7442;

! even a comment can do it ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffoo : 7442;
	
! end of test for PIR 2812

! test for PIR 2580, very long C-style comment

/******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
******************************************************************************/

!
!conversion tests
!

value
!data type conversions using values defined above
!			valid
	frim1		:	integer(bool2);
	frim2		:	float(abd_ef);
	frim3		:	float(frizz2);
!			invalid
	frim4		:	integer(bar1);
	frim5		:	float(bar1);
!
!end of value tests
!
!
!function tests
!
value color_blue	:	color ('mediumblue');
value color_red		:	color ('indian red');
value circle_radius	:	argument ( 'my_radius', integer);
value circle_color	:	argument ( 'my_color', color);

!
!
value color_black : color ('black', background);

! the next two definitions will generate warnings about overriding built-ins
value XmNactivateCallback : reason ( 'XmCR_ACTIVATE');
value XmNarmCallback : reason (' XmCR_ARM');

object pushbutton1 : XmPushButton
	{	arguments  {XmNforeground = color ('flamingo', foreground);
      			    XmNbackground = color_black;
			    XmNlabelString = compound_string
				 (#iso_latin2"string");
			    };
		callbacks	{XmNarmCallback = procedure ArmMe ();
				 XmNactivateCallback = procedure ActivateMe ();
	!execute is not a valid reason for PushButton SHOULD produce error
				 XmNexecuteCallback = procedure ExecuteMe ();
				};
	};
!
!color table test
!
value ct_1 : color_table
		( color_black = '.' , color_red = 'o');
!invalid color tables
value ct_2 : color_table
		( color_black = 'xx', color_red = 'o');

value ct_3 : color_table
		(color_teal = '!', color_azure = '?');

value ct_4 : color_table
		(background = 'm', foreground = 'o');

!
!invalid if case_insensitive

value ct_5 : color_table
		(color_black = 'r', color_blue = 'R');

!
!icon functions
!
!	invalid
value
icon_1 : icon	(color_table = ct_1,
		 '....oooo',
		 '.....ooo',
		 '......ooo',
		 '.......o',
		 '........');

!	valid

icon_2 : icon (color_table = ct_1,
		'');

value icon_3 : xbitmapfile ('gnu.xbm');

!
!font functions and tables
!
!	valid
!
value isolatin6 : font ('isolatin6');
value helvetica50 : font ('helvetica50');

!	invalid due to use of unknown value caramba
fonttable1 : font_table
	(iso_latin6=isolatin6,
	 iso_latin7=caramba);

!
!string tables
!
! valid example from documentation
object file_privileges :
	XmList
	{ arguments	
		{ XmNitems = string_table ('owner read',
					'owner write',
					'group read',
					'group write',
					'other read',
					'other write');
		};
	};

!	invalid 
value sticky_dessert : compound_string (#iso_greek"baklava");
object	dessert_tray :
	XmList
	{ arguments	
		{ XmNitems = string_table ( sticky_dessert,
					 'wrong punctuation,
					 'cheesecake');
		};
	};

!
!translation tables
!
!	valid from doc with mods
object new_translations :
	XmPushButton
	{
	arguments
	{ XmNtranslations = translation_table
		(
		'<Btn1Down>: XmPBArm()',
		'<Btn1Up>  : XmPBActivate()',
		'<Btn3Up>  : XmPBDisarm()'
		);
	};
	};

!
!more compound string tests
!

!	valid tests
value 	bizz1	:	'zoo';
	bizz2	:	'keeper';
	bizz3	:	bizz1 & bizz2;
	bizz4	:	#iso_greek"salt";
	bizz5	:	compound_string (#iso_latin6"lick");
	bizz6	:	bizz4 & bizz5;
	bizz7	:	bizz1 & bizz4;
	bizz8	:	compound_string (#iso_arabic"retaw\n");
	bizz9	:	bizz4 & bizz8;
	bizz10	:	#iso_latin8_lr"peter";
	bizz11	:	bizz4 & bizz10;
	bizz12	:	bizz10 & bizz8;

!	the following definition will issue an error
!	because bizz13 is subsequently referenced (in defining foop1)	
	bizz13	:	exported compound_string (#iso_greek"secret");

	bizz14	:	'bearer';

value	
	foop1	:	bizz13 & bizz9;
!
!	invalid test
			!not a legal character set
	foop3	:	compound_string(#notacharset"works");

!
!       BEGIN MOTIF ERRORS TESTS
!
		
!
! Invalid Motif resources test
!

object  myWidget:  XmPushButton
	{ arguments	{ XmNbogusResource1 = 1;
			  XmNbogusResource2 = 'string';
		          XmNbogusResource3 = compound_string ('why');
			  XmNbogusResource4 = (6 * 5);
			};
	  controls	{ XmBogusWidget  bogusWidget;
			};
	};


!
!  circular dependency in Form children
!

object Form1: XmForm
	{ controls { XmPushButton button1;
		     XmLabelGadget label1;
	           };
	};

object button1: XmPushButton
	{ arguments { XmNrightAttachment = XmATTACH_WIDGET;
		      XmNrightWidget = label1;
		    };
	};

object label1: XmLabelGadget
	{ arguments { XmNleftAttachment = XmATTACH_WIDGET;
		      XmNleftWidget = button1;
		    };
	};

! PIR 2831, defining class names

value	cb_class_name : class_rec_name ('XmCascadeButtonGadget');
	
object
	row_column_1 : XmRowColumn {
		arguments {  XmNentryClass = cb_class_name;
			  };
		};

	row_column_2 : XmRowColumn {
		arguments {  
			  XmNentryClass = class_rec_name ('XmTextWidget');
			  };
		};

! PIR 2847, a hitherto-undocumented legal syntax

object	foofoo : XmForm {
		controls  {
			    mybutton: XmPushButton {
				arguments {
					XmNlabelString =
					    compound_string ('hello');
				};
	  		    };
		};
	};

!test for PIR 4329

value
chan_foo:	argument('chan_foo', FLOAT);
	
procedure
chantestcreate;
		
object
chantest : 
user_defined procedure chantestcreate {
	arguments {
		chan_foo = 100.0;
		XmNx = 5;
		XmNy = 10;
	};
   };


! CR 5420, check for non string icon rows

value
	ten : 10;
	i1 : icon(10, 'aa');
	i2 : icon(10, 10);
	i3 : icon(ten, ten);

! CR 5421

value i5421 : exported icon ( color_table = 10, ' ');

value i5421a : icon ( color_table = 10, ' ');

object l5421 : XmLabel {
  arguments { XmNlabelPixmap = i5421a; };
};

! CR 5509

value
	s1 : exported 'left';
	s2 : exported 'right';

	s12 : s1 & s2;

! CR 5457

value d_key : keysym ('dog');


! CR 4859

value wc : wide_character ('abcd');




end module;






