| %%{ |
| /* this template is used to generate a copyright footer for a variety |
| * of files. |
| * |
| * usage: xdc.genFile(tplt, null, [src, dst, base]), |
| * |
| * where [src, dst, base] is an optional array of file names that identify |
| * the source, destination and basename of the file that is to receive the |
| * copyright notice. |
| */ |
| var PRODUCT = Manifest.packageName; |
| var COMPANY_NAME = "Texas Instruments Incorporated"; |
| var BeginComment = "%%{"; |
| var EndComment = "%%}"; |
| |
| var base = xdc.getPackageBase(Manifest.packageName); |
| base = base.substr(0, base.length - (Manifest.packageName.length + 1)); |
| |
| var VERSION = Manifest.compatibilityKey; |
| if (VERSION == "") { |
| VERSION = "1,0,0"; |
| } |
| VERSION += "," + Manifest.buildCount; |
| |
| var Today = new Date(); |
| var DATE = (Today.getUTCMonth() + 1) |
| + "-" + Today.getUTCDate() |
| + "-" + Today.getFullYear(); |
| |
| var CPYYEAR = Today.getFullYear(); |
| |
| var hour = new String(); |
| hour= String(Today.getHours()); |
| //print("hour len is"+hour.length); |
| if (hour.length < 2) { |
| hour = "0" + hour; |
| } |
| |
| var minute = new String(); |
| minute = String(Today.getMinutes()); |
| if (minute.length < 2) { |
| minute = "0" + minute; |
| } |
| var second = new String(); |
| second = String(Today.getSeconds()); |
| if (second.length<2) { |
| second = "0" + second; |
| } |
| var TIME = hour + ":" + minute + ":" + second; |
| |
| /* compute file type from source file extension */ |
| var fileType = ".c"; |
| if ($args != null && $args.length > 0) { |
| //print("args[0]="+$args[0]); |
| //var ext = $args[0].match(/\.[^\.]{1,}$/); |
| var fn = new java.io.File($args[0]); |
| |
| //print("fn.getName() "+fn.getName()); |
| |
| var ext = fn.getName().match(/\.[^\.]{1,}$/); |
| //print("ext="+ext); |
| //print("ext[0]="+ext[0]); |
| if (ext != null) { |
| fileType = ext[0]; |
| } |
| else { |
| var name = fn.getName(); |
| //print (" name is "+name); |
| if ((name == "makefile") || (name == "Makefile")) { |
| /* special case of makefile, no extension */ |
| fileType = ".makefile"; |
| } |
| } |
| } |
| %%} |
| %if (fileType == ".c" || fileType == ".h" || fileType == ".cpp" |
| % || fileType == ".java" |
| % || fileType == ".tcp" || fileType == ".tci" || fileType == ".js" |
| % || fileType == ".xs" || fileType == ".xdc" || fileType == ".rel" |
| % || fileType == ".bld" || fileType == ".tcf" || fileType == ".cfg") { |
| /* |
| * @(#) `PRODUCT`; `VERSION`; `DATE` `TIME`; `base` |
| */ |
| |
| %} |
| %else if (fileType == ".mak" || fileType == ".pl" || fileType == ".makefile" |
| % || fileType == ".ksh" || fileType == ".sh") { |
| # |
| # @(#) `PRODUCT`; `VERSION`; `DATE` `TIME`; `base` |
| # |
| |
| %} |
| %else if (fileType[1] == "s" || fileType == ".asm") { |
| ; |
| ; @(#) `PRODUCT`; `VERSION`; `DATE` `TIME`; `base` |
| ; |
| |
| %} |
| %else if (fileType == ".xdt") { |
| `BeginComment` |
| /* |
| * @(#) `PRODUCT`; `VERSION`; `DATE` `TIME`; `base` |
| */ |
| |
| `EndComment` |
| % /* DO NOT ADD white space after EndComment because this adds content to |
| % * template file that shows up in the file file generated by the template! |
| % */ |
| %} |
| %else if (fileType == ".dtd" || fileType == ".xml" |
| % || fileType == ".htm" || fileType == ".html") { |
| <!-- |
| /* |
| * @(#) `PRODUCT`; `VERSION`; `DATE` `TIME`; `base` |
| */ |
| --> |
| |
| %} |
| %else { |
| % throw new Error("can't create copyright notice: unsupported file type"); |
| %} |