[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: The Licencing Issue
From:       Mirko Sucker <mirko.sucker () unibw-hamburg ! de>
Date:       2000-06-13 20:47:58
[Download RAW message or body]

Talin wrote:
> =

> Here are some things that I hear often from KDE developers on this
> issue:
> =

> 1. "We don't need to change the license, therefore we won't change it."=

> =

>         My question is: Do you generally refuse to add features that yo=
ur users
> have requested, even if you personally don't need them?
Attached is a perl script that suits for changing licenses, contact
information etc in C++ source file automatically. For the people who
simply do not want to spend the time to change the licenses :-)
Just put, instead of your normal headers, the macros $Author$,
$License$, ... (read the script) in your sources, and run the script on
the file. To change the license, change the script. =

Example start of a C++ file:

/*
  Hello World implemented using a graphical user interface.

  $Copyright$
  $Author$
  $License$
  $Contact$
*/

Run the script, and it will look like:

/*
  Hello World implemented using a graphical user interface.

  $ Copyright: (C) 2000, Mirko Sucker $
  $ Author: Mirko Sucker $
  $ License: GPL with the following explicit addition:
         This code may be linked against any version of the Qt toolkit
         from Troll Tech, Norway. $
  $ Contact: mirko@kde.org
         http://www.kde.org $
*/

The script may run as often as you want to, and will replace the text
blocks.
Does this make sense? I do not know, but if it helps...
--Mirko.
-- =

Drei Dinge gibt es, denen alle Menschen gern gem=FCtlich zuschauen:
=B0 fliessendes Wasser,
=B0 knisterndes Feuer und (am allerliebsten)
=B0 anderen Menschen beim Arbeiten. (Charlie Brown).
["makeheaders.pl" (application/x-perl)]

#!/usr/bin/perl -w
#
# (C) Mirko Sucker, 2000.
# Released under GPL.
#
# This script replaces all keywords found as elements in the hash
# @Contents embraced by dollar signs by the contents predefined in the
# hash.  It processes all files given at the command line.  The texts
# may not contain the dollar sign ($), as this is used to mark texts
# to replace. Example: $Author$ will be replaced by the text $ Author:
# <whatever you write below> $ The script is intended to be used in #
# C++ files, place a multiline comment around the macros.

# Some constants for clearer code:

$LicenseText= 
  "License: GPL with the following explicit addition:\n" .
  "         This code may be linked against any version of the Qt toolkit\n" .
  "         from Troll Tech, Norway.";
$ContactText=
  "Contact: mirko\@kde.org\n" .
  "         http://www.kde.org";

# This hash defines the keywords:

%Contents = 
  (
   "Author" => "Author: Mirko Sucker",
   "License" => $LicenseText,
   "Copyright" => "Copyright: (C) 2000, Mirko Sucker",
   "Contact" => $ContactText
  );

# ----- main part:
#       preparation:

$#ARGV+1>0 || die "Give filenames to search and replace keywords in!";

print "Using the following settings and keywords:\n";
foreach $key (keys %Contents)
  {
    print $key . " = " . $Contents{$key} . "\n";
  }

#       iterate over given files:

foreach $file(@ARGV)
  {
    print("Processing $file.\n");
    if(open(InFileHandle, "<".$file))
	{
	  # read complete file content into scalar text:
	  $text="";
	  @temp=<InFileHandle>;
	  foreach(@temp)
	    {
	      $text=$text . $_;
	    }
	  # start replacing:
	  foreach $key (keys %Contents)
	    {
	      $keyword=$key;
	      if($text=~ s/\$\s*$key\s*.*?\s*\$/\$ $Contents{$key} \$/s)
		{
		  print("  Found keyword $key.\n");
		}
	    }
	  close(InFileHandle);
	  if(open(OutFileHandle, ">".$file))
	    {
	      print(OutFileHandle $text);
	    } else {
	      print("  Cannot write $file: permission denied.");
	    }
	} else {
	  print("  File $file does not exist.\n");
	}
    print("Done processing $file.\n");
  }

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic