logo       

rev 355 - trunk/src: msg#00111

Subject: rev 355 - trunk/src
Author: mark
Date: 2004-04-14 18:32:09 -0400 (Wed, 14 Apr 2004)
New Revision: 355

Modified:
   trunk/src/builtins-string.c
Log:
added type to argv array for string.__mod__()

Modified: trunk/src/builtins-string.c
===================================================================
--- trunk/src/builtins-string.c 2004-04-14 21:52:31 UTC (rev 354)
+++ trunk/src/builtins-string.c 2004-04-14 22:32:09 UTC (rev 355)
@@ -232,10 +232,19 @@
        return obj;
 }
 
+#define ARG_TYPE_INT   0
+#define ARG_TYPE_FLOAT 1
+#define ARG_TYPE_STRING        2
+
 typedef union {
        i64_t   i64;
        double  f64;
        char*   str;
+} arg_types_t;
+
+typedef struct {
+       arg_types_t     arg;
+       u8_t            type;
 } arg_t;
 
 typedef arg_t* arg_p;
@@ -255,13 +264,16 @@
        argv = pr_malloc(argc * sizeof(arg_t));
        for (i=0; i < argc; i++) {
                obj_p arg_obj = list_item(ist, argv_obj, (int) i);
-               if (has_proto_QUES(ist, arg_obj, OBJ(INT_PROTO)))
-                       argv[i].i64 = arg_obj->data.i64;
-               else if (has_proto_QUES(ist, arg_obj, OBJ(FLOAT_PROTO)))
-                       argv[i].f64 = arg_obj->data.f64;
-               else if (has_proto_QUES(ist, arg_obj, OBJ(STRING_PROTO)))
-                       argv[i].str = strch(arg_obj);
-               else {
+               if (has_proto_QUES(ist, arg_obj, OBJ(INT_PROTO))) {
+                       argv[i].arg.i64 = arg_obj->data.i64;
+                       argv[i].type    = ARG_TYPE_INT;
+               } else if (has_proto_QUES(ist, arg_obj, OBJ(FLOAT_PROTO))) {
+                       argv[i].arg.f64 = arg_obj->data.f64;
+                       argv[i].type    = ARG_TYPE_FLOAT;
+               } else if (has_proto_QUES(ist, arg_obj, OBJ(STRING_PROTO))) {
+                       argv[i].arg.str = strch(arg_obj);
+                       argv[i].type    = ARG_TYPE_STRING;
+               } else {
                        raise_exception(ist, OBJ(TYPE_EXC), "invalid type for 
string (%) format");
                        return NULL;
                }




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe