2 <html lang="en-us" itemscope itemtype="http://schema.org/Article">
5 <meta name="description" content=" Still unable to build 3.2.2/5.0.0 natively Worked on improving algorithm for copyright replacement...">
6 <meta name="generator" content="Movable Type 5.2.3">
7 <title>Improving fix_copyright.pl - Status</title>
8 <link rel="alternate" type="application/atom+xml" title="Recent Entries" href="http://defaria.com/blogs/Status/atom.xml">
9 <link rel="canonical" href="http://defaria.com/blogs/Status/2004/12/improving-fix-c.html">
10 <meta name="viewport" content="width=device-width,initial-scale=1">
11 <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles.css">
13 <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles_ie.css">
14 <script src="/mt/mt-static/support/theme_static/rainier/js/html5shiv.js"></script>
17 <link rel="start" href="http://defaria.com/blogs/Status/">
19 <link rel="prev" href="http://defaria.com/blogs/Status/2004/12/los178-build500.html" title="LOS178 Build/5.0.0 native toolchain build">
20 <link rel="next" href="http://defaria.com/blogs/Status/2004/12/fixing-fix-copy.html" title="Fixing fix_copyright.pl">
21 <!-- Open Graph Protocol -->
22 <meta property="og:type" content="article">
23 <meta property="og:locale" content="en-us">
24 <meta property="og:title" content="Improving fix_copyright.pl">
25 <meta property="og:url" content="http://defaria.com/blogs/Status/2004/12/improving-fix-c.html">
26 <meta property="og:description" content=" Still unable to build 3.2.2/5.0.0 natively Worked on improving algorithm for copyright replacement...">
27 <meta property="og:site_name" content="Status">
28 <meta property="og:image" content="/mt/mt-static/support/theme_static/rainier/img/siteicon-sample.png">
30 <meta itemprop="description" content=" Still unable to build 3.2.2/5.0.0 natively Worked on improving algorithm for copyright replacement...">
31 <link itemprop="url" href="http://defaria.com/blogs/Status/2004/12/improving-fix-c.html">
32 <link itemprop="image" href="/mt/mt-static/support/theme_static/rainier/img/siteicon-sample.png">
37 <div id="container-inner">
38 <header id="header" role="banner">
39 <div id="header-inner">
40 <div id="header-content">
42 <a href="http://defaria.com/blogs/Status/">
51 <nav role="navigation">
53 <li><a href="http://defaria.com/blogs/Status/">Home</a></li>
62 <div id="content-inner">
63 <ul class="breadcrumb breadcrumb-list">
64 <li class="breadcrumb-list-item"><a href="http://defaria.com/blogs/Status/">Home</a></li>
65 <li class="breadcrumb-list-item">Improving fix_copyright.pl</li>
67 <div id="individual-main" class="main" role="main">
68 <article id="entry-1535" class="entry entry-asset asset hentry">
69 <div class="asset-header">
70 <h2 itemprop="name" class="asset-name entry-title">Improving fix_copyright.pl</h2>
71 <footer class="asset-meta">
72 <ul class="asset-meta-list">
73 <li class="asset-meta-list-item">Posted on <time datetime="2004-12-20T17:55:11-08:00" itemprop="datePublished">December 20, 2004</time></li>
74 <li class="asset-meta-list-item">by <span class="author entry-author vcard"></span></li>
77 <li class="asset-meta-list-item">in <a itemprop="articleSection" rel="tag" href="http://defaria.com/blogs/Status/lynuxworks/">LynuxWorks</a></li>
83 <div class="entry-content asset-content" itemprop="articleBody">
86 <li>Still unable to build 3.2.2/5.0.0 natively</li>
88 <li>Worked on improving algorithm for copyright replacement</li>
91 <p>I'm finding it very difficult to develop a hueristic algorithm to find what I call "LynuxWorks copyright blocks" in existing source files. The problem is that the input data is not necessarily consistant. Sure we can go for the 80% fix and hand fix the rest (in fact, that's what I did before) however those 20% often cause compiler errors during the build. What's potential worse is that it is possible that some files will be altered in such a way as to not produce a compiler error but rather to change behavior of the resulting code.</p>
93 <p>My current algorithm attempts to do the following:</p>
96 <li>Locate the start of a C comment (i.e. "/*"). This comment must be at the beginning of the line (for now I am not considering inline comments as the chances of these containing a bona fide copyright statement is unlikely).</il>
98 <li>Scan until the enclosing end comment (i.e. "*/"). Again this must appear at the end of a line ($).</li>
100 <li>Take those lines and examine them for the works "(C) Copyright" and "LynuxWorks" (additionally I found some files that had "LynuxWork,").</li>
102 <li>If found then the comment block it throw out (to be replaced by the new, more consistent copyright block.</li>
106 <p>Currently the "official" copyright block is of the form:</p>
111 *************************************************************
118 $Revision: $Revision$
120 ************************************************************/
124 <p>The "$copy" is replaced by the copyright date found in the file. Dates of the form <year> are changed to <year>-<current year> (unless <year> == <current year>. Dates of the form <year1>, <year2>, <year3> are changed to <year1>-<curernt year>. In order to make finding such copyright information eaiser in the future I would suggest changing the above format to:</p>
128 /* Start Copyright ******************************************
130 (C) Copyright $copy LynuxWorks, Inc.
135 $Revision: $Revision$
137 * End Copyright *********************************************/
141 <p>This would 1) retain the "vi: ts=4 sw=4" annotation that I assume is for vi users, 2) group both the copyright string ("(C) Copyright") along with the company name of LynuxWorks on the same line. This makes it easier to grep for in the future considering some files have Rockwell copyrights. 3) Clearly delineates the start and stop of the copyright block.</p>
143 <p>The problems that I'm having is that I'm seeing copyright blocks of the following forms:</p>
146 <pre> /************************************************************
147 (C) Copyright 1987-2000
148 Lynx Real-Time Systems, Inc.
152 $Date: 2003/11/14 22:44:44 $
154 ************************************************************/
158 <p>(Does not contain LynuxWorks, rather Lynx Real-Time Systems)</p>
164 ***********************************************************************
168 ***********************************************************************
172 * INFORMATION SUBJECT TO EXPORT CONTROL LAWS
174 * Subject to local country rules and laws when applicable, you
175 * must comply with the following:
177 * These commodities, technology, or software were exported from
178 * the United States in accordance with the Export Administration
179 * Regulations. Diversion contrary to U. S. law and other relevant
180 * export controls is prohibited. They may not be re-exported to
181 * any of the following destinations without authorization; Cuba,
182 * Iran, Iraq, Libya, North Korea, Sudan or any other country to
183 * which shipment is prohibited; nor to end-use(r)s involved in
184 * chemical, biological, nuclear, or missile weapons activity.
187 * (C) Copyright 2001 Rockwell Collins, Inc. All rights reserved.
193 * utility to display disk usage
197 * ABBREVIATIONS/ACRONYMS:
199 *****************************************************************
202 /************************************************************
203 (C) Copyright 1987-1996
204 Lynx Real-Time Systems, Inc.
208 $Date: 2003/09/10 15:24:57 $
210 ************************************************************/
214 <p>Contains multiple "(C) Copyright" strings, one being ours and the other being Rockwell's. Should both exist in the resultant file?</p>
220 **********************************************************************
226 * Performs the integrity check of the program and data files
227 * in the CPR read only file system.
229 * ABBREVIATIONS/ACRONYMS: (optional)
234 * (C) Copyright 2001-2002 Rockwell Collins, Inc. All rights reserved.
235 * Proprietary and confidential material. Distribution,
236 * use, and disclosure restricted by Rockwell Collins, Inc.
237 * Copyright (c) 2003-2004, LynuxWorks, Inc. All Rights Reserved.
239 ***********************************************************************
245 <p>Contains multiple "(C) Copyright" strings, one being ours and the other being Rockwells, in the same comment block! Also notice the inconsistant form of one bying "(C) Copyright" while the other being "Copyright (C)". How should this case be handled?</p>
247 <nav class="page-navigation entry-navigation pagination content-nav">
248 <ul class="page-navigation-list">
250 <li class="page-navigation-list-item page-navigation-prev"><a rel="prev" href="http://defaria.com/blogs/Status/2004/12/los178-build500.html" title="LOS178 Build/5.0.0 native toolchain build">Previous entry</a></li>
253 <li class="page-navigation-list-item page-navigation-next"><a rel="next" href="http://defaria.com/blogs/Status/2004/12/fixing-fix-copy.html" title="Fixing fix_copyright.pl">Next entry</a></li>
258 <aside id="zenback" class="zenback feedback">
259 Please paste Zenback script code here.
266 <aside class="widgets related" role="complementary">
267 <nav class="widget-search widget">
268 <div class="widget-content">
269 <form method="get" id="search" action="http://defaria.com/mt/mt-search.cgi">
271 <input type="text" name="search" value="" placeholder="Search...">
273 <input type="hidden" name="IncludeBlogs" value="8">
275 <input type="hidden" name="limit" value="20">
276 <button type="submit" name="button">
277 <img alt="Search" src="/mt/mt-static/support/theme_static/rainier/img/search-icon.png">
283 <nav class="widget-archive-category widget">
284 <h3 class="widget-header">Categories</h3>
285 <div class="widget-content">
288 <ul class="widget-list">
291 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/ameriquest/">Ameriquest (99)</a>
299 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/audience/">Audience (3)</a>
307 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/broadcom/">Broadcom (76)</a>
315 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/gpdb/">GPDB (35)</a>
323 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/general-dynamics/">General Dynamics (61)</a>
331 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/general-electric/">General Electric (13)</a>
339 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/hewlett-packard/">Hewlett Packard (13)</a>
347 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/lynuxworks/">LynuxWorks (162)</a>
355 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/pqa/">PQA (35)</a>
363 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/salira/">Salira (79)</a>
371 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/tellabs/">Tellabs (2)</a>
379 <li class="widget-list-item"><a href="http://defaria.com/blogs/Status/texas-instruments/">Texas Instruments (31)</a>
391 <nav class="widget-archive-dropdown widget">
392 <h3 class="widget-header">Archives</h3>
393 <div class="widget-content">
395 <option>Select a Month...</option>
397 <option value="http://defaria.com/blogs/Status/2016/02/">February 2016</option>
401 <option value="http://defaria.com/blogs/Status/2014/09/">September 2014</option>
405 <option value="http://defaria.com/blogs/Status/2014/04/">April 2014</option>
409 <option value="http://defaria.com/blogs/Status/2014/03/">March 2014</option>
413 <option value="http://defaria.com/blogs/Status/2013/02/">February 2013</option>
417 <option value="http://defaria.com/blogs/Status/2012/09/">September 2012</option>
421 <option value="http://defaria.com/blogs/Status/2012/08/">August 2012</option>
425 <option value="http://defaria.com/blogs/Status/2012/05/">May 2012</option>
429 <option value="http://defaria.com/blogs/Status/2012/04/">April 2012</option>
433 <option value="http://defaria.com/blogs/Status/2012/02/">February 2012</option>
437 <option value="http://defaria.com/blogs/Status/2012/01/">January 2012</option>
441 <option value="http://defaria.com/blogs/Status/2011/10/">October 2011</option>
445 <option value="http://defaria.com/blogs/Status/2011/07/">July 2011</option>
449 <option value="http://defaria.com/blogs/Status/2010/09/">September 2010</option>
453 <option value="http://defaria.com/blogs/Status/2010/08/">August 2010</option>
457 <option value="http://defaria.com/blogs/Status/2010/04/">April 2010</option>
461 <option value="http://defaria.com/blogs/Status/2010/03/">March 2010</option>
465 <option value="http://defaria.com/blogs/Status/2010/02/">February 2010</option>
469 <option value="http://defaria.com/blogs/Status/2009/05/">May 2009</option>
473 <option value="http://defaria.com/blogs/Status/2009/04/">April 2009</option>
477 <option value="http://defaria.com/blogs/Status/2008/07/">July 2008</option>
481 <option value="http://defaria.com/blogs/Status/2008/05/">May 2008</option>
485 <option value="http://defaria.com/blogs/Status/2008/04/">April 2008</option>
489 <option value="http://defaria.com/blogs/Status/2008/03/">March 2008</option>
493 <option value="http://defaria.com/blogs/Status/2008/02/">February 2008</option>
497 <option value="http://defaria.com/blogs/Status/2008/01/">January 2008</option>
501 <option value="http://defaria.com/blogs/Status/2007/12/">December 2007</option>
505 <option value="http://defaria.com/blogs/Status/2007/11/">November 2007</option>
509 <option value="http://defaria.com/blogs/Status/2007/10/">October 2007</option>
513 <option value="http://defaria.com/blogs/Status/2007/09/">September 2007</option>
517 <option value="http://defaria.com/blogs/Status/2007/08/">August 2007</option>
521 <option value="http://defaria.com/blogs/Status/2007/07/">July 2007</option>
525 <option value="http://defaria.com/blogs/Status/2007/06/">June 2007</option>
529 <option value="http://defaria.com/blogs/Status/2007/05/">May 2007</option>
533 <option value="http://defaria.com/blogs/Status/2007/04/">April 2007</option>
537 <option value="http://defaria.com/blogs/Status/2007/03/">March 2007</option>
541 <option value="http://defaria.com/blogs/Status/2007/01/">January 2007</option>
545 <option value="http://defaria.com/blogs/Status/2006/12/">December 2006</option>
549 <option value="http://defaria.com/blogs/Status/2006/11/">November 2006</option>
553 <option value="http://defaria.com/blogs/Status/2006/10/">October 2006</option>
557 <option value="http://defaria.com/blogs/Status/2006/09/">September 2006</option>
561 <option value="http://defaria.com/blogs/Status/2006/07/">July 2006</option>
565 <option value="http://defaria.com/blogs/Status/2006/06/">June 2006</option>
569 <option value="http://defaria.com/blogs/Status/2006/05/">May 2006</option>
573 <option value="http://defaria.com/blogs/Status/2006/04/">April 2006</option>
577 <option value="http://defaria.com/blogs/Status/2006/03/">March 2006</option>
581 <option value="http://defaria.com/blogs/Status/2006/02/">February 2006</option>
585 <option value="http://defaria.com/blogs/Status/2006/01/">January 2006</option>
589 <option value="http://defaria.com/blogs/Status/2005/12/">December 2005</option>
593 <option value="http://defaria.com/blogs/Status/2005/11/">November 2005</option>
597 <option value="http://defaria.com/blogs/Status/2005/10/">October 2005</option>
601 <option value="http://defaria.com/blogs/Status/2005/09/">September 2005</option>
605 <option value="http://defaria.com/blogs/Status/2005/08/">August 2005</option>
609 <option value="http://defaria.com/blogs/Status/2005/07/">July 2005</option>
613 <option value="http://defaria.com/blogs/Status/2005/06/">June 2005</option>
617 <option value="http://defaria.com/blogs/Status/2005/05/">May 2005</option>
621 <option value="http://defaria.com/blogs/Status/2005/04/">April 2005</option>
625 <option value="http://defaria.com/blogs/Status/2005/03/">March 2005</option>
629 <option value="http://defaria.com/blogs/Status/2005/02/">February 2005</option>
633 <option value="http://defaria.com/blogs/Status/2005/01/">January 2005</option>
637 <option value="http://defaria.com/blogs/Status/2004/12/">December 2004</option>
641 <option value="http://defaria.com/blogs/Status/2004/09/">September 2004</option>
645 <option value="http://defaria.com/blogs/Status/2004/08/">August 2004</option>
649 <option value="http://defaria.com/blogs/Status/2004/07/">July 2004</option>
653 <option value="http://defaria.com/blogs/Status/2004/06/">June 2004</option>
657 <option value="http://defaria.com/blogs/Status/2004/05/">May 2004</option>
661 <option value="http://defaria.com/blogs/Status/2004/04/">April 2004</option>
665 <option value="http://defaria.com/blogs/Status/2004/03/">March 2004</option>
669 <option value="http://defaria.com/blogs/Status/2004/02/">February 2004</option>
673 <option value="http://defaria.com/blogs/Status/2004/01/">January 2004</option>
677 <option value="http://defaria.com/blogs/Status/2003/12/">December 2003</option>
681 <option value="http://defaria.com/blogs/Status/2003/11/">November 2003</option>
689 <div class="widget-syndication widget section">
690 <div class="widget-content">
691 <p><img src="http://defaria.com/mt/mt-static/images/status_icons/feed.gif" alt="Subscribe to feed" width="9" height="9" /> <a href="http://defaria.com/blogs/Status/atom.xml">Subscribe to this blog's feed</a></p>
699 <footer id="footer" role="contentinfo">
700 <div id="footer-inner">
701 <div id="footer-content">
702 <nav role="navigation">
704 <li><a href="http://defaria.com/blogs/Status/">Home</a></li>
710 <p class="license">© Copyright 2016.</p>
711 <p class="poweredby">Powered by <a href="http://www.movabletype.org/">Movable Type</a></p>
717 <script src="http://defaria.com/mt/mt-static/jquery/jquery.min.js"></script>
718 <script src="http://defaria.com/blogs/Status/mt-theme-scale2.js"></script>