Update of /cvsroot/monetdb/pathfinder/compiler/semantics
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10631/semantics

Modified Files:
        ns.c varscope.c xquery_fo.c 
Log Message:
-- Apply Anands whitespace fixes.


Index: xquery_fo.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/xquery_fo.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- xquery_fo.c 10 Nov 2009 09:45:24 -0000      1.191
+++ xquery_fo.c 10 Nov 2009 16:16:54 -0000      1.192
@@ -2868,7 +2868,7 @@
     ,  /* tijah:create-ft-index() as docmgmt */
       { .ns = PFns_tijah, .loc = "create-ft-index",
         .arity = 0, .sig_count = 1, .sigs = { {
-            .ret_ty = PFty_docmgmt () } }, 
+            .ret_ty = PFty_docmgmt () } },
         .alg = PFbui_manage_fti_c_xx }
     ,  /* tijah:create-ft-index(string*) as docmgmt */
       { .ns = PFns_tijah, .loc = "create-ft-index",

Index: ns.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/ns.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- ns.c        10 Nov 2009 09:45:24 -0000      1.47
+++ ns.c        10 Nov 2009 16:16:54 -0000      1.48
@@ -6,12 +6,12 @@
  * Resolve XML namespaces (NS) in the abstract syntax tree (this is
  * mainly based on W3C XQuery, 4.1 and W3C XML Namespaces).
  *
- * Walk the abstract syntax tree to 
+ * Walk the abstract syntax tree to
  *
  * (1) test if qualified names (QNames) refer to NS being actually in scope,
  *     and
  * (2) attach URIs associated with used NS prefixes.
- * 
+ *
  * During the tree walk, we detect and handle the following NS-relevant
  * XQuery constructs:
  *
@@ -104,27 +104,27 @@
  * prior declaration) in XQuery, see W3C XQuery, 4.12
  */
 /** Predefined namespace `xml' for any query */
-PFns_t PFns_xml = 
-    { .prefix = "xml", 
+PFns_t PFns_xml =
+    { .prefix = "xml",
       .uri    = "http://www.w3.org/XML/1998/namespace"; };
 /** Predefined namespace `xs' (XML Schema) for any query */
-PFns_t PFns_xs  = 
-    { .prefix = "xs",  
+PFns_t PFns_xs  =
+    { .prefix = "xs",
       .uri    = "http://www.w3.org/2001/XMLSchema"; };
 /** Predefined namespace `xsi' (XML Schema Instance) for any query */
-PFns_t PFns_xsi = 
-    { .prefix = "xsi", 
+PFns_t PFns_xsi =
+    { .prefix = "xsi",
       .uri    = "http://www.w3.org/2001/XMLSchema-instance"; };
 /** XQuery default function namespace (fn:...). */
 PFns_t PFns_fn  =
-    { .prefix = "fn",  
+    { .prefix = "fn",
       .uri    = "http://www.w3.org/2005/xpath-functions"; };
 /** Predefined namespace `xdt' (XPath Data Types) for any query */
-PFns_t PFns_xdt = 
+PFns_t PFns_xdt =
     { .prefix = "xdt",
       .uri    = "http://www.w3.org/2003/11/xpath-datatypes"; };
 /** Predefined namespace `local' (XQuery Local Functions) for any query */
-PFns_t PFns_local = 
+PFns_t PFns_local =
     { .prefix = "local",
       .uri    = "http://www.w3.org/2005/xquery-local-functions"; };
 /**
@@ -141,29 +141,29 @@
  * XQuery operator namespace (op:...)
  * (see W3C XQuery 1.0 and XPath 2.0 Function and Operators, 1.5).
  *
- * This namespace is not accessible for the user 
+ * This namespace is not accessible for the user
  * (see W3C XQuery F&O, 1.5).
  */
-PFns_t PFns_op  = { .prefix = "op",  
+PFns_t PFns_op  = { .prefix = "op",
                     .uri    = "http://www.w3.org/2002/08/xquery-operators"; };
 
 
-/** 
+/**
  * Pathfinder's namespace for additional non-'fn' functions.
- */ 
-PFns_t PFns_lib = { .prefix = "pf",  
+ */
+PFns_t PFns_lib = { .prefix = "pf",
                     .uri    = "http://www.pathfinder-xquery.org/"; };
 
-/** 
+/**
  * Pathfinder's namespace for additional tijah functions.
- */ 
-PFns_t PFns_tijah = { .prefix = "tijah",  
+ */
+PFns_t PFns_tijah = { .prefix = "tijah",
                       .uri    = "http://dbappl.cs.utwente.nl/pftijah/"; };
 
-/** 
+/**
  * Pathfinder's namespace for XRPC extension.
- */ 
-PFns_t PFns_xrpc = { .prefix = "xrpc",  
+ */
+PFns_t PFns_xrpc = { .prefix = "xrpc",
                       .uri    = "http://monetdb.cwi.nl/XQuery"; };
 
 #ifdef HAVE_GEOXML
@@ -182,14 +182,14 @@
                         .uri    = "http://dbappl.cs.utwente.nl/pxmlsup/"; };
 #endif
 
-/** 
+/**
  * Pathfinder's own internal NS (pf:...).
  * Note that the prefix contains a character that cannot be entered in
- * a query. 
+ * a query.
  *
  * This namespace is not accessible for the user.
- */ 
-PFns_t PFns_pf  = { .prefix = "#pf",  
+ */
+PFns_t PFns_pf  = { .prefix = "#pf",
                     .uri    = "http://www.pathfinder-xquery.org/internal/"; };
 
 /**
@@ -314,7 +314,7 @@
 }
 
 
-/** 
+/**
  * NS equality (URI-based, then prefix-based):
  * two NS with different prefixes are considered equal if they are bound
  * to the same URI (see, W3C XQuery, 4.1).
@@ -328,7 +328,7 @@
 PFns_eq (PFns_t ns1, PFns_t ns2)
 {
     /* NS equality is principally based on URI equality, so this is what
-     * we test for first: 
+     * we test for first:
      */
     if (ns1.uri) {
         if (ns2.uri)
@@ -340,7 +340,7 @@
         if (ns2.uri)
             return 1;
 
-    /* two unbound (URI-less) NS are deliberately assumed to be equal 
+    /* two unbound (URI-less) NS are deliberately assumed to be equal
      * if their prefixes coincide:
      */
     if (ns1.prefix) {
@@ -355,17 +355,17 @@
         else
             return 0;
     }
-    
+
 }
 
 /**
- * Collect and apply namespace declaration attributes 
+ * Collect and apply namespace declaration attributes
  * (W3C Namespaces):
  *
  * (1) xmlns:loc=ns        locally (for the owning element) define
  *                         NS prefix `loc:...' |-> ns
  *                         (ns is required to be a literal string)
- * 
+ *
  * (2) xmlns=ns            locally (for the owning element) re-define
  *                         the default element NS
  *                         (ns is required to be a literal string,
@@ -383,7 +383,7 @@
     PFpnode_t *next = R(c);
 
     assert (c);
-  
+
     switch (c->kind) {
 
         case p_contseq:
@@ -392,7 +392,7 @@
             if (L(c)->kind == p_attr) {
                 /* abstract syntax tree layout:
                  *
-                 *           attr 
+                 *           attr
                  *           /  \
                  *  tag-ns:loc   v
                  */
@@ -418,8 +418,8 @@
                          *  "xmlns":loc     exprseq
                          *                 /       \
                          *             lit_str     empty_seq
-                         *          
-                         */     
+                         *
+                         */
                         if ((R(a)->kind == p_exprseq
                              || R(a)->kind == p_contseq) &&
                             RL(a)->kind == p_lit_str &&
@@ -431,7 +431,7 @@
 
                             /* finally remove this NS declaration attribute */
                             *c = *R(c);
-                            
+
                             /*
                              * visit the "same" node again in the next
                              * iteration (we have just overwritten it)
@@ -458,17 +458,17 @@
                              * Namespaces, 5.2), W3C XQuery, 4.1
                              *
                              * abstract syntax tree layout:
-                             *          
+                             *
                              *           attr (a)
                              *          /        \
                              *     "xmlns"      exprseq
                              *                 /       \
                              *              lit_str   empty_seq
                              *
-                             *           content                
+                             *           content
                              *             / \          or        nil
-                             *  "ns"-lit_str  nil           
-                             */     
+                             *  "ns"-lit_str  nil
+                             */
                             switch (R(a)->kind) {
                                 case p_empty_seq:
                                     /*
@@ -523,7 +523,7 @@
 }
 
 /**
- * Recursively walk abstract syntax tree to resolve NS usage. 
+ * Recursively walk abstract syntax tree to resolve NS usage.
  *
  * @param n current abstract syntax tree node
  */
@@ -609,7 +609,7 @@
 
         case p_fns_decl:
             /*
-             * default function namespace = "foo" 
+             * default function namespace = "foo"
              *
              * abstract syntax tree layout:
              *
@@ -623,7 +623,7 @@
 
         case p_ens_decl:
             /*
-             * default element namespace = "foo" 
+             * default element namespace = "foo"
              *
              * abstract syntax tree layout:
              *
@@ -637,7 +637,7 @@
 
         case p_ns_decl:
             /*
-             * declare namespace ns = "foo" 
+             * declare namespace ns = "foo"
              * import schema namespace ns = "foo" [at "url"]
              *
              * abstract syntax tree layout:
@@ -680,7 +680,7 @@
 
                 if (! new_ns.uri)
                     PFoops_loc (OOPS_BADNS, n->loc,
-                            "unknown namespace in qualified function name %s", 
+                            "unknown namespace in qualified function name %s",
                             PFqname_raw_str (n->sem.qname_raw));
 
                 n->sem.qname = PFqname (new_ns, n->sem.qname_raw.loc);
@@ -755,8 +755,8 @@
 
         case p_req_name:
             /*
-             * This is the QName specification in an XPath location step. 
-             * 
+             * This is the QName specification in an XPath location step.
+             *
              * The spec says: ``An unprefixed QName, when used as a name
              * test on an axis whose principal node kind is element, has
              * the namespace URI of the default element/type namespace in
@@ -863,7 +863,7 @@
 
                 if (! new_ns.uri)
                     PFoops_loc (OOPS_BADNS, n->loc,
-                            "unknown namespace in qualified function name %s", 
+                            "unknown namespace in qualified function name %s",
                             PFqname_raw_str (n->sem.qname_raw));
 
                 n->sem.qname = PFqname (new_ns, n->sem.qname_raw.loc);
@@ -932,7 +932,7 @@
 
             /*
              * if element comes with a literal tag name resolve NS usage,
-             * for computed tags skip ahead 
+             * for computed tags skip ahead
              */
             assert (L(n));
             if (L(n)->kind == p_tag) {
@@ -946,7 +946,7 @@
 
                 L(n)->sem.qname = PFqname (new_ns, L(n)->sem.qname_raw.loc);
             }
-            else 
+            else
                 ns_resolve (L(n));
 
             /* NS resolution in element content c */
@@ -965,7 +965,7 @@
              *
              *           attr
              *           /  \
-             * tag-ns:loc    v 
+             * tag-ns:loc    v
              */
 
             /*
@@ -1063,7 +1063,7 @@
      * and make fn:... the default function NS
      */
     ns_add (PFns_fn);
-  
+
     fns = PFns_fn;
 
     /* ``undefine'' the default element NS */
@@ -1083,7 +1083,7 @@
 PFns_resolve (PFpnode_t *root)
 {
     /* initiate the actual NS resolution */
-    ns_resolve (root); 
+    ns_resolve (root);
 }
 
 /* vim:set shiftwidth=4 expandtab: */

Index: varscope.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/varscope.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- varscope.c  10 Nov 2009 09:45:24 -0000      1.24
+++ varscope.c  10 Nov 2009 16:16:54 -0000      1.25
@@ -9,8 +9,8 @@
  * a stack-type environment, variable scoping is checked. On any occurence of
  *
  *  - a @c flwr, @c some or @c every node, or a function declaration
- *    node, the current variable environment is saved and restored 
- *    after the node has been processed.  The variables are bound only within 
+ *    node, the current variable environment is saved and restored
+ *    after the node has been processed.  The variables are bound only within
  *    the rightmost subtree of the node.
  *
  *  - a @c typeswitch node, the leftmost child is processed (which may
@@ -27,8 +27,8 @@
  *    @c struct is pushed onto the variabel environment stack.
  *    If we find a variable of the same name on the stack (i.e., in
  *    scope), issue a warning about variable reuse.  Note that
- *    a @c bind node may bring into scope up to two variables 
- *    (positional variables in @c for).  
+ *    a @c bind node may bring into scope up to two variables
+ *    (positional variables in @c for).
  *
  *  - a variable usage, the stack is scanned top down for the first
  *    occurence of a variable with the same name. If the variable is
@@ -115,7 +115,7 @@
 /**
  * Push a new variable onto the variable environment stack.
  *
- * @param n variable to push onto the stack. 
+ * @param n variable to push onto the stack.
  * @return Status code as described in pathfinder/oops.c
  */
 static void
@@ -131,12 +131,12 @@
     assert (varname);
 
     if (! (var = PFnew_var (*varname)))
-        PFoops (OOPS_OUTOFMEM, 
+        PFoops (OOPS_OUTOFMEM,
                 "allocation of new variable failed");
 
     /* If we find a variable of the same name on the stack (i.e., in scope),
-     * issue a warning (the user might mistake an XQuery clause like 
-     * `let $x := $x + 1' for an imperative variable update). 
+     * issue a warning (the user might mistake an XQuery clause like
+     * `let $x := $x + 1' for an imperative variable update).
      */
     if (PFscope_lookup (var_env, *varname))
         PFinfo_loc (OOPS_WARN_VARREUSE, n->loc, "$%s", PFqname_str (*varname));
@@ -191,70 +191,70 @@
          * to report them all to the user.
          */
         var = find_var (n->sem.qname);
-        
+
         if (!var) {
             PFinfo_loc (OOPS_UNKNOWNVAR, n->loc,
                         "$%s", PFqname_str (n->sem.qname));
             scoping_failed = true;
         }
-        
+
         n->sem.var = var;
         n->kind = p_var;
-        
+
         break;
-        
-    case p_flwr:     
+
+    case p_flwr:
         /*                       flwr
          *                      / | | \
          *                 binds  o p  e
          *
-         * (1) save current variable environment 
-         * (2) process variable bindings 
+         * (1) save current variable environment
+         * (2) process variable bindings
          * (3) process o `order by', p `where', and e `return' clauses
          * (4) restore variable environment
          */
-        
+
         /* (1) */
         PFscope_open (var_env);
-        
+
         /* (2) */
         scope (n->child[0]);
-        
+
         /* (3) */
         scope (n->child[1]);
-        
+
         /* (4) */
         PFscope_close (var_env);
-        
+
         break;
-        
-    case p_some:      
-    case p_every:     
+
+    case p_some:
+    case p_every:
         /*                       some/every
          *                         /   \
          *                     binds    e
          *
-         * (1) save current variable environment 
-         * (2) process variable bindings 
+         * (1) save current variable environment
+         * (2) process variable bindings
          * (3) process quantifier body e `satifies' clause
          * (4) restore variable environment
          */
-        
+
         /* (1) */
         PFscope_open (var_env);
-        
+
         /* (2) */
         scope (n->child[0]);
-        
+
         /* (3) */
         scope (n->child[1]);
-        
+
         /* (4) */
         PFscope_close (var_env);
-        
+
         break;
-        
-    case p_fun_decl:  
+
+    case p_fun_decl:
         /*                      fun_decl
          *                     /        \
          *                 fun_sig       e
@@ -262,27 +262,27 @@
          *             params      t
          *
          *
-         * (1) save current variable environment 
+         * (1) save current variable environment
          * (2) process function parameters
          * (3) process function body e
          * (4) restore variable environment
          */
-        
+
         /* (1) */
         PFscope_open (var_env);
-        
+
         /* (2) */
         scope (n->child[0]);
-        
+
         /* (3) */
         scope (n->child[1]);
-        
+
         /* (4) */
         PFscope_close (var_env);
-        
+
         break;
-        
-    case p_bind:     
+
+    case p_bind:
         /*                 bind
          *                /    \
          *             vars     e        for $v as t at $i in e
@@ -297,7 +297,7 @@
          * (2) bring v into scope
          * (3) bring i into scope (if present)
          */
-      
+
         /*
          * Raise an error if positional variable and bound
          * variable have the same name, e.g.
@@ -316,7 +316,7 @@
                             PFqname_str (n->child[0]->child[1]->sem.qname));
             }
         }
-      
+
         /* (1) */
         scope (n->child[1]);
 
@@ -326,7 +326,7 @@
                 && n->child[0]->child[0]->child[0]->kind == p_varref);
 
         push (n->child[0]->child[0]->child[0]);
-        
+
         /* (3) */
         assert (n->child[0] && n->child[0]->child[1]);
 
@@ -335,20 +335,20 @@
 
         break;
 
-    case p_let:  
+    case p_let:
         /*                 let
          *                /   \
-         *         var_type    e       let $v as t := e 
+         *         var_type    e       let $v as t := e
          *          /    \
          *         v      t
          *
          * (1) process e (v not yet visible in e)
          * (2) bring v into scope
          */
-      
+
         /* (1) */
         scope (n->child[1]);
-      
+
         /* (2) */
         assert (n->child[0] && n->child[0]->child[0]
                 && n->child[0]->child[0]->kind == p_varref);
@@ -360,7 +360,7 @@
     case p_param:    /* function parameter */
         /* Abstract syntax tree layout:
          *
-         *                param                
+         *                param
          *                 / \        declare function ... (..., t v, ...)
          *                t   v
          */
@@ -380,7 +380,7 @@
          *         v         t
          *
          */
-      
+
         /* occurrence of a branch variable is optional */
         assert (n->child[0] && n->child[0]->child[0]);
 
@@ -392,7 +392,7 @@
 
         /* visit the case branch e itself */
         assert (n->child[1]);
-        
+
         scope (n->child[1]);
 
         PFscope_close (var_env);
@@ -555,7 +555,7 @@
     switch (n->kind) {
 
         case p_lib_mod:
-        {  
+        {
             /* back up variable environment */
             PFscope_t *old_var_env = var_env;
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to