Deprecated: Function set_magic_quotes_runtime() is deprecated in /home4/mfoster/public_html/cb/forums/include/common.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 34
Cross-Browser.com / Putting a copyright notice in a compressed file

Cross-Browser.com

X Library Forums

You are not logged in.

Announcement

New user registration is currently disabled.

  • Index
  •  » X Library
  •  » Putting a copyright notice in a compressed file

#1 July 20, 2007 11:27:37 am

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Putting a copyright notice in a compressed file

xc does a great job of compressing source but it removes all comments, including the copyright notice that's often at the top of the file.  If I use 3rd party code with certain licenses, I'm obligated to preserve the notice but would really like to compress the rest of the file.  I'd like some way to have xc preserve or add copyright notices to the output file.  One strategy would be to skip the first comment in the file (if the copyright isn't there, I could move it up).  Another would be to be able to specify a file to be copied to the output (before or after the xc banner).  Any thoughts?

Offline

 

#2 July 20, 2007 4:34:36 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Putting a copyright notice in a compressed file

Yes I agree. I've often thought about this.

Let's kick around some ideas

to be able to specify a file to be copied to the output


I have been thinking along these lines also. For "XLib Mode" it means another directive in the config file. For "Standalone" mode it means a command-line option.

I'll be thinking about it. If you Chris or anyone else has any other ideas please post them.

Offline

 

#3 July 23, 2007 8:43:53 am

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Re: Putting a copyright notice in a compressed file

MikeFoster wrote:

If you Chris or anyone else has any other ideas please post them.


I think that including a specified file is probably easier for you to code but it'd be much, much easier for me to use if you had a switch to leave the first comment in the file intact.  I looked at xc.c and it seems that at line 1033 if you had a flag -- set by a command line option (or config file option) -- that said, "leave first comment" you could easily bypass that comment processing block once, clearing the flag as you go.  That way I can have a Makefile like:

# Open Source Software scripts; we *don't* take the copyright notices (first comment) out.
OSSSCRIPTS := x.js xc.js TSorter_1.js webtoolkit.md5.js
...
  @for s in $(OSSSCRIPTS) ; do \
    xc -keepfirstcomment target/$$s $$s >/dev/null;\
   done


Rather than having to process each 3rd party script separately (somehow extracting their copyright notice to a temporary file then including it in the compressed file).  OTOH, I want to have my cake and eat it, too, because for my scripts, I want to include the same copyright in every one as part of post processing:

# Our scripts, put copyright in after compression
SCRIPTS := one.js two.js
...
  @for s in $(SCRIPTS) ; do \
    xc -addheader ourcopyright.txt target/$$s $$s >/dev/null;\
   done


On the third hand ;-), I'm likely to have a copyright notice in my uncompressed script so keeping the first comment in my scripts solves both problems.  If I had to choose, I vote strongly in favor of a "keep first comment" option.

Last edited by ChrisNelson (July 23, 2007 8:44:44 am)

Offline

 

#4 July 23, 2007 9:39:56 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Putting a copyright notice in a compressed file

You have some good ideas there.

I was thinking, since header comments are often a group of single-line comments, maybe the logic could be that we preserve everything until we reach the first non-comment line... ?

Also, perhaps this option should only apply to application (non-xlib) code... ?

Offline

 

#5 July 24, 2007 6:57:12 am

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Re: Putting a copyright notice in a compressed file

MikeFoster wrote:

You have some good ideas there.


Thanks.

I was thinking, since header comments are often a group of single-line comments, maybe the logic could be that we preserve everything until we reach the first non-comment line... ?


Yes!  A great idea.

Also, perhaps this option should only apply to application (non-xlib) code... ?


Sure.  That doesn't matter to me.

Offline

 

#6 July 24, 2007 4:41:33 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Putting a copyright notice in a compressed file

Please give it a try before I release it: xc_107_src.zip

Standalone mode syntax:

xc [-hdr] output_file input_file1 input_file2 input_file3 ...

Offline

 

#7 July 24, 2007 7:38:28 pm

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Re: Putting a copyright notice in a compressed file

MikeFoster wrote:

Please give it a try before I release it: xc_107_src.zip


Awesome!  Thanks.  I'll try it first thing tomorrow.

Offline

 

#8 July 25, 2007 9:32:06 am

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Re: Putting a copyright notice in a compressed file

Works great!  Thanks.

Offline

 

#9 July 25, 2007 10:03:30 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: Putting a copyright notice in a compressed file

Excellent smile

When you get a chance, would you please make a statically linked executable as gebura mentioned in this topic? If you'll email that to me I'll include it in the next X release.

Thanks very much!

Offline

 

#10 July 25, 2007 11:10:38 am

ChrisNelson
Member
Registered: June 22, 2007
Posts: 73

Re: Putting a copyright notice in a compressed file

Just sent the Linux binary.

Offline

 
  • Index
  •  » X Library
  •  » Putting a copyright notice in a compressed file

Board footer

Powered by PunBB 1.2.15
Copyright © 2002–2005 Rickard Andersson

Expand Restore Select Format Eval Load