SciCodePile/SciCode-Domain-Code
DATA1: Domain-Specific Code Dataset Dataset Overview DATA1 is a large-scale domain-specific code dataset focusing on code samples from interdisciplinary fields such as biology, chemistry, materials science, and related areas. The dataset is collected and organized from GitHub repositories, covering 178 different domain topics with over 1.1 billion lines of code. Dataset Statistics Total Datasets: 178 CSV files Total Data Size: ~115 GB Total Lines… See the full description on the dataset page: https://huggingface.co/datasets/SciCodePile/SciCode-Domain-Code.
42.4k
1"keyword","repo_name","file_path","file_extension","file_size","line_count","content","language"
2"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java",".java","2858","73","/*3 Launch4j (http://launch4j.sourceforge.net/)4 Cross-platform Java application wrapper for creating Windows native executables.5 6 Copyright (c) 2004, 2007 Grzegorz Kowal7 8 All rights reserved.9 10 Redistribution and use in source and binary forms, with or without modification,11 are permitted provided that the following conditions are met:12 13 * Redistributions of source code must retain the above copyright notice,14 this list of conditions and the following disclaimer.15 * Redistributions in binary form must reproduce the above copyright notice,16 this list of conditions and the following disclaimer in the documentation17 and/or other materials provided with the distribution.18 * Neither the name of the Launch4j nor the names of its contributors19 may be used to endorse or promote products derived from this software without20 specific prior written permission.21 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS23 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF30 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING31 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.33*/34 35package net.sf.launch4j.example;36 37import java.io.BufferedReader;38import java.io.IOException;39import java.io.InputStreamReader;40 41/**42 * @author Copyright (C) 2005 Grzegorz Kowal43 */44public class ConsoleApp {45 public static void main(String[] args) {46 StringBuffer sb = new StringBuffer(""Hello World!\n\nJava version: "");47 sb.append(System.getProperty(""java.version""));48 sb.append(""\nJava home: "");49 sb.append(System.getProperty(""java.home""));50 sb.append(""\nCurrent dir: "");51 sb.append(System.getProperty(""user.dir""));52 if (args.length > 0) {53 sb.append(""\nArgs: "");54 for (int i = 0; i < args.length; i++) {55 sb.append(args[i]);56 sb.append(' ');57 }58 }59 sb.append(""\n\nEnter a line of text, Ctrl-C to stop.\n\n>"");60 System.out.print(sb.toString());61 try {62 BufferedReader is = new BufferedReader(new InputStreamReader(System.in));63 String line;64 while ((line = is.readLine()) != null && !line.equalsIgnoreCase(""quit"")) {65 System.out.print(""You wrote: "" + line + ""\n\n>"");66 }67 is.close();68 System.exit(123);69 } catch (IOException e) {70 System.err.print(e);71 }72 }73}74","Java"
75"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java",".java","3743","105","/*76 Launch4j (http://launch4j.sourceforge.net/)77 Cross-platform Java application wrapper for creating Windows native executables.78 79 Copyright (c) 2004, 2007 Grzegorz Kowal80 81 All rights reserved.82 83 Redistribution and use in source and binary forms, with or without modification,84 are permitted provided that the following conditions are met:85 86 * Redistributions of source code must retain the above copyright notice,87 this list of conditions and the following disclaimer.88 * Redistributions in binary form must reproduce the above copyright notice,89 this list of conditions and the following disclaimer in the documentation90 and/or other materials provided with the distribution.91 * Neither the name of the Launch4j nor the names of its contributors92 may be used to endorse or promote products derived from this software without93 specific prior written permission.94 95 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS96 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT97 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR98 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR99 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,100 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,101 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR102 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF103 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING104 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS105 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.106*/107 108package net.sf.launch4j.example;109 110import java.awt.Dimension;111import java.awt.Toolkit;112import java.awt.event.WindowAdapter;113import java.awt.event.WindowEvent;114 115import javax.swing.JFrame;116import javax.swing.JMenu;117import javax.swing.JMenuBar;118import javax.swing.JMenuItem;119import javax.swing.JOptionPane;120import javax.swing.UIManager;121 122public class SimpleApp extends JFrame {123 public SimpleApp(String[] args) {124 super(""Java Application"");125 final int inset = 100;126 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();127 setBounds (inset, inset,128 screenSize.width - inset * 2, screenSize.height - inset * 2);129 130 JMenu menu = new JMenu(""File"");131 menu.add(new JMenuItem(""Open""));132 menu.add(new JMenuItem(""Save""));133 JMenuBar mb = new JMenuBar();134 mb.setOpaque(true);135 mb.add(menu);136 setJMenuBar(mb);137 138 this.addWindowListener(new WindowAdapter() {139 public void windowClosing(WindowEvent e) {140 System.exit(123);141 }});142 setVisible(true);143 144 StringBuffer sb = new StringBuffer(""Java version: "");145 sb.append(System.getProperty(""java.version""));146 sb.append(""\nJava home: "");147 sb.append(System.getProperty(""java.home""));148 sb.append(""\nCurrent dir: "");149 sb.append(System.getProperty(""user.dir""));150 if (args.length > 0) {151 sb.append(""\nArgs: "");152 for (int i = 0; i < args.length; i++) {153 sb.append(args[i]);154 sb.append(' ');155 }156 }157 JOptionPane.showMessageDialog(this,158 sb.toString(),159 ""Info"",160 JOptionPane.INFORMATION_MESSAGE);161 }162 163 public static void setLAF() {164 JFrame.setDefaultLookAndFeelDecorated(true);165 Toolkit.getDefaultToolkit().setDynamicLayout(true);166 System.setProperty(""sun.awt.noerasebackground"",""true"");167 try {168 UIManager.setLookAndFeel(""com.sun.java.swing.plaf.windows.WindowsLookAndFeel"");169 } catch (Exception e) {170 System.err.println(""Failed to set LookAndFeel"");171 }172 }173 174 public static void main(String[] args) {175 setLAF();176 new SimpleApp(args);177 }178}179","Java"
180"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/Main.java",".java","3605","100","/*181 Launch4j (http://launch4j.sourceforge.net/)182 Cross-platform Java application wrapper for creating Windows native executables.183 184 Copyright (c) 2004, 2008 Grzegorz Kowal185 186 All rights reserved.187 188 Redistribution and use in source and binary forms, with or without modification,189 are permitted provided that the following conditions are met:190 191 * Redistributions of source code must retain the above copyright notice,192 this list of conditions and the following disclaimer.193 * Redistributions in binary form must reproduce the above copyright notice,194 this list of conditions and the following disclaimer in the documentation195 and/or other materials provided with the distribution.196 * Neither the name of the Launch4j nor the names of its contributors197 may be used to endorse or promote products derived from this software without198 specific prior written permission.199 200 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS201 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT202 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR203 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR204 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,205 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,206 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR207 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF208 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING209 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS210 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.211*/212 213/*214 * Created on Apr 21, 2005215 */216package net.sf.launch4j;217 218import java.io.File;219import java.io.InputStream;220import java.util.Properties;221 222import net.sf.launch4j.config.ConfigPersister;223import net.sf.launch4j.formimpl.MainFrame;224 225/**226 * @author Copyright (C) 2005 Grzegorz Kowal227 */228public class Main {229 private static String _name; 230 private static String _description;231 232 public static void main(String[] args) {233 try {234 Properties props = new Properties();235 InputStream in = Main.class.getClassLoader()236 .getResourceAsStream(""launch4j.properties"");237 props.load(in);238 in.close();239 setDescription(props);240 241 if (args.length == 0) {242 ConfigPersister.getInstance().createBlank();243 MainFrame.createInstance();244 } else if (args.length == 1 && !args[0].startsWith(""-"")) {245 ConfigPersister.getInstance().load(new File(args[0]));246 Builder b = new Builder(Log.getConsoleLog());247 b.build();248 } else {249 System.out.println(_description250 + Messages.getString(""Main.usage"")251 + "": launch4j config.xml"");252 }253 } catch (Exception e) {254 Log.getConsoleLog().append(e.getMessage());255 } 256 }257 258 public static String getName() {259 return _name;260 }261 262 public static String getDescription() {263 return _description;264 }265 266 private static void setDescription(Properties props) {267 _name = ""Launch4j "" + props.getProperty(""version""); 268 _description = _name + 269 "" (http://launch4j.sourceforge.net/)\n"" +270 ""Cross-platform Java application wrapper"" +271 "" for creating Windows native executables.\n\n"" +272 ""Copyright (C) 2004, 2008 Grzegorz Kowal\n\n"" +273 ""Launch4j comes with ABSOLUTELY NO WARRANTY.\n"" +274 ""This is free software, licensed under the BSD License.\n"" +275 ""This product includes software developed by the Apache Software Foundation"" +276 "" (http://www.apache.org/)."";277 }278}279","Java"
280"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/FileChooserFilter.java",".java","2639","77","/*281 Launch4j (http://launch4j.sourceforge.net/)282 Cross-platform Java application wrapper for creating Windows native executables.283 284 Copyright (c) 2004, 2007 Grzegorz Kowal285 286 All rights reserved.287 288 Redistribution and use in source and binary forms, with or without modification,289 are permitted provided that the following conditions are met:290 291 * Redistributions of source code must retain the above copyright notice,292 this list of conditions and the following disclaimer.293 * Redistributions in binary form must reproduce the above copyright notice,294 this list of conditions and the following disclaimer in the documentation295 and/or other materials provided with the distribution.296 * Neither the name of the Launch4j nor the names of its contributors297 may be used to endorse or promote products derived from this software without298 specific prior written permission.299 300 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS301 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT302 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR303 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR304 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,305 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,306 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR307 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF308 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING309 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS310 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.311*/312 313/*314 * Created on 2004-01-15315 */316package net.sf.launch4j;317 318import java.io.File;319 320import javax.swing.filechooser.FileFilter;321 322/**323 * @author Copyright (C) 2004 Grzegorz Kowal324 */325public class FileChooserFilter extends FileFilter {326 String _description;327 String[] _extensions;328 329 public FileChooserFilter(String description, String extension) {330 _description = description;331 _extensions = new String[] {extension};332 }333 334 public FileChooserFilter(String description, String[] extensions) {335 _description = description;336 _extensions = extensions;337 }338 339 public boolean accept(File f) {340 if (f.isDirectory()) {341 return true;342 }343 String ext = Util.getExtension(f);344 for (int i = 0; i < _extensions.length; i++) {345 if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) {346 return true;347 }348 }349 return false;350 }351 352 public String getDescription() {353 return _description;354 }355}356","Java"
357"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/Builder.java",".java","6332","208","/*358 Launch4j (http://launch4j.sourceforge.net/)359 Cross-platform Java application wrapper for creating Windows native executables.360 361 Copyright (c) 2004, 2007 Grzegorz Kowal362 363 All rights reserved.364 365 Redistribution and use in source and binary forms, with or without modification,366 are permitted provided that the following conditions are met:367 368 * Redistributions of source code must retain the above copyright notice,369 this list of conditions and the following disclaimer.370 * Redistributions in binary form must reproduce the above copyright notice,371 this list of conditions and the following disclaimer in the documentation372 and/or other materials provided with the distribution.373 * Neither the name of the Launch4j nor the names of its contributors374 may be used to endorse or promote products derived from this software without375 specific prior written permission.376 377 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS378 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT379 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR380 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR381 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,382 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,383 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR384 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF385 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING386 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS387 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.388*/389 390/*391 * Created on 2005-04-24392 */393package net.sf.launch4j;394 395import java.io.File;396import java.io.FileInputStream;397import java.io.FileOutputStream;398import java.io.IOException;399import java.util.ArrayList;400import java.util.Iterator;401import java.util.List;402import java.util.StringTokenizer;403 404import net.sf.launch4j.binding.InvariantViolationException;405import net.sf.launch4j.config.Config;406import net.sf.launch4j.config.ConfigPersister;407 408/**409 * @author Copyright (C) 2005 Grzegorz Kowal410 */411public class Builder {412 private final Log _log;413 private final File _basedir;414 415 public Builder(Log log) {416 _log = log;417 _basedir = Util.getJarBasedir();418 }419 420 public Builder(Log log, File basedir) {421 _log = log;422 _basedir = basedir;423 }424 425 /**426 * @return Output file path.427 */428 public File build() throws BuilderException {429 final Config c = ConfigPersister.getInstance().getConfig();430 try {431 c.validate();432 } catch (InvariantViolationException e) {433 throw new BuilderException(e.getMessage());434 }435 File rc = null;436 File ro = null;437 File outfile = null;438 FileInputStream is = null;439 FileOutputStream os = null;440 final RcBuilder rcb = new RcBuilder();441 try {442 rc = rcb.build(c);443 ro = Util.createTempFile(""o"");444 outfile = ConfigPersister.getInstance().getOutputFile();445 446 Cmd resCmd = new Cmd(_basedir);447 resCmd.addExe(""windres"")448 .add(Util.WINDOWS_OS ? ""--preprocessor=type"" : ""--preprocessor=cat"")449 .add(""-J rc -O coff -F pe-i386"")450 .addAbsFile(rc)451 .addAbsFile(ro);452 _log.append(Messages.getString(""Builder.compiling.resources""));453 resCmd.exec(_log);454 455 Cmd ldCmd = new Cmd(_basedir);456 ldCmd.addExe(""ld"")457 .add(""-mi386pe"")458 .add(""--oformat pei-i386"")459 .add((c.getHeaderType().equals(Config.GUI_HEADER))460 ? ""--subsystem windows"" : ""--subsystem console"")461 .add(""-s"") // strip symbols462 .addFiles(c.getHeaderObjects())463 .addAbsFile(ro)464 .addFiles(c.getLibs())465 .add(""-o"")466 .addAbsFile(outfile);467 _log.append(Messages.getString(""Builder.linking""));468 ldCmd.exec(_log);469 470 if (!c.isDontWrapJar()) {471 _log.append(Messages.getString(""Builder.wrapping""));472 int len;473 byte[] buffer = new byte[1024];474 is = new FileInputStream(Util.getAbsoluteFile(475 ConfigPersister.getInstance().getConfigPath(), c.getJar()));476 os = new FileOutputStream(outfile, true);477 while ((len = is.read(buffer)) > 0) {478 os.write(buffer, 0, len);479 }480 }481 _log.append(Messages.getString(""Builder.success"") + outfile.getPath());482 return outfile;483 } catch (IOException e) {484 Util.delete(outfile);485 _log.append(e.getMessage());486 throw new BuilderException(e);487 } catch (ExecException e) {488 Util.delete(outfile);489 String msg = e.getMessage(); 490 if (msg != null && msg.indexOf(""windres"") != -1) {491 if (e.getErrLine() != -1) {492 _log.append(Messages.getString(""Builder.line.has.errors"",493 String.valueOf(e.getErrLine())));494 _log.append(rcb.getLine(e.getErrLine()));495 } else {496 _log.append(Messages.getString(""Builder.generated.resource.file""));497 _log.append(rcb.getContent());498 }499 }500 throw new BuilderException(e);501 } finally {502 Util.close(is);503 Util.close(os);504 Util.delete(rc);505 Util.delete(ro);506 }507 }508}509 510class Cmd {511 private final List _cmd = new ArrayList();512 private final File _basedir;513 private final File _bindir;514 515 public Cmd(File basedir) {516 _basedir = basedir;517 String path = System.getProperty(""launch4j.bindir"");518 if (path == null) {519 _bindir = new File(basedir, ""bin"");520 } else {521 File bindir = new File(path);522 _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path);523 }524 }525 526 public Cmd add(String s) {527 StringTokenizer st = new StringTokenizer(s);528 while (st.hasMoreTokens()) {529 _cmd.add(st.nextToken());530 }531 return this;532 }533 534 public Cmd addAbsFile(File file) {535 _cmd.add(file.getPath());536 return this;537 }538 539 public Cmd addFile(String pathname) {540 _cmd.add(new File(_basedir, pathname).getPath());541 return this;542 }543 544 public Cmd addExe(String pathname) {545 if (Util.WINDOWS_OS) {546 pathname += "".exe"";547 }548 _cmd.add(new File(_bindir, pathname).getPath());549 return this;550 }551 552 public Cmd addFiles(List files) {553 for (Iterator iter = files.iterator(); iter.hasNext();) {554 addFile((String) iter.next());555 }556 return this;557 }558 559 public void exec(Log log) throws ExecException {560 String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]);561 Util.exec(cmd, log);562 }563}564","Java"
565"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/OptionParser.java",".java","2772","72","/*566 Launch4j (http://launch4j.sourceforge.net/)567 Cross-platform Java application wrapper for creating Windows native executables.568 569 Copyright (c) 2004, 2007 Grzegorz Kowal570 571 All rights reserved.572 573 Redistribution and use in source and binary forms, with or without modification,574 are permitted provided that the following conditions are met:575 576 * Redistributions of source code must retain the above copyright notice,577 this list of conditions and the following disclaimer.578 * Redistributions in binary form must reproduce the above copyright notice,579 this list of conditions and the following disclaimer in the documentation580 and/or other materials provided with the distribution.581 * Neither the name of the Launch4j nor the names of its contributors582 may be used to endorse or promote products derived from this software without583 specific prior written permission.584 585 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS586 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT587 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR588 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR589 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,590 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,591 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR592 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF593 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING594 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS595 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.596*/597 598/*599 * Created on 2005-04-24600 */601package net.sf.launch4j;602 603//import net.sf.launch4j.config.Config;604 605//import org.apache.commons.cli.CommandLine;606//import org.apache.commons.cli.CommandLineParser;607//import org.apache.commons.cli.HelpFormatter;608//import org.apache.commons.cli.Options;609//import org.apache.commons.cli.ParseException;610//import org.apache.commons.cli.PosixParser;611 612/**613 * @author Copyright (C) 2005 Grzegorz Kowal614 */615public class OptionParser {616 617// private final Options _options;618//619// public OptionParser() {620// _options = new Options();621// _options.addOption(""h"", ""header"", true, ""header"");622// }623//624// public Config parse(Config c, String[] args) throws ParseException {625// CommandLineParser parser = new PosixParser();626// CommandLine cl = parser.parse(_options, args);627// c.setJar(getFile(props, Config.JAR));628// c.setOutfile(getFile(props, Config.OUTFILE));629// }630//631// public void printHelp() {632// HelpFormatter formatter = new HelpFormatter();633// formatter.printHelp(""launch4j"", _options);634// }635}636","Java"
637"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/Messages.java",".java","2978","79","/*638 Launch4j (http://launch4j.sourceforge.net/)639 Cross-platform Java application wrapper for creating Windows native executables.640 641 Copyright (c) 2004, 2007 Grzegorz Kowal642 643 All rights reserved.644 645 Redistribution and use in source and binary forms, with or without modification,646 are permitted provided that the following conditions are met:647 648 * Redistributions of source code must retain the above copyright notice,649 this list of conditions and the following disclaimer.650 * Redistributions in binary form must reproduce the above copyright notice,651 this list of conditions and the following disclaimer in the documentation652 and/or other materials provided with the distribution.653 * Neither the name of the Launch4j nor the names of its contributors654 may be used to endorse or promote products derived from this software without655 specific prior written permission.656 657 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS658 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT659 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR660 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR661 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,662 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,663 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR664 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF665 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING666 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS667 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.668*/669 670package net.sf.launch4j;671 672import java.text.MessageFormat;673import java.util.MissingResourceException;674import java.util.ResourceBundle;675 676public class Messages {677 private static final String BUNDLE_NAME = ""net.sf.launch4j.messages"";678 679 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle680 .getBundle(BUNDLE_NAME);681 private static final MessageFormat FORMATTER = new MessageFormat("""");682 683 private Messages() {684 }685 686 public static String getString(String key) {687 try {688 return RESOURCE_BUNDLE.getString(key);689 } catch (MissingResourceException e) {690 return '!' + key + '!';691 }692 }693 694 public static String getString(String key, String arg0) {695 return getString(key, new Object[] {arg0});696 }697 698 public static String getString(String key, String arg0, String arg1) {699 return getString(key, new Object[] {arg0, arg1});700 }701 702 public static String getString(String key, String arg0, String arg1, String arg2) {703 return getString(key, new Object[] {arg0, arg1, arg2});704 }705 706 public static String getString(String key, Object[] args) {707 try {708 FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key));709 return FORMATTER.format(args);710 } catch (MissingResourceException e) {711 return '!' + key + '!';712 }713 }714}715","Java"
716"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/Util.java",".java","5877","198","/*717 Launch4j (http://launch4j.sourceforge.net/)718 Cross-platform Java application wrapper for creating Windows native executables.719 720 Copyright (c) 2004, 2007 Grzegorz Kowal721 722 All rights reserved.723 724 Redistribution and use in source and binary forms, with or without modification,725 are permitted provided that the following conditions are met:726 727 * Redistributions of source code must retain the above copyright notice,728 this list of conditions and the following disclaimer.729 * Redistributions in binary form must reproduce the above copyright notice,730 this list of conditions and the following disclaimer in the documentation731 and/or other materials provided with the distribution.732 * Neither the name of the Launch4j nor the names of its contributors733 may be used to endorse or promote products derived from this software without734 specific prior written permission.735 736 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS737 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT738 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR739 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR740 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,741 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,742 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR743 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF744 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING745 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS746 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.747*/748 749/*750 * Created on 2005-04-24751 */752package net.sf.launch4j;753 754import java.io.BufferedReader;755import java.io.File;756import java.io.IOException;757import java.io.InputStream;758import java.io.InputStreamReader;759import java.io.OutputStream;760import java.io.Reader;761import java.io.Writer;762import java.util.regex.Matcher;763import java.util.regex.Pattern;764 765/**766 * @author Copyright (C) 2005 Grzegorz Kowal767 */768public class Util {769 public static final boolean WINDOWS_OS = System.getProperty(""os.name"")770 .toLowerCase().startsWith(""windows"");771 772 private Util() {}773 774 public static File createTempFile(String suffix) throws IOException {775 String tmpdir = System.getProperty(""launch4j.tmpdir"");776 if (tmpdir != null) {777 if (tmpdir.indexOf(' ') != -1) {778 throw new IOException(Messages.getString(""Util.tmpdir""));779 }780 return File.createTempFile(""launch4j"", suffix, new File(tmpdir));781 } else {782 return File.createTempFile(""launch4j"", suffix);783 }784 }785 786 /**787 * Returns the base directory of a jar file or null if the class is a standalone file. 788 * @return System specific path789 * 790 * Based on a patch submitted by Josh Elsasser791 */792 public static File getJarBasedir() {793 String url = Util.class.getClassLoader()794 .getResource(Util.class.getName().replace('.', '/') + "".class"")795 .getFile()796 .replaceAll(""%20"", "" "");797 if (url.startsWith(""file:"")) {798 String jar = url.substring(5, url.lastIndexOf('!'));799 int x = jar.lastIndexOf('/');800 if (x == -1) {801 x = jar.lastIndexOf('\\'); 802 }803 String basedir = jar.substring(0, x + 1);804 return new File(basedir);805 } else {806 return new File(""."");807 }808 }809 810 public static File getAbsoluteFile(File basepath, File f) {811 return f.isAbsolute() ? f : new File(basepath, f.getPath());812 }813 814 public static String getExtension(File f) {815 String name = f.getName();816 int x = name.lastIndexOf('.');817 if (x != -1) {818 return name.substring(x);819 } else {820 return """";821 }822 }823 824 public static void exec(String[] cmd, Log log) throws ExecException {825 BufferedReader is = null;826 try {827 if (WINDOWS_OS) {828 for (int i = 0; i < cmd.length; i++) {829 cmd[i] = cmd[i].replaceAll(""/"", ""\\\\"");830 }831 }832 Process p = Runtime.getRuntime().exec(cmd);833 is = new BufferedReader(new InputStreamReader(p.getErrorStream()));834 String line;835 int errLine = -1;836 Pattern pattern = Pattern.compile("":\\d+:"");837 while ((line = is.readLine()) != null) {838 log.append(line);839 Matcher matcher = pattern.matcher(line);840 if (matcher.find()) {841 errLine = Integer.valueOf(842 line.substring(matcher.start() + 1, matcher.end() - 1))843 .intValue();844 if (line.matches(""(?i).*unrecognized escape sequence"")) {845 log.append(Messages.getString(""Util.use.double.backslash""));846 }847 break;848 }849 }850 is.close();851 p.waitFor();852 if (errLine != -1) {853 throw new ExecException(Messages.getString(""Util.exec.failed"")854 + "": "" + cmd, errLine);855 }856 if (p.exitValue() != 0) {857 throw new ExecException(Messages.getString(""Util.exec.failed"")858 + ""("" + p.exitValue() + ""): "" + cmd);859 }860 } catch (IOException e) {861 close(is);862 throw new ExecException(e);863 } catch (InterruptedException e) {864 close(is);865 throw new ExecException(e);866 }867 }868 869 public static void close(final InputStream o) {870 if (o != null) {871 try {872 o.close();873 } catch (IOException e) {874 System.err.println(e); // XXX log875 }876 }877 }878 879 public static void close(final OutputStream o) {880 if (o != null) {881 try {882 o.close();883 } catch (IOException e) {884 System.err.println(e); // XXX log885 }886 }887 }888 889 public static void close(final Reader o) {890 if (o != null) {891 try {892 o.close();893 } catch (IOException e) {894 System.err.println(e); // XXX log895 }896 }897 }898 899 public static void close(final Writer o) {900 if (o != null) {901 try {902 o.close();903 } catch (IOException e) {904 System.err.println(e); // XXX log905 }906 }907 }908 909 public static boolean delete(File f) {910 return (f != null) ? f.delete() : false;911 }912}913","Java"
914"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/Log.java",".java","3125","106","/*915 Launch4j (http://launch4j.sourceforge.net/)916 Cross-platform Java application wrapper for creating Windows native executables.917 918 Copyright (c) 2004, 2007 Grzegorz Kowal919 920 All rights reserved.921 922 Redistribution and use in source and binary forms, with or without modification,923 are permitted provided that the following conditions are met:924 925 * Redistributions of source code must retain the above copyright notice,926 this list of conditions and the following disclaimer.927 * Redistributions in binary form must reproduce the above copyright notice,928 this list of conditions and the following disclaimer in the documentation929 and/or other materials provided with the distribution.930 * Neither the name of the Launch4j nor the names of its contributors931 may be used to endorse or promote products derived from this software without932 specific prior written permission.933 934 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS935 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT936 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR937 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR938 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,939 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,940 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR941 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF942 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING943 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS944 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.945*/946 947/*948 * Created on May 12, 2005949 */950package net.sf.launch4j;951 952import javax.swing.JTextArea;953import javax.swing.SwingUtilities;954 955/**956 * @author Copyright (C) 2005 Grzegorz Kowal957 */958public abstract class Log {959 private static final Log _consoleLog = new ConsoleLog();960 private static final Log _antLog = new AntLog();961 962 public abstract void clear();963 public abstract void append(String line);964 965 public static Log getConsoleLog() {966 return _consoleLog;967 }968 969 public static Log getAntLog() {970 return _antLog;971 }972 973 public static Log getSwingLog(JTextArea textArea) {974 return new SwingLog(textArea);975 }976}977 978class ConsoleLog extends Log {979 public void clear() {980 System.out.println(""\n"");981 }982 983 public void append(String line) {984 System.out.println(""launch4j: "" + line);985 }986}987 988class AntLog extends Log {989 public void clear() {990 System.out.println(""\n"");991 }992 993 public void append(String line) {994 System.out.println(line);995 }996}997 998class SwingLog extends Log {999 private final JTextArea _textArea;1000 1001 public SwingLog(JTextArea textArea) {1002 _textArea = textArea;1003 }1004 1005 public void clear() {1006 SwingUtilities.invokeLater(new Runnable() {1007 public void run() {1008 _textArea.setText("""");1009 }});1010 }1011 1012 public void append(final String line) {1013 SwingUtilities.invokeLater(new Runnable() {1014 public void run() {1015 _textArea.append(line + ""\n"");1016 }});1017 }1018}1019","Java"
1020"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/BuilderException.java",".java","2038","53","/*1021 Launch4j (http://launch4j.sourceforge.net/)1022 Cross-platform Java application wrapper for creating Windows native executables.1023 1024 Copyright (c) 2004, 2007 Grzegorz Kowal1025 1026 All rights reserved.1027 1028 Redistribution and use in source and binary forms, with or without modification,1029 are permitted provided that the following conditions are met:1030 1031 * Redistributions of source code must retain the above copyright notice,1032 this list of conditions and the following disclaimer.1033 * Redistributions in binary form must reproduce the above copyright notice,1034 this list of conditions and the following disclaimer in the documentation1035 and/or other materials provided with the distribution.1036 * Neither the name of the Launch4j nor the names of its contributors1037 may be used to endorse or promote products derived from this software without1038 specific prior written permission.1039 1040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS1041 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT1042 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR1043 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR1044 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,1045 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,1046 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR1047 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF1048 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING1049 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS1050 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.1051*/1052 1053/*1054 * Created on May 13, 20051055 */1056package net.sf.launch4j;1057 1058/**1059 * @author Copyright (C) 2005 Grzegorz Kowal1060 */1061public class BuilderException extends Exception {1062 public BuilderException() {}1063 1064 public BuilderException(Throwable t) {1065 super(t);1066 }1067 1068 public BuilderException(String msg) {1069 super(msg);1070 }1071}1072","Java"
1073"Bio foundation model","phylogeography/SPREADv1","release/tools/launch4j/src/net/sf/launch4j/RcBuilder.java",".java","11072","341","/*1074 Launch4j (http://launch4j.sourceforge.net/)1075 Cross-platform Java application wrapper for creating Windows native executables.1076 1077 Copyright (c) 2004, 2007 Grzegorz Kowal1078 1079 All rights reserved.1080 1081 Redistribution and use in source and binary forms, with or without modification,1082 are permitted provided that the following conditions are met:1083 1084 * Redistributions of source code must retain the above copyright notice,1085 this list of conditions and the following disclaimer.1086 * Redistributions in binary form must reproduce the above copyright notice,1087 this list of conditions and the following disclaimer in the documentation1088 and/or other materials provided with the distribution.1089 * Neither the name of the Launch4j nor the names of its contributors1090 may be used to endorse or promote products derived from this software without1091 specific prior written permission.1092 1093 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS1094 ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT1095 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR1096 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR1097 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,1098 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,1099 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR1100 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF1101 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING1102 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS1103 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.1104*/1105 1106/*1107 * Created on 2005-04-241108 */1109package net.sf.launch4j;1110 1111import java.io.BufferedWriter;1112import java.io.File;1113import java.io.FileWriter;1114import java.io.IOException;1115import java.util.List;1116 1117import net.sf.launch4j.config.Config;1118import net.sf.launch4j.config.ConfigPersister;1119import net.sf.launch4j.config.Jre;1120import net.sf.launch4j.config.Msg;1121import net.sf.launch4j.config.Splash;1122import net.sf.launch4j.config.VersionInfo;1123 1124/**1125 * @author Copyright (C) 2005 Grzegorz Kowal1126 */1127public class RcBuilder {1128 1129 // winnt.h1130 public static final int LANG_NEUTRAL = 0;1131 public static final int SUBLANG_NEUTRAL = 0;1132 public static final int SUBLANG_DEFAULT = 1;1133 public static final int SUBLANG_SYS_DEFAULT = 2;1134 1135 // MANIFEST1136 public static final int MANIFEST = 1;1137 1138 // ICON1139 public static final int APP_ICON = 1;1140 1141 // BITMAP1142 public static final int SPLASH_BITMAP = 1;1143 1144 // RCDATA1145 public static final int JRE_PATH = 1;1146 public static final int JAVA_MIN_VER = 2;1147 public static final int JAVA_MAX_VER = 3;1148 public static final int SHOW_SPLASH = 4;1149 public static final int SPLASH_WAITS_FOR_WINDOW = 5;1150 public static final int SPLASH_TIMEOUT = 6;1151 public static final int SPLASH_TIMEOUT_ERR = 7;1152 public static final int CHDIR = 8;1153 public static final int SET_PROC_NAME = 9;1154 public static final int ERR_TITLE = 10;1155 public static final int GUI_HEADER_STAYS_ALIVE = 11;1156 public static final int JVM_OPTIONS = 12;1157 public static final int CMD_LINE = 13;1158 public static final int JAR = 14;1159 public static final int MAIN_CLASS = 15;1160 public static final int CLASSPATH = 16;1161 public static final int WRAPPER = 17;1162 public static final int JDK_PREFERENCE = 18;1163 public static final int ENV_VARIABLES = 19;1164 public static final int PRIORITY_CLASS = 20;1165 public static final int DOWNLOAD_URL = 21;1166 public static final int SUPPORT_URL = 22;1167 public static final int MUTEX_NAME = 23;1168 public static final int INSTANCE_WINDOW_TITLE = 24;1169 public static final int INITIAL_HEAP_SIZE = 25;1170 public static final int INITIAL_HEAP_PERCENT = 26;1171 public static final int MAX_HEAP_SIZE = 27;1172 public static final int MAX_HEAP_PERCENT = 28;1173 1174 public static final int STARTUP_ERR = 101;1175 public static final int BUNDLED_JRE_ERR = 102;1176 public static final int JRE_VERSION_ERR = 103;1177 public static final int LAUNCHER_ERR = 104;1178 public static final int INSTANCE_ALREADY_EXISTS_MSG = 105;1179 1180 private final StringBuffer _sb = new StringBuffer();1181 1182 public String getContent() {1183 return _sb.toString();1184 }1185 1186 public String getLine(int line) {1187 return _sb.toString().split(""\n"")[line - 1];1188 }1189 1190 public File build(Config c) throws IOException {1191 _sb.append(""LANGUAGE "");1192 _sb.append(LANG_NEUTRAL);1193 _sb.append("", "");1194 _sb.append(SUBLANG_DEFAULT);1195 _sb.append('\n');1196 addVersionInfo(c.getVersionInfo());1197 addJre(c.getJre());1198 addManifest(MANIFEST, c.getManifest());1199 addIcon(APP_ICON, c.getIcon());1200 addText(ERR_TITLE, c.getErrTitle());