antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright gtkshell/Makefile gtkshell/gtkshell.h...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright gtkshell/Makefile gtkshell/gtkshell.h...
Date: Mon, 16 Apr 2007 01:50:31 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/04/16 01:50:31

Modified files:
        gtkshell       : Makefile gtkshell.h guidl_util.c guidl_util.h 
Added files:
        gtkshell       : guidl_widgets.c guidl_widgets.h 
        libantiright   : tuple.c tuple.h 

Log message:
        Added tuple files and the initial guidl_widgets dictionary-based
        widget addition code.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/Makefile?cvsroot=antiright&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.h?cvsroot=antiright&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_util.c?cvsroot=antiright&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_util.h?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_widgets.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_widgets.h?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/tuple.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/tuple.h?cvsroot=antiright&rev=1.1

Patches:
Index: gtkshell/Makefile
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/Makefile,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- gtkshell/Makefile   13 Apr 2007 22:48:25 -0000      1.23
+++ gtkshell/Makefile   16 Apr 2007 01:50:31 -0000      1.24
@@ -38,7 +38,7 @@
        file_dialog.o row.o containers.o geometry.o font.o dragdrop.o\
        image_button.o terminal.o terminal_options.o menu.o updated.o\
        guidl_util.o about_dialog.o init.o guidl_dialog.o guidl_dictionary.o\
-       guidl_options.o
+       guidl_options.o guidl_widgets.o
 
 program=main.o 
 

Index: gtkshell/gtkshell.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- gtkshell/gtkshell.h 13 Apr 2007 22:48:25 -0000      1.33
+++ gtkshell/gtkshell.h 16 Apr 2007 01:50:31 -0000      1.34
@@ -98,6 +98,7 @@
 #include "init.h"
 #include "guidl_dialog.h"
 #include "guidl_options.h"
+#include "guidl_widgets.h"
 
 GtkWidget *
 gsh_create_main_window();

Index: gtkshell/guidl_util.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- gtkshell/guidl_util.c       16 Apr 2007 01:19:51 -0000      1.8
+++ gtkshell/guidl_util.c       16 Apr 2007 01:50:31 -0000      1.9
@@ -111,8 +111,10 @@
 
 
 void
-gsh_guidl_add(const char * switches, gchar * argument)
+gsh_guidl_add(const gchar * switches, gchar * argument)
 {
+       if(switches == NULL)
+               return;
        gsh_append_arg((gchar *)switches);
        if(argument != NULL)
        {

Index: gtkshell/guidl_util.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_util.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/guidl_util.h       13 Apr 2007 22:48:25 -0000      1.4
+++ gtkshell/guidl_util.h       16 Apr 2007 01:50:31 -0000      1.5
@@ -72,7 +72,7 @@
 
 /* SWITCHES is not freed.  If dynamically allocated, you must free.  */
 void
-gsh_guidl_add(const char * switches, gchar * argument);
+gsh_guidl_add(const gchar * switches, gchar * argument);
 
 void
 gsh_guidl_string_dialog(gchar * string);

Index: gtkshell/guidl_widgets.c
===================================================================
RCS file: gtkshell/guidl_widgets.c
diff -N gtkshell/guidl_widgets.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gtkshell/guidl_widgets.c    16 Apr 2007 01:50:31 -0000      1.1
@@ -0,0 +1,53 @@
+/*
+  AntiRight
+  (c) 2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#include "gtkshell.h"
+
+extern struct GDLEnvironment * gsh_guidl_env;
+
+#define DEF(a, b) GSH_GUIDL_DEFINE(widgets, a, b)
+
+static void
+setup_definitions(struct ARTupleVector * widgets)
+{
+       DEF("label", "-al");
+       DEF("field", "-at");
+       DEF("terminal", "-as");
+}
+
+static void
+setup_dictionary()
+{
+       setup_definitions(gsh_guidl_env->dictionaries.widgets
+                         =ar_new_ARTupleVector());
+}
+
+void
+gsh_guidl_widget(gchar * widget, gchar * argument)
+{
+       GSH_GUIDL_CHECK_DICTIONARY(widgets);
+       gsh_guidl_add(gsh_guidl_lookup(gsh_guidl_env->dictionaries.widgets, 
+                                      widget),
+                     argument);
+       g_free(widget);         
+}
+

Index: gtkshell/guidl_widgets.h
===================================================================
RCS file: gtkshell/guidl_widgets.h
diff -N gtkshell/guidl_widgets.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gtkshell/guidl_widgets.h    16 Apr 2007 01:50:31 -0000      1.1
@@ -0,0 +1,29 @@
+/*
+  AntiRight
+  (c) 2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef GSH_GUIDL_WIDGETS_H
+#define GSH_GUIDL_WIDGETS_H
+
+void
+gsh_guidl_widget(gchar * widget, gchar * argument);
+
+#endif /* GSH_GUIDL_WIDGETS_H */

Index: libantiright/tuple.c
===================================================================
RCS file: libantiright/tuple.c
diff -N libantiright/tuple.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libantiright/tuple.c        16 Apr 2007 01:50:31 -0000      1.1
@@ -0,0 +1,90 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#include "library.h"
+
+struct ARTuple *
+ar_new_ARTuple(gchar * key, gchar * value)
+{
+       struct ARTuple * tuple;
+
+       tuple=g_malloc(sizeof(struct ARTuple));
+       tuple->key=g_strdup(key);
+       tuple->value=g_strdup(value);
+
+       return tuple;
+}
+
+void
+ar_delete_ARTuple(struct ARTuple * tuple)
+{
+       g_free(tuple->key);
+       g_free(tuple->value);
+       g_free(tuple);
+}
+
+struct ARTupleVector *
+ar_new_ARTupleVector()
+{
+       struct ARTupleVector * vector;
+
+       vector=g_malloc(sizeof(struct ARTupleVector));
+       vector->data=NULL;
+       vector->elements=0;
+       vector->add=&ar_ARTupleVector_add;
+       vector->find=&ar_ARTupleVector_find;
+
+       return vector;
+}
+
+void
+ar_delete_ARTupleVector(struct ARTupleVector * vector)
+{
+       while(vector->elements > 1)
+               ar_delete_ARTuple(vector->data[(--(vector->elements))-1]);
+       g_free(vector);
+}
+
+void
+ar_ARTupleVector_add(struct ARTupleVector * vector,
+                    gchar * key, gchar * value)
+{
+       vector->data=realloc(vector->data, 
+                            ++vector->elements * sizeof(struct ARTuple *));
+       vector->data[vector->elements-1]=ar_new_ARTuple(key, value);
+}
+
+const gchar *
+ar_ARTupleVector_find(struct ARTupleVector * vector,
+                     gchar * term)
+{
+       guint i;
+#ifdef DEBUG
+       ARPASSERT(vector);
+       ARPASSERT(vector->data);
+#endif /* DEBUG */
+       for(i=0; i < vector->elements; i++)
+               if(!strcmp(vector->data[i]->key, term))
+                       return vector->data[i]->value;
+       /* TERM not found.  */
+       return NULL;
+}

Index: libantiright/tuple.h
===================================================================
RCS file: libantiright/tuple.h
diff -N libantiright/tuple.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libantiright/tuple.h        16 Apr 2007 01:50:31 -0000      1.1
@@ -0,0 +1,63 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef AR_TUPLE_H
+#define AR_TUPLE_H
+
+struct ARTuple
+{
+       gchar * key;
+       gchar * value;
+};
+
+struct ARTupleVector
+{
+       struct ARTuple ** data;
+       guint elements;
+       void (*add)(struct ARTupleVector *, gchar *, gchar *);
+       const gchar * (*find)(struct ARTupleVector *, gchar *);
+};
+
+struct ARTuple *
+ar_new_ARTuple(gchar * key, gchar * value);
+
+void
+ar_delete_ARTuple(struct ARTuple * tuple);
+
+struct ARTupleVector *
+ar_new_ARTupleVector();
+
+void
+ar_delete_ARTupleVector(struct ARTupleVector * vector);
+
+void
+ar_ARTupleVector_add(struct ARTupleVector * vector,
+                    gchar * key, gchar * value);
+
+
+const gchar *
+ar_ARTupleVector_find(struct ARTupleVector * vector,
+                     gchar * term);
+
+
+#endif /* AR_TUPLE_H */
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]