You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by "Nathan Kurz (JIRA)" <ji...@apache.org> on 2009/11/21 19:58:39 UTC

[jira] Created: (LUCY-71) Remove Perl dependency of METAQUOTE

Remove Perl dependency of METAQUOTE
-----------------------------------

                 Key: LUCY-71
                 URL: https://issues.apache.org/jira/browse/LUCY-71
             Project: Lucy
          Issue Type: Improvement
          Components: Charmonizer
            Reporter: Nathan Kurz
            Priority: Minor


Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.

The suggested alternatives were to use manual quoting or standard macros.  

Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.



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


[jira] Resolved: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey resolved LUCY-71.
---------------------------------

    Resolution: Fixed
      Assignee: Marvin Humphrey

With the commit of bye_bye_metaquote.diff as r916351, this issue is resolved.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Assignee: Marvin Humphrey
>            Priority: Minor
>         Attachments: bye_bye_metaquote.diff, charm_and_harm_to_c_and_h.diff, quote.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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


[jira] Commented: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey commented on LUCY-71:
-------------------------------------

It turns out that the following construct generates a warning under GCC:

{code:none}
char stuff[] = QUOTE(\
  #include <stdio.h>
  int main() {
    printf("Greetings, earthlings.\n");
    return 0;
  }
);
{code}

"foo.c:23:5: warning: embedding a directive within macro arguments is not portable"

Thus, my forthcoming patch takes this tack instead:

{code:none}
char stuff[] = 
  QUOTE(  #include <stdio.h>                     )
  QUOTE(  int main() {                           )
  QUOTE(    printf("Greetings, earthlings.\n");  )
  QUOTE(    return 0;                            )
  QUOTE(  }                                      );
{code}

It works fine so long as there are no unmated parentheses on any given line.  

The vim highlighter doesn't really like curly braces within parens, but other
than that, the construct seems to work ok.


> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: charm_and_harm_to_c_and_h.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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


[jira] Updated: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey updated LUCY-71:
--------------------------------

    Attachment: quote.diff

A couple more minor issues with the latest QUOTE strategem popped up.  First,
MSVC complained about not getting enough arguments when the macro was fed
either pure whitespace or just a comment, forcing such lines to go unquoted:

{code:none}
QUOTE(      int i;                                                   )
QUOTE(      int retval;                                              )
            /* Rebuild command line args. */ 
QUOTE(      for (i = 1; i < argc; i++) {                             )
QUOTE(          command_len += strlen(argv[i]) + 1;                  )
{code}

Second, GCC warned about embedding __VA_ARGS__, so I manually quoted that.

{code:none}
QUOTE(  #include "_charm.h"                                   )   
QUOTE(  #define ISO_TEST(fmt, ...) \\                         )   
"           printf(fmt, __VA_ARGS__)                        \n"
QUOTE(  int main() {                                          )  
{code}

Despite the limitations, though, in my opinion QUOTE is still better than global 
manual quoting -- so here's the complete quote.diff patch, which purges 
METAQUOTE from the Charmonizer source files.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: charm_and_harm_to_c_and_h.diff, quote.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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


[jira] Updated: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey updated LUCY-71:
--------------------------------

    Attachment: bye_bye_metaquote.diff

Ever since all instances of METAQUOTE in the Charmonizer source code were
switched over to QUOTE, running through the "metaquote" utility has been a
pass-through operation.  The attached patch, "bye_bye_metaquote.diff",
eliminates the metaquote stage, so that the Perl build process uses the
Charmonizer .c/.h files directly.  It also removes the now-obsolete
"metaquote" script and the trunk/charmonizer/bin directory.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: bye_bye_metaquote.diff, charm_and_harm_to_c_and_h.diff, quote.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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


[jira] Updated: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey updated LUCY-71:
--------------------------------

    Attachment: charm_and_harm_to_c_and_h.diff

With commit r882993, I svn moved all .charm/.harm files to .c/.h and patched
the metaquote utility and Build.pm to handle the new filenames.

This gets us past stage one of this issue.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: charm_and_harm_to_c_and_h.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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


[jira] Commented: (LUCY-71) Remove Perl dependency of METAQUOTE

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

Marvin Humphrey commented on LUCY-71:
-------------------------------------

"quote.diff" has been committed as r904951.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>
>                 Key: LUCY-71
>                 URL: https://issues.apache.org/jira/browse/LUCY-71
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: charm_and_harm_to_c_and_h.diff, quote.diff
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the 'stringify' (#expr) function within standard C preprocessor macros.

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