[Gnucash-changes] r13213 - gnucash/trunk - Globally replace the words "exchange_code" with cusip in the

David Hampton hampton at cvs.gnucash.org
Sat Feb 11 15:00:53 EST 2006


Author: hampton
Date: 2006-02-11 15:00:52 -0500 (Sat, 11 Feb 2006)
New Revision: 13213
Trac: http://svn.gnucash.org/trac/changeset/13213

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
   gnucash/trunk/src/backend/file/test/test-xml-commodity.c
   gnucash/trunk/src/backend/postgres/table.m4
   gnucash/trunk/src/engine/gnc-commodity.c
   gnucash/trunk/src/engine/gnc-commodity.h
   gnucash/trunk/src/engine/gw-engine-spec.scm
   gnucash/trunk/src/engine/test-core/test-engine-stuff.c
   gnucash/trunk/src/engine/test/test-commodities.c
   gnucash/trunk/src/gnome-utils/dialog-commodity.c
   gnucash/trunk/src/gnome-utils/dialog-commodity.h
   gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.c
   gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.h
   gnucash/trunk/src/gnome-utils/gnc-tree-view-commodity.c
   gnucash/trunk/src/import-export/import-commodity-matcher.c
   gnucash/trunk/src/import-export/import-commodity-matcher.h
   gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
Log:
Globally replace the words "exchange_code" with cusip in the
source. No user visible changes.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/ChangeLog	2006-02-11 20:00:52 UTC (rev 13213)
@@ -1,3 +1,19 @@
+2006-02-11  David Hampton  <hampton at employees.org>
+
+	* src/backend/file/test/test-xml-commodity.c:
+	* src/backend/file/gnc-commodity-xml-v2.c:
+	* src/backend/postgres/table.m4:
+	* src/import-export/ofx/gnc-ofx-import.c:
+	* src/import-export/import-commodity-matcher.[ch]:
+	* src/gnome-utils/gnc-tree-view-commodity.c:
+	* src/gnome-utils/gnc-tree-model-commodity.[ch]:
+	* src/gnome-utils/dialog-commodity.[ch]:
+	* src/engine/gw-engine-spec.scm:
+	* src/engine/test-core/test-engine-stuff.c:
+	* src/engine/test/test-commodities.c:
+	* src/engine/gnc-commodity.[ch]: Globally replace the words
+	"exchange_code" with cusip in the source. No user visible changes.
+
 2006-02-11  Christian Stimming  <stimming at tuhh.de>
 
 	* po/Makevars: Add --keyword=Q_ to xgettext arguments so that

Modified: gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -81,12 +81,12 @@
                                           gnc_commodity_get_fullname(com)));
     }
 
-    if(gnc_commodity_get_exchange_code(com) &&
-       strlen(gnc_commodity_get_exchange_code(com)) > 0)
+    if(gnc_commodity_get_cusip(com) &&
+       strlen(gnc_commodity_get_cusip(com)) > 0)
     {
         xmlAddChild(ret, text_to_dom_tree(
                         cmdty_xcode,
-                        gnc_commodity_get_exchange_code(com)));
+                        gnc_commodity_get_cusip(com)));
     }
 
     xmlAddChild(ret, int_to_dom_tree(cmdty_fraction,
@@ -117,7 +117,7 @@
     { cmdty_namespace,    gnc_commodity_set_namespace },
     { cmdty_id,           gnc_commodity_set_mnemonic },
     { cmdty_name,         gnc_commodity_set_fullname },
-    { cmdty_xcode,        gnc_commodity_set_exchange_code },
+    { cmdty_xcode,        gnc_commodity_set_cusip },
     { cmdty_quote_tz,     gnc_commodity_set_quote_tz },
     { 0, 0 }
 };

Modified: gnucash/trunk/src/backend/file/test/test-xml-commodity.c
===================================================================
--- gnucash/trunk/src/backend/file/test/test-xml-commodity.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/backend/file/test/test-xml-commodity.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -76,7 +76,7 @@
         else if(safe_strcmp((char*)mark->name, "cmdty:xcode") == 0)
         {
             if(!equals_node_val_vs_string(
-                   mark, gnc_commodity_get_exchange_code(com)))
+                   mark, gnc_commodity_get_cusip(com)))
             {
                 return "exchange codes differ";
             }

Modified: gnucash/trunk/src/backend/postgres/table.m4
===================================================================
--- gnucash/trunk/src/backend/postgres/table.m4	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/backend/postgres/table.m4	2006-02-11 20:00:52 UTC (rev 13213)
@@ -62,7 +62,7 @@
        namespace,    , char *, gnc_commodity_get_namespace(ptr),
        fullname,     , char *, gnc_commodity_get_fullname(ptr),
        mnemonic,     , char *, gnc_commodity_get_mnemonic(ptr),
-       code,         , char *, gnc_commodity_get_exchange_code(ptr),
+       code,         , char *, gnc_commodity_get_cusip(ptr),
        fraction,     , int32,  gnc_commodity_get_fraction(ptr),
        commodity, KEY, char *, gnc_commodity_get_unique_name(ptr),
        ')

Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/engine/gnc-commodity.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -55,7 +55,7 @@
   char    * fullname;  
   char    * mnemonic;
   char    * printname;
-  char    * exchange_code;  /* CUSIP or other identifying code */
+  char    * cusip;          /* CUSIP or other identifying code */
   int       fraction;
   char    * unique_name;  
   gint16    mark;           /* user-defined mark, handy for traversals */
@@ -502,8 +502,7 @@
 gnc_commodity *
 gnc_commodity_new(QofBook *book, const char * fullname, 
                   const char * namespace, const char * mnemonic, 
-                  const char * exchange_code, 
-                  int fraction)
+                  const char * cusip, int fraction)
 {
   gnc_commodity * retval = g_new0(gnc_commodity, 1);
   gnc_commodity_table *table;
@@ -520,7 +519,7 @@
   
   retval->fullname = CACHE_INSERT(fullname);
   retval->mnemonic = CACHE_INSERT(mnemonic);
-  retval->exchange_code = CACHE_INSERT(exchange_code);
+  retval->cusip = CACHE_INSERT(cusip);
   retval->fraction = fraction;
   retval->mark = 0;
   retval->quote_flag = 0;
@@ -548,7 +547,7 @@
 
   /* Set at creation */
   CACHE_REMOVE (cm->fullname);
-  CACHE_REMOVE (cm->exchange_code);
+  CACHE_REMOVE (cm->cusip);
   CACHE_REMOVE (cm->mnemonic);
   CACHE_REMOVE (cm->quote_tz);
   cm->namespace = NULL;
@@ -575,7 +574,7 @@
   gnc_commodity_set_fullname (dest, src->fullname);
   dest->namespace = src->namespace;
   gnc_commodity_set_fraction (dest, src->fraction);
-  gnc_commodity_set_exchange_code (dest, src->exchange_code);
+  gnc_commodity_set_cusip (dest, src->cusip);
   gnc_commodity_set_quote_flag (dest, src->quote_flag);
   gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
   gnc_commodity_set_quote_tz (dest, src->quote_tz);
@@ -588,7 +587,7 @@
 
   dest->fullname = CACHE_INSERT(src->fullname);
   dest->mnemonic = CACHE_INSERT(src->mnemonic);
-  dest->exchange_code = CACHE_INSERT(src->exchange_code);
+  dest->cusip = CACHE_INSERT(src->cusip);
   dest->quote_tz = CACHE_INSERT(src->quote_tz);
 
   dest->namespace = src->namespace;
@@ -671,14 +670,14 @@
 
 
 /********************************************************************
- * gnc_commodity_get_exchange_code
+ * gnc_commodity_get_cusip
  ********************************************************************/
 
 const char * 
-gnc_commodity_get_exchange_code(const gnc_commodity * cm) 
+gnc_commodity_get_cusip(const gnc_commodity * cm) 
 {
   if(!cm) return NULL;
-  return cm->exchange_code;
+  return cm->cusip;
 }
 
 /********************************************************************
@@ -807,18 +806,18 @@
 }
 
 /********************************************************************
- * gnc_commodity_set_exchange_code
+ * gnc_commodity_set_cusip
  ********************************************************************/
 
 void
-gnc_commodity_set_exchange_code(gnc_commodity * cm, 
-                                const char * exchange_code) 
+gnc_commodity_set_cusip(gnc_commodity * cm, 
+			const char * cusip) 
 {
   if(!cm) return;
-  if(cm->exchange_code == exchange_code) return;
+  if(cm->cusip == cusip) return;
 
-  CACHE_REMOVE (cm->exchange_code);
-  cm->exchange_code = CACHE_INSERT (exchange_code);
+  CACHE_REMOVE (cm->cusip);
+  cm->cusip = CACHE_INSERT (cusip);
   mark_commodity_dirty(cm);
 }
 
@@ -943,10 +942,9 @@
     return FALSE;
   }
 
-  if (safe_strcmp(a->exchange_code, b->exchange_code) != 0)
+  if (safe_strcmp(a->cusip, b->cusip) != 0)
   {
-    DEBUG ("exchange codes differ: %s vs %s",
-           a->exchange_code, b->exchange_code);
+    DEBUG ("cusips differ: %s vs %s", a->cusip, b->cusip);
     return FALSE;
   }
 

Modified: gnucash/trunk/src/engine/gnc-commodity.h
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.h	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/engine/gnc-commodity.h	2006-02-11 20:00:52 UTC (rev 13213)
@@ -248,9 +248,9 @@
  *  match the stock ticker symbol used by the exchange where you want
  *  to get automatic stock quote updates.  E.G. ACME, ACME.US, etc.
  *
- *  @param exchange_code A string containing the CUSIP code or similar
+ *  @param cusip A string containing the CUSIP code or similar
  *  UNIQUE code for this commodity. The stock ticker is NOT
- *  appropriate.
+ *  appropriate as that goes in the mnemonic field.
  *
  *  @param fraction The smallest division of this commodity
  *  allowed. I.E. If this is 1, then the commodity must be traded in
@@ -263,7 +263,7 @@
 				  const char * fullname, 
                                   const char * namespace,
                                   const char * mnemonic,
-                                  const char * exchange_code,
+                                  const char * cusip,
                                   int fraction);
 
 /** Destroy a commodity.  Release all memory attached to this data structure.
@@ -356,7 +356,7 @@
  *  string is owned by the engine and should not be freed by the
  *  caller.
  */
-const char * gnc_commodity_get_exchange_code(const gnc_commodity * cm);
+const char * gnc_commodity_get_cusip(const gnc_commodity * cm);
 
 /** Retrieve the 'unique' name for the specified commodity.  This will
  *  be a pointer to a null terminated string of the form "AMEX::ACME",
@@ -480,11 +480,11 @@
  *
  *  @param cm A pointer to a commodity data structure.
  *
- *  @param exchange_code A pointer to the full name for this commodity.  This
- *  string belongs to the caller and will be duplicated by the engine.
+ *  @param cusip A pointer to the cusip or other exchange specific
+ *  data for this commodity.  This string belongs to the caller and
+ *  will be duplicated by the engine.
  */
-void  gnc_commodity_set_exchange_code(gnc_commodity * cm, 
-                                      const char * exchange_code);
+void  gnc_commodity_set_cusip(gnc_commodity * cm, const char * cusip);
 
 /** Set the fraction for the specified commodity.  This should be
  *  an integer value specifying the number of fractional units that

Modified: gnucash/trunk/src/engine/gw-engine-spec.scm
===================================================================
--- gnucash/trunk/src/engine/gw-engine-spec.scm	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/engine/gw-engine-spec.scm	2006-02-11 20:00:52 UTC (rev 13213)
@@ -2065,9 +2065,9 @@
  ws
  'gnc:commodity-get-exchange-code
  '(<gw:mchars> callee-owned const)
- "gnc_commodity_get_exchange_code"
+ "gnc_commodity_get_cusip"
  '((<gnc:commodity*> comm))
- "Get the exchange code (ISO numeric code)")
+ "Get the cusip (exchange specific data, not the stock ticker)")
 
 (gw:wrap-function
  ws

Modified: gnucash/trunk/src/engine/test/test-commodities.c
===================================================================
--- gnucash/trunk/src/engine/test/test-commodities.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/engine/test/test-commodities.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -51,7 +51,7 @@
         char *fullname;
         const char *namespace;
         char *mnemonic;
-        char *exchange_code;
+        char *cusip;
         int fraction;
         gnc_commodity *com2;
         QofBook *book;
@@ -60,11 +60,11 @@
         fullname = get_random_string();
         namespace = get_random_commodity_namespace();
         mnemonic = get_random_string();
-        exchange_code = get_random_string();
+        cusip = get_random_string();
         fraction = get_random_int_in_range(0, 10000);
 
         com = gnc_commodity_new(book, fullname, namespace, mnemonic,
-                                exchange_code, fraction);
+                                cusip, fraction);
 
         do_test(
             com != NULL, "commodity with data new and destroy");
@@ -82,8 +82,8 @@
             "mnemonic equal test");
 
         do_test(
-            safe_strcmp(exchange_code, gnc_commodity_get_exchange_code(com)) == 0,
-            "exchange code equal test");
+            safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
+            "cusip equal test");
 
         do_test(
             gnc_commodity_get_fraction(com) == fraction,
@@ -107,11 +107,11 @@
             safe_strcmp(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
             "reset mnemonic equal test");
 
-        exchange_code = get_random_string();
-        gnc_commodity_set_exchange_code(com, exchange_code);
+        cusip = get_random_string();
+        gnc_commodity_set_cusip(com, cusip);
         do_test(
-            safe_strcmp(exchange_code, gnc_commodity_get_exchange_code(com)) == 0,
-            "reset exchange code equal test");
+            safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
+            "reset cusip equal test");
 
         fraction = get_random_int_in_range(0, 10000);
         gnc_commodity_set_fraction(com, fraction);
@@ -120,7 +120,7 @@
             "reset fraction code equal test");
 
         com2 = gnc_commodity_new(book, fullname, namespace, mnemonic,
-                                 exchange_code, fraction);
+                                 cusip, fraction);
         do_test(
             gnc_commodity_equiv(com, com2), "commodity equiv");
 

Modified: gnucash/trunk/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -587,7 +587,7 @@
   g_free (str);
 
   str = get_random_string ();
-  gnc_commodity_set_exchange_code (com, str);
+  gnc_commodity_set_cusip (com, str);
   g_free (str);
 
   gnc_commodity_set_fraction (com, get_random_int_in_range (1, 100000));

Modified: gnucash/trunk/src/gnome-utils/dialog-commodity.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-commodity.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/gnome-utils/dialog-commodity.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -59,7 +59,7 @@
 
   gnc_commodity * selection;
 
-  const char * default_exchange_code;
+  const char * default_cusip;
   const char * default_fullname;
   const char * default_mnemonic;
   int          default_fraction;
@@ -134,7 +134,7 @@
 				   GtkWidget * parent,
 				   dialog_commodity_mode mode,
 				   const char * user_message,
-				   const char * code,
+				   const char * cusip,
 				   const char * fullname,
 				   const char * mnemonic)
 {
@@ -146,7 +146,7 @@
   gint value;
   
   win = gnc_ui_select_commodity_create(orig_sel, mode);
-  win->default_exchange_code=code;
+  win->default_cusip=cusip;
   win->default_fullname=fullname;
   win->default_mnemonic=mnemonic;
   
@@ -155,7 +155,7 @@
 
   if (user_message != NULL)
     initial = user_message;
-  else if ((code != NULL) || (fullname != NULL) || (mnemonic != NULL))
+  else if ((cusip != NULL) || (fullname != NULL) || (mnemonic != NULL))
     initial = _("\nPlease select a commodity to match:");
   else
     initial = "";
@@ -165,8 +165,8 @@
 		    initial,
 		    fullname ? _("\nCommodity: ") : "",
 		    fullname ? fullname : "",
-		    code     ? _("\nExchange code (CUSIP or similar): ") : "",
-		    code     ? code : "",
+		    cusip    ? _("\nExchange code (CUSIP or similar): ") : "",
+		    cusip    ? cusip : "",
 		    mnemonic ? _("\nMnemonic(Ticker symbol or similar): ") : "",
 		    mnemonic ? mnemonic : "");
    gtk_label_set_text ((GtkLabel *)(win->select_user_prompt),
@@ -303,7 +303,7 @@
   const gnc_commodity * new_commodity = 
     gnc_ui_new_commodity_modal_full(namespace,
 				    w->dialog,
-				    w->default_exchange_code,
+				    w->default_cusip,
 				    w->default_fullname,
 				    w->default_mnemonic,
 				    w->default_fraction);
@@ -486,7 +486,7 @@
 
     commodity = gnc_ui_new_commodity_modal_full (namespace,
 						 w->dialog,
-						 w->default_exchange_code,
+						 w->default_cusip,
 						 w->default_fullname,
 						 w->default_mnemonic,
 						 w->default_fraction);
@@ -975,7 +975,7 @@
 gnc_ui_common_commodity_modal(gnc_commodity *commodity,
 			      GtkWidget * parent,
 			      const char * namespace,
-			      const char * code,
+			      const char * cusip,
 			      const char * fullname,
 			      const char * mnemonic,
 			      int fraction)
@@ -992,7 +992,7 @@
     namespace = gnc_commodity_get_namespace (commodity);
     fullname = gnc_commodity_get_fullname (commodity);
     mnemonic = gnc_commodity_get_mnemonic (commodity);
-    code = gnc_commodity_get_exchange_code (commodity);
+    cusip = gnc_commodity_get_cusip (commodity);
     fraction = gnc_commodity_get_fraction (commodity);
   } else {
     /* Not allowed to create new currencies */
@@ -1002,7 +1002,7 @@
   }
 
   win = gnc_ui_new_commodity_dialog(namespace, parent, fullname,
-				    mnemonic, code, fraction);
+				    mnemonic, cusip, fraction);
 
   /* Update stock quote info based on existing commodity */
   gnc_ui_commodity_update_quote_info(win, commodity);
@@ -1047,7 +1047,7 @@
 gnc_commodity * 
 gnc_ui_new_commodity_modal_full(const char * namespace, 
 				GtkWidget * parent,
-				const char * exchange_code,
+				const char * cusip,
 				const char * fullname,
 				const char * mnemonic,
 				int fraction)
@@ -1056,7 +1056,7 @@
 
   ENTER(" ");
   result = gnc_ui_common_commodity_modal(NULL, parent, namespace, fullname,
-					 mnemonic, exchange_code, 10000);
+					 mnemonic, cusip, 10000);
   LEAVE(" ");
   return result;
 }
@@ -1160,7 +1160,7 @@
       gnc_commodity_set_fullname (c, fullname);
       gnc_commodity_set_mnemonic (c, mnemonic);
       gnc_commodity_set_namespace (c, namespace);
-      gnc_commodity_set_exchange_code (c, code);
+      gnc_commodity_set_cusip (c, code);
       gnc_commodity_set_fraction (c, fraction);
     }
 

Modified: gnucash/trunk/src/gnome-utils/dialog-commodity.h
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-commodity.h	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/gnome-utils/dialog-commodity.h	2006-02-11 20:00:52 UTC (rev 13213)
@@ -81,9 +81,10 @@
  *  the dialog box as an instruction to the user.  If NULL, a generic
  *  instruction will be used.
  *
- *  @param exchange_code If present, a note will be added to the user
+ *  @param cusip If present, a note will be added to the user
  *  instruction providing this exchange specific code, and this will
- *  be the default exchange code for any newly created commodities.
+ *  be the default exchange specific data for any newly created
+ *  commodities.
  *
  *  @param fullname If present, a note will be added to the user
  *  instruction providing this commodity's full name, and this will be
@@ -104,7 +105,7 @@
 				   GtkWidget * parent,
 				   dialog_commodity_mode mode,
 				   const char * user_message,
-				   const char * exchange_code,
+				   const char * cusip,
 				   const char * fullname,
 				   const char * mnemonic);
 
@@ -149,8 +150,8 @@
  *  the dialog box as an instruction to the user.  If NULL, a generic
  *  instruction will be used.
  *
- *  @param exchange_code If present, this will be the default exchange
- *  code for the new commodity.
+ *  @param cusip If present, this will be the default exchange
+ *  specific data for the new commodity.
  *
  *  @param fullname If present, this will be the default fullname for
  *  the new commodity.
@@ -166,7 +167,7 @@
 gnc_commodity * 
 gnc_ui_new_commodity_modal_full(const char * namespace, 
 				GtkWidget * parent,
-				const char * exchange_code,
+				const char * cusip,
 				const char * fullname,
 				const char * mnemonic,
 				int fraction);

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -389,7 +389,7 @@
 		case GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE:
 		case GNC_TREE_MODEL_COMMODITY_COL_FULLNAME:
 		case GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME:
-		case GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE:
+		case GNC_TREE_MODEL_COMMODITY_COL_CUSIP:
 		case GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME:
 		case GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE:
 		case GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ:
@@ -580,10 +580,10 @@
 
 			g_value_set_string (value, gnc_commodity_get_printname (commodity));
 			break;
-		case GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE:
+		case GNC_TREE_MODEL_COMMODITY_COL_CUSIP:
 			g_value_init (value, G_TYPE_STRING);
 
-			g_value_set_string (value, gnc_commodity_get_exchange_code (commodity));
+			g_value_set_string (value, gnc_commodity_get_cusip (commodity));
 			break;
 		case GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME:
 			g_value_init (value, G_TYPE_STRING);

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.h	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-commodity.h	2006-02-11 20:00:52 UTC (rev 13213)
@@ -60,7 +60,7 @@
 	GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
 	GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
 	GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
-	GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE,
+	GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
 	GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
 	GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
 	GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-commodity.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-commodity.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-commodity.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -229,8 +229,8 @@
   SAFE_STRCMP (gnc_commodity_get_fullname (comm_a),
                gnc_commodity_get_fullname (comm_b));
 
-  SAFE_STRCMP (gnc_commodity_get_exchange_code (comm_a),
-               gnc_commodity_get_exchange_code (comm_b));
+  SAFE_STRCMP (gnc_commodity_get_cusip (comm_a),
+               gnc_commodity_get_cusip (comm_b));
 
   fraction_a = gnc_commodity_get_fraction (comm_a);
   fraction_b = gnc_commodity_get_fraction (comm_b);
@@ -340,8 +340,8 @@
   if (!get_commodities (f_model, f_iter_a, f_iter_b, &comm_a, &comm_b))
     return sort_namespace (f_model, f_iter_a, f_iter_b);
 
-  SAFE_STRCMP (gnc_commodity_get_exchange_code (comm_a),
-               gnc_commodity_get_exchange_code (comm_b));
+  SAFE_STRCMP (gnc_commodity_get_cusip (comm_a),
+               gnc_commodity_get_cusip (comm_b));
 
   return default_sort(comm_a, comm_b);
 }
@@ -504,7 +504,7 @@
 				 sort_by_unique_name);
   gnc_tree_view_add_text_column (view, _("CUSIP code"), "cusip_code", NULL,
 				 "QWERTYUIOP",
-				 GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE,
+				 GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
 				 GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
 				 sort_by_cusip_code);
   gnc_tree_view_add_numeric_column (view, _("Fraction"), "fraction", "10000",

Modified: gnucash/trunk/src/import-export/import-commodity-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-commodity-matcher.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/import-export/import-commodity-matcher.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -53,7 +53,7 @@
 
 
 
-gnc_commodity * gnc_import_select_commodity(char * exchange_code,
+gnc_commodity * gnc_import_select_commodity(char * cusip,
 				    char auto_create,
 				    char * default_fullname,
 				    char * default_mnemonic)
@@ -67,7 +67,7 @@
   DEBUG("Default fullname received: %s", default_fullname);
   DEBUG("Default mnemonic received: %s", default_mnemonic);
   
-  DEBUG("Looking for commodity with exchange_code: %s", exchange_code);
+  DEBUG("Looking for commodity with exchange_code: %s", cusip);
 
   namespace_list = gnc_commodity_table_get_namespaces(commodity_table);
 
@@ -88,9 +88,9 @@
 	  tmp_commodity=commodity_list->data;
 	  DEBUG("Looking at commodity %s",gnc_commodity_get_fullname(tmp_commodity));
 	  
-	  if(gnc_commodity_get_exchange_code(tmp_commodity)!=NULL &&
-	     exchange_code != NULL &&
-	     strncmp(gnc_commodity_get_exchange_code(tmp_commodity),exchange_code,strlen(exchange_code))==0)
+	  if(gnc_commodity_get_cusip(tmp_commodity)!=NULL &&
+	     cusip != NULL &&
+	     strncmp(gnc_commodity_get_cusip(tmp_commodity),cusip,strlen(cusip))==0)
 	    {
 	      retval = tmp_commodity;
 	      DEBUG("Commodity %s%s",gnc_commodity_get_fullname(retval)," matches.");
@@ -118,18 +118,17 @@
 						NULL,
 						DIAG_COMM_ALL,
 						message,
-						exchange_code,
+						cusip,
 						default_fullname,
 						default_mnemonic);
       
     }
   if (retval != NULL&&
-      gnc_commodity_get_exchange_code(tmp_commodity)!=NULL &&
-      exchange_code != NULL &&
-      (strncmp(gnc_commodity_get_exchange_code(retval),exchange_code,strlen(exchange_code))!=0))
+      gnc_commodity_get_cusip(tmp_commodity)!=NULL &&
+      cusip != NULL &&
+      (strncmp(gnc_commodity_get_cusip(retval),cusip,strlen(cusip))!=0))
     {
-      gnc_commodity_set_exchange_code(retval,
-				      exchange_code);
+      gnc_commodity_set_cusip(retval, cusip);
     }
   return retval;
 };

Modified: gnucash/trunk/src/import-export/import-commodity-matcher.h
===================================================================
--- gnucash/trunk/src/import-export/import-commodity-matcher.h	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/import-export/import-commodity-matcher.h	2006-02-11 20:00:52 UTC (rev 13213)
@@ -29,18 +29,18 @@
 
 /**
   Must be called with a string containing a unique identifier for the
-  commodity.  If an commodity with a matching exchange_code is
+  commodity.  If an commodity with a matching cusip is
   found, the function immediately returns with a pointer to that
   commodity.  Otherwise, the user may be prompted to select a GnuCash
-  account or create a new one (in both cases, the exchange_code is written
-  written to the commodity's exchange_code field, overwriting anything that
+  account or create a new one (in both cases, the cusip is 
+  written to the commodity's cusip field, overwriting anything that
   was there before.
 
-    @param exchange_code The string containing the code for which you
+    @param cusip The string containing the code for which you
     want a matching commodity.  A CUISP code or similar UNIQUE code.
     The stock ticker is NOT appropriate, unless you have no other option.
 
-    @param auto_create If 0, if the exchange_code value in unknown,
+    @param auto_create If 0, if the cusip value in unknown,
     the function returns NULL, otherwise, the user will be asked to 
     create a new account.
 
@@ -58,7 +58,7 @@
   account was found or created.
 
 */
-gnc_commodity * gnc_import_select_commodity(char * exchange_code,
+gnc_commodity * gnc_import_select_commodity(char * cusip,
 				    char auto_create,
 				    char * default_fullname,
 				    char * default_mnemonic);

Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-02-11 18:54:52 UTC (rev 13212)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-02-11 20:00:52 UTC (rev 13213)
@@ -76,13 +76,13 @@
 
 int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data)
 {
-  char * tmp_exchange_code=NULL;
+  char * tmp_cusip=NULL;
   char * tmp_default_fullname=NULL;
   char * tmp_default_mnemonic=NULL;
  
   if(data.unique_id_valid==true)
     {
-      tmp_exchange_code=(char *)data.unique_id;
+      tmp_cusip=(char *)data.unique_id;
     }
   if(data.secname_valid==true)
     {
@@ -93,7 +93,7 @@
       tmp_default_mnemonic=(char *)data.ticker;
     }
   
-  gnc_import_select_commodity(tmp_exchange_code,
+  gnc_import_select_commodity(tmp_cusip,
 	        	      true,
 			      tmp_default_fullname,
 			      tmp_default_mnemonic);



More information about the gnucash-changes mailing list