[Monetdb-developers] [Monetdb-pf-checkins] pathfinder/compiler/schema import.c, 1.20, 1.21

Ying Zhang Y.Zhang at cwi.nl
Tue Jan 23 16:23:47 CET 2007


Hi Jens,


Your check-in seems breaking the compilation:

make install...
../../../compiler/schema/import.c: In function 'PFschema_import':
../../../compiler/schema/import.c:2571: error: implicit declaration of
function 'PFenv_iterate'
make[5]: *** [libschema_la-import.lo] Error 1
make[4]: *** [install] Error 2
make[3]: *** [install-recursive] Error 1
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2

The function PFenv_iterate is defined in env.h as the following:

#if 0
/** iterate over all bound values in an environment */
void PFenv_iterate (PFenv_t *, void (*) (PFqname_t, void *));
#endif

Regards,

Jennie

On Tue, Jan 23, 2007 at 02:05:49PM +0000, Jens Teubner wrote:
> Update of /cvsroot/monetdb/pathfinder/compiler/schema
> In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11879/compiler/schema
> 
> Modified Files:
> 	import.c 
> Log Message:
> Some work in Pathfinder's QName handling:
> 
>  -- There are now different C types represent QNames before and after
>     namespace resolution.  Before resolution, QNames are represented
>     as PFqname_raw_t structs, a prefix/local name combination (without
>     URI).  After resolution, QNames are PFqname_t structs, with prefixes
>     resolved to their URIs.
> 
>  -- (Resolved) QNames, in turn, are now encoded by integer values, only.
>     A lookup table within qname.c contains the actual namespaces and
>     local names.  Given the integer QName id, functions PFqname_loc(),
>     PFqname_uri(), PFqname_prefix(), PFqname_ns() retrieve the respective
>     information from the lookup table.
> 
>     This change can significantly improve the performance of QName
>     comparisons (since they no longer depend on string comparisons).
>     There is a small penalty, in turn, when new QNames are created
>     (creation of a new entry in the lookup table).
> 
>  -- Pathfinder's QName based environments (PFenv_...) are way easier
>     (and more efficient) to implement using the new QNames.  No need
>     to sort any more, just positional lookups.
> 
> TODO:
> 
>  -- Some cleanup with respect to PFqname_eq().  Its name is confusing,
>     and we should use an (inlined) integer comparison instead.
> 
> 
> 
> Index: import.c
> ===================================================================
> RCS file: /cvsroot/monetdb/pathfinder/compiler/schema/import.c,v
> retrieving revision 1.20
> retrieving revision 1.21
> diff -u -d -r1.20 -r1.21
> --- import.c	3 Jan 2007 12:33:00 -0000	1.20
> +++ import.c	23 Jan 2007 14:05:46 -0000	1.21
> @@ -417,7 +417,7 @@
>  static PFqname_t
>  imported_qname (char *nsloc)
>  {
> -    PFqname_t qn;
> +    PFqname_raw_t qn_raw;
>  
>      assert (nsloc);
>  
> @@ -425,17 +425,14 @@
>       * It is still valid to call PFstr_qname() here, because we will
>       * overwrite the namespace information in a moment.
>       */
> -    qn = PFstr_qname (nsloc);
> +    qn_raw = PFqname_raw (nsloc);
>  
> -    if (qn.ns.prefix && *(qn.ns.prefix))
> +    if (qn_raw.prefix && *(qn_raw.prefix))
>          PFinfo (OOPS_SCHEMAIMPORT,
>                  "namespace of `%s' replaced by target namespace `%s'",
> -                PFqname_str (qn),
> -                target_ns.uri);
> -
> -    qn.ns = target_ns;
> +                PFqname_raw_str (qn_raw), target_ns.uri);
>  
> -    return qn;
> +    return PFqname (target_ns, qn_raw.loc);
>  }
>  
>  /**
> @@ -450,30 +447,31 @@
>  static PFqname_t
>  ref_qname (char *nsloc)
>  {
> -    PFqname_t qn;
> -    PFns_t *ns;
> +    PFqname_raw_t  qn_raw;
> +    PFns_t        *ns_ptr;
> +    PFns_t         ns;
>  
>      assert (nsloc);
>  
> -    qn = PFstr_qname (nsloc);
> +    qn_raw = PFqname_raw (nsloc);
>  
> -    assert (qn.ns.prefix);
> +    assert (qn_raw.prefix);
>  
>      /*
>       * Don't use lookup_ns() for unqualified names, as this would
>       * yield the default element namespace, *not* the target
>       * namespace.
>       */
> -    if (! *(qn.ns.prefix))
> -        qn.ns = target_ns;
> -    else if ((ns = lookup_ns (qn.ns.prefix)))
> -        qn.ns = *ns;
> +    if (! *(qn_raw.prefix))
> +        ns = target_ns;
> +    else if ((ns_ptr = lookup_ns (qn_raw.prefix)))
> +        ns = *ns_ptr;
>      else
>          PFoops (OOPS_BADNS,
>                  "(XML Schema import) prefix `%s' unknown",
> -                qn.ns.prefix);
> +                qn_raw.prefix);
>  
> -    return qn;
> +    return PFqname (ns, qn_raw.loc);
>  }
>  
>  /**
> @@ -500,14 +498,13 @@
>  static int
>  map_open_tag (void *ctx, char *nsloc)
>  {
> -    PFqname_t qn;
> -    PFns_t   *ns;
> -    const char **t;
> +    PFqname_raw_t   qn_raw;
> +    PFns_t         *ns;
> +    const char    **t;
>  
>      assert (nsloc);
>  
> -    /* validly called here, as we don't look into qn.ns.uri */
> -    qn = PFstr_qname (nsloc);
> +    qn_raw = PFqname_raw (nsloc);
>  
>      /*
>       * check namespace of opening tag
> @@ -517,7 +514,7 @@
>       * will correctly lead to the default element namespace in
>       * lookup_ns().
>       */
> -    if ((ns = lookup_ns (qn.ns.prefix))) {
> +    if ((ns = lookup_ns (qn_raw.prefix))) {
>          /* is this the XML Schema namespace? */
>          if (strcmp (ns->uri, PFns_xs.uri)) {
>              PFinfo (OOPS_SCHEMAIMPORT, "non-XML Schema element seen");
> @@ -527,12 +524,12 @@
>      }
>      else {
>          PFinfo (OOPS_BADNS,
> -                "(XML Schema import) prefix `%s' unknown", qn.ns.prefix);
> +                "(XML Schema import) prefix `%s' unknown", qn_raw.prefix);
>          xmlParserError (ctx, "\n");
>          PFoops (OOPS_SCHEMAIMPORT, "check schema validity");
>      }
>  
> -    t = (char const **) bsearch (qn.loc,
> +    t = (char const **) bsearch (qn_raw.loc,
>                                   xml_schema_tags,
>                                   XML_SCHEMA_TAGS,
>                                   sizeof (char *),
> @@ -580,8 +577,8 @@
>  static PFarray_t *
>  attributes (void *ctx, const xmlChar **atts)
>  {
> -    PFqname_t qn;
> -    PFarray_t *attrs;
> +    PFqname_raw_t  qn_raw;
> +    PFarray_t     *attrs;
>  
>      attrs = PFarray (sizeof (char *));
>  
> @@ -591,17 +588,17 @@
>      if (atts)
>          while (*atts) {
>  
> -            qn = PFstr_qname ((char *) *atts);
> +            qn_raw = PFqname_raw ((char *) *atts);
>  
> -            assert (qn.ns.prefix);
> +            assert (qn_raw.prefix);
>  
> -            if (*(qn.ns.prefix)) {
> -                if (strcmp (qn.ns.prefix, XMLNS) == 0) {
> +            if (*(qn_raw.prefix)) {
> +                if (strcmp (qn_raw.prefix, XMLNS) == 0) {
>                      /* `xmlns:loc="uri"' NS declaration attribute */
>                      atts++;
>  
>                      /* declare loc namespace |-> uri */
> -                    push_ns (new_ns (qn.loc, PFstrdup ((char *) *atts)));
> +                    push_ns (new_ns (qn_raw.loc, PFstrdup ((char *) *atts)));
>                      atts++;
>  
>                      continue;
> @@ -609,12 +606,12 @@
>  
>                  /* bogus namespace prefix for regular attribute */
>                  PFinfo (OOPS_SCHEMAIMPORT,
> -                        "undeclared attribute `%s'", PFqname_str (qn));
> +                        "undeclared attribute `%s'", PFqname_raw_str (qn_raw));
>                  xmlParserError (ctx, "\n");
>                  PFoops (OOPS_SCHEMAIMPORT, "check schema validity");
>              }
>  
> -            if (strcmp (qn.loc, XMLNS) == 0) {
> +            if (strcmp (qn_raw.loc, XMLNS) == 0) {
>                  /* `xmlns="uri"' default NS declaration attribute */
>                  atts++;
>  
> @@ -2511,8 +2508,10 @@
>   * the given name @a qn in symbol space @a sym_space.
>   */
>  #define REGULARITY(sym_space)                                        \
> -static void regularity_##sym_space (PFqname_t qn)                    \
> +static void regularity_##sym_space (PFqname_t qn, void *defn)        \
>  {                                                                    \
> +    (void) defn;                                                     \
> +                                                                     \
>      if (PFty_regularity (PFty_##sym_space (qn)))                     \
>          return;                                                      \
>                                                                       \
> @@ -2569,11 +2568,11 @@
>      }
>  
>      /* check imported types for well-formedness (ensure regularity) */
> -    PFenv_key_iterate (PFtype_defns,      regularity_named);
> -    PFenv_key_iterate (PFelem_decls,      regularity_named_elem);
> -    PFenv_key_iterate (PFattr_decls,      regularity_named_attr);
> -    PFenv_key_iterate (PFgroup_defns,     regularity_named_group);
> -    PFenv_key_iterate (PFattrgroup_defns, regularity_named_attrgroup);
> +    PFenv_iterate (PFtype_defns,      regularity_named);
> +    PFenv_iterate (PFelem_decls,      regularity_named_elem);
> +    PFenv_iterate (PFattr_decls,      regularity_named_attr);
> +    PFenv_iterate (PFgroup_defns,     regularity_named_group);
> +    PFenv_iterate (PFattrgroup_defns, regularity_named_attrgroup);
>  }
>  
>  /* vim:set shiftwidth=4 expandtab: */
> 
> 
> -------------------------------------------------------------------------
> 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
> _______________________________________________
> Monetdb-pf-checkins mailing list
> Monetdb-pf-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins




More information about the developers-list mailing list