You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by "Peter Karman (JIRA)" <ji...@apache.org> on 2009/11/23 05:40:40 UTC

[jira] Created: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

use short names wherever CHAZ_USE_SHORT_NAMES is in effect
----------------------------------------------------------

                 Key: LUCY-72
                 URL: https://issues.apache.org/jira/browse/LUCY-72
             Project: Lucy
          Issue Type: Task
          Components: Charmonizer
            Reporter: Peter Karman


Function names in .c files always use "short names"
whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
"Sort_mergesort" rather than "lucy_Sort_mergesort".  
    
Within Charmonizer, we should be consistent about using short names
everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:

     void
    -chaz_Test_plan(TestBatch *batch)
    +Test_plan(TestBatch *batch)
     {
         printf("1..%u\n", batch->num_tests);
     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marvin Humphrey resolved LUCY-72.
---------------------------------

    Resolution: Fixed
      Assignee: Marvin Humphrey

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>            Assignee: Marvin Humphrey
>         Attachments: charmonize_c_short_names.diff, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Peter Karman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782952#action_12782952 ] 

Peter Karman commented on LUCY-72:
----------------------------------

Ah, this was my fault. I did this:

 % grep -r -l ' append_conf' charmonizer | xargs perl -pi -e 's/ append_conf/ ModHand_append_conf/g'

instead of this:

 % grep -r -l ' append_conf' charmonizer | grep -v .svn | xargs perl -pi -e 's/ append_conf/ ModHand_append_conf/g'

forgot the grep -v .svn that I used for my other global changes. So the .svn dirs had the same s/// applied and so svn diff did not see a change.

My bad. Sorry.

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Peter Karman (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Karman updated LUCY-72:
-----------------------------

    Attachment: chaz_prefix-cleanup.patch

This patch removes the chaz_ prefix wherever the SHORT_NAMES macro is in effect and does some further clean up of the function names to add namespace prefixes where they were missing. This patch is against r884395

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marvin Humphrey updated LUCY-72:
--------------------------------

    Attachment: chaz_prefix-cleanup.patch

Here's a new version of the patch with the append_conf() thing fixed.

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marvin Humphrey updated LUCY-72:
--------------------------------

    Attachment: chaz_prefix-cleanup.patch
                charmonize_c_short_names.diff

Attached two diff files.  The first is charmonize_c_short_names.diff, which
I'm not going to apply right now, but we should keep around pending further
discussions.  The second is another rev of chaz_prefix-cleanup.patch.  Aside
from charmonize.c getting broken out, there are only a few changed lines
relating to ModHandler.h in this version.

When we define macros, we should always use the fully qualified symbol names,
so that the macro will continue to work in the absence of
CHAZ_USE_SHORT_NAMES.  I.e. this change...

{code:none}
-#define CHAZ_MODHAND_END_RUN append_conf("\n")
+#define CHAZ_MODHAND_END_RUN chaz_ModHand_append_conf("\n")
{code}

... rather than this one:

{code:none}
-#define CHAZ_MODHAND_END_RUN append_conf("\n")
+#define CHAZ_MODHAND_END_RUN ModHand_append_conf("\n")
{code}

In all the changes this iteration, it turned out to be academic, because all
the affected macros only get invoked in the context of CHAZ_USE_SHORT_NAMES
anyway.  However, I think we should always define macros this way for
consistency's sake.  That's how I've tried to do things in the Lucy core,
anyhow.

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: charmonize_c_short_names.diff, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782967#action_12782967 ] 

Marvin Humphrey commented on LUCY-72:
-------------------------------------

I committed the third rev of chaz_prefix-cleanup.patch (dated 
2009-11-26 07:20 PM) as r884674.

I'll leave this issue open for another day or so in case someone wants to make
the case that charmonize_c_short_names.diff should be applied as part of this
issue, too.

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: charmonize_c_short_names.diff, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782946#action_12782946 ] 

Marvin Humphrey commented on LUCY-72:
-------------------------------------

Technical note about the patch first: 

There's something a little strange.  "svn diff" or however it was prepared
failed to detect that certain lines were changed:

{code:none}
 void 
-chaz_ModHand_shorten_macro(const char *sym)
+ModHand_shorten_macro(const char *sym)
 {
     ModHand_append_conf("  #define %s CHY_%s\n", sym, sym); 
 }
{code}

Note the "ModHand_append_conf".  That line has actually changed -- it's just
"append_conf" in the repository now.  

It turns out that everywhere that "append_conf" appeared in the code base --
and it's all over the place, in many files -- it wasn't detected as changed.
But clearly it *was* changed, because we see the changed line right there in
the patch.  Weird.

In any case, I got everything to work by first manually applying the hunks
that had been rejected, then issuing the following command:

{code}
$ predit -T 's/\bappend_conf\b/ModHand_append_conf/g' charmonizer/src/
{code}

("predit", for "Perl Recursive EDITor", is a little app in the KS
trunk/devel/bin directory.  It performs the specified transform on every file
within a directory tree, but before saving the changes it shows you a diff and
asks you to confirm, making it safer than the canonical "perl -pie".)


> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782959#action_12782959 ] 

Marvin Humphrey commented on LUCY-72:
-------------------------------------

OK, now that we have the fiddly stuff straightened out...

This is a good patch.  It takes the intent of the original task and goes much
farther in exactly the right direction.  With this patch, it is much clearer
where you might find all the various functions being invoked within
Charmonizer, and we are much more in line with the namespacing conventions
used in the Lucy core.

The only thing that's a little wacky is that charmonize.c itself was supposed
to be user code, and thus maybe ought to be using the full qualified symbols
as we'd expect user code to do.  

I think that wasn't clear because of where charmonize.c is located, right
there in trunk/charmonizer/.   Nate thought it was internal to Charmonizer,
too.  And if you both made the same "mistake" from my perspective, then we
know who's *really* to blame.  :)

Maybe what we should do is move this full-on version of charmonize.c somewhere
else (trunk/core?), add a trunk/charmonizer/sample/ directory and include a
slimmed-down version that's obviously documentation rather than functional
code in use by Lucy.  Whatever.  That's a separate issue, and we should
discuss it on the dev list as we decide what kind of an API Charmonizer ought
to have and how to document it.

In any case, I'm going to make a few more minor mods, break out the
charmonize.c changes as a separate patch, and commit the rest.  


> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCY-72) use short names wherever CHAZ_USE_SHORT_NAMES is in effect

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782954#action_12782954 ] 

Marvin Humphrey commented on LUCY-72:
-------------------------------------

> So the .svn dirs had the same s/// applied and so svn diff did not see a
> change.

Ha!  Mystery solved.

I probably had it coming after all the nasty little traps you set off while
working up this patch: 

{code:none}
 #ifdef CHAZ_USE_SHORT_NAMES
-  #define VariadicMacros_run    chaz_VaradicMacros_run
+  #define VariadicMacros_run    chaz_VariadicMacros_run
 #endif
{code}

:)

This append_conf() snafu is a perfect illustration of why I hate "perl -pie"
and felt compelled to write predit.

> use short names wherever CHAZ_USE_SHORT_NAMES is in effect
> ----------------------------------------------------------
>
>                 Key: LUCY-72
>                 URL: https://issues.apache.org/jira/browse/LUCY-72
>             Project: Lucy
>          Issue Type: Task
>          Components: Charmonizer
>            Reporter: Peter Karman
>         Attachments: chaz_prefix-cleanup.patch, chaz_prefix-cleanup.patch
>
>
> Function names in .c files always use "short names"
> whenever the "LUCY_USE_SHORT_NAMES" macro is in effect -- e.g. we use
> "Sort_mergesort" rather than "lucy_Sort_mergesort".  
>     
> Within Charmonizer, we should be consistent about using short names
> everywhere the "CHAZ_USE_SHORT_NAMES" macro is in effect, but currently
> there are lots of places that we don't -- e.g. we use "chaz_Test_plan"
> rather than "Test_plan" within charmonizer/src/Charmonizer/Test.charm:
>      void
>     -chaz_Test_plan(TestBatch *batch)
>     +Test_plan(TestBatch *batch)
>      {
>          printf("1..%u\n", batch->num_tests);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.