[65498] trunk/dports/textproc/tcl-dox
raimue at macports.org
raimue at macports.org
Fri Mar 26 14:37:45 PDT 2010
Revision: 65498
http://trac.macports.org/changeset/65498
Author: raimue at macports.org
Date: 2010-03-26 14:37:43 -0700 (Fri, 26 Mar 2010)
Log Message:
-----------
textproc/tcl-dox:
Apply some patches from http://therowes.net/~greg/2010/02/10/tcl-dox-patches/
Modified Paths:
--------------
trunk/dports/textproc/tcl-dox/Portfile
Added Paths:
-----------
trunk/dports/textproc/tcl-dox/files/
trunk/dports/textproc/tcl-dox/files/patch-0001-require-at-least-one-white-space-and-or-tab-after-a-.diff
trunk/dports/textproc/tcl-dox/files/patch-0002-print-whitespace-after-namespace-declaration.diff
trunk/dports/textproc/tcl-dox/files/patch-0003-if-we-match-a-at-start-of-file-we-look-for-a-matchin.diff
trunk/dports/textproc/tcl-dox/files/patch-0004-recognize-package-require-provide-statements.diff
trunk/dports/textproc/tcl-dox/files/patch-0005-consume-whole-content-of-a-proc-declaration.diff
trunk/dports/textproc/tcl-dox/files/patch-0006-add-a-pattern-to-recognize-values-in-brackets-in-opt.diff
trunk/dports/textproc/tcl-dox/files/patch-0007-consume-whole-lines-or-at-least-the-newline-characte.diff
trunk/dports/textproc/tcl-dox/files/patch-0008-don-t-break-the-lexer-if-there-is-an-escaped-bracket.diff
trunk/dports/textproc/tcl-dox/files/patch-0009-remove-commented-test-code.diff
Modified: trunk/dports/textproc/tcl-dox/Portfile
===================================================================
--- trunk/dports/textproc/tcl-dox/Portfile 2010-03-26 21:22:51 UTC (rev 65497)
+++ trunk/dports/textproc/tcl-dox/Portfile 2010-03-26 21:37:43 UTC (rev 65498)
@@ -4,6 +4,7 @@
name tcl-dox
version 0.8.3
+revision 1
categories textproc
platforms darwin
maintainers raimue
@@ -20,6 +21,21 @@
depends_build bin:flex:flex
+
+patchfiles \
+ patch-0001-require-at-least-one-white-space-and-or-tab-after-a-.diff \
+ patch-0002-print-whitespace-after-namespace-declaration.diff \
+ patch-0003-if-we-match-a-at-start-of-file-we-look-for-a-matchin.diff \
+ patch-0004-recognize-package-require-provide-statements.diff \
+ patch-0005-consume-whole-content-of-a-proc-declaration.diff \
+ patch-0006-add-a-pattern-to-recognize-values-in-brackets-in-opt.diff \
+ patch-0007-consume-whole-lines-or-at-least-the-newline-characte.diff \
+ patch-0008-don-t-break-the-lexer-if-there-is-an-escaped-bracket.diff \
+ patch-0009-remove-commented-test-code.diff
+
+patch.args -p1
+patch.dir ${worksrcpath}/src
+
use_configure no
build.dir ${worksrcpath}/src
Added: trunk/dports/textproc/tcl-dox/files/patch-0001-require-at-least-one-white-space-and-or-tab-after-a-.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0001-require-at-least-one-white-space-and-or-tab-after-a-.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0001-require-at-least-one-white-space-and-or-tab-after-a-.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,71 @@
+>From 941072cd481b4c070b1a5cc67dd1ad7ab0ebf880 Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 10:30:08 +0100
+Subject: [PATCH 1/9] require at least one white space and/or tab after a keyword so we won't
+ keywords in function names e.g. proc foo_set_var {}
+
+---
+ tcl-dox.l | 17 ++++++++---------
+ 1 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index 2dd813f..6d1a1ff 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -83,22 +83,21 @@ WS [ \t]
+ }
+
+
+-
+- "class" {
++ "class"[ \t]+ {
+ ECHO;
+ BEGIN(CLASS);
+ }
+
+- "constructor" {
++ "constructor"[ \t]+ {
+ fprintf(yyout, "public:\n %s", g_className);
+ BEGIN(PROC_OPEN);
+ }
+
+- "destructor" {
++ "destructor"[ \t]+ {
+ fprintf(yyout, "public:\n ~%s()", g_className);
+ }
+
+- "proc" {
++ "proc"[ \t]+ {
+ /* If we are inside of a class then the proc is static. */
+ if(g_className)
+ {
+@@ -111,22 +110,22 @@ WS [ \t]
+ BEGIN(PROC);
+ }
+
+- "method" {
++ "method"[ \t]+ {
+ fprintf(yyout, "%s", "string ");
+ BEGIN(PROC);
+ }
+
+- "namespace eval" {
++ "namespace eval"[ \t]+ {
+ fprintf(yyout, "%s", "namespace");
+ BEGIN(NAMESPACE);
+ }
+
+- "public"|"private"|"protected" {
++ "public"|"private"|"protected"[ \t]+ {
+ ECHO;
+ fprintf(yyout, "%s", ":\n");
+ }
+
+- "variable"|"common"|"global"|"array set"|"set" {
++ "variable"|"common"|"global"|"array set"|"set"[ \t]+ {
+ fprintf(yyout, "%s", "type ");
+ BEGIN(VAR);
+ }
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0002-print-whitespace-after-namespace-declaration.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0002-print-whitespace-after-namespace-declaration.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0002-print-whitespace-after-namespace-declaration.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,25 @@
+>From 572cfeba145eb8e94e1acc5bbdbeeae87ba3447c Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 10:32:35 +0100
+Subject: [PATCH 2/9] print whitespace after namespace declaration
+
+---
+ tcl-dox.l | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index 6d1a1ff..ac3a69b 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -116,7 +116,7 @@ WS [ \t]
+ }
+
+ "namespace eval"[ \t]+ {
+- fprintf(yyout, "%s", "namespace");
++ fprintf(yyout, "%s", "namespace ");
+ BEGIN(NAMESPACE);
+ }
+
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0003-if-we-match-a-at-start-of-file-we-look-for-a-matchin.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0003-if-we-match-a-at-start-of-file-we-look-for-a-matchin.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0003-if-we-match-a-at-start-of-file-we-look-for-a-matchin.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,49 @@
+>From 5ae7aab919826dc03c2f4a7e4ae33880fc132bf9 Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 10:33:34 +0100
+Subject: [PATCH 3/9] if we match a #! at start of file we look for a matching exec statement
+ to cover the exec tclsh "$0" ${1+$@} trick from the tclsh manpage
+
+---
+ tcl-dox.l | 12 +++++++++++-
+ 1 files changed, 11 insertions(+), 1 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index ac3a69b..17887c4 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -58,13 +58,18 @@ void handleArgumentComma();
+ %option nounput
+
+ %x CBLOCK CLASS PROC PROC_OPEN PROC_ARGS OPTIONAL_ARG
+-%x VAR CLASS_INH INH NAMESPACE UNSUPPORTED_CMD
++%x VAR CLASS_INH INH NAMESPACE UNSUPPORTED_CMD EXEC
+
+ ID [[:alpha:]_]+[[:alnum:]_]*
+ WS [ \t]
+
+ %%
+
++ /* looks like a shebang line.. smells like the exec trick so lets
++ * try to catch it; match this only at the start of file */
++"#!".*$ {
++ BEGIN(EXEC);
++}
+
+ <INITIAL>{
+ ##{WS}*$ {
+@@ -159,6 +164,11 @@ WS [ \t]
+ }
+
+
++<EXEC>{
++ .*"exec"[ \t]+.* {BEGIN(INITIAL);}
++ .* {BEGIN(EXEC);}
++}
++
+
+
+ <CBLOCK>{
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0004-recognize-package-require-provide-statements.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0004-recognize-package-require-provide-statements.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0004-recognize-package-require-provide-statements.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,53 @@
+>From e1d82ff8117e2368ffe56bb8c1a5aab42750043a Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 10:37:16 +0100
+Subject: [PATCH 4/9] recognize package require|provide statements
+ replace package require with '#include "<package>"'
+
+---
+ tcl-dox.l | 15 ++++++++++++++-
+ 1 files changed, 14 insertions(+), 1 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index 17887c4..ee254a0 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -58,7 +58,7 @@ void handleArgumentComma();
+ %option nounput
+
+ %x CBLOCK CLASS PROC PROC_OPEN PROC_ARGS OPTIONAL_ARG
+-%x VAR CLASS_INH INH NAMESPACE UNSUPPORTED_CMD EXEC
++%x VAR CLASS_INH INH NAMESPACE UNSUPPORTED_CMD PACKAGE EXEC
+
+ ID [[:alpha:]_]+[[:alnum:]_]*
+ WS [ \t]
+@@ -135,6 +135,10 @@ WS [ \t]
+ BEGIN(VAR);
+ }
+
++ "package"[ \t]+ {
++ BEGIN(PACKAGE);
++ }
++
+
+ \} {
+
+@@ -170,6 +174,15 @@ WS [ \t]
+ }
+
+
++<PACKAGE>{
++ "require"[ \t]+.* {
++ fprintf(yyout, "%s \"%s\"\n", "#include", yytext + strlen("require") + 1);
++ BEGIN(INITIAL);
++ }
++ .* {
++ BEGIN(INITIAL);
++ }
++}
+
+ <CBLOCK>{
+ ^{WS}*#.*$ {
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0005-consume-whole-content-of-a-proc-declaration.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0005-consume-whole-content-of-a-proc-declaration.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0005-consume-whole-content-of-a-proc-declaration.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,88 @@
+>From d089856a5b473fd3806ec226f707bb1985bb22aa Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 13:46:53 +0100
+Subject: [PATCH 5/9] consume whole content of a proc declaration
+ replace it with {}
+ this is done by counting '{' and '}'. we start with an open bracket and
+ increase the counter for every subsequent open bracket whereas for every
+ close bracket we'll decrease the count by one.
+ when the counter is one again we have reached the closing bracket of the
+ proc and we can start from initial again.
+ this ensures that anything inside of a proc won't confuse the rest of
+ the lexer.
+
+---
+ tcl-dox.l | 36 ++++++++++++++++++++++++++++++++----
+ 1 files changed, 32 insertions(+), 4 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index ee254a0..21afca5 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -28,6 +28,11 @@ int g_firstArg;
+ int g_oarg;
+
+ /**
++ * count brackets inside of proc statements so the function body can be
++ * ignored and won't confuse the lexer with keywords */
++int g_bcount = 1;
++
++/**
+ * Keeps track of the current class name. This is needed for correct
+ * output of constructors and destructors using C++ syntax.
+ */
+@@ -57,7 +62,7 @@ void handleArgumentComma();
+
+ %option nounput
+
+-%x CBLOCK CLASS PROC PROC_OPEN PROC_ARGS OPTIONAL_ARG
++%x CBLOCK CLASS PROC PROC_OPEN PROC_ARGS PROC_EAT OPTIONAL_ARG
+ %x VAR CLASS_INH INH NAMESPACE UNSUPPORTED_CMD PACKAGE EXEC
+
+ ID [[:alpha:]_]+[[:alnum:]_]*
+@@ -290,8 +295,8 @@ WS [ \t]
+
+ <PROC_ARGS>{
+ \} {
+- fprintf(yyout, "%s", ")");
+- BEGIN(INITIAL);
++ fprintf(yyout, "%s\n%s", ")", "{");
++ BEGIN(PROC_EAT);
+ }
+
+ {ID} {
+@@ -307,7 +312,30 @@ WS [ \t]
+ }
+ }
+
+-
++<PROC_EAT>{
++ .*\n {
++ do
++ {
++ switch (*yytext)
++ {
++ case '{':
++ g_bcount++;
++ break;
++ case '}':
++ g_bcount--;
++ break;
++ }
++ /*fprintf(stderr, "%s\t%i\n", yytext, * g_bcount);*/
++ } while (*(yytext++));
++
++ if (g_bcount == 1) {
++ fprintf(yyout, "%s\n", "}");
++ BEGIN(INITIAL);
++ } else {
++ BEGIN(PROC_EAT);
++ }
++ }
++}
+
+ <CLASS>{
+ {ID} {
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0006-add-a-pattern-to-recognize-values-in-brackets-in-opt.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0006-add-a-pattern-to-recognize-values-in-brackets-in-opt.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0006-add-a-pattern-to-recognize-values-in-brackets-in-opt.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,52 @@
+>From 6be037f73050404e0ae15b55049211a729555dea Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 14:22:36 +0100
+Subject: [PATCH 6/9] add a pattern to recognize values in {} brackets in optional arguments
+
+---
+ tcl-dox.l | 29 ++++++++++++++++++-----------
+ 1 files changed, 18 insertions(+), 11 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index 21afca5..e99959e 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -280,17 +280,24 @@ WS [ \t]
+
+
+ <OPTIONAL_ARG>{
+- \} {
+- g_oarg = 0;
+- BEGIN(PROC_ARGS);
+- }
+- [^\n\} \t]+ {
+- g_oarg++;
+- if((g_oarg % 2) == 0){
+- fprintf(yyout, "%s", "=");
+- }
+- ECHO;
+- }
++ \} {
++ g_oarg = 0;
++ BEGIN(PROC_ARGS);
++ }
++ [^\n\} \t]+ {
++ g_oarg++;
++ if((g_oarg % 2) == 0){
++ fprintf(yyout, "%s", "=");
++ }
++ ECHO;
++ }
++ \{[^\n\} \t]*\} {
++ g_oarg++;
++ if((g_oarg % 2) == 0){
++ fprintf(yyout, "%s", "=");
++ }
++ ECHO;
++ }
+ }
+
+ <PROC_ARGS>{
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0007-consume-whole-lines-or-at-least-the-newline-characte.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0007-consume-whole-lines-or-at-least-the-newline-characte.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0007-consume-whole-lines-or-at-least-the-newline-characte.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,34 @@
+>From f20fb9dadea09c1703e705b72b836872ae592c15 Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 14:24:02 +0100
+Subject: [PATCH 7/9] consume whole lines or at least the newline character
+
+---
+ tcl-dox.l | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index e99959e..d49e3ce 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -175,7 +175,7 @@ WS [ \t]
+
+ <EXEC>{
+ .*"exec"[ \t]+.* {BEGIN(INITIAL);}
+- .* {BEGIN(EXEC);}
++ .*|\n {BEGIN(EXEC);}
+ }
+
+
+@@ -320,7 +320,7 @@ WS [ \t]
+ }
+
+ <PROC_EAT>{
+- .*\n {
++ .*|\n {
+ do
+ {
+ switch (*yytext)
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0008-don-t-break-the-lexer-if-there-is-an-escaped-bracket.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0008-don-t-break-the-lexer-if-there-is-an-escaped-bracket.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0008-don-t-break-the-lexer-if-there-is-an-escaped-bracket.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,27 @@
+>From 27dedd9c4bd052123085ac9b7a3c6e71a32a9bf9 Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 14:24:42 +0100
+Subject: [PATCH 8/9] don't break the lexer if there is an escaped bracket (\{ or \}) on the
+ input
+
+---
+ tcl-dox.l | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index d49e3ce..ffdbfd6 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -325,6 +325,9 @@ WS [ \t]
+ {
+ switch (*yytext)
+ {
++ case '\\':
++ /* ignore any escaped value */
++ break;
+ case '{':
+ g_bcount++;
+ break;
+--
+1.6.6.1
+
Added: trunk/dports/textproc/tcl-dox/files/patch-0009-remove-commented-test-code.diff
===================================================================
--- trunk/dports/textproc/tcl-dox/files/patch-0009-remove-commented-test-code.diff (rev 0)
+++ trunk/dports/textproc/tcl-dox/files/patch-0009-remove-commented-test-code.diff 2010-03-26 21:37:43 UTC (rev 65498)
@@ -0,0 +1,24 @@
+>From 86bf768d672132336d72e8828e93e9a6bbbdc1ca Mon Sep 17 00:00:00 2001
+From: Jochen Keil <jochen.keil at emlix.com>
+Date: Fri, 29 Jan 2010 14:25:27 +0100
+Subject: [PATCH 9/9] remove commented test code
+
+---
+ tcl-dox.l | 1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+diff --git a/tcl-dox.l b/tcl-dox.l
+index ffdbfd6..8390ed1 100644
+--- a/tcl-dox.l
++++ b/tcl-dox.l
+@@ -335,7 +335,6 @@ WS [ \t]
+ g_bcount--;
+ break;
+ }
+- /*fprintf(stderr, "%s\t%i\n", yytext, * g_bcount);*/
+ } while (*(yytext++));
+
+ if (g_bcount == 1) {
+--
+1.6.6.1
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100326/03441c72/attachment.html>
More information about the macports-changes
mailing list