Hi Alex:

As you requested -a patch for my work on classicladder. Wished I knew how to do that before! This patch also corrects the Vars display to toggle symbols/variable when the check box in the section display is changed. You'll see lines uncommented so they will print- I wanted the info at the time of course I would change them back- actually my patch for compare/operate varsing prints alot of debug info still.
Hope it is close to your liking.

Chris 'Chester' Morley

_________________________________________________________________
Don’t waste time standing in line—try shopping online. Visit Sympatico / MSN Shopping today! http://shopping.sympatico.msn.ca
? .tm_project.cache
? chris.patch
? ladder.prj
? ladder.pws
? src.prj
? hal/.tm_project.cache
? hal/hal.prj
? hal/hal.pws
? hal/classicladder/.tm_project.cache
? hal/classicladder/classicladder.prj
? hal/classicladder/classicladder.pws
? hal/classicladder/module_hal (copy).c
? hal/drivers/pluto_servo_rbf.h
? po/it.msg
Index: hal/classicladder/arrays.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/arrays.c,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 arrays.c
--- hal/classicladder/arrays.c	21 Jan 2007 19:10:39 -0000	1.8.2.1
+++ hal/classicladder/arrays.c	3 Apr 2007 08:51:55 -0000
@@ -225,7 +225,7 @@
     InfosGene->CurrentSection = 0;
 #endif
 
-    rtapi_print("Sizes: %d %d %d %d %d %d %d %d %d %d %d\n",
+    rtapi_print("Sizes: %d %d %d Words- %d, %d %d HAL inputs- %d, HAL outputs- %d, %d %d %d\n",
         pSizesInfos->nbr_rungs,
         pSizesInfos->nbr_bits,
         pSizesInfos->nbr_words,
@@ -555,4 +555,4 @@
 		DisplaySymbols( );
 	}
 #endif
-}
+}
Index: hal/classicladder/classicladder.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/classicladder.c,v
retrieving revision 1.8.2.2
diff -u -r1.8.2.2 classicladder.c
--- hal/classicladder/classicladder.c	20 Feb 2007 01:45:46 -0000	1.8.2.2
+++ hal/classicladder/classicladder.c	3 Apr 2007 08:51:55 -0000
@@ -111,9 +111,9 @@
 	       "\n"
                "Copyright (C) 2001-2004 Marc Le [EMAIL PROTECTED]"
 	       "\n"
-	       "ClassicLadder comes with NO WARRANTY\n"
-	       "to the extent permitted by law.\n"
-	       "\n"
+	       "EMCLadder is experimental\n"
+	       "now inputs s32 signals from HAL \n"
+	       "you can use variables W0-W3 to access them\n"
 	       "You may redistribute copies of ClassicLadder\n"
 	       "under the terms of the GNU Lesser General Public Licence.\n"
 	       "See the file `lesserGPL.txt' for more information.\n");
@@ -376,4 +376,4 @@
 
 	return 0;
 }
-#endif
+#endif
Index: hal/classicladder/classicladder_gtk.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/classicladder_gtk.c,v
retrieving revision 1.16.2.3
diff -u -r1.16.2.3 classicladder_gtk.c
--- hal/classicladder/classicladder_gtk.c	14 Mar 2007 23:47:28 -0000	1.16.2.3
+++ hal/classicladder/classicladder_gtk.c	3 Apr 2007 08:51:55 -0000
@@ -33,9 +33,9 @@
 #include "classicladder_gtk.h"
 // #include "hardware.h"
 
-#define NBR_BOOLS_VAR_SPY 15
-#define NBR_TYPE_BOOLS_SPY 3
-#define NBR_FREE_VAR_SPY 5
+#define NBR_BOOLS_VAR_SPY 15 //for bit variable list (15 in each column)
+#define NBR_TYPE_BOOLS_SPY 3 
+#define NBR_FREE_VAR_SPY 10 //for word variable list (10 variables)
 
 GdkPixmap *pixmap = NULL;
 GtkWidget *drawing_area = NULL;
@@ -43,7 +43,7 @@
 int ValOffsetBoolVar[ NBR_TYPE_BOOLS_SPY ] = { 0, 0, 0 };
 GtkWidget *chkvar[ NBR_TYPE_BOOLS_SPY ][ NBR_BOOLS_VAR_SPY ];
 GtkWidget *EntryVarSpy[NBR_FREE_VAR_SPY*2];
-int VarSpy[NBR_FREE_VAR_SPY][2] = { {VAR_MEM_WORD,0}, {VAR_MEM_WORD,1}, {VAR_MEM_WORD,2}, {VAR_MEM_WORD,3}, {VAR_MEM_WORD,4} }; /* defaults vars to spy */
+int VarSpy[NBR_FREE_VAR_SPY][2] = { {VAR_MEM_WORD,0}, {VAR_MEM_WORD,1}, {VAR_MEM_WORD,2}, {VAR_MEM_WORD,3}, {VAR_MEM_WORD,4}, {VAR_MEM_WORD,5}, {VAR_MEM_WORD,6}, {VAR_MEM_WORD,7}, {VAR_MEM_WORD,8},{VAR_MEM_WORD,9 } }; /* defaults vars to spy */
 GtkWidget *DisplayFormatVarSpy[NBR_FREE_VAR_SPY];
 GtkWidget *entrylabel,*entrycomment;
 GtkWidget *CheckDispSymbols;
@@ -58,7 +58,8 @@
 GtkWidget *FileSelector;
 GtkWidget *ConfirmDialog;
 GtkWidget *RungWindow;
-
+GtkWidget *windowvars;
+GtkWidget *windowvars2; 
 #include "drawing.h"
 #include "vars_access.h"
 #include "calc.h"
@@ -610,7 +611,8 @@
 	GtkWidget *dialog, *label, *okay_button;
 	/* Create the widgets */
 	dialog = gtk_dialog_new();
-	label = gtk_label_new ("ClassicLadder v" RELEASE_VER_STRING "\n" RELEASE_DATE_STRING "\n"
+	label = gtk_label_new ("    EMCLadder v" RELEASE_VER_STRING "\n" RELEASE_DATE_STRING "\n"
+						"EMC2 Development of Classicladder\n"
 						"Copyright (C) 2001-2006 Marc Le Douarain\nmarc . le - douarain /At\\ laposte \\DoT/ net\n"
 						"http://www.sourceforge.net/projects/classicladder\n";
 						"http://www.multimania.com/mavati/classicladder\n";
@@ -712,6 +714,7 @@
 #endif
 }
 
+
 void RungWindowInitGtk()
 {
     GtkWidget *vbox,*hboxtop,*hboxbottom,*hboxbottom2;
@@ -853,7 +856,12 @@
     gtk_signal_connect(GTK_OBJECT (ButtonSymbols), "clicked",
                         (GtkSignalFunc) OpenSymbolsWindow, 0);
     gtk_widget_show (ButtonSymbols);
-    ButtonConfig = gtk_button_new_with_label ("Config");
+   ButtonSymbols = gtk_button_new_with_label ("Vars"); // add button to open vars list
+    gtk_box_pack_start (GTK_BOX (hboxbottom2), ButtonSymbols, TRUE, TRUE, 0);
+    gtk_signal_connect(GTK_OBJECT (ButtonSymbols), "clicked",
+                        (GtkSignalFunc) OpenVarsWindow, 0);
+    gtk_widget_show (ButtonSymbols);
+   ButtonConfig = gtk_button_new_with_label ("Config");
     gtk_box_pack_start (GTK_BOX (hboxbottom2), ButtonConfig, TRUE, TRUE, 0);
     gtk_signal_connect(GTK_OBJECT (ButtonConfig), "clicked",
                         (GtkSignalFunc) ButtonConfig_click, 0);
@@ -909,29 +917,40 @@
 }
 
 gint VarsWindowDeleteEvent( GtkWidget * widget, GdkEvent * event, gpointer data )
-{
-	// we do not want that the window be destroyed.
+{   gtk_widget_hide (windowvars2); 
+	gtk_widget_hide (windowvars);
+	// we can not destroy
 	return TRUE;
 }
 
 void VarsWindowInitGtk()
 {
-	GtkWidget *windowvars;
+	//GtkWidget *windowvars;
+	//GtkWidget *windowvars2; // used for word variable list
 	GtkWidget *vboxboolvars[ NBR_TYPE_BOOLS_SPY ],*vboxmain,*hboxvars,*hboxvars2;
-	GtkWidget * hboxfreevars[ NBR_FREE_VAR_SPY ];
+	GtkWidget *hboxfreevars[ NBR_FREE_VAR_SPY ],*vboxmain2;//added cm
 	int NumCheckWidget,ColumnVar,NumVarSpy,NumEntry;
 	GList *DisplayFormatItems = NULL;
 	
+	windowvars2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); //added cm
+	gtk_window_set_title ((GtkWindow *)windowvars2, "Vars2"); // added cm
+	vboxmain2 = gtk_vbox_new (FALSE, 0);//added cm
+	gtk_container_add (GTK_CONTAINER (windowvars2), vboxmain2);//added cm
+	gtk_widget_show (vboxmain2);//added cm
+	
 	windowvars = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 	gtk_window_set_title ((GtkWindow *)windowvars, "Vars");
+	
 	vboxmain = gtk_vbox_new (FALSE, 0);
 	gtk_container_add (GTK_CONTAINER (windowvars), vboxmain);
 	gtk_widget_show (vboxmain);
+	
 	hboxvars = gtk_hbox_new (FALSE, 0);
 	gtk_container_add (GTK_CONTAINER (vboxmain), hboxvars);
 	gtk_widget_show (hboxvars);
+	
 	hboxvars2 = gtk_hbox_new (FALSE, 0);
-	gtk_container_add (GTK_CONTAINER (vboxmain), hboxvars2);
+	gtk_container_add (GTK_CONTAINER (vboxmain2), hboxvars2);// changed cm
 	gtk_widget_show (hboxvars2);
 
 	for( ColumnVar=0; ColumnVar<NBR_TYPE_BOOLS_SPY; ColumnVar++ )
@@ -968,17 +987,17 @@
 		}
 	}
 	UpdateAllLabelsBoolsVars( );
-
+// next is to build vars2 list
 	for(NumVarSpy=0; NumVarSpy<NBR_FREE_VAR_SPY; NumVarSpy++)
 	{
 		hboxfreevars[ NumVarSpy ] = gtk_hbox_new (FALSE, 0);
-		gtk_container_add (GTK_CONTAINER (vboxmain), hboxfreevars[ NumVarSpy ]);
+		gtk_container_add (GTK_CONTAINER (vboxmain2), hboxfreevars[ NumVarSpy ]);
 		gtk_widget_show (hboxfreevars[ NumVarSpy ]);
 		for(ColumnVar=0; ColumnVar<2; ColumnVar++)
 		{
 			NumEntry = NumVarSpy+ColumnVar*NBR_FREE_VAR_SPY;
 			EntryVarSpy[ NumEntry ] = gtk_entry_new();
-			gtk_widget_set_usize((GtkWidget *)EntryVarSpy[ NumEntry ],(ColumnVar==0)?50:80,0);
+			gtk_widget_set_usize((GtkWidget *)EntryVarSpy[ NumEntry ],(ColumnVar==0)?85:80,0);
 			gtk_box_pack_start (GTK_BOX( hboxfreevars[ NumVarSpy ] ), EntryVarSpy[ NumEntry ], TRUE, TRUE, 0);
 			gtk_widget_show(EntryVarSpy[NumEntry]);
 			if ( ColumnVar==0 )
@@ -999,9 +1018,28 @@
 	
 	gtk_signal_connect( GTK_OBJECT(windowvars), "delete_event",
 		(GtkSignalFunc)VarsWindowDeleteEvent, 0 );
-	gtk_widget_show (windowvars);
+	gtk_signal_connect( GTK_OBJECT(windowvars2), "delete_event",
+		(GtkSignalFunc)VarsWindowDeleteEvent, 0 );
+	//gtk_widget_show (windowvars2); //default the windows hidden
+	//gtk_widget_show (windowvars);
 }
 
+void OpenVarsWindow ( void )
+{
+	static int VarWindowToggle; // toggle variable
+	if (!VarWindowToggle)
+	{ gtk_widget_show (windowvars); //show windows
+	  gtk_window_present( GTK_WINDOW(windowvars) );
+	  gtk_widget_show (windowvars2);
+	  gtk_window_present( GTK_WINDOW(windowvars2) );
+	}
+	else {gtk_widget_hide (windowvars); //hide windows
+		  gtk_widget_hide (windowvars2);
+		 }
+		VarWindowToggle=(VarWindowToggle-1)*-1; //toggle
+}	
+
+
 char * ConvToBin( unsigned int Val )
 {
 	static char TabBin[ 33 ];
@@ -1033,6 +1071,8 @@
 	int Value;
 	char BufferValue[50];
 	char DisplayFormat[10];
+	static int LastTime;
+	int NumEntry;
 	for (NumVarSpy=0; NumVarSpy<NBR_FREE_VAR_SPY; NumVarSpy++)
 	{
 		Value = ReadVar(VarSpy[NumVarSpy][0],VarSpy[NumVarSpy][1]);
@@ -1045,7 +1085,17 @@
 		if (strcmp( DisplayFormat,"Bin" )==0 )
 			strcpy( BufferValue, ConvToBin( Value ) );
 		gtk_entry_set_text((GtkEntry *)EntryVarSpy[NBR_FREE_VAR_SPY+NumVarSpy],BufferValue);
+		if (InfosGene->DisplaySymbols!=LastTime) //check if changed
+		{	
+		 	NumEntry = NumVarSpy+0*NBR_FREE_VAR_SPY;// change symbols/variables
+			gtk_entry_set_text((GtkEntry *)EntryVarSpy[ NumEntry ],DisplayInfo(VarSpy[NumVarSpy][0],VarSpy[NumVarSpy][1]));
+		}
+					
 	}
+	if (InfosGene->DisplaySymbols!=LastTime) //check if changed
+		{
+			LastTime=((LastTime-1)*-1); //toggle update of Variables
+		}			
 }
 
 void RefreshOneBoolVar( int Type, int Num, int Val )
Index: hal/classicladder/classicladder_gtk.h
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/classicladder_gtk.h,v
retrieving revision 1.5
diff -u -r1.5 classicladder_gtk.h
--- hal/classicladder/classicladder_gtk.h	16 Nov 2006 01:45:33 -0000	1.5
+++ hal/classicladder/classicladder_gtk.h	3 Apr 2007 08:51:55 -0000
@@ -11,4 +11,4 @@
 void quit_appli();
 void InitGtkWindows( int argc, char *argv[] );
 void UpdateGtkAfterLoading( char cCreateTimer );
-
+void OpenVarsWindow( void );
Index: hal/classicladder/edit.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/edit.c,v
retrieving revision 1.3
diff -u -r1.3 edit.c
--- hal/classicladder/edit.c	16 Nov 2006 01:45:33 -0000	1.3
+++ hal/classicladder/edit.c	3 Apr 2007 08:51:55 -0000
@@ -456,80 +456,166 @@
 char * TextParserForArithmExpr(char * text, int TypeElement)
 {
 	static char NewExpr[100];
-	char Buffer[20];
+	static char Buffer[20];
+	static char Temp [2];
 	int ItIsOk = TRUE;
+	int BeenHere = FALSE;
+	int HaveAUnit= FALSE;
 	int VarType;
 	int VarOffset;
-	char * ptr = text;
 	int StringLength;
+	char * tmpptr = text;
+	char * bufptr = Buffer;
 	ErrorMessageVarParser = NULL;
 	strcpy(NewExpr,"");
-	/* Convert expression for variables authorized */
-	do
-	{
-//TODO: symbols strings to support here...
-		/* Verify if it is a variable (character and number) */
-		if ( *ptr=='%' && *(ptr+2)>='0' && *(ptr+2)<='9' )
-		{
-			switch(*(ptr+1))
-			{
-				case 'W':
-				case 'T':
-				case 'M':
-				case 'C':
-				case 'X':
-					if (TextParserForAVar(ptr,&VarType,&VarOffset,&StringLength,FALSE/*PartialNames*/))
+	strcpy(Buffer,"");
+	
+	// we want to break the text into a "unit". The unit is between the math 
+	// symbols. The unit is check for a symbol, proper variable, decimal or text and converted. 
+	
+	// if the text is empty then set an error which does nothing
+	if (*tmpptr == '\0') { ItIsOk=FALSE;}
+	
+	do{
+		do{
+			
+			 
+			switch (*tmpptr)
+			{
+			case '\0':// we have found the end-must be a unit to check
+				HaveAUnit= TRUE; 
+			    break;
+			case ' ':
+				ItIsOk= FALSE;
+				ErrorMessageVarParser="No spaces allowed.";
+				break;
+			case '=':case '<':case '>':case '*':case '/':case '|':case ',':
+			case '!':case '&':case '+':case '-':case ')':case '^':
+				if (BeenHere==TRUE) // been here before then save the math symbols
+					{ printf("added %c to NewExpr\n",*tmpptr);
+						sprintf (Temp,"%c",*tmpptr);
+					  strcat(NewExpr,Temp);
+					  tmpptr ++;
+					}
+				else { printf("set been here true\n");
+					HaveAUnit=TRUE;// otherwise we have a unit to check
+					   BeenHere=TRUE;
+					 }
+				break;
+			case '(': // is this the beginning bracket of absolute, minimum, maximum or average(MOY) funtion? 
+					 if (strcmp(Buffer,"ABS")==0 || strcmp(Buffer,"MINI")|| strcmp(Buffer,"MAXI")||strcmp(Buffer,"MOY"))  
+					 	{	sprintf(Temp,"%c",*tmpptr);// add ( to our buffer 
+					 		strcat(Buffer,Temp);
+							strcat(NewExpr,Buffer); // add Buffer to NewExp
+							strcpy(Buffer,""); //clear buffer
+							tmpptr ++;   // next character
+						}
+					else
+					{
+						 printf("added %c to NewExpr NewExpr %s\n",*tmpptr,NewExpr); 
+						sprintf (Temp,"%c",*tmpptr); // add it to NewExpr
+					  strcat(NewExpr,Temp);
+					  tmpptr ++;
+					}	
+				break;
+					 default:
+					 printf("added %c to Buffer\n",*tmpptr);
+					 sprintf(Temp,"%c",*tmpptr);// add it to our buffer to make a unit
+					 strcat(Buffer,Temp);
+					 tmpptr ++;
+					 BeenHere=FALSE;
+				break;
+				 }
+					 
+		
+			 }	 
+			while (HaveAUnit == FALSE && ItIsOk == TRUE);			 
+
+		if (ItIsOk == TRUE) // we have a unit and no error
+		{
+			printf("Have a unit! %s\n",Buffer);
+			if (*bufptr !='%') // if not a variable
+				{
+					char * VarName=ConvSymbolToVarName(bufptr);// check for symbols
+					
+					if (VarName!=NULL)
+						{ printf("converted symbol to variable %s,%s\n",Buffer,VarName);
+							strcpy(Buffer,""); // empty buffer of symbols
+						  strcpy(Buffer,VarName); // copy the variable in
+						}
+				}
+			if (*bufptr !='%') // still not a variable?
+			 	{	printf("checking for a number\n");
+					switch (*bufptr) // does it have to do with numbers dec or hex?
 					{
+								case '0':case '1':case '2':case '3':
+								case '4':case '5':case '6':case '7':
+								case '8':case '9':case '-':case '+':
+								case '(':case ')':case '$':case '\0': //or at the end
+								printf("found number\n");	
+								break;
+
+								default:
+								printf("'%c' is not a number!\n",*bufptr);  		
+								ItIsOk=FALSE;
+										ErrorMessageVarParser="Not a symbol or dec/Hex number";
+			                    	break;	
+					}
+				}								
+			if (*bufptr =='%' && *(bufptr+2) >='0' && *(bufptr+2)<='9') //now a variable?
+			{   printf("Its a variable!\n");
+				switch (*(bufptr+1)) // is it the right variable?
+				{
+						case 'W':case 'T':case 'M':case 'C':case 'X':
+							if (TextParserForAVar(bufptr,&VarType,&VarOffset,&StringLength,FALSE/*PartialNames allowed*/))
+					{
+						strcpy(Buffer,"");
 						sprintf(Buffer,"@%d/%d@",VarType,VarOffset);
 						strcat(NewExpr,Buffer);
-						ptr+=StringLength;
+						strcpy(Buffer,"");
+						HaveAUnit=FALSE;
+						printf("new expresion=%s\nbuffer=%s\n",NewExpr,Buffer);
 						if ( VarType<VAR_ARE_WORD )
-						{
+						{printf("variable atribute error 1");
 							ItIsOk = FALSE;
 							ErrorMessageVarParser = "Incompatible type of variable (must be an integer!)";
 						}
 					}
 					else
-					{
+					{   printf("variable atribute error 2");
 						ItIsOk = FALSE;
 					}
+					
 					break;
-				// booleans variables not allowed for arithmetic expressions...
-				case 'B':
-				case 'I':
-				case 'Q':
-					ItIsOk = FALSE;
-					ErrorMessageVarParser = "Incompatible type of variable";
-					break;
-				case '\0':
-					ItIsOk = FALSE;
-					ErrorMessageVarParser = "Null expression not valid";
-					break;
+				
 				default:
-					sprintf(Buffer,"%c",*ptr);
-					strcat(NewExpr, Buffer);
-					ptr++;
-					break;
+						ItIsOk=FALSE;
+						ErrorMessageVarParser = "can only use W,T,M,C,X variable letters";
+					   break;
+				}
 			}
-		}
 		else
-		{
-			sprintf(Buffer,"%c",*ptr);
-			strcat(NewExpr, Buffer);
-			ptr++;
-		}
-	}
-	while( (*ptr) && ItIsOk );
-	/* Verify length of the expression */
-	if (ItIsOk)
-	{
-		if (strlen(NewExpr)>=ARITHM_EXPR_SIZE)
-		{
-			ItIsOk = FALSE;
-			ErrorMessageVarParser = "Expression too long";
+		    {if (*tmpptr=='%')
+				{   ItIsOk=FALSE;
+					ErrorMessageVarParser = "Syntaxt error in variable";
+				}
+				else 
+				{
+				 if (ItIsOk== TRUE)
+				 	{ 	printf("Adding %s to NewExpr_%s\n",Buffer,NewExpr);
+						strcat(NewExpr,Buffer);
+				  		strcpy(Buffer,"");					
+						HaveAUnit=FALSE;
+					}
+				}
+			}
 		}
 	}
-//printf("Parser Arithm ; ItIsOk=%d ; OriExpr=%s ; NewExpr=%s\n",ItIsOk, text, NewExpr);
+	while (ItIsOk != FALSE && *tmpptr!='\0');// not at end,no error? 
+		
+			
+//printf("\n itisok= %d   tmpptr= %c\n",ItIsOk,*tmpptr); //debug info	
+printf("Parser Arithm ; ItIsOk=%d ; OriExpr=%s ; NewExpr=%s\n",ItIsOk, text, NewExpr);
 	/* Verify expression converted */
 	if (ItIsOk)
 	{
@@ -547,8 +633,10 @@
 	}
 	/* Give result */
 	if (ItIsOk)
+	{	printf("returned %s\n",NewExpr);	
 		return NewExpr;
-	else
+	}
+		else
 		return NULL;
 }
 
Index: hal/classicladder/edit_gtk.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/edit_gtk.c,v
retrieving revision 1.4
diff -u -r1.4 edit_gtk.c
--- hal/classicladder/edit_gtk.c	16 Nov 2006 01:45:33 -0000	1.4
+++ hal/classicladder/edit_gtk.c	3 Apr 2007 08:51:56 -0000
@@ -271,12 +271,67 @@
 				switch( ToolBarEle.Type )
 				{
 					case EDIT_POINTER:
-						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Selector", NULL);
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Current Object\n Selector", NULL);
 						break;
 					case EDIT_ERASER:
 						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Eraser", NULL);
 						break;
-				}
+					case ELE_RISING_INPUT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Rising Edge Input", NULL);
+						break;
+					case ELE_FALLING_INPUT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Falling Edge Input", NULL);
+						break;
+					case ELE_INPUT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Input", NULL);
+						break;
+					case ELE_INPUT_NOT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Input Not", NULL);
+						break;
+					case ELE_CONNECTION:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Horizontal Conection", NULL);
+						break;
+					case EDIT_CNX_WITH_TOP:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Vertical Conection", NULL);
+						break;
+					case EDIT_LONG_CONNECTION:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Running Connection", NULL);
+						break;
+					case ELE_TIMER:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Timer", NULL);
+						break;
+					case ELE_MONOSTABLE:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Monostable", NULL);
+						break;
+					case ELE_COUNTER:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Counter", NULL);
+						break;
+					case ELE_COMPAR:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Compare Variable", NULL);
+						break;
+					case ELE_OUTPUT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Output", NULL);
+						break;
+					case ELE_OUTPUT_NOT:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Output Not", NULL);
+						break;
+					case ELE_OUTPUT_SET:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Output Set", NULL);
+						break;
+					case ELE_OUTPUT_RESET:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Output Reset", NULL);
+						break;
+					case ELE_OUTPUT_JUMP:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Jump Coil", NULL);
+						break;
+					case ELE_OUTPUT_CALL:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Call Coil", NULL);
+						break;
+					case ELE_OUTPUT_OPERATE:
+						gtk_tooltips_set_tip (TheTooltips, ToolbarBtnRadio[ CurrentAvail ], "Variable Assignment", NULL);
+						break;
+					
+					}
 
 				gtk_widget_show( ToolbarBtnRadio[ CurrentAvail ] );
 				CurrentAvail++;
@@ -354,4 +409,3 @@
 
 	EditDatas.NumElementSelectedInToolBar = -1;
 }
-
Index: hal/classicladder/files.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/files.c,v
retrieving revision 1.6
diff -u -r1.6 files.c
--- hal/classicladder/files.c	16 Nov 2006 01:45:33 -0000	1.6
+++ hal/classicladder/files.c	3 Apr 2007 08:51:56 -0000
@@ -987,27 +987,27 @@
 
 	printf("Loading datas from %s...\n", DatasDirectory);
 	sprintf(FileName,"%s/timers.csv",DatasDirectory);
-//	printf("Loading timers datas from %s\n",FileName);
+	printf("Loading timers datas from %s\n",FileName);
 	LoadTimersParams(FileName,TimerArray);
 	sprintf(FileName,"%s/monostables.csv",DatasDirectory);
-//	printf("Loading monostables datas from %s\n",FileName);
+	printf("Loading monostables datas from %s\n",FileName);
 	LoadMonostablesParams(FileName,MonostableArray);
 	sprintf(FileName,"%s/counters.csv",DatasDirectory);
-//	printf("Loading counters datas from %s\n",FileName);
+	printf("Loading counters datas from %s\n",FileName);
 	LoadCountersParams(FileName);
 	PrepareTimers();
 	PrepareMonostables();
 	PrepareCounters();
 
 	sprintf(FileName,"%s/arithmetic_expressions.csv",DatasDirectory);
-//	printf("Loading arithmetic expressions from %s\n",FileName);
+	printf("Loading arithmetic expressions from %s\n",FileName);
 	LoadArithmeticExpr(FileName);
 
 	// Sections added since v0.5.5, the format of files has a little changed :
 	// before the prev/next rungs were not saved in each rung...
 	// and the nmber of rungs changed when saved...
 	sprintf(FileName,"%s/sections.csv",DatasDirectory);
-//	printf("Loading sections datas from %s\n",FileName);
+    printf("Loading sections datas from %s\n",FileName);
 	if ( LoadSectionsParams(FileName) )
 	{
 		sprintf(FileName,"%s/rung_",DatasDirectory);
@@ -1024,18 +1024,19 @@
 	}
 #ifdef SEQUENTIAL_SUPPORT
 	sprintf(FileName,"%s/sequential.csv",DatasDirectory);
-//	printf("Loading sequential datas from %s\n",FileName);
+	printf("Loading sequential datas from %s\n",FileName);
 	LoadSequential( FileName );
 #endif
 	sprintf(FileName,"%s/ioconf.csv",DatasDirectory);
-//	printf("Loading I/O configuration datas from %s\n",FileName);
+	printf("Loading I/O configuration datas from %s\n",FileName);
 	LoadIOConfParams( FileName );
 #ifdef USE_MODBUS
 	sprintf(FileName,"%s/modbusioconf.csv",DatasDirectory);
-//	printf("Loading modbus distributed I/O configuration datas from %s\n",FileName);
+	printf("Loading modbus distributed I/O configuration datas from %s\n",FileName);
 	LoadModbusIOConfParams( FileName );
 #endif
 	sprintf(FileName,"%s/symbols.csv",DatasDirectory);
+	printf("Loading symbols from %s\n",FileName);
 	LoadSymbols(FileName);
 
 	PrepareRungs();
Index: hal/classicladder/global.h
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/global.h,v
retrieving revision 1.4
diff -u -r1.4 global.h
--- hal/classicladder/global.h	16 Nov 2006 01:45:33 -0000	1.4
+++ hal/classicladder/global.h	3 Apr 2007 08:51:56 -0000
@@ -31,6 +31,10 @@
 extern GtkWidget *drawing_area;
 //extern GtkWidget *chkvar[40];
 extern GtkWidget *EditWindow;
+extern GtkWidget *windowvars;
+extern GtkWidget *windowvars2;
+
+
 #endif
 
 extern char LadderDirectory[400];
@@ -55,4 +59,3 @@
 #endif
 
 extern char * ErrorMessageVarParser;
-
Index: hal/classicladder/module_hal.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/module_hal.c,v
retrieving revision 1.1
diff -u -r1.1 module_hal.c
--- hal/classicladder/module_hal.c	6 Nov 2006 23:41:35 -0000	1.1
+++ hal/classicladder/module_hal.c	3 Apr 2007 08:51:56 -0000
@@ -54,11 +54,12 @@
 #else
 #define numPhysInputs InfosGene->SizesInfos.nbr_phys_inputs
 #define numPhysOutputs InfosGene->SizesInfos.nbr_phys_outputs
+#define numWords InfosGene->SizesInfos.nbr_words
 #endif
 
 hal_bit_t **hal_inputs;
 hal_bit_t **hal_outputs;
-
+hal_s32_t **hal_s32_inputs;
 extern plc_sizeinfo_s sinfo;
 
 #define TIME_REFRESH_RUNG_NS (1000 * 1000 * (TIME_REFRESH_RUNG_MS))
@@ -70,6 +71,13 @@
 	}
 }
 
+void HalReads32Inputs(void) {
+	int i;
+	for( i=0; i<4; i++) {
+		WriteVar(VAR_MEM_WORD, i, *hal_s32_inputs[i]);
+	}
+}
+
 void HalWritePhysicalOutputs(void) {
 	int i;
 	for( i=0; i<InfosGene->SizesInfos.nbr_phys_outputs; i++) {
@@ -90,6 +98,8 @@
 
 			HalReadPhysicalInputs();
 
+			HalReads32Inputs();
+
 			RefreshAllRungs();
 
 			HalWritePhysicalOutputs();
@@ -117,6 +127,8 @@
 
 	hal_inputs = hal_malloc(sizeof(hal_bit_t*) * numPhysInputs);
 	if(!hal_inputs) { result = -ENOMEM; goto error; }
+	hal_s32_inputs = hal_malloc(sizeof(hal_s32_t*) * numWords);
+	if(!hal_s32_inputs) { result = -ENOMEM; goto error; }
 	hal_outputs = hal_malloc(sizeof(hal_bit_t*) * numPhysOutputs);
 	if(!hal_outputs) { result = -ENOMEM; goto error; }
 
@@ -126,6 +138,12 @@
 		if(result < 0) goto error;
 	}
 
+	for(i=0; i<4; i++) {
+		result = hal_pin_s32_newf(HAL_IN, &hal_s32_inputs[i], compId,
+				"classicladder.0.s32in-%02d", i);
+		if(result < 0) goto error;
+	}
+
 	for(i=0; i<numPhysOutputs; i++) {
 		result = hal_pin_bit_newf(HAL_OUT, &hal_outputs[i], compId,
 				"classicladder.0.out-%02d", i);
Index: hal/classicladder/symbols.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/symbols.c,v
retrieving revision 1.1
diff -u -r1.1 symbols.c
--- hal/classicladder/symbols.c	6 Nov 2006 23:41:35 -0000	1.1
+++ hal/classicladder/symbols.c	3 Apr 2007 08:51:56 -0000
@@ -39,12 +39,15 @@
 void InitSymbols( void )
 {
 	int ScanSymb;
-	for ( ScanSymb=0; ScanSymb<NBR_SYMBOLS; ScanSymb++ )
+
+		for ( ScanSymb=0; ScanSymb<NBR_SYMBOLS-1; ScanSymb++ )
 	{
 		SymbolArray[ ScanSymb ].VarName[ 0 ] = '\0';
 		SymbolArray[ ScanSymb ].Symbol[ 0 ] = '\0';
 		SymbolArray[ ScanSymb ].Comment[ 0 ] = '\0';
 	}
+		strcpy( SymbolArray[NBR_SYMBOLS-1].VarName, "%W0\0" );
+		strcpy( SymbolArray[NBR_SYMBOLS-1].Symbol, "HALsIn0\0" );
 }
 
 
@@ -195,4 +198,3 @@
 		return NULL;
 	}
 }
-
Index: hal/classicladder/symbols_gtk.c
===================================================================
RCS file: /cvs/emc2/src/hal/classicladder/symbols_gtk.c,v
retrieving revision 1.1
diff -u -r1.1 symbols_gtk.c
--- hal/classicladder/symbols_gtk.c	6 Nov 2006 23:41:35 -0000	1.1
+++ hal/classicladder/symbols_gtk.c	3 Apr 2007 08:51:56 -0000
@@ -68,7 +68,8 @@
 /* The callback for the editing of text in our GtkTreeView */
 /* data=column number */
 void Callback_TextEdited(GtkCellRendererText *cell, gchar *path_string,
-		      gchar *new_text, gpointer data) {
+		      gchar *new_text, gpointer data)
+{
 
 	int OffsetArray = -999;
 	StrSymbol * pSymbol = NULL;
@@ -84,8 +85,8 @@
 						-1);
 	gtk_list_store_set( ListStore, &iter,
 					data, new_text, -1);
-//printf( "path=%s, new_text=%s, data_column=%d, offset_array=%d\n",path_string, new_text, (int)data, OffsetArray );
-	pSymbol = &SymbolArray[ OffsetArray ];
+printf( "path=%s, new_text=%s, data_column=%d, offset_array=%d\n",path_string, new_text, (int)data, OffsetArray );
+	pSymbol = &SymbolArray[ OffsetArray ];//changed above line to print
 	switch( (int)data )
 	{
 		case VAR_NAME:
@@ -128,18 +129,25 @@
 
 gint SymbolsWindowDeleteEvent( GtkWidget * widget, GdkEvent * event, gpointer data )
 {
-	gtk_widget_hide( SymbolsWindow );
+	gtk_widget_hide( SymbolsWindow );// can be toggled hidden/shown
 	// we do not want that the window be destroyed.
 	return TRUE;
 }
 
 void OpenSymbolsWindow( void )
 {
-	gtk_widget_show (SymbolsWindow);
-#ifdef GTK2
-	gtk_window_present( GTK_WINDOW(SymbolsWindow) );
-#endif
-}
+	static int SymbolWindowToggle; // toggle variable
+	if (!SymbolWindowToggle)
+	{ gtk_widget_show (SymbolsWindow); //show windows
+	  gtk_window_present( GTK_WINDOW(SymbolsWindow) );
+	  
+	}
+	else {gtk_widget_hide (SymbolsWindow); //hide windows
+		  gtk_widget_hide (SymbolsWindow);
+		 }
+		SymbolWindowToggle=(SymbolWindowToggle-1)*-1; //toggle
+}	
+
 
 void SymbolsInitGtk()
 {
@@ -193,4 +201,3 @@
 
 //gtk_widget_show (SymbolsWindow);
 }
-

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to