text:
/**
 * Expresses a single CSS Selector.
 *
 * Beginning of array
 * - First index: element name
 * - Subsequent odd indices: attr keys
 * - Subsequent even indices: attr values
 *
 * After SelectorFlags.CLASS flag
 * - Class name values
 *
 * SelectorFlags.NOT flag
 * - Changes the mode to NOT
 * - Can be combined with other flags to set the element / attr / class mode
 *
 * e.g. SelectorFlags.NOT | SelectorFlags.ELEMENT
 *
 * Example:
 * Original: `div.foo.bar[attr1=val1][attr2]`
 * Parsed: ['div', 'attr1', 'val1', 'attr2', '', SelectorFlags.CLASS, 'foo', 'bar']
 *
 * Original: 'div[attr1]:not(.foo[attr2])
 * Parsed: [
 *  'div', 'attr1', '',
 *  SelectorFlags.NOT | SelectorFlags.ATTRIBUTE 'attr2', '', SelectorFlags.CLASS, 'foo'
 * ]
 *
 * See more examples in node_selector_matcher_spec.ts
 */
export declare type CssSelector = (string | SelectorFlags)[];
/**
 * A list of CssSelectors.
 *
 * A directive or component can have multiple selectors. This type is used for
 * directive defs so any of the selectors in the list will match that directive.
 *
 * Original: 'form, [ngForm]'
 * Parsed: [['form'], ['', 'ngForm', '']]
 */
export declare type CssSelectorList = CssSelector[];
/** Flags used to build up CssSelectors */
export declare const enum SelectorFlags {
    /** Indicates this is the beginning of a new negative selector */
    NOT = 1,
    /** Mode for matching attributes */
    ATTRIBUTE = 2,
    /** Mode for matching tag names */
    ELEMENT = 4,
    /** Mode for matching class names */
    CLASS = 8
}
export declare const NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
export declare const unusedValueExportToPlacateAjd = 1;


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('conferences', '0012_auto_20191012_2038'),
    ]

    operations = [
        migrations.AddField(
            model_name='conference',
            name='pretix_event_url',
            field=models.URLField(blank=True, default='', verbose_name='pretix event url'),
        ),
    ]

redpajama_set_name: RedPajamaGithub


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

<title>Dynamic List Input</title>

Dynamic List Input Control

<form>

    <input id="nameBase:dynamic-list-input-row:0:input" rsf:id="input" value="Strongly Disagree" size="20" type="text"/>
    <input id="nameBase:dynamic-list-input-row:0:remove" rsf:id="remove" value="Remove" type="button"/>

    <input id="nameBase:dynamic-list-input-row:1:input" rsf:id="input" value="Disagree" size="20" type="text"/>
    <input id="nameBase:dynamic-list-input-row:1:remove" rsf:id="remove" value="Remove" type="button"/>

  <input id="nameBase:add-row" rsf:id="add-row" type="button" value="Add Scale Point"/>

</form>


text:
'use strict';

module.exports = (ngModule) => {
  require('./posts.create.controller')(ngModule);
  require('./posts.list.controller')(ngModule);
};


text:
package cd4017be.indlog.util.filter;

import javax.annotation.Nullable;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;

/**
 *
 * @author cd4017be
 */
public interface FluidFilterProvider {

	/**
	 * @param stack the actual stack representing the filter or null if created directly from NBT
	 * @return a new filter instance provided by this item
	 */
	PipeFilter<FluidStack, IFluidHandler> getFluidFilter(@Nullable ItemStack stack);

	public static PipeFilter<FluidStack, IFluidHandler> load(NBTTagCompound nbt) {
		Item item;
		if (nbt.hasKey("id", NBT.TAG_STRING)) item = Item.getByNameOrId(nbt.getString("id"));
		else item = Item.getByNameOrId("indlog:fluid_filter"); //backward compatibility
		if (item instanceof FluidFilterProvider) {
			PipeFilter<FluidStack, IFluidHandler> filter = ((FluidFilterProvider)item).getFluidFilter(null);
			if (filter != null) filter.deserializeNBT(nbt);
			return filter;
		} else return null;
	}

}


text:
const React = require('react');

const Nav = ({ title }) => (

    {title}

        Home (current)

);

Nav.propTypes = { title: React.PropTypes.string };
Nav.defaultProps = { title: 'Title' };

module.exports = Nav;


text:
DECLARE_bool(fst_compat_symbols);

namespace fst {

// WARNING: Reading via symbol table read options should
//          not be used. This is a temporary work around for
//          reading symbol ranges of previously stored symbol sets.
struct SymbolTableReadOptions {
  SymbolTableReadOptions() {}

  SymbolTableReadOptions(
      std::vector<std::pair<int64, int64>> string_hash_ranges,
      const string &source)
      : string_hash_ranges(std::move(string_hash_ranges)), source(source) {}

  std::vector<std::pair<int64, int64>> string_hash_ranges;
  string source;
};

struct SymbolTableTextOptions {
  explicit SymbolTableTextOptions(bool allow_negative_labels = false);

  bool allow_negative_labels;
  string fst_field_separator;
};

namespace internal {

// List of symbols with a dense hash for looking up symbol index.
// Hash uses linear probe, rehashes at 0.75% occupancy, avg 6 bytes overhead
// per entry.  Rehash in place from symbol list.
//
// Symbols are stored as c strings to avoid adding memory overhead, but the
// performance penalty for this is high because rehash must call strlen on
// every symbol.  AddSymbol can be another 2x faster if symbol lengths were
// stored.
class DenseSymbolMap {
 public:
  DenseSymbolMap();

  DenseSymbolMap(const DenseSymbolMap &x);

  ~DenseSymbolMap();

  std::pair<int64, bool> InsertOrFind(const string &key);

  int64 Find(const string &key) const;

  const size_t size() const { return symbols_.size(); }

  const string GetSymbol(size_t idx) const {
    return string(symbols_[idx], strlen(symbols_[idx]));
  }

  void RemoveSymbol(size_t idx);

 private:
  // num_buckets must be power of 2.
  void Rehash(size_t num_buckets);

  const char* NewSymbol(const string &sym);

  int64 empty_;
  std::vector<const char *> symbols_;
  std::hash<string> str_hash_;
  std::vector<int64> buckets_;
  uint64 hash_mask_;
};

class SymbolTableImpl {
 public:
  explicit SymbolTableImpl(const string &name)
      : name_(name),
        available_key_(0),
        dense_key_limit_(0),
        check_sum_finalized_(false) {}

  SymbolTableImpl(const SymbolTableImpl &impl)
      : name_(impl.name_),
        available_key_(impl.available_key_),
        dense_key_limit_(impl.dense_key_limit_),
        symbols_(impl.symbols_),
        idx_key_(impl.idx_key_),
        key_map_(impl.key_map_),
        check_sum_finalized_(false) {}

  int64 AddSymbol(const string &symbol, int64 key);

  int64 AddSymbol(const string &symbol) {
    return AddSymbol(symbol, available_key_);
  }

  // Removes the symbol with the given key. The removal is costly
  // (O(NumSymbols)) and may reduce the efficiency of Find() because of a
  // potentially reduced size of the dense key interval.
  void RemoveSymbol(int64 key);

  static SymbolTableImpl *ReadText(
      std::istream &strm, const string &name,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions());

  static SymbolTableImpl* Read(std::istream &strm,
                               const SymbolTableReadOptions &opts);

  bool Write(std::ostream &strm) const;

  // Return the string associated with the key. If the key is out of
  // range (<0, >max), return an empty string.
  string Find(int64 key) const {
    int64 idx = key;
    if (key < 0 || key >= dense_key_limit_) {
      const auto it = key_map_.find(key);
      if (it == key_map_.end()) return "";
      idx = it->second;
    }
    if (idx < 0 || idx >= symbols_.size()) return "";
    return symbols_.GetSymbol(idx);
  }

  // Returns the key associated with the symbol. If the symbol
  // does not exists, return SymbolTable::kNoSymbol.
  int64 Find(const string &symbol) const {
    int64 idx = symbols_.Find(symbol);
    if (idx == -1 || idx < dense_key_limit_) return idx;
    return idx_key_[idx - dense_key_limit_];
  }

  bool Member(int64 key) const { return !Find(key).empty(); }

  bool Member(const string &symbol) const { return Find(symbol) != -1; }

  int64 GetNthKey(ssize_t pos) const {
    if (pos < 0 || pos >= symbols_.size()) return -1;
    if (pos < dense_key_limit_) return pos;
    return Find(symbols_.GetSymbol(pos));
  }

  const string &Name() const { return name_; }

  void SetName(const string &new_name) { name_ = new_name; }

  string CheckSum() const {
    MaybeRecomputeCheckSum();
    return check_sum_string_;
  }

  string LabeledCheckSum() const {
    MaybeRecomputeCheckSum();
    return labeled_check_sum_string_;
  }

  int64 AvailableKey() const { return available_key_; }

  size_t NumSymbols() const { return symbols_.size(); }

 private:
  // Recomputes the checksums (both of them) if we've had changes since the last
  // computation (i.e., if check_sum_finalized_ is false).
  // Takes ~2.5 microseconds (dbg) or ~230 nanoseconds (opt) on a 2.67GHz Xeon
  // if the checksum is up-to-date (requiring no recomputation).
  void MaybeRecomputeCheckSum() const;

  string name_;
  int64 available_key_;
  int64 dense_key_limit_;

  DenseSymbolMap symbols_;
  // Maps index to key for index >= dense_key_limit:
  //   key = idx_key_[index - dense_key_limit]
  std::vector<int64> idx_key_;
  // Maps key to index for key >= dense_key_limit_.
  //  index = key_map_[key]
  map<int64, int64> key_map_;

  mutable bool check_sum_finalized_;
  mutable string check_sum_string_;
  mutable string labeled_check_sum_string_;
  mutable Mutex check_sum_mutex_;
};

}  // namespace internal

// Symbol (string) to integer (and reverse) mapping.
//
// The SymbolTable implements the mappings of labels to strings and reverse.
// SymbolTables are used to describe the alphabet of the input and output
// labels for arcs in a Finite State Transducer.
//
// SymbolTables are reference-counted and can therefore be shared across
// multiple machines. For example a language model grammar G, with a
// SymbolTable for the words in the language model can share this symbol
// table with the lexical representation L o G.
class SymbolTable {
 public:
  static FST_CONSTEXPR const int64 kNoSymbol = -1;

  // Constructs symbol table with an unspecified name.
  SymbolTable() :
      impl_(std::make_shared<internal::SymbolTableImpl>("<unspecified>")) {}

  // Constructs symbol table with a unique name.
  explicit SymbolTable(const string &name)
      : impl_(std::make_shared<internal::SymbolTableImpl>(name)) {}

  virtual ~SymbolTable() {}

  // Reads a text representation of the symbol table from an istream. Pass a
  // name to give the resulting SymbolTable.
  static SymbolTable* ReadText(std::istream &strm,
      const string &name,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) {
    auto *impl = internal::SymbolTableImpl::ReadText(strm, name, opts);
    if (!impl) {
      return nullptr;
    } else {
      return new SymbolTable(impl);
    }
  }

  // Reads a text representation of the symbol table.
  static SymbolTable *ReadText(const string &filename,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) {
    std::ifstream strm(filename, std::ios_base::in);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::ReadText: Can't open file " << filename;
      return nullptr;
    }
    return ReadText(strm, filename, opts);
  }

  // WARNING: Reading via symbol table read options should not be used. This is
  // a temporary work-around.
  static SymbolTable* Read(std::istream &strm,
                           const SymbolTableReadOptions &opts) {
    auto *impl = internal::SymbolTableImpl::Read(strm, opts);
    return (impl) ? new SymbolTable(impl) : nullptr;
  }

  // Reads a binary dump of the symbol table from a stream.
  static SymbolTable *Read(std::istream &strm,
                           const string &source) {
    SymbolTableReadOptions opts;
    opts.source = source;
    return Read(strm, opts);
  }

  // Reads a binary dump of the symbol table.
  static SymbolTable *Read(const string& filename) {
    std::ifstream strm(filename,
                            std::ios_base::in | std::ios_base::binary);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::Read: Can't open file " << filename;
      return nullptr;
    }
    return Read(strm, filename);
  }

  //--------------------------------------------------------
  // Derivable Interface (final)
  //--------------------------------------------------------
  // Creates a reference counted copy.
  virtual SymbolTable *Copy() const { return new SymbolTable(*this); }

  // Adds a symbol with given key to table. A symbol table also keeps track of
  // the last available key (highest key value in the symbol table).
  virtual int64 AddSymbol(const string &symbol, int64 key) {
    MutateCheck();
    return impl_->AddSymbol(symbol, key);
  }

  // Adds a symbol to the table. The associated value key is automatically
  // assigned by the symbol table.
  virtual int64 AddSymbol(const string &symbol) {
    MutateCheck();
    return impl_->AddSymbol(symbol);
  }

  // Adds another symbol table to this table. All key values will be offset
  // by the current available key (highest key value in the symbol table).
  // Note string symbols with the same key value with still have the same
  // key value after the symbol table has been merged, but a different
  // value. Adding symbol tables do not result in changes in the base table.
  virtual void AddTable(const SymbolTable &table);

  virtual void RemoveSymbol(int64 key) {
    MutateCheck();
    return impl_->RemoveSymbol(key);
  }

  // Returns the name of the symbol table.
  virtual const string &Name() const { return impl_->Name(); }

  // Sets the name of the symbol table.
  virtual void SetName(const string &new_name) {
    MutateCheck();
    impl_->SetName(new_name);
  }

  // Return the label-agnostic MD5 check-sum for this table.  All new symbols
  // added to the table will result in an updated checksum. Deprecated.
  virtual string CheckSum() const { return impl_->CheckSum(); }

  // Same as CheckSum(), but returns an label-dependent version.
  virtual string LabeledCheckSum() const { return impl_->LabeledCheckSum(); }

  virtual bool Write(std::ostream &strm) const { return impl_->Write(strm); }

  bool Write(const string &filename) const {
    std::ofstream strm(filename,
                             std::ios_base::out | std::ios_base::binary);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::Write: Can't open file " << filename;
      return false;
    }
    return Write(strm);
  }

  // Dump a text representation of the symbol table via a stream.
  virtual bool WriteText(std::ostream &strm,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) const;

  // Dump an text representation of the symbol table.
  bool WriteText(const string &filename) const {
    std::ofstream strm(filename);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::WriteText: Can't open file " << filename;
      return false;
    }
    return WriteText(strm);
  }

  // Returns the string associated with the key. If the key is out of
  // range (<0, >max), returns an empty string.
  virtual string Find(int64 key) const { return impl_->Find(key); }

  // Returns the key associated with the symbol. If the symbol does not exist,
  // SymbolTable::kNoSymbol is returned.
  virtual int64 Find(const string &symbol) const { return impl_->Find(symbol); }

  // Returns the key associated with the symbol. If the symbol does not exist,
  // SymbolTable::kNoSymbol is returned.
  virtual int64 Find(const char *symbol) const { return impl_->Find(symbol); }

  virtual bool Member(int64 key) const { return impl_->Member(key); }

  virtual bool Member(const string &symbol) const {
    return impl_->Member(symbol);
  }

  // Returns the current available key (i.e., highest key + 1) in the symbol
  // table.
  virtual int64 AvailableKey() const { return impl_->AvailableKey(); }

  // Returns the current number of symbols in table (not necessarily equal to
  // AvailableKey()).
  virtual size_t NumSymbols() const { return impl_->NumSymbols(); }

  virtual int64 GetNthKey(ssize_t pos) const { return impl_->GetNthKey(pos); }

 private:
  explicit SymbolTable(internal::SymbolTableImpl *impl) : impl_(impl) {}

  void MutateCheck() {
    if (!impl_.unique()) impl_.reset(new internal::SymbolTableImpl(*impl_));
  }

  const internal::SymbolTableImpl *Impl() const { return impl_.get(); }

 private:
  std::shared_ptr<internal::SymbolTableImpl> impl_;
};

// Iterator class for symbols in a symbol table.
class SymbolTableIterator {
 public:
  explicit SymbolTableIterator(const SymbolTable &table)
      : table_(table),
        pos_(0),
        nsymbols_(table.NumSymbols()),
        key_(table.GetNthKey(0)) {}

  ~SymbolTableIterator() {}

  // Returns whether iterator is done.
  bool Done() const { return (pos_ == nsymbols_); }

  // Return the key of the current symbol.
  int64 Value() const { return key_; }

  // Return the string of the current symbol.
  string Symbol() const { return table_.Find(key_); }

  // Advances iterator.
  void Next() {
    ++pos_;
    if (pos_ < nsymbols_) key_ = table_.GetNthKey(pos_);
  }

  // Resets iterator.
  void Reset() {
    pos_ = 0;
    key_ = table_.GetNthKey(0);
  }

 private:
  const SymbolTable &table_;
  ssize_t pos_;
  size_t nsymbols_;
  int64 key_;
};

// Relabels a symbol table as specified by the input vector of pairs
// (old label, new label). The new symbol table only retains symbols
// for which a relabeling is explicitly specified.
//
// TODO(allauzen): consider adding options to allow for some form of implicit
// identity relabeling.
template <class Label>
SymbolTable *RelabelSymbolTable(const SymbolTable *table,
    const std::vector<std::pair<Label, Label>> &pairs) {
  auto new_table = new SymbolTable(table->Name().empty() ?
      string() : (string("relabeled_") + table->Name()));
  for (const auto &pair : pairs) {
    new_table->AddSymbol(table->Find(pair.first), pair.second);
  }
  return new_table;
}

// Returns true if the two symbol tables have equal checksums. Passing in
// nullptr for either table always returns true.
bool CompatSymbols(const SymbolTable *syms1, const SymbolTable *syms2,
                   bool warning = true);

// Symbol Table serialization.

void SymbolTableToString(const SymbolTable *table, string *result);

SymbolTable *StringToSymbolTable(const string &str);

}  // namespace fst

#endif  // FST_SYMBOL_TABLE_H_


text:
/**
 * 版权声明: 版权所有 违者必究 2012
 * 日    期:12-6-1
 */
package com.appleframework.rest.impl;

import com.appleframework.rest.*;
import com.appleframework.rest.annotation.HttpAction;
import com.appleframework.rest.client.RestUnmarshaller;
import com.appleframework.rest.client.unmarshaller.JacksonJsonRestUnmarshaller;
import com.appleframework.rest.config.SystemParameterNames;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.bind.ServletRequestDataBinder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <pre>
 *    构建{@link com.appleframework.rest.RestRequestContext}实例
 * </pre>
 *
 * @author 陈雄华
 * @version 1.0
 */
public class ServletRequestContextBuilder implements RequestContextBuilder {

    //通过前端的负载均衡服务器时,请求对象中的IP会变成负载均衡服务器的IP,因此需要特殊处理,下同。
    public static final String X_REAL_IP = "X-Real-IP";

    public static final String X_FORWARDED_FOR = "X-Forwarded-For";

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    private FormattingConversionService conversionService;

    private Validator validator;

    private RestUnmarshaller jsonUnmarshaller = new JacksonJsonRestUnmarshaller();

    public ServletRequestContextBuilder(FormattingConversionService conversionService) {
        this.conversionService = conversionService;
    }

    public ServletRequestContextBuilder() {
    }

    @Override
    public SimpleRestRequestContext buildBySysParams(RestContext restContext,
                                                    Object request,
                                                    Object response) {
        if (!(request instanceof HttpServletRequest)) {
            throw new IllegalArgumentException("请求对象必须是HttpServletRequest的类型");
        }
        if(response != null && !(response instanceof HttpServletResponse)){
            throw new IllegalArgumentException("请求对象必须是HttpServletResponse的类型");
        }

        HttpServletRequest servletRequest = (HttpServletRequest) request;
        SimpleRestRequestContext requestContext = new SimpleRestRequestContext(restContext);

        //设置请求对象及参数列表
        requestContext.setRawRequestObject(servletRequest);
        if (response != null) {
            requestContext.setRawResponseObject(response);
        }
        requestContext.setAllParams(getRequestParams(servletRequest));
        requestContext.setIp(getRemoteAddr(servletRequest)); //感谢melin所指出的BUG

        //设置服务的系统级参数
        requestContext.setMethod(servletRequest.getParameter(SystemParameterNames.getMethod()));
        requestContext.setContent(servletRequest.getParameter(SystemParameterNames.getContent()));
        requestContext.setHttpAction(HttpAction.fromValue(servletRequest.getMethod()));

        //设置服务处理器
        ServiceMethodHandler serviceMethodHandler =
                restContext.getServiceMethodHandler(requestContext.getMethod());
        requestContext.setServiceMethodHandler(serviceMethodHandler);

        return requestContext;
    }

    private String getRemoteAddr(HttpServletRequest request) {
        String remoteIp = request.getHeader(X_REAL_IP); //nginx反向代理
        if (StringUtils.hasText(remoteIp)) {
            return remoteIp;
        } else {
            remoteIp = request.getHeader(X_FORWARDED_FOR);//apache反射代理
            if (StringUtils.hasText(remoteIp)) {
                String[] ips = remoteIp.split(",");
                for (String ip : ips) {
                    if (!"null".equalsIgnoreCase(ip)) {
                        return ip;
                    }
                }
            }
            return request.getRemoteAddr();
        }
    }

    /**
     * 将{@link HttpServletRequest}的数据绑定到{@link com.appleframework.rest.RestRequestContext}的{@link com.appleframework.rest.RestRequest}中,同时使用
     * JSR 303对请求数据进行校验,将错误信息设置到{@link com.appleframework.rest.RestRequestContext}的属性列表中。
     *
     * @param restRequestContext
     */
    @Override
    public RestRequest buildRestRequest(RestRequestContext restRequestContext) {
        AbstractRestRequest restRequest = null;
        if (restRequestContext.getServiceMethodHandler().isRestRequestImplType()) {
            HttpServletRequest request =
                    (HttpServletRequest) restRequestContext.getRawRequestObject();

            //修改 对传json字符串的支持
            String content = restRequestContext.getContent();
            BindingResult bindingResult = null;
            if(null != content) {
                bindingResult = doBind(request, content, restRequestContext.getServiceMethodHandler().getRequestType());
            }
            else {
                bindingResult = doBind(request, restRequestContext.getServiceMethodHandler().getRequestType());
            }
            restRequest = buildRestRequestFromBindingResult(restRequestContext, bindingResult);

            List<ObjectError> allErrors = bindingResult.getAllErrors();
            restRequestContext.setAttribute(SimpleRestRequestContext.SPRING_VALIDATE_ERROR_ATTRNAME, allErrors);
        } else {
            restRequest = new DefaultRestRequest();
        }
        restRequest.setRestRequestContext(restRequestContext);
        return restRequest;
    }

    private AbstractRestRequest buildRestRequestFromBindingResult(RestRequestContext restRequestContext, BindingResult bindingResult) {
        AbstractRestRequest restRequest = (AbstractRestRequest) bindingResult.getTarget();
        if (restRequest instanceof AbstractRestRequest) {
            AbstractRestRequest abstractRestRequest = restRequest;
            abstractRestRequest.setRestRequestContext(restRequestContext);
        } else {
            logger.warn(restRequest.getClass().getName() + "不是扩展于" + AbstractRestRequest.class.getName() +
                    ",无法设置" + RestRequestContext.class.getName());
        }
        return restRequest;
    }

    @SuppressWarnings("rawtypes")
	private HashMap<String, String> getRequestParams(HttpServletRequest request) {
        Map srcParamMap = request.getParameterMap();
        HashMap<String, String> destParamMap = new HashMap<String, String>(srcParamMap.size());
        for (Object obj : srcParamMap.keySet()) {
            String[] values = (String[]) srcParamMap.get(obj);
            if (values != null && values.length > 0) {
                destParamMap.put((String) obj, values[0]);
            } else {
                destParamMap.put((String) obj, null);
            }
        }
        return destParamMap;
    }

    private BindingResult doBind(HttpServletRequest webRequest, Class<? extends RestRequest> requestType) {
        RestRequest bindObject = BeanUtils.instantiateClass(requestType);
        ServletRequestDataBinder dataBinder = new ServletRequestDataBinder(bindObject, "bindObject");
        dataBinder.setConversionService(getFormattingConversionService());
        dataBinder.setValidator(getValidator());
        dataBinder.bind(webRequest);
        dataBinder.validate();
        return dataBinder.getBindingResult();
    }

    private BindingResult doBind(HttpServletRequest webRequest, String content, Class<? extends RestRequest> requestType) {
        RestRequest bindObject = jsonUnmarshaller.unmarshaller(content, requestType);
        ServletRequestDataBinder dataBinder = new ServletRequestDataBinder(bindObject, "bindObject");
        dataBinder.setConversionService(getFormattingConversionService());
        dataBinder.setValidator(getValidator());
        dataBinder.bind(webRequest);
        dataBinder.validate();
        return dataBinder.getBindingResult();
    }

    private Validator getValidator() {
        if (this.validator == null) {
            LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
            localValidatorFactoryBean.afterPropertiesSet();
            this.validator = localValidatorFactoryBean;
        }
        return this.validator;
    }

    public FormattingConversionService getFormattingConversionService() {
        return conversionService;
    }

    //默认的{@link RestRequest}实现类
    private class DefaultRestRequest extends AbstractRestRequest {
    }
}


text:
package fr.soleil.lib.ci.jenkinsjobgenerator.domain.mustache;

/**
 * Created by ABEILLE on 09/04/2014.
 */
public class JenkinsSvnConfig extends JenkinsConfig {

    private String svnurl;

    public JenkinsSvnConfig(String description, String emails, String svnurl) {
        super(description, emails);
        this.svnurl = svnurl;
    }

    public String getSvnurl() {
        return svnurl;
    }

}


text:
//
//  SecEvent.m
//  Done
//
//  Created by Lyt on 14-5-19.
//  Copyright (c) 2014年 LYT Computer Company. All rights reserved.
//

//This class serves for the view of adding second event

#import "SecEvent.h"
#import "MainControl.h"

@interface SecEvent ()
@property (strong, nonatomic) IBOutlet UIView *SecEventView;
@property (strong, nonatomic) UITextView *SecTextView;
@property (strong, nonatomic) UITextField *SecHeishuText;   //Black level
@property (strong, nonatomic) UILabel *ShuruLable;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *ConfirmButton;
@property (strong, nonatomic) UIButton *ToTop;  //The button to hide keyboard
@property BOOL isSomethingWrong;    //Record whether the user input wrong
@property BOOL is4Inch;

@end

@implementation SecEvent

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void)viewDidAppear:(BOOL)animated
{
    if (self.is4Inch) {
        [self.SecTextView becomeFirstResponder];
    }else{
        BOOL Yongjiu = [[[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"yongjiu"] boolValue];
        if (Yongjiu == YES) {
            [self.SecTextView becomeFirstResponder];
        }else{
            [self.SecHeishuText becomeFirstResponder];
        }
    }
}

-(void)viewWillAppear:(BOOL)animated
{

}

- (void)viewDidLoad
{
    [super viewDidLoad];

    if ([UIScreen mainScreen].bounds.size.height == 568) {
        self.is4Inch = YES;
    }else{
        self.is4Inch = NO;
    }

    // Do any additional setup after loading the view.
    BOOL Yongjiu = [[[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"yongjiu"] boolValue];
    if (Yongjiu == YES) {  //Only one textview if the user select permenant
        if (self.is4Inch) {
            self.SecTextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 102, 280, 210)];
            self.ShuruLable = [[UILabel alloc] initWithFrame:CGRectMake(20, 58, 280, 54)];
            self.ShuruLable.text = @"输入详细信息";
            self.ShuruLable.font = [UIFont fontWithName: @"System" size:16];
        }else{
            self.SecTextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 102, 280, 120)];
            self.ShuruLable = [[UILabel alloc] initWithFrame:CGRectMake(20, 58, 280, 54)];
            self.ShuruLable.text = @"输入详细信息";
            self.ShuruLable.font = [UIFont fontWithName: @"System" size:16];
        }
        self.SecTextView.font = [UIFont systemFontOfSize:14];
        self.SecTextView.backgroundColor = [UIColor lightGrayColor];

        [self.SecEventView addSubview:self.SecTextView];
        [self.SecEventView addSubview:self.ShuruLable];
    }else{
        self.isSomethingWrong = NO;
        if (self.is4Inch) {
            self.SecHeishuText = [[UITextField alloc] initWithFrame: CGRectMake(20, 270, 280, 54)];
            self.ShuruLable = [[UILabel alloc] initWithFrame:CGRectMake(20, 58, 280, 54)];
            self.ShuruLable.text = @"输入详细信息";
            self.ShuruLable.font = [UIFont fontWithName: @"System" size:18];
        }else{
            self.SecHeishuText = [[UITextField alloc] initWithFrame: CGRectMake(20, 75, 280, 54)];
            self.SecHeishuText.delegate = self;
            self.ShuruLable = [[UILabel alloc] initWithFrame:CGRectMake(20, 120, 280, 54)];
            self.ShuruLable.text = @"输入详细信息";
            self.ShuruLable.font = [UIFont fontWithName: @"System" size:16];

            self.ToTop = [[UIButton alloc] initWithFrame:CGRectMake(270, 240, 45, 45)];
            [self.ToTop setImage:[UIImage imageNamed:@"HideKeyboard"] forState:UIControlStateNormal];
            [self.ToTop addTarget:self action:@selector(HideKey:) forControlEvents:UIControlEventTouchDown];

        }
        [self.SecHeishuText setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"NewName.png"]]];
        UIImageView *imgv2=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NewHeishuLeft.png"]];
        self.SecHeishuText.leftView=imgv2;
        self.SecHeishuText.leftViewMode = UITextFieldViewModeAlways;
        [self.SecHeishuText setBorderStyle:UITextBorderStyleNone];
        self.SecHeishuText.placeholder = @"增加黑度";
        self.SecHeishuText.autocorrectionType = UITextAutocorrectionTypeNo;
        self.SecHeishuText.autocapitalizationType = UITextAutocapitalizationTypeNone;
        self.SecHeishuText.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.SecHeishuText.font = [UIFont systemFontOfSize:20];
        self.SecHeishuText.keyboardType = UIKeyboardTypeNumberPad;
        self.SecHeishuText.delegate = self;

        if (self.is4Inch) {
            self.SecTextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 102, 280, 160)];
        }else{
            self.SecTextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 160, 280, 130)];
            self.SecTextView.delegate = self;
        }
        self.SecTextView.font = [UIFont systemFontOfSize:14];
        self.SecTextView.backgroundColor = [UIColor lightGrayColor];

        [self.SecEventView addSubview:self.ShuruLable];
        [self.SecEventView addSubview:self.SecHeishuText];
        [self.SecEventView addSubview:self.SecTextView];
    }

    UIColor *bgColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0];
    [self.SecEventView setBackgroundColor:bgColor];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//This function refers user click the OK button
- (IBAction)ConfirmSec:(UIBarButtonItem *)sender {

    if ([[[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"yongjiu"] boolValue]) {
        NSString *newwhy = self.SecTextView.text;
        if ([newwhy isEqualToString:@""]) {
            newwhy = @"无描述";
        }

        NSDate *d2 = [NSDate date];
        NSTimeZone *zone2 = [NSTimeZone systemTimeZone];
        NSInteger interval2 = [zone2 secondsFromGMTForDate: d2];
        NSDate *localeDate2 = [d2 dateByAddingTimeInterval: interval2];        //Get the time of current time zone
        [[MainControl sharedInstance] NewWhytoNum:self.NumThing withwhy: newwhy indate:localeDate2];

        [[MainControl sharedInstance] SyncIn];
        [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
    }else{
        NSString *x = self.SecHeishuText.text;
        NSInteger y = [x integerValue];     //see if the number of user input is right
        if ([x isEqual:@""] || y <= 0 || y > 100) {
            [self.SecHeishuText setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"InputNo"]]];
            UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NewHeishuLeftNo"]];
            self.SecHeishuText.leftView=imgv;
            self.SecHeishuText.text = @"";
            self.SecHeishuText.placeholder = @"请输入1~100数值";
            self.isSomethingWrong = YES;

            [self.SecHeishuText resignFirstResponder];
            [self.SecTextView resignFirstResponder];
        }else{
            NSNumber *OriginHeidu = [[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"originheishu"];
            NSInteger Origin = [OriginHeidu integerValue];

            NSNumber *ManuHeidu = [[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"manuheishu"];
            NSInteger Manu = [ManuHeidu integerValue];

            NSDate *Oridate = [[[[MainControl sharedInstance].thingarray objectAtIndex:(NSUInteger)self.NumThing] objectAtIndex:0] objectForKey:@"date"];   //current date
            NSInteger MeiriDown = [[[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"meiri"] integerValue];      //level of decrease everyday

            NSDate *localDate = [NSDate date];
            NSTimeInterval Inter = [localDate timeIntervalSinceDate:Oridate];       //retreve the time interval, unit is seconds in double

            NSInteger Day = Inter/(3600 * 24);
            NSInteger TimeCount = Day*MeiriDown;

            NSInteger Final = Origin - Manu - TimeCount;

            NSInteger new = [self.SecHeishuText.text integerValue];    //new black level

            NSInteger newcurrent = new + Final;     //if the new black level exceed the original, we set the new to be the newest
            if(newcurrent >= Origin)
            {
                if (newcurrent >= 100) {    //top limit is 100
                    Origin = 100;
                    newcurrent = 100;
                }else{
                    Origin = newcurrent;
                }

                NSNumber *NewOrigin = [NSNumber numberWithInteger:Origin];
                NSNumber *NewManu = [NSNumber numberWithInteger: - TimeCount];      //To compensate the time

                //renew the data
                [[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] setObject:NewOrigin forKey:@"originheishu"];
                [[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] setObject:NewManu forKey:@"manuheishu"];

                //renew the push notification time--------------------------
                float tempDays = ceil(newcurrent * 1.0 / MeiriDown);
                NSInteger tempSecs = tempDays * 24 * 60 * 60;
                NSDate *date = [NSDate dateWithTimeIntervalSinceNow:tempSecs];

                UIApplication *app = [UIApplication sharedApplication];     //get local push notification array
                NSArray *localArr = [app scheduledLocalNotifications];
                if (localArr) {
                    BOOL NotiStillThere = NO;
                    for (UILocalNotification *noti in localArr) {
                        NSDictionary *dict = noti.userInfo;
                        if (dict) {
                            NSString *inKey = [dict objectForKey:@"key"];
                            if ([inKey isEqualToString: self.PushName]) {
                                [noti setFireDate:date];
                                NotiStillThere = YES;
                                break;
                            }
                        }
                    }

                    if (NotiStillThere == NO) {
                        //If there's no push notification, then start one
                        UILocalNotification *noti = [[UILocalNotification alloc] init];
                        if (noti) {
                            //set time
                            noti.fireDate = date;
                            //set time zone
                            noti.timeZone = [NSTimeZone defaultTimeZone];
                            //set repeats
                            noti.repeatInterval = 0;
                            //sound
                            noti.soundName = @"laheiTone.wav";
                            //content
                            NSString *tt = [self.PushName stringByAppendingString:@"已经解除拉黑"];
                            noti.alertBody = tt;
                            //clear the alert number appeared on the icon
                            noti.applicationIconBadgeNumber = 0;

                            //Set user info, convenient for deletion
                            NSDictionary *infoDic = [NSDictionary dictionaryWithObject:self.PushName forKey:@"key"];    //Key is the name
                            noti.userInfo = infoDic;
                            UIApplication *app = [UIApplication sharedApplication];
                            [app scheduleLocalNotification:noti];
                        }

                    }
                }

            }else{
                NSNumber *NewManu = [NSNumber numberWithInteger:(Manu - new)];      //原有的减少多少,要减去最近加的
                [[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] setObject:NewManu forKey:@"manuheishu"];      //将更新的人为存进去

                //更新推送通知时间--------------------------
                float tempDays = ceil(newcurrent * 1.0 / MeiriDown);
                NSInteger tempSecs = tempDays * 24 * 60 * 60;
                NSDate *date = [NSDate dateWithTimeIntervalSinceNow:tempSecs];  //算好时间按秒算

                UIApplication *app = [UIApplication sharedApplication];
                //获取本地推送数组
                NSArray *localArr = [app scheduledLocalNotifications];

                if (localArr) {
                    //如果有推送通知
                    for (UILocalNotification *noti in localArr) {
                        //每一个推送通知都看
                        NSDictionary *dict = noti.userInfo; //取出userinfo字典看
                        if (dict) {
                            //如果字典中有东西
                            NSString *inKey = [dict objectForKey:@"key"];
                            if ([inKey isEqualToString: self.PushName]) {
                                //每个推送通知都有一个key值,如果对的话重置时间
                                [noti setFireDate:date];
                                break;
                            }
                        }
                    }
                }

            }

            NSDate *localDate2 = [NSDate date];
            NSString *newwhy = self.SecTextView.text;
            if ([newwhy isEqualToString:@""]) {
                newwhy = @"无描述";
            }

            [[MainControl sharedInstance] NewWhytoNum:self.NumThing withwhy: newwhy indate:localDate2];

            [[MainControl sharedInstance] SyncIn];
            [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];

        }
    }
}

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    if (self.isSomethingWrong) {
        if ([textField isEqual: self.SecHeishuText]) {
            self.isSomethingWrong = NO;
            [self.SecHeishuText setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"NewName"]]];    //添加图片上去
            UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NewHeishuLeft"]];
            self.SecHeishuText.leftView=imgv;
            self.SecHeishuText.placeholder = @"增加黑度";
        }
    }
}

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (self.isSomethingWrong) {
        if ([textField isEqual: self.SecHeishuText]) {
            self.isSomethingWrong = NO;
            [self.SecHeishuText setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"NewName"]]];    //添加图片上去
            UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NewHeishuLeft"]];
            self.SecHeishuText.leftView=imgv;
            self.SecHeishuText.placeholder = @"增加黑度";
        }
    }
    return YES;
}

-(void)textViewDidBeginEditing:(UITextView *)textView
{
    int offset;
    CGRect frame = textView.frame;
    offset = frame.origin.y + 169 - (self.SecEventView.frame.size.height - 216.0);//The height of keyboard is 216

    NSTimeInterval animationDuration = 0.20f;

    [UIView beginAnimations:@"TextViewForKeyboard" context:nil];
    [UIView setAnimationDuration:animationDuration];
    if(offset > 0)
    {
        self.SecEventView.frame = CGRectMake(0.0f, -offset, self.view.frame.size.width, self.view.frame.size.height);
    }
    [UIView commitAnimations];

    [self.SecEventView addSubview:self.ToTop];
}

//This function serves for touch the background and hide the keyboard
- (IBAction)SecViewTouchDown:(UIControl *)sender {
    BOOL Yongjiu = [[[[MainControl sharedInstance].dataarray objectAtIndex:(NSUInteger)self.NumThing] objectForKey:@"yongjiu"] boolValue];
    if (!self.is4Inch && !Yongjiu) {
        [self.ToTop removeFromSuperview];

        [self.SecTextView resignFirstResponder];
        [self.SecHeishuText resignFirstResponder];

        [self.SecTextView resignFirstResponder];

        CGRect frame = self.SecEventView.frame;
        int offset = 0 - frame.origin.y;

        NSTimeInterval animationDuration = 0.20f;
        [UIView beginAnimations:@"HideKeyboard" context:nil];
        [UIView setAnimationDuration:animationDuration];

        if(offset > 0)
            self.SecEventView.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

        [UIView commitAnimations];
    }
}

//This function serves for hidding the keyboard by resign responder and move the whole view down
-(void)HideKey:(UIButton*)sender{
    [self.ToTop removeFromSuperview];

    [self.SecTextView resignFirstResponder];

    CGRect frame = self.SecEventView.frame;
    int offset = 0 - frame.origin.y;

    NSTimeInterval animationDuration = 0.20f;
    [UIView beginAnimations:@"HideKeyboard" context:nil];
    [UIView setAnimationDuration:animationDuration];

    if(offset > 0)
        self.SecEventView.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

    [UIView commitAnimations];
}

/*

//Touch background to hide the keyboard
- (IBAction)backgroundTap:(id)sender {
    [self.HeiduField resignFirstResponder];
    [self.NameField resignFirstResponder];
    [self.MeiRiField resignFirstResponder];
    [self.NewWhyField resignFirstResponder];

    CGRect frame = self.NewEventView.frame;
    int offset = 0 - frame.origin.y;

    NSTimeInterval animationDuration = 0.20f;
    [UIView beginAnimations:@"ResizeForKeyboard" context:nil];
    [UIView setAnimationDuration:animationDuration];

    if(offset > 0)
        self.NewEventView.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

    [UIView commitAnimations];
}
 */

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
@implementation FTActionsIcon

+ (UIApplicationShortcutIconType)toShortcutIconType:(FTActionsIconType)actionIconType
{
    switch (actionIconType)
    {
        case FTActionsIconTypeCompose:
            return UIApplicationShortcutIconTypeCompose;
        case FTActionsIconTypePlay:
            return UIApplicationShortcutIconTypePlay;
        case FTActionsIconTypePause:
            return UIApplicationShortcutIconTypePause;
        case FTActionsIconTypeAdd:
            return UIApplicationShortcutIconTypeAdd;
        case FTActionsIconTypeLocation:
            return UIApplicationShortcutIconTypeLocation;
        case FTActionsIconTypeSearch:
            return UIApplicationShortcutIconTypeSearch;
        case FTActionsIconTypeShare:
            return UIApplicationShortcutIconTypeShare;
        case FTActionsIconTypeProhibit:
            return UIApplicationShortcutIconTypeProhibit;
        case FTActionsIconTypeContact:
            return UIApplicationShortcutIconTypeContact;
        case FTActionsIconTypeHome:
            return UIApplicationShortcutIconTypeHome;
        case FTActionsIconTypeMarkLocation:
            return UIApplicationShortcutIconTypeMarkLocation;
        case FTActionsIconTypeFavorite:
            return UIApplicationShortcutIconTypeFavorite;
        case FTActionsIconTypeLove:
            return UIApplicationShortcutIconTypeLove;
        case FTActionsIconTypeCloud:
            return UIApplicationShortcutIconTypeCloud;
        case FTActionsIconTypeInvitation:
            return UIApplicationShortcutIconTypeInvitation;
        case FTActionsIconTypeConfirmation:
            return UIApplicationShortcutIconTypeConfirmation;
        case FTActionsIconTypeMail:
            return UIApplicationShortcutIconTypeMail;
        case FTActionsIconTypeMessage:
            return UIApplicationShortcutIconTypeMessage;
        case FTActionsIconTypeDate:
            return UIApplicationShortcutIconTypeDate;
        case FTActionsIconTypeTime:
            return UIApplicationShortcutIconTypeTime;
        case FTActionsIconTypeCapturePhoto:
            return UIApplicationShortcutIconTypeCapturePhoto;
        case FTActionsIconTypeCaptureVideo:
            return UIApplicationShortcutIconTypeCaptureVideo;
        case FTActionsIconTypeTask:
            return UIApplicationShortcutIconTypeTask;
        case FTActionsIconTypeTaskCompleted:
            return UIApplicationShortcutIconTypeTaskCompleted;
        case FTActionsIconTypeAlarm:
            return UIApplicationShortcutIconTypeAlarm;
        case FTActionsIconTypeBookmark:
            return UIApplicationShortcutIconTypeBookmark;
        case FTActionsIconTypeShuffle:
            return UIApplicationShortcutIconTypeShuffle;
        case FTActionsIconTypeAudio:
            return UIApplicationShortcutIconTypeAudio;
        case FTActionsIconTypeUpdate:
            return UIApplicationShortcutIconTypeUpdate;
        case FTActionsIconTypeCustom:
            return FTActionsIconTypeCustomValue;
    }
}

@end


text:
project_path: /web/_project.yaml
book_path: /web/tools/_book.yaml
description: Reference documentation for the "Element ARIA Attributes Are Allowed For This Role" Lighthouse audit.

{# wf_updated_on: 2017-01-13 #}
{# wf_published_on: 2017-01-13 #}

# Element ARIA Attributes Are Allowed For This Role  {: .page-title }

## Why the audit is important {: #why }

Invalid role-attribute combinations can disable the accessibility of your
page.

## How to pass the audit {: #how }

<<_shared/query.md>>

To find each element's invalid combination(s):

1. Note the `role` and `aria-*` attributes of the element.

1. Go to [Definition of Roles][roles].

1. Go to the page for this element's `role`.

1. Check the `aria-*` attributes of the element against the **Required
   States and Properties** or **Supported States and Properties** lists. Any
   attribute that is not in one of these two lists is invalid.

To fix the invalid combo, you can either remove the invalid attributes from
the element, or change the role of the element to one that supports the
attributes.

[qs]: /web/tools/chrome-devtools/console/command-line-reference#queryselector
[qsa]: /web/tools/chrome-devtools/console/command-line-reference#queryselectorall
[xp]: /web/tools/chrome-devtools/console/command-line-reference#xpath
[roles]: https://www.w3.org/TR/wai-aria/roles#role_definitions

{% include "web/tools/lighthouse/audits/implementation-heading.html" %}

This audit is powered by the aXe Accessibility Engine. See [Elements must only
use allowed ARIA attributes][axe] for more information.

[axe]: https://dequeuniversity.com/rules/axe/1.1/aria-allowed-attr

{% include "web/tools/lighthouse/audits/_feedback/aria-allowed-attributes.html" %}


text:
package com.kolich.spring.tags.parameter;

import com.kolich.spring.tags.ContextAwareTag;

public abstract class ParameterTag extends ContextAwareTag {

	private static final long serialVersionUID = 8156385022283270968L;

	/**
	 * Returns a String containing the value of the named context-wide
	 * initialization parameter, or null if the parameter does not exist.
	 * @param name
	 * @return
	 */
	protected final String getParameter(final String name) {
		return getServletContext().getInitParameter(name);
	}

}


text:
import contextlib
import unittest, os, sys
sys.path.insert(0, os.path.join(__file__, '../..'))
import fate

class AnswerLog(object):
    def __init__(self, testCase):
        self.testCase = testCase
    i = 0
    def ansLog(self, *a, **k): self.i += 1
    __call__ = ansLog

    def __enter__(self): return self
    def __exit__(self, exc=None, exc_type=None, exc_tb=None): pass

    def assertCalled(self, n, msg="Should have been called N times"):
        return self.testCase.assertEqual(self.i, n, msg)
    def assertAnswered(self, msg="Should have answered"):
        return self.assertCalled(1, msg)
    def assertUnanswered(self, msg="Should NOT have answered"):
        return self.assertCalled(0, msg)

class TestFate(unittest.TestCase):
    def answerLog(self): return AnswerLog(self)

    def testResolved(self):
        f = fate.resolved(42)
        self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f.then(ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.then(success=ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.then(failure=ansLog)
            ansLog.assertUnanswered()

        with self.answerLog() as ansLog:
            f.then(None, ansLog)
            ansLog.assertUnanswered()

        with self.answerLog() as ansLog:
            f.always(ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.done(ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.fail(ansLog)
            ansLog.assertUnanswered()

    def testRejected(self):
        f = fate.rejected(42)
        self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f.then(ansLog)
            ansLog.assertUnanswered()

        with self.answerLog() as ansLog:
            f.then(success=ansLog)
            ansLog.assertUnanswered()

        with self.answerLog() as ansLog:
            f.then(failure=ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.then(None, ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.always(ansLog)
            ansLog.assertAnswered()

        with self.answerLog() as ansLog:
            f.done(ansLog)
            ansLog.assertUnanswered()

        with self.answerLog() as ansLog:
            f.fail(ansLog)
            ansLog.assertAnswered()

    def testThenableResolve(self):
        f = fate.thenable()
        self.assertIsNone(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(ansLog)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(success=ansLog)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(failure=ansLog)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertUnanswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(None, ansLog)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertUnanswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(ansLog, ansLog)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

    def testThenableReject(self):
        f = fate.thenable()
        self.assertIsNone(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(ansLog)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertUnanswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(success=ansLog)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertUnanswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(failure=ansLog)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(None, ansLog)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.thenable(ansLog, ansLog)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

    def testDeferredResolve(self):
        f = fate.deferred()
        self.assertIsNone(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(success=ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(failure=ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertUnanswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(None, ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertUnanswered()
            self.assertTrue(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(ansLog, ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.resolve(42)
            ansLog.assertAnswered()
            self.assertTrue(f.state)

    def testDeferredReject(self):
        f = fate.deferred()
        self.assertIsNone(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertUnanswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(success=ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertUnanswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(failure=ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(None, ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

        with self.answerLog() as ansLog:
            f = fate.deferred()
            f.then(ansLog, ansLog)
            self.assertIsNone(f.state)
            ansLog.assertUnanswered()
            f.reject(-1942)
            ansLog.assertAnswered()
            self.assertFalse(f.state)

if __name__=='__main__':
    unittest.main()


text:
'''
Interface system. This is inspired by Haskell's typeclass instances

Interfaces are subclasses of Interface.

To declare that a class supports an interface use
@implementing(interface), where interface is an Interface. Multiple
interfaces can be specified: @implementing(i1, i2, ...)

To check whether a given class or object implements an interface, use
implements(obj, interface)
'''

class ImplementError(TypeError): pass

class Interface(object): pass

def implementing(*impl_list):
  intface_names = {}
  for intface_class in impl_list:
    for func_name in intface_class.__interface__:
      if func_name in intface_names:
        raise ImplementError (func_name +
              " defined in multiple intface_names: %s, %s"
              % (intface_names[func_name], intface_class.__name__))
      else:
        intface_names[func_name] = intface_class.__name__

  def deco(klass):
    for ifunc_name in intface_names:
      try:
        getattr(klass, ifunc_name)
      except AttributeError:
        raise ImplementError (
            "Interface %s requires %s to be implemented"
            % (intface_names[ifunc_name], ifunc_name))
      klass.__implements__ = impl_list
      return klass

  return deco

def implements(obj, intface):
  if not issubclass(intface, Interface):
    raise TypeError("2nd argument must be an Interface (or subclass)")

  if not getattr(obj, '__implements__', False):
    return False

  return intface in obj.__implements__


text:
package sliceutils

func StringInSlice(s string, list []string) bool {
	for _, v := range list {
		if v == s {
			return true
		}
	}

	return false
}


text:
$solutionDir = split-path $dte.Solution.Properties('Path').Value -parent;
$scriptPath = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent;
function publish($package) {
	if (!(test-path $package)) {
		throw ('Unable teo find nuget package ' + $package + ' for publishing');
	}
	nuget push $package;
}

$metadataPath = join-path $solutionDir 'metadata.xml';
if (!(test-path $metadataPath)) {
	throw ('unable to find solution metadata at ' + $metadataPath);
}
$metadata = [xml](get-content $metadataPath);
$metadata = $metadata.solution;
if (!$metadata) {
	throw ('metadata file  at ' + $metadataPath + ' is missing root solution node');
}

$version = $metadata.version;

$packages = @();
$errors = $false;
# run nuget pack
foreach ($proj in $dte.Solution) {
  if (!$proj -or !$proj.FullName) { continue; }

  $path = split-path -parent $proj.FullName;
  $nuspec = join-path $path 'package.nuspec';
  if (!(Test-Path $nuspec)) {
    write-verbose ('No nuspec found at ' + $nuspec);
    continue;
  }

  $nuspecData = [xml](get-content $nuspec);
  $name = $nuspecData.package.metadata.id + '.' + $nuspecDAta.package.metadata.version + '.nupkg';
  $pkg = (join-path $solutionDir $name);

  if (!(Test-PAth $pkg)) {
	write-error ('Unable to find nuget package at ' + $pkg);
	$errors = $true;
  }
  $packages += $pkg;
}

if ($errors) {
  write-error 'One or more errors ocurred while trying to publish';
  return;
}

foreach ($pkg in $packages) {
	nuget push $pkg;
}


text:
/* C M D W N D . C */
/* windowing commands  */

#define NOKEYSTATE
#define NOICON
#define NOBRUSH
#define NOCREATESTRUCT
#define NODRAWTEXT
#define NOMETAFILE
#define NOMINMAX
#define NOPEN
#define NOREGION
#define NOSOUND
#define NOTEXTMETRIC
#define NOWNDCLASS
#define NOCOMM
#include "word.h"
DEBUGASSERTSZ            /* WIN - bogus macro for assert string */
#include "version.h"
#include "heap.h"
#define NOIFK
#define USEBCM
#include "opuscmd.h"
#include "keys.h"
#include "doc.h"
#include "disp.h"
#include "splitter.h"
#include "props.h"
#include "sel.h"
#include "screen.h"
#include "print.h"
#include "ch.h"
#include "format.h"
#include "status.h"
#include "wininfo.h"
#include "menu2.h"
#include "dde.h"
#include "help.h"
#include "debug.h"
#include "field.h"
#include "cmdtbl.h"
#include "core.h"
#include "idle.h"
#include "layout.h"
#include "preview.h"
#include "message.h"
#include "rsb.h"
#include "resource.h"
#include "error.h"
#include "rerr.h"
#include "scc.h"
#include "el.h"
#include "macrocmd.h"
#include "automcr.h"
#include "doslib.h"

extern MES ** vhmes;
extern struct STTB **   vhsttbOpen;
extern BOOL             vfFileCacheDirty;
extern BOOL             vfDdeIdle;
extern HBRUSH           vhbrGray;
extern HWND             vhwndPgPrvw;
extern BOOL             vfRecording;
extern struct SCC       vsccAbove;
extern struct WWD **vhwwdOrigin;
extern FARPROC          vlppFWHChain;
extern int              vfInitializing;
extern struct MWD       **hmwdCur;
extern int              vlm;
extern PVS              vpvs;
extern int              mwCur;
extern int              mwMac; /* mac of child window */
extern int              wwMac;
#ifdef WIN23
extern struct BMI *mpidrbbmi;
#else
extern struct BMI mpidrbbmi[];
#endif /* WIN23 */
extern int              wwCreating;
extern struct MWD       **mpmwhmwd[];
extern int              docGlobalDot;
extern struct DOD       **mpdochdod[];
extern struct RC        vrcUnZoom;
extern struct SCI       vsci;
extern struct PRI       vpri;
extern struct FLI       vfli;
extern BOOL             vfWaitForDraw;
extern struct PREF      vpref;
extern HANDLE           vhInstance;
extern HWND             vhwndApp;          /* handle to parent's window */
extern HWND             vhwndDeskTop;
extern HWND             vhwndPgvCtl;
extern int              vmwClipboard;
extern BOOL             fElActive;
extern HWND             vhwndStatLine;
extern BOOL             vfExtendSel;
extern MSG              vmsgLast;
extern struct WWD       **mpwwhwwd[];
extern struct WWD       **hwwdCur;
extern BOOL             vfInLongOperation;
extern int              wwCur;
extern struct SEL       selCur;
extern struct SEL       selDotted;
extern int              vfDeactByOtherApp;
extern HWND             vhwndMsgBoxParent;
extern IDF		vidf;
extern int              vfSysMenu;
extern int              vssc;
extern struct MERR      vmerr;
extern int              flashID;
extern int              vfFocus;
extern int              vfDoubleClick;
extern HCURSOR          vhcStyWnd;
extern CP               vcpFetch;
extern int              vfSeeSel;
extern char             szApp[];
extern int              docCur;
extern HWND             vhwndAppModalFocus;
extern BOOL		fRecordMove;
extern BOOL		fRecordSize;
extern int              vfLargeFrameEMS;
extern int              vfSmallFrameEMS;
extern int              vfUrgentAlloc;
extern HANDLE  vhInstance;
extern HWND  vhwndApp;
extern HWND  vhwndDeskTop;
extern HMENU vhMenu;
extern BOOL  vfInitializing;
extern struct WWD       **hwwdCur;
extern int              wwCur;
extern struct WWD       **mpwwhwwd[];
extern struct MWD       **hmwdCur;
extern int              mwCur;
extern struct MWD       **mpmwhmwd[];
extern struct STTB      **vhsttbWnd;
extern struct SCI  vsci;
extern struct SEL  selCur;
extern struct PREF vpref;
extern struct FTI  vfti;
extern struct LCB  vlcb;
extern struct CA caPage;
extern struct CA caPara;
extern struct FLI vfli;
extern int wwCur;
extern BOOL vfOvertypeMode;
extern BOOL vfExtendSel;
extern BOOL vfBlockSel;
extern struct MERR vmerr;
extern char szClsStatLine[];
extern int              vcInMessageBox;

/* %%Function:CmdArrangeWnd %%Owner:chic */
CMD CmdArrangeWnd(pcmb)
CMB *pcmb;
{
	HWND hwnd;
	int cmw;
	int crow, ccol;
	int irow, icol;
	int x, y;
	int dx, dy;
	int dxDesk, dyDesk;
	struct RC rc;
	HWND rghwndMw[mwMax];
	int ihwnd;
	BOOL fRecSav;
	extern BOOL vfRecording;

	/* turn off recorder for now */
	InhibitRecorder(&fRecSav, fTrue);

	Assert(hmwdCur);

	/* get top to bottom list of window, so current window is always on top
		row and left most column after the arrangment */
	rghwndMw[ihwnd = 0] = (*hmwdCur)->hwnd;
	while ((hwnd = rghwndMw[ihwnd]) != hNil)
		{
		rghwndMw[++ihwnd] = GetNextWindow(hwnd, GW_HWNDNEXT );
		}
	cmw = ihwnd; /* window count */

	crow = min(cmw, 3); /* max 3 rows */

	GetClientRect(vhwndDeskTop, (LPRECT)&rc);
	dxDesk = rc.xpRight - rc.xpLeft;
	dyDesk = rc.ypBottom - rc.ypTop;
	dy = dyDesk/crow;
	y = -dy;
	irow = icol = -1;
	ccol = 0;

	for (ihwnd = 0; ihwnd < mwMax && (hwnd = rghwndMw[ihwnd]) != hNil; ihwnd++)
		{
		if (++icol >= ccol)
			{
			irow++;
			icol = 0;
			y += dy;
			x = 0;
			ccol = cmw/crow;
			/* assign leftovers to bottommost rows */
			if (cmw-ccol*crow >= crow-irow)
				ccol++;
			dx = dxDesk/ccol;
			}
		else
			x += dx;

		Assert(ccol);

		if (vpref.fZoomMwd && hwnd == (*hmwdCur)->hwnd)
			{
			vpref.fZoomMwd = fFalse;
			SetRect((LPRECT)&vrcUnZoom, x, y, x+dx, y+dy);
			UnZoomWnd(hwnd, &vrcUnZoom);
			SetWindowText(vhwndApp, (LPSTR) szAppTitle);
/* make sure child system menu is in the right place */
			CorrectSystemMenu();
			}
		else
			SetWindowPos(hwnd, NULL, x, y, dx, dy,
					SWP_NOACTIVATE|SWP_NOZORDER);
		}

	InhibitRecorder(&fRecSav, fFalse);

	return cmdOK;
}

/* %%Function:CmdSizeWnd %%Owner:chic */
CMD CmdSizeWnd(pcmb)
CMB *pcmb;
{
	SendMessage((*hmwdCur)->hwnd, WM_SYSCOMMAND, SC_SIZE, 0L);
	return cmdOK;
}

/* %%Function:CmdMoveWnd %%Owner:chic */
CMD CmdMoveWnd(pcmb)
CMB *pcmb;
{
	SendMessage((*hmwdCur)->hwnd, WM_SYSCOMMAND, SC_MOVE, 0L);
	return cmdOK;
}

/* %%Function:CmdRestoreWnd %%Owner:chic */
CMD CmdRestoreWnd(pcmb)
CMB *pcmb;
{
	HWND hwnd;

	if (!vpref.fZoomMwd)
		return cmdOK;

	vpref.fZoomMwd = fFalse;

	Assert(mwCur != mwNil && mpmwhmwd[mwCur] != hNil);
	hwnd = (*mpmwhmwd[mwCur])->hwnd;
	UnZoomWnd(hwnd, &vrcUnZoom);
	SetWindowText(vhwndApp, (LPSTR) szAppTitle);
/* make sure child system menu is in the right place */
	CorrectSystemMenu();
	return cmdOK;
}

/* %%Function:CmdZoomWnd %%Owner:chic */
CMD CmdZoomWnd(pcmb)
CMB *pcmb;
{
	HWND hwndMw;

	vpref.fZoomMwd = !vpref.fZoomMwd;

	Assert(mwCur != mwNil && mpmwhmwd[mwCur] != hNil);
	hwndMw = (*mpmwhmwd[mwCur])->hwnd;
	if (vpref.fZoomMwd)
		{
		/* There is no rc information to ZoomWnd because there is a
		standard way to figure it out and is redudent to spend codes
		in every callers.
		The app's caption is also set up in ZoomWnd for the same
		reason above. */
		ZoomWnd( hwndMw );
		}
	else
		{
		/* There is a need to pass in a rc to UnZoomWnd because although
		most of the time we use vrcUnZoom, there are times we want to
		use a different rc, e.g. when we are creating a window when
		we already have a zoomed window, we want to create the new
		window in zoomed size first, then unzoom the old window, there-
		fore we have to save away the old unzoom size in another rc to
		be passed to UnZoomWnd. */
		UnZoomWnd( hwndMw, &vrcUnZoom );

		/* Reset the app's caption to contain only the app name.
		This is only necessary if going to a nonzoom state and not
		necessary whenever we want to unzoom a window because a ZoomWnd
		would have followed in other places where UnZoomWnd is called
		and would have set up the app's caption appropriately. */
		SetWindowText( vhwndApp, (LPSTR)szAppTitle );
		}

/* make sure child system menu is in the right place */
	CorrectSystemMenu();

	return cmdOK;
}

/* C M D  F I L E  C L O S E */
/* %%Function:CmdFileClose %%Owner:chic */
CMD CmdFileClose(pcmb)
CMB * pcmb;
{
	BOOL fRecordingSav;
	CMD cmd = cmdOK;

	Assert(hwwdCur != hNil);

	/* don't close window if there is msg box up, else focus of msg box
	is returned to destroyed window */
	if (vcInMessageBox > 0)
		return cmdCancelled;

	/* Stop any recording while we are closing file */
	InhibitRecorder(&fRecordingSav, fTrue);

	if ((*hwwdCur)->wk == wkMacro)
		{
		int mwCurSav;
		int docDot;

		docDot = PmeiImei(ImeiFromMw(mwCur))->elg;

		mwCurSav = mwCur;
		CloseDocWin((*hmwdCur)->hwnd, acQuerySave);
		if (mwCurSav == mwCur)
			{
			cmd = cmdCancelled;
			goto LRet;
			}

		/* Close the macros template (iff not global) */
		if (docDot != docGlobalDot && mpdochdod[docDot] != hNil &&
				!FCloseAllWinsOfDoc(docDot, acQuerySave))
			{
			cmd = cmdCancelled;
			}
		}
	else
		{
		if (!FCloseAllWinsOfDoc(selCur.doc, acQuerySave))
			cmd = cmdCancelled;
		}

LRet:
	InhibitRecorder(&fRecordingSav, fFalse);
	return cmd;
}

/* %%Function:ElFileClose %%Owner:chic */
EL ElFileClose(ac)
uns ac;
{
	int rerr = rerrNil;
	BOOL fRecordingSav;

	if (ac > 2)
		RtError(rerrIllegalFunctionCall);

	Assert(hwwdCur != hNil);

	/* don't close window if there is msg box up, else focus of msg box
	is returned to destroyed window */
	if (vcInMessageBox > 0)
		{
		RtError(rerrCommandFailed); /* to stop the macro from continue */
		return;
		}

	/* Stop any recording while we are closing file */
	InhibitRecorder(&fRecordingSav, fTrue);

	if ((*hwwdCur)->wk == wkMacro)
		{
		extern RERR vrerr;

		int docDot;

		docDot = PmeiImei(ImeiFromMw(mwCur))->elg;

		CloseDocWin((*hmwdCur)->hwnd, ac);
		if (vrerr != rerrNil)
			{
			rerr = rerrHalt;
			goto LRet;
			}

		/* Close the macros template (iff not global) */
		if (docDot != docGlobalDot && mpdochdod[docDot] != hNil &&
				!FCloseAllWinsOfDoc(docDot, ac))
			{
			rerr = rerrCommandFailed;
			}

		goto LRet;
		}

	if (!FCloseAllWinsOfDoc(selCur.doc, ac))
		{
		rerr = rerrCommandFailed;
		}

LRet:
	InhibitRecorder(&fRecordingSav, fFalse);
	if (rerr != rerrNil)
		RtError(rerr);
}

/* Returns fFalse iff cancelled */
/* %%Function:FCloseAllWinsOfDoc %%Owner:chic */
FCloseAllWinsOfDoc(doc, ac)
int doc, ac;
{
	extern BOOL vfDisableAutoMacros;
	BOOL fDisableAutoMacrosSav;

	Assert(doc != docNil);

	doc = DocMother (doc);

	Assert (doc != docNil &&
			!PdodDoc(doc)->fShort);

	if (PdodDoc(doc)->docHdr != docNil)
		FCleanUpHdr(doc, fFalse, fFalse);

	if (PdodDoc(doc)->fDot && !FCloseDotMacros(doc, ac))
		return fFalse;

	if (CmdRunAtmOnDoc(atmClose, doc) == cmdCancelled)
		return fFalse;

	if (!FConfirmSaveDoc(doc, fTrue /* fForce */, ac))
		return fFalse;

	/* if preview is up, kill it, too! */
	if (vlm == lmPreview)
		FExecCmd(bcmPrintPreview);

	if (mpdochdod[doc] != docNil)
		{
		/* Disable the AutoClose macro while we close the
			windows since we already did it! */
		fDisableAutoMacrosSav = vfDisableAutoMacros;
		vfDisableAutoMacros = fTrue;

		CloseMwsOfDoc(doc);

		vfDisableAutoMacros = fDisableAutoMacrosSav;
		}

	return fTrue;
}

/* C L O S E  D O C */
/*  Close all windows on doc */
/* %%Function:CloseMwsOfDoc %%Owner:chic */
CloseMwsOfDoc(doc)
int doc;
{
	int ww, wwPrev;

	Assert (doc != docNil && !PdodDoc(doc)->fShort);

	UndirtyDoc(doc);  /* so we don't get subsequent prompts */
	wwPrev = wwNil;
	while ((ww = WwDisp(doc, wwNil,fFalse)) != wwNil && ww != wwPrev)
		{
		SendMessage( PmwdMw(PwwdWw(wwPrev = ww)->mw)->hwnd, WM_CLOSE, 0, 0L );
		if (mpdochdod [doc] == hNil)
			/* doc was disposed of by above SendMessage */
			break;
		}
}

/* C m d  S t a t u s  A r e a */
/* %%Function:CmdStatusArea %%Owner:chic */
CMD CmdStatusArea(pcmb)
CMB *pcmb;
{
	extern int vfInitializing;
	extern HWND vhwndDeskTop;
	extern HWND vhwndStatLine;
	struct RC   rc;
	BOOL        fShow;
	int fHaveStatLine = (vhwndStatLine != NULL);
	int df;

	StartLongOp ();

	if (!fHaveStatLine)
		{
		/* There is no status line, bring one up. */
		if (!FCreateStatLine())
			{
			SetErrorMat(matMem);
			return cmdError;
			}
		}
	else
		/* Take down the existing window. */
		DestroyStatLine();

	/* If we're initializing, the status line window will get
		shown once the initialization process is done, so we
		don't need to do it here.  Also, at initialization, the
		desktop is sized with the status line in mind, so we
		don't need to adjust the MWDs here. */

	if (!vfInitializing)
		{
		GetDeskTopPrc( &rc );
		MoveWindowRc( vhwndDeskTop, &rc, fTrue );
		if (vhwndStatLine)
			{
			/* Get MWDs out of the way if necessary. */
			ResizeMwds();
			MakeStatLineVisible();
			}
		}

LRet:
	EndLongOp (fFalse /* fAll */);
	return cmdOK;
}

/* F  C r e a t  e  S t a t  L i n e */
/* %%Function:FCreateStatLine %%Owner:chic */
BOOL NEAR FCreateStatLine()
{
	struct RC rc;

	GetClientRect( vhwndApp, (LPRECT) &rc );

	if ((vhwndStatLine = CreateWindow((LPSTR)szClsStatLine, (LPSTR)NULL,
			WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
			rc.xpLeft - vsci.dxpBorder,
			rc.ypBottom - vsci.dypStatLine + vsci.dypBorder,
			rc.xpRight - rc.xpLeft + 2 * vsci.dxpBorder, vsci.dypStatLine,
			vhwndApp, NULL, vhInstance, (LPSTR)NULL)) == NULL)
		return (fFalse);

	InitStatLineState();

	return (fTrue);
}

/* M a k e  S t a t  L i n e  V i s i b l e */
/* The status line is created invisble initially. This routine is called
	to make it visible. */

/* %%Function:MakeStatLineVisible %%Owner:chic */
MakeStatLineVisible()
{
	ShowWindow( vhwndStatLine, SHOW_OPENWINDOW );
	UpdateWindow( vhwndStatLine );
}

/* I n i t  S t a t  L i n e  S t a t e */
/* %%Function:InitStatLineState %%Owner:chic */
InitStatLineState()
{
	extern struct SLS vsls;
	struct SLS sls;

	SetWords(&sls, 0, cwSLS);
	FGetStatLineState(&sls,usoNormal);
	blt( &sls, &vsls, cwSLS );
}

/* D e s t r o y  S t a t  L i n e */
/* %%Function:DestroyStatLine %%Owner:chic */
DestroyStatLine()
{
	Assert(vhwndStatLine != NULL);

	AssertDo(DestroyWindow(vhwndStatLine));
	vhwndStatLine = NULL;
}

/* %%Function:FCreatePgvCtls %%Owner:chic %%reviewed: 7/10/89 */
FCreatePgvCtls(ww)
int ww;
{
	extern CHAR szClsRSB [];
	struct WWD **hwwd = HwwdWw(ww);
	struct BMI *pbmi;
	struct RC rcVertBar, rc;

	if ((*hwwd)->hwndVScroll)
		{
		GetVertBarRc(ww, &rcVertBar);
		rc = rcVertBar;
		rc.ypBottom = rcVertBar.ypTop + vsci.dypScrollArrow;
		if (((*hwwd)->hwndPgvUp = HwndCreateWindowRc( szClsRSB,
				WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS | maskWndPgVw,
				rc,
				PmwdWw(ww)->hwnd )) == NULL)
			return fFalse;

		SetWindowWord( (*hwwd)->hwndPgvUp,
				offset( RSBS, bcm ), bcmPgvPrevPage );
		SetWindowWord( (*hwwd)->hwndPgvUp,
				offset( RSBS, ww ), ww );

		rc = rcVertBar;
		rc.ypTop = rcVertBar.ypBottom - vsci.dypScrollArrow;
		if (((*hwwd)->hwndPgvDown = HwndCreateWindowRc( szClsRSB,
				WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS | maskWndPgVw,
				rc,
				PmwdWw(ww)->hwnd )) == NULL)
			{
			DestroyPhwnd(&(*hwwd)->hwndPgvUp);
			return fFalse;
			}
		SetWindowWord( (*hwwd)->hwndPgvDown,
				offset( RSBS, bcm ), bcmPgvNextPage );
		SetWindowWord( (*hwwd)->hwndPgvDown,
				offset( RSBS, ww ), ww );
		GetClientRect((*hwwd)->hwndPgvDown, &rc);
#ifdef WIN23
		pbmi = &mpidrbbmi[vsci.fWin3Visuals ? idrbPageview3 : idrbPageview2];
#else
		pbmi = &mpidrbbmi[idrbPageview];
#endif /* WIN23 */
		pbmi->dxp = pbmi->dxpEach = rc.xpRight - rc.xpLeft;
		pbmi->dyp = rc.ypBottom - rc.ypTop;
		}
	return fTrue;
}

/* %%Function:DestroyPgvCtls %%Owner:chic %%reviewed: 7/10/89 */
DestroyPgvCtls(ww)
int ww;
{
	struct WWD **hwwd = HwwdWw(ww);
	struct RC rcVertBar;

	if ((*hwwd)->hwndPgvUp)
		{
		DestroyPhwnd(&(*hwwd)->hwndPgvUp);
		}
	if ((*hwwd)->hwndPgvDown)
		{
		DestroyPhwnd(&(*hwwd)->hwndPgvDown);
		}
	if ((*hwwd)->hwndVScroll)
		{
		GetVertBarRc(ww, &rcVertBar);
		MoveWindowRc((*hwwd)->hwndVScroll, &rcVertBar, fTrue);
		}
}

/* %%Function:ShowPgvCtls %%Owner:chic %%reviewed: 7/10/89 */
ShowPgvCtls(ww, fMove)
int ww;
int fMove;
{
	struct WWD **hwwd = HwwdWw(ww);
	HWND hwnd, hwndScroll;
	struct RC rcVertBar;
	struct RC rcT;
	int dyp = vsci.dypScrollArrow - vsci.dypBorder;

	if (hwndScroll = (*hwwd)->hwndVScroll)
		{
		GetVertBarRc(ww, &rcVertBar);
		rcT = rcVertBar;
		rcT.ypTop += dyp;
		rcT.ypBottom -= dyp;
		MoveWindowRc((*hwwd)->hwndVScroll, &rcT, fTrue);
		hwnd = (*hwwd)->hwndPgvUp;
		if (fMove)
			{
			rcT = rcVertBar;
			rcT.ypBottom = rcT.ypTop + vsci.dypScrollArrow;
			MoveWindowRc(hwnd, &rcT, fTrue);
			}
		CWDisplayAndUpdateControl(hwnd);
		CWDisplayAndUpdateControl(hwndScroll);
		hwnd = (*hwwd)->hwndPgvDown;
		if (fMove)
			{
			rcT = rcVertBar;
			rcT.ypTop = rcT.ypBottom - vsci.dypScrollArrow;
			MoveWindowRc(hwnd, &rcT, fTrue);
			}
		CWDisplayAndUpdateControl(hwnd);
		}
}

/* %%Function:DestroyVScrlWw %%Owner:chic */
DestroyVScrlWw(ww)
int ww;
{
	DestroyPhwnd( &PwwdWw(ww)->hwndVScroll );
	if (PwwdWw(ww)->fPageView)
		DestroyPgvCtls(ww);
}

/* Force all pageview panes to have passed grpfvisi */
/* %%Function:SyncPageViewGrpfvisi %%Owner:chic  %%reviewed: 7/10/89*/
SyncPageViewGrpfvisi(docMother, grpfvisi, fDisplayAsPrint)
int docMother;
GRPFVISI grpfvisi;
{
	int ww = wwNil;
	struct WWD *pwwd;

	Assert(docMother == DocMother(docMother));
	while ((ww = WwDisp(docMother, ww,fFalse)) != wwNil)
		{
		pwwd = PwwdWw(ww);
		pwwd->fDisplayAsPrint = fDisplayAsPrint;
		if (pwwd->fPageView && pwwd->grpfvisi.w != grpfvisi.w)
			{
			pwwd->grpfvisi = grpfvisi;
			TrashWw(ww);
			}
		}
}

/* C M D  N E W  W N D */
/* %%Function:CmdNewWnd %%Owner:chic */
CMD CmdNewWnd(pcmb)
CMB *pcmb;
{ /* duplicate another instance of the current doc window */

	int doc = DocMother(selCur.doc);
	struct SELS sels;

	blt(&selCur, &sels, cwSELS);  /* for the goback cache */

	if (!FCreateMw(doc, wkDoc, &sels, NULL))
		{
		ErrorEid(eidSessionComplex, " CmdNewWnd");
		return cmdError;
		}
	return cmdOK;
}

/* C M D  C L O S E  W N D */
/* %%Function:CmdCloseWnd %%Owner:chic */
CMD CmdCloseWnd(pcmb)
CMB *pcmb;
{
	if (vlm == lmPreview)
		CmdExecBcmKc(bcmPrintPreview, kcNil);
	else
		SendMessage((*hmwdCur)->hwnd, WM_CLOSE, 0, 0L);

	return cmdError; /* so we don't get recorded! */
}

/* %%Function:ElDocClose %%Owner:chic */
EL ElDocClose(ac)
unsigned ac;
{
	if (ac > 2)
		RtError(rerrIllegalFunctionCall);

	CloseDocWin((*hmwdCur)->hwnd, ac);
}

/* %%Function:CmdMwd1 %%Owner:chic */
CMD CmdMwd1(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(0);
}

/* %%Function:CmdMwd2 %%Owner:chic */
CMD CmdMwd2(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(1);
}

/* %%Function:CmdMwd3 %%Owner:chic */
CMD CmdMwd3(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(2);
}

/* %%Function:CmdMwd4 %%Owner:chic */
CMD CmdMwd4(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(3);
}

/* %%Function:CmdMwd5 %%Owner:chic */
CMD CmdMwd5(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(4);
}

/* %%Function:CmdMwd6 %%Owner:chic */
CMD CmdMwd6(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(5);
}

/* %%Function:CmdMwd7 %%Owner:chic */
CMD CmdMwd7(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(6);
}

/* %%Function:CmdMwd8 %%Owner:chic */
CMD CmdMwd8(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(7);
}

/* %%Function:CmdMwd9 %%Owner:chic */
CMD CmdMwd9(pcmb)
CMB *pcmb;
{
	return CmdSetMwd(8);
}

/* %%Function:CmdSetMwd %%Owner:chic */
CMD CmdSetMwd(imw)
int imw;
{
	CHAR HUGE *hpst;
	if (imw >= (*vhsttbWnd)->ibstMac)
		{
		if (fElActive)
			RtError(rerrOutOfRange);
		return cmdError;
		}
	hpst = HpstFromSttb(vhsttbWnd, imw);
	SetMw((int)*(hpst + *hpst));
	return cmdOK;
}

/* %%Function:SetMw %%Owner:chic */
SetMw(mw)
int mw;
{
	extern BOOL vfRecording;
	HWND hwndMw = PmwdMw(mw)->hwnd;
	HWND hwndMwOld = PmwdMw(mwCur)->hwnd;
	struct RC rcUnZoomSave;
	BOOL fRecordingSav;

	InhibitRecorder(&fRecordingSav, fTrue);

	if (mw != mwCur)
		NewCurWw( PmwdMw(mw)->wwActive, fFalse);

	InhibitRecorder(&fRecordingSav, fFalse);
}

/* C M D  O T H E R  P A N E */
/* %%Function:CmdOtherPane %%Owner:chic */
CMD CmdOtherPane(pcmb)
CMB *pcmb;
{
	int ww;
	extern struct SEL selMacro;
	BOOL fRecordingSav;

	if ((ww = WwOther(wwCur)) != wwNil)
		{
		InhibitRecorder(&fRecordingSav, fTrue);
		NewCurWw(ww, fFalse);
		InhibitRecorder(&fRecordingSav, fFalse);
		}

	if (PwwdWw(wwCur)->wk == wkMacro && (*vhmes)->fAnimate)
		{
		TurnOffSel(&selMacro);
		blt(&selCur, &selMacro, cwSEL);
		TurnOnSel(&selMacro);
		}

	return cmdOK;
}

/* C M D  N E X T  M W D */

/* %%Function:CmdNextMwd %%Owner:chic */
CMD CmdNextMwd(pcmb)
CMB *pcmb;
{
	NextPrevMwd( 1 /* dmw */ );
	return cmdOK;
}

/* C M D  P R E V  M W D */

/* %%Function:CmdPrevMwd %%Owner:chic */
CMD CmdPrevMwd(pcmb)
CMB *pcmb;
{
	NextPrevMwd(- 1 /* dmw */);
	return cmdOK;
}

/* N E X T  P R E V  M W D */
/* go through mpmwhmwd looking for the next entry referring to an
existing child window; cycle back to the beginning of array if
necessary */

/* %%Function:NextPrevMwd %%Owner:chic */
NextPrevMwd(dmw)
int dmw;
{
	int mw, imw;
	int cmw = mwMac - mwDocMin;

	Assert( mwMac > 1 );

	/* get next (prev) window handle; skip NULL handles */
	/* cycle through the mw's mod mwMac */
	Assert( (*hmwdCur)->hwnd != NULL );
	mw = mwCur;
	do
		{
		mw = mwDocMin + ((mw - mwDocMin + dmw + cmw) % cmw);
		}
	while (mw != vmwClipboard && mpmwhmwd[mw] == NULL);
	/* clipboard window has no entry in our window menu */

	if (mw != mwCur && (imw = IbstMw(mw)) >= 0)
		/* imw is index in list of open windows (on Window menu) */
		CmdSetMwd(imw);
}

/* I B S T  M W */
/* %%Function:IbstMw %%Owner:chic */
IbstMw(mw)
int mw;
{
	extern struct STTB **vhsttbWnd;
	int ibstMac = (*vhsttbWnd)->ibstMac;
	int ibst;
	CHAR HUGE *hpst;

	for (ibst = 0; ibst < ibstMac; ibst++)
		{
		hpst = HpstFromSttb(vhsttbWnd, ibst);
		if ((int)*(hpst + *hpst) == mw) /* found it */
			return ibst;
		}

	return ibstNil;
}

/* G E T  V E R T  B A R  R C S */
/* %%Function:GetVertBarRc %%Owner:chic %%reviewed: 7/10/89 */
GetVertBarRc(ww, prcVertScroll)
int ww;
struct RC *prcVertScroll;
{
	int mw = PwwdWw(ww)->mw;
	struct MWD **hmwd;
	struct RC rcMw;
	struct RC rcTopPane, rcBottomPane;
	struct RC rcTopScrlBar, rcBottomScrlBar;
	struct RC rcSplitBox, rcSplitBar;

	Assert(mw > mwNil && mw < mwMac);
	hmwd = mpmwhmwd[mw];
	GetDocAreaPrc(*hmwd, &rcMw);
	GetDocAreaChildRcs(hmwd, rcMw, wkDoc, (*hmwd)->ypSplit, &rcTopPane,
			&rcTopScrlBar, &rcSplitBox, &rcSplitBar, &rcBottomPane, &rcBottomScrlBar);
	Assert(ww == (*hmwd)->wwUpper || ((*hmwd)->fSplit && ww == (*hmwd)->wwLower));
	*prcVertScroll = (ww == (*hmwd)->wwUpper) ? rcTopScrlBar : rcBottomScrlBar;
}

/* %%Function:ShowStyWnd %%Owner:chic */
ShowStyWnd(mw, dxwNew, fSetDxw)
int mw;
int dxwNew; /* new width of the styname wnd */
{ /* Close, open or change the styname wnd size for a particular ww */
	/* We come to here only when there is something to do */
	struct MWD **hmwd;

	Assert( mw != mwNil && dxwNew >= 0 );

	hmwd = mpmwhmwd[mw];

	AdjustStyNameDxw(hmwd, &dxwNew);
	if (fSetDxw)
		vpref.dxaStyWnd = DxaFromDxs(0/*dummy*/, dxwNew); /* so new window will not new width */

	SetHmwdDxwStyWnd(hmwd, dxwNew, fSetDxw);
	selCur.fUpdateRuler = fTrue;

	SynchSccWw(&vsccAbove, wwCur); /* invalidate the screen cache also */
}

/* %%Function:SetHmwdDxwStyWnd %%Owner:chic */
SetHmwdDxwStyWnd(hmwd, dxwStyWnd, fSetDxw)
struct MWD **hmwd;
int dxwStyWnd;
int fSetDxw;
{
	int ww = (*hmwd)->wwUpper;

	SetDxwStyWndInWw(ww, dxwStyWnd, fSetDxw);
	if ((*hmwd)->ypSplit != 0)
		{
		Assert((*hmwd)->fSplit);
		SetDxwStyWndInWw((*hmwd)->wwLower, dxwStyWnd, fSetDxw);
		}
}

/* %%Function:SetDxwStyWndInWw %%Owner:chic */
SetDxwStyWndInWw(ww, dxwStyWnd, fSetDxw)
int ww;
int dxwStyWnd;
int fSetDxw;
{
	struct WWD *pwwd = PwwdWw(ww);
	struct RC rcInval;
	struct DR *pdr;
	int ddxw = dxwStyWnd - pwwd->xwSelBar;

	FreezeHp();
	pwwd->xwMin += ddxw; /* adjust rcwDisp */
	/* don't do this because the conversion routine already takes into account
	of rcePage and xwMin
	pwwd->xeScroll += ddxw; adjust rcePage
	*/
	pwwd->xwSelBar = dxwStyWnd;

#ifdef BOGUS
	if (!pwwd->fPageView)
		/* adjust DRCL */
		{
		pdr = PdrGalley(pwwd);
		RcToDrc(&pwwd->rcwDisp, &pdr->drcl);
		pdr->xl = pdr->yl = 0;
		}
#endif /* BOGUS */

	if (fSetDxw)
		{
		pwwd->dxwStyWnd = dxwStyWnd;
		}
	if (fSetDxw || ww != wwCur)
		{ /* the wwCur test is for wwOther of the one going into Page view */
		/* invalidate the area so it will be repainted */
		GetClientRect(pwwd->hwnd, (LPRECT)&rcInval);
		InvalidateRect(pwwd->hwnd, (LPRECT)&rcInval, fTrue/*fEraseBkGround*/);
		}
	MeltHp();
}

/* %%Function:TrackStyWndCursor %%Owner:chic */
TrackStyWndCursor(pt)
struct PT pt;
{
	struct RC rcLim;

	/* convert to screen coordinate first */
	ClientToScreen( (*hmwdCur)->hwnd, (LPPOINT) &pt );

	/* restrict the point within the client area of ww */
	GetClientRect((*hmwdCur)->hwnd, (LPRECT)&rcLim);
	if (PwwdWw((*hmwdCur)->wwUpper)->hwndIconBar != hNil) /* clip away the iconbar height */
		rcLim.ypTop += vsci.dypIconBar;
	rcLim.xpRight = rcLim.xpRight >> 1; /* don't let the stywnd takes up the whole window */

	if (vhcStyWnd == NULL && !FAssureIrcds(ircdsStyWnd))
		return;

	if (FTrackDragLine((*hmwdCur)->hwnd, &pt, vhcStyWnd, rcLim, fFalse /*fHorz*/))
		{
		/* dxpNew should actually be
			xpRight (i.e. pt.xp) - xpLeft (i.e. -vsci.dxpBorder)
		*/
		ShowStyWnd(mwCur, pt.xp + vsci.dxpBorder/*dxwNew*/, fTrue/*fSetDxw*/);
		}
}

/* Emulate Mac ROM call that does nothing if *ppt is in prc, but
	moves *ppt to closest border of prc if *ppt is outide prc.
*/
/* %%Function:PtIntoRc %%Owner:chic */
PtIntoRc(ppt, prc)
struct PT *ppt;
struct RC *prc;
{
	if (ppt->xp < prc->xpLeft)
		ppt->xp = prc->xpLeft;
	else  if (ppt->xp > prc->xpRight)
		ppt->xp = prc->xpRight;

	if (ppt->yp < prc->ypTop)
		ppt->yp = prc->ypTop;
	else  if (ppt->yp > prc->ypBottom)
		ppt->yp = prc->ypBottom;
}

/* %%Function:FTrackDragLine %%Owner:chic */
FTrackDragLine(hwnd, ppt, hCursor, rcLim, fHorz)
HWND hwnd; /* where the tracking is going to be in */
struct PT *ppt; /* initial position in screen coordinates,
	final position in client coordinates when return fTrue */
HCURSOR hCursor;
struct RC rcLim;
int fHorz;
{
/* return fFalse if the user cancel out from the tracking.
	return fTrue if the tracking process is completed and return
	the final position of the point in ppt.
	This routine supports keyboard interface and handle both
	vertical and horizontal line tracking.
*/
	HDC hdc;
	int grpf;
	int fTrack;
	int wLongOp;

/* Note that the point passed in should be in screen coordinate */

	Assert(hwnd);

	if ((hdc = GetDC(NULL)) == NULL)
		return (fFalse);

	ClientToScreen(hwnd, (LPPOINT) &rcLim.ptTopLeft);
	ClientToScreen(hwnd, (LPPOINT) &rcLim.ptBottomRight);

	/* We want to change to the appropriate cursor even if in Long Op */
	GetLongOpState(&wLongOp);
	EndLongOp(fTrue /* fAll */);

	OurSetCursor(hCursor);
	SetCapture(hwnd);
	PtIntoRc(ppt, (struct RC *)&rcLim); /* confine trace line in rect */

	fTrack = FTrackLine(hwnd, hdc, ppt, rcLim, fHorz, 0);

	ReleaseDC(NULL, hdc);
	ReleaseCapture();

	ResetLongOpState(wLongOp);
	return(fTrack);
}

/* %%Function:FTrackLine %%Owner:chic */
FTrackLine(hwnd, hdc, ppt, rcLim, fHorz, grpfDrag)
HWND hwnd; /* where the tracking is going to be in */
HDC hdc;
struct PT *ppt; /* comes in like a lion and out like a lamb - oops, I
	mean in in screen coordinates, and out in client
	coordinates */
/* ...except for preview, which is done all in client
	coords. */
struct RC rcLim;
int fHorz;
int grpfDrag; /* grpf for preview ShowXaYa... */
{
	int grpf;
	struct PT ptMouse, ptT;

	SelectObject(hdc, vhbrGray);
	DrawDragLine(hdc, *ppt, &rcLim, fHorz); /* draw */
	bltbyte(ppt, &ptMouse, sizeof(struct PT));
	while ((grpf = GrpfStillTracking(&ptMouse, fHorz)) & FSTILLTRACKING)
		{
	/* handle keyboard interface */
		if (grpf & FTOP)
			if (fHorz)
				ptMouse.yp = rcLim.ypTop;
			else  /* FLEFT case for vertical line */
				ptMouse.xp = rcLim.xpLeft;
		else  if (grpf & FBOTTOM)
			if (fHorz)
				ptMouse.yp = rcLim.ypBottom;
			else  /* FRIGHT case for vertical line */
				ptMouse.xp = rcLim.xpRight;
		else
			PtIntoRc(&ptMouse, (struct RC *)&rcLim);

		if (grpf & FKEYBOARD)
			{
			ptT = ptMouse;
			SetCursorPos(ptT.xp, ptT.yp);
			}

	/* erase old line, draw new line */
		if ((fHorz && ppt->yp != ptMouse.yp) || (!fHorz && ppt->xp != ptMouse.xp))
			{
			DrawDragLine(hdc, *ppt, &rcLim, fHorz); /* erase */
			DrawDragLine(hdc, ptMouse, &rcLim, fHorz); /* draw */
			*ppt = ptMouse;
			}
		}

	PtIntoRc(&ptMouse, (struct RC *)&rcLim);
	DrawDragLine(hdc, *ppt, (struct RC *)&rcLim, fHorz); /* erase */

	ScreenToClient(hwnd, (LPPOINT)ppt);
	return(!(grpf & FESCAPE));
}

/* %%Function:GrpfStillTracking %%Owner:chic */
GrpfStillTracking(ppt, fHorz)
struct PT   *ppt;     /* in and out in screen coords */
/* client coords for preview */
int fHorz;
{
	MSG msg;
	int wIncr;
	extern struct DBS vdbs;
	int grpfRet = 0;

	/* Since re-entrancy can move the heap sometimes, shake it */

	Debug(vdbs.fShakeHeap ? ShakeHeap() : 0);

	if ( PeekMessage( (LPMSG)&msg, (HWND)NULL, NULL, NULL, fTrue ) )
		{
		switch (msg.message)
			{
		default:
			TranslateMessage( (LPMSG)&msg );
			DispatchMessage( (LPMSG)&msg );
			break;

		case WM_LBUTTONDOWN:
			break;

		case WM_LBUTTONUP:
			*ppt = MAKEPOINT(msg.lParam);
			/* lParam is given to us in client coords */
			if (vlm != lmPreview)
				ClientToScreen(msg.hwnd, (LPPOINT)ppt);
			return (fFalse);

		case WM_MOUSEMOVE:
			/* KLUGE ALERT:  if in preview and selecting/moving objects
				via the keyboard, WM_MOUSEMOVEs are generated by SetCursor
				Pos.  But, if the tab key is held down, the messages meant
				for one object might not be processed here until after a
				different object is selected.  There doesn't seem to be
				an easy way to couple object identifiers with their appro-
				priate messages, so we take the draconian step of filtering
				all mouse move messages while in preview keyboard mode. */
			if (vlm == lmPreview && vpvs.fPrvwTab)
				break;

			/* A Mouse Move, Mouse Down, or Mouse Up is waiting */
			*ppt = MAKEPOINT(msg.lParam);

			/* lParam is given to us in client coords */
			if (vlm != lmPreview)
				ClientToScreen(msg.hwnd, (LPPOINT)ppt);
			break;

		case WM_KEYUP:
			if (msg.wParam == VK_SHIFT || msg.wParam == VK_CONTROL)
				SetOurKeyState();
			goto LKeyboard;
			break;

		case WM_KEYDOWN:
			switch (msg.wParam)
				{
				extern int vfAwfulNoise;
			default:
LMakeNoise:
				Beep();
				vfAwfulNoise = fFalse;
				return (FSTILLTRACKING);
			case VK_SHIFT:
			case VK_CONTROL:
				SetOurKeyState();
				grpfRet = FSTILLTRACKING;
				break;
			case VK_UP:
			case VK_DOWN:
				if (fHorz && GetKeyState(VK_CONTROL) < 0)
					{
					grpfRet = msg.wParam == VK_UP ? FTOP : FBOTTOM;
					break;
					}
				wIncr = (vlm == lmPreview) ? 2 : 8;
				if (msg.wParam == VK_UP)
					wIncr = -wIncr;
				ppt->yp += wIncr * vsci.dypBorder;
				break;
			case VK_LEFT:
			case VK_RIGHT:
				if (!fHorz && GetKeyState(VK_CONTROL) < 0)
					{
					grpfRet = msg.wParam == VK_LEFT ? FTOP : FBOTTOM;
					break;
					}
				wIncr = (vlm == lmPreview) ? 2 : 8;
				if (msg.wParam == VK_LEFT)
					wIncr = -wIncr;
				ppt->xp += wIncr * vsci.dxpBorder;
				break;
			case VK_PRIOR:
			case VK_NEXT:
				if (vlm == lmPreview || fHorz)
					{
					grpfRet = msg.wParam == VK_PRIOR ? FTOP : FBOTTOM;
					break;
					}
				else
					goto LMakeNoise;
			case VK_HOME:
			case VK_END:
				if (vlm != lmPreview && fHorz)
					goto LMakeNoise;
				grpfRet = msg.wParam == VK_HOME ? FTOP : FBOTTOM;
				break;
			case VK_TAB:
				if (vlm != lmPreview)
					goto LMakeNoise;
				/* if in preview, terminate tracking gunk but
					remember that tab was pressed. */
				PostMessage(msg.hwnd,msg.message,msg.wParam,msg.lParam);
				/* Fall Through */
			case VK_RETURN:
				return (!FSTILLTRACKING);
				break;
			case VK_ESCAPE:
				return(FESCAPE);
				break;
				}
LKeyboard:
			grpfRet |= FKEYBOARD;
			break;
			}
		}

	grpfRet |= FSTILLTRACKING;
	return (grpfRet);
}

/* %%Function:DrawDragLine %%Owner:chic */
DrawDragLine(hdc, ptFrom, prc, fHorz)
HDC hdc;
struct PT ptFrom;
struct RC *prc;
int fHorz;
{
/* Draws a horizontal or vertical line (determined by fVert) through
	ptFrom and within prc.
	Uses the PATINVERT raster-op so that successive calls toggle the
	visibility of the line.
*/
	struct PT ptTo;

	ptTo = ptFrom;
	if (fHorz)
		{
		ptFrom.xp = prc->xpLeft;
		ptTo.xp = prc->xpRight;
		}
	else
		{
		ptFrom.yp = prc->ypTop;
		ptTo.yp = prc->ypBottom;
		}
	PatBlt(hdc,ptFrom.xp,ptFrom.yp,ptTo.xp - ptFrom.xp+1,ptTo.yp -
			ptFrom.yp+1,PATINVERT);
}

/* D e s t r o y  P h w n d */
/* Destroy passed window, zero out data structure.  Allows for the case
	in which phwnd is a heap pointer and the DestroyWindow produces
	heap movement.  OK to pass in NULL. */
/* %%Function:DestroyPhwnd %%Owner:chic %%reviewed: 7/10/89 */
DestroyPhwnd( phwnd )
HWND *phwnd;
{
	HWND hwnd = *phwnd;
	*phwnd = NULL;
	if (hwnd != NULL)
		{
		Assert(IsWindow(hwnd));
		DestroyWindow (hwnd);
		}
}

/* Put hwnd as first child of Z ordering */
/* %%Function:CWDisplayAndUpdateControl %%Owner:chic %%reviewed: 7/10/89 */
CWDisplayAndUpdateControl(hwnd)
HWND hwnd;
{
	SetWindowPos(hwnd, NULL, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE);
	ShowWindow(hwnd, SHOW_OPENWINDOW);
	UpdateWindow(hwnd);
}

/* D E L  S T  F I L E  F R O M  M R U */
/* Remove passed st from Work on Cache */
/* %%Function:DelStFileFromMru %%Owner:chic */
DelStFileFromMru(st)
char * st;
{
	int ibstDel;
	char stNorm [ichMaxFile];

	Assert(vhsttbOpen != hNil);

	/* Store MRU list normalized so it's uambiguous */
	FNormalizeStFile(st, stNorm, nfoNormal);

	/* look for and delete existing entry */
	if ((ibstDel = IbstFindSt(vhsttbOpen, stNorm)) != iNil)
		DeleteIFromSttb(vhsttbOpen, ibstDel);

	vfFileCacheDirty = fTrue; /* so menu gets updated */
}


text:
<?php
error_reporting(E_ALL);
ini_set('display_errors',true);
require_once __DIR__.'/../../autoload.php';

$a = new \Pyrus\Developer\PackageFile\PEAR2SVN(__DIR__, 'PEAR2_SimpleChannelServer');

$package = new \Pyrus\Package('package.xml');
$outfile = $package->name.'-'.$package->version['release'];
$a = new \Pyrus\Package\Creator(array(
                    //new \Pyrus\Developer\Creator\Tar($outfile.'.tar', 'none'),
                    new \Pyrus\Developer\Creator\Phar($outfile.'.tgz', false, Phar::TAR, Phar::GZ),),
                    __DIR__.'/../../Exception/src',
					__DIR__.'/../../Autoload/src',
					__DIR__.'/../../MultiErrors/src');
$a->render($package);

$a = new \Pyrus\Package\Creator(array(
                    new \Pyrus\Developer\Creator\Phar\PHPArchive(__DIR__ . '/pearscs.phar', '<?php
function __autoload($class)
{
    include \'phar://\' . PYRUS_PHAR_FILE . \'/php/\' . implode(\'/\', explode(\'_\', $class)) . \'.php\';
}
set_include_path(\'phar://\' . PYRUS_PHAR_FILE . \'/php/\'.PATH_SEPARATOR.get_include_path());
$cli = new pear\SimpleChannelServer\CLI();
$cli->process();
'),),
                    __DIR__ . '/../../Exception/src',
                    __DIR__ . '/../../Autoload/src',
                    __DIR__ . '/../../MultiErrors/src');
$b = new \Pyrus\Package(__DIR__ . '/package.xml');
$rp = __DIR__ . '/../../HTTP_Request/src/HTTP';

$additional_files = array(
    'php/PEAR2/HTTP/Request.php'                   => $rp . '/Request.php',
    'php/PEAR2/HTTP/Request/Adapter.php'           => $rp . '/Request/Adapter.php',
    'php/PEAR2/HTTP/Request/Adapter/Phpsocket.php' => $rp . '/Request/Adapter/Phpsocket.php',
    'php/PEAR2/HTTP/Request/Adapter/Phpstream.php' => $rp . '/Request/Adapter/Phpstream.php',
    'php/PEAR2/HTTP/Request/Exception.php'         => $rp . '/Request/Exception.php',
    'php/PEAR2/HTTP/Request/Headers.php'           => $rp . '/Request/Headers.php',
    'php/PEAR2/HTTP/Request/Response.php'          => $rp . '/Request/Response.php',
    'php/PEAR2/HTTP/Request/Uri.php'               => $rp . '/Request/Uri.php',
);
$pyrus = new \Pyrus\Package(__DIR__ . '/../../Pyrus/package.xml');
$pyrus_developer = new \Pyrus\Package(__DIR__ . '/../../Pyrus_Developer/package.xml');
$exception = new \Pyrus\Package(__DIR__ . '/../../Exception/package.xml');
foreach (array('Pyrus'           => $pyrus,
               'Pyrus_Developer' => $pyrus_developer,
               'Exception'       => $exception) as $add_dir=>$add_package) {
    foreach ($add_package->installcontents as $filename=>$details) {
        $add_filename = __DIR__ . '/../../'.$add_dir.'/'.$filename;
        switch($details['attribs']['role']) {
            case 'php':
                $additional_files[str_replace('src/','php/PEAR2/', $filename)] = $add_filename;
                break;
            case 'data':
                $additional_files['php/'.$filename] = $add_filename;
                $additional_files[$filename]        = $add_filename;
                break;
        }
    }
}
$a->render($b, $additional_files);

?>