/*
** Generated Code
*/
/*
**LIBS: -lXm -lXt -lX11
*/

#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/DialogS.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/Text.h>
#include <Xm/ToggleB.h>
#include <Xm/CascadeBG.h>
#include <Xm/LabelG.h>

extern void digit_callback ();
extern void decimal_point ();
extern void Equals ();
extern void Add ();
extern void Subtract ();
extern void Multiply ();
extern void Divide ();
extern void Sin ();
extern void Cos ();
extern void Tan ();
extern void Log10 ();
extern void Ln ();
extern void MemRecall ();
extern void Sqrt ();
extern void RaisePower ();
extern void Exp ();
extern void Reciprocal ();
extern void Factorial ();
extern void MemAdd ();
extern void And ();
extern void Or ();
extern void Xor ();
extern void LeftShift ();
extern void RightShift ();
extern void MemSubtract ();
extern void ClearAll ();
extern void ClearEntry ();
extern void ChangeSign ();
extern void OpenParenthesis ();
extern void CloseParenthesis ();
extern void inverse_callback ();
extern void Degrees ();
extern void Radians ();
extern void Gradient ();
Widget calc_shell = (Widget) NULL;
Widget calc_form = (Widget) NULL;
Widget digits_rc = (Widget) NULL;
Widget digit7 = (Widget) NULL;
Widget digit4 = (Widget) NULL;
Widget digit1 = (Widget) NULL;
Widget dec_point = (Widget) NULL;
Widget digit8 = (Widget) NULL;
Widget digit5 = (Widget) NULL;
Widget digit2 = (Widget) NULL;
Widget digit0 = (Widget) NULL;
Widget digit9 = (Widget) NULL;
Widget digit6 = (Widget) NULL;
Widget digit3 = (Widget) NULL;
Widget eq_b = (Widget) NULL;
Widget add_b = (Widget) NULL;
Widget sub_b = (Widget) NULL;
Widget mul_b = (Widget) NULL;
Widget div_b = (Widget) NULL;
Widget calc_display = (Widget) NULL;
Widget unary_rc = (Widget) NULL;
Widget sin_b = (Widget) NULL;
Widget cos_b = (Widget) NULL;
Widget tan_b = (Widget) NULL;
Widget log_b = (Widget) NULL;
Widget ln_b = (Widget) NULL;
Widget m_b = (Widget) NULL;
Widget sqr_b = (Widget) NULL;
Widget pow_b = (Widget) NULL;
Widget exp_b = (Widget) NULL;
Widget rec_b = (Widget) NULL;
Widget fact_b = (Widget) NULL;
Widget mplus_b = (Widget) NULL;
Widget and_b = (Widget) NULL;
Widget or_b = (Widget) NULL;
Widget xor_b = (Widget) NULL;
Widget lsh_b = (Widget) NULL;
Widget rsh_b = (Widget) NULL;
Widget mminus_b = (Widget) NULL;
Widget ac_b = (Widget) NULL;
Widget ce_b = (Widget) NULL;
Widget sgn_b = (Widget) NULL;
Widget bra_b = (Widget) NULL;
Widget ket_b = (Widget) NULL;
Widget inv_b = (Widget) NULL;
Widget drg_cb = (Widget) NULL;
Widget deg_b = (Widget) NULL;
Widget rad_b = (Widget) NULL;
Widget gra_b = (Widget) NULL;



void create_calc_shell (display, app_name, app_argc, app_argv)
Display *display;
char *app_name;
int app_argc;
char **app_argv;
{
	Widget children[24];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	char from_s [256];             /* For resource conversion */
	XrmValue from_value, to_value; /* ditto */
	XtPointer tmp_value;             /* ditto */
	int fg, bg;                    /* colour values for pixmaps */ 
	XmString *list_items;          /* For list items */
	int list_item;                 /* Index for list_items */
	Atom *atom_list;               /* For Drop Site targets */
	XmString xmstrings[16];    /* temporary storage for XmStrings */
	Widget widget45 = (Widget)NULL;
	Widget widget46 = (Widget)NULL;
	Widget widget48 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	calc_shell = XtAppCreateShell ( app_name, "MCalc", applicationShellWidgetClass, display, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	XtSetArg(al[ac], XmNhorizontalSpacing, 5); ac++;
	XtSetArg(al[ac], XmNverticalSpacing, 5); ac++;
	calc_form = XmCreateForm ( calc_shell, "calc_form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNnumColumns, 4); ac++;
	XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
	XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++;
	digits_rc = XmCreateRowColumn ( calc_form, "digits_rc", al, ac );
	ac = 0;
	digit7 = XmCreatePushButton ( digits_rc, "digit7", al, ac );
	digit4 = XmCreatePushButton ( digits_rc, "digit4", al, ac );
	digit1 = XmCreatePushButton ( digits_rc, "digit1", al, ac );
	dec_point = XmCreatePushButton ( digits_rc, "dec_point", al, ac );
	digit8 = XmCreatePushButton ( digits_rc, "digit8", al, ac );
	digit5 = XmCreatePushButton ( digits_rc, "digit5", al, ac );
	digit2 = XmCreatePushButton ( digits_rc, "digit2", al, ac );
	digit0 = XmCreatePushButton ( digits_rc, "digit0", al, ac );
	digit9 = XmCreatePushButton ( digits_rc, "digit9", al, ac );
	digit6 = XmCreatePushButton ( digits_rc, "digit6", al, ac );
	digit3 = XmCreatePushButton ( digits_rc, "digit3", al, ac );
	eq_b = XmCreatePushButton ( digits_rc, "eq_b", al, ac );
	add_b = XmCreatePushButton ( digits_rc, "add_b", al, ac );
	sub_b = XmCreatePushButton ( digits_rc, "sub_b", al, ac );
	mul_b = XmCreatePushButton ( digits_rc, "mul_b", al, ac );
	div_b = XmCreatePushButton ( digits_rc, "div_b", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 20); ac++;
	XtSetArg(al[ac], XmNcolumns, 20); ac++;
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNcursorPositionVisible, FALSE); ac++;
	calc_display = XmCreateText ( calc_form, "calc_display", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNnumColumns, 4); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
	XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++;
	XtSetArg(al[ac], XmNadjustLast, FALSE); ac++;
	unary_rc = XmCreateRowColumn ( calc_form, "unary_rc", al, ac );
	ac = 0;
	sin_b = XmCreatePushButton ( unary_rc, "sin_b", al, ac );
	cos_b = XmCreatePushButton ( unary_rc, "cos_b", al, ac );
	tan_b = XmCreatePushButton ( unary_rc, "tan_b", al, ac );
	log_b = XmCreatePushButton ( unary_rc, "log_b", al, ac );
	ln_b = XmCreatePushButton ( unary_rc, "ln_b", al, ac );
	m_b = XmCreatePushButton ( unary_rc, "m_b", al, ac );
	sqr_b = XmCreatePushButton ( unary_rc, "sqr_b", al, ac );
	pow_b = XmCreatePushButton ( unary_rc, "pow_b", al, ac );
	exp_b = XmCreatePushButton ( unary_rc, "exp_b", al, ac );
	rec_b = XmCreatePushButton ( unary_rc, "rec_b", al, ac );
	fact_b = XmCreatePushButton ( unary_rc, "fact_b", al, ac );
	mplus_b = XmCreatePushButton ( unary_rc, "mplus_b", al, ac );
	and_b = XmCreatePushButton ( unary_rc, "and_b", al, ac );
	or_b = XmCreatePushButton ( unary_rc, "or_b", al, ac );
	xor_b = XmCreatePushButton ( unary_rc, "xor_b", al, ac );
	lsh_b = XmCreatePushButton ( unary_rc, "lsh_b", al, ac );
	rsh_b = XmCreatePushButton ( unary_rc, "rsh_b", al, ac );
	mminus_b = XmCreatePushButton ( unary_rc, "mminus_b", al, ac );
	if (DefaultDepthOfScreen(DefaultScreenOfDisplay(display)) != 1) {
	sprintf ( from_s, "white" );
	from_value.size = strlen(from_s)+1;
	from_value.addr = from_s;
	to_value.addr = NULL;
	XtConvertAndStore (unary_rc, XmRString, &from_value, XmRPixel, &to_value);
	if ( to_value.addr )
	{
		XtSetArg(al[ac], XmNforeground, *(unsigned int *)to_value.addr); ac++;
	}
	}
	if (DefaultDepthOfScreen(DefaultScreenOfDisplay(display)) != 1) {
	sprintf ( from_s, "orange" );
	from_value.size = strlen(from_s)+1;
	from_value.addr = from_s;
	to_value.addr = NULL;
	XtConvertAndStore (unary_rc, XmRString, &from_value, XmRPixel, &to_value);
	if ( to_value.addr )
	{
		XtSetArg(al[ac], XmNbackground, *(unsigned int *)to_value.addr); ac++;
	}
	}
	ac_b = XmCreatePushButton ( unary_rc, "ac_b", al, ac );
	ac = 0;
	ce_b = XmCreatePushButton ( unary_rc, "ce_b", al, ac );
	sgn_b = XmCreatePushButton ( unary_rc, "sgn_b", al, ac );
	bra_b = XmCreatePushButton ( unary_rc, "bra_b", al, ac );
	ket_b = XmCreatePushButton ( unary_rc, "ket_b", al, ac );
	XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
	XtSetArg(al[ac], XmNmarginLeft, 0); ac++;
	XtSetArg(al[ac], XmNindicatorOn, FALSE); ac++;
	inv_b = XmCreateToggleButton ( unary_rc, "inv_b", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
	XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
	widget45 = XmCreateOptionMenu ( calc_form, "widget45", al, ac );
	ac = 0;
	widget46 = XmOptionLabelGadget ( widget45 );
	drg_cb = XmOptionButtonGadget ( widget45 );
	XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
	XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
	XtSetValues ( widget46,al, ac );
	ac = 0;
	widget48 = XmCreatePulldownMenu ( widget45, "widget48", al, ac );
	deg_b = XmCreatePushButton ( widget48, "deg_b", al, ac );
	rad_b = XmCreatePushButton ( widget48, "rad_b", al, ac );
	gra_b = XmCreatePushButton ( widget48, "gra_b", al, ac );

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, widget45); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 1); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( digits_rc,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( calc_display,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, widget45); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 15); ac++;
	XtSetArg(al[ac], XmNleftWidget, digits_rc); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( unary_rc,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, calc_display); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( widget45,al, ac );
	ac = 0;
	XtAddCallback (digit7, XmNactivateCallback, digit_callback,(char *)7);
	XtAddCallback (digit4, XmNactivateCallback, digit_callback,(char *)4);
	XtAddCallback (digit1, XmNactivateCallback, digit_callback,(char *)1);
	XtAddCallback (dec_point, XmNactivateCallback, decimal_point,NULL);
	XtAddCallback (digit8, XmNactivateCallback, digit_callback,(char *)8);
	XtAddCallback (digit5, XmNactivateCallback, digit_callback,(char *)5);
	XtAddCallback (digit2, XmNactivateCallback, digit_callback,(char *)2);
	XtAddCallback (digit0, XmNactivateCallback, digit_callback,(char *)0);
	XtAddCallback (digit9, XmNactivateCallback, digit_callback,(char *)9);
	XtAddCallback (digit6, XmNactivateCallback, digit_callback,(char*)6);
	XtAddCallback (digit3, XmNactivateCallback, digit_callback,(char *)3);
	XtAddCallback (eq_b, XmNactivateCallback, Equals,NULL);
	XtAddCallback (add_b, XmNactivateCallback, Add,NULL);
	XtAddCallback (sub_b, XmNactivateCallback, Subtract,NULL);
	XtAddCallback (mul_b, XmNactivateCallback, Multiply,NULL);
	XtAddCallback (div_b, XmNactivateCallback, Divide,NULL);
	children[ac++] = digit7;
	children[ac++] = digit4;
	children[ac++] = digit1;
	children[ac++] = dec_point;
	children[ac++] = digit8;
	children[ac++] = digit5;
	children[ac++] = digit2;
	children[ac++] = digit0;
	children[ac++] = digit9;
	children[ac++] = digit6;
	children[ac++] = digit3;
	children[ac++] = eq_b;
	children[ac++] = add_b;
	children[ac++] = sub_b;
	children[ac++] = mul_b;
	children[ac++] = div_b;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (sin_b, XmNactivateCallback, Sin,NULL);
	XtAddCallback (cos_b, XmNactivateCallback, Cos,NULL);
	XtAddCallback (tan_b, XmNactivateCallback, Tan,NULL);
	XtAddCallback (log_b, XmNactivateCallback, Log10,NULL);
	XtAddCallback (ln_b, XmNactivateCallback, Ln,NULL);
	XtAddCallback (m_b, XmNactivateCallback, MemRecall,NULL);
	XtAddCallback (sqr_b, XmNactivateCallback, Sqrt,NULL);
	XtAddCallback (pow_b, XmNactivateCallback, RaisePower,NULL);
	XtAddCallback (exp_b, XmNactivateCallback, Exp,NULL);
	XtAddCallback (rec_b, XmNactivateCallback, Reciprocal,NULL);
	XtAddCallback (fact_b, XmNactivateCallback, Factorial,NULL);
	XtAddCallback (mplus_b, XmNactivateCallback, MemAdd,NULL);
	XtAddCallback (and_b, XmNactivateCallback, And,NULL);
	XtAddCallback (or_b, XmNactivateCallback, Or,NULL);
	XtAddCallback (xor_b, XmNactivateCallback, Xor,NULL);
	XtAddCallback (lsh_b, XmNactivateCallback, LeftShift,NULL);
	XtAddCallback (rsh_b, XmNactivateCallback, RightShift,NULL);
	XtAddCallback (mminus_b, XmNactivateCallback, MemSubtract,NULL);
	XtAddCallback (ac_b, XmNactivateCallback, ClearAll,NULL);
	XtAddCallback (ce_b, XmNactivateCallback, ClearEntry,NULL);
	XtAddCallback (sgn_b, XmNactivateCallback, ChangeSign,NULL);
	XtAddCallback (bra_b, XmNactivateCallback, OpenParenthesis,NULL);
	XtAddCallback (ket_b, XmNactivateCallback, CloseParenthesis,NULL);
	XtAddCallback (inv_b, XmNvalueChangedCallback, inverse_callback,NULL);
	children[ac++] = sin_b;
	children[ac++] = cos_b;
	children[ac++] = tan_b;
	children[ac++] = log_b;
	children[ac++] = ln_b;
	children[ac++] = m_b;
	children[ac++] = sqr_b;
	children[ac++] = pow_b;
	children[ac++] = exp_b;
	children[ac++] = rec_b;
	children[ac++] = fact_b;
	children[ac++] = mplus_b;
	children[ac++] = and_b;
	children[ac++] = or_b;
	children[ac++] = xor_b;
	children[ac++] = lsh_b;
	children[ac++] = rsh_b;
	children[ac++] = mminus_b;
	children[ac++] = ac_b;
	children[ac++] = ce_b;
	children[ac++] = sgn_b;
	children[ac++] = bra_b;
	children[ac++] = ket_b;
	children[ac++] = inv_b;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (deg_b, XmNactivateCallback, Degrees,NULL);
	XtAddCallback (rad_b, XmNactivateCallback, Radians,NULL);
	XtAddCallback (gra_b, XmNactivateCallback, Gradient,NULL);
	children[ac++] = deg_b;
	children[ac++] = rad_b;
	children[ac++] = gra_b;
	XtManageChildren(children, ac);
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, widget48); ac++;
	XtSetValues ( drg_cb, al, ac );
	ac = 0;
	children[ac++] = digits_rc;
	children[ac++] = calc_display;
	children[ac++] = unary_rc;
	children[ac++] = widget45;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( calc_form);
}

