text:
package org.apache.kerby.asn1.type;

import org.apache.kerby.asn1.UniversalTag;
import org.apache.kerby.asn1.parse.Asn1Item;
import org.apache.kerby.asn1.parse.Asn1ParseResult;

import java.io.IOException;

public class Asn1OctetString extends Asn1Simple<byte[]> {
    public Asn1OctetString() {
        this(null);
    }

    public Asn1OctetString(byte[] value) {
        super(UniversalTag.OCTET_STRING, value);
    }

    @Override
    protected byte[] encodeBody() {
        return getValue();
    }

    @Override
    protected int encodingBodyLength() {
        if (getValue() != null) {
            return getValue().length;
        }
        return 0;
    }

    @Override
    protected void decodeBody(Asn1ParseResult parseResult) throws IOException {
        Asn1Item item = (Asn1Item) parseResult;
        setValue(item.readBodyBytes());
    }

    @Override
    public String toString() {
        String typeStr = tag().typeStr() + " ["
            + "tag=" + tag()
            + ", len=" + getHeaderLength() + "+" + getBodyLength()
            + "] ";

        byte[] valueBytes = getValue();
        String valueStr = "<null>";
        if (valueBytes != null) {
            valueStr = "<" + valueBytes.length + " octets>";
        }

        return typeStr + valueStr;
    }
}


text:
package de.uni_mannheim.informatik.dws.winter.usecase.products.model;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.*;

import org.apache.commons.lang3.StringUtils;

import de.uni_mannheim.informatik.dws.winter.model.AbstractRecord;
import de.uni_mannheim.informatik.dws.winter.model.defaultmodel.Attribute;

/**
 * A {@link AbstractRecord} representing a product.
 *
 * @author Oliver Lehmberg (oli@dwslab.de)
 *
 */
public class Product extends AbstractRecord<Attribute> implements Serializable {

	/*
	 * example entry
	 * 14219585,Computers_and_Accessories,,"Apple Mac Pro MD878LL/A Desktop: Designed for professional product editing,
	 * graphics work and multiple Ultra HD 4K displays, this impressive computer provides top-tier power and connectivity.
	 * The eye-catching body provides efficient, quiet cooling and fits easily on a desk.@en-US",,
	 * Apple - Mac Pro Desktop Computer 6-Core Intel® Xeon® Processor 16GB Memory 256GB Flash Storage Black@en-US
	 */

	private static final long serialVersionUID = 1L;

	public Product(String identifier, String provenance) {
		super(identifier, provenance);
	}

	private String title;
	private String category;
	private String brand;
	private String description;
	private String price;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	private final Map<Attribute, Collection<String>> provenance = new HashMap<>();
	private Collection<String> recordProvenance;

	public void setRecordProvenance(Collection<String> provenance) {
		recordProvenance = provenance;
	}

	public Collection<String> getRecordProvenance() {
		return recordProvenance;
	}

	public void setAttributeProvenance(Attribute attribute,
			Collection<String> provenance) {
		this.provenance.put(attribute, provenance);
	}

	public Collection<String> getAttributeProvenance(String attribute) {
		return provenance.get(attribute);
	}

	public String getMergedAttributeProvenance(Attribute attribute) {
		Collection<String> prov = provenance.get(attribute);

		if (prov != null) {
			return StringUtils.join(prov, "+");
		} else {
			return "";
		}
	}

	public static final Attribute TITLE = new Attribute("Title");
	public static final Attribute CATEGORY = new Attribute("Category");
	public static final Attribute BRAND = new Attribute("Brand");
	public static final Attribute DESCRIPTION = new Attribute("Description");
	public static final Attribute PRICE = new Attribute("Price");

	@Override
	public boolean hasValue(Attribute attribute) {
		if(attribute==TITLE)
			return getTitle() != null && !getTitle().isEmpty();
		else if(attribute==CATEGORY)
			return getCategory() != null && !getCategory().isEmpty();
		else if(attribute==BRAND)
			return getBrand() != null && !getBrand().isEmpty();
		else if(attribute==DESCRIPTION)
			return getDescription() != null && getDescription().isEmpty();
		else if(attribute==PRICE)
			return getPrice() != null && getPrice().isEmpty();
		else
			return false;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		if (!super.equals(o)) return false;
		Product product = (Product) o;
		return title.equals(product.title) &&
				category.equals(product.category) &&
				brand.equals(product.brand) &&
				description.equals(product.description) &&
				price.equals(product.price);
	}

	@Override
	public int hashCode() {
		return Objects.hash(super.hashCode(), title, category, brand, description, price);
	}

	@Override
	public String toString() {
		return "Product{" +
				"title='" + title + '\'' +
				", category='" + category + '\'' +
				", brand='" + brand + '\'' +
				", description='" + description + '\'' +
				", price='" + price + '\'' +
				", provenance=" + provenance +
				", recordProvenance=" + recordProvenance +
				'}';
	}
}

redpajama_set_name: RedPajamaGithub


text:
module Conversocial
  module Resources
    module QueryEngines
      class Channel < Base
        def initialize client
          super client
        end

        protected

        def model_klass
          Conversocial::Resources::Models::Channel
        end

      end
    end
  end
end


text:
package org.apache.hadoop.hbase.snapshot;

import java.io.IOException;
import java.io.FileNotFoundException;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.io.HFileLink;
import org.apache.hadoop.hbase.io.HLogLink;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
import org.apache.hadoop.hbase.snapshot.SnapshotReferenceUtil;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.util.FSTableDescriptors;

/**
 * Tool for dumping snapshot information.
 *

 *
 Table Descriptor
 *
 Snapshot creation time, type, format version, ...
 *
 List of hfiles and hlogs
 *
 Stats about hfiles and logs sizes, percentage of shared with the source table, ...
 *

 */
@InterfaceAudience.Public
@InterfaceStability.Evolving
public final class SnapshotInfo extends Configured implements Tool {
  private static final Log LOG = LogFactory.getLog(SnapshotInfo.class);

  /**
   * Statistics about the snapshot
   *

   *
 How many store files and logs are in the archive
   *
 How many store files and logs are shared with the table
   *
 Total store files and logs size and shared amount
   *

   */
  public static class SnapshotStats {
    /** Information about the file referenced by the snapshot */
    static class FileInfo {
      private final boolean inArchive;
      private final long size;

      FileInfo(final boolean inArchive, final long size) {
        this.inArchive = inArchive;
        this.size = size;
      }

      /** @return true if the file is in the archive */
      public boolean inArchive() {
        return this.inArchive;
      }

      /** @return true if the file is missing */
      public boolean isMissing() {
        return this.size < 0;
      }

      /** @return the file size */
      public long getSize() {
        return this.size;
      }

      String getStateToString() {
        if (isMissing()) return "NOT FOUND";
        if (inArchive()) return "archive";
        return null;
      }
    }

    private int hfileArchiveCount = 0;
    private int hfilesMissing = 0;
    private int hfilesCount = 0;
    private int logsMissing = 0;
    private int logsCount = 0;
    private long hfileArchiveSize = 0;
    private long hfileSize = 0;
    private long logSize = 0;

    private final SnapshotDescription snapshot;
    private final Configuration conf;
    private final FileSystem fs;

    SnapshotStats(final Configuration conf, final FileSystem fs, final SnapshotDescription snapshot)
    {
      this.snapshot = snapshot;
      this.conf = conf;
      this.fs = fs;
    }

    /** @return the snapshot descriptor */
    public SnapshotDescription getSnapshotDescription() {
      return this.snapshot;
    }

    /** @return true if the snapshot is corrupted */
    public boolean isSnapshotCorrupted() {
      return hfilesMissing > 0 || logsMissing > 0;
    }

    /** @return the number of available store files */
    public int getStoreFilesCount() {
      return hfilesCount + hfileArchiveCount;
    }

    /** @return the number of available store files in the archive */
    public int getArchivedStoreFilesCount() {
      return hfileArchiveCount;
    }

    /** @return the number of available log files */
    public int getLogsCount() {
      return logsCount;
    }

    /** @return the number of missing store files */
    public int getMissingStoreFilesCount() {
      return hfilesMissing;
    }

    /** @return the number of missing log files */
    public int getMissingLogsCount() {
      return logsMissing;
    }

    /** @return the total size of the store files referenced by the snapshot */
    public long getStoreFilesSize() {
      return hfileSize + hfileArchiveSize;
    }

    /** @return the total size of the store files shared */
    public long getSharedStoreFilesSize() {
      return hfileSize;
    }

    /** @return the total size of the store files in the archive */
    public long getArchivedStoreFileSize() {
      return hfileArchiveSize;
    }

    /** @return the percentage of the shared store files */
    public float getSharedStoreFilePercentage() {
      return ((float)hfileSize / (hfileSize + hfileArchiveSize)) * 100;
    }

    /** @return the total log size */
    public long getLogsSize() {
      return logSize;
    }

    /**
     * Add the specified store file to the stats
     * @param region region encoded Name
     * @param family family name
     * @param hfile store file name
     * @return the store file information
     */
    FileInfo addStoreFile(final String region, final String family, final String hfile)
          throws IOException {
      String table = this.snapshot.getTable();
      HFileLink link = HFileLink.create(conf, table, region, family, hfile);
      boolean inArchive = false;
      long size = -1;
      try {
        if ((inArchive = fs.exists(link.getArchivePath()))) {
          size = fs.getFileStatus(link.getArchivePath()).getLen();
          hfileArchiveSize += size;
          hfileArchiveCount++;
        } else {
          size = link.getFileStatus(fs).getLen();
          hfileSize += size;
          hfilesCount++;
        }
      } catch (FileNotFoundException e) {
        hfilesMissing++;
      }
      return new FileInfo(inArchive, size);
    }

    /**
     * Add the specified recovered.edits file to the stats
     * @param region region encoded name
     * @param logfile log file name
     * @return the recovered.edits information
     */
    FileInfo addRecoveredEdits(final String region, final String logfile) throws IOException {
      Path rootDir = FSUtils.getRootDir(conf);
      Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir);
      Path path = SnapshotReferenceUtil.getRecoveredEdits(snapshotDir, region, logfile);
      long size = fs.getFileStatus(path).getLen();
      logSize += size;
      logsCount++;
      return new FileInfo(true, size);
    }

    /**
     * Add the specified log file to the stats
     * @param server server name
     * @param logfile log file name
     * @return the log information
     */
    FileInfo addLogFile(final String server, final String logfile) throws IOException {
      HLogLink logLink = new HLogLink(conf, server, logfile);
      long size = -1;
      try {
        size = logLink.getFileStatus(fs).getLen();
        logSize += size;
        logsCount++;
      } catch (FileNotFoundException e) {
        logsMissing++;
      }
      return new FileInfo(false, size);
    }
  }

  private boolean printSizeInBytes = false;
  private FileSystem fs;
  private Path rootDir;

  private HTableDescriptor snapshotTableDesc;
  private SnapshotDescription snapshotDesc;
  private Path snapshotDir;

  @Override
  public int run(String[] args) throws IOException, InterruptedException {
    final Configuration conf = getConf();
    boolean listSnapshots = false;
    String snapshotName = null;
    boolean showSchema = false;
    boolean showFiles = false;
    boolean showStats = false;

    // Process command line args
    for (int i = 0; i < args.length; i++) {
      String cmd = args[i];
      try {
        if (cmd.equals("-snapshot")) {
          snapshotName = args[++i];
        } else if (cmd.equals("-files")) {
          showFiles = true;
          showStats = true;
        } else if (cmd.equals("-stats")) {
          showStats = true;
        } else if (cmd.equals("-schema")) {
          showSchema = true;
        } else if (cmd.equals("-remote-dir")) {
          Path sourceDir = new Path(args[++i]);
          URI defaultFs = sourceDir.getFileSystem(conf).getUri();
          FSUtils.setFsDefault(conf, new Path(defaultFs));
          FSUtils.setRootDir(conf, sourceDir);
        } else if (cmd.equals("-list-snapshots")) {
          listSnapshots = true;
        } else if (cmd.equals("-size-in-bytes")) {
          printSizeInBytes = true;
        } else if (cmd.equals("-h") || cmd.equals("--help")) {
          printUsageAndExit();
        } else {
          System.err.println("UNEXPECTED: " + cmd);
          printUsageAndExit();
        }
      } catch (Exception e) {
        printUsageAndExit();
      }
    }

    // List Available Snapshots
    if (listSnapshots) {
      SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
      System.out.printf("%-20s | %-20s | %s%n", "SNAPSHOT", "CREATION TIME", "TABLE NAME");
      for (SnapshotDescription desc: getSnapshotList(conf)) {
        System.out.printf("%-20s | %20s | %s%n",
                          desc.getName(),
                          df.format(new Date(desc.getCreationTime())),
                          desc.getTable());
      }
      return 0;
    }

    if (snapshotName == null) {
      System.err.println("Missing snapshot name!");
      printUsageAndExit();
      return 1;
    }

    rootDir = FSUtils.getRootDir(conf);
    fs = FileSystem.get(rootDir.toUri(), conf);
    LOG.debug("fs=" + fs.getUri().toString() + " root=" + rootDir);

    // Load snapshot information
    if (!loadSnapshotInfo(snapshotName)) {
      System.err.println("Snapshot '" + snapshotName + "' not found!");
      return 1;
    }

    printInfo();
    if (showSchema) printSchema();
    printFiles(showFiles, showStats);

    return 0;
  }

  /**
   * Load snapshot info and table descriptor for the specified snapshot
   * @param snapshotName name of the snapshot to load
   * @return false if snapshot is not found
   */
  private boolean loadSnapshotInfo(final String snapshotName) throws IOException {
    snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
    if (!fs.exists(snapshotDir)) {
      LOG.warn("Snapshot '" + snapshotName + "' not found in: " + snapshotDir);
      return false;
    }

    snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
    snapshotTableDesc = FSTableDescriptors.getTableDescriptor(fs, snapshotDir);
    return true;
  }

  /**
   * Dump the {@link SnapshotDescription}
   */
  private void printInfo() {
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    System.out.println("Snapshot Info");
    System.out.println("----------------------------------------");
    System.out.println("   Name: " + snapshotDesc.getName());
    System.out.println("   Type: " + snapshotDesc.getType());
    System.out.println("  Table: " + snapshotDesc.getTable());
    System.out.println(" Format: " + snapshotDesc.getVersion());
    System.out.println("Created: " + df.format(new Date(snapshotDesc.getCreationTime())));
    System.out.println();
  }

  /**
   * Dump the {@link HTableDescriptor}
   */
  private void printSchema() {
    System.out.println("Table Descriptor");
    System.out.println("----------------------------------------");
    System.out.println(snapshotTableDesc.toString());
    System.out.println();
  }

  /**
   * Collect the hfiles and logs statistics of the snapshot and
   * dump the file list if requested and the collected information.
   */
  private void printFiles(final boolean showFiles, final boolean showStats) throws IOException {
    if (showFiles) {
      System.out.println("Snapshot Files");
      System.out.println("----------------------------------------");
    }

    // Collect information about hfiles and logs in the snapshot
    final String table = this.snapshotDesc.getTable();
    final SnapshotStats stats = new SnapshotStats(this.getConf(), this.fs, this.snapshotDesc);
    SnapshotReferenceUtil.visitReferencedFiles(fs, snapshotDir,
      new SnapshotReferenceUtil.FileVisitor() {
        public void storeFile (final String region, final String family, final String hfile)
            throws IOException {
          SnapshotStats.FileInfo info = stats.addStoreFile(region, family, hfile);

          if (showFiles) {
            String state = info.getStateToString();
            System.out.printf("%8s %s/%s/%s/%s %s%n",
              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
              table, region, family, hfile,
              state == null ? "" : "(" + state + ")");
          }
        }

        public void recoveredEdits (final String region, final String logfile)
            throws IOException {
          SnapshotStats.FileInfo info = stats.addRecoveredEdits(region, logfile);

          if (showFiles) {
            System.out.printf("%8s recovered.edits %s on region %s%n",
              fileSizeToString(info.getSize()), logfile, region);
          }
        }

        public void logFile (final String server, final String logfile)
            throws IOException {
          SnapshotStats.FileInfo info = stats.addLogFile(server, logfile);

          if (showFiles) {
            String state = info.getStateToString();
            System.out.printf("%8s log %s on server %s %s%n",
              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
              logfile, server,
              state == null ? "" : "(" + state + ")");
          }
        }
    });

    // Dump the stats
    System.out.println();
    if (stats.isSnapshotCorrupted()) {
      System.out.println("**************************************************************");
      System.out.printf("BAD SNAPSHOT: %d hfile(s) and %d log(s) missing.%n",
        stats.getMissingStoreFilesCount(), stats.getMissingLogsCount());
      System.out.println("**************************************************************");
    }

    if (showStats) {
      System.out.printf("%d HFiles (%d in archive), total size %s (%.2f%% %s shared with the source table)%n",
        stats.getStoreFilesCount(), stats.getArchivedStoreFilesCount(),
        fileSizeToString(stats.getStoreFilesSize()),
        stats.getSharedStoreFilePercentage(),
        fileSizeToString(stats.getSharedStoreFilesSize())
      );
      System.out.printf("%d Logs, total size %s%n",
        stats.getLogsCount(), fileSizeToString(stats.getLogsSize()));
      System.out.println();
    }
  }

  private String fileSizeToString(long size) {
    return printSizeInBytes ? Long.toString(size) : StringUtils.humanReadableInt(size);
  }

  private void printUsageAndExit() {
    System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
    System.err.println(" where [options] are:");
    System.err.println("  -h|-help                Show this help and exit.");
    System.err.println("  -remote-dir             Root directory that contains the snapshots.");
    System.err.println("  -list-snapshots         List all the available snapshots and exit.");
    System.err.println("  -snapshot NAME          Snapshot to examine.");
    System.err.println("  -files                  Files and logs list.");
    System.err.println("  -stats                  Files and logs stats.");
    System.err.println("  -schema                 Describe the snapshotted table.");
    System.err.println();
    System.err.println("Examples:");
    System.err.println("  hbase " + getClass() + " \\");
    System.err.println("    -snapshot MySnapshot -files");
    System.exit(1);
  }

  /**
   * Returns the snapshot stats
   * @param conf the {@link Configuration} to use
   * @param snapshot {@link SnapshotDescription} to get stats from
   * @return the snapshot stats
   */
  public static SnapshotStats getSnapshotStats(final Configuration conf,
      final SnapshotDescription snapshot) throws IOException {
    Path rootDir = FSUtils.getRootDir(conf);
    FileSystem fs = FileSystem.get(rootDir.toUri(), conf);
    Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir);
    final SnapshotStats stats = new SnapshotStats(conf, fs, snapshot);
    SnapshotReferenceUtil.visitReferencedFiles(fs, snapshotDir,
      new SnapshotReferenceUtil.FileVisitor() {
        public void storeFile (final String region, final String family, final String hfile)
            throws IOException {
          stats.addStoreFile(region, family, hfile);
        }

        public void recoveredEdits (final String region, final String logfile) throws IOException {
          stats.addRecoveredEdits(region, logfile);
        }

        public void logFile (final String server, final String logfile) throws IOException {
          stats.addLogFile(server, logfile);
        }
    });
    return stats;
  }

  /**
   * Returns the list of available snapshots in the specified location
   * @param conf the {@link Configuration} to use
   * @return the list of snapshots
   */
  public static List<SnapshotDescription> getSnapshotList(final Configuration conf)
      throws IOException {
    Path rootDir = FSUtils.getRootDir(conf);
    FileSystem fs = FileSystem.get(rootDir.toUri(), conf);
    Path snapshotDir = SnapshotDescriptionUtils.getSnapshotsDir(rootDir);
    FileStatus[] snapshots = fs.listStatus(snapshotDir,
      new SnapshotDescriptionUtils.CompletedSnaphotDirectoriesFilter(fs));
    List<SnapshotDescription> snapshotLists =
      new ArrayList<SnapshotDescription>(snapshots.length);
    for (FileStatus snapshotDirStat: snapshots) {
      snapshotLists.add(SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDirStat.getPath()));
    }
    return snapshotLists;
  }

  /**
   * The guts of the {@link #main} method.
   * Call this method to avoid the {@link #main(String[])} System.exit.
   * @param args
   * @return errCode
   * @throws Exception
   */
  static int innerMain(final String [] args) throws Exception {
    return ToolRunner.run(HBaseConfiguration.create(), new SnapshotInfo(), args);
  }

  public static void main(String[] args) throws Exception {
     System.exit(innerMain(args));
  }
}


text:
\documentclass[letterpaper,10pt,titlepage]{article}

\usepackage{graphicx}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}

\usepackage{alltt}
\usepackage{float}
\usepackage{color}

\usepackage{url}

\usepackage{balance}
\usepackage[TABBOTCAP, tight]{subfigure}
\usepackage{enumitem}

\usepackage{pstricks, pst-node}

\usepackage{verbatim}

\usepackage{geometry}
\geometry{textheight=10in, textwidth=7.5in}

%random comment

\newcommand{\cred}[1]{{\color{red}#1}}
\newcommand{\cblue}[1]{{\color{blue}#1}}

\usepackage{hyperref}

\def\name{Geoffrey Corey}

%pull in the necessary preamble matter for pygments output
\input{pygments.tex}

%% The following metadata will show up in the PDF properties
\hypersetup{
  colorlinks = true,
  urlcolor = black,
  pdfauthor = {\name},
  pdfkeywords = {cs311 ``operating systems'' process control},
  pdftitle = {CS 311 Project 3: UNIX Process control},
  pdfsubject = {CS 311 Project 3},
  pdfpagemode = UseNone
}

\parindent = 0.0 in
\parskip = 0.2 in

\begin{document}
\section{Design}
\label{System Design & Deviations}
%\begin{Verbatim}

\subsection{The Design}
\label{DesingProcess}
The overall design for my system was again very loose. I first had to setup a basic input/output system to make sure that reading from stdin was working regardless of the type of input supplied to it.
As the input parsing was finished, the signal handling was implmented for SIGHUP, SIGINT, and SIGQUIT. Once this signal handling was tested, the next step was to try routing all input from stdin to the system's sort process, getting the piping and plumbing down, and controlling the sort process.
After this was accomplished, expanding the process control the the specified number of processes to run from command line was (almost) trivial.
The next step was to setup the suppressor to read from all the sorts and then print only the unique words.
\subsection{The Deviations}
\label{Deviations}
The begining of the designed assumend reading from a file provided through the commandline. This was later rectified to read directly from stdin.
Later in this project, was the switch from C to C++ to allow for better string handling, however most of the CPP code is actually C code.
\section{History}
\label{myar Revision History}
\input{log.txt}

\section{Challenges}
\label{Overcoming Project challenges}
The biggest challenge of this project was figureing out why there was a hang between 2 and a minimum number of processes that increased as the size of the input stream increased. The cause of this challenge was improper piping, but rectifying the problem proved (nearly) impossible for the time left on the project, and was scrapped after the move to CPP cope.

\section{Questions}
\label{Project Quesions}
\subsection{The Point of the Assignment}
\label{Point}
The overall point of this assigment was to leanr and implments process creation and process control inside a Unix environment.
\subsection{Quality Assurance}
\label{QA}
For testing my uniqify, I parsed an input file of varrying length, as well as freeform type from the keyboard, into my uniqify program, as well as a (parsed) file to the system sort and compared the results.
\subsection{What Did You Learn?}
\label{Learned}
I learned that even with vastly improved time allocation, it can still be easy to program yourself into a corner.
%\end{Verbatim}

\includegraphics[width=\textwidth]{plot.eps}

%input the pygmentized output of mt19937ar.c, using a (hopefully) unique name
%this file only exists at compile time. Feel free to change that.
\section{Code}
\label{myar Source Code}
\input{__uniqify.cpp.tex}
\end{document}


text:
Get Zulip notifications for the stories in your Pivotal Tracker project!

1. {!create-stream.md!}

1. {!create-bot-construct-url.md!}

1. Go to your Pivotal project's **Settings** page, and click on **Webhooks**.

1. Under **Activity Web Hook**, provide the URL constructed above.
   Choose version 5 (`v5`) of the API. Zulip supports both version 3 and
   version 5, but version 5 contains more information and allows
   Zulip to format more useful messages. Click **Add**.

{!congrats.md!}

![](/static/images/integrations/pivotal/001.png)


text:
package org.apache.bcel.util;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;

/**
 * Utility class that implements a sequence of bytes which can be read
 * via the `readByte()' method. This is used to implement a wrapper for the
 * Java byte code stream to gain some more readability.
 *
 * @version $Id: ByteSequence.java 386056 2006-03-15 11:31:56Z tcurdt $
 * @author  M. Dahm
 */
public final class ByteSequence extends DataInputStream {

    private ByteArrayStream byte_stream;

    public ByteSequence(byte[] bytes) {
        super(new ByteArrayStream(bytes));
        byte_stream = (ByteArrayStream) in;
    }

    public final int getIndex() {
        return byte_stream.getPosition();
    }

    final void unreadByte() {
        byte_stream.unreadByte();
    }

    private static final class ByteArrayStream extends ByteArrayInputStream {

        ByteArrayStream(byte[] bytes) {
            super(bytes);
        }

        final int getPosition() {
            return pos;
        } // is protected in ByteArrayInputStream

        final void unreadByte() {
            if (pos > 0) {
                pos--;
            }
        }
    }
}


text:
#ifndef FORMAT_HPP_27C3F464_170B_432E_9D44_3884DDBB95AC
#define FORMAT_HPP_27C3F464_170B_432E_9D44_3884DDBB95AC
#pragma once

/*
format.hpp

Форматирование строк
*/
/*
Copyright © 2009 Far Group
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// Internal:

// Platform:

// Common:
#include "common/preprocessor.hpp"

// External:

//----------------------------------------------------------------------------

WARNING_PUSH(3)

WARNING_DISABLE_GCC("-Wctor-dtor-privacy")

WARNING_DISABLE_CLANG("-Weverything")

#define FMT_CONSTEVAL // Not yet

#define FMT_STATIC_THOUSANDS_SEPARATOR
#include "thirdparty/fmt/fmt/format.h"
#include "thirdparty/fmt/fmt/xchar.h"
#include "thirdparty/fmt/fmt/ostream.h"
#undef FMT_STATIC_THOUSANDS_SEPARATOR

WARNING_POP()

namespace detail
{
	template<typename F>
	void validate_format()
	{
		static_assert(!std::is_array_v<F>, "Use FSTR or string_view instead of string literals");
	}
}

template<typename F, typename... args>
auto format(F&& Format, args&&... Args)
{
	detail::validate_format<F>();

	return fmt::format(FWD(Format), FWD(Args)...);
}

template<typename I, typename F, typename... args>
auto format_to(I&& Iterator, F&& Format, args&&... Args)
{
	detail::validate_format<F>();

	return fmt::format_to(FWD(Iterator), FWD(Format), FWD(Args)...);
}

template<typename F, typename... args>
auto format_to(string& Str, F&& Format, args&&... Args)
{
	detail::validate_format<F>();

	return fmt::format_to(std::back_inserter(Str), FWD(Format), FWD(Args)...);
}

#define FSTR(str) FMT_STRING(str)

template<typename T>
auto str(const T& Value)
{
	return fmt::to_wstring(Value);
}

inline auto str(const void* Value)
{
	return format(FSTR(L"0x{:0{}X}"sv), reinterpret_cast<uintptr_t>(Value), sizeof(Value) * 2);
}

inline auto str(void* Value)
{
	return str(static_cast<void const*>(Value));
}

string str(const char*) = delete;
string str(const wchar_t*) = delete;
string str(std::string) = delete;
string str(string) = delete;
string str(std::string_view) = delete;
string str(string_view) = delete;

namespace format_helpers
{
	struct parse_no_spec
	{
		template<typename ParseContext>
		constexpr auto parse(ParseContext& ctx)
		{
			return ctx.begin();
		}
	};

	template<typename object_type>
	struct format_no_spec
	{
		template <typename FormatContext>
		auto format(object_type const& Value, FormatContext& ctx)
		{
			return fmt::format_to(ctx.out(), FSTR(L"{}"sv), fmt::formatter<object_type, wchar_t>::to_string(Value));
		}
	};

	template<typename object_type>
	struct no_spec: parse_no_spec, format_no_spec<object_type>
	{
	};
}

template<>
struct fmt::formatter<std::exception, wchar_t>: format_helpers::no_spec<std::exception>
{
	static string to_string(std::exception const& Value);
};

#endif // FORMAT_HPP_27C3F464_170B_432E_9D44_3884DDBB95AC


text:
package sivl.platform.pay.sdk.wxpay.scan.protocol.reverse_protocol;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

import sivl.platform.pay.sdk.wxpay.common.Configure;
import sivl.platform.pay.sdk.wxpay.common.RandomStringGenerator;
import sivl.platform.pay.sdk.wxpay.common.Signature;

/**
 * User: rizenguo
 * Date: 2014/10/25
 * Time: 16:42
 */
public class ReverseReqData {
    //每个字段具体的意思请查看API文档
    private String appid = "";
    private String mch_id = "";
    private String transaction_id = "";
    private String out_trade_no = "";
    private String nonce_str = "";
    private String sign = "";
    private String sdk_version = "";

    /**
     * 请求撤销服务
     * @param transactionID 是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。建议优先使用
     * @param outTradeNo 商户系统内部的订单号,transaction_id 、out_trade_no 二选一,如果同时存在优先级:transaction_id>out_trade_no
     * @return API返回的XML数据
     * @throws Exception
     */

    public ReverseReqData(String transactionID,String outTradeNo){

        //--------------------------------------------------------------------
        //以下是测试数据,请商户按照自己的实际情况填写具体的值进去
        //--------------------------------------------------------------------

        setSdk_version(Configure.getSdkVersion());

        //微信分配的公众号ID(开通公众号之后可以获取到)
        setAppid(Configure.getAppid());

        //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
        setMch_id(Configure.getMchid());

        //transaction_id是微信系统为每一笔支付交易分配的订单号,通过这个订单号可以标识这笔交易,它由支付订单API支付成功时返回的数据里面获取到。
        setTransaction_id(transactionID);

        //商户系统自己生成的唯一的订单号
        setOut_trade_no(outTradeNo);

        //随机字符串,不长于32 位
        setNonce_str(RandomStringGenerator.getRandomStringByLength(32));

        //根据API给的签名规则进行签名
        String sign = Signature.getSign(toMap());
        setSign(sign);//把签名数据设置到Sign这个属性中

    }

    public String getAppid() {
        return appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }

    public String getMch_id() {
        return mch_id;
    }

    public void setMch_id(String mch_id) {
        this.mch_id = mch_id;
    }

    public String getTransaction_id() {
        return transaction_id;
    }

    public void setTransaction_id(String transaction_id) {
        this.transaction_id = transaction_id;
    }

    public String getOut_trade_no() {
        return out_trade_no;
    }

    public void setOut_trade_no(String out_trade_no) {
        this.out_trade_no = out_trade_no;
    }

    public String getNonce_str() {
        return nonce_str;
    }

    public void setNonce_str(String nonce_str) {
        this.nonce_str = nonce_str;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getSdk_version(){
        return sdk_version;
    }

    public void setSdk_version(String sdk_version) {
        this.sdk_version = sdk_version;
    }

    public Map<String,Object> toMap(){
        Map<String,Object> map = new HashMap<String, Object>();
        Field[] fields = this.getClass().getDeclaredFields();
        for (Field field : fields) {
            Object obj;
            try {
                obj = field.get(this);
                if(obj!=null){
                    map.put(field.getName(), obj);
                }
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return map;
    }

}


text:
namespace k8s
{
    /// <summary>
    /// Represents a Kubernetes object that has a spec
    /// </summary>
    /// <typeparam name="T">type of Kubernetes object</typeparam>
    public interface ISpec<T>
    {
        /// <summary>
        /// Gets or sets specification of the desired behavior of the entity. More
        /// info:
        /// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
        /// </summary>
        T Spec { get; set; }
    }
}


text:
/*
    Document   : style
    Created on : 2012-09-13, 20:04:23
    Author     : UFO
    Description:
        Purpose of the stylesheet follows.
*/

root {
    display: block;
}


text:
package apple.quartzcore;

import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSCoder;
import apple.foundation.NSDictionary;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.foundation.protocol.NSCopying;
import apple.foundation.protocol.NSSecureCoding;
import apple.quartzcore.protocol.CAAction;
import apple.quartzcore.protocol.CAAnimationDelegate;
import apple.quartzcore.protocol.CAMediaTiming;
import apple.quartzcore.struct.CAFrameRateRange;
import apple.scenekit.SCNAnimationEvent;
import apple.scenekit.protocol.SCNAnimation;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.MappedReturn;
import org.moe.natj.general.ann.NFloat;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.ProtocolClassMethod;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;

/**
 * The base animation class. *
 */
@Generated
@Library("QuartzCore")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class CAAnimation extends NSObject implements NSSecureCoding, NSCopying, CAMediaTiming, CAAction, SCNAnimation {
    static {
        NatJ.register();
    }

    @Generated
    protected CAAnimation(Pointer peer) {
        super(peer);
    }

    @Generated
    @Selector("accessInstanceVariablesDirectly")
    public static native boolean accessInstanceVariablesDirectly();

    @Generated
    @Owned
    @Selector("alloc")
    public static native CAAnimation alloc();

    @Owned
    @Generated
    @Selector("allocWithZone:")
    public static native CAAnimation allocWithZone(VoidPtr zone);

    /**
     * Creates a new animation object.
     */
    @Generated
    @Selector("animation")
    public static native CAAnimation animation();

    @Generated
    @Selector("automaticallyNotifiesObserversForKey:")
    public static native boolean automaticallyNotifiesObserversForKey(String key);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:")
    public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
    public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
            @Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
            @Mapped(ObjCObjectMapper.class) Object anArgument);

    @Generated
    @Selector("classFallbacksForKeyedArchiver")
    public static native NSArray<String> classFallbacksForKeyedArchiver();

    @Generated
    @Selector("classForKeyedUnarchiver")
    public static native Class classForKeyedUnarchiver();

    @Generated
    @Selector("debugDescription")
    public static native String debugDescription_static();

    /**
     * Animations implement the same property model as defined by CALayer.
     * See CALayer.h for more details.
     */
    @Generated
    @Selector("defaultValueForKey:")
    @MappedReturn(ObjCObjectMapper.class)
    public static native Object defaultValueForKey(String key);

    @Generated
    @Selector("description")
    public static native String description_static();

    @Generated
    @Selector("hash")
    @NUInt
    public static native long hash_static();

    @Generated
    @Selector("instanceMethodForSelector:")
    @FunctionPtr(name = "call_instanceMethodForSelector_ret")
    public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);

    @Generated
    @Selector("instanceMethodSignatureForSelector:")
    public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);

    @Generated
    @Selector("instancesRespondToSelector:")
    public static native boolean instancesRespondToSelector(SEL aSelector);

    @Generated
    @Selector("isSubclassOfClass:")
    public static native boolean isSubclassOfClass(Class aClass);

    @Generated
    @Selector("keyPathsForValuesAffectingValueForKey:")
    public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);

    @Generated
    @Owned
    @Selector("new")
    public static native CAAnimation new_objc();

    @Generated
    @Selector("resolveClassMethod:")
    public static native boolean resolveClassMethod(SEL sel);

    @Generated
    @Selector("resolveInstanceMethod:")
    public static native boolean resolveInstanceMethod(SEL sel);

    @Generated
    @Selector("setVersion:")
    public static native void setVersion_static(@NInt long aVersion);

    @Generated
    @Selector("superclass")
    public static native Class superclass_static();

    @Generated
    @Selector("version")
    @NInt
    public static native long version_static();

    /**
     * [@property] animationEvents
     *

     * Specifies the animation events attached to the receiver.
     */
    @Generated
    @Selector("animationEvents")
    public native NSArray<? extends SCNAnimationEvent> animationEvents();

    @Generated
    @Selector("autoreverses")
    public native boolean autoreverses();

    @Generated
    @Selector("beginTime")
    public native double beginTime();

    @Generated
    @Owned
    @Selector("copyWithZone:")
    @MappedReturn(ObjCObjectMapper.class)
    public native Object copyWithZone(VoidPtr zone);

    /**
     * The delegate of the animation. This object is retained for the
     * lifetime of the animation object. Defaults to nil. See below for the
     * supported delegate methods.
     */
    @Generated
    @Selector("delegate")
    @MappedReturn(ObjCObjectMapper.class)
    public native CAAnimationDelegate delegate();

    @Generated
    @Selector("duration")
    public native double duration();

    @Generated
    @Selector("encodeWithCoder:")
    public native void encodeWithCoder(NSCoder coder);

    /**
     * [@property] fadeInDuration
     *

     * Determines the receiver's fade-in duration.
     *

     * When the fadeInDuration is greater than zero, the effect of the animation progressively increase from 0% to 100%
     * during the specified duration.
     */
    @Generated
    @Selector("fadeInDuration")
    @NFloat
    public native double fadeInDuration();

    /**
     * [@property] fadeOutDuration
     *

     * Determines the receiver's fade-out duration.
     *

     * When the fadeOutDuration is greater than zero, the effect of the animation progressively decrease from 100% to 0%
     * at the end of the animation duration.
     */
    @Generated
    @Selector("fadeOutDuration")
    @NFloat
    public native double fadeOutDuration();

    @Generated
    @Selector("fillMode")
    public native String fillMode();

    @Generated
    @Selector("init")
    public native CAAnimation init();

    @Generated
    @Selector("initWithCoder:")
    public native CAAnimation initWithCoder(NSCoder coder);

    /**
     * When true, the animation is removed from the render tree once its
     * active duration has passed. Defaults to YES.
     */
    @Generated
    @Selector("isRemovedOnCompletion")
    public native boolean isRemovedOnCompletion();

    /**
     * When true, the animation is removed from the render tree once its
     * active duration has passed. Defaults to YES.
     */
    @Generated
    @Selector("setRemovedOnCompletion:")
    public native void setRemovedOnCompletion(boolean value);

    @Generated
    @Selector("repeatCount")
    public native float repeatCount();

    @Generated
    @Selector("repeatDuration")
    public native double repeatDuration();

    @Generated
    @Selector("runActionForKey:object:arguments:")
    public native void runActionForKeyObjectArguments(String event, @Mapped(ObjCObjectMapper.class) Object anObject,
            NSDictionary<?, ?> dict);

    /**
     * [@property] animationEvents
     *

     * Specifies the animation events attached to the receiver.
     */
    @Generated
    @Selector("setAnimationEvents:")
    public native void setAnimationEvents(NSArray<? extends SCNAnimationEvent> value);

    @Generated
    @Selector("setAutoreverses:")
    public native void setAutoreverses(boolean value);

    @Generated
    @Selector("setBeginTime:")
    public native void setBeginTime(double value);

    /**
     * The delegate of the animation. This object is retained for the
     * lifetime of the animation object. Defaults to nil. See below for the
     * supported delegate methods.
     */
    @Generated
    @Selector("setDelegate:")
    public native void setDelegate(@Mapped(ObjCObjectMapper.class) CAAnimationDelegate value);

    @Generated
    @Selector("setDuration:")
    public native void setDuration(double value);

    /**
     * [@property] fadeInDuration
     *

     * Determines the receiver's fade-in duration.
     *

     * When the fadeInDuration is greater than zero, the effect of the animation progressively increase from 0% to 100%
     * during the specified duration.
     */
    @Generated
    @Selector("setFadeInDuration:")
    public native void setFadeInDuration(@NFloat double value);

    /**
     * [@property] fadeOutDuration
     *

     * Determines the receiver's fade-out duration.
     *

     * When the fadeOutDuration is greater than zero, the effect of the animation progressively decrease from 100% to 0%
     * at the end of the animation duration.
     */
    @Generated
    @Selector("setFadeOutDuration:")
    public native void setFadeOutDuration(@NFloat double value);

    @Generated
    @Selector("setFillMode:")
    public native void setFillMode(String value);

    @Generated
    @Selector("setRepeatCount:")
    public native void setRepeatCount(float value);

    @Generated
    @Selector("setRepeatDuration:")
    public native void setRepeatDuration(double value);

    @Generated
    @Selector("setSpeed:")
    public native void setSpeed(float value);

    @Generated
    @Selector("setTimeOffset:")
    public native void setTimeOffset(double value);

    /**
     * A timing function defining the pacing of the animation. Defaults to
     * nil indicating linear pacing.
     */
    @Generated
    @Selector("setTimingFunction:")
    public native void setTimingFunction(CAMediaTimingFunction value);

    /**
     * [@property] usesSceneTimeBase
     *

     * Determines whether the receiver is evaluated using the scene time or the system time. Defaults to NO.
     *

     * A scene-time based animation is evaluated using the "sceneTime" value of the renderer that renders the scene.
     */
    @Generated
    @Selector("setUsesSceneTimeBase:")
    public native void setUsesSceneTimeBase(boolean value);

    @Generated
    @Selector("shouldArchiveValueForKey:")
    public native boolean shouldArchiveValueForKey(String key);

    @Generated
    @Selector("speed")
    public native float speed();

    @Generated
    @Selector("timeOffset")
    public native double timeOffset();

    /**
     * A timing function defining the pacing of the animation. Defaults to
     * nil indicating linear pacing.
     */
    @Generated
    @Selector("timingFunction")
    public native CAMediaTimingFunction timingFunction();

    /**
     * [@property] usesSceneTimeBase
     *

     * Determines whether the receiver is evaluated using the scene time or the system time. Defaults to NO.
     *

     * A scene-time based animation is evaluated using the "sceneTime" value of the renderer that renders the scene.
     */
    @Generated
    @Selector("usesSceneTimeBase")
    public native boolean usesSceneTimeBase();

    /**
     * Bridge with SCNAnimation
     * Initializes a CoreAnimation animation from a SCNAnimation
     */
    @Generated
    @Selector("animationWithSCNAnimation:")
    public static native CAAnimation animationWithSCNAnimation(apple.scenekit.SCNAnimation animation);

    @Generated
    @Selector("supportsSecureCoding")
    public static native boolean supportsSecureCoding();

    @Generated
    @ProtocolClassMethod("supportsSecureCoding")
    public boolean _supportsSecureCoding() {
        return supportsSecureCoding();
    }

    /**
     * Defines the range of desired frame rate in frames-per-second for this
     * animation. The actual frame rate is dynamically adjusted to better align
     * with other animation sources.
     */
    @Generated
    @Selector("preferredFrameRateRange")
    @ByValue
    public native CAFrameRateRange preferredFrameRateRange();

    /**
     * Defines the range of desired frame rate in frames-per-second for this
     * animation. The actual frame rate is dynamically adjusted to better align
     * with other animation sources.
     */
    @Generated
    @Selector("setPreferredFrameRateRange:")
    public native void setPreferredFrameRateRange(@ByValue CAFrameRateRange value);
}


text:
<?php
/**
 * Empty cart page
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

wc_print_notices();

?>

<?php _e( 'Your cart is currently empty.', 'woocommerce' ) ?>

<?php do_action( 'woocommerce_cart_is_empty' ); ?>

 开始定制球衣


text:
<?php

declare(strict_types=1);

/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

namespace ParkManager\Module\CoreModule\Infrastructure\Security;

final class ClientUser extends SecurityUser
{
}


text:
#include "tensorflow/compiler/tf2xla/xla_op_kernel.h"
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"
#include "tensorflow/compiler/xla/client/lib/slicing.h"
#include "tensorflow/compiler/xla/client/lib/tridiagonal.h"
#include "tensorflow/core/framework/node_def_util.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/platform/errors.h"

namespace tensorflow {
namespace {

class TridiagonalSolveOp : public XlaOpKernel {
 public:
  explicit TridiagonalSolveOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) {}
  void Compile(XlaOpKernelContext* ctx) override {
    auto diagonals = ctx->Input(0);
    auto rhs = ctx->Input(1);
    bool partial_pivoting = false;
    OP_REQUIRES_OK(ctx,
                   GetNodeAttr(def(), "partial_pivoting", &partial_pivoting));
    if (partial_pivoting) {
      ctx->SetStatus(errors::Unimplemented(
          "Current implementation does not yet support pivoting."));
      return;
    }

    auto result = xla::tridiagonal::ThomasSolver(diagonals, rhs);
    if (!result.ok()) {
      ctx->SetStatus(result.status());
      return;
    }
    ctx->SetOutput(0, result.ValueOrDie());
  }
};

REGISTER_XLA_OP(Name("TridiagonalSolve").TypeConstraint("T", kFloatTypes),
                TridiagonalSolveOp);

}  // namespace
}  // namespace tensorflow


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/solid.css" integrity="sha384-VGP9aw4WtGH/uPAOseYxZ+Vz/vaTb1ehm1bwx92Fm8dTrE+3boLfF1SpAtB1z7HW" crossorigin="anonymous">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/brands.css" integrity="sha384-rf1bqOAj3+pw6NqYrtaE1/4Se2NBwkIfeYbsFdtiR6TQz0acWiwJbv1IM/Nt/ite" crossorigin="anonymous">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/fontawesome.css" integrity="sha384-1rquJLNOM3ijoueaaeS5m+McXPJCGdr5HcA03/VHXxcp2kX2sUrQDmFc3jR5i/C7" crossorigin="anonymous">
    <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
    <link rel="shortcut icon" type="image/x-icon" href="{{ "/favicon.ico" | prepend: site.baseurl }}" >
    <meta name="viewport" content="width=device-width">

    {% seo %}

{{ site.title | default: site.github.repository_name }}

{{ site.description | default: site.github.project_tagline }}

Features

Controls and Hotkeys

Content

Setup

File Format

Credits

Share

Contact

        {% if site.github.is_project_page %}

Graces Games

        {% endif %}

        {{ content }}

{% if site.google_analytics %}

{% endif %}


text:
namespace musik {
    namespace cube {
        class BrowseOverlays {
            public:
                static void ShowCategoryChooser(
                    musik::core::ILibraryPtr library,
                    std::function<void(std::string, std::string)> callback);

                static void ShowDirectoryChooser(
                    musik::core::ILibraryPtr library,
                    std::function<void(std::string)> callback);

                static void ShowIndexer(musik::core::ILibraryPtr library);
        };
    }
}


text:
package demoapp.dom.domain.actions.ActionLayout.promptStyle;

import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.MemberSupport;
import org.apache.causeway.applib.annotation.PromptStyle;
import org.apache.causeway.applib.annotation.SemanticsOf;

import lombok.RequiredArgsConstructor;

//tag::class[]
@Action(
        semantics = SemanticsOf.IDEMPOTENT
)
@ActionLayout(
        promptStyle = PromptStyle.DIALOG_MODAL,
        named = "Modal",
        describedAs = "promptStyle = MODAL",
        associateWith = "readOnlyProperty1",
        sequence = "2")
@RequiredArgsConstructor
public class ActionLayoutPromptStyleVm_annotatedModal {

    private final ActionLayoutPromptStyleVm stringViewModel;

    @MemberSupport public ActionLayoutPromptStyleVm act(final String newValue) {
        stringViewModel.setReadOnlyProperty1(newValue);
        return stringViewModel;
    }
    @MemberSupport public String default0Act() {
        return stringViewModel.getReadOnlyProperty1();
    }

}
//end::class[]


text:
package com.linecorp.armeria.server;

import static com.linecorp.armeria.server.ClientAddressSource.ofHeader;
import static org.assertj.core.api.Assertions.assertThat;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;

import org.junit.jupiter.api.Test;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;

import com.linecorp.armeria.common.HttpHeaderNames;
import com.linecorp.armeria.common.HttpHeaders;
import com.linecorp.armeria.common.annotation.Nullable;

class HttpHeaderUtilTest {

    private static final Predicate<InetAddress> ACCEPT_ANY = addr -> true;

    final InetSocketAddress remoteAddr = new InetSocketAddress("11.0.0.1", 0);

    @Test
    void getAddress_Forwarded() throws UnknownHostException {
        // IPv4
        assertThat(forwarded("for=192.0.2.60;proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("192.0.2.60", 0),
                                 new InetSocketAddress("192.0.2.61", 0));

        // IPv4 with a port number
        assertThat(forwarded("for=192.0.2.60:4711;proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("192.0.2.60", 4711),
                                 new InetSocketAddress("192.0.2.61", 0));

        // IPv6
        assertThat(forwarded("for=\"[2001:db8:cafe::17]\";proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 0),
                                 new InetSocketAddress("192.0.2.61", 0));

        // IPv6 with a port number
        assertThat(forwarded("for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("192.0.2.61", 0));

        // No "for" parameter in the first value.
        assertThat(forwarded("proto=http," +
                             "for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("192.0.2.61", 0));

        // The format of the first value is invalid.
        assertThat(forwarded("for=\"[2001:db8:cafe::," +
                             "for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("192.0.2.61", 0));

        // A obfuscated identifier
        assertThat(forwarded("for=_superhost;proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("192.0.2.61", 0));

        // The unknown identifier
        assertThat(forwarded("for=unknown;proto=http;by=203.0.113.43,for=192.0.2.61"))
                .containsExactly(new InetSocketAddress("192.0.2.61", 0));
    }

    @Nullable
    private static List<InetSocketAddress> forwarded(String value) {
        return getAllValidAddresses(value, HttpHeaderUtil.FORWARDED_CONVERTER, ACCEPT_ANY);
    }

    @Nullable
    private static List<InetSocketAddress> forwarded(String value, Predicate<InetAddress> clientAddressFilter) {
        return getAllValidAddresses(value, HttpHeaderUtil.FORWARDED_CONVERTER, clientAddressFilter);
    }

    @Nullable
    private static List<InetSocketAddress> getAllValidAddresses(
            String value, Function<String, String> valueConverter, Predicate<InetAddress> clientAddressFilter) {
        final Builder<InetSocketAddress> builder = ImmutableList.builder();
        HttpHeaderUtil.getAllValidAddress(value, valueConverter, clientAddressFilter, builder);
        return builder.build();
    }

    @Test
    void getAddress_X_Forwarded_For() throws UnknownHostException {
        // IPv4
        assertThat(xForwardedFor("192.0.2.60,192.0.2.61,192.0.2.62"))
                .containsExactly(new InetSocketAddress("192.0.2.60", 0),
                                 new InetSocketAddress("192.0.2.61", 0),
                                 new InetSocketAddress("192.0.2.62", 0));

        // IPv4 with a port number
        assertThat(xForwardedFor("192.0.2.60:4711,192.0.2.61:4711,192.0.2.62:4711"))
                .containsExactly(new InetSocketAddress("192.0.2.60", 4711),
                                 new InetSocketAddress("192.0.2.61", 4711),
                                 new InetSocketAddress("192.0.2.62", 4711));

        // IPv6
        assertThat(xForwardedFor("[2001:db8:cafe::17],[2001:db8:cafe::18],[2001:db8:cafe::19]"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 0),
                                 new InetSocketAddress("2001:db8:cafe::18", 0),
                                 new InetSocketAddress("2001:db8:cafe::19", 0));

        // IPv6 with a port number
        assertThat(xForwardedFor("\"[2001:db8:cafe::17]:4711\",[2001:db8:cafe::18]:4711"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("2001:db8:cafe::18", 4711));

        // The format of the first value is invalid.
        assertThat(xForwardedFor("[2001:db8:cafe::,[2001:db8:cafe::17]:4711,[2001:db8:cafe::18]:4711"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("2001:db8:cafe::18", 4711));

        // The following cases are not a part of X-Forwarded-For specifications, but the first element is
        // definitely not valid.
        // A obfuscated identifier
        assertThat(xForwardedFor("_superhost,[2001:db8:cafe::17]:4711,[2001:db8:cafe::18]:4711"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("2001:db8:cafe::18", 4711));

        // The unknown identifier
        assertThat(xForwardedFor("unknown,[2001:db8:cafe::17]:4711,[2001:db8:cafe::18]:4711"))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                 new InetSocketAddress("2001:db8:cafe::18", 4711));
    }

    @Nullable
    private static List<InetSocketAddress> xForwardedFor(String value) {
        return getAllValidAddresses(value, Function.identity(), ACCEPT_ANY);
    }

    @Nullable
    private static List<InetSocketAddress> xForwardedFor(String value,
                                                         Predicate<InetAddress> clientAddressFilter) {
        return getAllValidAddresses(value, Function.identity(), clientAddressFilter);
    }

    @Test
    void testFilter_Forwarded() throws UnknownHostException {
        // All addresses which is not one of site local addresses
        assertThat(forwarded("for=10.0.0.1,for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43",
                             addr -> !addr.isSiteLocalAddress()))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711));

        // All addresses which is one of site local addresses
        assertThat(forwarded(
                "for=10.0.0.1,for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43",
                InetAddress::isSiteLocalAddress))
                .containsExactly(new InetSocketAddress("10.0.0.1", 0));

        // All IPv6 addresses
        assertThat(forwarded(
                "for=10.0.0.1,for=\"[2001:db8:cafe::17]:4711\";proto=http;by=203.0.113.43",
                addr -> addr instanceof Inet6Address))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711));

        // All addresses which is not a loopback
        assertThat(forwarded("for=localhost", addr -> !addr.isLoopbackAddress())).isEmpty();
    }

    @Test
    void testFilter_X_Forwarded_For() throws UnknownHostException {
        // All addresses which is not one of site local addresses
        assertThat(xForwardedFor("10.0.0.1,8.8.8.8", addr -> !addr.isSiteLocalAddress()))
                .containsExactly(new InetSocketAddress("8.8.8.8", 0));

        // All addresses which is not one of site local addresses
        assertThat(xForwardedFor("8.8.8.8,10.0.0.1", InetAddress::isSiteLocalAddress))
                .containsExactly(new InetSocketAddress("10.0.0.1", 0));

        // All IPv6 addresses
        assertThat(xForwardedFor("10.0.0.1,[2001:db8:cafe::17]:4711", addr -> addr instanceof Inet6Address))
                .containsExactly(new InetSocketAddress("2001:db8:cafe::17", 4711));

        // The addresses which is not a loopback
        assertThat(xForwardedFor("localhost", addr -> !addr.isLoopbackAddress())).isEmpty();
    }

    @Test
    void proxiedAddresses_Forwarded() throws UnknownHostException {
        // The first address in Forwarded header.
        final ProxiedAddresses proxiedAddresses = ProxiedAddresses.of(
                new InetSocketAddress("10.0.0.1", 0),
                new InetSocketAddress("10.0.0.2", 0));
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.FORWARDED, "for=10.0.0.1,for=10.0.0.2",
                               HttpHeaderNames.X_FORWARDED_FOR, "10.1.0.2,10.1.0.3"),
                ClientAddressSource.DEFAULT_SOURCES, null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(proxiedAddresses);

        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.FORWARDED, "for=10.0.0.1,for=10.0.0.2"),
                ClientAddressSource.DEFAULT_SOURCES, null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(proxiedAddresses);
    }

    @Test
    void proxiedAddresses_IPv6() throws UnknownHostException {
        final InetSocketAddress remoteAddr = new InetSocketAddress("11.0.0.1", 0);
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.FORWARDED,
                               "for=\"[2001:db8:cafe::17]:4711\",for=[2001:db8:cafe::18]"),
                ClientAddressSource.DEFAULT_SOURCES, null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(ProxiedAddresses.of(new InetSocketAddress("2001:db8:cafe::17", 4711),
                                               new InetSocketAddress("2001:db8:cafe::18", 0)));
    }

    @Test
    void proxiedAddresses_custom_header() {
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.FORWARDED, "for=10.0.0.1,for=10.0.0.2",
                               HttpHeaderNames.X_FORWARDED_FOR, "10.1.0.1,10.1.0.2",
                               HttpHeaderNames.of("x-real-ip"), "10.2.0.1,10.2.0.2:443"),
                ImmutableList.of(
                        ofHeader("x-real-ip"),
                        ofHeader(HttpHeaderNames.FORWARDED),
                        ofHeader(HttpHeaderNames.X_FORWARDED_FOR)),
                null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(ProxiedAddresses.of(new InetSocketAddress("10.2.0.1", 0),
                                               new InetSocketAddress("10.2.0.2", 443)));
    }

    @Test
    void proxiedAddresses_X_Forwarded_For() {
        final ProxiedAddresses proxiedAddresses = ProxiedAddresses.of(
                new InetSocketAddress("10.1.0.1", 80),
                new InetSocketAddress("10.1.0.2", 443));
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.X_FORWARDED_FOR, "10.1.0.1:80,10.1.0.2:443"),
                ClientAddressSource.DEFAULT_SOURCES, null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(proxiedAddresses);

        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(HttpHeaderNames.FORWARDED, "for=10.0.0.1,for=10.0.0.2",
                               HttpHeaderNames.X_FORWARDED_FOR, "10.1.0.1:80,10.1.0.2:443"),
                ImmutableList.of(ofHeader(HttpHeaderNames.X_FORWARDED_FOR)),
                null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(proxiedAddresses);
    }

    @Test
    void proxiedAddress_Proxy_Protocol() {
        final ProxiedAddresses proxiedAddresses = ProxiedAddresses.of(
                new InetSocketAddress("10.2.0.1", 50001),
                new InetSocketAddress("10.2.0.2", 50002));
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(), ClientAddressSource.DEFAULT_SOURCES,
                proxiedAddresses,
                remoteAddr, ACCEPT_ANY))
                .isEqualTo(proxiedAddresses);
    }

    @Test
    void proxiedAddress_no_proxy() {
        assertThat(HttpHeaderUtil.determineProxiedAddresses(
                HttpHeaders.of(), ClientAddressSource.DEFAULT_SOURCES, null, remoteAddr, ACCEPT_ANY))
                .isEqualTo(ProxiedAddresses.of(remoteAddr));
    }
}


text:
#ifndef Py_INTERNAL_PYSTATE_H
#define Py_INTERNAL_PYSTATE_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_BUILD_CORE
#  error "this header requires Py_BUILD_CORE define"
#endif

#include "cpython/initconfig.h"
#include "fileobject.h"
#include "pystate.h"
#include "pythread.h"
#include "sysmodule.h"

#include "pycore_gil.h"   /* _gil_runtime_state  */
#include "pycore_pathconfig.h"
#include "pycore_pymem.h"
#include "pycore_warnings.h"

/* ceval state */

struct _pending_calls {
    int finishing;
    PyThread_type_lock lock;
    /* Request for running pending calls. */
    _Py_atomic_int calls_to_do;
    /* Request for looking at the `async_exc` field of the current
       thread state.
       Guarded by the GIL. */
    int async_exc;
#define NPENDINGCALLS 32
    struct {
        int (*func)(void *);
        void *arg;
    } calls[NPENDINGCALLS];
    int first;
    int last;
};

struct _ceval_runtime_state {
    int recursion_limit;
    /* Records whether tracing is on for any thread.  Counts the number
       of threads for which tstate->c_tracefunc is non-NULL, so if the
       value is 0, we know we don't have to check this thread's
       c_tracefunc.  This speeds up the if statement in
       PyEval_EvalFrameEx() after fast_next_opcode. */
    int tracing_possible;
    /* This single variable consolidates all requests to break out of
       the fast path in the eval loop. */
    _Py_atomic_int eval_breaker;
    /* Request for dropping the GIL */
    _Py_atomic_int gil_drop_request;
    struct _pending_calls pending;
    /* Request for checking signals. */
    _Py_atomic_int signals_pending;
    struct _gil_runtime_state gil;
};

/* interpreter state */

typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int);

// The PyInterpreterState typedef is in Include/pystate.h.
struct _is {

    struct _is *next;
    struct _ts *tstate_head;

    int64_t id;
    int64_t id_refcount;
    int requires_idref;
    PyThread_type_lock id_mutex;

    int finalizing;

    PyObject *modules;
    PyObject *modules_by_index;
    PyObject *sysdict;
    PyObject *builtins;
    PyObject *importlib;

    /* Used in Python/sysmodule.c. */
    int check_interval;

    /* Used in Modules/_threadmodule.c. */
    long num_threads;
    /* Support for runtime thread stack size tuning.
       A value of 0 means using the platform's default stack size
       or the size specified by the THREAD_STACK_SIZE macro. */
    /* Used in Python/thread.c. */
    size_t pythread_stacksize;

    PyObject *codec_search_path;
    PyObject *codec_search_cache;
    PyObject *codec_error_registry;
    int codecs_initialized;

    /* fs_codec.encoding is initialized to NULL.
       Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */
    struct {
        char *encoding;   /* Filesystem encoding (encoded to UTF-8) */
        char *errors;     /* Filesystem errors (encoded to UTF-8) */
        _Py_error_handler error_handler;
    } fs_codec;

    PyConfig config;
#ifdef HAVE_DLOPEN
    int dlopenflags;
#endif

    PyObject *dict;  /* Stores per-interpreter state */

    PyObject *builtins_copy;
    PyObject *import_func;
    /* Initialized to PyEval_EvalFrameDefault(). */
    _PyFrameEvalFunction eval_frame;

    Py_ssize_t co_extra_user_count;
    freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS];

#ifdef HAVE_FORK
    PyObject *before_forkers;
    PyObject *after_forkers_parent;
    PyObject *after_forkers_child;
#endif
    /* AtExit module */
    void (*pyexitfunc)(PyObject *);
    PyObject *pyexitmodule;

    uint64_t tstate_next_unique_id;

    struct _warnings_runtime_state warnings;

    PyObject *audit_hooks;
};

PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T);

PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *);
PyAPI_FUNC(void) _PyInterpreterState_IDIncref(struct _is *);
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *);

/* cross-interpreter data registry */

/* For now we use a global registry of shareable classes.  An
   alternative would be to add a tp_* slot for a class's
   crossinterpdatafunc. It would be simpler and more efficient. */

struct _xidregitem;

struct _xidregitem {
    PyTypeObject *cls;
    crossinterpdatafunc getdata;
    struct _xidregitem *next;
};

/* runtime audit hook state */

typedef struct _Py_AuditHookEntry {
    struct _Py_AuditHookEntry *next;
    Py_AuditHookFunction hookCFunction;
    void *userData;
} _Py_AuditHookEntry;

/* GIL state */

struct _gilstate_runtime_state {
    int check_enabled;
    /* Assuming the current thread holds the GIL, this is the
       PyThreadState for the current thread. */
    _Py_atomic_address tstate_current;
    PyThreadFrameGetter getframe;
    /* The single PyInterpreterState used by this process'
       GILState implementation
    */
    /* TODO: Given interp_main, it may be possible to kill this ref */
    PyInterpreterState *autoInterpreterState;
    Py_tss_t autoTSSkey;
};

/* hook for PyEval_GetFrame(), requested for Psyco */
#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe

/* Issue #26558: Flag to disable PyGILState_Check().
   If set to non-zero, PyGILState_Check() always return 1. */
#define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled

/* Full Python runtime state */

typedef struct pyruntimestate {
    /* Is running Py_PreInitialize()? */
    int preinitializing;

    /* Is Python preinitialized? Set to 1 by Py_PreInitialize() */
    int preinitialized;

    /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */
    int core_initialized;

    /* Is Python fully initialized? Set to 1 by Py_Initialize() */
    int initialized;

    /* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize()
       is called again. */
    PyThreadState *finalizing;

    struct pyinterpreters {
        PyThread_type_lock mutex;
        PyInterpreterState *head;
        PyInterpreterState *main;
        /* _next_interp_id is an auto-numbered sequence of small
           integers.  It gets initialized in _PyInterpreterState_Init(),
           which is called in Py_Initialize(), and used in
           PyInterpreterState_New().  A negative interpreter ID
           indicates an error occurred.  The main interpreter will
           always have an ID of 0.  Overflow results in a RuntimeError.
           If that becomes a problem later then we can adjust, e.g. by
           using a Python int. */
        int64_t next_id;
    } interpreters;
    // XXX Remove this field once we have a tp_* slot.
    struct _xidregistry {
        PyThread_type_lock mutex;
        struct _xidregitem *head;
    } xidregistry;

    unsigned long main_thread;

#define NEXITFUNCS 32
    void (*exitfuncs[NEXITFUNCS])(void);
    int nexitfuncs;

    struct _gc_runtime_state gc;
    struct _ceval_runtime_state ceval;
    struct _gilstate_runtime_state gilstate;

    PyPreConfig preconfig;

    Py_OpenCodeHookFunction open_code_hook;
    void *open_code_userdata;
    _Py_AuditHookEntry *audit_hook_head;

    // XXX Consolidate globals found via the check-c-globals script.
} _PyRuntimeState;

#define _PyRuntimeState_INIT \
    {.preinitialized = 0, .core_initialized = 0, .initialized = 0}
/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */

PyAPI_DATA(_PyRuntimeState) _PyRuntime;
PyAPI_FUNC(PyStatus) _PyRuntimeState_Init(_PyRuntimeState *runtime);
PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime);
PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);

/* Initialize _PyRuntimeState.
   Return NULL on success, or return an error message on failure. */
PyAPI_FUNC(PyStatus) _PyRuntime_Initialize(void);

PyAPI_FUNC(void) _PyRuntime_Finalize(void);

#define _Py_CURRENTLY_FINALIZING(runtime, tstate) \
    (runtime->finalizing == tstate)

/* Variable and macro for in-line access to current thread
   and interpreter state */

#define _PyRuntimeState_GetThreadState(runtime) \
    ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current))

/* Get the current Python thread state.

   Efficient macro reading directly the 'gilstate.tstate_current' atomic
   variable. The macro is unsafe: it does not check for error and it can
   return NULL.

   The caller must hold the GIL.

   See also PyThreadState_Get() and PyThreadState_GET(). */
#define _PyThreadState_GET() _PyRuntimeState_GetThreadState(&_PyRuntime)

/* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */
#undef PyThreadState_GET
#define PyThreadState_GET() _PyThreadState_GET()

/* Get the current interpreter state.

   The macro is unsafe: it does not check for error and it can return NULL.

   The caller must hold the GIL.

   See also _PyInterpreterState_Get()
   and _PyGILState_GetInterpreterStateUnsafe(). */
#define _PyInterpreterState_GET_UNSAFE() (_PyThreadState_GET()->interp)

/* Other */

PyAPI_FUNC(void) _PyThreadState_Init(
    _PyRuntimeState *runtime,
    PyThreadState *tstate);
PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
    _PyRuntimeState *runtime,
    PyThreadState *tstate);

PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap(
    struct _gilstate_runtime_state *gilstate,
    PyThreadState *newts);

PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime);
PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);

PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime);

#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_PYSTATE_H */