public inbox for sourcenav@sourceware.org
 help / color / mirror / Atom feed
* source navigator patch for javac
@ 2001-01-16 19:57 Jose Freddy Rojas Chavarria
  2001-01-17  0:20 ` Ian Roxborough
  0 siblings, 1 reply; 2+ messages in thread
From: Jose Freddy Rojas Chavarria @ 2001-01-16 19:57 UTC (permalink / raw)
  To: sourcenav

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3146 bytes --]

Hello.
I am using source navigator. And I have an option to use it with 
javac compiler of SUN in linux with the minimal of changes.

To be compatible with the gcc and gjc format I write a simple javacc script. 
It receive the gnu format and call javac in this way.


++++++++++++++++++javacc+++++++++++++++++++++++++++++
#!/bin/sh

case "$1" in
    "-c")
	javac "$2"
    ;;
    "-o")
    ;;
esac
++++++++++++++++++++++++ EOF ++++++++++++++++++++++++++++++++

Then I modify the file mkfilegen.tcl in order to check the name javacc as
the compiler and allow to work it ok in the same way that gjc.
The patch is



+++++++++++++++++++++++++++++mkfilegendiff.patch+++++++++++++++++++++++

*** mkfilegen.tcl	Thu Jan  4 06:56:02 2001
--- mkfilegen.tcl.origin	Mon Sep 11 12:48:34 2000
*************** itcl_class MakefileGen {
*** 33,39 ****
      # private date members
      protected b_target ""     ; # Build target object
      protected toolchain ""    ; # Use this toolchain
!     protected tooljava  ""    ;
  
      method constructor { target_name {tool_chain ""} {args "" }} {
  
--- 33,39 ----
      # private date members
      protected b_target ""     ; # Build target object
      protected toolchain ""    ; # Use this toolchain
! 
  
      method constructor { target_name {tool_chain ""} {args "" }} {
  
*************** itcl_class MakefileGen {
*** 283,291 ****
      method WriteMacroLINKER { file_d } {
          set linker [$b_target GetLinkerLocation]
          puts $file_d "LINKER = $linker"
- 	if { $linker == "javacc" } {
- 	      set tooljava "true"
-         }
  	
          set linkerflags [$b_target GetUserLinkFlags]
          puts $file_d "LINKER_FLAGS = $linkerflags"
--- 283,288 ----
*************** itcl_class MakefileGen {
*** 343,353 ****
          # Make the rule
  	puts $file_d "\nclean:"
  	foreach objext $objexts {
! 	    if { $tooljava == "true"} {
! 	      puts $file_d "\trm -f *.class"    
! 	    } else {
!               puts $file_d "\trm -f *$objext"
! 	    }
          }
  	     
          puts $file_d "\trm -f $outputfile"
--- 340,346 ----
          # Make the rule
  	puts $file_d "\nclean:"
  	foreach objext $objexts {
!             puts $file_d "\trm -f *$objext"
          }
  	     
          puts $file_d "\trm -f $outputfile"


++++++++++++++++++++++ EOF ++++++++++++++++++++++++++++++++

With this two changes I can select javacc as my java compiler and I add
in the project file (makefile) the main java file or the list of files and
sourcenavigator works as gcj compiler.

This is my simple way to do that. Please if you think it patch should be 
practical for you. Tell me please. It is preliminary, and it was my easy way
to avoid to compile gjc for now.

Tank you
Freddy Rojas





++++++++++++++++++++++++++++++++++++++++++
Eng. José Freddy Rojas Chavarría,MSC.
Research and Development Department
Instituto Costarricense de Electricidad
San Jose, Costa Rica.
(Utility company of Costa Rica)
freddy@ns.dgct.ice.go.cr
freddyrojas@costarricense.com
+++++++++++++++++++++++++++++++++++++++++++


_______________________________________
Yo me registré en www.costarricense.com


[-- Attachment #2: JAVACC --]
[-- Type: text/x-shellscript, Size: 75 bytes --]

#!/bin/sh

case "$1" in
    "-c")
	javac "$2"
    ;;
    "-o")
    ;;
esac

[-- Attachment #3: PATCH-FOR-JAVAC.PATCH --]
[-- Type: text/x-diff, Size: 1595 bytes --]

*** mkfilegen.tcl	Thu Jan  4 06:56:02 2001
--- mkfilegen.tcl.origin	Mon Sep 11 12:48:34 2000
*************** itcl_class MakefileGen {
*** 33,39 ****
      # private date members
      protected b_target ""     ; # Build target object
      protected toolchain ""    ; # Use this toolchain
!     protected tooljava  ""    ;
  
      method constructor { target_name {tool_chain ""} {args "" }} {
  
--- 33,39 ----
      # private date members
      protected b_target ""     ; # Build target object
      protected toolchain ""    ; # Use this toolchain
! 
  
      method constructor { target_name {tool_chain ""} {args "" }} {
  
*************** itcl_class MakefileGen {
*** 283,291 ****
      method WriteMacroLINKER { file_d } {
          set linker [$b_target GetLinkerLocation]
          puts $file_d "LINKER = $linker"
- 	if { $linker == "javacc" } {
- 	      set tooljava "true"
-         }
  	
          set linkerflags [$b_target GetUserLinkFlags]
          puts $file_d "LINKER_FLAGS = $linkerflags"
--- 283,288 ----
*************** itcl_class MakefileGen {
*** 343,353 ****
          # Make the rule
  	puts $file_d "\nclean:"
  	foreach objext $objexts {
! 	    if { $tooljava == "true"} {
! 	      puts $file_d "\trm -f *.class"    
! 	    } else {
!               puts $file_d "\trm -f *$objext"
! 	    }
          }
  	     
          puts $file_d "\trm -f $outputfile"
--- 340,346 ----
          # Make the rule
  	puts $file_d "\nclean:"
  	foreach objext $objexts {
!             puts $file_d "\trm -f *$objext"
          }
  	     
          puts $file_d "\trm -f $outputfile"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: source navigator patch for javac
  2001-01-16 19:57 source navigator patch for javac Jose Freddy Rojas Chavarria
@ 2001-01-17  0:20 ` Ian Roxborough
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Roxborough @ 2001-01-17  0:20 UTC (permalink / raw)
  To: freddyrojas; +Cc: sourcenav

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4990 bytes --]

Hi,

This isn't the "real way" to add tool chains (but given that 4.5.2
tool chains support is a bit hacky to say the least....).

You could create a tool chain in toolchain.tcl which would only
have JAVA support (i.e. only a Java toolchain)

This example is close to what you want:

# Sun Java compiler toolchain.

set sunjava [snToolChain SunJavaTarget]
$sunjava SetIsEmbedded 0
$sunjava SetShortName sunjava
$sunjava SetDebuggerName gdb
$sunjava AddRule JAVA .class.o javacc "-c $<"
$sunjava AddRuleInfo JAVA "Java" "Compile a Java file"

# does suns compiler need an entry point.
# $sunjava AddExeLinkerEntryPointFlag JAVA "--main="

$sunjava AddRuleSuffix JAVA .class

#DEBUG FLAGS
$sunjava AddRuleFlagSet JAVA Debug "" DBG_DEFAULT

#OPRIMIZATION FLAGS
$sunjava AddRuleFlagSet JAVA Optimize "" OPT_DEFAULT

#CODE GENERATION FLAGS
$sunjava AddRuleFlagSet JAVA CodeGen "" CG_DEFAULT

#WARNING FLAGS
$sunjava AddRuleFlagSet JAVA Warning "" WN_DEFAULT



You need to find all the hard coded bits for selecting
a tool chain (5.0 will handle this much better).

Another alternative would be to just modify the GNU java
compiler support to use the Sun Java compiler.

Anyway, hope this is of some use to you.
Thanks,
    Ian.


Jose Freddy Rojas Chavarria wrote:
> 
> Hello.
> I am using source navigator. And I have an option to use it with
> javac compiler of SUN in linux with the minimal of changes.
> 
> To be compatible with the gcc and gjc format I write a simple javacc script.
> It receive the gnu format and call javac in this way.
> 
> ++++++++++++++++++javacc+++++++++++++++++++++++++++++
> #!/bin/sh
> 
> case "$1" in
>     "-c")
>         javac "$2"
>     ;;
>     "-o")
>     ;;
> esac
> ++++++++++++++++++++++++ EOF ++++++++++++++++++++++++++++++++
> 
> Then I modify the file mkfilegen.tcl in order to check the name javacc as
> the compiler and allow to work it ok in the same way that gjc.
> The patch is
> 
> +++++++++++++++++++++++++++++mkfilegendiff.patch+++++++++++++++++++++++
> 
> *** mkfilegen.tcl       Thu Jan  4 06:56:02 2001
> --- mkfilegen.tcl.origin        Mon Sep 11 12:48:34 2000
> *************** itcl_class MakefileGen {
> *** 33,39 ****
>       # private date members
>       protected b_target ""     ; # Build target object
>       protected toolchain ""    ; # Use this toolchain
> !     protected tooljava  ""    ;
> 
>       method constructor { target_name {tool_chain ""} {args "" }} {
> 
> --- 33,39 ----
>       # private date members
>       protected b_target ""     ; # Build target object
>       protected toolchain ""    ; # Use this toolchain
> !
> 
>       method constructor { target_name {tool_chain ""} {args "" }} {
> 
> *************** itcl_class MakefileGen {
> *** 283,291 ****
>       method WriteMacroLINKER { file_d } {
>           set linker [$b_target GetLinkerLocation]
>           puts $file_d "LINKER = $linker"
> -       if { $linker == "javacc" } {
> -             set tooljava "true"
> -         }
> 
>           set linkerflags [$b_target GetUserLinkFlags]
>           puts $file_d "LINKER_FLAGS = $linkerflags"
> --- 283,288 ----
> *************** itcl_class MakefileGen {
> *** 343,353 ****
>           # Make the rule
>         puts $file_d "\nclean:"
>         foreach objext $objexts {
> !           if { $tooljava == "true"} {
> !             puts $file_d "\trm -f *.class"
> !           } else {
> !               puts $file_d "\trm -f *$objext"
> !           }
>           }
> 
>           puts $file_d "\trm -f $outputfile"
> --- 340,346 ----
>           # Make the rule
>         puts $file_d "\nclean:"
>         foreach objext $objexts {
> !             puts $file_d "\trm -f *$objext"
>           }
> 
>           puts $file_d "\trm -f $outputfile"
> 
> ++++++++++++++++++++++ EOF ++++++++++++++++++++++++++++++++
> 
> With this two changes I can select javacc as my java compiler and I add
> in the project file (makefile) the main java file or the list of files and
> sourcenavigator works as gcj compiler.
> 
> This is my simple way to do that. Please if you think it patch should be
> practical for you. Tell me please. It is preliminary, and it was my easy way
> to avoid to compile gjc for now.
> 
> Tank you
> Freddy Rojas
> 
> ++++++++++++++++++++++++++++++++++++++++++
> Eng. José Freddy Rojas Chavarría,MSC.
> Research and Development Department
> Instituto Costarricense de Electricidad
> San Jose, Costa Rica.
> (Utility company of Costa Rica)
> freddy@ns.dgct.ice.go.cr
> freddyrojas@costarricense.com
> +++++++++++++++++++++++++++++++++++++++++++
> 
> _______________________________________
> Yo me registré en www.costarricense.com
> 
>   ------------------------------------------------------------------------
>              Name: JAVACC
>    JAVACC    Type: Application/Octect-stream
>          Encoding: Base64
> 
>                             Name: PATCH-FOR-JAVAC.PATCH
>    PATCH-FOR-JAVAC.PATCH    Type: Application/Octect-stream
>                         Encoding: Base64

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-17  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-16 19:57 source navigator patch for javac Jose Freddy Rojas Chavarria
2001-01-17  0:20 ` Ian Roxborough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).