text:
module GroupsHelper
  def can_change_group_visibility_level?(group)
    can?(current_user, :change_visibility_level, group)
  end

  def group_icon(group)
    if group.is_a?(String)
      group = Group.find_by_full_path(group)
    end

    group.try(:avatar_url) || image_path('no_group_avatar.png')
  end

  def group_title(group, name = nil, url = nil)
    full_title = ''

    group.ancestors.each do |parent|
      full_title += link_to(simple_sanitize(parent.name), group_path(parent))
      full_title += ' / '.html_safe
    end

    full_title += link_to(simple_sanitize(group.name), group_path(group))
    full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name

    content_tag :span do
      full_title.html_safe
    end
  end

  def projects_lfs_status(group)
    lfs_status =
      if group.lfs_enabled?
        group.projects.select(&:lfs_enabled?).size
      else
        group.projects.reject(&:lfs_enabled?).size
      end

    size = group.projects.size

    if lfs_status == size
      'for all projects'
    else
      "for #{lfs_status} out of #{pluralize(size, 'project')}"
    end
  end

  def group_lfs_status(group)
    status = group.lfs_enabled? ? 'enabled' : 'disabled'

    content_tag(:span, class: "lfs-#{status}") do
      "#{status.humanize} #{projects_lfs_status(group)}"
    end
  end

  def group_issues(group)
    IssuesFinder.new(current_user, group_id: group.id).execute
  end
end


text:
metal.ns('metal.ui.ButtonBar');
/**
 * Button Bar
 *
 * @class metal.ui.ButtonBar
 * @author Amir Lazarovich
 * @version 0.1
 */
metal.ui.ButtonBar = metal.extend(metal.ui.AbstractView, {

	type: 'MetalButtonBar',

	/**
 	* Holds all this view's properties
 	*
 	* @property {Object} properties
 	*/
	properties : {
		/**
 		* The id of this window
 		*
 		* @private
 		* @property {String} id
 		*/
		id: 'MetalButtonBar_' + metal.generateId(),

		/**
	 	*
the selected index

	 	*
	 	* @property {int} index
	 	*/
		index: undefined,

		/**
	 	*
the array of labels for the button bar. each object should have the properties <tt>title</tt>, <tt>image</tt>, <tt>width</tt> and <tt>enabled</tt>.

	 	*
	 	* @property {array} labels
	 	*/
		labels: undefined,

		/**
	 	*
the style of the button bar

	 	*
	 	* @property {int} style
	 	*/
		style: undefined

	},

	/**
 	* The Titanium view this class wraps
 	*
 	* @property {Titanium.UI.View} component
 	*/
	component: undefined,

	/**
 	* @constructor
 	*/
	constructor: function(config) {
		metal.overrideClass(this, config);
		dlog('ButtonBar::' + this.get('id'), 'constructor');

		// Set native component
		this.component = Ti.UI.createButtonBar(metal.formatProperties(this.properties));

		// Call parent constructor
		metal.ui.ButtonBar.superclass.constructor.call(this);
	}
});

redpajama_set_name: RedPajamaGithub


text:
package com.google.javascript.jscomp;

import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.collect.Lists;
import com.google.javascript.jscomp.ReferenceCollectingCallback.Behavior;
import com.google.javascript.jscomp.ReferenceCollectingCallback.Reference;
import com.google.javascript.jscomp.ReferenceCollectingCallback.ReferenceCollection;
import com.google.javascript.jscomp.ReferenceCollectingCallback.ReferenceMap;
import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Using the infrastructure provided by {@link ReferenceCollectingCallback},
 * identify variables that are only ever assigned to object literals
 * and that are never used in entirety, and expand the objects into
 * individual variables.
 *
 * Based on the InlineVariables pass
 *
 */
class InlineObjectLiterals implements CompilerPass {

  public static final String VAR_PREFIX = "JSCompiler_object_inline_";

  private final AbstractCompiler compiler;

  private final Supplier<String> safeNameIdSupplier;

  InlineObjectLiterals(
      AbstractCompiler compiler,
      Supplier<String> safeNameIdSupplier) {
    this.compiler = compiler;
    this.safeNameIdSupplier = safeNameIdSupplier;
  }

  @Override
  public void process(Node externs, Node root) {
    ReferenceCollectingCallback callback = new ReferenceCollectingCallback(
        compiler, new InliningBehavior());
    callback.process(externs, root);
  }

  /**
   * Builds up information about nodes in each scope. When exiting the
   * scope, inspects all variables in that scope, and inlines any
   * that we can.
   */
  private class InliningBehavior implements Behavior {

    /**
     * A list of variables that should not be inlined, because their
     * reference information is out of sync with the state of the AST.
     */
    private final Set<Var> staleVars = new HashSet<>();

    @Override
    public void afterExitScope(NodeTraversal t, ReferenceMap referenceMap) {
      for (Iterator<Var> it = t.getScope().getVars(); it.hasNext();) {
        Var v = it.next();

        if (isVarInlineForbidden(v)) {
          continue;
        }

        ReferenceCollection referenceInfo = referenceMap.getReferences(v);

        if (isInlinableObject(referenceInfo.references)) {
          // Blacklist the object itself, as well as any other values
          // that it refers to, since they will have been moved around.
          staleVars.add(v);

          Reference init = referenceInfo.getInitializingReference();

          // Split up the object into individual variables if the object
          // is never referenced directly in full.
          splitObject(v, init, referenceInfo);
        }
      }
    }

    /**
     * If there are any variable references in the given node tree,
     * blacklist them to prevent the pass from trying to inline the
     * variable. Any code modifications will have potentially made the
     * ReferenceCollection invalid.
     */
    private void blacklistVarReferencesInTree(Node root, final Scope scope) {
      NodeUtil.visitPreOrder(root, new NodeUtil.Visitor() {
        @Override
        public void visit(Node node) {
          if (node.isName()) {
            staleVars.add(scope.getVar(node.getString()));
          }
        }
      }, NodeUtil.MATCH_NOT_FUNCTION);
    }

    /**
     * Whether the given variable is forbidden from being inlined.
     */
    private boolean isVarInlineForbidden(Var var) {
      // A variable may not be inlined if:
      // 1) The variable is defined in the externs
      // 2) The variable is exported,
      // 3) Don't inline the special RENAME_PROPERTY_FUNCTION_NAME
      // 4) A reference to the variable has been inlined. We're downstream
      //    of the mechanism that creates variable references, so we don't
      //    have a good way to update the reference. Just punt on it.

      // Additionally, exclude global variables for now.

      return var.isGlobal()
          || var.isExtern()
          || compiler.getCodingConvention().isExported(var.name)
          || RenameProperties.RENAME_PROPERTY_FUNCTION_NAME.equals(var.name)
          || staleVars.contains(var);
    }

    /**
     * Counts the number of direct (full) references to an object.
     * Specifically, we check for references of the following type:
     * <pre>
     *   x;
     *   x.fn();
     * </pre>
     */
    private boolean isInlinableObject(List<Reference> refs) {
      boolean ret = false;
      Set<String> validProperties = new HashSet<>();
      for (Reference ref : refs) {
        Node name = ref.getNode();
        Node parent = ref.getParent();
        Node grandparent = ref.getGrandparent();

        // Ignore most indirect references, like x.y (but not x.y(),
        // since the function referenced by y might reference 'this').
        //
        if (parent.isGetProp()) {
          Preconditions.checkState(parent.getFirstChild() == name);
          // A call target may be using the object as a 'this' value.
          if (grandparent.isCall()
              && grandparent.getFirstChild() == parent) {
            return false;
          }

          // Deleting a property has different semantics from deleting
          // a variable, so deleted properties should not be inlined.
          if (grandparent.isDelProp()) {
            return false;
          }

          // NOTE(nicksantos): This pass's object-splitting algorithm has
          // a blind spot. It assumes that if a property isn't defined on an
          // object, then the value is undefined. This is not true, because
          // Object.prototype can have arbitrary properties on it.
          //
          // We short-circuit this problem by bailing out if we see a reference
          // to a property that isn't defined on the object literal. This
          // isn't a perfect algorithm, but it should catch most cases.
          String propName = parent.getLastChild().getString();
          if (!validProperties.contains(propName)) {
            if (NodeUtil.isVarOrSimpleAssignLhs(parent, grandparent)) {
              validProperties.add(propName);
            } else {
              return false;
            }
          }
          continue;
        }

        // Only rewrite VAR declarations or simple assignment statements
        if (!isVarOrAssignExprLhs(name)) {
           return false;
        }

        Node val = ref.getAssignedValue();
        if (val == null) {
          // A var with no assignment.
          continue;
        }

        // We're looking for object literal assignments only.
        if (!val.isObjectLit()) {
          return false;
        }

        // Make sure that the value is not self-referential. IOW,
        // disallow things like x = {b: x.a}.
        //
        // TODO(dimvar): Only exclude unorderable self-referential
        // assignments. i.e. x = {a: x.b, b: x.a} is not orderable,
        // but x = {a: 1, b: x.a} is.
        //
        // Also, ES5 getters/setters aren't handled by this pass.
        for (Node child = val.getFirstChild(); child != null;
             child = child.getNext()) {
          if (child.isGetterDef() ||
              child.isSetterDef()) {
            // ES5 get/set not supported.
            return false;
          }

          validProperties.add(child.getString());

          Node childVal = child.getFirstChild();
          // Check if childVal is the parent of any of the passed in
          // references, as that is how self-referential assignments
          // will happen.
          for (Reference t : refs) {
            Node refNode = t.getParent();
            while (!NodeUtil.isStatementBlock(refNode)) {
              if (refNode == childVal) {
                // There's a self-referential assignment
                return false;
              }
              refNode = refNode.getParent();
            }
          }
        }

        // We have found an acceptable object literal assignment. As
        // long as there are no other assignments that mess things up,
        // we can inline.
        ret = true;
      }
      return ret;
    }

    private boolean isVarOrAssignExprLhs(Node n) {
      Node parent = n.getParent();
      return parent.isVar() ||
          (parent.isAssign()
              && parent.getFirstChild() == n
              && parent.getParent().isExprResult());
    }

    /**
     * Computes a list of ever-referenced keys in the object being
     * inlined, and returns a mapping of key name -> generated
     * variable name.
     */
    private Map<String, String> computeVarList(
        ReferenceCollection referenceInfo) {
      Map<String, String> varmap = new LinkedHashMap<>();

      for (Reference ref : referenceInfo.references) {
        if (ref.isLvalue() || ref.isInitializingDeclaration()) {
          Node val = ref.getAssignedValue();
          if (val != null) {
            Preconditions.checkState(val.isObjectLit());
            for (Node child = val.getFirstChild(); child != null;
                 child = child.getNext()) {
              String varname = child.getString();
              if (varmap.containsKey(varname)) {
                continue;
              }

              String var = VAR_PREFIX + varname + "_" +
                safeNameIdSupplier.get();
              varmap.put(varname, var);
            }
          }
        } else if (ref.getParent().isVar()) {
          // This is the var. There is no value.
        } else {
          Node getprop = ref.getParent();
          Preconditions.checkState(getprop.isGetProp());

          // The key being looked up in the original map.
          String varname = getprop.getLastChild().getString();
          if (varmap.containsKey(varname)) {
            continue;
          }

          String var = VAR_PREFIX + varname + "_" + safeNameIdSupplier.get();
          varmap.put(varname, var);
        }
      }

      return varmap;
    }

    /**
     * Populates a map of key names -> initial assigned values. The
     * object literal these are being pulled from is invalidated as
     * a result.
     */
    private void fillInitialValues(Reference init, Map<String, Node> initvals) {
      Node object = init.getAssignedValue();
      Preconditions.checkState(object.isObjectLit());
      for (Node key = object.getFirstChild(); key != null;
           key = key.getNext()) {
        initvals.put(key.getString(), key.removeFirstChild());
      }
    }

    /**
     * Replaces an assignment like x = {...} with t1=a,t2=b,t3=c,true.
     * Note that the resulting expression will always evaluate to
     * true, as would the x = {...} expression.
     */
    private void replaceAssignmentExpression(Var v, Reference ref,
                                             Map<String, String> varmap) {
      // Compute all of the assignments necessary
      List<Node> nodes = new ArrayList<>();
      Node val = ref.getAssignedValue();
      blacklistVarReferencesInTree(val, v.scope);
      Preconditions.checkState(val.isObjectLit());
      Set<String> all = new LinkedHashSet<>(varmap.keySet());
      for (Node key = val.getFirstChild(); key != null;
           key = key.getNext()) {
        String var = key.getString();
        Node value = key.removeFirstChild();
        // TODO(user): Copy type information.
        nodes.add(
            IR.assign(
                IR.name(varmap.get(var)),
                value));
        all.remove(var);
      }

      // TODO(user): Better source information.
      for (String var : all) {
        nodes.add(
            IR.assign(
                IR.name(varmap.get(var)),
                NodeUtil.newUndefinedNode(null)));
      }

      Node replacement;
      if (nodes.isEmpty()) {
        replacement = IR.trueNode();
      } else {
        // All assignments evaluate to true, so make sure that the
        // expr statement evaluates to true in case it matters.
        nodes.add(IR.trueNode());

        // Join these using COMMA.  A COMMA node must have 2 children, so we
        // create a tree. In the tree the first child be the COMMA to match
        // the parser, otherwise tree equality tests fail.
        nodes = Lists.reverse(nodes);
        replacement = new Node(Token.COMMA);
        Node cur = replacement;
        int i;
        for (i = 0; i < nodes.size() - 2; i++) {
          cur.addChildToFront(nodes.get(i));
          Node t = new Node(Token.COMMA);
          cur.addChildToFront(t);
          cur = t;
        }
        cur.addChildToFront(nodes.get(i));
        cur.addChildToFront(nodes.get(i + 1));
      }

      Node replace = ref.getParent();
      replacement.useSourceInfoIfMissingFromForTree(replace);

      if (replace.isVar()) {
        replace.getParent().replaceChild(
            replace, NodeUtil.newExpr(replacement));
      } else {
        replace.getParent().replaceChild(replace, replacement);
      }
    }

    /**
     * Splits up the object literal into individual variables, and
     * updates all uses.
     */
    private void splitObject(Var v, Reference init,
                             ReferenceCollection referenceInfo) {
      // First figure out the FULL set of possible keys, so that they
      // can all be properly set as necessary.
      Map<String, String> varmap = computeVarList(referenceInfo);

      Map<String, Node> initvals = new HashMap<>();
      // Figure out the top-level of the var assign node. If it's a plain
      // ASSIGN, then there's an EXPR_STATEMENT above it, if it's a
      // VAR then it should be directly replaced.
      Node vnode;
      boolean defined = referenceInfo.isWellDefined() &&
          init.getParent().isVar();
      if (defined) {
        vnode = init.getParent();
        fillInitialValues(init, initvals);
      } else {
        // TODO(user): More test / rewrite this part.
        // Find the beginning of the function / script.
        vnode = v.getScope().getRootNode().getLastChild().getFirstChild();
      }

      for (Map.Entry<String, String> entry : varmap.entrySet()) {
        Node val = initvals.get(entry.getKey());
        Node varnode = NodeUtil.newVarNode(entry.getValue(), val);
        if (val == null) {
          // is this right?
          varnode.useSourceInfoIfMissingFromForTree(vnode);
        } else {
          blacklistVarReferencesInTree(val, v.scope);
        }
        vnode.getParent().addChildBefore(varnode, vnode);
        compiler.reportChangeToEnclosingScope(vnode);
      }

      if (defined) {
        vnode.getParent().removeChild(vnode);
      }

      for (Reference ref : referenceInfo.references) {
        compiler.reportChangeToEnclosingScope(ref.getNode());
        // The init/decl have already been converted.
        if (defined && ref == init) {
          continue;
        }

        if (ref.isLvalue()) {
          // Assignments have to be handled specially, since they
          // expand out into multiple assignments.
          replaceAssignmentExpression(v, ref, varmap);
        } else if (ref.getParent().isVar()) {
          // The old variable declaration. It didn't have a
          // value. Remove it entirely as it should now be unused.
          ref.getGrandparent().removeChild(ref.getParent());
        } else {
          // Make sure that the reference is a GETPROP as we expect it to be.
          Node getprop = ref.getParent();
          Preconditions.checkState(getprop.isGetProp());

          // The key being looked up in the original map.
          String var = getprop.getSecondChild().getString();

          // If the variable hasn't already been declared, add an empty
          // declaration near all the other declarations.
          Preconditions.checkState(varmap.containsKey(var));

          // Replace the GETPROP node with a NAME.
          Node replacement = IR.name(varmap.get(var));
          replacement.useSourceInfoIfMissingFrom(getprop);
          ref.getGrandparent().replaceChild(ref.getParent(), replacement);
        }
      }
    }
  }
}


text:
from pprint import pformat
import re
import types

### required - do no delete
def user(): return dict(form=auth())
def download(): return response.download(request,db)
def call(): return service()
### end requires

def error():
    return dict()

def index():
    tree_selector, selector_by_uuid = sloelib_get_tree_selector('final')
    return dict(
        tree_selector=tree_selector,
        selector_by_uuid=selector_by_uuid
    )

def yt():
    if len(request.args) < 1:
        redirect(URL('index'))
    req_uuid, is_valid = sloe_condition_uuid(request.args[0])
    if not is_valid:
        raise HTTP(404, "Cannot decode UUID from %s
%s" % (XML(request.args[0], sanitize=True), A("Home", _href=URL('index'))))
    redirect(URL('video', req_uuid, host=True, scheme=True))

def viewitem():
    if len(request.args) < 1:
        redirect(URL('index'))
    req_uuid, is_valid = sloe_condition_uuid(request.args[0])
    item = sloelib_get_item(req_uuid)
    if not item:
        raise HTTP(404, "Nothing found for UUID %s
%s" % (XML(req_uuid, sanitize=True), A("Home", _href=URL('index'))))
    return dict(item=Storage(item.as_dict()))

def __videoelement():
    size_errors = []

    # For sizes, URL vars override the session but don't overwrite it
    if not session.video_sizes:
        session.video_sizes = {}

    if 0 in session.video_sizes:
        width, height = session.video_sizes[0]
    else:
        width, height = 1280, 720

    if request.vars.size:
        match = re.match(r'(\d+)x(\d+)$', str(request.vars.size))
        if match:
            width, height = int(match.group(1)), int(match.group(2))
        else:
            size_errors.append(T("Cannot decode size element in URL - must be in the form 123x456"))

    size_form, size_script = oar_video_size_form((width, height))

    if size_form.process(formname='sizeform', keepvalues=True, onsuccess=None).accepted:
        match = re.match(r'(\d+)x(\d+)$', size_form.vars.sizecombo)
        if not match:
            size_errors.append(T("Cannot decode size - must be in the form 123x456"))
        else:
            width, height = int(match.group(1)), int(match.group(2))
            session.video_sizes[0] = width, height

    elif size_form.errors:
        size_errors.append(T("Size form error"))

    width = max(0, min(width, 10000))
    height = max(0, min(height, 10000))

    if size_errors:
        session.flash += ". ".join([str(x) for x in size_errors])

    link_form, link_script = oar_link_form()

    return dict(height=height,
                link_form=link_form,
                link_script=link_script,
                size_form=size_form,
                size_script=size_script,
                width=width)

def __get_markers():
    # If there are markers in the request then ignore all markers in the session
    markers = {}
    marker_regexp_key = re.compile(r'(C|E)\d+$')
    marker_regexp_value = re.compile(r'[-0-9.]+$')
    for key, value in request.vars.iteritems():
        if marker_regexp_key.match(str(key)) and isinstance(value, types.StringType) and marker_regexp_value.match(value):
            markers[key]=float(value)

    if not markers and session.current_selection:
        session_key = 'markers_%s' % session.current_selection
        for key, value in session.get(session_key, {}).iteritems():
            if marker_regexp_key.match(key) and marker_regexp_value.match(value):
                markers[key]=float(value)

    return markers

def video():
    sloe_process_singlevid_request()
    elements = __videoelement()
    elements.update(select())
    elements['browser'] = request.user_agent().browser.name.lower()
    elements['markers'] = __get_markers()

    return elements

def select():
    select_errors = []

    selector_form, selector_script = oar_selector_form(session.current_selection)

    if selector_form.process(formname='treeselector_form', keepvalues=True, onsuccess=None).accepted:
        if sloe_verify_uuid(selector_form.vars.treeselector_items):
            redirect(URL(args=[selector_form.vars.treeselector_items]))
    elif selector_form.errors:
        select_errors.append(T("Selector form error"))

    if select_errors:
        session.flash += ". ".join([str(x) for x in select_errors])

    if session.current_selection:
        fii = sloelib_get_final_item_info(session.current_selection)
        if len(fii.remote_items) == 1:
            response.title = fii.remote_items[0].title.replace(' [oarstack]', '')
        link_args=[session.current_selection]
    else:
        fii = Storage()
        link_args=[]

    if fii.filesize:
        size_str = "%.1fMB" % (float(fii.filesize) / 2**20)
    else:
        size_str = None

    # vi is video information, for videos without a final item
    vi = Storage(
        fps=fii.fps or '29.97',
        size_str=size_str,
        speed_factor=fii.speed_factor or '1'
    )

    return dict(
        fii=fii,
        link_args=link_args,
        selector_form=selector_form,
        selector_script=selector_script,
        vi=vi
    )

def treeselectoritems():
    tree_selector, selector_by_uuid = sloelib_get_tree_selector('final')
    tree_selected = "/".join(request.args)
    tree_entries = [x[1] for x in tree_selector if x[0] == tree_selected]
    item_entries=[{'menutitle': 'Select', 'uuid': ''}] + sorted(tree_entries[0])
    return dict(
        current_item_uuid = session.current_selection or '',
        item_entries=item_entries
    )

def debuginfoframe():
    if session.current_selection:
        fii = sloelib_get_final_item_info(session.current_selection)
        link_args=[session.current_selection]
    else:
        fii = Storage()
        link_args=[]

    return dict(
        fii=fii,
        link_args=link_args
    )


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Sr. Design 2015: C:/Users/Benjaminp/Documents/GitHub/firmware.X/src/powerman.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Sr. Design 2015

Solar Powered light

Main Page

Related Pages

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

powerman.c

Go to the documentation of this file.

    1

    6 #include <powerman.h>                         //PIC hardware mapping

    7 #include <eeprom.h>                           //eeprom memory

    8 #include <math.h>

    9 #include <lcd.h>

   10 #include <hid.h>

   11

   12 void power_setup(void)

   13 {

   14     TRISAbits.TRISA4 = 0;   // RA4 set as output to relay

   15     TRISAbits.TRISA5 = 1;   // battery input

   16     LATAbits.LATA4=0;         //output initially set to zero

   17 }

   18

   19

   20

   21 //check battery level using adc converter

   22 void power_loop(void)        //Power switch depending on battery level

   23 {

   24     double battvolt;

   25     unsigned int rawbat;

   26     unsigned char set;

   27     static unsigned errored = 0;

   28     set = (setting_bits1 & 0b00110000) >> 4;

   29     rawbat = adc_read(ANBATT);

   30

   31 //KEEP IN MIND: VOLTAGE DIVIDER!!!!

   33     if((battvolt < 2.0)  && ((set == 1) || (set == 3)))     //turns battery off if voltage too low

   34     {

   35         LATAbits.LATA4 = 0;            //This will change the relay to AC power.

   36     }

   37     else if((battvolt > 2.3) && (set > 1))      //turns battery on if voltage too high or forced

   38     {

   39         LATAbits.LATA4 = 1;            //This will the turn the AC power off.

   40     }

   41

   42     if((battvolt < 0.6) && (battvolt > 0.2)) // error when low but there is a battery

   43     {

   44         if(errored == 0)

   45         {

   46             mem_append_log(ERR_BATTLOW);

   47             errored = 1;

   48         }

   49     }

   50

   51 }

   52

   53

ANBATT

#define ANBATT

Definition: shared.h:26

hid.h

setting_bits1

unsigned char setting_bits1

Definition: eeprom.h:37

power_setup

void power_setup(void)

Definition: powerman.c:12

mem_append_log

unsigned char mem_append_log(unsigned char)

saves an event to the log space.

Definition: eeprom.c:41

ERR_BATTLOW

#define ERR_BATTLOW

Definition: eeprom.h:14

eeprom.h

power_loop

void power_loop(void)

Definition: powerman.c:22

lcd.h

powerman.h

adc_read

unsigned int adc_read(unsigned char)

Read adc value out of the ADC buffer for the passed channel.

Definition: shared.c:32

src

powerman.c

Generated on Thu Apr 23 2015 21:58:23 for Sr. Design 2015 by

     1.8.9.1


text:
from ._marketplace_ordering_agreements import MarketplaceOrderingAgreements

try:
    from ._patch import __all__ as _patch_all
    from ._patch import *  # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
    _patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
    "MarketplaceOrderingAgreements",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()


text:
<?php

$configPath = dirname(realpath(__FILE__)) . "/";

// Define some useful constants
define('BASE_PATH', dirname($configPath));
define('PUBLIC_PATH', BASE_PATH . '/www/');
define('APP_PATH', BASE_PATH . '/app/');


text:
(function() {
    'use strict';

    angular.module('myApp.header')

        // Controller
        .controller(
        	"HeaderController",
        	function(
        		$scope,
                myAuthService

        	){
	            // Expose logout function
                $scope.logout = function() {
                    myAuthService.logout();

            	}

                $scope.user = myAuthService.getUser();
        	}
        );
})();


text:
function feature = feature_BK_bool_lelbow_kinEnergy(mot)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Feature value 0: if kinetic Energy is smaller then treshold
% Feature value 1: otherwise
%
% author: Björn Krüger (kruegerb@cs.uni-bonn.de)

global VARS_GLOBAL;
treshold=VARS_GLOBAL.treshold;
feature=BK_calc_dyn_feature(mot,'lelbow_E_kin','singleTresholdAdaptive',treshold);


text:
actions :create, :delete
default_action :create

attribute :subsystem_name, name_attribute: true, kind_of: String
attribute :subsystem_synonym, kind_of: String
attribute :subsystem_group, kind_of: String
attribute :program, kind_of: String, required: true
attribute :arguments, kind_of: [String, Array]
attribute :standard_output, kind_of: String
attribute :standard_input, kind_of: String
attribute :standard_error, kind_of: String
attribute :user, kind_of: String, default: 'root'

attr_accessor :enabled


text:
namespace Poco {

class Foundation_API MutexImpl
{
protected:
	MutexImpl();
	~MutexImpl();
	void lockImpl();
	bool tryLockImpl();
	bool tryLockImpl(long milliseconds);
	void unlockImpl();

private:
	HANDLE _mutex;
};

typedef MutexImpl FastMutexImpl;

} // namespace Poco

#endif // Foundation_Mutex_WINCE_INCLUDED


text:
"""Base class for "type-aware" (sharded) document storage. This goes beyond simple subclasses
like PhylesystemProxy by introducing more business rules and differences between document types
in the store (eg, Nexson studies in Phylesystem, tree collections in TreeCollectionStore)."""
import os

try:
    # noinspection PyCompatibility
    from cStringIO import StringIO
except ImportError:
    from io import StringIO
import json

try:
    import anyjson
except:
    class Wrapper(object):
        pass

    anyjson = Wrapper()
    anyjson.loads = json.loads
from peyotl.git_storage import ShardedDocStore
from peyotl.git_storage.git_shard import FailedShardCreationError
from peyotl.utility import get_logger

_LOG = get_logger(__name__)

class TypeAwareDocStore(ShardedDocStore):
    def __init__(self,
                 prefix_from_doc_id,
                 repos_dict=None,
                 repos_par=None,
                 with_caching=True,
                 assumed_doc_version=None,
                 git_ssh=None,
                 pkey=None,
                 git_action_class=None,  # requires a *type-specific* GitActionBase subclass
                 git_shard_class=None,  # requires a *type-specific* GitShard subclass
                 mirror_info=None,
                 new_doc_prefix=None,
                 infrastructure_commit_author='OpenTree API <api@opentreeoflife.org>',
                 **kwargs):
        """
        Repos can be found by passing in a `repos_par` (a directory that is the parent of the repos)
            or by trusting the `repos_dict` mapping of name to repo filepath.
        `prefix_from_doc_id` should be a type-specific method defined in the subclass
        `with_caching` should be True for non-debugging uses.
        `assumed_doc_version` is optional. If specified all shard repos are assumed to store
            files of this version of the primary document syntax.
        `git_ssh` is the path of an executable for git-ssh operations.
        `pkey` is the PKEY that has to be in the env for remote, authenticated operations to work
        `git_action_class` is a subclass of GitActionBase to use. the __init__ syntax must be compatible
            with PhylesystemGitAction
        If you want to use a mirrors of the repo for pushes or pulls, send in a `mirror_info` dict:
            mirror_info['push'] and mirror_info['pull'] should be dicts with the following keys:
            'parent_dir' - the parent directory of the mirrored repos
            'remote_map' - a dictionary of remote name to prefix (the repo name + '.git' will be
                appended to create the URL for pushing).
        """
        from peyotl.phylesystem.helper import get_repos, _get_phylesystem_parent_with_source
        ShardedDocStore.__init__(self,
                                 prefix_from_doc_id=prefix_from_doc_id)
        self.assumed_doc_version = assumed_doc_version
        if repos_dict is not None:
            self._filepath_args = 'repos_dict = {}'.format(repr(repos_dict))
        elif repos_par is not None:
            self._filepath_args = 'repos_par = {}'.format(repr(repos_par))
        else:
            fmt = '<No arg> default phylesystem_parent from {}'
            a = _get_phylesystem_parent_with_source(**kwargs)[1]
            self._filepath_args = fmt.format(a)
        push_mirror_repos_par = None
        push_mirror_remote_map = {}
        if mirror_info:
            push_mirror_info = mirror_info.get('push', {})
            if push_mirror_info:
                push_mirror_repos_par = push_mirror_info['parent_dir']
                push_mirror_remote_map = push_mirror_info.get('remote_map', {})
                if push_mirror_repos_par:
                    if not os.path.exists(push_mirror_repos_par):
                        os.makedirs(push_mirror_repos_par)
                    if not os.path.isdir(push_mirror_repos_par):
                        e_fmt = 'Specified push_mirror_repos_par, "{}", is not a directory'
                        e = e_fmt.format(push_mirror_repos_par)
                        raise ValueError(e)
        if repos_dict is None:
            repos_dict = get_repos(repos_par, **kwargs)
        shards = []
        repo_name_list = list(repos_dict.keys())
        repo_name_list.sort()
        for repo_name in repo_name_list:
            repo_filepath = repos_dict[repo_name]
            push_mirror_repo_path = None
            if push_mirror_repos_par:
                expected_push_mirror_repo_path = os.path.join(push_mirror_repos_par, repo_name)
                if os.path.isdir(expected_push_mirror_repo_path):
                    push_mirror_repo_path = expected_push_mirror_repo_path
            try:
                # assumes uniform __init__ arguments for all GitShard subclasses
                shard = git_shard_class(repo_name,
                                        repo_filepath,
                                        assumed_doc_version,
                                        git_ssh,
                                        pkey,
                                        git_action_class,
                                        push_mirror_repo_path,
                                        new_doc_prefix,
                                        infrastructure_commit_author)
            except FailedShardCreationError as x:
                f = 'SKIPPING repo "{d}" (not a {c}). Details:\n  {e}'
                f = f.format(d=repo_filepath, c=git_shard_class.__name__, e=str(x))
                _LOG.warn(f)
                continue
            # if the mirror does not exist, clone it...
            if push_mirror_repos_par and (push_mirror_repo_path is None):
                from peyotl.git_storage import GitActionBase
                GitActionBase.clone_repo(push_mirror_repos_par,
                                         repo_name,
                                         repo_filepath)
                if not os.path.isdir(expected_push_mirror_repo_path):
                    e_msg = 'git clone in mirror bootstrapping did not produce a directory at {}'
                    e = e_msg.format(expected_push_mirror_repo_path)
                    raise ValueError(e)
                for remote_name, remote_url_prefix in push_mirror_remote_map.items():
                    if remote_name in ['origin', 'originssh']:
                        f = '"{}" is a protected remote name in the mirrored repo setup'
                        m = f.format(remote_name)
                        raise ValueError(m)
                    remote_url = remote_url_prefix + '/' + repo_name + '.git'
                    GitActionBase.add_remote(expected_push_mirror_repo_path, remote_name, remote_url)
                shard.push_mirror_repo_path = expected_push_mirror_repo_path
                for remote_name in push_mirror_remote_map.keys():
                    mga = shard._create_git_action_for_mirror()  # pylint: disable=W0212
                    mga.fetch(remote_name)
            shards.append(shard)

        self._shards = shards
        if len(shards) < 1:
            self._growing_shard = None
        else:
            self._growing_shard = shards[-1]  # generalize with config...
        self._prefix2shard = {}
        for shard in shards:
            for prefix in shard.known_prefixes:
                # we don't currently support multiple shards with the same ID prefix scheme
                assert prefix not in self._prefix2shard
                self._prefix2shard[prefix] = shard
        with self._index_lock:
            self._locked_refresh_doc_ids()
        if self.assumed_doc_version is None:
            # if no version was specified, try to pick it up from a shard's contents (using auto-detect)
            if self._growing_shard:
                self.assumed_doc_version = self._growing_shard.assumed_doc_version
        self.git_action_class = git_action_class

    def _locked_refresh_doc_ids(self):
        """Assumes that the caller has the _index_lock !
        """
        d = {}
        for s in self._shards:
            for k in s.doc_index.keys():
                if k in d:
                    raise KeyError('doc "{i}" found in multiple repos'.format(i=k))
                d[k] = s
        self._doc2shard_map = d

    def has_doc(self, doc_id):
        with self._index_lock:
            return doc_id in self._doc2shard_map

    def create_git_action(self, doc_id):
        shard = self.get_shard(doc_id)
        if shard is None:
            shard = self._growing_shard
        assert shard is not None
        return shard.create_git_action()

    def get_filepath_for_doc(self, doc_id):
        ga = self.create_git_action(doc_id)
        return ga.path_for_doc(doc_id)

    def return_doc(self,
                   doc_id,
                   branch='master',
                   commit_sha=None,
                   return_WIP_map=False):
        ga = self.create_git_action(doc_id)
        with ga.lock():
            # _LOG.debug('pylesystem.return_doc({s}, {b}, {c}...)'.format(s=doc_id, b=branch, c=commit_sha))

            blob = ga.return_document(doc_id,
                                      branch=branch,
                                      commit_sha=commit_sha,
                                      return_WIP_map=return_WIP_map)
            content = blob[0]
            if content is None:
                raise KeyError('Document {} not found'.format(doc_id))
            nexson = anyjson.loads(blob[0])
            if return_WIP_map:
                return nexson, blob[1], blob[2]
            return nexson, blob[1]

    def get_blob_sha_for_doc_id(self, doc_id, head_sha):
        ga = self.create_git_action(doc_id)
        docpath = ga.path_for_doc(doc_id)
        return ga.get_blob_sha_for_file(docpath, head_sha)

    def get_version_history_for_doc_id(self, doc_id):
        ga = self.create_git_action(doc_id)
        docpath = ga.path_for_doc(doc_id)
        return ga.get_version_history_for_file(docpath)

    def push_doc_to_remote(self, remote_name, doc_id=None):
        """This will push the master branch to the remote named `remote_name`
        using the mirroring strategy to cut down on locking of the working repo.

        `doc_id` is used to determine which shard should be pushed.
        if `doc_id` is None, all shards are pushed.
        """
        if doc_id is None:
            ret = True
            # @TODO should spawn a thread of each shard...
            for shard in self._shards:
                if not shard.push_to_remote(remote_name):
                    ret = False
            return ret
        shard = self.get_shard(doc_id)
        return shard.push_to_remote(remote_name)

    def commit_and_try_merge2master(self,
                                    file_content,
                                    doc_id,
                                    auth_info,
                                    parent_sha,
                                    commit_msg='',
                                    merged_sha=None):
        from peyotl.git_storage.git_workflow import generic_commit_and_try_merge2master_wf
        git_action = self.create_git_action(doc_id)
        resp = generic_commit_and_try_merge2master_wf(git_action,
                                                      file_content,
                                                      doc_id,
                                                      auth_info,
                                                      parent_sha,
                                                      commit_msg,
                                                      merged_sha=merged_sha)
        if not resp['merge_needed']:
            self._doc_merged_hook(git_action, doc_id)
        return resp

    def annotate_and_write(self,  # pylint: disable=R0201
                           git_data,
                           nexson,
                           doc_id,
                           auth_info,
                           adaptor,
                           annotation,
                           parent_sha,
                           commit_msg='',
                           master_file_blob_included=None):
        """
        This is the heart of the api's __finish_write_verb
        It was moved to phylesystem to make it easier to coordinate it
            with the caching decisions. We have been debating whether
            to cache @id and @dateCreated attributes for the annotations
            or cache the whole annotation. Since these decisions are in
            add_validation_annotation (above), it is easier to have
            that decision and the add_or_replace_annotation call in the
            same repo.
        """
        adaptor.add_or_replace_annotation(nexson,
                                          annotation['annotationEvent'],
                                          annotation['agent'],
                                          add_agent_only=True)
        return self.commit_and_try_merge2master(file_content=nexson,
                                                doc_id=doc_id,
                                                auth_info=auth_info,
                                                parent_sha=parent_sha,
                                                commit_msg=commit_msg,
                                                merged_sha=master_file_blob_included)

    def delete_doc(self, doc_id, auth_info, parent_sha, **kwargs):
        git_action = self.create_git_action(doc_id)
        from peyotl.git_storage.git_workflow import delete_document
        doctype_display_name = kwargs.get('doctype_display_name', None)
        ret = delete_document(git_action,
                              doc_id,
                              auth_info,
                              parent_sha,
                              doctype_display_name=doctype_display_name,
                              **kwargs)
        if not ret['merge_needed']:
            with self._index_lock:
                try:
                    _shard = self._doc2shard_map[doc_id]
                except KeyError:
                    pass
                else:
                    _shard.delete_doc_from_index(doc_id)
                    try:
                        # complex types use aliases (clean these up)
                        alias_list = _shard.id_alias_list_fn(doc_id)
                    except:
                        # it's a simple type, with no alias list
                        alias_list = [doc_id]
                    for alias in alias_list:
                        try:
                            del self._doc2shard_map[alias]
                        except KeyError:
                            pass
        return ret

    def iter_doc_objs(self, **kwargs):
        """Generator that iterates over all detected documents (eg, nexson studies)
        and returns the doc object (deserialized from JSON) for each doc.
        Order is by shard, but arbitrary within shards.
        @TEMP not locked to prevent doc creation/deletion
        """
        for shard in self._shards:
            for doc_id, blob in shard.iter_doc_objs(**kwargs):
                yield doc_id, blob

    def iter_doc_filepaths(self, **kwargs):
        """Generator that iterates over all detected documents.
        and returns the filesystem path to each doc.
        Order is by shard, but arbitrary within shards.
        @TEMP not locked to prevent doc creation/deletion
        """
        for shard in self._shards:
            for doc_id, blob in shard.iter_doc_filepaths(**kwargs):
                yield doc_id, blob

    def pull(self, remote='origin', branch_name='master'):
        with self._index_lock:
            for shard in self._shards:
                shard.pull(remote=remote, branch_name=branch_name)
            self._locked_refresh_doc_ids()

    def report_configuration(self):
        out = StringIO()
        self.write_configuration(out)
        return out.getvalue()

    def write_configuration(self, out, secret_attrs=False):
        """Generic configuration, may be overridden by type-specific version"""
        key_order = ['assumed_doc_version',
                     'number_of_shards',
                     'initialization', ]
        cd = self.get_configuration_dict(secret_attrs=secret_attrs)
        for k in key_order:
            if k in cd:
                out.write('  {} = {}'.format(k, cd[k]))
        for n, shard in enumerate(self._shards):
            out.write('Shard {}:\n'.format(n))
            shard.write_configuration(out)

    def get_configuration_dict(self, secret_attrs=False):
        """Generic configuration, may be overridden by type-specific version"""
        cd = {'assumed_doc_version': self.assumed_doc_version,
              'number_of_shards': len(self._shards),
              'initialization': self._filepath_args,
              'shards': [],
              }
        for i in self._shards:
            cd['shards'].append(i.get_configuration_dict(secret_attrs=secret_attrs))
        return cd

    def get_branch_list(self):
        a = []
        for i in self._shards:
            a.extend(i.get_branch_list())
        return a

    def get_changed_docs(self, ancestral_commit_sha, doc_ids_to_check=None):
        ret = None
        for i in self._shards:
            x = i.get_changed_docs(ancestral_commit_sha, doc_ids_to_check=doc_ids_to_check)
            if x is not False:
                ret = x
                break
        if ret is not None:
            return ret
        raise ValueError('No docstore shard returned changed documents for the SHA')

    def get_doc_ids(self, include_aliases=False):
        k = []
        for shard in self._shards:
            k.extend(shard.get_doc_ids(include_aliases=include_aliases))
        return k


text:
var mysql = require('mysql');
var fs = require('fs');

var connection = mysql.createConnection({
   host: '127.0.0.1',
   user: 'root',
   password: 'root',
   database: 'kitsune'
});

connection.connect();

connection.query('SELECT Count(ID) AS NumberOfPenguins FROM Penguins;', function(err, results, fields) {
    if(err) throw err;

    fs.writeFile('usercount.json', JSON.stringify(results), function (err) {
      if (err) throw err;
      console.log('Saved registered penguins!');
    });

    connection.query('SELECT * FROM Penguins ORDER BY ID DESC LIMIT 1;', function(err, results, fields) {
    if(err) throw err;

    fs.writeFile('lastuser.json', JSON.stringify(results), function (err) {
      if (err) throw err;
      console.log('Saved last registered penguin!');
    });

        connection.query('SELECT * FROM Penguins;', function(err, results, fields) {
    if(err) throw err;

    fs.writeFile('registeredusers.json', JSON.stringify(results), function (err) {
      if (err) throw err;
      console.log('Saved penguins column!');
    });

    connection.end();
});
});
});


text:
using System;
using System.Threading.Tasks;

namespace Orleans.LeaseProviders
{
    /// <summary>
    /// Acquired lease
    /// </summary>
    [Immutable]
    [GenerateSerializer]
    public class AcquiredLease
    {
        /// <summary>
        /// The resource key which the lease is attached to
        /// </summary>
        [Id(0)]
        public string ResourceKey { get; }

        /// <summary>
        /// Duration of the acquired lease
        /// </summary>
        [Id(1)]
        public TimeSpan Duration { get; }

        /// <summary>
        /// Lease token, which will be null if acquiring or renewing the lease failed
        /// </summary>
        [Id(2)]
        public string Token { get; }

        /// <summary>
        /// Caller side start time for this lease, which is when the lease is acquired or renewed
        /// </summary>
        [Id(3)]
        public DateTime StartTimeUtc { get; }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="resourceKey"></param>
        /// <param name="duration"></param>
        /// <param name="token"></param>
        /// <param name="startTimeUtc"></param>
        public AcquiredLease(string resourceKey, TimeSpan duration, string token, DateTime startTimeUtc)
        {
            this.ResourceKey = resourceKey;
            this.Duration = duration;
            this.Token = token;
            this.StartTimeUtc = startTimeUtc;
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="resourceKey"></param>
        public AcquiredLease(string resourceKey)
        {
            this.ResourceKey = resourceKey;
        }
    }

    /// <summary>
    /// AcquireLeaseResult class, which demonstrates result of acquiring or renewing lease operation
    /// </summary>
    [Immutable]
    [GenerateSerializer]
    public class AcquireLeaseResult
    {
        /// <summary>
        /// Acquired lease, which will be null if acquire or renew operation failed.
        /// </summary>
        [Id(0)]
        public AcquiredLease AcquiredLease { get; }

        /// <summary>
        /// Response status
        /// </summary>
        [Id(1)]
        public ResponseCode StatusCode { get; }

        /// <summary>
        /// If acquiring or renewing the lease failed, this is the exception which caused it. This field would be null if operation succeed.
        /// </summary>
        [Id(2)]
        public Exception FailureException { get; }

        public AcquireLeaseResult(AcquiredLease acquiredLease, ResponseCode statusCode, Exception failureException)
        {
            this.AcquiredLease = acquiredLease;
            this.StatusCode = statusCode;
            this.FailureException = failureException;
        }
    }

    [GenerateSerializer]
    public enum ResponseCode
    {
        /// <summary>
        /// Operation succeed
        /// </summary>
        OK,
        /// <summary>
        /// Lease is owned by other entity
        /// </summary>
        LeaseNotAvailable,
        /// <summary>
        /// The token in the AcquiredLease is invalid, which means the lease expired
        /// </summary>
        InvalidToken,
        /// <summary>
        /// TransientFailure, which should be retriable.
        /// </summary>
        TransientFailure
    }

    /// <summary>
    /// Lease request where you can specify ResourceKey and duration of your lease.
    /// </summary>
    [GenerateSerializer]
    public class LeaseRequest
    {
        /// <summary>
        /// The key of the resource where you want to apply the lease on
        /// </summary>
        [Id(0)]
        public string ResourceKey { get; set; }

        /// <summary>
        /// Duration of the lease
        /// </summary>
        [Id(1)]
        public TimeSpan Duration { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        public LeaseRequest()
        { }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="resourceKey"></param>
        /// <param name="duration"></param>
        public LeaseRequest(string resourceKey, TimeSpan duration)
        {
            this.ResourceKey = resourceKey;
            this.Duration = duration;
        }
    }

    /// <summary>
    /// Lease provider interface
    /// </summary>
    public interface ILeaseProvider
    {
        /// <summary>
        /// Batch acquire leases operation
        /// </summary>
        /// <param name="category">resource category</param>
        /// <param name="leaseRequests"></param>
        /// <returns>Lease acquiring results array, whose order is the same with leaseRequstes</returns>
        Task<AcquireLeaseResult[]> Acquire(string category, LeaseRequest[] leaseRequests);
        /// <summary>
        /// Batch renew lease operation
        /// </summary>
        /// <param name="category">resource category</param>
        /// <param name="aquiredLeases"></param>
        /// <returns>Lease renew results array, whose order is the same with acquiredLeases</returns>
        Task<AcquireLeaseResult[]> Renew(string category, AcquiredLease[] aquiredLeases);
        /// <summary>
        /// Batch release lease operation
        /// </summary>
        /// <param name="category">resource category</param>
        /// <param name="aquiredLeases"></param>
        /// <returns></returns>
        Task Release(string category, AcquiredLease[] aquiredLeases);
    }
}


text:
package com.intel.oap.common.storage.memkind;

import com.intel.oap.common.storage.stream.MetaData;
import com.intel.oap.common.storage.stream.PMemPhysicalAddress;
import com.intel.oap.common.storage.stream.PMemMetaStore;

import java.util.concurrent.ConcurrentHashMap;

//TODO design point, how to store data on PMEM
public class MemkindMetaStore implements PMemMetaStore {
    ConcurrentHashMap<String, MemkindPMemPhysicalAddress> pMemHashMap = new ConcurrentHashMap();
    ConcurrentHashMap<String, MetaData> metaHashMap = new ConcurrentHashMap();

    @Override
    public PMemPhysicalAddress getPhysicalAddressByID(byte[] id, int chunkID) {
        StringBuilder keyBuilder = new StringBuilder();
        keyBuilder.append(chunkID).append(new String(id));
        return pMemHashMap.get(keyBuilder.toString());
    }

    @Override
    public void putMetaFooter(byte[] id, MetaData metaData) {
        metaHashMap.put(new String(id), metaData);
    }

    @Override
    public void removeMetaFooter(byte[] id) {
        metaHashMap.remove(new String(id));
    }
    @Override
    public void putPhysicalAddress(byte[] id, int chunkID, PMemPhysicalAddress pMemPhysicalAddress) {
        StringBuilder keyBuilder = new StringBuilder();
        keyBuilder.append(chunkID).append(new String(id));
        pMemHashMap.put(keyBuilder.toString(), (MemkindPMemPhysicalAddress) pMemPhysicalAddress);
    }

    @Override
    public void removePhysicalAddress(byte[] id, int chunkID) {
        StringBuilder keyBuilder = new StringBuilder();
        keyBuilder.append(chunkID).append(new String(id));
        pMemHashMap.remove(keyBuilder.toString());
    }

    @Override
    public MetaData getMetaFooter(byte[] id) {
        return metaHashMap.get(new String(id));
    }
}


text:
using System;
using NUnit.Framework;
using Rock.Messaging.Routing;

namespace RouteResultTests
{
    public class TheMessageConstructor
    {
        [Test]
        public void ThrowsAnArgumentNullExceptionIfTheMessageParameterIsNull()
        {
            Assert.That(() => new RouteResult(null, new object()), Throws.InstanceOf<ArgumentNullException>());
        }

        [Test]
        public void DoesNotThrowAnExceptionIfTheResultParameterIsNull()
        {
            Assert.That(() => new RouteResult(new TestMessage(), null), Throws.Nothing);
        }

        [Test]
        public void SetsTheValueOfTheMessageProperty()
        {
            var message = new TestMessage();

            var routeResult = new RouteResult(message, null);

            Assert.That(routeResult.Message, Is.SameAs(message));
        }

        [Test]
        public void SetsTheValueOfTheResultProperty()
        {
            var result = new object();

            var routeResult = new RouteResult(new TestMessage(), result);

            Assert.That(routeResult.Result, Is.SameAs(result));
        }

        private class TestMessage
        {
        }
    }

    public class TheExceptionConstructor
    {
        [Test]
        public void ThrowsAnArgumentNullExceptionIfTheExceptionParameterIsNull()
        {
            Assert.That(() => new RouteResult((Exception)null), Throws.InstanceOf<ArgumentNullException>());
        }

        [Test]
        public void SetsTheValueOfTheExceptionProperty()
        {
            var exception = new Exception();

            var routeResult = new RouteResult(exception);

            Assert.That(routeResult.Exception, Is.SameAs(exception));
        }
    }

    public class TheSuccessProperty
    {
        [Test]
        public void ReturnsTrueWhenTheMessagePropertyIsNotNull()
        {
            var result = new RouteResult(new TestMessage(), null);

            Assert.That(result.Success, Is.True);
        }

        [Test]
        public void ReturnsFalseWhenTheExceptionPropertyIsNotNull()
        {
            var result = new RouteResult(new Exception());

            Assert.That(result.Success, Is.False);
        }

        private class TestMessage
        {
        }
    }
}


text:
<?php

/**
 * @author Evgeniy Udodov <flr.null@gmail.com>
 */

namespace FTrace\Code;

use FTrace\Code\Unit;
use FTrace\Code\Call;
use FTrace\Utils\Trace;

class Code {

    /**
     * @var Call
     */
    private $_call;

    public function __construct () {
        $this->_call = new Call(true);
    }

    /**
     * @param Trace $obTrace
     */
    public function pushCode (Trace $obTrace) {
        // Code has root call
        // Each unit could have call
        // Each call has array of units
        /*
         Code:
            0. Init root call in constructor
            1. Create unit
            2. Push unit to call
         Call:
            1. If we have no units, simply add it as first and calc call depth
            2. If we already have units
                2.1 If unit has deeper depth
                    2.1.1 If last unit is mock, push this new unit to last call
                    2.1.2 If we have no open call, we create unit mock with call, and put unit as first unit of this call
                2.2 If unit has the same depth
                    2.2.1 If last unit is mock, insert data from new unit into mock, remove new unit (unit closing call)
                    2.2.2 If last unit not mock, simply add new unit to array
                2.2 If unit has smaller depth, we remove it and skip step (we are out of scope)
        */

        $unit = new Unit($obTrace);
        $this->_call->addUnit($unit);
    }

    /**
     * @return Call
     */
    public function getData () {
        return $this->_call;
    }

}


text:
[![Join the chat at https://gitter.im/mifos-initiative/mifos.io](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mifos-initiative/mifos.io?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This project provides simple reporting capabilities.

## Versioning
The version numbers follow the [Semantic Versioning](http://semver.org/) scheme.

In addition to MAJOR.MINOR.PATCH the following postfixes are used to indicate the development state.

* BUILD-SNAPSHOT - A release currently in development.
* M - A _milestone_ release include specific sets of functions and are released as soon as the functionality is complete.
* RC - A _release candidate_ is a version with potential to be a final product, considered _code complete_.
* RELEASE - _General availability_ indicates that this release is the best available version and is recommended for all usage.

The versioning layout is {MAJOR}.{MINOR}.{PATCH}-{INDICATOR}[.{PATCH}]. Only milestones and release candidates can  have patch versions. Some examples:

1.2.3.BUILD-SNAPSHOT
1.3.5.M.1
1.5.7.RC.2
2.0.0.RELEASE

## License
See [LICENSE](LICENSE) file.


text:
#ifndef SUPP_H
#define SUPP_H 1
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
#include <ctype.h>
/* typenames */
#define CHAR 1
#define SHORT 2
#define INT 3
#define LONG 4
#define LLONG 5
#define FLOAT 6
#define DOUBLE 7
#define LDOUBLE 8
#define VOID 9
#define POINTER 10
#define ARRAY 11
#define STRUCT 12
#define UNION 13
#define ENUM 14
#define FUNKT 15
#define BOOL 16
#define MAXINT 17 /* should not be accessible to application */
#define MAX_TYPE MAXINT
#define MAXVECDIM 16
#define VECBOOL (MAXINT+1)
#define VECCHAR (VECBOOL+MAXVECDIM)
#define VECSHORT (VECCHAR+MAXVECDIM)
#define VECINT (VECSHORT+MAXVECDIM)
#define VECLONG (VECINT+MAXVECDIM)
#define VECFLOAT (VECLONG+MAXVECDIM)
#define VECLAST (VECFLOAT+MAXVECDIM)
#define NQ 255   /* f&NQ gives type without any qualifiers */
#define NU 511   /* f&NU gives type without any qualifiers but UNSIGNED */
#define q1typ(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==CONVERT||p->code==SUBPFP)?p->typf2:p->typf)
#define q2typ(p) ((p->code==SUBPFP||p->code==LSHIFT||p->code==RSHIFT)?p->typf2:p->typf)
#define ztyp(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==ADDRESS)?p->typf2:p->typf)
#define iclabel(p) (p->typf)
#define opsize(p) (p->q2.val.vmax)
#define pushsize(p) (p->z.val.vmax)
#define pushedargsize(p) (p->q2.val.vmax)
#define isstatic(x) ((x)==STATIC)
#define isextern(x) ((x)==EXTERN)
#define isauto(x)   ((x)==AUTO||(x)==REGISTER)
/* operations on bit-vectors */
typedef unsigned int bvtype;
#define BVBITS (sizeof(bvtype)*CHAR_BIT)
#define BVSIZE(x) ((((x)+BVBITS-1)/BVBITS)*sizeof(bvtype))
#define BSET(array,bit) (array)[(bit)/BVBITS]|=1<<((bit)%BVBITS)
#define BCLR(array,bit) (array)[(bit)/BVBITS]&=~(1<<((bit)%BVBITS))
#define BTST(array,bit) ((array)[(bit)/BVBITS]&(1<<((bit)%BVBITS)))
/* type-qualifiers */
#define UNSIGNED (NQ+1)
#define CONST (UNSIGNED<<1)
#define VOLATILE (CONST<<1)
#define RESTRICT (VOLATILE<<1)
#define UNCOMPLETE (RESTRICT<<1)
#define STRINGCONST (UNCOMPLETE<<1)
#define BOOLEAN (STRINGCONST<<1)
#define SIGNED_CHARACTER (BOOLEAN<<1)
#ifdef HAVE_ECPP
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
#endif
#define t_min(x) (((x)&UNSIGNED)?l2zm(0L):t_min[(x)&NQ])
#define t_max(x) (((x)&UNSIGNED)?tu_max[(x)&NQ]:t_max[(x)&NQ])
/*  macro for internal errors */
#define ierror(a) error(-1,(a),__LINE__,FILE_)
/* macros for target errors */
#define twarning(x) error(323,x);
#define terror(x) error(324,x);
/* this header is provided by the code generator */
#include "machine.h"
#ifndef HAVE_EXT_TYPES
typedef zllong zmax;
typedef zullong zumax;
#endif
#ifndef ISPOINTER
#define ISPOINTER(x) ((x&NQ)==POINTER)
#endif
#ifndef ISINT
#define ISINT(x) ((x&NQ)>=CHAR&&(x&NQ)<=LLONG)
#endif
#ifndef ISFLOAT
#define ISFLOAT(x) ((x&NQ)>=FLOAT&&(x&NQ)<=LDOUBLE)
#endif
#ifndef ISFUNC
#define ISFUNC(x) ((x&NQ)==FUNKT)
#endif
#ifndef ISSTRUCT
#define ISSTRUCT(x) ((x&NQ)==STRUCT)
#endif
#ifndef ISUNION
#define ISUNION(x) ((x&NQ)==UNION)
#endif
#ifndef ISARRAY
#define ISARRAY(x) ((x&NQ)==ARRAY)
#endif
#ifndef ISVECTOR
#define ISVECTOR(x) ((x&NQ)>=VECBOOL&&(x&NQ)<=VECLAST)
#endif
#ifndef VECDIM
#define VECDIM(x) ((((x&NQ)-VECBOOL)&15)+1)
#endif
#ifndef ISSCALAR
#define ISSCALAR(x) ((x&NQ)>=CHAR&&(x&NQ)<=POINTER)
#endif
#ifndef ISARITH
#define ISARITH(x) (ISINT(x)||ISFLOAT(x))
#endif
#ifndef POINTER_TYPE
#define POINTER_TYPE(x) POINTER
#endif
#ifndef MAXINT
#define MAXINT LLONG
#endif
#ifndef HAVE_INT_SIZET
#define HAVE_INT_SIZET 0
#endif
#ifndef PTRDIFF_T
#define PTRDIFF_T(x) INT
#endif
#ifndef MAXADDI2P
#define MAXADDI2P LLONG
#endif
#define RSIZE BVSIZE(MAXR+1)
#define ALL_CALLS 1
#define ALL_REGS  2
#define ALL_USES  4
#define ALL_MODS  8
#define ALL_STACK 16
#define ALWAYS_RETURNS 32
#define NEVER_RETURNS 64
#define NOSIDEFX 128
#define WARNED_STACK 256
#define WARNED_REGS 512
#define USES_VLA 1024
struct tunit{
  struct Var *statics;
  struct tunit *next;
};
/*  additional information for functions; used by the optimizer  */
struct function_info{
  struct IC *first_ic;    /* inline copy of function starts here */
  struct IC *last_ic;     /*  "       "       "      ends here   */
  struct IC *opt_ic;      /* code after optimizing */
  struct Var *vars;       /* pointer to list of vars of that function */
  struct Var *statics;    /* static variables of translation-unit */
  char *inline_asm;       /* pointer to code for inline assembler */
  unsigned long flags;    /* misc flags, see above */
  /* functions called, variables used and changed */
  int call_cnt,use_cnt,change_cnt;
  struct varlist *call_list;
  struct varlist *use_list;
  struct varlist *change_list;
  zmax max_offset;
  /* registers used and modified by that function */
  bvtype regs_modified[RSIZE/sizeof(bvtype)];
#if HAVE_OSEK
/* removed */
/* removed */
/* removed */
#endif
  zumax stack1;
  zumax stack2;
};
/*  struct for types.    */
struct Typ{
  int flags;  /*  see above   */
  struct Typ *next;
  struct struct_declaration *exact;   /* used for STRUCT/UNION/FUNKT  */
  zmax size;     /*  used for ARRAY  */
  struct Var *dsize; /* used for variable-length arrays */
  char *attr;
  int reg;
#ifdef HAVE_ECPP
/* removed */
#endif
};
#define TYPS sizeof(struct Typ)
#ifndef HAVE_EXT_TYPES
union atyps{
  zchar vchar;
  zuchar vuchar;
  zshort vshort;
  zushort vushort;
  zint vint;
  zuint vuint;
  zlong vlong;
  zulong vulong;
  zllong vllong;
  zullong vullong;
  zmax vmax;
  zumax vumax;
  zfloat vfloat;
  zdouble vdouble;
  zldouble vldouble;
};
#endif
/* This struct represents objects in the intermediate code. */
struct obj{
  int flags;      /* see below */
  int reg;        /* number of reg if flags&REG */
  int dtyp;       /* type of pointer for DREFOBJ */
  struct Var *v;
  struct AddressingMode *am;
  union atyps val;
};
/*  Available flags in struct obj.  */
                    /*  KONST muss immer am kleinsten sein, um beim Swappen */
                    /*  fuer available_expressions und Konstanten nach      */
                    /*  rechts nicht in eine Endlosschleife zu kommen.      */
#define KONST 1     /*  The object is a constant. Its value is stored in    */
                    /*  val.                                                */
#define VAR 2       /*  The object is a variable (stored in v).             */
#define SCRATCH 8   /*  The object is a temporary.                          */
#define STACK 16    /*  obsolete                                            */
#define DREFOBJ 32  /*  The object must be dereferenced.                    */
#define REG 64      /*  The object is contained in a hardware register.     */
#define VARADR 128  /*  The object is the address of a static variable.     */
#define DONTREGISTERIZE 256 /*  Do not put this object into a register.     */
#define VKONST 512  /*  Variable containing a constant (for reg-alloc).     */
struct Var{
  int storage_class;  /* see below    */
  int reg;            /* Var is assigned to this hard-reg */
  int priority;       /* Priority to be used in simple_regs() */
  long flags;         /* see below */
  char *identifier;   /* name of the variable */
  int nesting;        /* can be freely used by the frontend */
  int index;          /* used by the optimizer */
  int inr;            /* counter for num_vars */
  zmax offset;        /* offset relative to the stack frame */
  int line;           /* line number of first declaration */
  char *filename;     /* filename of first declaration */
  int dline;          /* line number of definition */
  char *dfilename;    /* filename of definition */
  struct Typ *vtyp;   /* type of the variable */
  struct const_list *clist;   /* initialized? */
  struct Var *next;   /* pointer to next variable */
  struct function_info *fi;   /* used by the optimizer */
  struct Var *inline_copy;    /* used for function-inlining */
  struct tunit *tunit; /* translation unit the variable belongs to */
  char *vattr;         /* extended variable attributes */
  char *description;   /* description of variable meaning */
  struct obj cobj;     /* used for register-allocation of constants */
  int ctyp;            /*   ----------------- " -----------------   */
#ifdef HAVE_TARGET_ATTRIBUTES
  unsigned long tattr;        /* target-specific attributes */
#endif
#ifdef ALEX_REG
  int iRegCopyNr;
  int iRegCopyNrHc12V;
#endif
};
/* available storage-classes */
#define AUTO 1          /* var is allocated on the stack */
#define REGISTER 2      /* basically the same as AUTO (C-only) */
#define STATIC 3        /* var is static but has no external linkage */
#define EXTERN  4       /* var is static and has external linkage */
#define TYPEDEF 5       /* C-only */
/* available flags in struct Var */
#define USEDASSOURCE 1      /* the var has been read */
#define USEDASDEST 2        /* the var has been written */
#define DEFINED 4           /* the var has been defined (i.e. storage will
                               be allocated in the current file) */
#define USEDASADR 8         /* the address of the var has been taken */
#define GENERATED 16        /* code for static vars has been generated */
#define CONVPARAMETER 32
#define TENTATIVE 64        /* C-only */
#define USEDBEFORE 128      /* used by the optimizer */
#define INLINEV 256         /*  "               "    */
#define PRINTFLIKE 512      /* C-only */
#define SCANFLIKE 1024      /* C-only */
#define NOTTYPESAFE 2048    /* used by the optimizer */
#define DNOTTYPESAFE 4096   /*  "               "    */
#define REGPARM 8192        /* the var is a register parameter */
#define DBLPUSH 16384       /* parameter is also on the stack */
#define NOTINTU 32768       /* variable not (yet) defined in this translation-unit */
#define REFERENCED 65536    /* variable referenced */
#define INLINEFUNC (REFERENCED*2)
#define INLINEEXT (INLINEFUNC*2)
#define BUILTIN (INLINEFUNC*2)

/* C-only */
struct struct_list{
  char *identifier;   /* name of the struct/union-tag */
  struct Typ *styp;   /* type of the member/parameter */
  zmax align;         /* alignment of struct-member */
  int bfoffset;       /* bitfield-offset */
  int bfsize;         /* bitfield-size */
  int storage_class;  /* storage-class of function-parameter */
  int reg;            /* register to pass function-parameter */
#ifdef HAVE_ECPP
/* removed */
#endif
};

#define SLSIZE 32   /* realloc struct_lists in those steps */
/*  These structs are used to describe members of STRUCT/UNION or   */
/*  parameters of FUNKT. Some of the entries in struct_list are not */
/*  relevant for both alternatives.                                 */
struct struct_declaration{
  int count;  /* number of members/parameters */
  int label; /* used for debug output */
  int typ;
  struct tunit *tunit;
  struct struct_declaration *next;
  struct struct_list (*sl)[];
  char *identifier;
#ifdef HAVE_ECPP
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
#endif
};

/*  The quads in the intermediate code. */
struct IC{
  struct IC *prev;    /* pointer to the next IC */
  struct IC *next;    /* pointer to the previous IC */
  int code;           /* see below */
  int typf;           /* usually type of the operands, see interface.doc */
  int typf2;          /* used for CONVERT,ADDI2P,SUBIFP,SUBPFP */
  int defindex;       /* used by optimizer */
  int expindex;
  int copyindex;
  int change_cnt;
  int use_cnt;
  int call_cnt;
  int line;           /* corresponding line in source file (or 0) */
  struct varlist *change_list;    /* used by optimizer */
  struct varlist *use_list;
  struct varlist *call_list;
  struct obj q1;      /* source 1 */
  struct obj q2;      /* source 2 */
  struct obj z;       /* target */
  char *file;         /* filename of the source file */
  int arg_cnt;
  struct IC **arg_list; /* pointers to function argument ICs (only for code==CALL) */
  struct IC *copy;    /* for copying/inlining */
  struct Typ *ityp;
  long flags;
  struct Var *savedsp; /* only for branch instructions and vlas */
#ifdef HAVE_EXT_IC
  struct ext_ic ext;
#endif
#ifdef ALEX_REG
  int iZWebIndex; /* web for z in case z is a pointer and its value is defed*/
  int iQ1WebIndex; /* web for argument q1 */
  int iQ2WebIndex; /* web for argument q2 */
  void *pFlow;           /* flowgraph reverse lookup */
#endif
};
#define ICS sizeof(struct IC)
/* flags for ICs */
#define LOOP_COND_TRUE 1  /* loop condition is true at first iteration */
#define EFF_IC 2          /* do not transform IC with doubtful optimizations */
#define ORDERED_PUSH_COPY 4 /* mark a copy of an ordered push */

/*  Available codes for struct IC. See interface.doc. */
#define KOMMA 1
#define ASSIGN 2
#define ASSIGNOP 3

#if 0
/* obsolete */
#define ASSIGNADD 3
#define ASSIGNSUB 4
#define ASSIGNMULT 5
#define ASSIGNDIV 6
#define ASSIGNMOD 7
#define ASSIGNAND 8
#define ASSIGNXOR 9
#define ASSIGNOR 10
#define ASSIGNLSHIFT 11
#define ASSIGNRSHIFT 12
#endif

#define COND 13
#define LOR 14
#define LAND 15
#define OR 16
#define XOR 17
#define AND 18
#define EQUAL 19
#define INEQUAL 20
#define LESS 21
#define LESSEQ 22
#define GREATER 23
#define GREATEREQ 24
#define LSHIFT 25
#define RSHIFT 26
#define ADD 27
#define SUB 28
#define MULT 29
#define DIV 30
#define MOD 31
#define NEGATION 32
#define KOMPLEMENT 33
#define PREINC 34
#define POSTINC 35
#define PREDEC 36
#define POSTDEC 37
#define MINUS 38
#define CONTENT 39
#define ADDRESS 40
#define CAST 41
#define CALL 42
#define INDEX 43
#define DPSTRUCT 44
#define DSTRUCT 45
#define IDENTIFIER 46
#define CEXPR 47
#define STRING 48
#define MEMBER 49
#define CONVERT 50
#if 0
#define CONVCHAR 50
#define CONVSHORT 51
#define CONVINT 52
#define CONVLONG 53
#define CONVFLOAT 54
#define CONVDOUBLE 55
#define CONVVOID 56
#define CONVPOINTER 57
#define CONVUCHAR 58
#define CONVUSHORT 59
#define CONVUINT 60
#define CONVULONG 61
#endif
#define ADDRESSA 62
#define FIRSTELEMENT 63
#define PMULT 64
#define ALLOCREG 65
#define FREEREG 66
#define PCEXPR 67
#define TEST 68
#define LABEL 69
#define BEQ 70
#define BNE 71
#define BLT 72
#define BGE 73
#define BLE 74
#define BGT 75
#define BRA 76
#define COMPARE 77
#define PUSH 78
#define POP 79
#define ADDRESSS 80
#define ADDI2P 81
#define SUBIFP 82
#define SUBPFP 83
#define PUSHREG 84
#define POPREG 85
#define POPARGS 86
#define SAVEREGS 87
#define RESTOREREGS 88
#define ILABEL 89
#define DC 90
#define ALIGN 91
#define COLON 92
#define GETRETURN 93
#define SETRETURN 94
#define MOVEFROMREG 95
#define MOVETOREG 96
#define NOP 97
#define BITFIELD 98
#define LITERAL 99
#define REINTERPRET 100
extern char *typname[];
extern zmax sizetab[];
extern char *storage_class_name[];
extern char *ename[];
extern int align_arguments; /* arguments correctly aligned on stack or
			       just stackalign? */
extern zmax align[],maxalign,stackalign;
/*  an empty string */
extern char *empty;
extern zchar vchar; extern zuchar vuchar;
extern zshort vshort; extern zushort vushort;
extern zint vint; extern zuint vuint;
extern zlong vlong; extern zulong vulong;
extern zllong vllong; extern zullong vullong;
extern zmax vmax; extern zumax vumax;
extern zfloat vfloat; extern zdouble vdouble;
extern zldouble vldouble;
extern union atyps gval;
#ifndef DEBUG
extern int DEBUG;
#endif
#ifdef HAVE_MISRA
/* removed */
#endif
/*  used by the optimizer */
/* for lists in ICs flags may be DREFOBJ to mark dereferences */
/* for lists in function infos flags is the type of access */
struct varlist{
  struct Var *v;
  int flags;
};
#define VLS sizeof(struct varlist)
extern struct IC *first_ic,*last_ic;
extern int regs[MAXR+1],regsa[MAXR+1],regused[MAXR+1],simple_scratch[MAXR+1];
extern int reg_prio[MAXR+1],regscratch[MAXR+1];
extern zmax regsize[MAXR+1];
extern struct Typ *regtype[MAXR+1];
extern struct Var *regsv[MAXR+1];
extern char *regnames[];
extern bvtype regs_modified[RSIZE/sizeof(bvtype)];
extern int optspeed,optsize,unroll_all,stack_check;
extern int cross_module,final,no_emit;
extern int debug_info;
extern int label,return_label;
/* The structures used for available options of the code generator. */
union ppi {char *p;long l;void (*f)(char *);};
#define USEDFLAG 1
#define STRINGFLAG 2
#define VALFLAG 4
#define FUNCFLAG 8
extern int g_flags[MAXGF];
extern char *g_flags_name[MAXGF];
extern union ppi g_flags_val[MAXGF];
extern zmax max_offset;
extern int function_calls,vlas;
extern int coloring;
extern int dmalloc;
extern int disable;
extern int misracheck,misraversion,misracomma,misratok;
extern int pack_align;
extern int short_push;
extern int default_unsigned;

/*  Das haette ich gern woanders    */
extern struct struct_declaration *add_sd(struct struct_declaration *,int);
struct node{
  int flags,lvalue,sidefx;
  int bfs,bfo;
  struct Typ *ntyp;
  struct node *left;
  struct node *right;
  struct argument_list *alist;
  char *identifier;
  struct const_list *cl;
  struct Var *dsize;
  union atyps val;
  struct obj o;
};
typedef struct node *np;
#define NODES sizeof(struct node)
struct const_list{
  union atyps val;
  np tree;
  zmax idx;
  struct const_list *other,*next;
};
#define CLS sizeof(struct const_list)
struct case_table{
  int num,typf;
  struct IC *next_ic;
  double density;
  union atyps *vals;
  int *labels;
  union atyps min,max;
  zumax diff;
};
extern zmax t_min[];
extern zumax t_max[];
extern zumax tu_max[];
extern zmax char_bit;
extern char cg_copyright[];
#ifdef HAVE_TARGET_ATTRIBUTES
extern char *g_attr_name[];
#endif
extern char **target_macros;
extern int goto_used;
extern int ic_count;
extern int only_inline;
extern int multiple_ccs;
extern int float_used;
extern struct IC *err_ic;
extern long maxoptpasses,optflags,inline_size,unroll_size,inline_depth;
extern int noaliasopt,fp_assoc,noitra;
extern struct Var *vl0,*vl1,*vl2,*vl3;
extern char *filename;
extern char *emit_buffer[EMIT_BUF_DEPTH];
extern char *emit_p;
extern int emit_f,emit_l;
extern int no_inline_peephole;
extern int ecpp;
/* functions which must be provided by the frontend */
extern void add_IC(struct IC *);
extern void error(int,...);
#ifdef HAVE_MISRA
/* removed */
/* removed */
#endif
extern struct Var *add_tmp_var(struct Typ *);
extern void free_var(struct Var *);
extern void raus(void);
/* functions provided by supp.c */
#define printtype prd
#define printobj probj
#define printic pric2
#define printiclist pric
extern void free_IC(struct IC *);
extern void insert_IC(struct IC *,struct IC *);
extern void move_IC(struct IC *,struct IC *);
extern void pric(FILE *,struct IC *);
extern void pric2(FILE *,struct IC *);
extern void probj(FILE *,struct obj *,int);
extern void emit(FILE *,const char *,...);
extern void emit_char(FILE *,int);
void emit_flush(FILE *);
void remove_asm(void);
#if HAVE_TARGET_PEEPHOLE
extern int emit_peephole(void);
#endif
extern void emit_remove(void);
extern void emit_inline_asm(FILE *,char *);
extern void emitzm(FILE *,zmax);
extern void emitzum(FILE *,zumax);
extern void emitzld(FILE *,zldouble);
extern void emitval(FILE *,union atyps *,int);
extern void printzm(FILE *,zmax);
extern void printzum(FILE *,zumax);
extern void printzld(FILE *,zldouble);
extern void printval(FILE *,union atyps *,int);
extern void insert_const(union atyps *,int);
extern void prd(FILE *,struct Typ *);
extern void print_var(FILE *,struct Var *);
extern void freetyp(struct Typ *);
extern struct Typ *new_typ(void);
extern struct Typ *clone_typ(struct Typ *);
#ifdef HAVE_EXT_TYPES
extern void conv_typ(struct Typ *);
#endif
extern int VECTYPE(int);
extern int mkvec(int,int);
extern zmax szof(struct Typ *);
extern int is_vlength(struct Typ *);
extern struct Var *vlength_szof(struct Typ *);
extern zmax struct_offset(struct struct_declaration *,const char *);
extern zmax falign(struct Typ *);
int get_first_base_type(struct Typ *);
extern void eval_const(union atyps *,int);
extern struct function_info *new_fi(void);
extern void free_fi(struct function_info *);
extern void print_fi(FILE *,struct function_info *);
extern void static_stack_check(struct Var *);
#ifdef HAVE_REGPARMS
extern zmax va_offset(struct Var *);
#endif
extern void print_varlist(FILE *f,struct varlist *,int);
extern int switch_IC(struct IC *);
extern int collides(struct obj *,struct obj *);
extern int is_const(struct Typ *);
extern int is_volatile_obj(struct obj *);
extern int is_volatile_ic(struct IC *);
extern struct case_table *calc_case_table(struct IC *,double);
int calc_regs(struct IC *,int);
struct Var *declare_builtin(char *name,int ztyp,int q1typ,int q1reg,int q2typ,int q2reg,int nosidefx,char *asm);
extern void emit_jump_table(FILE *,struct case_table *,char *,char *,int);
extern void optimize(long, struct Var *);
int bvcmp(bvtype *dest,bvtype *src,size_t len);
int bvdointersect(bvtype *,bvtype *,size_t len);
void bvunite(bvtype *dest,bvtype *src,size_t len);
void bvintersect(bvtype *dest,bvtype *src,size_t len);
void bvdiff(bvtype *dest,bvtype *src,size_t len);
void vqsort (void *,size_t,size_t,int (*)(const void *,const void *));
#define bvcopy(dest,src,len) memcpy(dest,src,len)
#define bvclear(dest,len) memset(dest,0,len)
#define bvsetall(dest,len) memset(dest,-1,len)
extern void remove_IC(struct IC *);
extern struct IC *clone_ic(struct IC *);
extern struct IC *new_IC(void);
extern struct Var *new_var(void);
extern void insert_bitfield(struct obj *,struct obj *,struct obj *,int,int,int,int);
extern void *mymalloc(size_t);
extern void *myrealloc(void *,size_t);
extern void myfree(void *p);
#define free(x) myfree(x)
extern char *mystrdup(char *);
extern void simple_regs(void);
extern int bflayout(int,int,int);
/*  functions provided by the code generator */
extern int regok(int,int,int);
struct rpair {int r1,r2;};
int reg_pair(int,struct rpair *);
extern struct rpair rp;
extern int freturn(struct Typ *);
#define ffreturn(x) ((x)->reg?(x)->reg:freturn(x))
extern void gen_code(FILE *,struct IC *,struct Var *,zmax);
extern int init_cg(void);
extern void cleanup_cg(FILE *);
extern void init_db(FILE *);
void cleanup_db(FILE *);
extern int dangerous_IC(struct IC *);
extern void gen_dc(FILE *,int,struct const_list *);
extern void gen_ds(FILE *,zmax,struct Typ *);
extern void gen_var_head(FILE *,struct Var *);
extern void gen_align(FILE *,zmax);
extern int shortcut(int, int);
extern int must_convert(int,int,int);
long get_pof2(zumax);
#ifdef HAVE_TARGET_PRAGMAS
extern int handle_pragma(const char *);
#endif
#ifdef HAVE_LIBCALLS
extern char *use_libcall(int code,int t1,int t2);
#endif
extern int cost_savings(struct IC *,int,struct obj *);
/* additional declarations for targets which pass arguments in */
/* registers by default.                                       */
#ifdef HAVE_REGPARMS
extern struct reg_handle empty_reg_handle;
extern int reg_parm(struct reg_handle *, struct Typ *,int,struct Typ *);
#endif
#ifdef HAVE_TARGET_EFF_IC
extern void mark_eff_ics(void);
#else
#define mark_eff_ics()
#endif
#ifndef JUMP_TABLE_DENSITY
#define JUMP_TABLE_DENSITY 1
#endif
#ifndef JUMP_TABLE_LENGTH
#define JUMP_TABLE_LENGTH 1000
#endif
#ifndef ALLOCVLA_REG
#define ALLOCVLA_REG 0
#endif
#ifndef ALLOCVLA_INLINEASM
#define ALLOCVLA_INLINEASM 0
#endif
#ifndef FREEVLA_REG
#define FREEVLA_REG 0
#endif
#ifndef FREEVLA_INLINEASM
#define FREEVLA_INLINEASM 0
#endif
#ifndef OLDSPVLA_INLINEASM
#define OLDSPVLA_INLINEASM 0
#endif
#ifndef FPVLA_REG
#define FPVLA_REG 0
#endif
#ifndef MIN_INT_TO_FLOAT_TYPE
#define MIN_INT_TO_FLOAT_TYPE CHAR
#endif
#ifndef MIN_FLOAT_TO_INT_TYPE
#define MIN_FLOAT_TO_INT_TYPE CHAR
#endif
#ifndef AVOID_FLOAT_TO_UNSIGNED
#define AVOID_FLOAT_TO_UNSIGNED 0
#endif
#ifndef AVOID_UNSIGNED_TO_FLOAT
#define AVOID_UNSIGNED_TO_FLOAT 0
#endif
#if HAVE_OSEK
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
/* removed */
#endif

#endif /* SUPP_H */


text:
import { GroupOptions } from './control-options';

export interface FormBaseConfig {
  /**
   */
  id: string;

  /**
   * default update strategy of the form
   */
  updateOn?: 'change' | 'blur' | 'submit';
  /**
   * sync validators
   */
  validators?: string | string[];
  /**
   * async validators
   */
  asyncValidators?: string | string[];
  /**
   * error messages for the validators
   */
  errors?: { [key: string]: string };

  /**
   */
  showMultipleErrors?: boolean;

  /**
   * additional user data
   */
  user?: any;
}

export interface FormConfig extends FormBaseConfig {
  /**
   * group options
   */
  options: GroupOptions;
}


text:
local ADDON_NAME, ADDON = ...
local eventManager = ADDON.eventManager

local core = {}

local function migrate()
    -- V 0.76 or less must reset settings
    if (DJBags_DB == nil or not DJBags_DB.VERSION or DJBags_DB.VERSION < 0.76) then
        DJBags_DB = {
            VERSION = 0.8,
            categories = {
            },
            newItems = {}
        }
    end
    if (DJBags_DB_Char == nil or not DJBags_DB_Char.VERSION or DJBags_DB_Char.VERSION < 0.76) then
        DJBags_DB_Char = {
            VERSION = 0.8,
            categories = {
            },
            newItems = {}
        }
    end
end

function core:ADDON_LOADED(name)
	if ADDON_NAME ~= name then return end

    migrate()

	eventManager:Remove('ADDON_LOADED', core)
end

eventManager:Add('ADDON_LOADED', core)

ToggleAllBags = function()
    if DJBagsBag:IsVisible() then
        DJBagsBag:Hide()
    else
        DJBagsBag:Show()
    end
end

local oldToggle = ToggleBag
ToggleBag = function(id)
    if id < 5 and id > -1 then
        if DJBagsBag:IsVisible() then
            DJBagsBag:Hide()
        else
            DJBagsBag:Show()
        end
    else
        oldToggle(id)
    end
end

ToggleBackpack = function()
    if DJBagsBag:IsVisible() then
        DJBagsBag:Hide()
    else
        DJBagsBag:Show()
    end
end

OpenAllBags = function()
    DJBagsBag:Show()
end

OpenBackpack = function()
    DJBagsBag:Show()
end

CloseAllBags = function()
    DJBagsBag:Hide()
end

CloseBackpack = function()
    DJBagsBag:Hide()
end

SLASH_DJBAGS1, SLASH_DJBAGS2, SLASH_DJBAGS3, SLASH_DJBAGS4 = '/djb', '/dj', '/djbags', '/db';
function SlashCmdList.DJBAGS(msg, editbox)
    DJBagsBag:Show()
end

SLASH_RL1 = '/rl';
function SlashCmdList.RL(msg, editbox)
    ReloadUI()
end