code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
/*
* Copyright (c) 2008, 2009 open80211s Ltd.
* Author: Luis Carlos Cobo <luisca@cozybit.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/gfp.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include "ieee80211_i.h"
#include "rate.h"
#include "mesh.h"
#define PLINK_CNF_AID(mgmt) ((mgmt)->u.action.u.self_prot.variable + 2)
#define PLINK_GET_LLID(p) (p + 2)
#define PLINK_GET_PLID(p) (p + 4)
#define mod_plink_timer(s, t) (mod_timer(&s->mesh->plink_timer, \
jiffies + msecs_to_jiffies(t)))
enum plink_event {
PLINK_UNDEFINED,
OPN_ACPT,
OPN_RJCT,
OPN_IGNR,
CNF_ACPT,
CNF_RJCT,
CNF_IGNR,
CLS_ACPT,
CLS_IGNR
};
static const char * const mplstates[] = {
[NL80211_PLINK_LISTEN] = "LISTEN",
[NL80211_PLINK_OPN_SNT] = "OPN-SNT",
[NL80211_PLINK_OPN_RCVD] = "OPN-RCVD",
[NL80211_PLINK_CNF_RCVD] = "CNF_RCVD",
[NL80211_PLINK_ESTAB] = "ESTAB",
[NL80211_PLINK_HOLDING] = "HOLDING",
[NL80211_PLINK_BLOCKED] = "BLOCKED"
};
static const char * const mplevents[] = {
[PLINK_UNDEFINED] = "NONE",
[OPN_ACPT] = "OPN_ACPT",
[OPN_RJCT] = "OPN_RJCT",
[OPN_IGNR] = "OPN_IGNR",
[CNF_ACPT] = "CNF_ACPT",
[CNF_RJCT] = "CNF_RJCT",
[CNF_IGNR] = "CNF_IGNR",
[CLS_ACPT] = "CLS_ACPT",
[CLS_IGNR] = "CLS_IGNR"
};
/* We only need a valid sta if user configured a minimum rssi_threshold. */
static bool rssi_threshold_check(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta)
{
s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold;
return rssi_threshold == 0 ||
(sta &&
(s8)-ewma_signal_read(&sta->rx_stats.avg_signal) >
rssi_threshold);
}
/**
* mesh_plink_fsm_restart - restart a mesh peer link finite state machine
*
* @sta: mesh peer link to restart
*
* Locking: this function must be called holding sta->mesh->plink_lock
*/
static inline void mesh_plink_fsm_restart(struct sta_info *sta)
{
lockdep_assert_held(&sta->mesh->plink_lock);
sta->mesh->plink_state = NL80211_PLINK_LISTEN;
sta->mesh->llid = sta->mesh->plid = sta->mesh->reason = 0;
sta->mesh->plink_retries = 0;
}
/*
* mesh_set_short_slot_time - enable / disable ERP short slot time.
*
* The standard indirectly mandates mesh STAs to turn off short slot time by
* disallowing advertising this (802.11-2012 8.4.1.4), but that doesn't mean we
* can't be sneaky about it. Enable short slot time if all mesh STAs in the
* MBSS support ERP rates.
*
* Returns BSS_CHANGED_ERP_SLOT or 0 for no change.
*/
static u32 mesh_set_short_slot_time(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
struct sta_info *sta;
u32 erp_rates = 0, changed = 0;
int i;
bool short_slot = false;
if (band == IEEE80211_BAND_5GHZ) {
/* (IEEE 802.11-2012 19.4.5) */
short_slot = true;
goto out;
} else if (band != IEEE80211_BAND_2GHZ)
goto out;
for (i = 0; i < sband->n_bitrates; i++)
if (sband->bitrates[i].flags & IEEE80211_RATE_ERP_G)
erp_rates |= BIT(i);
if (!erp_rates)
goto out;
rcu_read_lock();
list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (sdata != sta->sdata ||
sta->mesh->plink_state != NL80211_PLINK_ESTAB)
continue;
short_slot = false;
if (erp_rates & sta->sta.supp_rates[band])
short_slot = true;
else
break;
}
rcu_read_unlock();
out:
if (sdata->vif.bss_conf.use_short_slot != short_slot) {
sdata->vif.bss_conf.use_short_slot = short_slot;
changed = BSS_CHANGED_ERP_SLOT;
mpl_dbg(sdata, "mesh_plink %pM: ERP short slot time %d\n",
sdata->vif.addr, short_slot);
}
return changed;
}
/**
* mesh_set_ht_prot_mode - set correct HT protection mode
*
* Section 9.23.3.5 of IEEE 80211-2012 describes the protection rules for HT
* mesh STA in a MBSS. Three HT protection modes are supported for now, non-HT
* mixed mode, 20MHz-protection and no-protection mode. non-HT mixed mode is
* selected if any non-HT peers are present in our MBSS. 20MHz-protection mode
* is selected if all peers in our 20/40MHz MBSS support HT and atleast one
* HT20 peer is present. Otherwise no-protection mode is selected.
*/
static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
u16 ht_opmode;
bool non_ht_sta = false, ht20_sta = false;
switch (sdata->vif.bss_conf.chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
case NL80211_CHAN_WIDTH_5:
case NL80211_CHAN_WIDTH_10:
return 0;
default:
break;
}
rcu_read_lock();
list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (sdata != sta->sdata ||
sta->mesh->plink_state != NL80211_PLINK_ESTAB)
continue;
if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20)
continue;
if (!sta->sta.ht_cap.ht_supported) {
mpl_dbg(sdata, "nonHT sta (%pM) is present\n",
sta->sta.addr);
non_ht_sta = true;
break;
}
mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr);
ht20_sta = true;
}
rcu_read_unlock();
if (non_ht_sta)
ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED;
else if (ht20_sta &&
sdata->vif.bss_conf.chandef.width > NL80211_CHAN_WIDTH_20)
ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ;
else
ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
if (sdata->vif.bss_conf.ht_operation_mode == ht_opmode)
return 0;
sdata->vif.bss_conf.ht_operation_mode = ht_opmode;
sdata->u.mesh.mshcfg.ht_opmode = ht_opmode;
mpl_dbg(sdata, "selected new HT protection mode %d\n", ht_opmode);
return BSS_CHANGED_HT;
}
static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
enum ieee80211_self_protected_actioncode action,
u8 *da, u16 llid, u16 plid, u16 reason)
{
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct ieee80211_tx_info *info;
struct ieee80211_mgmt *mgmt;
bool include_plid = false;
u16 peering_proto = 0;
u8 *pos, ie_len = 4;
int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) +
sizeof(mgmt->u.action.u.self_prot);
int err = -ENOMEM;
skb = dev_alloc_skb(local->tx_headroom +
hdr_len +
2 + /* capability info */
2 + /* AID */
2 + 8 + /* supported rates */
2 + (IEEE80211_MAX_SUPP_RATES - 8) +
2 + sdata->u.mesh.mesh_id_len +
2 + sizeof(struct ieee80211_meshconf_ie) +
2 + sizeof(struct ieee80211_ht_cap) +
2 + sizeof(struct ieee80211_ht_operation) +
2 + sizeof(struct ieee80211_vht_cap) +
2 + sizeof(struct ieee80211_vht_operation) +
2 + 8 + /* peering IE */
sdata->u.mesh.ie_len);
if (!skb)
return err;
info = IEEE80211_SKB_CB(skb);
skb_reserve(skb, local->tx_headroom);
mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
memset(mgmt, 0, hdr_len);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION);
memcpy(mgmt->da, da, ETH_ALEN);
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
mgmt->u.action.category = WLAN_CATEGORY_SELF_PROTECTED;
mgmt->u.action.u.self_prot.action_code = action;
if (action != WLAN_SP_MESH_PEERING_CLOSE) {
enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
/* capability info */
pos = skb_put(skb, 2);
memset(pos, 0, 2);
if (action == WLAN_SP_MESH_PEERING_CONFIRM) {
/* AID */
pos = skb_put(skb, 2);
put_unaligned_le16(sta->sta.aid, pos);
}
if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
mesh_add_rsn_ie(sdata, skb) ||
mesh_add_meshid_ie(sdata, skb) ||
mesh_add_meshconf_ie(sdata, skb))
goto free;
} else { /* WLAN_SP_MESH_PEERING_CLOSE */
info->flags |= IEEE80211_TX_CTL_NO_ACK;
if (mesh_add_meshid_ie(sdata, skb))
goto free;
}
/* Add Mesh Peering Management element */
switch (action) {
case WLAN_SP_MESH_PEERING_OPEN:
break;
case WLAN_SP_MESH_PEERING_CONFIRM:
ie_len += 2;
include_plid = true;
break;
case WLAN_SP_MESH_PEERING_CLOSE:
if (plid) {
ie_len += 2;
include_plid = true;
}
ie_len += 2; /* reason code */
break;
default:
err = -EINVAL;
goto free;
}
if (WARN_ON(skb_tailroom(skb) < 2 + ie_len))
goto free;
pos = skb_put(skb, 2 + ie_len);
*pos++ = WLAN_EID_PEER_MGMT;
*pos++ = ie_len;
memcpy(pos, &peering_proto, 2);
pos += 2;
put_unaligned_le16(llid, pos);
pos += 2;
if (include_plid) {
put_unaligned_le16(plid, pos);
pos += 2;
}
if (action == WLAN_SP_MESH_PEERING_CLOSE) {
put_unaligned_le16(reason, pos);
pos += 2;
}
if (action != WLAN_SP_MESH_PEERING_CLOSE) {
if (mesh_add_ht_cap_ie(sdata, skb) ||
mesh_add_ht_oper_ie(sdata, skb) ||
mesh_add_vht_cap_ie(sdata, skb) ||
mesh_add_vht_oper_ie(sdata, skb))
goto free;
}
if (mesh_add_vendor_ies(sdata, skb))
goto free;
ieee80211_tx_skb(sdata, skb);
return 0;
free:
kfree_skb(skb);
return err;
}
/**
* __mesh_plink_deactivate - deactivate mesh peer link
*
* @sta: mesh peer link to deactivate
*
* All mesh paths with this peer as next hop will be flushed
* Returns beacon changed flag if the beacon content changed.
*
* Locking: the caller must hold sta->mesh->plink_lock
*/
static u32 __mesh_plink_deactivate(struct sta_info *sta)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed = 0;
lockdep_assert_held(&sta->mesh->plink_lock);
if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
changed = mesh_plink_dec_estab_count(sdata);
sta->mesh->plink_state = NL80211_PLINK_BLOCKED;
mesh_path_flush_by_nexthop(sta);
ieee80211_mps_sta_status_update(sta);
changed |= ieee80211_mps_set_sta_local_pm(sta,
NL80211_MESH_POWER_UNKNOWN);
return changed;
}
/**
* mesh_plink_deactivate - deactivate mesh peer link
*
* @sta: mesh peer link to deactivate
*
* All mesh paths with this peer as next hop will be flushed
*/
u32 mesh_plink_deactivate(struct sta_info *sta)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed;
spin_lock_bh(&sta->mesh->plink_lock);
changed = __mesh_plink_deactivate(sta);
sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED;
mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE,
sta->sta.addr, sta->mesh->llid, sta->mesh->plid,
sta->mesh->reason);
spin_unlock_bh(&sta->mesh->plink_lock);
return changed;
}
static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
struct ieee802_11_elems *elems, bool insert)
{
struct ieee80211_local *local = sdata->local;
enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
struct ieee80211_supported_band *sband;
u32 rates, basic_rates = 0, changed = 0;
enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
sband = local->hw.wiphy->bands[band];
rates = ieee80211_sta_get_rates(sdata, elems, band, &basic_rates);
spin_lock_bh(&sta->mesh->plink_lock);
sta->rx_stats.last_rx = jiffies;
/* rates and capabilities don't change during peering */
if (sta->mesh->plink_state == NL80211_PLINK_ESTAB &&
sta->mesh->processed_beacon)
goto out;
sta->mesh->processed_beacon = true;
if (sta->sta.supp_rates[band] != rates)
changed |= IEEE80211_RC_SUPP_RATES_CHANGED;
sta->sta.supp_rates[band] = rates;
if (ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
elems->ht_cap_elem, sta))
changed |= IEEE80211_RC_BW_CHANGED;
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
elems->vht_cap_elem, sta);
if (bw != sta->sta.bandwidth)
changed |= IEEE80211_RC_BW_CHANGED;
/* HT peer is operating 20MHz-only */
if (elems->ht_operation &&
!(elems->ht_operation->ht_param &
IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20)
changed |= IEEE80211_RC_BW_CHANGED;
sta->sta.bandwidth = IEEE80211_STA_RX_BW_20;
}
if (insert)
rate_control_rate_init(sta);
else
rate_control_rate_update(local, sband, sta, changed);
out:
spin_unlock_bh(&sta->mesh->plink_lock);
}
static int mesh_allocate_aid(struct ieee80211_sub_if_data *sdata)
{
struct sta_info *sta;
unsigned long *aid_map;
int aid;
aid_map = kcalloc(BITS_TO_LONGS(IEEE80211_MAX_AID + 1),
sizeof(*aid_map), GFP_KERNEL);
if (!aid_map)
return -ENOMEM;
/* reserve aid 0 for mcast indication */
__set_bit(0, aid_map);
rcu_read_lock();
list_for_each_entry_rcu(sta, &sdata->local->sta_list, list)
__set_bit(sta->sta.aid, aid_map);
rcu_read_unlock();
aid = find_first_zero_bit(aid_map, IEEE80211_MAX_AID + 1);
kfree(aid_map);
if (aid > IEEE80211_MAX_AID)
return -ENOBUFS;
return aid;
}
static struct sta_info *
__mesh_sta_info_alloc(struct ieee80211_sub_if_data *sdata, u8 *hw_addr)
{
struct sta_info *sta;
int aid;
if (sdata->local->num_sta >= MESH_MAX_PLINKS)
return NULL;
aid = mesh_allocate_aid(sdata);
if (aid < 0)
return NULL;
sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL);
if (!sta)
return NULL;
sta->mesh->plink_state = NL80211_PLINK_LISTEN;
sta->sta.wme = true;
sta->sta.aid = aid;
sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
return sta;
}
static struct sta_info *
mesh_sta_info_alloc(struct ieee80211_sub_if_data *sdata, u8 *addr,
struct ieee802_11_elems *elems)
{
struct sta_info *sta = NULL;
/* Userspace handles station allocation */
if (sdata->u.mesh.user_mpm ||
sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED)
cfg80211_notify_new_peer_candidate(sdata->dev, addr,
elems->ie_start,
elems->total_len,
GFP_KERNEL);
else
sta = __mesh_sta_info_alloc(sdata, addr);
return sta;
}
/*
* mesh_sta_info_get - return mesh sta info entry for @addr.
*
* @sdata: local meshif
* @addr: peer's address
* @elems: IEs from beacon or mesh peering frame.
*
* Return existing or newly allocated sta_info under RCU read lock.
* (re)initialize with given IEs.
*/
static struct sta_info *
mesh_sta_info_get(struct ieee80211_sub_if_data *sdata,
u8 *addr, struct ieee802_11_elems *elems) __acquires(RCU)
{
struct sta_info *sta = NULL;
rcu_read_lock();
sta = sta_info_get(sdata, addr);
if (sta) {
mesh_sta_info_init(sdata, sta, elems, false);
} else {
rcu_read_unlock();
/* can't run atomic */
sta = mesh_sta_info_alloc(sdata, addr, elems);
if (!sta) {
rcu_read_lock();
return NULL;
}
mesh_sta_info_init(sdata, sta, elems, true);
if (sta_info_insert_rcu(sta))
return NULL;
}
return sta;
}
/*
* mesh_neighbour_update - update or initialize new mesh neighbor.
*
* @sdata: local meshif
* @addr: peer's address
* @elems: IEs from beacon or mesh peering frame
*
* Initiates peering if appropriate.
*/
void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
u8 *hw_addr,
struct ieee802_11_elems *elems)
{
struct sta_info *sta;
u32 changed = 0;
sta = mesh_sta_info_get(sdata, hw_addr, elems);
if (!sta)
goto out;
if (mesh_peer_accepts_plinks(elems) &&
sta->mesh->plink_state == NL80211_PLINK_LISTEN &&
sdata->u.mesh.accepting_plinks &&
sdata->u.mesh.mshcfg.auto_open_plinks &&
rssi_threshold_check(sdata, sta))
changed = mesh_plink_open(sta);
ieee80211_mps_frame_release(sta, elems);
out:
rcu_read_unlock();
ieee80211_mbss_info_change_notify(sdata, changed);
}
static void mesh_plink_timer(unsigned long data)
{
struct sta_info *sta;
u16 reason = 0;
struct ieee80211_sub_if_data *sdata;
struct mesh_config *mshcfg;
enum ieee80211_self_protected_actioncode action = 0;
/*
* This STA is valid because sta_info_destroy() will
* del_timer_sync() this timer after having made sure
* it cannot be readded (by deleting the plink.)
*/
sta = (struct sta_info *) data;
if (sta->sdata->local->quiescing)
return;
spin_lock_bh(&sta->mesh->plink_lock);
/* If a timer fires just before a state transition on another CPU,
* we may have already extended the timeout and changed state by the
* time we've acquired the lock and arrived here. In that case,
* skip this timer and wait for the new one.
*/
if (time_before(jiffies, sta->mesh->plink_timer.expires)) {
mpl_dbg(sta->sdata,
"Ignoring timer for %pM in state %s (timer adjusted)",
sta->sta.addr, mplstates[sta->mesh->plink_state]);
spin_unlock_bh(&sta->mesh->plink_lock);
return;
}
/* del_timer() and handler may race when entering these states */
if (sta->mesh->plink_state == NL80211_PLINK_LISTEN ||
sta->mesh->plink_state == NL80211_PLINK_ESTAB) {
mpl_dbg(sta->sdata,
"Ignoring timer for %pM in state %s (timer deleted)",
sta->sta.addr, mplstates[sta->mesh->plink_state]);
spin_unlock_bh(&sta->mesh->plink_lock);
return;
}
mpl_dbg(sta->sdata,
"Mesh plink timer for %pM fired on state %s\n",
sta->sta.addr, mplstates[sta->mesh->plink_state]);
sdata = sta->sdata;
mshcfg = &sdata->u.mesh.mshcfg;
switch (sta->mesh->plink_state) {
case NL80211_PLINK_OPN_RCVD:
case NL80211_PLINK_OPN_SNT:
/* retry timer */
if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) {
u32 rand;
mpl_dbg(sta->sdata,
"Mesh plink for %pM (retry, timeout): %d %d\n",
sta->sta.addr, sta->mesh->plink_retries,
sta->mesh->plink_timeout);
get_random_bytes(&rand, sizeof(u32));
sta->mesh->plink_timeout = sta->mesh->plink_timeout +
rand % sta->mesh->plink_timeout;
++sta->mesh->plink_retries;
mod_plink_timer(sta, sta->mesh->plink_timeout);
action = WLAN_SP_MESH_PEERING_OPEN;
break;
}
reason = WLAN_REASON_MESH_MAX_RETRIES;
/* fall through on else */
case NL80211_PLINK_CNF_RCVD:
/* confirm timer */
if (!reason)
reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT;
sta->mesh->plink_state = NL80211_PLINK_HOLDING;
mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
case NL80211_PLINK_HOLDING:
/* holding timer */
del_timer(&sta->mesh->plink_timer);
mesh_plink_fsm_restart(sta);
break;
default:
break;
}
spin_unlock_bh(&sta->mesh->plink_lock);
if (action)
mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr,
sta->mesh->llid, sta->mesh->plid, reason);
}
static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout)
{
sta->mesh->plink_timer.expires = jiffies + msecs_to_jiffies(timeout);
sta->mesh->plink_timer.data = (unsigned long) sta;
sta->mesh->plink_timer.function = mesh_plink_timer;
sta->mesh->plink_timeout = timeout;
add_timer(&sta->mesh->plink_timer);
}
static bool llid_in_use(struct ieee80211_sub_if_data *sdata,
u16 llid)
{
struct ieee80211_local *local = sdata->local;
bool in_use = false;
struct sta_info *sta;
rcu_read_lock();
list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (sdata != sta->sdata)
continue;
if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) {
in_use = true;
break;
}
}
rcu_read_unlock();
return in_use;
}
static u16 mesh_get_new_llid(struct ieee80211_sub_if_data *sdata)
{
u16 llid;
do {
get_random_bytes(&llid, sizeof(llid));
} while (llid_in_use(sdata, llid));
return llid;
}
u32 mesh_plink_open(struct sta_info *sta)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed;
if (!test_sta_flag(sta, WLAN_STA_AUTH))
return 0;
spin_lock_bh(&sta->mesh->plink_lock);
sta->mesh->llid = mesh_get_new_llid(sdata);
if (sta->mesh->plink_state != NL80211_PLINK_LISTEN &&
sta->mesh->plink_state != NL80211_PLINK_BLOCKED) {
spin_unlock_bh(&sta->mesh->plink_lock);
return 0;
}
sta->mesh->plink_state = NL80211_PLINK_OPN_SNT;
mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout);
spin_unlock_bh(&sta->mesh->plink_lock);
mpl_dbg(sdata,
"Mesh plink: starting establishment with %pM\n",
sta->sta.addr);
/* set the non-peer mode to active during peering */
changed = ieee80211_mps_local_status_update(sdata);
mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN,
sta->sta.addr, sta->mesh->llid, 0, 0);
return changed;
}
u32 mesh_plink_block(struct sta_info *sta)
{
u32 changed;
spin_lock_bh(&sta->mesh->plink_lock);
changed = __mesh_plink_deactivate(sta);
sta->mesh->plink_state = NL80211_PLINK_BLOCKED;
spin_unlock_bh(&sta->mesh->plink_lock);
return changed;
}
static void mesh_plink_close(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
enum plink_event event)
{
struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg;
u16 reason = (event == CLS_ACPT) ?
WLAN_REASON_MESH_CLOSE : WLAN_REASON_MESH_CONFIG;
sta->mesh->reason = reason;
sta->mesh->plink_state = NL80211_PLINK_HOLDING;
mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
}
static u32 mesh_plink_establish(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta)
{
struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg;
u32 changed = 0;
del_timer(&sta->mesh->plink_timer);
sta->mesh->plink_state = NL80211_PLINK_ESTAB;
changed |= mesh_plink_inc_estab_count(sdata);
changed |= mesh_set_ht_prot_mode(sdata);
changed |= mesh_set_short_slot_time(sdata);
mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr);
ieee80211_mps_sta_status_update(sta);
changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode);
return changed;
}
/**
* mesh_plink_fsm - step @sta MPM based on @event
*
* @sdata: interface
* @sta: mesh neighbor
* @event: peering event
*
* Return: changed MBSS flags
*/
static u32 mesh_plink_fsm(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta, enum plink_event event)
{
struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg;
enum ieee80211_self_protected_actioncode action = 0;
u32 changed = 0;
mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr,
mplstates[sta->mesh->plink_state], mplevents[event]);
spin_lock_bh(&sta->mesh->plink_lock);
switch (sta->mesh->plink_state) {
case NL80211_PLINK_LISTEN:
switch (event) {
case CLS_ACPT:
mesh_plink_fsm_restart(sta);
break;
case OPN_ACPT:
sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD;
sta->mesh->llid = mesh_get_new_llid(sdata);
mesh_plink_timer_set(sta,
mshcfg->dot11MeshRetryTimeout);
/* set the non-peer mode to active during peering */
changed |= ieee80211_mps_local_status_update(sdata);
action = WLAN_SP_MESH_PEERING_OPEN;
break;
default:
break;
}
break;
case NL80211_PLINK_OPN_SNT:
switch (event) {
case OPN_RJCT:
case CNF_RJCT:
case CLS_ACPT:
mesh_plink_close(sdata, sta, event);
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
case OPN_ACPT:
/* retry timer is left untouched */
sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD;
action = WLAN_SP_MESH_PEERING_CONFIRM;
break;
case CNF_ACPT:
sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD;
mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout);
break;
default:
break;
}
break;
case NL80211_PLINK_OPN_RCVD:
switch (event) {
case OPN_RJCT:
case CNF_RJCT:
case CLS_ACPT:
mesh_plink_close(sdata, sta, event);
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
case OPN_ACPT:
action = WLAN_SP_MESH_PEERING_CONFIRM;
break;
case CNF_ACPT:
changed |= mesh_plink_establish(sdata, sta);
break;
default:
break;
}
break;
case NL80211_PLINK_CNF_RCVD:
switch (event) {
case OPN_RJCT:
case CNF_RJCT:
case CLS_ACPT:
mesh_plink_close(sdata, sta, event);
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
case OPN_ACPT:
changed |= mesh_plink_establish(sdata, sta);
action = WLAN_SP_MESH_PEERING_CONFIRM;
break;
default:
break;
}
break;
case NL80211_PLINK_ESTAB:
switch (event) {
case CLS_ACPT:
changed |= __mesh_plink_deactivate(sta);
changed |= mesh_set_ht_prot_mode(sdata);
changed |= mesh_set_short_slot_time(sdata);
mesh_plink_close(sdata, sta, event);
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
case OPN_ACPT:
action = WLAN_SP_MESH_PEERING_CONFIRM;
break;
default:
break;
}
break;
case NL80211_PLINK_HOLDING:
switch (event) {
case CLS_ACPT:
del_timer(&sta->mesh->plink_timer);
mesh_plink_fsm_restart(sta);
break;
case OPN_ACPT:
case CNF_ACPT:
case OPN_RJCT:
case CNF_RJCT:
action = WLAN_SP_MESH_PEERING_CLOSE;
break;
default:
break;
}
break;
default:
/* should not get here, PLINK_BLOCKED is dealt with at the
* beginning of the function
*/
break;
}
spin_unlock_bh(&sta->mesh->plink_lock);
if (action) {
mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr,
sta->mesh->llid, sta->mesh->plid,
sta->mesh->reason);
/* also send confirm in open case */
if (action == WLAN_SP_MESH_PEERING_OPEN) {
mesh_plink_frame_tx(sdata, sta,
WLAN_SP_MESH_PEERING_CONFIRM,
sta->sta.addr, sta->mesh->llid,
sta->mesh->plid, 0);
}
}
return changed;
}
/*
* mesh_plink_get_event - get correct MPM event
*
* @sdata: interface
* @sta: peer, leave NULL if processing a frame from a new suitable peer
* @elems: peering management IEs
* @ftype: frame type
* @llid: peer's peer link ID
* @plid: peer's local link ID
*
* Return: new peering event for @sta, but PLINK_UNDEFINED should be treated as
* an error.
*/
static enum plink_event
mesh_plink_get_event(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
struct ieee802_11_elems *elems,
enum ieee80211_self_protected_actioncode ftype,
u16 llid, u16 plid)
{
enum plink_event event = PLINK_UNDEFINED;
u8 ie_len = elems->peering_len;
bool matches_local;
matches_local = (ftype == WLAN_SP_MESH_PEERING_CLOSE ||
mesh_matches_local(sdata, elems));
/* deny open request from non-matching peer */
if (!matches_local && !sta) {
event = OPN_RJCT;
goto out;
}
if (!sta) {
if (ftype != WLAN_SP_MESH_PEERING_OPEN) {
mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n");
goto out;
}
/* ftype == WLAN_SP_MESH_PEERING_OPEN */
if (!mesh_plink_free_count(sdata)) {
mpl_dbg(sdata, "Mesh plink error: no more free plinks\n");
goto out;
}
} else {
if (!test_sta_flag(sta, WLAN_STA_AUTH)) {
mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n");
goto out;
}
if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED)
goto out;
}
/* new matching peer */
if (!sta) {
event = OPN_ACPT;
goto out;
}
switch (ftype) {
case WLAN_SP_MESH_PEERING_OPEN:
if (!matches_local)
event = OPN_RJCT;
if (!mesh_plink_free_count(sdata) ||
(sta->mesh->plid && sta->mesh->plid != plid))
event = OPN_IGNR;
else
event = OPN_ACPT;
break;
case WLAN_SP_MESH_PEERING_CONFIRM:
if (!matches_local)
event = CNF_RJCT;
if (!mesh_plink_free_count(sdata) ||
sta->mesh->llid != llid ||
(sta->mesh->plid && sta->mesh->plid != plid))
event = CNF_IGNR;
else
event = CNF_ACPT;
break;
case WLAN_SP_MESH_PEERING_CLOSE:
if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
/* Do not check for llid or plid. This does not
* follow the standard but since multiple plinks
* per sta are not supported, it is necessary in
* order to avoid a livelock when MP A sees an
* establish peer link to MP B but MP B does not
* see it. This can be caused by a timeout in
* B's peer link establishment or B beign
* restarted.
*/
event = CLS_ACPT;
else if (sta->mesh->plid != plid)
event = CLS_IGNR;
else if (ie_len == 8 && sta->mesh->llid != llid)
event = CLS_IGNR;
else
event = CLS_ACPT;
break;
default:
mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n");
break;
}
out:
return event;
}
static void
mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt,
struct ieee802_11_elems *elems)
{
struct sta_info *sta;
enum plink_event event;
enum ieee80211_self_protected_actioncode ftype;
u32 changed = 0;
u8 ie_len = elems->peering_len;
u16 plid, llid = 0;
if (!elems->peering) {
mpl_dbg(sdata,
"Mesh plink: missing necessary peer link ie\n");
return;
}
if (elems->rsn_len &&
sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
mpl_dbg(sdata,
"Mesh plink: can't establish link with secure peer\n");
return;
}
ftype = mgmt->u.action.u.self_prot.action_code;
if ((ftype == WLAN_SP_MESH_PEERING_OPEN && ie_len != 4) ||
(ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) ||
(ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6
&& ie_len != 8)) {
mpl_dbg(sdata,
"Mesh plink: incorrect plink ie length %d %d\n",
ftype, ie_len);
return;
}
if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
(!elems->mesh_id || !elems->mesh_config)) {
mpl_dbg(sdata, "Mesh plink: missing necessary ie\n");
return;
}
/* Note the lines below are correct, the llid in the frame is the plid
* from the point of view of this host.
*/
plid = get_unaligned_le16(PLINK_GET_LLID(elems->peering));
if (ftype == WLAN_SP_MESH_PEERING_CONFIRM ||
(ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8))
llid = get_unaligned_le16(PLINK_GET_PLID(elems->peering));
/* WARNING: Only for sta pointer, is dropped & re-acquired */
rcu_read_lock();
sta = sta_info_get(sdata, mgmt->sa);
if (ftype == WLAN_SP_MESH_PEERING_OPEN &&
!rssi_threshold_check(sdata, sta)) {
mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n",
mgmt->sa);
goto unlock_rcu;
}
/* Now we will figure out the appropriate event... */
event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid);
if (event == OPN_ACPT) {
rcu_read_unlock();
/* allocate sta entry if necessary and update info */
sta = mesh_sta_info_get(sdata, mgmt->sa, elems);
if (!sta) {
mpl_dbg(sdata, "Mesh plink: failed to init peer!\n");
goto unlock_rcu;
}
sta->mesh->plid = plid;
} else if (!sta && event == OPN_RJCT) {
mesh_plink_frame_tx(sdata, NULL, WLAN_SP_MESH_PEERING_CLOSE,
mgmt->sa, 0, plid,
WLAN_REASON_MESH_CONFIG);
goto unlock_rcu;
} else if (!sta || event == PLINK_UNDEFINED) {
/* something went wrong */
goto unlock_rcu;
}
if (event == CNF_ACPT) {
/* 802.11-2012 13.3.7.2 - update plid on CNF if not set */
if (!sta->mesh->plid)
sta->mesh->plid = plid;
sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt));
}
changed |= mesh_plink_fsm(sdata, sta, event);
unlock_rcu:
rcu_read_unlock();
if (changed)
ieee80211_mbss_info_change_notify(sdata, changed);
}
void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt, size_t len,
struct ieee80211_rx_status *rx_status)
{
struct ieee802_11_elems elems;
size_t baselen;
u8 *baseaddr;
/* need action_code, aux */
if (len < IEEE80211_MIN_ACTION_SIZE + 3)
return;
if (sdata->u.mesh.user_mpm)
/* userspace must register for these */
return;
if (is_multicast_ether_addr(mgmt->da)) {
mpl_dbg(sdata,
"Mesh plink: ignore frame from multicast address\n");
return;
}
baseaddr = mgmt->u.action.u.self_prot.variable;
baselen = (u8 *) mgmt->u.action.u.self_prot.variable - (u8 *) mgmt;
if (mgmt->u.action.u.self_prot.action_code ==
WLAN_SP_MESH_PEERING_CONFIRM) {
baseaddr += 4;
baselen += 4;
if (baselen > len)
return;
}
ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems);
mesh_process_plink_frame(sdata, mgmt, &elems);
}
| AiJiaZone/linux-4.0 | virt/net/mac80211/mesh_plink.c | C | gpl-2.0 | 31,502 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2263,
1010,
2268,
2330,
17914,
17465,
2487,
2015,
5183,
1012,
1008,
3166,
1024,
6446,
5828,
2522,
5092,
1026,
6446,
3540,
1030,
26931,
16313,
1012,
4012,
1028,
1008,
1008,
2023,
2565,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Imports BVSoftware.Bvc5.Core
Imports System.Data
Imports System.Collections.ObjectModel
Partial Class BVModules_ContentBlocks_Order_Activity_view
Inherits Content.BVModule
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
LoadOrders()
End If
End Sub
Private Sub LoadOrders()
Dim s As String = String.Empty
s = SettingsManager.GetSetting("Status")
Select Case s
Case "Payment"
LoadPaymentStatus()
Case "Shipping"
LoadShippingStatus()
Case "Other"
LoadOtherStatus()
End Select
End Sub
Public Sub LoadPaymentStatus()
Dim c As New Orders.OrderSearchCriteria
Dim v As String = String.Empty
v = SettingsManager.GetSetting("Value")
Me.Title.Text = "Last 10 Orders with Payment Status: " & v.ToString
Select Case v
Case "Unknown"
c.PaymentStatus = Orders.OrderPaymentStatus.Unknown
Case "Unpaid"
c.PaymentStatus = Orders.OrderPaymentStatus.Unpaid
Case "PartiallyPaid"
c.PaymentStatus = Orders.OrderPaymentStatus.PartiallyPaid
Case "Paid"
c.PaymentStatus = Orders.OrderPaymentStatus.Paid
Case "Overpaid"
c.PaymentStatus = Orders.OrderPaymentStatus.Overpaid
End Select
Dim found As New Collection(Of Orders.Order)
found = Orders.Order.FindByCriteria(c)
Dim newFound As New Collection(Of Orders.Order)
Dim i As Integer = 0
If found.Count > 10 Then
While i < 10
newFound.Add(found.Item(i))
i += 1
End While
Else
Dim f As Integer = 0
While f < found.Count
newFound.Add(found.Item(f))
f += 1
End While
End If
Me.OrderActivityDataList.DataSource = newFound
Me.OrderActivityDataList.DataBind()
Me.OrderActivityDataList.RepeatDirection = SettingsManager.GetIntegerSetting("DisplayTypeRad")
If SettingsManager.GetIntegerSetting("DisplayTypeRad") = 1 Then
Me.OrderActivityDataList.RepeatColumns = 1
Else
Me.OrderActivityDataList.RepeatColumns = SettingsManager.GetIntegerSetting("GridColumnsField")
End If
End Sub
Public Sub LoadShippingStatus()
Dim c As New Orders.OrderSearchCriteria
Dim v As String = String.Empty
v = SettingsManager.GetSetting("Value")
Me.Title.Text = "Last 10 Orders with Shipping Status: " & v.ToString
Select Case v
Case "Unknown"
c.ShippingStatus = Orders.OrderShippingStatus.Unknown
Case "Unshipped"
c.ShippingStatus = Orders.OrderShippingStatus.Unshipped
Case "PartiallyShipped"
c.ShippingStatus = Orders.OrderShippingStatus.PartiallyShipped
Case "FullyShipped"
c.ShippingStatus = Orders.OrderShippingStatus.FullyShipped
Case "NonShipping"
c.ShippingStatus = Orders.OrderShippingStatus.NonShipping
End Select
Dim found As New Collection(Of Orders.Order)
found = Orders.Order.FindByCriteria(c)
Dim newFound As New Collection(Of Orders.Order)
Dim i As Integer = 0
If found.Count > 10 Then
While i < 10
newFound.Add(found.Item(i))
i += 1
End While
Else
Dim f As Integer = 0
While f < found.Count
newFound.Add(found.Item(f))
f += 1
End While
End If
Me.OrderActivityDataList.DataSource = newFound
Me.OrderActivityDataList.DataBind()
Me.OrderActivityDataList.RepeatDirection = SettingsManager.GetIntegerSetting("DisplayTypeRad")
If SettingsManager.GetIntegerSetting("DisplayTypeRad") = 1 Then
Me.OrderActivityDataList.RepeatColumns = 1
Else
Me.OrderActivityDataList.RepeatColumns = SettingsManager.GetIntegerSetting("GridColumnsField")
End If
End Sub
Public Sub LoadOtherStatus()
Dim c As New Orders.OrderSearchCriteria
Dim v As String = SettingsManager.GetSetting("OtherStatusBvin")
Dim o As Orders.OrderStatusCode = Orders.OrderStatusCode.FindByBvin(v)
c.StatusCode = v
Dim found As New Collection(Of Orders.Order)
found = Orders.Order.FindByCriteria(c)
If found.Count = 0 Then
Me.Title.Text = "No Orders Found"
Else
Me.Title.Text = "Last 10 Orders with Status: " & o.StatusName
Dim newFound As New Collection(Of Orders.Order)
Dim i As Integer = 0
If found.Count > 10 Then
While i < 10
newFound.Add(found.Item(i))
i += 1
End While
Else
Dim f As Integer = 0
While f < found.Count
newFound.Add(found.Item(f))
f += 1
End While
End If
Me.OrderActivityDataList.DataSource = newFound
Me.OrderActivityDataList.DataBind()
Me.OrderActivityDataList.RepeatDirection = SettingsManager.GetIntegerSetting("DisplayTypeRad")
If SettingsManager.GetIntegerSetting("DisplayTypeRad") = 1 Then
Me.OrderActivityDataList.RepeatColumns = 1
Else
Me.OrderActivityDataList.RepeatColumns = SettingsManager.GetIntegerSetting("GridColumnsField")
End If
End If
End Sub
Protected Sub OrderActivityDataList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles OrderActivityDataList.ItemCommand
If e.CommandName = "Go" Then
Dim OrderID As String = e.CommandArgument.ToString
Response.Redirect("~/BVAdmin/Orders/ViewOrder.aspx?id=" & OrderID & "")
End If
End Sub
End Class
| ajaydex/Scopelist_2015 | BVModules/ContentBlocks/Order Activity/view.ascx.vb | Visual Basic | apache-2.0 | 6,248 | [
30522,
17589,
1038,
15088,
15794,
8059,
1012,
1038,
25465,
2629,
1012,
4563,
17589,
2291,
1012,
2951,
17589,
2291,
1012,
6407,
1012,
4874,
5302,
9247,
7704,
2465,
1038,
2615,
5302,
8566,
4244,
1035,
4180,
23467,
2015,
1035,
2344,
1035,
4023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "DirectoryNodeAlbumCompilations.h"
#include "QueryParams.h"
#include "music/MusicDatabase.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
CDirectoryNodeAlbumCompilations::CDirectoryNodeAlbumCompilations(const std::string& strName, CDirectoryNode* pParent)
: CDirectoryNode(NODE_TYPE_ALBUM_COMPILATIONS, strName, pParent)
{
}
NODE_TYPE CDirectoryNodeAlbumCompilations::GetChildType() const
{
if (GetName()=="-1")
return NODE_TYPE_ALBUM_COMPILATIONS_SONGS;
return NODE_TYPE_SONG;
}
std::string CDirectoryNodeAlbumCompilations::GetLocalizedName() const
{
if (GetID() == -1)
return g_localizeStrings.Get(15102); // All Albums
CMusicDatabase db;
if (db.Open())
return db.GetAlbumById(GetID());
return "";
}
bool CDirectoryNodeAlbumCompilations::GetContent(CFileItemList& items) const
{
CMusicDatabase musicdatabase;
if (!musicdatabase.Open())
return false;
CQueryParams params;
CollectQueryParams(params);
bool bSuccess=musicdatabase.GetCompilationAlbums(BuildPath(), items);
musicdatabase.Close();
return bSuccess;
}
| joethefox/xbmc | xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.cpp | C++ | gpl-2.0 | 1,817 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
2286,
2136,
1060,
25526,
2278,
1008,
8299,
1024,
1013,
1013,
1060,
25526,
2278,
1012,
8917,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const webpack = require("webpack");
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const AssetsPlugin = require("assets-webpack-plugin");
module.exports = {
entry: {
main: path.join(__dirname, "src", "index.js")
},
output: {
path: path.join(__dirname, "dist")
},
module: {
rules: [
{
test: /\.((png)|(eot)|(woff)|(woff2)|(ttf)|(svg)|(gif))(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader?name=/[hash].[ext]"
},
{test: /\.json$/, loader: "json-loader"},
{
loader: "babel-loader",
test: /\.js?$/,
exclude: /node_modules/,
query: {cacheDirectory: true}
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /node_modules/,
use: ["style-loader", MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", "sass-loader"]
}
]
},
plugins: [
new webpack.ProvidePlugin({
fetch: "imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch"
}),
new AssetsPlugin({
filename: "webpack.json",
path: path.join(process.cwd(), "site/data"),
prettyPrint: true
}),
// new CopyWebpackPlugin([
// {
// from: "./src/fonts/",
// to: "fonts/",
// flatten: true
// }
// ])
]
};
| codemeyer/ArgData | Docs/webpack.common.js | JavaScript | mit | 1,390 | [
30522,
9530,
3367,
4773,
23947,
1027,
5478,
1006,
1000,
4773,
23947,
1000,
1007,
1025,
9530,
3367,
4130,
1027,
5478,
1006,
1000,
4130,
1000,
1007,
1025,
9530,
3367,
6100,
8545,
2497,
23947,
24759,
15916,
2378,
1027,
5478,
1006,
1000,
6100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Override <linux/workqueue.h>
*/
struct work_struct {
};
| ev3rt-git/ev3rt-hrp2 | target/ev3_gcc/drivers/common/virtual-linux-kernel/include/linux/workqueue.h | C | gpl-2.0 | 65 | [
30522,
1013,
1008,
1008,
1008,
2058,
15637,
1026,
11603,
1013,
2147,
4226,
5657,
1012,
1044,
1028,
1008,
1013,
2358,
6820,
6593,
2147,
1035,
2358,
6820,
6593,
1063,
1065,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React closes out dominant 2018 - Hacker News Hiring Trends (December 2018)</title>
<meta property="og:title" content="React closes out dominant 2018 - Hacker News Hiring Trends (December 2018)" />
<meta name="description" content="Most Popular programming languanges
and software development technologies for December, 2018">
<meta property="og:description" content="Most Popular programming
languanges and software development technologies for December, 2018">
<meta property="og:image" content="https://s3.amazonaws.com/rw-net/hacker-news-hiring-trends/hacker-news-hiring-trends.png"/>
<meta property="og:image:secure_url" content="https://s3.amazonaws.com/rw-net/hacker-news-hiring-trends/hacker-news-hiring-trends.png" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="../css/styles.css" />
<link rel="canonical" href="https://www.hntrends.com/2018/dec-react-closes-out-dominant-2018.html">
<link rel="alternate" type="application/rss+xml" title="Hacker News Hiring Trends" href="https://www.hntrends.com/feed.xml">
</head>
<body>
<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="../">Home and Archives</a></li>
<li class="breadcrumb-item active">December 2018</li>
<li class="breadcrumb-item"><a href="#highlights">Highlights and Analysis</a></li>
<li class="breadcrumb-item"><a href="#data">Data</a></li>
</ol>
</nav>
<div class="page-header row">
<div class="col-sm-8">
<h1>
React closes out dominant 2018
</h1>
<p class="lead">
December 2018 Hacker News Hiring Trends
</p>
</div>
<div class="col-sm-4">
</div>
</div>
<div class="chart-filters mb-2">
<form id="chart_filter" method="get">
<div class="form-row align-items-center">
<div class="col-md-1">
<select id="topfilter" class="form-control">
<option value="5" selected>Top 5</option>
<option value="10">Top 10</option>
<option value="20">Top 20</option>
<option value="50">Top 50</option>
</select>
</div>
<div class="col-md-1">
or compare
</div>
<div id="term_comparisons" class="col-md-9 form-row">
<div class="col">
<input type="text" name="compare" class="term-compare form-control" placeholder="Ruby" />
</div>
<div class="col">
<input type="text" name="compare" class="term-compare form-control" placeholder="Python" />
</div>
<div class="col">
<input type="text" name="compare" class="term-compare form-control" />
</div>
<div class="col">
<input type="text" name="compare" class="term-compare form-control" />
</div>
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-default">Compare</button>
</div>
</div>
</form>
</div>
<div id="chart" class="mb-5" style="width:100%; height:400px;"></div>
<div class="row">
<div class="col-md-9">
<h3 id="highlights">December Highlights</h3>
<div class="post-date">Monday, December 31, 2018</div>
<p>
The story of 2018, much like 2017, remains to be React as it becomes
the first technology to remain on top for an entire calendar year.
React also runs its win streak to an incredible nineteen months in a
row. <a href="?compare=AngularJS&compare=Ember&compare=React&compare=Vue">Looking at the larger world of JavaScript libraries</a>
does not reveal any emerging threats to React on the horizon. Angular
is trending down, Vue.js is still in search of a jump to the next level
and Ember remains flat.
</p>
<p>
As far as programming languages go, Python is mirroring React's
overall dominance, claiming the crown as most popular programming
language for the past nineteen months. It was last topped by JavaScript
in May, 2017.
</p>
<p>
Looking further down the full list of rankings, a few other stories
from 2018 are emerging:
</p>
<ul>
<li>
TypeScript is making huge gains.
</li>
<li>
Containers showing their popularity with Docker and Kubernetes consistently approaching the Top 10.
</li>
<li>
node.js has emerged as the top backend web technology, but Rails has not dropped off.
</li>
<li>
AWS is dominating the cloud with a number of strong performing services (Lambda, ECS, Kinesis, SQS).
</li>
<li>
<a href="?compare=GraphQL&compare=REST">GraphQL surpassed REST</a>, demonstrating its popularity as a way to deliver APIs.
</li>
</ul>
<h4>Top 10 Programming Languages</h4>
<ol>
<li><a href="?compare=Python">Python</a></li>
<li><a href="?compare=JavaScript">JavaScript</a></li>
<li><a href="?compare=Java">Java</a></li>
<li><a href="?compare=golang">Go</a></li>
<li><a href="?compare=Ruby">Ruby</a></li>
<li><a href="?compare=TypeScript">TypeScript</a></li>
<li><a href="?compare=C%2B%2B">C++</a></li>
<li><a href="?compare=Scala">Scala</a></li>
<li><a href="?compare=C">C</a></li>
<li><a href="?compare=PHP">PHP</a></li>
</ol>
<p>
<a href="?compare=Python&compare=JavaScript&compare=Java&compare=golang&compare=Ruby&compare=TypeScript&compare=C%2B%2B&compare=Scala&compare=C&compare=PHP">Compare Top 10 Programming Languages</a>
</p>
<h4>Server-side Frameworks</h4>
<p>
<a href="?compare=Rails&compare=node.js&compare=PHP&compare=Django">
Compare Rails, node.js, PHP and Django
</a>
</p>
<p>
</p>
<h4>JavaScript Frameworks</h4>
<p>
<a href="?compare=AngularJS&compare=Ember&compare=React&compare=Vue">
Compare React, Angular, Vue, and Ember
</a>
</p>
<p>
</p>
<h4>SQL Databases</h4>
<p>
<a href="?compare=Postgresql&compare=MySQL&compare=SQL+Server&compare=">
Compare Postgresql, MySQL and SQL Server
</a>
</p>
<p>
</p>
<h4>NoSQL Databases</h4>
<p>
<a href="?compare=Mongodb&compare=elasticsearch&compare=Cassandra&compare=DynamoDB">
Compare Mongodb, Elasticsearch, Cassandra and DynamoDB
</a>
</p>
<h4>Big Data</h4>
<p>
<a href="?compare=storm&compare=Hadoop&compare=Spark">
Compare Storm, Hadoop and Spark
</a>
</p>
<h4>Messaging</h4>
<p>
<a href="?compare=kafka&compare=rabbitmq&compare=SQS&compare=Kinesis">
Compare Kafka, RabbitMQ, SQS and Kinesis
</a>
</p>
<h4>DevOps Tools</h4>
<p>
<a href="?compare=Chef&compare=Puppet&compare=Ansible&compare=Terraform">
Compare Terraform, Chef, Puppet and Ansible
</a>
</p>
<h4>Virtualization and Container Tools</h4>
<p>
<a href="?compare=docker&compare=Kubernetes&compare=mesos&compare=Terraform">
Compare Docker, Kubernetes, Mesos and Terraform
</a>
</p>
<h4>Cryptocurrency and Blockchain</h4>
<p>
<a href="?compare=blockchain&compare=bitcoin&compare=ethereum"> Compare Blockchain, Bitcoin and Ethereum</a>
</p>
</div>
<div class="col-md-3">
<p style="margin-top:30px;">
<a href="http://eepurl.com/DVVSb" class="btn btn-success btn-lg">Subscribe for updates</a>
</p>
<div class="badges">
<script src="//platform.linkedin.com/in.js" type="text/javascript">
lang: en_US
</script>
<script type="IN/Share" data-url="https://hntrends.com/2018/dec-react-closes-out-dominant-2018.html" data-counter="right"></script>
<a href="https://twitter.com/intent/tweet?text=Hacker%20News%20tech%20hiring%20trends&via=ryanwi&hashtags=hackernews" class="twitter-share-button">Tweet</a>
</div>
</div>
</div>
<h3>Rankings and movers</h3>
<div id="data"></div>
<ul class="nav nav-tabs">
<li class="nav-item"><a href="#top20" class="nav-link active" data-toggle="tab">Top 20</a></li>
<li class="nav-item"><a href="#rising" class="nav-link" data-toggle="tab">Rising</a></li>
<li class="nav-item"><a href="#falling" class="nav-link" data-toggle="tab">Falling</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="top20">
<table class="table table-condensed">
<thead>
<tr>
<th>Tech</th>
<th>Rank</th>
<th>Last Month</th>
<th>Change</th>
<th>Last Year</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="?compare=React">React</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td><a href="?compare=Python">Python</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>2</td>
<td>0</td>
</tr>
<tr>
<td><a href="?compare=AWS">AWS</td>
<td>3</td>
<td>4</td>
<td class="positive success">+1</td>
<td>4</td>
<td class="positive success">+1</td>
</tr>
<tr>
<td><a href="?compare=Full Stack">Full Stack</td>
<td>4</td>
<td>3</td>
<td class="negative danger">-1</td>
<td>7</td>
<td class="positive success">+3</td>
</tr>
<tr>
<td><a href="?compare=JavaScript">JavaScript</td>
<td>5</td>
<td>5</td>
<td>0</td>
<td>3</td>
<td class="negative danger">-2</td>
</tr>
<tr>
<td><a href="?compare=DevOps">DevOps</td>
<td>6</td>
<td>9</td>
<td class="positive success">+3</td>
<td>9</td>
<td class="positive success">+3</td>
</tr>
<tr>
<td><a href="?compare=node.js">node.js</td>
<td>7</td>
<td>6</td>
<td class="negative danger">-1</td>
<td>6</td>
<td class="negative danger">-1</td>
</tr>
<tr>
<td><a href="?compare=Java">Java</td>
<td>8</td>
<td>10</td>
<td class="positive success">+2</td>
<td>11</td>
<td class="positive success">+3</td>
</tr>
<tr>
<td><a href="?compare=Machine Learning">Machine Learning</td>
<td>9</td>
<td>11</td>
<td class="positive success">+2</td>
<td>8</td>
<td class="negative danger">-1</td>
</tr>
<tr>
<td><a href="?compare=Postgresql">Postgresql</td>
<td>10</td>
<td>7</td>
<td class="negative danger">-3</td>
<td>5</td>
<td class="negative danger">-5</td>
</tr>
<tr>
<td><a href="?compare=golang">golang</td>
<td>11</td>
<td>8</td>
<td class="negative danger">-3</td>
<td>14</td>
<td class="positive success">+3</td>
</tr>
<tr>
<td><a href="?compare=Docker">Docker</td>
<td>12</td>
<td>12</td>
<td>0</td>
<td>13</td>
<td class="positive success">+1</td>
</tr>
<tr>
<td><a href="?compare=Ruby">Ruby</td>
<td>13</td>
<td>13</td>
<td>0</td>
<td>12</td>
<td class="negative danger">-1</td>
</tr>
<tr>
<td><a href="?compare=Rails">Rails</td>
<td>14</td>
<td>15</td>
<td class="positive success">+1</td>
<td>10</td>
<td class="negative danger">-4</td>
</tr>
<tr>
<td><a href="?compare=Kubernetes">Kubernetes</td>
<td>15</td>
<td>14</td>
<td class="negative danger">-1</td>
<td>37</td>
<td class="positive success">+22</td>
</tr>
<tr>
<td><a href="?compare=iOS">iOS</td>
<td>16</td>
<td>17</td>
<td class="positive success">+1</td>
<td>15</td>
<td class="negative danger">-1</td>
</tr>
<tr>
<td><a href="?compare=Android">Android</td>
<td>17</td>
<td>16</td>
<td class="negative danger">-1</td>
<td>17</td>
<td>0</td>
</tr>
<tr>
<td><a href="?compare=TypeScript">TypeScript</td>
<td>18</td>
<td>24</td>
<td class="positive success">+6</td>
<td>50</td>
<td class="positive success">+32</td>
</tr>
<tr>
<td><a href="?compare=Open Source">Open Source</td>
<td>19</td>
<td>27</td>
<td class="positive success">+8</td>
<td>16</td>
<td class="negative danger">-3</td>
</tr>
<tr>
<td><a href="?compare=C++">C++</td>
<td>20</td>
<td>18</td>
<td class="negative danger">-2</td>
<td>19</td>
<td class="negative danger">-1</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane" id="rising">
<table class="table table-condensed">
<thead>
<tr>
<th>Tech</th>
<th>Mentions</th>
<th>Rank</th>
<th>Last Year Mentions</th>
<th>Last Year Rank</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="?compare=ECS">ECS</td>
<td>9</td>
<td>76</td>
<td>0</td>
<td>195</td>
<td class="positive success">+119</td>
</tr>
<tr>
<td><a href="?compare=SQS">SQS</td>
<td>5</td>
<td>105</td>
<td>0</td>
<td>207</td>
<td class="positive success">+102</td>
</tr>
<tr>
<td><a href="?compare=Kinesis">Kinesis</td>
<td>12</td>
<td>65</td>
<td>2</td>
<td>146</td>
<td class="positive success">+81</td>
</tr>
<tr>
<td><a href="?compare=Apollo">Apollo</td>
<td>5</td>
<td>101</td>
<td>1</td>
<td>178</td>
<td class="positive success">+77</td>
</tr>
<tr>
<td><a href="?compare=BigQuery">BigQuery</td>
<td>5</td>
<td>100</td>
<td>1</td>
<td>172</td>
<td class="positive success">+72</td>
</tr>
<tr>
<td><a href="?compare=OpenCV">OpenCV</td>
<td>6</td>
<td>94</td>
<td>1</td>
<td>165</td>
<td class="positive success">+71</td>
</tr>
<tr>
<td><a href="?compare=GraphQL">GraphQL</td>
<td>34</td>
<td>33</td>
<td>9</td>
<td>87</td>
<td class="positive success">+54</td>
</tr>
<tr>
<td><a href="?compare=Assembly">Assembly</td>
<td>10</td>
<td>72</td>
<td>4</td>
<td>118</td>
<td class="positive success">+46</td>
</tr>
<tr>
<td><a href="?compare=Shell">Shell</td>
<td>5</td>
<td>104</td>
<td>2</td>
<td>150</td>
<td class="positive success">+46</td>
</tr>
<tr>
<td><a href="?compare=Lambda">Lambda</td>
<td>16</td>
<td>57</td>
<td>6</td>
<td>102</td>
<td class="positive success">+45</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane" id="falling">
<table class="table table-condensed">
<thead>
<tr>
<th>Tech</th>
<th>Mentions</th>
<th>Rank</th>
<th>Last Year Mentions</th>
<th>Last Year Rank</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="?compare=Web Services">Web Services</td>
<td>4</td>
<td>121</td>
<td>14</td>
<td>65</td>
<td class="negative danger">-56</td>
</tr>
<tr>
<td><a href="?compare=Mesos">Mesos</td>
<td>2</td>
<td>154</td>
<td>7</td>
<td>100</td>
<td class="negative danger">-54</td>
</tr>
<tr>
<td><a href="?compare=nginx">nginx</td>
<td>4</td>
<td>122</td>
<td>12</td>
<td>72</td>
<td class="negative danger">-50</td>
</tr>
<tr>
<td><a href="?compare=Ethereum">Ethereum</td>
<td>4</td>
<td>125</td>
<td>11</td>
<td>76</td>
<td class="negative danger">-49</td>
</tr>
<tr>
<td><a href="?compare=Hive">Hive</td>
<td>3</td>
<td>141</td>
<td>7</td>
<td>96</td>
<td class="negative danger">-45</td>
</tr>
<tr>
<td><a href="?compare=Laravel">Laravel</td>
<td>4</td>
<td>126</td>
<td>8</td>
<td>90</td>
<td class="negative danger">-36</td>
</tr>
<tr>
<td><a href="?compare=Ansible">Ansible</td>
<td>8</td>
<td>81</td>
<td>23</td>
<td>45</td>
<td class="negative danger">-36</td>
</tr>
<tr>
<td><a href="?compare=zookeeper">zookeeper</td>
<td>2</td>
<td>142</td>
<td>5</td>
<td>107</td>
<td class="negative danger">-35</td>
</tr>
<tr>
<td><a href="?compare=Erlang">Erlang</td>
<td>4</td>
<td>117</td>
<td>9</td>
<td>83</td>
<td class="negative danger">-34</td>
</tr>
<tr>
<td><a href="?compare=Ember">Ember</td>
<td>7</td>
<td>88</td>
<td>17</td>
<td>55</td>
<td class="negative danger">-33</td>
</tr>
</tbody>
</table>
</div>
</div>
<footer style="text-align:center;margin-top:30px;margin-bottom:30px;">
<a href="https://www.ryanwilliams.dev">Portland Ruby, Web and Software developer Ryan Williams</a> •
<a href="https://twitter.com/ryanwi">Follow @ryanwi</a> •
Email: ryan at ryanwilliams.dev •
<a href="https://github.com/ryanwi/hiringtrends">Code on GitHub</a>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="../data/data-20181201.js"></script>
<script src="../js/builder-v11.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-16316427-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-16316427-3');
</script>
</body>
</html>
| ryanwi/hiringtrends | web/2018/dec-react-closes-out-dominant-2018.html | HTML | mit | 19,729 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
4180,
1027,
1000,
9381,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
** Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
** Copyright (C) 2005-2013 Sourcefire, Inc.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License Version 2 as
** published by the Free Software Foundation. You may not use, modify or
** distribute this program under any other version of the GNU General
** Public License.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "client_app_api.h"
#include "client_app_smtp.h"
typedef enum
{
SMTP_STATE_HELO,
SMTP_STATE_MAIL_FROM,
SMTP_STATE_RCPT_TO,
SMTP_STATE_DATA,
SMTP_STATE_MESSAGE,
SMTP_STATE_CONNECTION_ERROR
} SMTPState;
#define MAX_VERSION_SIZE 64
typedef struct
{
SMTPState state;
uint8_t version[MAX_VERSION_SIZE];
} ClientSMTPData;
typedef struct _SMTP_CLIENT_APP_CONFIG
{
int enabled;
} SMTP_CLIENT_APP_CONFIG;
static SMTP_CLIENT_APP_CONFIG smtp_config;
static CLIENT_APP_RETCODE smtp_init(const InitClientAppAPI * const init_api, SF_LIST *config);
static CLIENT_APP_RETCODE smtp_validate(const uint8_t *data, uint16_t size, const int dir,
FLOW *flowp, const SFSnortPacket *pkt, struct _Detector *userData);
RNAClientAppModule smtp_client_mod =
{
.name = "SMTP",
.proto = IPPROTO_TCP,
.init = &smtp_init,
.validate = &smtp_validate,
.minimum_matches = 1
};
typedef struct {
const u_int8_t *pattern;
unsigned length;
int index;
unsigned appId;
} Client_App_Pattern;
#define HELO "HELO "
#define EHLO "EHLO "
#define MAILFROM "MAIL FROM:"
#define RCPTTO "RCPT TO:"
#define DATA "DATA"
#define RSET "RSET"
#define MICROSOFT "Microsoft "
#define OUTLOOK "Outlook"
#define EXPRESS "Express "
#define IMO "IMO, "
static const uint8_t APP_SMTP_OUTLOOK[] = "Microsoft Outlook";
static const uint8_t APP_SMTP_OUTLOOK_EXPRESS[] = "Microsoft Outlook Express ";
static const uint8_t APP_SMTP_IMO[] = "IMO, ";
static const uint8_t APP_SMTP_EVOLUTION[] = "Ximian Evolution ";
static const uint8_t APP_SMTP_LOTUSNOTES[] = "Lotus Notes ";
static const uint8_t APP_SMTP_APPLEMAIL[] = "Apple Mail (";
static const uint8_t APP_SMTP_EUDORA[] = "QUALCOMM Windows Eudora Version ";
static const uint8_t APP_SMTP_EUDORAPRO[] = "Windows Eudora Pro Version ";
static const uint8_t APP_SMTP_AOL[] = "AOL ";
static const uint8_t APP_SMTP_MUTT[] = "Mutt/";
static const uint8_t APP_SMTP_KMAIL[] = "KMail/";
static const uint8_t APP_SMTP_MTHUNDERBIRD[] = "Mozilla Thunderbird ";
static const uint8_t APP_SMTP_THUNDERBIRD[] = "Thunderbird ";
static const uint8_t APP_SMTP_MOZILLA[] = "Mozilla";
static const uint8_t APP_SMTP_THUNDERBIRD_SHORT[] = "Thunderbird/";
static Client_App_Pattern patterns[] =
{
{(uint8_t *)HELO, sizeof(HELO)-1, 0, APP_ID_SMTP},
{(uint8_t *)EHLO, sizeof(EHLO)-1, 0, APP_ID_SMTP},
{APP_SMTP_OUTLOOK, sizeof(APP_SMTP_OUTLOOK)-1, -1, APP_ID_OUTLOOK},
{APP_SMTP_OUTLOOK_EXPRESS, sizeof(APP_SMTP_OUTLOOK_EXPRESS)-1,-1, APP_ID_OUTLOOK_EXPRESS},
{APP_SMTP_IMO, sizeof(APP_SMTP_IMO)-1, -1, APP_ID_SMTP_IMO},
{APP_SMTP_EVOLUTION, sizeof(APP_SMTP_EVOLUTION)-1, -1, APP_ID_EVOLUTION},
{APP_SMTP_LOTUSNOTES, sizeof(APP_SMTP_LOTUSNOTES)-1, -1, APP_ID_LOTUS_NOTES},
{APP_SMTP_APPLEMAIL, sizeof(APP_SMTP_APPLEMAIL)-1, -1, APP_ID_APPLE_EMAIL},
{APP_SMTP_EUDORA, sizeof(APP_SMTP_EUDORA)-1, -1, APP_ID_EUDORA},
{APP_SMTP_EUDORAPRO, sizeof(APP_SMTP_EUDORAPRO)-1, -1, APP_ID_EUDORA_PRO},
{APP_SMTP_AOL, sizeof(APP_SMTP_AOL)-1, -1, APP_ID_AOL_EMAIL},
{APP_SMTP_MUTT, sizeof(APP_SMTP_MUTT)-1, -1, APP_ID_MUTT},
{APP_SMTP_KMAIL, sizeof(APP_SMTP_KMAIL)-1, -1, APP_ID_KMAIL},
{APP_SMTP_MTHUNDERBIRD, sizeof(APP_SMTP_MTHUNDERBIRD)-1, -1, APP_ID_THUNDERBIRD},
{APP_SMTP_THUNDERBIRD, sizeof(APP_SMTP_THUNDERBIRD)-1, -1, APP_ID_THUNDERBIRD},
};
static tAppRegistryEntry appIdRegistry[] =
{
{APP_ID_THUNDERBIRD, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_OUTLOOK, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_KMAIL, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_EUDORA_PRO, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_EVOLUTION, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_SMTP_IMO, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_EUDORA, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_LOTUS_NOTES, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_APPLE_EMAIL, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_AOL_EMAIL, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_MUTT, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_SMTP, APPINFO_FLAG_CLIENT_ADDITIONAL},
{APP_ID_OUTLOOK_EXPRESS, APPINFO_FLAG_CLIENT_ADDITIONAL}
};
static CLIENT_APP_RETCODE smtp_init(const InitClientAppAPI * const init_api, SF_LIST *config)
{
unsigned i;
RNAClientAppModuleConfigItem *item;
smtp_config.enabled = 1;
if (config)
{
for (item = (RNAClientAppModuleConfigItem *)sflist_first(config);
item;
item = (RNAClientAppModuleConfigItem *)sflist_next(config))
{
_dpd.debugMsg(DEBUG_LOG,"Processing %s: %s\n",item->name, item->value);
if (strcasecmp(item->name, "enabled") == 0)
{
smtp_config.enabled = atoi(item->value);
}
}
}
if (smtp_config.enabled)
{
for (i=0; i < sizeof(patterns)/sizeof(*patterns); i++)
{
init_api->RegisterPattern(&smtp_validate, IPPROTO_TCP, patterns[i].pattern, patterns[i].length, patterns[i].index);
}
}
unsigned j;
for (j=0; j < sizeof(appIdRegistry)/sizeof(*appIdRegistry); j++)
{
_dpd.debugMsg(DEBUG_LOG,"registering appId: %d\n",appIdRegistry[j].appId);
init_api->RegisterAppId(&smtp_validate, appIdRegistry[j].appId, appIdRegistry[j].additionalInfo, NULL);
}
return CLIENT_APP_SUCCESS;
}
static int ExtractVersion(ClientSMTPData * const fd, const uint8_t *product,
const uint8_t *data, FLOW *flowp, const SFSnortPacket *pkt)
{
const u_int8_t *p;
u_int8_t *v;
u_int8_t *v_end;
unsigned len;
unsigned sublen;
v_end = fd->version;
v_end += MAX_VERSION_SIZE - 1;
len = data - product;
if (len >= sizeof(MICROSOFT) && memcmp(product, MICROSOFT, sizeof(MICROSOFT)-1) == 0)
{
p = product + sizeof(MICROSOFT) - 1;
if (data-p >= (int)sizeof(OUTLOOK) && memcmp(p, OUTLOOK, sizeof(OUTLOOK)-1) == 0)
{
p += sizeof(OUTLOOK) - 1;
if (p >= data) return 1;
if (*p == ',')
{
p++;
if (p >= data || *p != ' ') return 1;
p++;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_OUTLOOK, (char *)fd->version);
return 0;
}
else if (*p == ' ')
{
p++;
if (data-p >= (int)sizeof(EXPRESS) && memcmp(p, EXPRESS, sizeof(EXPRESS)-1) == 0)
{
p += sizeof(EXPRESS) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_OUTLOOK_EXPRESS, (char *)fd->version);
return 0;
}
else if (data-p >= (int)sizeof(IMO) && memcmp(p, IMO, sizeof(IMO)-1) == 0)
{
p += sizeof(IMO) - 1;
if (p >= data) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_OUTLOOK, (char *)fd->version);
return 0;
}
}
}
}
else if (len >= sizeof(APP_SMTP_EVOLUTION) && memcmp(product, APP_SMTP_EVOLUTION, sizeof(APP_SMTP_EVOLUTION)-1) == 0)
{
p = product + sizeof(APP_SMTP_EVOLUTION) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_EVOLUTION, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_LOTUSNOTES) && memcmp(product, APP_SMTP_LOTUSNOTES, sizeof(APP_SMTP_LOTUSNOTES)-1) == 0)
{
p = product + sizeof(APP_SMTP_LOTUSNOTES) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_LOTUS_NOTES, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_APPLEMAIL) && memcmp(product, APP_SMTP_APPLEMAIL, sizeof(APP_SMTP_APPLEMAIL)-1) == 0)
{
p = product + sizeof(APP_SMTP_APPLEMAIL) - 1;
if (p >= data || *(data - 1) != ')' || *p == ')' || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data-1; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_APPLE_EMAIL, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_EUDORA) && memcmp(product, APP_SMTP_EUDORA, sizeof(APP_SMTP_EUDORA)-1) == 0)
{
p = product + sizeof(APP_SMTP_EUDORA) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_EUDORA, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_EUDORAPRO) && memcmp(product, APP_SMTP_EUDORAPRO, sizeof(APP_SMTP_EUDORAPRO)-1) == 0)
{
p = product + sizeof(APP_SMTP_EUDORAPRO) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_EUDORA_PRO, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_AOL) && memcmp(product, APP_SMTP_AOL, sizeof(APP_SMTP_AOL)-1) == 0)
{
p = product + sizeof(APP_SMTP_AOL) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_AOL_EMAIL, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_MUTT) && memcmp(product, APP_SMTP_MUTT, sizeof(APP_SMTP_MUTT)-1) == 0)
{
p = product + sizeof(APP_SMTP_MUTT) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_MUTT, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_KMAIL) && memcmp(product, APP_SMTP_KMAIL, sizeof(APP_SMTP_KMAIL)-1) == 0)
{
p = product + sizeof(APP_SMTP_KMAIL) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_SMTP/*KMAIL_ID*/, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_THUNDERBIRD) && memcmp(product, APP_SMTP_THUNDERBIRD, sizeof(APP_SMTP_THUNDERBIRD)-1) == 0)
{
p = product + sizeof(APP_SMTP_THUNDERBIRD) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_THUNDERBIRD, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_MTHUNDERBIRD) && memcmp(product, APP_SMTP_MTHUNDERBIRD, sizeof(APP_SMTP_MTHUNDERBIRD)-1) == 0)
{
p = product + sizeof(APP_SMTP_MTHUNDERBIRD) - 1;
if (p >= data || isspace(*p)) return 1;
for (v=fd->version; v<v_end && p < data; v++,p++)
{
*v = *p;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_THUNDERBIRD, (char *)fd->version);
return 0;
}
else if (len >= sizeof(APP_SMTP_MOZILLA) && memcmp(product, APP_SMTP_MOZILLA, sizeof(APP_SMTP_MOZILLA)-1) == 0)
{
for (p = product + sizeof(APP_SMTP_MOZILLA) - 1; p < data; p++)
{
if (*p == 'T')
{
sublen = data - p;
if (sublen >= sizeof(APP_SMTP_THUNDERBIRD_SHORT) && memcmp(p, APP_SMTP_THUNDERBIRD_SHORT, sizeof(APP_SMTP_THUNDERBIRD_SHORT)-1) == 0)
{
p = p + sizeof(APP_SMTP_THUNDERBIRD_SHORT) - 1;
for (v=fd->version; v<v_end && p < data; p++)
{
if (*p == 0x0A || *p == 0x0D || !isprint(*p)) break;
*v = *p;
v++;
}
*v = 0;
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_THUNDERBIRD, (char *)fd->version);
return 0;
}
}
}
}
return 1;
}
static inline int CheckTag(const uint8_t *tag, const uint8_t *data)
{
#define XMAILER "X-Mailer"
#define USERAGENT "User-Agent"
unsigned len;
len = data - tag;
if (len >= sizeof(XMAILER)-1 && memcmp(tag, XMAILER, sizeof(XMAILER)-1) == 0)
return 0;
if (len >= sizeof(USERAGENT)-1 && memcmp(tag, USERAGENT, sizeof(USERAGENT)-1) == 0)
return 0;
return 1;
}
static CLIENT_APP_RETCODE smtp_validate(const uint8_t *data, uint16_t size, const int dir,
FLOW *flowp, const SFSnortPacket *pkt, struct _Detector *userData)
{
#define FIND_NEWLINE() \
{ \
while (data < end) \
{ \
if (*data == 0x0A) break; \
else if (*data == 0x0D) \
{ \
data++; \
if (data >= end || *data != 0x0A) goto done; \
break; \
} \
else if (!isprint(*data)) goto done; \
data++; \
} \
if (data >= end) goto done; \
data++; \
}
ClientSMTPData *fd;
const uint8_t *end;
const uint8_t *tag;
const uint8_t *product;
int rval;
unsigned len;
if (dir != APP_ID_FROM_INITIATOR)
return CLIENT_APP_INPROCESS;
fd = smtp_client_mod.api->data_get(flowp);
if (!fd)
{
fd = calloc(1, sizeof(*fd));
if (!fd)
return CLIENT_APP_ENOMEM;
if (smtp_client_mod.api->data_add(flowp, fd, &free))
{
free(fd);
return CLIENT_APP_ENOMEM;
}
fd->state = SMTP_STATE_HELO;
}
end = data + size;
while (data < end)
{
switch (fd->state)
{
case SMTP_STATE_HELO:
len = end - data;
if (len >= sizeof(HELO) && memcmp(HELO, data, sizeof(HELO)-1) == 0)
{
data += sizeof(HELO) - 1;
}
else if (len >= sizeof(EHLO) && memcmp(EHLO, data, sizeof(EHLO)-1) == 0)
{
data += sizeof(EHLO) - 1;
}
else goto done;
FIND_NEWLINE();
fd->state = SMTP_STATE_MAIL_FROM;
break;
case SMTP_STATE_MAIL_FROM:
if (end-data > (int)sizeof(MAILFROM) && memcmp(MAILFROM, data, sizeof(MAILFROM)-1) == 0)
{
data += sizeof(MAILFROM) - 1;
FIND_NEWLINE();
fd->state = SMTP_STATE_RCPT_TO;
}
else if (end-data > (int)sizeof(RSET) && memcmp(RSET, data, sizeof(RSET)-1) == 0)
{
data += sizeof(RSET) - 1;
if (*data != 0x0A)
{
if (*data != 0x0D) goto done;
data++;
if (data >= end || *data != 0x0A) goto done;
}
data++;
}
else goto done;
break;
case SMTP_STATE_RCPT_TO:
if (end-data < (int)sizeof(RCPTTO) || memcmp(RCPTTO, data, sizeof(RCPTTO)-1) != 0) goto done;
data += sizeof(RCPTTO) - 1;
FIND_NEWLINE();
fd->state = SMTP_STATE_DATA;
break;
case SMTP_STATE_DATA:
if (end-data > (int)sizeof(DATA) && memcmp(DATA, data, sizeof(DATA)-1) == 0)
{
data += sizeof(DATA) - 1;
if (*data != 0x0A)
{
if (*data != 0x0D) goto done;
data++;
if (data >= end || *data != 0x0A) goto done;
}
data++;
fd->state = SMTP_STATE_MESSAGE;
}
else
{
if (end-data < (int)sizeof(RCPTTO) || memcmp(RCPTTO, data, sizeof(RCPTTO)-1) != 0) goto done;
data += sizeof(RCPTTO) - 1;
FIND_NEWLINE();
}
break;
case SMTP_STATE_MESSAGE:
if (*data == '.')
{
len = end - data;
if ((len >= 1 && data[1] == 0x0A) ||
(len >= 2 && data[1] == 0x0D && data[2] == 0x0A))
{
smtp_client_mod.api->add_app(flowp, APP_ID_SMTP, APP_ID_SMTP, NULL);
goto done;
}
}
tag = data;
while (data < end)
{
if (*data == ':')
{
/* Must end with ': ' and have more on the line */
if (end-data < 3 || data[1] != ' ' || data[2] == 0x0D || data[2] == 0x0A || !isprint(data[2])) goto done;
break;
}
else if (*data == 0x0A) break;
else if (*data == 0x0D)
{
data++;
if (data >= end || *data != 0x0A) goto done;
break;
}
else if (!isprint(*data) && *data != 0x09) goto done;
data++;
}
if (data >= end) goto done;
if (*data == ':')
{
rval = CheckTag(tag, data);
data += 2;
if (rval == 0)
{
while (data < end)
{
if (*data != ' ') break;
data++;
}
if (data >= end) goto done;
product = data;
while (data < end)
{
if (*data == 0x0A) break;
else if (*data == 0x0D)
{
if (end - data < 2 || data[1] != 0x0A) goto done;
break;
}
else if (!isprint(*data)) goto done;
data++;
}
if (data >= end) goto done;
if (ExtractVersion(fd, product, data, flowp, pkt) == 0) goto done;
}
else FIND_NEWLINE();
}
else data++;
break;
default:
goto done;
}
}
return CLIENT_APP_INPROCESS;
done:
flow_mark(flowp, FLOW_CLIENTAPPDETECTED);
return CLIENT_APP_SUCCESS;
}
| kunschikov/snort | src/dynamic-preprocessors/appid/client_plugins/client_app_smtp.c | C | gpl-2.0 | 20,873 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
2325,
26408,
1998,
1013,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
2286,
3120,
10273,
1010,
4297,
1012,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
#include "Task.h"
namespace vlp {
class WaitTask : public Task {
public:
void run(Engine& engine) override;
};
} | jenningsm42/vulpan | vulpan/include/WaitTask.h | C | mit | 131 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1000,
4708,
1012,
1044,
1000,
3415,
15327,
1058,
14277,
1063,
2465,
3524,
10230,
2243,
1024,
2270,
4708,
1063,
2270,
1024,
11675,
2448,
1006,
3194,
1004,
3194,
1007,
2058,
15637,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***************************************************************************
* Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "app_type.h"
#include "compiler.h"
#include "vsfhal.h"
#if VSFHAL_USART_EN
#include "core.h"
#include "NUC505Series.h"
#define UART_IS_RX_READY(uart) ((uart->FIFOSTS & UART_FIFOSTS_RXEMPTY_Msk) >> UART_FIFOSTS_RXEMPTY_Pos)
#define UART_IS_TX_EMPTY(uart) ((uart->FIFOSTS & UART_FIFOSTS_TXEMPTYF_Msk) >> UART_FIFOSTS_TXEMPTYF_Pos)
#define UART_IS_TX_FIFO_FULL(uart) ((uart->FIFOSTS & UART_FIFOSTS_TXFULL_Msk) >> UART_FIFOSTS_TXFULL_Pos)
static void (*nuc505_usart_ontx[USART_NUM])(void *);
static void (*nuc505_usart_onrx[USART_NUM])(void *, uint16_t data);
static void *nuc505_usart_callback_param[USART_NUM];
vsf_err_t nuc505_usart_init(uint8_t index)
{
uint8_t usart_idx = index & 0x0F;
uint8_t remap_idx = (index >> 4) & 0x0F;
switch (usart_idx)
{
#if USART00_ENABLE
case 0:
switch (remap_idx)
{
case 0:
#if USART00_TX_ENABLE
SYS->GPB_MFPL &= ~(SYS_GPB_MFPL_PB0MFP_Msk);
SYS->GPB_MFPL |= 3 << SYS_GPB_MFPL_PB0MFP_Pos;
#endif
#if USART00_RX_ENABLE
SYS->GPB_MFPL &= ~(SYS_GPB_MFPL_PB1MFP_Msk);
SYS->GPB_MFPL |= 3 << SYS_GPB_MFPL_PB1MFP_Pos;
#endif
break;
default:
return VSFERR_NOT_SUPPORT;
}
CLK->CLKDIV3 &= ~(CLK_CLKDIV3_UART0SEL_Msk | CLK_CLKDIV3_UART0DIV_Msk);
CLK->APBCLK |= CLK_APBCLK_UART0CKEN_Msk;
SYS->IPRST1 |= SYS_IPRST1_UART0RST_Msk;
SYS->IPRST1 &= ~SYS_IPRST1_UART0RST_Msk;
break;
#endif // USART00_ENABLE
#if USART01_ENABLE || USART11_ENABLE
case 1:
switch (remap_idx)
{
#if USART01_ENABLE
case 0:
#if USART01_TX_ENABLE
SYS->GPA_MFPH &= ~(SYS_GPA_MFPH_PA8MFP_Msk);
SYS->GPA_MFPH |= 3 << SYS_GPA_MFPH_PA8MFP_Pos;
#endif
#if USART01_RX_ENABLE
SYS->GPA_MFPH &= ~(SYS_GPA_MFPH_PA9MFP_Msk);
SYS->GPA_MFPH |= 3 << SYS_GPA_MFPH_PA9MFP_Pos;
#endif
break;
#endif // USART01_ENABLE
#if USART11_ENABLE
case 0:
#if USART11_CTS_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB8MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB8MFP_Pos;
#endif
#if USART11_RTS_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB8MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB8MFP_Pos;
#endif
#if USART11_TX_ENABLE
SYS->GPB_MFPL &= ~(SYS_GPB_MFPL_PB6MFP_Msk);
SYS->GPB_MFPL |= 3 << SYS_GPB_MFPL_PB6MFP_Pos;
#endif
#if USART11_RX_ENABLE
SYS->GPB_MFPL &= ~(SYS_GPB_MFPL_PB7MFP_Msk);
SYS->GPB_MFPL |= 3 << SYS_GPB_MFPL_PB7MFP_Msk;
#endif
break;
#endif // USART11_ENABLE
default:
return VSFERR_NOT_SUPPORT;
}
CLK->CLKDIV3 &= ~(CLK_CLKDIV3_UART1SEL_Msk | CLK_CLKDIV3_UART1DIV_Msk);
CLK->APBCLK |= CLK_APBCLK_UART1CKEN_Msk;
SYS->IPRST1 |= SYS_IPRST1_UART1RST_Msk;
SYS->IPRST1 &= ~SYS_IPRST1_UART1RST_Msk;
break;
#endif // USART01_ENABLE || USART11_ENABLE
#if USART02_ENABLE
case 2:
switch (remap_idx)
{
case 0:
#if USART02_CTS_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB12MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB12MFP_Pos;
#endif
#if USART02_RTS_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB13MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB13MFP_Pos;
#endif
#if USART02_TX_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB10MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB10MFP_Pos;
#endif
#if USART02_RX_ENABLE
SYS->GPB_MFPH &= ~(SYS_GPB_MFPH_PB11MFP_Msk);
SYS->GPB_MFPH |= 3 << SYS_GPB_MFPH_PB11MFP_Pos;
#endif
break;
default:
return VSFERR_NOT_SUPPORT;
}
CLK->CLKDIV3 &= ~(CLK_CLKDIV3_UART2SEL_Msk | CLK_CLKDIV3_UART2DIV_Msk);
CLK->APBCLK |= CLK_APBCLK_UART2CKEN_Msk;
SYS->IPRST1 |= SYS_IPRST1_UART2RST_Msk;
SYS->IPRST1 &= ~SYS_IPRST1_UART2RST_Msk;
break;
#endif // USART02_ENABLE
default:
return VSFERR_NOT_SUPPORT;
}
return VSFERR_NONE;
}
vsf_err_t nuc505_usart_fini(uint8_t index)
{
uint8_t usart_idx = index & 0x0F;
switch (usart_idx)
{
#if USART00_ENABLE
case 0:
CLK->APBCLK &= ~CLK_APBCLK_UART0CKEN_Msk;
break;
#endif // USART00_ENABLE
#if USART01_ENABLE || USART11_ENABLE
case 1:
CLK->APBCLK &= ~CLK_APBCLK_UART1CKEN_Msk;
break;
#endif // USART01_ENABLE || USART11_ENABLE
#if USART02_ENABLE
case 2:
CLK->APBCLK &= ~CLK_APBCLK_UART2CKEN_Msk;
break;
#endif // USART02_ENABLE
default:
return VSFERR_NOT_SUPPORT;
}
return VSFERR_NONE;
}
vsf_err_t nuc505_usart_config(uint8_t index, uint32_t baudrate, uint32_t mode)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F;
struct nuc505_info_t *info;
uint32_t baud_div = 0, reg_line = 0;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
/* switch (datalength)
{
case 5:
reg_line = 0;
break;
case 6:
reg_line = 1;
break;
case 7:
reg_line = 2;
break;
case 8:
reg_line = 3;
break;
default:
return VSFERR_INVALID_PARAMETER;
}
*/
// mode:
// bit0 - bit1: parity
// ------------------------------------- bit2 - bit3: mode [nothing]
// bit4 : stopbits
reg_line |= (mode << 3) & 0x18; //parity
reg_line |= (mode >> 2) & 0x04; //stopbits
usart->FUNCSEL = 0;
usart->LINE = reg_line;
usart->FIFO = 0x5ul << 4; // 46/14 (64/16)
usart->TOUT = 60;
if (nuc505_get_info(&info))
{
return VSFERR_FAIL;
}
if(baudrate != 0)
{
int32_t error;
baud_div = info->osc_freq_hz / baudrate;
if ((baud_div < 11) || (baud_div > (0xffff + 2)))
return VSFERR_INVALID_PARAMETER;
error = (info->osc_freq_hz / baud_div) * 1000 / baudrate;
error -= 1000;
if ((error > 20) || ((error < -20)))
return VSFERR_INVALID_PARAMETER;
if (info->osc_freq_hz * 1000 / baud_div / baudrate)
usart->BAUD = UART_BAUD_BAUDM0_Msk | UART_BAUD_BAUDM1_Msk |
(baud_div - 2);
}
switch (usart_idx)
{
#if USART0_INT_EN
case 0:
usart->INTEN = UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk |
UART_INTEN_TOCNTEN_Msk;
NVIC_EnableIRQ(UART0_IRQn);
break;
#endif
#if USART1_INT_EN
case 1:
usart->INTEN = UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk |
UART_INTEN_TOCNTEN_Msk;
NVIC_EnableIRQ(UART1_IRQn);
break;
#endif
#if USART2_INT_EN
case 2:
usart->INTEN = UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk |
UART_INTEN_TOCNTEN_Msk;
NVIC_EnableIRQ(UART2_IRQn);
break;
#endif
default:
break;
}
return VSFERR_NONE;
}
vsf_err_t nuc505_usart_config_cb(uint8_t index, uint32_t int_priority,
void *p, void (*ontx)(void *), void (*onrx)(void *, uint16_t))
{
uint32_t usart_idx = index & 0x0F;
nuc505_usart_ontx[usart_idx] = ontx;
nuc505_usart_onrx[usart_idx] = onrx;
nuc505_usart_callback_param[usart_idx] = p;
return VSFERR_NONE;
}
vsf_err_t nuc505_usart_tx(uint8_t index, uint16_t data)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
usart->DAT = (uint8_t)data;
usart->INTEN |= UART_INTEN_THREIEN_Msk;
return VSFERR_NONE;
}
uint16_t nuc505_usart_rx(uint8_t index)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
return usart->DAT;
}
uint16_t nuc505_usart_tx_bytes(uint8_t index, uint8_t *data, uint16_t size)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F;
uint16_t i;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
for (i = 0; i < size; i++)
{
usart->DAT = data[i];
}
usart->INTEN |= UART_INTEN_THREIEN_Msk;
return 0;
}
uint16_t nuc505_usart_tx_get_free_size(uint8_t index)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F, fifo_len;
fifo_len = usart_idx ? 64 : 16;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
if (usart->FIFOSTS & UART_FIFOSTS_TXFULL_Msk)
{
return 0;
}
else
{
return fifo_len - ((usart->FIFOSTS & UART_FIFOSTS_TXPTR_Msk) >>
UART_FIFOSTS_TXPTR_Pos);
}
}
uint16_t nuc505_usart_rx_bytes(uint8_t index, uint8_t *data, uint16_t size)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F;
uint16_t i;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
for (i = 0; i < size; i++)
{
if (usart->FIFOSTS & (UART_FIFOSTS_RXFULL_Msk | UART_FIFOSTS_RXPTR_Msk))
{
data[i] = usart->DAT;
}
else
{
break;
}
}
return i;
}
uint16_t nuc505_usart_rx_get_data_size(uint8_t index)
{
UART_T *usart;
uint32_t usart_idx = index & 0x0F, fifo_len;
fifo_len = usart_idx ? 64 : 16;
usart = (UART_T *)(UART0_BASE + (usart_idx << 12));
if (usart->FIFOSTS & UART_FIFOSTS_RXFULL_Msk)
{
return fifo_len;
}
else
{
return (usart->FIFOSTS & UART_FIFOSTS_RXPTR_Msk) >>
UART_FIFOSTS_RXPTR_Pos;
}
}
#if USART0_INT_EN && USART00_ENABLE
ROOTFUNC void UART0_IRQHandler(void)
{
if (UART0->INTSTS & UART_INTSTS_RDAIF_Msk)
{
nuc505_usart_onrx[0](nuc505_usart_callback_param[0], UART0->DAT);
}
else if (UART0->INTSTS & UART_INTSTS_RXTOINT_Msk)
{
nuc505_usart_onrx[0](nuc505_usart_callback_param[0], UART0->DAT);
}
if (UART0->INTSTS & UART_INTSTS_THREINT_Msk)
{
UART0->INTEN &= (~UART_INTEN_THREIEN_Msk);
nuc505_usart_ontx[0](nuc505_usart_callback_param[0]);
}
}
#endif // USART0_INT_EN && USART00_ENABLE
#if USART1_INT_EN && (USART01_ENABLE || USART11_ENABLE)
ROOTFUNC void UART1_IRQHandler(void)
{
if (UART1->INTSTS & UART_INTSTS_RDAIF_Msk)
{
nuc505_usart_onrx[1](nuc505_usart_callback_param[1], UART1->DAT);
}
else if (UART1->INTSTS & UART_INTSTS_RXTOINT_Msk)
{
nuc505_usart_onrx[1](nuc505_usart_callback_param[1], UART1->DAT);
}
if (UART1->INTSTS & UART_INTSTS_THREINT_Msk)
{
UART1->INTEN &= (~UART_INTEN_THREIEN_Msk);
nuc505_usart_ontx[1](nuc505_usart_callback_param[1]);
}
}
#endif // USART1_INT_EN && (USART01_ENABLE || USART11_ENABLE)
#if USART2_INT_EN && USART02_ENABLE
ROOTFUNC void UART2_IRQHandler(void)
{
if (UART2->INTSTS & UART_INTSTS_RDAIF_Msk)
{
nuc505_usart_onrx[2](nuc505_usart_callback_param[2], UART2->DAT);
}
else if (UART2->INTSTS & UART_INTSTS_RXTOINT_Msk)
{
nuc505_usart_onrx[2](nuc505_usart_callback_param[2], UART2->DAT);
}
if (UART2->INTSTS & UART_INTSTS_THREINT_Msk)
{
UART2->INTEN &= (~UART_INTEN_THREIEN_Msk);
nuc505_usart_ontx[2](nuc505_usart_callback_param[2]);
}
}
#endif // USART2_INT_EN && USART02_ENABLE
#endif
| versaloon/vsf | vsf/hal/cpu/nuc505/uart/NUC505_USART.c | C | gpl-3.0 | 11,725 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (c) 2014 - 2022 Frank Appel
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Frank Appel - initial API and implementation
*/
package com.codeaffine.eclipse.swt.util;
import org.eclipse.swt.widgets.Display;
public class ActionScheduler {
private final Display display;
private final Runnable action;
public ActionScheduler( Display display, Runnable action ) {
this.display = display;
this.action = action;
}
public void schedule( int delay ) {
display.timerExec( delay, action );
}
}
| fappel/xiliary | com.codeaffine.eclipse.swt/src/com/codeaffine/eclipse/swt/util/ActionScheduler.java | Java | epl-1.0 | 753 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
16798,
2475,
3581,
10439,
2884,
1008,
2035,
2916,
9235,
1012,
2023,
2565,
1998,
1996,
10860,
4475,
1008,
2024,
2081,
2800,
2104,
1996,
3408,
1997,
1996,
13232,
2270,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html class="no-js" ng-app="ngMailCreator">
<head>
<meta charset="utf-8">
<title>frontend</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:css({.tmp,app}) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
<!-- build:js scripts/modernizr.js -->
<script src="bower_components/modernizr/modernizr.js"></script>
<!-- endbuild -->
</head>
<body>
<!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- <div class="off-canvas-wrap">
<a class="left-off-canvas-toggle" href="#"><i class="fa fa-cog"></i></a>
<div ui-view="content" class="inner-wrap"></div>
<aside ui-view="left-nav" class="left-off-canvas-menu"></aside>
</div> -->
<div class="off-canvas-wrap" ui-view="main"></div>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X');ga('send','pageview');
</script>
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="bower_components/angular-foundation/mm-foundation-tpls.js"></script>
<!-- endbower -->
<script src="scripts/modules/ngDraggable.js"></script>
<!-- endbuild -->
<!-- build:js({app,.tmp}) scripts/main.js -->
<script src="scripts/ngMailCreator.js"></script>
<script src="scripts/controllers/main-ctrl.js"></script>
<!-- inject:partials -->
<!-- endinject -->
<!-- endbuild -->
</body>
</html>
| MBing/ngMailCreator | app/index.html | HTML | mit | 2,843 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
2465,
1027,
1000,
2053,
1011,
1046,
2015,
1000,
12835,
1011,
10439,
1027,
1000,
12835,
21397,
16748,
8844,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/perl
use subs;
use strict;
use warnings;
use IO::Handle;
use Time::HiRes qw(tv_interval gettimeofday);
# test.pl
#
# runs a test and check its output
sub run($$$) {
my ($input, $options, $output) = @_;
my $extraopts = $ENV{'ESBMC_TEST_EXTRA_ARGS'};
$extraopts = "" unless defined($extraopts);
my $cmd = "esbmc $extraopts $options $input >$output 2>&1";
print LOG "Running $cmd\n";
my $tv = [gettimeofday()];
system $cmd;
my $elapsed = tv_interval($tv);
my $exit_value = $? >> 8;
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
my $failed = 0;
print LOG " Exit: $exit_value\n";
print LOG " Signal: $signal_num\n";
print LOG " Core: $dumped_core\n";
if($signal_num != 0) {
$failed = 1;
print "Killed by signal $signal_num";
if($dumped_core) {
print " (code dumped)";
}
}
if ($signal_num == 2) {
# Interrupted by ^C: we should exit too
print "Halting tests on interrupt";
exit 1;
}
system "echo EXIT=$exit_value >>$output";
system "echo SIGNAL=$signal_num >>$output";
return ($failed, $elapsed);
}
sub load($) {
my ($fname) = @_;
open FILE, "<$fname";
my @data = <FILE>;
close FILE;
chomp @data;
return @data;
}
sub test($$) {
my ($name, $test) = @_;
my ($input, $options, @results) = load($test);
my $output = $input;
$output =~ s/\.cu$/.out/;
$output =~ s/\.cpp$/.out/;
if($output eq $input) {
print("Error in test file -- $test\n");
return 1;
}
print LOG "Test '$name'\n";
print LOG " Input: $input\n";
print LOG " Output: $output\n";
print LOG " Options: $options\n";
print LOG " Results:\n";
foreach my $result (@results) {
print LOG " $result\n";
}
my ($failed, $elapsed);
($failed, $elapsed) = run($input, $options, $output);
if(!$failed) {
print LOG "Execution [OK]\n";
my $included = 1;
foreach my $result (@results) {
if($result eq "--") {
$included = !$included;
} else {
my $r;
system "grep '$result' '$output' >/dev/null";
$r = ($included ? $? != 0 : $? == 0);
if($r) {
print LOG "$result [FAILED]\n";
$failed = 1;
} else {
print LOG "$result [OK]\n";
}
}
}
} else {
print LOG "Execution [FAILED]\n";
}
print LOG "\n";
return ($failed, $elapsed, $output, @results);
}
sub dirs() {
my @list;
opendir CWD, ".";
@list = grep { !/^\./ && -d "$_" && !/CVS/ } readdir CWD;
closedir CWD;
@list = sort @list;
return @list;
}
if(@ARGV != 0) {
print "Usage:\n";
print " test.pl\n";
exit 1;
}
open LOG,">tests.log";
print "Loading\n";
my @tests = dirs();
my $count = @tests;
if($count == 1) {
print " $count test found\n";
} else {
print " $count tests found\n";
}
print "\n";
my $failures = 0;
my $xmloutput = "";
my $timeaccuml = 0.0;
print "Running tests\n";
foreach my $test (@tests) {
print " Running $test";
chdir $test;
my ($failed, $elapsed, $outputfile, @resultrexps) = test($test, "test.desc");
$timeaccuml += $elapsed;
chdir "..";
$xmloutput = $xmloutput . "<testcase name=\"$test\" time=\"$elapsed\"";
if($failed) {
$failures++;
print " [FAILED]\n";
$xmloutput = $xmloutput . ">\n";
$xmloutput = $xmloutput . " <failure message=\"Test regexes \'@resultrexps\' failed\" type=\"nodescript failure\">\n";
open(LOGFILE, "<$test/$outputfile") or die "Can't open outputfile $test/$outputfile";
while (<LOGFILE>) {
my $lump;
$lump = $_;
$lump =~ s/\&/\&/gm;
$lump =~ s/"/\"/gm;
$lump =~ s/</\</gm;
$lump =~ s/>/\>/gm;
$xmloutput = $xmloutput . $lump;
}
close(LOGFILE);
$xmloutput = $xmloutput . "</failure>\n</testcase>";
} else {
print " [OK]\n";
$xmloutput = $xmloutput . "/>\n";
}
}
print "\n";
my $io = IO::Handle->new();
if ($io->fdopen(3, "w")) {
print $io "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<testsuite failures=\"$failures\" hostname=\"pony.ecs.soton.ac.uk\" name=\"ESBMC single threaded regression tests\" tests=\"$count\" time=\"$timeaccuml\">\n";
print $io $xmloutput;
print $io "</testsuite>";
}
if($failures == 0) {
print "All tests were successful\n";
} else {
print "Tests failed\n";
if($failures == 1) {
print " $failures of $count test failed\n";
} else {
print " $failures of $count tests failed\n";
}
}
close LOG;
exit $failures;
| ssvlab/esbmc-gpu | regression/cuda/gpu_verify/structs/test.pl | Perl | apache-2.0 | 4,401 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
2566,
2140,
2224,
4942,
2015,
1025,
2224,
9384,
1025,
2224,
16234,
1025,
2224,
22834,
1024,
1024,
5047,
1025,
2224,
2051,
1024,
1024,
28208,
1053,
2860,
1006,
2694,
1035,
13483,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/// <reference path='fourslash.ts' />
// Exercises completions for hidden files (ie: those beginning with '.')
// @Filename: f.ts
//// /*f1*/
// @Filename: d1/g.ts
//// /*g1*/
// @Filename: d1/d2/h.ts
//// /*h1*/
// @Filename: d1/d2/d3/i.ts
//// /// <reference path=".\..\..\/*28*/
// @Filename: test.ts
//// /// <reference path="/*0*/
//// /// <reference path=".//*1*/
//// /// <reference path=".\/*2*/
//// /// <reference path="[|./*3*/|]
//// /// <reference path="d1//*4*/
//// /// <reference path="d1/.//*5*/
//// /// <reference path="d1/.\/*6*/
//// /// <reference path="d1/[|./*7*/|]
//// /// <reference path="d1\/*8*/
//// /// <reference path="d1\.//*9*/
//// /// <reference path="d1\.\/*10*/
//// /// <reference path="d1\[|./*11*/|]
//// /// <reference path="d1/d2//*12*/
//// /// <reference path="d1/d2/.//*13*/
//// /// <reference path="d1/d2/.\/*14*/
//// /// <reference path="d1/d2/[|./*15*/|]
//// /// <reference path="d1/d2\/*16*/
//// /// <reference path="d1/d2\.//*17*/
//// /// <reference path="d1/d2\.\/*18*/
//// /// <reference path="d1/d2\[|./*19*/|]
//// /// <reference path="d1\d2//*20*/
//// /// <reference path="d1\d2/.//*21*/
//// /// <reference path="d1\d2/.\/*22*/
//// /// <reference path="d1\d2/[|./*23*/|]
//// /// <reference path="d1\d2\/*24*/
//// /// <reference path="d1\d2\.//*25*/
//// /// <reference path="d1\d2\.\/*26*/
//// /// <reference path="d1\d2\[|./*27*/|]
testBlock(0, 'f.ts', "d1");
testBlock(4, 'g.ts', "d2");
testBlock(8, 'g.ts', "d2");
testBlock(12, 'h.ts', "d3");
testBlock(16, 'h.ts', "d3");
testBlock(20, 'h.ts', "d3");
testBlock(24, 'h.ts', "d3");
verify.completions({ marker: "28", exact: ["g.ts", "d2"], isNewIdentifierLocation: true });
function testBlock(offset: number, fileName: string, dir: string) {
const names = [fileName, dir];
verify.completions(
{
marker: [offset, offset + 1, offset + 2].map(String),
exact: names,
isNewIdentifierLocation: true,
},
{
marker: String(offset + 3),
exact: names.map(name => ({ name, replacementSpan: test.ranges()[offset / 4] })),
isNewIdentifierLocation: true,
});
}
| weswigham/TypeScript | tests/cases/fourslash/tripleSlashRefPathCompletionBackandForwardSlash.ts | TypeScript | apache-2.0 | 2,191 | [
30522,
1013,
1013,
1013,
1026,
4431,
4130,
1027,
1005,
23817,
27067,
1012,
24529,
1005,
1013,
1028,
1013,
1013,
11110,
6503,
2015,
2005,
5023,
6764,
1006,
29464,
1024,
2216,
2927,
2007,
1005,
1012,
1005,
1007,
1013,
1013,
1030,
5371,
18442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
*
* @author j
* Date: 12/22/14
* Time: 3:44 PM
*
* File: abstractdatabase.class.php
*/
namespace chilimatic\lib\database;
use chilimatic\lib\database\connection\IDatabaseConnection;
/**
* Class AbstractDatabase
*
* @package chilimatic\lib\database
*/
abstract class AbstractDatabase implements DatabaseInterface
{
/**
* @param IDatabaseConnection $masterConnection
* @param IDatabaseConnection $slaveConnection
*/
abstract public function __construct(IDatabaseConnection $masterConnection, IDatabaseConnection $slaveConnection = null);
/**
* @param string $query
*
* @return mixed
*/
abstract public function query($query);
/**
* @return mixed
*/
abstract public function lastQuery();
/**
* @param string $query
*
* @return mixed
*/
abstract public function execute($query);
/**
* @return mixed
*/
abstract public function prepare();
} | chilimatic/chilimatic-framework | lib/database/AbstractDatabase.php | PHP | mit | 977 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1008,
1030,
3166,
1046,
1008,
3058,
1024,
2260,
1013,
2570,
1013,
2403,
1008,
2051,
1024,
1017,
1024,
4008,
7610,
1008,
1008,
5371,
1024,
10061,
2850,
2696,
15058,
1012,
2465,
1012,
25718,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Hieracium pallidum subsp. pallidum SUBSPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Hieracium/ Syn. Hieracium pallidum pallidum/README.md | Markdown | apache-2.0 | 194 | [
30522,
1001,
7632,
6906,
6895,
2819,
14412,
21273,
2819,
24807,
1012,
14412,
21273,
2819,
11056,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package Koha::Club::Enrollment::Field;
# Copyright ByWater Solutions 2014
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Enrollment::Field
Represents a "pattern" on which many clubs can be created.
In this way we can directly compare different clubs of the same 'template'
for statistical purposes.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubEnrollmentField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;
| joubu/Koha | Koha/Club/Enrollment/Field.pm | Perl | gpl-3.0 | 1,244 | [
30522,
7427,
12849,
3270,
1024,
1024,
2252,
1024,
1024,
10316,
1024,
1024,
2492,
1025,
1001,
9385,
2011,
5880,
7300,
2297,
1001,
1001,
2023,
5371,
2003,
2112,
1997,
12849,
3270,
1012,
1001,
1001,
12849,
3270,
2003,
2489,
4007,
1025,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import * as t from "babel-types";
import * as util from "./util";
// this function converts a shorthand object generator method into a normal
// (non-shorthand) object property which is a generator function expression. for
// example, this:
//
// var foo = {
// *bar(baz) { return 5; }
// }
//
// should be replaced with:
//
// var foo = {
// bar: function*(baz) { return 5; }
// }
//
// to do this, it clones the parameter array and the body of the object generator
// method into a new FunctionExpression.
//
// this method can be passed any Function AST node path, and it will return
// either:
// a) the path that was passed in (iff the path did not need to be replaced) or
// b) the path of the new FunctionExpression that was created as a replacement
// (iff the path did need to be replaced)
//
// In either case, though, the caller can count on the fact that the return value
// is a Function AST node path.
//
// If this function is called with an AST node path that is not a Function (or with an
// argument that isn't an AST node path), it will throw an error.
export default function replaceShorthandObjectMethod(path) {
if (!path.node || !t.isFunction(path.node)) {
throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.");
}
// this function only replaces shorthand object methods (called ObjectMethod
// in Babel-speak).
if (!t.isObjectMethod(path.node)) {
return path;
}
// this function only replaces generators.
if (!path.node.generator) {
return path;
}
const parameters = path.node.params.map(function (param) {
return t.cloneDeep(param);
})
const functionExpression = t.functionExpression(
null, // id
parameters, // params
t.cloneDeep(path.node.body), // body
path.node.generator,
path.node.async
);
util.replaceWithOrRemove(path,
t.objectProperty(
t.cloneDeep(path.node.key), // key
functionExpression, //value
path.node.computed, // computed
false // shorthand
)
);
// path now refers to the ObjectProperty AST node path, but we want to return a
// Function AST node path for the function expression we created. we know that
// the FunctionExpression we just created is the value of the ObjectProperty,
// so return the "value" path off of this path.
return path.get("value");
}
| hellokidder/js-studying | 微信小程序/wxtest/node_modules/regenerator-transform/src/replaceShorthandObjectMethod.js | JavaScript | mit | 2,374 | [
30522,
12324,
1008,
2004,
1056,
2013,
1000,
11561,
2140,
1011,
4127,
1000,
1025,
12324,
1008,
2004,
21183,
4014,
2013,
1000,
1012,
1013,
21183,
4014,
1000,
1025,
1013,
1013,
2023,
3853,
19884,
1037,
2460,
11774,
4874,
13103,
4118,
2046,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.harmony.beans.tests.support.mock;
public class MockNullSubClass extends MockNullSuperClass{
}
| skyHALud/codenameone | Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java | Java | gpl-2.0 | 943 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2009-2022 Contributors (see credits.txt)
*
* This file is part of jEveAssets.
*
* jEveAssets is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* jEveAssets is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with jEveAssets; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
package net.nikr.eve.jeveasset.i18n;
import java.util.Locale;
import uk.me.candle.translations.conf.DefaultBundleConfiguration;
import uk.me.candle.translations.service.BasicBundleService;
import uk.me.candle.translations.service.BundleService;
public class BundleServiceFactory {
private static BundleService bundleService;
public static BundleService getBundleService() {
//XXX - Workaround for default language
if (bundleService == null) {
bundleService = new BasicBundleService(new DefaultBundleConfiguration(), Locale.ENGLISH);
}
return bundleService;
}
}
| GoldenGnu/jeveassets | src/main/java/net/nikr/eve/jeveasset/i18n/BundleServiceFactory.java | Java | gpl-2.0 | 1,439 | [
30522,
1013,
1008,
1008,
9385,
2268,
1011,
16798,
2475,
16884,
1006,
2156,
6495,
1012,
19067,
2102,
1007,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
15333,
3726,
27241,
3215,
1012,
1008,
1008,
15333,
3726,
27241,
3215,
2003,
2489,
4007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Styling for DataTables with Semantic UI
*/
table.dataTable.table {
margin: 0;
}
table.dataTable.table thead th,
table.dataTable.table thead td {
position: relative;
}
table.dataTable.table thead th.sorting, table.dataTable.table thead th.sorting_asc, table.dataTable.table thead th.sorting_desc,
table.dataTable.table thead td.sorting,
table.dataTable.table thead td.sorting_asc,
table.dataTable.table thead td.sorting_desc {
padding-right: 20px;
}
table.dataTable.table thead th.sorting:after, table.dataTable.table thead th.sorting_asc:after, table.dataTable.table thead th.sorting_desc:after,
table.dataTable.table thead td.sorting:after,
table.dataTable.table thead td.sorting_asc:after,
table.dataTable.table thead td.sorting_desc:after {
position: absolute;
top: 12px;
right: 8px;
display: block;
font-family: Icons;
}
table.dataTable.table thead th.sorting:after,
table.dataTable.table thead td.sorting:after {
content: "\f0dc";
color: #ddd;
font-size: 0.8em;
}
table.dataTable.table thead th.sorting_asc:after,
table.dataTable.table thead td.sorting_asc:after {
content: "\f0de";
}
table.dataTable.table thead th.sorting_desc:after,
table.dataTable.table thead td.sorting_desc:after {
content: "\f0dd";
}
table.dataTable.table td,
table.dataTable.table th {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
table.dataTable.table td.dataTables_empty,
table.dataTable.table th.dataTables_empty {
text-align: center;
}
table.dataTable.table.nowrap th,
table.dataTable.table.nowrap td {
white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_length select {
vertical-align: middle;
min-height: 2.7142em;
}
div.dataTables_wrapper div.dataTables_length .ui.selection.dropdown {
min-width: 0;
}
div.dataTables_wrapper div.dataTables_filter input {
margin-left: 0.5em;
}
div.dataTables_wrapper div.dataTables_info {
padding-top: 13px;
white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 200px;
margin-left: -100px;
text-align: center;
}
div.dataTables_wrapper div.row.dt-table {
padding: 0;
}
div.dataTables_wrapper div.dataTables_scrollHead table.dataTable {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom: none;
}
div.dataTables_wrapper div.dataTables_scrollBody thead .sorting:after,
div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_asc:after,
div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_desc:after {
display: none;
}
div.dataTables_wrapper div.dataTables_scrollBody table.dataTable {
border-radius: 0;
border-top: none;
border-bottom-width: 0;
}
div.dataTables_wrapper div.dataTables_scrollBody table.dataTable.no-footer {
border-bottom-width: 1px;
}
div.dataTables_wrapper div.dataTables_scrollFoot table.dataTable {
border-top-right-radius: 0;
border-top-left-radius: 0;
border-top: none;
}
| Xero-Hige/chimecho | src/static/vendor/datatables/css/dataTables.semanticui.css | CSS | gpl-3.0 | 3,072 | [
30522,
1013,
1008,
1008,
20724,
2005,
2951,
10880,
2015,
2007,
21641,
21318,
1008,
1013,
2795,
1012,
2951,
10880,
1012,
2795,
1063,
7785,
1024,
1014,
1025,
1065,
2795,
1012,
2951,
10880,
1012,
2795,
1996,
4215,
16215,
1010,
2795,
1012,
2951... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const mockMark = jest.fn();
const mockUnmark = jest.fn();
jest.mock('mark.js', () => () => ({
mark: mockMark,
unmark: mockUnmark,
}));
import { MarkerService } from '../MarkerService';
describe('Marker service', () => {
let marker: MarkerService;
const element = document.createElement('span');
beforeEach(() => {
marker = new MarkerService();
mockMark.mockClear();
mockUnmark.mockClear();
});
test('add element to Map', () => {
marker.add(element);
expect(marker.map.size).toBeGreaterThan(0);
});
test('delete element from Map', () => {
marker.add(element);
marker.delete(element);
expect(marker.map.size).toEqual(0);
});
test('addOnly: should unmark and remove old elements', () => {
const e1 = document.createElement('span');
const e2 = document.createElement('span');
const e3 = document.createElement('span');
marker.add(e1);
marker.add(e2);
marker.addOnly([element, e2, e3]);
expect(mockUnmark).toHaveBeenCalledTimes(1);
expect(marker.map.size).toEqual(3);
});
test('unmark: should unmark all elements', () => {
const e1 = document.createElement('span');
const e2 = document.createElement('span');
marker.add(e1);
marker.add(e2);
marker.add(element);
marker.unmark();
expect(mockUnmark).toHaveBeenCalledTimes(3);
expect(mockMark).not.toHaveBeenCalled();
});
test('clearAll: should unmark and remove all elements', () => {
const e1 = document.createElement('span');
const e2 = document.createElement('span');
marker.add(e1);
marker.add(e2);
marker.add(element);
marker.clearAll();
expect(mockUnmark).toHaveBeenCalledTimes(3);
expect(mockMark).not.toHaveBeenCalled();
expect(marker.map.size).toEqual(0);
});
test('mark: should unmark and mark again each element', () => {
const e1 = document.createElement('span');
const e2 = document.createElement('span');
marker.add(e1);
marker.add(e2);
marker.add(element);
marker.mark('test');
expect(mockUnmark).toHaveBeenCalledTimes(3);
expect(mockMark).toHaveBeenCalledTimes(3);
expect(mockMark).toHaveBeenCalledWith('test');
expect(marker.map.size).toEqual(3);
});
test('mark: should do nothing if no term provided', () => {
marker.add(element);
marker.mark();
expect(mockMark).not.toHaveBeenCalled();
});
test('mark: should save previous marked term and use it if no term is provided', () => {
marker.add(element);
marker.mark('test');
marker.mark();
expect(mockMark).toHaveBeenLastCalledWith('test');
});
});
| Rebilly/ReDoc | src/services/__tests__/MarkerService.test.ts | TypeScript | mit | 2,623 | [
30522,
9530,
3367,
12934,
10665,
1027,
15333,
3367,
1012,
1042,
2078,
1006,
1007,
1025,
9530,
3367,
12934,
4609,
10665,
1027,
15333,
3367,
1012,
1042,
2078,
1006,
1007,
1025,
15333,
3367,
1012,
12934,
1006,
1005,
2928,
1012,
1046,
2015,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const React = require('react');
const { ViewPropTypes } = ReactNative = require('react-native');
const {
View,
Animated,
StyleSheet,
ScrollView,
Text,
Platform,
Dimensions,
I18nManager
} = ReactNative;
const Button = require('./Button');
//import { PropTypes } from 'react'
const WINDOW_WIDTH = Dimensions.get('window').width;
const ScrollableTabBar = React.createClass({
propTypes: {
goToPage: React.PropTypes.func,
activeTab: React.PropTypes.number,
tabs: React.PropTypes.array,
backgroundColor: React.PropTypes.string,
activeTextColor: React.PropTypes.string,
inactiveTextColor: React.PropTypes.string,
scrollOffset: React.PropTypes.number,
//style: ViewPropTypes.style,
//tabStyle: ViewPropTypes.style,
//tabsContainerStyle: ViewPropTypes.style,
//tabStyle: ViewPropTypes.style,
textStyle: Text.propTypes.style,
renderTab: React.PropTypes.func,
//underlineStyle: ViewPropTypes.style,
onScroll:React.PropTypes.func,
},
getDefaultProps() {
return {
scrollOffset: 52,
activeTextColor: 'navy',
inactiveTextColor: 'black',
backgroundColor: null,
style: {},
tabStyle: {},
tabsContainerStyle: {},
tabStyle: {},
underlineStyle: {},
};
},
getInitialState() {
this._tabsMeasurements = [];
return {
_leftTabUnderline: new Animated.Value(0),
_widthTabUnderline: new Animated.Value(0),
_containerWidth: null,
};
},
componentDidMount() {
this.props.scrollValue.addListener(this.updateView);
},
updateView(offset) {
//console.log("updateView="+JSON.stringify(offset));
//console.log("updateView="+JSON.stringify(this.props));
const position = Math.floor(offset.value);
const pageOffset = offset.value % 1;
const tabCount = this.props.tabs.length;
const lastTabPosition = tabCount - 1;
if (tabCount === 0 || offset.value < 0 || offset.value > lastTabPosition) {
return;
}
if (this.necessarilyMeasurementsCompleted(position, position === lastTabPosition)) {
this.updateTabPanel(position, pageOffset);
this.updateTabUnderline(position, pageOffset, tabCount);
}
},
necessarilyMeasurementsCompleted(position, isLastTab) {
return this._tabsMeasurements[position] &&
(isLastTab || this._tabsMeasurements[position + 1]) &&
this._tabContainerMeasurements &&
this._containerMeasurements;
},
updateTabPanel(position, pageOffset) {
const containerWidth = this._containerMeasurements.width;
const tabWidth = this._tabsMeasurements[position].width;
//console.log("containerWidth="+containerWidth+" tabWidth="+tabWidth);
const nextTabMeasurements = this._tabsMeasurements[position + 1];
const nextTabWidth = nextTabMeasurements && nextTabMeasurements.width || 0;
const tabOffset = this._tabsMeasurements[position].left;
const absolutePageOffset = pageOffset * tabWidth;
let newScrollX = tabOffset + absolutePageOffset;
// center tab and smooth tab change (for when tabWidth changes a lot between two tabs)
newScrollX -= (containerWidth - (1 - pageOffset) * tabWidth - pageOffset * nextTabWidth) / 2;
newScrollX = newScrollX >= 0 ? newScrollX : 0;
if (Platform.OS === 'android') {
this._scrollView.scrollTo({x: newScrollX, y: 0, animated: false, });
} else {
const rightBoundScroll = this._tabContainerMeasurements.width - (this._containerMeasurements.width);
newScrollX = newScrollX > rightBoundScroll ? rightBoundScroll : newScrollX;
this._scrollView.scrollTo({x: newScrollX, y: 0, animated: false, });
}
},
updateTabUnderline(position, pageOffset, tabCount) {
const tabPad = this.props.underlineAlignText?this.props.tabPadding:0;
const lineLeft = this._tabsMeasurements[position].left;
const lineRight = this._tabsMeasurements[position].right;
if (position < tabCount - 1) {
const nextTabLeft = this._tabsMeasurements[position + 1].left;
const nextTabRight = this._tabsMeasurements[position + 1].right;
const newLineLeft = (pageOffset * nextTabLeft + (1 - pageOffset) * lineLeft);
const newLineRight = (pageOffset * nextTabRight + (1 - pageOffset) * lineRight);
this.state._leftTabUnderline.setValue(newLineLeft+tabPad);
this.state._widthTabUnderline.setValue(newLineRight - newLineLeft -tabPad*2);
} else {
this.state._leftTabUnderline.setValue(lineLeft+tabPad);
this.state._widthTabUnderline.setValue(lineRight - lineLeft-tabPad*2);
}
},
renderTab(name, page, isTabActive, onPressHandler, onLayoutHandler) {
const { activeTextColor, inactiveTextColor, textStyle, } = this.props;
const textColor = isTabActive ? activeTextColor : inactiveTextColor;
const fontWeight = isTabActive ? 'bold' : 'normal';
return <Button
key={`${name}_${page}`}
accessible={true}
accessibilityLabel={name}
accessibilityTraits='button'
onPress={() => onPressHandler(page)}
onLayout={onLayoutHandler}
>
<View style={[this.props.tabStyle||styles.tab, ]}>
<Text style={[{color: textColor, fontWeight, }, textStyle, ]}>
{name}
</Text>
</View>
</Button>;
},
measureTab(page, event) {
console.log("measureTab="+page+"layout "+JSON.stringify(event.nativeEvent.layout));
const { x, width, height, } = event.nativeEvent.layout;
this._tabsMeasurements[page] = {left: x, right: x + width, width, height, };
this.updateView({value: this.props.scrollValue._value, });
},
render() {
const tabUnderlineStyle = {
position: 'absolute',
height: 1,
backgroundColor: 'navy',
bottom: 0,
};
const key = I18nManager.isRTL ? 'right' : 'left';
const dynamicTabUnderline = {
[`${key}`]: this.state._leftTabUnderline,
width: this.state._widthTabUnderline
}
return <View
style={[this.props.tabsContainerStyle||styles.container, ]}
onLayout={this.onContainerLayout}
>
<ScrollView
automaticallyAdjustContentInsets={false}
ref={(scrollView) => { this._scrollView = scrollView; }}
horizontal={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
directionalLockEnabled={true}
onScroll={this.props.onScroll}
bounces={false}
scrollsToTop={false}
>
<View
style={[styles.tabs, {width: this.state._containerWidth, }, ]}
ref={'tabContainer'}
onLayout={this.onTabContainerLayout}
>
{this.props.tabs.map((name, page) => {
const isTabActive = this.props.activeTab === page;
const renderTab = this.props.renderTab || this.renderTab;
return renderTab(name, page, isTabActive, this.props.goToPage, this.measureTab.bind(this, page));
})}
<Animated.View style={[tabUnderlineStyle, dynamicTabUnderline, this.props.underlineStyle, ]} />
</View>
</ScrollView>
</View>;
},
componentWillReceiveProps(nextProps) {
// If the tabs change, force the width of the tabs container to be recalculated
if (JSON.stringify(this.props.tabs) !== JSON.stringify(nextProps.tabs) && this.state._containerWidth) {
this.setState({ _containerWidth: null, });
}
},
onTabContainerLayout(e) {
this._tabContainerMeasurements = e.nativeEvent.layout;
let width = this._tabContainerMeasurements.width;
if (width < WINDOW_WIDTH) {
width = WINDOW_WIDTH;
}
this.setState({ _containerWidth: width, });
this.updateView({value: this.props.scrollValue._value, });
},
onContainerLayout(e) {
this._containerMeasurements = e.nativeEvent.layout;
this.updateView({value: this.props.scrollValue._value, });
},
});
module.exports = ScrollableTabBar;
const styles = StyleSheet.create({
tab: {
height: 49,
alignItems: 'center',
justifyContent: 'center',
paddingLeft: 20,
paddingRight: 20,
},
container: {
height: 50,
borderWidth: 1,
borderTopWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 0,
borderColor: '#ccc',
},
tabs: {
flexDirection: 'row',
// justifyContent: 'space-around', android设备可能撞车
},
});
| jackuhan/react-native-viewpager-indicator | ScrollableTabBar.js | JavaScript | mit | 8,319 | [
30522,
9530,
3367,
10509,
1027,
5478,
1006,
1005,
10509,
1005,
1007,
1025,
9530,
3367,
1063,
3193,
21572,
13876,
18863,
2015,
1065,
1027,
10509,
19833,
3512,
1027,
5478,
1006,
1005,
10509,
1011,
3128,
1005,
1007,
1025,
9530,
3367,
1063,
319... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
version https://git-lfs.github.com/spec/v1
oid sha256:0f924f0bd38d3dfb7ebc34016ec96c018aee7fb62e1cd562898fdeb85ca7d283
size 2234
| yogeshsaroya/new-cdnjs | ajax/libs/timelinejs/2.26.1/js/locale/si.js | JavaScript | mit | 129 | [
30522,
2544,
16770,
1024,
1013,
1013,
21025,
2102,
1011,
1048,
10343,
1012,
21025,
2705,
12083,
1012,
4012,
1013,
28699,
1013,
1058,
2487,
1051,
3593,
21146,
17788,
2575,
1024,
1014,
2546,
2683,
18827,
2546,
2692,
2497,
2094,
22025,
2094,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER
* DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF
* ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE
* MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR
* ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT
* IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER
* LICENSES CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE
* RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO RECEIVER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
* RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*/
/*
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <boot/boot.h>
#include <msm7k/gpio.h>
/* gross */
typedef struct gpioregs gpioregs;
struct gpioregs
{
unsigned out;
unsigned in;
unsigned int_status;
unsigned int_clear;
unsigned int_en;
unsigned int_edge;
unsigned int_pos;
unsigned oe;
};
static gpioregs GPIO_REGS[] = {
{
.out = GPIO_OUT_0,
.in = GPIO_IN_0,
.int_status = GPIO_INT_STATUS_0,
.int_clear = GPIO_INT_CLEAR_0,
.int_en = GPIO_INT_EN_0,
.int_edge = GPIO_INT_EDGE_0,
.int_pos = GPIO_INT_POS_0,
.oe = GPIO_OE_0,
},
{
.out = GPIO_OUT_1,
.in = GPIO_IN_1,
.int_status = GPIO_INT_STATUS_1,
.int_clear = GPIO_INT_CLEAR_1,
.int_en = GPIO_INT_EN_1,
.int_edge = GPIO_INT_EDGE_1,
.int_pos = GPIO_INT_POS_1,
.oe = GPIO_OE_1,
},
{
.out = GPIO_OUT_2,
.in = GPIO_IN_2,
.int_status = GPIO_INT_STATUS_2,
.int_clear = GPIO_INT_CLEAR_2,
.int_en = GPIO_INT_EN_2,
.int_edge = GPIO_INT_EDGE_2,
.int_pos = GPIO_INT_POS_2,
.oe = GPIO_OE_2,
},
{
.out = GPIO_OUT_3,
.in = GPIO_IN_3,
.int_status = GPIO_INT_STATUS_3,
.int_clear = GPIO_INT_CLEAR_3,
.int_en = GPIO_INT_EN_3,
.int_edge = GPIO_INT_EDGE_3,
.int_pos = GPIO_INT_POS_3,
.oe = GPIO_OE_3,
},
{
.out = GPIO_OUT_4,
.in = GPIO_IN_4,
.int_status = GPIO_INT_STATUS_4,
.int_clear = GPIO_INT_CLEAR_4,
.int_en = GPIO_INT_EN_4,
.int_edge = GPIO_INT_EDGE_4,
.int_pos = GPIO_INT_POS_4,
.oe = GPIO_OE_4,
},
};
static gpioregs *find_gpio(unsigned n, unsigned *bit)
{
if(n > 106) return 0;
if(n > 94) {
*bit = 1 << (n - 95);
return GPIO_REGS + 4;
}
if(n > 67) {
*bit = 1 << (n - 68);
return GPIO_REGS + 3;
}
if(n > 42) {
*bit = 1 << (n - 43);
return GPIO_REGS + 2;
}
if(n > 15) {
*bit = 1 << (n - 16);
return GPIO_REGS + 1;
}
*bit = 1 << n;
return GPIO_REGS + 0;
}
void gpio_output_enable(unsigned n, unsigned out)
{
gpioregs *r;
unsigned b;
unsigned v;
if((r = find_gpio(n, &b)) == 0) return;
v = readl(r->oe);
if(out) {
writel(v | b, r->oe);
} else {
writel(v & (~b), r->oe);
}
}
void gpio_write(unsigned n, unsigned on)
{
gpioregs *r;
unsigned b;
unsigned v;
if((r = find_gpio(n, &b)) == 0) return;
v = readl(r->out);
if(on) {
writel(v | b, r->out);
} else {
writel(v & (~b), r->out);
}
}
int gpio_read(unsigned n)
{
gpioregs *r;
unsigned b;
if((r = find_gpio(n, &b)) == 0) return 0;
return (readl(r->in) & b) ? 1 : 0;
}
void gpio_dir(int nr, int out)
{
gpio_output_enable(nr, out);
}
void gpio_set(int nr, int set)
{
gpio_write(nr, set);
}
int gpio_get(int nr)
{
return gpio_read(nr);
}
| luckasfb/OT_903D-kernel-2.6.35.7 | bootable/bootloader/legacy/arch_msm7k/gpio.c | C | gpl-2.0 | 6,641 | [
30522,
1013,
1008,
9385,
4861,
1024,
1008,
1008,
2023,
4007,
1013,
3813,
8059,
1998,
3141,
12653,
1006,
1000,
2865,
23125,
4007,
1000,
1007,
2024,
1008,
5123,
2104,
7882,
9385,
4277,
1012,
1996,
2592,
4838,
2182,
2378,
2003,
1008,
18777,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
.archive-year
{
list-style: none;
}
.archive-year__title
{
margin-left: -16px;
padding: .2em 0 .2em 16px;
cursor: pointer;
background: url(img/arrow_down.png) no-repeat 6px center;
}
.archive-year__title:hover
{
background-color: #F0F0F0;
}
.archive-year__content
{
padding: 0 0 1em 2ex;
margin: 0;
}
.archive-year__title_collapsed
{
background-image: url(img/arrow_right.png);
background-position: 8px center;
}
.archive-year__content_collapsed
{
display: none;
}
| fateevv/basisjs | demo/apps/blog/template/archiveYear.css | CSS | mit | 547 | [
30522,
1012,
8756,
1011,
2095,
1063,
2862,
1011,
2806,
1024,
3904,
1025,
1065,
1012,
8756,
1011,
2095,
1035,
1035,
2516,
1063,
7785,
1011,
2187,
1024,
1011,
2385,
2361,
2595,
1025,
11687,
4667,
1024,
1012,
1016,
6633,
1014,
30524,
25215,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifdef ENVOY_GOOGLE_GRPC
#include "envoy/config/core/v3/grpc_service.pb.h"
#include "envoy/config/grpc_credential/v3/file_based_metadata.pb.h"
#include "common/common/fmt.h"
#include "common/grpc/google_async_client_impl.h"
#include "extensions/grpc_credentials/file_based_metadata/config.h"
#include "extensions/grpc_credentials/well_known_names.h"
#include "test/common/grpc/grpc_client_integration_test_harness.h"
#include "test/integration/fake_upstream.h"
#include "test/test_common/environment.h"
namespace Envoy {
namespace Grpc {
namespace {
// FileBasedMetadata credential validation tests.
class GrpcFileBasedMetadataClientIntegrationTest : public GrpcSslClientIntegrationTest {
public:
void expectExtraHeaders(FakeStream& fake_stream) override {
AssertionResult result = fake_stream.waitForHeadersComplete();
RELEASE_ASSERT(result, result.message());
Http::TestHeaderMapImpl stream_headers(fake_stream.headers());
if (!header_value_1_.empty()) {
EXPECT_EQ(header_prefix_1_ + header_value_1_, stream_headers.get_(header_key_1_));
}
if (!header_value_2_.empty()) {
EXPECT_EQ(header_value_2_, stream_headers.get_("authorization"));
}
}
envoy::config::core::v3::GrpcService createGoogleGrpcConfig() override {
auto config = GrpcClientIntegrationTest::createGoogleGrpcConfig();
auto* google_grpc = config.mutable_google_grpc();
google_grpc->set_credentials_factory_name(credentials_factory_name_);
auto* ssl_creds = google_grpc->mutable_channel_credentials()->mutable_ssl_credentials();
ssl_creds->mutable_root_certs()->set_filename(
TestEnvironment::runfilesPath("test/config/integration/certs/upstreamcacert.pem"));
if (!header_value_1_.empty()) {
const std::string yaml1 = fmt::format(R"EOF(
"@type": type.googleapis.com/envoy.config.grpc_credential.v2alpha.FileBasedMetadataConfig
secret_data:
inline_string: {}
header_key: {}
header_prefix: {}
)EOF",
header_value_1_, header_key_1_, header_prefix_1_);
auto* plugin_config = google_grpc->add_call_credentials()->mutable_from_plugin();
plugin_config->set_name(credentials_factory_name_);
envoy::config::grpc_credential::v3::FileBasedMetadataConfig metadata_config;
Envoy::TestUtility::loadFromYaml(yaml1, *plugin_config->mutable_typed_config());
}
if (!header_value_2_.empty()) {
// uses default key/prefix
const std::string yaml2 = fmt::format(R"EOF(
"@type": type.googleapis.com/envoy.config.grpc_credential.v2alpha.FileBasedMetadataConfig
secret_data:
inline_string: {}
)EOF",
header_value_2_);
envoy::config::grpc_credential::v3::FileBasedMetadataConfig metadata_config2;
auto* plugin_config2 = google_grpc->add_call_credentials()->mutable_from_plugin();
plugin_config2->set_name(credentials_factory_name_);
Envoy::TestUtility::loadFromYaml(yaml2, *plugin_config2->mutable_typed_config());
}
if (!access_token_value_.empty()) {
google_grpc->add_call_credentials()->set_access_token(access_token_value_);
}
return config;
}
std::string header_key_1_{};
std::string header_value_1_{};
std::string header_value_2_{};
std::string header_prefix_1_{};
std::string access_token_value_{};
std::string credentials_factory_name_{};
};
// Parameterize the loopback test server socket address and gRPC client type.
INSTANTIATE_TEST_SUITE_P(SslIpVersionsClientType, GrpcFileBasedMetadataClientIntegrationTest,
GRPC_CLIENT_INTEGRATION_PARAMS);
// Validate that a simple request-reply unary RPC works with FileBasedMetadata auth.
TEST_P(GrpcFileBasedMetadataClientIntegrationTest, FileBasedMetadataGrpcAuthRequest) {
SKIP_IF_GRPC_CLIENT(ClientType::EnvoyGrpc);
header_key_1_ = "header1";
header_prefix_1_ = "prefix1";
header_value_1_ = "secretvalue";
credentials_factory_name_ =
Extensions::GrpcCredentials::GrpcCredentialsNames::get().FileBasedMetadata;
initialize();
auto request = createRequest(empty_metadata_);
request->sendReply();
dispatcher_helper_.runDispatcher();
}
// Validate that two separate metadata plugins work with FileBasedMetadata auth.
TEST_P(GrpcFileBasedMetadataClientIntegrationTest, DoubleFileBasedMetadataGrpcAuthRequest) {
SKIP_IF_GRPC_CLIENT(ClientType::EnvoyGrpc);
header_key_1_ = "header1";
header_prefix_1_ = "prefix1";
header_value_1_ = "secretvalue";
header_value_2_ = "secret2";
credentials_factory_name_ =
Extensions::GrpcCredentials::GrpcCredentialsNames::get().FileBasedMetadata;
initialize();
auto request = createRequest(empty_metadata_);
request->sendReply();
dispatcher_helper_.runDispatcher();
}
// Validate that FileBasedMetadata auth plugin works without a config loaded
TEST_P(GrpcFileBasedMetadataClientIntegrationTest, EmptyFileBasedMetadataGrpcAuthRequest) {
SKIP_IF_GRPC_CLIENT(ClientType::EnvoyGrpc);
credentials_factory_name_ =
Extensions::GrpcCredentials::GrpcCredentialsNames::get().FileBasedMetadata;
initialize();
auto request = createRequest(empty_metadata_);
request->sendReply();
dispatcher_helper_.runDispatcher();
}
// Validate that FileBasedMetadata auth plugin works with extra credentials configured
TEST_P(GrpcFileBasedMetadataClientIntegrationTest, ExtraConfigFileBasedMetadataGrpcAuthRequest) {
SKIP_IF_GRPC_CLIENT(ClientType::EnvoyGrpc);
access_token_value_ = "testaccesstoken";
header_key_1_ = "header1";
header_prefix_1_ = "prefix1";
header_value_1_ = "secretvalue";
credentials_factory_name_ =
Extensions::GrpcCredentials::GrpcCredentialsNames::get().FileBasedMetadata;
initialize();
auto request = createRequest(empty_metadata_);
request->sendReply();
dispatcher_helper_.runDispatcher();
}
class MockAuthContext : public ::grpc::AuthContext {
public:
~MockAuthContext() override {}
MOCK_METHOD(bool, IsPeerAuthenticated, (), (const, override));
MOCK_METHOD(std::vector<grpc::string_ref>, GetPeerIdentity, (), (const, override));
MOCK_METHOD(std::string, GetPeerIdentityPropertyName, (), (const, override));
MOCK_METHOD(std::vector<grpc::string_ref>, FindPropertyValues, (const std::string& name),
(const, override));
MOCK_METHOD(::grpc::AuthPropertyIterator, begin, (), (const, override));
MOCK_METHOD(::grpc::AuthPropertyIterator, end, (), (const, override));
MOCK_METHOD(void, AddProperty, (const std::string& key, const grpc::string_ref& value),
(override));
MOCK_METHOD(bool, SetPeerIdentityPropertyName, (const std::string& name), (override));
};
TEST(GrpcFileBasedMetadata, MissingSecretData) {
const std::string yaml = R"EOF(
secret_data:
filename: missing-file
)EOF";
envoy::config::grpc_credential::v3::FileBasedMetadataConfig metadata_config;
Envoy::TestUtility::loadFromYaml(yaml, metadata_config);
Api::ApiPtr api = Api::createApiForTest();
Extensions::GrpcCredentials::FileBasedMetadata::FileBasedMetadataAuthenticator authenticator(
metadata_config, *api);
MockAuthContext context;
std::multimap<grpc::string, grpc::string> metadata;
auto status =
authenticator.GetMetadata(grpc::string_ref(), grpc::string_ref(), context, &metadata);
EXPECT_EQ(grpc::StatusCode::NOT_FOUND, status.error_code());
}
} // namespace
} // namespace Grpc
} // namespace Envoy
#endif
| jrajahalme/envoy | test/extensions/grpc_credentials/file_based_metadata/file_based_metadata_grpc_credentials_test.cc | C++ | apache-2.0 | 7,404 | [
30522,
1001,
2065,
3207,
2546,
19918,
1035,
8224,
1035,
24665,
15042,
1001,
2421,
1000,
19918,
1013,
9530,
8873,
2290,
1013,
4563,
1013,
1058,
2509,
1013,
24665,
15042,
1035,
2326,
1012,
1052,
2497,
1012,
1044,
1000,
1001,
2421,
1000,
19918... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React, { Component, PropTypes } from 'react';
import Select from 'react-select';
import { omit } from 'lodash';
import classNames from 'classnames';
import styles from './styles.scss';
import chevronIcon from '../../../assets/images/icons/chevron-down.svg';
export const THEMES = { OLD: 'old', INTERNAL: 'internal' };
export default class SelectField extends Component {
static propTypes = {
theme: PropTypes.string,
label: PropTypes.string,
error: PropTypes.string,
className: PropTypes.string,
};
static defaultProps = {
theme: THEMES.OLD,
};
constructor(props, context) {
super(props, context);
this.renderArrow = ::this.renderArrow;
}
renderArrow() {
return (
<div className={styles.selectArrow}>
<img src={chevronIcon} alt="chevron" />
</div>
);
}
renderOption(option, i) {
return (
<div key={i} className={styles.selectFieldOption}>{option.label}</div>
);
}
renderLabel() {
const labelStyles = classNames(styles.selectLabel, { [styles.selectLabelInvalid]: this.props.error });
return this.props.label ? (
<div className={labelStyles}>{this.props.label}</div>
) : null;
}
renderError() {
return this.props.error ? (
<div className={styles.selectFieldError}>
{this.props.error}
</div>
) : null;
}
renderSelectField() {
const selectStyles = classNames(styles.selectField, { [styles.selectFieldInvalid]: this.props.error });
const props = omit(this.props, ['error', 'label']);
return (
<div className={selectStyles}>
<Select {...props} arrowRenderer={this.renderArrow} optionRenderer={this.renderOption} />
{this.renderError()}
</div>
);
}
render() {
const selectStyles = classNames(styles.select, this.props.className, {
[styles.selectOld]: this.props.theme === THEMES.OLD,
[styles.selectInternal]: this.props.theme === THEMES.INTERNAL,
});
return (
<div className={selectStyles}>
{this.renderLabel()}
{this.renderSelectField()}
</div>
);
}
}
| singaporesamara/SOAS-DASHBOARD | app/components/UIKit/SelectField/index.js | JavaScript | mit | 2,115 | [
30522,
12324,
10509,
1010,
1063,
6922,
1010,
17678,
13874,
2015,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
7276,
2013,
1005,
10509,
1011,
7276,
1005,
1025,
12324,
1063,
18168,
4183,
1065,
2013,
1005,
8840,
8883,
2232,
1005,
1025,
12324,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace common\fixtures\helpers;
interface FixtureTester {
public function haveFixtures($fixtures);
public function grabFixture($name, $index = null);
public function seeRecord(string $class, array $array);
/**
* @param string $className
* @param array $attributes
* @return mixed
*/
public function haveRecord(string $className, array $attributes);
}
| edzima/VestraTele | common/fixtures/helpers/FixtureTester.php | PHP | bsd-3-clause | 380 | [
30522,
1026,
1029,
25718,
3415,
15327,
2691,
1032,
17407,
1032,
2393,
2545,
1025,
8278,
15083,
22199,
2121,
1063,
2270,
3853,
2031,
8873,
18413,
14900,
1006,
1002,
17407,
1007,
1025,
2270,
3853,
6723,
8873,
18413,
5397,
1006,
1002,
2171,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
requirejs(['bmotion.config'], function() {
requirejs(['bms.integrated.root'], function() {});
});
| ladenberger/bmotion-frontend | app/js/bmotion.integrated.js | JavaScript | epl-1.0 | 100 | [
30522,
5478,
22578,
1006,
1031,
1005,
1038,
18938,
3258,
1012,
9530,
8873,
2290,
1005,
1033,
1010,
3853,
1006,
1007,
1063,
5478,
22578,
1006,
1031,
1005,
1038,
5244,
1012,
6377,
1012,
7117,
1005,
1033,
1010,
3853,
1006,
1007,
1063,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#include <boost/python.hpp>
#include <mapnik/datasource_cache.hpp>
namespace {
using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
{
bool bind=true;
mapnik::parameters params;
boost::python::list keys=d.keys();
for (int i=0; i<len(keys); ++i)
{
std::string key = extract<std::string>(keys[i]);
object obj = d[key];
if (key == "bind")
{
bind = extract<bool>(obj)();
continue;
}
extract<std::string> ex0(obj);
extract<int> ex1(obj);
extract<double> ex2(obj);
if (ex0.check())
{
params[key] = ex0();
}
else if (ex1.check())
{
params[key] = ex1();
}
else if (ex2.check())
{
params[key] = ex2();
}
}
return mapnik::datasource_cache::instance().create(params, bind);
}
void register_datasources(std::string const& path)
{
mapnik::datasource_cache::instance().register_datasources(path);
}
std::vector<std::string> plugin_names()
{
return mapnik::datasource_cache::instance().plugin_names();
}
std::string plugin_directories()
{
return mapnik::datasource_cache::instance().plugin_directories();
}
}
void export_datasource_cache()
{
using mapnik::datasource_cache;
class_<datasource_cache,
boost::noncopyable>("DatasourceCache",no_init)
.def("create",&create_datasource)
.staticmethod("create")
.def("register_datasources",®ister_datasources)
.staticmethod("register_datasources")
.def("plugin_names",&plugin_names)
.staticmethod("plugin_names")
.def("plugin_directories",&plugin_directories)
.staticmethod("plugin_directories")
;
}
| ake-koomsin/mapnik_nvpr | bindings/python/mapnik_datasource_cache.cpp | C++ | lgpl-2.1 | 2,838 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (C) 2010, Bernd Stramm
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QRegExp>
#include <QString>
#include <QStringList>
#include "shortener.h"
#include "network-if.h"
namespace chronicon {
Shortener::Shortener (QObject *parent)
:QObject (parent),
network (0)
{
}
void
Shortener::SetNetwork (NetworkIF * net)
{
network = net;
connect (network, SIGNAL (ShortenReply (QUuid, QString, QString, bool)),
this, SLOT (CatchShortening (QUuid, QString, QString, bool)));
}
void
Shortener::ShortenHttp (QString status, bool & wait)
{
if (network == 0) {
emit DoneShortening (status);
return;
}
QRegExp regular ("(https?://)(\\S*)");
status.append (" ");
QStringList linkList;
QStringList wholeList;
int where (0), offset(0), lenSub(0);
QString link, beforeLink;
while ((where = regular.indexIn (status,offset)) > 0) {
lenSub = regular.matchedLength();
beforeLink = status.mid (offset, where - offset);
link = regular.cap(0);
if ((!link.contains ("bit.ly"))
&& (!link.contains ("twitpic.com"))
&& (link.length() > QString("http://bit.ly/12345678").length())) {
linkList << link;
}
wholeList << beforeLink;
wholeList << link;
offset = where + lenSub;
}
wholeList << status.mid (offset, -1);
shortenTag = QUuid::createUuid();
if (linkList.isEmpty ()) {
wait = false;
} else {
messageParts[shortenTag] = wholeList;
linkParts [shortenTag] = linkList;
network->ShortenHttp (shortenTag,linkList);
wait = true;
}
}
void
Shortener::CatchShortening (QUuid tag, QString shortUrl, QString longUrl, bool good)
{
/// replace the longUrl with shortUrl in the messageParts[tag]
// remove the longUrl from the linkParts[tag]
// if the linkParts[tag] is empty, we have replaced all the links
// so send append all the messageParts[tag] and finish the message
if (messageParts.find(tag) == messageParts.end()) {
return; // extra, perhaps duplicates in original, or not for me
}
if (linkParts.find(tag) == linkParts.end()) {
return;
}
QStringList::iterator chase;
for (chase = messageParts[tag].begin();
chase != messageParts[tag].end();
chase++) {
if (*chase == longUrl) {
*chase = shortUrl;
}
}
linkParts[tag].removeAll (longUrl);
if (linkParts[tag].isEmpty()) {
QString message = messageParts[tag].join (QString());
emit DoneShortening (message);
messageParts.erase (tag);
}
}
} // namespace
| berndhs/chronicon | chronicon/src/shortener.cpp | C++ | gpl-2.0 | 3,400 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
return [
'collector' => [
'name' => 'Microsoft SNDS',
'description' => 'Collects data from Microsoft SNDS to generate events',
'enabled' => false,
'location' => 'https://postmaster.live.com/snds/ipStatus.aspx',
'key' => '',
'aliasses' => [
'E-mail address harvesting' => 'detected_harvesting',
'Symantec Brightmail' => 'symantec_rbl',
'SpamHaus SBL/XBL' => 'spamhaus_rbl',
'Blocked due to user complaints or other evidence of spamming' => 'user_complaints',
]
],
'feeds' => [
'detected_harvesting' => [
'class' => 'HARVESTING',
'type' => 'ABUSE',
'enabled' => true,
'fields' => [
'first_ip',
'last_ip',
'blocked',
'feed',
],
'filters' => [
'first_ip',
'last_ip',
]
],
'symantec_rbl' => [
'class' => 'RBL_LISTED',
'type' => 'ABUSE',
'enabled' => true,
'fields' => [
'first_ip',
'last_ip',
'blocked',
'feed',
],
'filters' => [
'first_ip',
'last_ip',
]
],
'spamhaus_rbl' => [
'class' => 'RBL_LISTED',
'type' => 'ABUSE',
'enabled' => true,
'fields' => [
'first_ip',
'last_ip',
'blocked',
'feed',
],
'filters' => [
'first_ip',
'last_ip',
]
],
'user_complaints' => [
'class' => 'SPAM',
'type' => 'ABUSE',
'enabled' => true,
'fields' => [
'first_ip',
'last_ip',
'blocked',
'feed',
],
'filters' => [
'first_ip',
'last_ip',
]
],
],
];
| AbuseIO/collector-snds | config/Snds.php | PHP | gpl-2.0 | 2,257 | [
30522,
1026,
1029,
25718,
2709,
1031,
1005,
10018,
1005,
1027,
1028,
1031,
1005,
2171,
1005,
1027,
1028,
1005,
7513,
1055,
18376,
1005,
1010,
1005,
6412,
1005,
1027,
1028,
1005,
17427,
2951,
2013,
7513,
1055,
18376,
30524,
1005,
1027,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.teksystems.qe.automata.sample.amazon.views;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.teksystems.qe.automata.interfaces.BaseView;
import com.teksystems.qe.automata.sample.amazon.data.AmazonUser;
public abstract class AmazonBaseView implements BaseView{
protected WebDriver driver;
protected AmazonUser user;
/**
* Define global elements here
*/
@FindBy(xpath="//input[@name='field-keywords']")
WebElement searchInput;
@FindBy(xpath="//input[contains(@class,'nav-input') and @type='submit']")
WebElement searchSubmit;
public AmazonBaseView(WebDriver driver, AmazonUser user){
this.driver = driver;
this.user = user;
PageFactory.initElements(driver, this);
}
public abstract void complete();
public void navigate() {
return;
}
/**
* Put utility functions here
*/
}
| jmastri/automata | sample_automata/src/main/java/com/teksystems/qe/automata/sample/amazon/views/AmazonBaseView.java | Java | gpl-3.0 | 967 | [
30522,
7427,
4012,
1012,
8915,
5705,
27268,
6633,
2015,
1012,
1053,
2063,
1012,
8285,
21022,
1012,
7099,
1012,
9733,
1012,
5328,
1025,
12324,
8917,
1012,
2330,
19062,
1012,
7367,
7770,
5007,
1012,
4773,
23663,
2099,
1025,
12324,
8917,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2010-2013 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.notifications.impl;
import com.evolveum.midpoint.notifications.api.EventHandler;
import com.evolveum.midpoint.notifications.api.NotificationFunctions;
import com.evolveum.midpoint.notifications.api.NotificationManager;
import com.evolveum.midpoint.notifications.api.events.BaseEvent;
import com.evolveum.midpoint.notifications.api.events.Event;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskManager;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EventHandlerType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* @author mederly
*/
@Component
public class NotificationManagerImpl implements NotificationManager {
private static final Trace LOGGER = TraceManager.getTrace(NotificationManager.class);
private static final String OPERATION_PROCESS_EVENT = NotificationManager.class + ".processEvent";
@Autowired
@Qualifier("cacheRepositoryService")
private transient RepositoryService cacheRepositoryService;
@Autowired
private NotificationFunctions notificationFunctions;
@Autowired
private TaskManager taskManager;
private boolean disabled = false; // for testing purposes (in order for model-intest to run more quickly)
private HashMap<Class<? extends EventHandlerType>,EventHandler> handlers = new HashMap<>();
private HashMap<String,Transport> transports = new HashMap<>();
public void registerEventHandler(Class<? extends EventHandlerType> clazz, EventHandler handler) {
LOGGER.trace("Registering event handler " + handler + " for " + clazz);
handlers.put(clazz, handler);
}
public EventHandler getEventHandler(EventHandlerType eventHandlerType) {
EventHandler handler = handlers.get(eventHandlerType.getClass());
if (handler == null) {
throw new IllegalStateException("Unknown handler for " + eventHandlerType);
} else {
return handler;
}
}
@Override
public void registerTransport(String name, Transport transport) {
LOGGER.trace("Registering notification transport {} under name {}", transport, name);
transports.put(name, transport);
}
// accepts name:subname (e.g. dummy:accounts) - a primitive form of passing parameters (will be enhanced/replaced in the future)
@Override
public Transport getTransport(String name) {
String key = name.split(":")[0];
Transport transport = transports.get(key);
if (transport == null) {
throw new IllegalStateException("Unknown transport named " + key);
} else {
return transport;
}
}
public void processEvent(@Nullable Event event) {
Task task = taskManager.createTaskInstance(OPERATION_PROCESS_EVENT);
processEvent(event, task, task.getResult());
}
public void processEvent(@Nullable Event event, Task task, OperationResult result) {
if (event == null) {
return;
}
if (event instanceof BaseEvent) {
((BaseEvent) event).setNotificationFunctions(notificationFunctions);
}
LOGGER.trace("NotificationManager processing event:\n{}", event.debugDumpLazily(1));
if (event.getAdHocHandler() != null) {
processEvent(event, event.getAdHocHandler(), task, result);
}
boolean errorIfNotFound = !SchemaConstants.CHANNEL_GUI_INIT_URI.equals(task.getChannel());
SystemConfigurationType systemConfigurationType = NotificationFunctionsImpl
.getSystemConfiguration(cacheRepositoryService, errorIfNotFound, result);
if (systemConfigurationType == null) { // something really wrong happened (or we are doing initial import of objects)
return;
}
// boolean specificSecurityPoliciesDefined = false;
// if (systemConfigurationType.getGlobalSecurityPolicyRef() != null) {
//
// SecurityPolicyType securityPolicyType = NotificationFuctionsImpl.getSecurityPolicyConfiguration(systemConfigurationType.getGlobalSecurityPolicyRef(), cacheRepositoryService, result);
// if (securityPolicyType != null && securityPolicyType.getAuthentication() != null) {
//
// for (MailAuthenticationPolicyType mailPolicy : securityPolicyType.getAuthentication().getMailAuthentication()) {
// NotificationConfigurationType notificationConfigurationType = mailPolicy.getNotificationConfiguration();
// if (notificationConfigurationType != null) {
// specificSecurityPoliciesDefined = true;
// processNotifications(notificationConfigurationType, event, task, result);
// }
// }
//
// for (SmsAuthenticationPolicyType mailPolicy : securityPolicyType.getAuthentication().getSmsAuthentication()) {
// NotificationConfigurationType notificationConfigurationType = mailPolicy.getNotificationConfiguration();
// if (notificationConfigurationType != null) {
// specificSecurityPoliciesDefined = true;
// processNotifications(notificationConfigurationType, event, task, result);
// }
// }
//
// return;
// }
// }
//
// if (specificSecurityPoliciesDefined) {
// LOGGER.trace("Specific policy for notifier set in security configuration, skupping notifiers defined in system configuration.");
// return;
// }
if (systemConfigurationType.getNotificationConfiguration() == null) {
LOGGER.trace("No notification configuration in repository, finished event processing.");
return;
}
NotificationConfigurationType notificationConfigurationType = systemConfigurationType.getNotificationConfiguration();
processNotifications(notificationConfigurationType, event, task, result);
LOGGER.trace("NotificationManager successfully processed event {} ({} top level handler(s))", event, notificationConfigurationType.getHandler().size());
}
private void processNotifications(NotificationConfigurationType notificationConfigurationType, Event event, Task task, OperationResult result){
for (EventHandlerType eventHandlerType : notificationConfigurationType.getHandler()) {
processEvent(event, eventHandlerType, task, result);
}
}
public boolean processEvent(Event event, EventHandlerType eventHandlerType, Task task, OperationResult result) {
try {
return getEventHandler(eventHandlerType).processEvent(event, eventHandlerType, this, task, result);
} catch (SchemaException e) {
LoggingUtils.logException(LOGGER, "Event couldn't be processed; event = {}", e, event);
return true; // continue if you can
}
}
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
}
| arnost-starosta/midpoint | model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java | Java | apache-2.0 | 8,364 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2286,
19852,
2819,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This file is part of Arglyzer.
*
* Copyright (c) 2015 Juan Jose Salazar Garcia jjslzgc@gmail.com
*
* Arglyzer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Arglyzer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Arglyzer. If not, see <http://www.gnu.org/licenses/>.
*
**/
#include "result.h"
#include "option.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
ResultPtr create_result(OptionsListPtr options_list, int max_args)
{
if(max_args <= 0)
return NULL;
ResultPtr result = (ResultPtr) malloc(sizeof(Result));
result -> options = options_list;
result -> params = (char **) malloc(sizeof(char *) * (max_args + 1));
memset(result -> params, 0, max_args + 1);
return result;
}
int print_result(ResultPtr result)
{
if(result == NULL)
return 1;
if(result -> options == NULL)
return 2;
OptionPtr opt_ptr;
for(opt_ptr = result -> options -> lh_first; opt_ptr != NULL; opt_ptr = opt_ptr -> entries.le_next)
print_option(opt_ptr);
char **params_ptr;
for(params_ptr = result -> params; *params_ptr != NULL; ++params_ptr)
printf("Param[%d] : %s\n", params_ptr - result -> params, *params_ptr);
return 0;
}
int free_result(ResultPtr result)
{
if(result == NULL)
return 1;
char **params_ptr;
for(params_ptr = result -> params; *params_ptr != NULL; ++params_ptr)
free(*params_ptr);
free(result -> params);
free(result);
return 0;
}
| j2sg/arglyzer | src/result.c | C | gpl-3.0 | 1,976 | [
30522,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
12098,
25643,
6290,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
5348,
4560,
25315,
7439,
29017,
14540,
2480,
18195,
1030,
20917,
4014,
1012,
4012,
1008,
1008,
12098,
25643,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import $ from 'jquery';
import { router } from 'src/router';
import './header.scss';
export default class Header {
static selectors = {
button: '.header__enter',
search: '.header__search'
};
constructor($root) {
this.elements = {
$root,
$window: $(window)
};
this.attachEvents();
}
attachEvents() {
this.elements.$root.on('click', Header.selectors.button, this.handleClick)
}
handleClick = () => {
const search = $(Header.selectors.search).val();
if (search) {
router.navigate(`/search?query=${search}`);
}
}
}
| ksukhova/Auction | src/components/header/header.js | JavaScript | isc | 658 | [
30522,
12324,
1002,
2013,
1005,
1046,
4226,
2854,
1005,
1025,
12324,
1063,
2799,
2099,
1065,
2013,
1005,
5034,
2278,
1013,
2799,
2099,
1005,
1025,
12324,
1005,
1012,
1013,
20346,
1012,
8040,
4757,
1005,
1025,
9167,
12398,
2465,
20346,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
"""
The scheduler is responsible for the module handling.
"""
import modules
from importlib import import_module
from additional.Logging import Logging
################################################################################
class Scheduler():
"""
This class instantiates the modules, takes care of the module's versions
and gets the module's select queries.
"""
# dictonary of instantiated modules
_instantiated_modules = {}
def __init__(self, db):
self._db = db
self._log = Logging(self.__class__.__name__).get_logger()
########################################################################
self._instantiate_modules()
self._check_module_versions()
############################################################################
def _instantiate_modules(self):
"""
Method to instantiate modules.
All modules must contain a class with the exact same name as the module.
This class must implement the abstract base class (abc) DatasourceBase.
"""
# finds all modules to import
for module_name in modules.__all__:
# imports an instantiates the module by name
module = import_module('modules.' + module_name)
module = getattr(module, module_name)()
# makes sure the module implements DatasourceBase
if not isinstance(module, modules.DatasourceBase):
raise SubClassError(
'Modul is not an instance of DatasourceBase: {}'
.format(module.__class__.__name__))
# adds the module to the list of instantieated modules
self._instantiated_modules[module.__class__.__name__] = module
############################################################################
def _check_module_versions(self):
"""
Method to check module's versions.
"""
for module_name, module in self._instantiated_modules.items():
module_version = module.get_version()
# searches module's version in the database
result = self._db.select_data('''
SELECT version
FROM versions
WHERE module = %s''', (module_name,))
if not result:
# appends the module with it's version to the database
self._db.insert_data('''
INSERT INTO versions (module, version)
VALUES (%s, %s)''', (module_name, module_version))
elif result[0][0] < module_version:
# updates the request entry
self.server.db.update_data('''
UPDATE versions
SET version = %s
WHERE module = %s''', (module_version, module_name,))
elif result[0][0] > module_version:
raise VersionError('Old module version detected!' +
'Module: {} - Expected: {} - Found: {}'
.format(module_name, result[0][0], module_version))
############################################################################
def get_module_select_queries(self):
"""
Returns the module's search queries.
"""
queries = {}
for module_name, module in self._instantiated_modules.items():
queries[module_name] = module.get_queries('select')
return queries
################################################################################
class SubClassError(Exception):
"""
Exception for module subclass errors.
"""
class VersionError(Exception):
"""
Exception for module version errors.
"""
| andreas-kowasch/DomainSearch | DomainSearchViewer/additional/Scheduler.py | Python | bsd-2-clause | 3,767 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
1000,
1000,
1996,
6134,
2099,
2003,
3625,
2005,
1996,
11336,
8304,
1012,
1000,
1000,
1000,
12324,
14184,
2013,
12324,
29521,
12324,
12324,
1035,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2015-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <zmq/zmqabstractnotifier.h>
#include <util.h>
CZMQAbstractNotifier::~CZMQAbstractNotifier()
{
assert(!psocket);
}
bool CZMQAbstractNotifier::NotifyBlock(const CBlockIndex * /*CBlockIndex*/)
{
return true;
}
bool CZMQAbstractNotifier::NotifyTransaction(const CTransaction &/*transaction*/)
{
return true;
}
bool CZMQAbstractNotifier::NotifyTransactionLock(const CTransactionRef &/*transaction*/)
{
return true;
} | globaltoken/globaltoken | src/zmq/zmqabstractnotifier.cpp | C++ | mit | 636 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2325,
1011,
2418,
1996,
2978,
3597,
2378,
4563,
9797,
1013,
1013,
5500,
2104,
1996,
10210,
4007,
6105,
1010,
2156,
1996,
10860,
1013,
1013,
5371,
24731,
2030,
8299,
1024,
1013,
1013,
7479,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package geoipfix
import (
"time"
)
// Version is the current application version
const Version = "0.1.0"
// DefaultPort is the default server port
const DefaultPort = 3001
// DatabaseURL is the full url to download the maxmind database
const DatabaseURL = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz"
// UpdateInterval is the default time to update the database
const UpdateInterval = 24 * time.Hour
// RetryInterval is the default retry time to retry the update
const RetryInterval = time.Hour
// compilation variables.
var (
Branch string
Revision string
BuildTime string
Compiler string
)
| ulule/ipfix | constants.go | GO | mit | 639 | [
30522,
7427,
20248,
11514,
8873,
2595,
12324,
1006,
1000,
2051,
1000,
1007,
1013,
1013,
2544,
2003,
1996,
2783,
4646,
2544,
9530,
3367,
2544,
1027,
1000,
1014,
1012,
1015,
1012,
1014,
1000,
1013,
1013,
12398,
6442,
2003,
1996,
12398,
8241,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2015 wcm.io
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package io.wcm.devops.conga.plugins.sling.validator;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import io.wcm.devops.conga.generator.spi.ValidationException;
import io.wcm.devops.conga.generator.spi.ValidatorPlugin;
import io.wcm.devops.conga.generator.spi.context.FileContext;
import io.wcm.devops.conga.generator.util.PluginManagerImpl;
public class ProvisioningValidatorTest {
private ValidatorPlugin underTest;
@BeforeEach
public void setUp() {
underTest = new PluginManagerImpl().get(ProvisioningValidator.NAME, ValidatorPlugin.class);
}
@Test
public void testValid() throws Exception {
File file = new File(getClass().getResource("/validProvisioning.txt").toURI());
FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8);
assertTrue(underTest.accepts(fileContext, null));
underTest.apply(fileContext, null);
}
@Test
public void testInvalid() throws Exception {
File file = new File(getClass().getResource("/invalidProvisioning.txt").toURI());
FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8);
assertTrue(underTest.accepts(fileContext, null));
assertThrows(ValidationException.class, () -> {
underTest.apply(fileContext, null);
});
}
@Test
public void testInvalidFileExtension() throws Exception {
File file = new File(getClass().getResource("/noProvisioning.txt").toURI());
FileContext fileContext = new FileContext().file(file).charset(StandardCharsets.UTF_8);
assertFalse(underTest.accepts(fileContext, null));
}
}
| wcm-io-devops/wcm-io-devops-conga-sling-plugin | conga-sling-plugin/src/test/java/io/wcm/devops/conga/plugins/sling/validator/ProvisioningValidatorTest.java | Java | apache-2.0 | 2,492 | [
30522,
1013,
1008,
1008,
1001,
1003,
1048,
1008,
15868,
2213,
1012,
22834,
1008,
1003,
1003,
1008,
9385,
1006,
1039,
1007,
2325,
15868,
2213,
1012,
22834,
1008,
1003,
1003,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package bucky;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class GUIFiftySix extends JFrame {
// Variables
private JTextField addressBar;
private JEditorPane display;
// Constructor
public GUIFiftySix(){
super("the Title");
// Create address bar
addressBar = new JTextField("Enter a URL");
// Capture on press enter event
addressBar.addActionListener(
// Anonymous inner class
new ActionListener(){
// Overwrite method
public void actionPerformed(ActionEvent event){
// Pass URL to loadPage method
loadPage(event.getActionCommand());
}
}
);
add(addressBar, BorderLayout.NORTH);
// Create display
display = new JEditorPane();
display.setEditable(false);
// Make links respond to click
display.addHyperlinkListener(
// Anonymous inner class
new HyperlinkListener(){
// Overwrite method
public void hyperlinkUpdate(HyperlinkEvent event){
// Act on clicks only
if(event.getEventType()==HyperlinkEvent.EventType.ACTIVATED)
loadPage(event.getURL().toString());
}
}
);
add(new JScrollPane(display), BorderLayout.CENTER);
setSize(500, 300);
setVisible(true);
}
// Method
private void loadPage(String link){
try{
display.setPage(link);
addressBar.setText(link);
}catch(Exception ex){
System.out.println("An exception was caught.");
}
}
}
| willem-vanheemstrasystems/java-headstart | bucky/src/bucky/GUIFiftySix.java | Java | mit | 1,412 | [
30522,
7427,
10131,
2100,
1025,
12324,
9262,
1012,
22091,
2102,
1012,
1008,
1025,
12324,
9262,
1012,
22091,
2102,
1012,
2724,
1012,
1008,
1025,
12324,
9262,
2595,
1012,
7370,
1012,
1008,
1025,
12324,
9262,
2595,
1012,
7370,
1012,
2724,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// ============================================================================
//
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.daikon.i18n.package1;
/**
* test class used to test the inherited class base i18n resolver and find the location of the messages.properties see
* org.talend.daikon.i18n.ClassBasedI18nMessagesTest
*/
public class TestClass1 {
// only for tests
}
| pbailly/daikon | daikon/src/test/java/org/talend/daikon/i18n/package1/TestClass1.java | Java | apache-2.0 | 795 | [
30522,
1013,
1013,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// JWTClaimVerifierBase.h
// JWT
//
// Created by Dmitry Lobanov on 30.05.2021.
// Copyright © 2021 JWTIO. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <JWT/JWTClaimsSetsProtocols.h>
NS_ASSUME_NONNULL_BEGIN
@interface JWTClaimVerifierBase : NSObject <JWTClaimVerifierProtocol>
@end
NS_ASSUME_NONNULL_END
| lolgear/JWT | Sources/JWT/include/JWT/JWTClaimVerifierBase.h | C | mit | 338 | [
30522,
1013,
1013,
1013,
1013,
1046,
26677,
25154,
6299,
18095,
15058,
1012,
1044,
1013,
1013,
1046,
26677,
1013,
1013,
1013,
1013,
2580,
2011,
22141,
8840,
8193,
4492,
2006,
2382,
1012,
5709,
1012,
25682,
1012,
1013,
1013,
9385,
1075,
2568... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DesktopCharacter.Model.Locator;
using DesktopCharacter.ViewModel.SettingTab;
namespace DesktopCharacter.ViewModel
{
class SettingViewModel : Livet.ViewModel
{
public LauncherSettingViewModel LauncherSetting { set; private get; }
public CharacterSettingViewModel CharacterSetting { set; private get; }
public TwitterSettingViewModel TwitterSetting { set; private get; }
public CodicSettingTabViewModel CodicSettingTab { set; private get; }
public SlackSettingViewModel SlackSetting { set; private get; }
public SettingViewModel()
{
}
public void ClosedEvent()
{
TwitterSetting.OnClose();
CodicSettingTab.OnClose();
CharacterSetting.OnClose();
SlackSetting.OnClose();
LauncherSetting.OnClose();
ServiceLocator.Instance.ClearConfigBaseContext();
}
}
}
| Babumi/DesktopCharacter | DesktopCharacter/ViewModel/SettingViewModel.cs | C# | mit | 1,063 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
30524,
3415,
15327,
15363,
7507,
22648,
3334,
1012,
3193,
5302,
9247,
1063,
2465,
4292,
8584,
5302,
9247,
1024,
2444,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $title; ?></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta property="fb:app_id" content="621104771250679"/>
<meta property="og:title" content="A qui profite la péréquation ?"/>
<meta property="og:type" content="website" />
<meta property="og:image" content="<?php echo $root_url; ?>/img/fb.jpg" />
<meta property="og:description" content="FPIC,DMTO, FSRIF : à qui profite la péréquation ? Quels sont leschiffres pour votre collectivité ? Toutes les réponses dansl'application interactive du Club Finances de la Gazette des communes." />
{{ Asset::container('head')->styles() }}
{{ Asset::container('head')->scripts() }}
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="comparer">
<header class="main clearfix">
<div class="container">
<a class="title" href="/"></a>
</div>
</header>
<div class="content container">
<a class="btn back" href="<?php echo $root_url; ?>/donnees/toutes/france">Retourner aux données</a>
<div class="notice">Cet écran vous permet de comparer différentes collectivités. Faites votre sélection parmi les choix suivants.</div>
<div class="level <?php echo $niveau; ?>">
<div class="niveau btn-group" data-toggle="buttons-radio">
<a class="btn regions <?php if ($niveau == 'regions'){ echo 'active';} ?>" data-level="regions" href="<?php echo $root_url; ?>/comparer/regions">Regions</a>
<a class="btn departements <?php if ($niveau == 'departements'){ echo 'active';} ?>" data-level="departements" href="<?php echo $root_url; ?>/comparer/departements">Départements</a>
<a class="btn intercos <?php if ($niveau == 'intercos'){ echo 'active';} ?>" data-level="intercos" href="<?php echo $root_url; ?>/comparer/intercos">Intercommunalités</a>
</div>
<div class="row">
<div class="collectivite collectivite1 span4" data-collectivite="1">
<select class="interco_departements" data-collectivite="1"></select>
<select class="choose" data-collectivite="1"></select>
<div class="infos"></div>
</div>
<div class="collectivite collectivite2 span4" data-collectivite="2">
<select class="interco_departements" data-collectivite="2"></select>
<select class="choose" data-collectivite="2"></select>
<div class="infos"></div>
</div>
<div class="collectivite collectivite3 span4" data-collectivite="3">
<select class="interco_departements" data-collectivite="3"></select>
<select class="choose" data-collectivite="3"></select>
<div class="infos"></div>
</div>
</div>
</div>
</div>
<div id="unautorized" class="modal hide fade" tabindex="-1" role="dialog">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Réservé aux membres du Club Finances</h3>
</div>
<div class="modal-body">
<p>L'accès aux données Départements et Intercommunalités est réservé aux membres du Club Finances. Veuillez vous identifier ou créer un compte.</p>
</div>
<div class="modal-footer">
<button class="rollback btn pull-left" data-dismiss="modal" aria-hidden="true">Fermer</button>
<button class="identify btn btn-primary">S'identifier</button>
<button class="identify btn btn-primary register">Devenir membre</button>
</div>
</div>
<footer class="main container">
<a class="club-finance" href="http://www.lagazettedescommunes.com/rubriques/club-finances/" target="_blank"><img src="<?php echo $root_url; ?>/img/club_finance.jpg" alt="Club finance"/></a>
<script>window.appUrl = "<?php echo $root_url; ?>";</script>
{{ Asset::container('footer')->scripts() }}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40757740-1', 'angrykatze.com');
ga('send', 'pageview');
</script>
</footer>
</div>
</body>
</html>
| jameslafa/a-qui-profite-la-perequation | application/views/comparer/index.blade.php | PHP | gpl-3.0 | 4,938 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
1031,
2065,
8318,
29464,
1021,
1033,
1028,
1026,
16129,
2465,
1027,
1000,
2053,
1011,
1046,
2015,
8318,
1011,
29464,
2683,
8318,
1011,
29464,
2620,
8318,
1011,
29464,
2581,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 9 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 10 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 11 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 12 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 13 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
python tile_grab2.py -b "35.247;32.130;42.786;37.676" -z 14 -i false -d "syria_satellite" -u "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic3BhdGlhbG5ldHdvcmtzIiwiYSI6ImNpcW83Mm1kYjAxZ3hmbm5ub2llYnNuMmkifQ.an57h9ykokxNlGArcWQztw" -f jpg
| geobabbler/tile-grab | scrape2.sh | Shell | mit | 1,769 | [
30522,
18750,
14090,
1035,
6723,
2475,
1012,
1052,
2100,
1011,
1038,
1000,
3486,
1012,
23380,
1025,
3590,
1012,
7558,
1025,
4413,
1012,
6275,
2575,
1025,
4261,
1012,
6163,
2575,
1000,
1011,
1062,
1023,
1011,
30524,
1013,
13262,
1013,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/sh
#shell script saved in /usr/local/iptables
IPTABLES=/sbin/iptables
IP6TABLES=/sbin/ip6tables
MODPROBE=/sbin/modprobe
INT_NET=192.168.179.0/24
EXT_NET=10.0.1.5
SER_NET=192.168.200.192
DMZ_INTF=eth1
INT_INTF=eth2
EXT_INTF=eth0
#---------------------------------------------------------------------
echo "[+] Setting core network function..."
echo 1 > /proc/sys/net/ipv4/tcp_syncookies #阻止SYN Flooding攻击
echo 3 > /proc/sys/net/ipv4/tcp_syn_relries #缩短TCP队列占用时间
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts #忽略Icmp广播响应请求
for i in /proc/sys/net/ipv4/conf/*/{rp_filter,log_martians}; do
echo 1 > $i #记录假冒非法地址的ip包:rp_filter自动过滤掉伪造的ip地址(ethX和其对应的网段不匹配)
done
for i in /proc/sys/net/ipv4/conf/*/{accept_source_route,accept_redirects,send_redirects}; do
echo "0" > $i
done
### flush existing rules and set chain policy setting to DROP
echo "[+] Flushing existing iptables rules..."
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -X
$IPTABLES -X -t nat
$IPTABLES -Z
$IPTABLES -Z -t nat
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
### this policy does not handle IPv6 traffic except to drop it.
#
echo "[+] Disabling IPv6 traffic..."
$IP6TABLES -P INPUT DROP
$IP6TABLES -P OUTPUT DROP
$IP6TABLES -P FORWARD DROP
### load connection-tracking modules
#
$MODPROBE ip_conntrack
$MODPROBE iptable_nat
$MODPROBE ip_conntrack_ftp
$MODPROBE ip_nat_ftp
### USER chain ####
$IPTABLES -N HTTP_SRV
$IPTABLES -N FTP_SRV
$IPTABLES -N SSH_SRV
#
echo "[+] Setting up USER chain..."
##### HTTP_SRV #####
$IPTABLES -A HTTP_SRV -m recent --name web_srv --update --seconds 60 --hitcount 10 -j LOG --log-level
alert --log-prefix "HTTP attack:" #LOG记录封包,不处理封包
$IPTABLES -A HTTP_SRV -m recent --name web_srv --update --seconds 60 --hitcount 10 -j DROP #达到指定条件执行drop
$IPTABLES -A HTTP_SRV -m recent --name web_srv --set -j ACCEPT
#### FTP_SRV ####
$IPTABLES -A FTP_SRV -m recent --name ftp_srv --update --seconds 60 --hitcount 10 -j LOG --log-level
alert --log-prefix "FTP acctack:"
$IPTABLES -A FTP_SRV -m recent --name ftp_srv --update --seconds 60 --hitcount 10 -j DROP
$IPTABLES -A FTP_SRV -m recent --name ftp_srv --set -j ACCEPT
#### SSH_SRV ####
$IPTABLES -A SSH_SRV -m recent --name ssh_srv --update --seconds 60 --hitcount 3 -j LOG --log-level
alert --log-prefix "SSH attack:"
$IPTABLES -A SSH_SRV -m recent --name ssh_srv --update --seconds 60 --hitcount 3 -j DROP
$IPTABLES -A SSH_SRV -m recent --name ssh_srv --set -j ACCEPT
###### INPUT chain ######
#
echo "[+] Setting up INPUT chain..."
### state tracking rules
$IPTABLES -A INPUT -m conntrack --ctstate INVALID -j LOG --log-prefix "DROP INVALID " --log-ip-options --log-tcp-options
$IPTABLES -A INPUT -m conntrack --ctstate INVALID -j DROP
$IPTABLES -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
### anti-spoofing rules
$IPTABLES -A INPUT -i $INT_INTF ! -s $INT_NET -j LOG --log-prefix "SPOOFED PKT "
$IPTABLES -A INPUT -i $INT_INTF ! -s $INT_NET -j DROP
### ACCEPT rules
$IPTABLES -A INPUT -i $INT_INTF -p tcp -s $INT_NET --dport 22 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j DROP
### port scan ####
#$IPTABLES -A INPUT -p tcp --syn -m recent --name portscan --rcheck --seconds 60 --hitcount 10 -j LOG --log-level
#alert log-prefix "portscan:"
#$IPTABLES -A INPUT -p tcp --syn -m recent --name portscan --set -j DROP
### default INPUT LOG rule
$IPTABLES -A INPUT ! -i lo -j LOG --log-prefix "DROP " --log-ip-options --log-tcp-options
### make sure that loopback traffic is accepted
$IPTABLES -A INPUT -i lo -j ACCEPT
###### OUTPUT chain ######
#
echo "[+] Setting up OUTPUT chain..."
### state tracking rules
$IPTABLES -A OUTPUT -m conntrack --ctstate INVALID -j LOG --log-prefix "DROP INVALID " --log-ip-options --log-tcp-options
$IPTABLES -A OUTPUT -m conntrack --ctstate INVALID -j DROP
$IPTABLES -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
### ACCEPT rules for allowing connections out
$IPTABLES -A OUTPUT -p tcp --dport 21 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 25 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 43 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate NEW -j ACCEPT
#$IPTABLES -A OUTPUT -p tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 4321 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
### default OUTPUT LOG rule
$IPTABLES -A OUTPUT ! -o lo -j LOG --log-prefix "DROP " --log-ip-options --log-tcp-options
### make sure that loopback traffic is accepted
$IPTABLES -A OUTPUT -o lo -j ACCEPT
###### FORWARD chain ######
#
echo "[+] Setting up FORWARD chain..."
### state tracking rules
$IPTABLES -A FORWARD -m conntrack --ctstate INVALID -j LOG --log-prefix "DROP INVALID " --log-ip-options --log-tcp-options
$IPTABLES -A FORWARD -m conntrack --ctstate INVALID -j DROP
$IPTABLES -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
### anti-spoofing rules
$IPTABLES -A FORWARD -i $INT_INTF ! -s $INT_NET -j LOG --log-prefix "SPOOFED PKT "
$IPTABLES -A FORWARD -i $INT_INTF ! -s $INT_NET -j DROP
### ACCEPT rules
$IPTABLES -A FORWARD -p tcp --syn -i $EXT_INTF -d $SER_NET -m multiport --dports 80,443 -m conntrack --ctstate NEW -j HTTP_SRV
$IPTABLES -A FORWARD -p tcp -i $EXT_INTF -d $SER_NET --dport 21 -m conntrack --ctstate NEW -j FTP_SRV
$IPTABLES -A FORWARD -p tcp -i $INT_INTF -s $INT_NET --dport 21 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A FORWARD -p tcp -i $EXT_INTF -d $SER_NET --dport 22 -m conntrack --ctstate NEW -j SSH_SRV
$IPTABLES -A FORWARD -p tcp -i $INT_INTF -s $INT_NET --dport 22 -m conntrack --ctstate NEW -j ACCEPT
#$IPTABLES -A FORWARD -p tcp -i $INT_INTF -s $INT_NET --dport 25 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A FORWARD -p tcp -i $INT_INTF -s $INT_NET --dport 43 -m conntrack --ctstate NEW -j ACCEPT
#$IPTABLES -A FORWARD -p tcp --dport 443 -m conntrack --ctstate NEW -j HTTP_SRV
$IPTABLES -A FORWARD -p tcp -i $INT_INTF -s $INT_NET --dport 4321 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A FORWARD -p udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
$IPTABLES -A FORWARD -p icmp --icmp-type echo-request -j ACCEPT
### default LOG rule
$IPTABLES -A FORWARD ! -i lo -j LOG --log-prefix "DROP " --log-ip-options --log-tcp-options
###### NAT rules ######
#
echo "[+] Setting up NAT rules..."
$IPTABLES -t nat -A PREROUTING -p tcp --dport 80 -i $EXT_INTF -j DNAT --to $SER_NET:80
$IPTABLES -t nat -A PREROUTING -p tcp --dport 21 -i $EXT_INTF -j DNAT --to $SER_NET:21
$IPTABLES -t nat -A PREROUTING -p tcp --dport 22 -i $EXT_INTF -j DNAT --to $SER_NET:22
$IPTABLES -t nat -A PREROUTING -p tcp --dport 443 -i $EXT_INTF -j DNAT --to $SER_NET:443
#$IPTABLES -t nat -A PREROUTING -p udp --dport 53 -i $EXT_INTF -j DNAT --to $SER_NET:53
$IPTABLES -t nat -A POSTROUTING -s $INT_NET -o $EXT_INTF -j SNAT --to $EXT_NET
#$IPTABLES -t nat -A POSTROUTING -s $INT_NET -o $EXT_INTF -j MASQUERADE
###### LOG ######
#
$IPTABLES -A INPUT -i $INT_INTF -j LOG
$IPTABLES -A OUTPUT -o $EXT_INTF -j LOG
$IPTABLES -A FORWARD -i $EXT_INTF -o $DMZ_INTF -j LOG
$IPTABLES -A FORWARD -i $DMZ_INTF -o $EXT_INTF -j LOG
###### forwarding ######
#
echo "[+] Enabling IP forwarding..."
echo 1 > /proc/sys/net/ipv4/ip_forward
exit
### EOF ### | voilet7z/iptables | firewall.sh | Shell | gpl-3.0 | 7,853 | [
30522,
1001,
999,
1013,
8026,
1013,
14021,
1001,
5806,
5896,
5552,
1999,
1013,
2149,
2099,
1013,
2334,
1013,
12997,
10880,
2015,
12997,
10880,
2015,
1027,
1013,
24829,
2378,
1013,
12997,
10880,
2015,
12997,
2575,
10880,
2015,
1027,
1013,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* Inspection that reports unresolved and unused references.
* You can inject logic to mark some unused imports as used. See extension points in this package.
* @author Ilya.Kazakevich
*/
package vgrechka.phizdetsidea.phizdets.inspections.unresolvedReference; | vovagrechka/fucking-everything | phizdets/phizdets-idea/src/vgrechka/phizdetsidea/phizdets/inspections/unresolvedReference/package-info.java | Java | apache-2.0 | 871 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2297,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2013 Ambroz Bizjak
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AMBROLIB_DISTANCE_SPLITTER_H
#define AMBROLIB_DISTANCE_SPLITTER_H
#include <stdint.h>
#include <aprinter/meta/PowerOfTwo.h>
#include <aprinter/meta/ServiceUtils.h>
#include <aprinter/math/FloatTools.h>
#include <aprinter/base/Object.h>
#include <aprinter/printer/Configuration.h>
namespace APrinter {
template <typename Arg>
class DistanceSplitter {
using Context = typename Arg::Context;
using ParentObject = typename Arg::ParentObject;
using Config = typename Arg::Config;
using FpType = typename Arg::FpType;
using Params = typename Arg::Params;
public:
struct Object;
private:
using ClockTimeUnit = APRINTER_FP_CONST_EXPR(Context::Clock::time_unit);
using CMinSplitLengthRec = decltype(ExprCast<FpType>(ExprRec(Config::e(Params::MinSplitLength::i()))));
using CMaxSplitLengthRec = decltype(ExprCast<FpType>(ExprRec(Config::e(Params::MaxSplitLength::i()))));
using CSegmentsPerSecondTimeUnit = decltype(ExprCast<FpType>(Config::e(Params::SegmentsPerSecond::i()) * ClockTimeUnit()));
public:
class Splitter {
public:
void start (Context c, FpType distance, FpType base_max_v_rec, FpType time_freq_by_max_speed)
{
FpType base_segments_by_distance = APRINTER_CFG(Config, CSegmentsPerSecondTimeUnit, c) * time_freq_by_max_speed;
FpType fpcount = distance * FloatMin(APRINTER_CFG(Config, CMinSplitLengthRec, c), FloatMax(APRINTER_CFG(Config, CMaxSplitLengthRec, c), base_segments_by_distance));
if (fpcount >= FloatLdexp(FpType(1.0f), 31)) {
m_count = PowerOfTwo<uint32_t, 31>::Value;
} else {
m_count = 1 + (uint32_t)fpcount;
}
m_pos = 1;
m_max_v_rec = base_max_v_rec / m_count;
}
bool pull (Context c, FpType *out_rel_max_v_rec, FpType *out_frac)
{
*out_rel_max_v_rec = m_max_v_rec;
if (m_pos == m_count) {
return false;
}
*out_frac = (FpType)m_pos / m_count;
m_pos++;
return true;
}
private:
uint32_t m_count;
uint32_t m_pos;
FpType m_max_v_rec;
};
public:
using ConfigExprs = MakeTypeList<CMinSplitLengthRec, CMaxSplitLengthRec, CSegmentsPerSecondTimeUnit>;
struct Object : public ObjBase<DistanceSplitter, ParentObject, EmptyTypeList> {};
};
APRINTER_ALIAS_STRUCT_EXT(DistanceSplitterService, (
APRINTER_AS_TYPE(MinSplitLength),
APRINTER_AS_TYPE(MaxSplitLength),
APRINTER_AS_TYPE(SegmentsPerSecond)
), (
APRINTER_ALIAS_STRUCT_EXT(Splitter, (
APRINTER_AS_TYPE(Context),
APRINTER_AS_TYPE(ParentObject),
APRINTER_AS_TYPE(Config),
APRINTER_AS_TYPE(FpType)
), (
using Params = DistanceSplitterService;
APRINTER_DEF_INSTANCE(Splitter, DistanceSplitter)
))
))
}
#endif
| ambrop72/aprinter | aprinter/printer/transform/DistanceSplitter.h | C | bsd-2-clause | 4,306 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
2572,
12618,
2480,
12170,
2480,
18317,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<title>try chat(JAX-RS)</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="../webjars/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="../resources/css/style.css" />
<script type='text/javascript' src="../webjars/jquery/2.1.1/jquery.min.js"></script>
<script type='text/javascript' src="../webjars/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script type='text/javascript' src="../webjars/vue/0.11.0/vue.min.js"></script>
<script type='text/javascript' src="../resources/js/common.js"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>サンプルチャット JAX-RS</h1>
<form id="form" class="login" v-on="submit:join">
<span id="error" >{{error_message}}</span>
<div id="nameFg" class="form-group {{name_error_css}}">
<label for="name" class="control-label">名前 <span>{{name_message}}</span></label>
<input id="name" name="name" placeholder="表示名を入力"
type="text" class="form-control" v-model="name" />
</div>
<div id="emailFg" class="form-group {{email_error_css}}">
<label for="email" class="control-label ">Gravatarメールアドレス <span>{{email_message}}</span></label>
<input id="email" name="email" placeholder="Gravatarのイメージを使用する場合入力" type="email"
class="form-control" v-model="email" />
</div>
<input type="submit" value="join" class="btn btn-default" />
</form>
<div>
<a href="../" class="btn btn-link">JSF版へ</a>
</div>
</div>
</div>
<script type='text/javascript' src="../resources/js/vm_index.js"></script>
</body>
</html>
| enterprisegeeks/try_java_ee7 | try_java_ee7-web/src/main/webapp/rest/index.html | HTML | apache-2.0 | 2,108 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
3046,
11834,
1006,
13118,
1011,
12667,
1007,
1026,
1013,
2516,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Comp355Component } from './comp-355.component';
describe('Comp355Component', () => {
let component: Comp355Component;
let fixture: ComponentFixture<Comp355Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ Comp355Component ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(Comp355Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
| angular/angular-cli-stress-test | src/app/components/comp-355/comp-355.component.spec.ts | TypeScript | mit | 840 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
1008,
9385,
8224,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
2019,
10210,
1011,
2806,
6105,
2008,
2064,
2022,
1008,
2179,
1999,
1996,
6105,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/////////////////////////////////////////////////////////////////////////////
// Name: wx/os2/frame.h
// Purpose: wxFrame class
// Author: David Webster
// Modified by:
// Created: 10/27/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FRAME_H_
#define _WX_FRAME_H_
//
// Get the default resource ID's for frames
//
#include "wx/os2/wxrsc.h"
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
public:
// construction
wxFrame() { Init(); }
wxFrame( wxWindow* pParent
,wxWindowID vId
,const wxString& rsTitle
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = wxDEFAULT_FRAME_STYLE
,const wxString& rsName = wxFrameNameStr
)
{
Init();
Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
}
bool Create( wxWindow* pParent
,wxWindowID vId
,const wxString& rsTitle
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = wxDEFAULT_FRAME_STYLE
,const wxString& rsName = wxFrameNameStr
);
virtual ~wxFrame();
// implement base class pure virtuals
#if wxUSE_MENUS_NATIVE
virtual void SetMenuBar(wxMenuBar* pMenubar);
#endif
virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL
);
// implementation only from now on
// -------------------------------
virtual void Raise(void);
// event handlers
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
// Toolbar
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar( long lStyle = -1
,wxWindowID vId = -1
,const wxString& rsName = wxToolBarNameStr
);
virtual wxToolBar* OnCreateToolBar( long lStyle
,wxWindowID vId
,const wxString& rsName
);
virtual void PositionToolBar(void);
#endif // wxUSE_TOOLBAR
// Status bar
#if wxUSE_STATUSBAR
virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1
,long lStyle = wxSTB_DEFAULT_STYLE
,wxWindowID vId = 0
,const wxString& rsName = wxStatusLineNameStr
);
virtual void PositionStatusBar(void);
// Hint to tell framework which status bar to use: the default is to use
// native one for the platforms which support it (Win32), the generic one
// otherwise
// TODO: should this go into a wxFrameworkSettings class perhaps?
static void UseNativeStatusBar(bool bUseNative)
{ m_bUseNativeStatusBar = bUseNative; };
static bool UsesNativeStatusBar()
{ return m_bUseNativeStatusBar; };
#endif // wxUSE_STATUSBAR
WXHMENU GetWinMenu() const { return m_hMenu; }
// Returns the origin of client area (may be different from (0,0) if the
// frame has a toolbar)
virtual wxPoint GetClientAreaOrigin() const;
// event handlers
bool HandlePaint(void);
bool HandleSize( int nX
,int nY
,WXUINT uFlag
);
bool HandleCommand( WXWORD wId
,WXWORD wCmd
,WXHWND wControl
);
bool HandleMenuSelect( WXWORD wItem
,WXWORD wFlags
,WXHMENU hMenu
);
// tooltip management
#if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
#endif // tooltips
void SetClient(WXHWND c_Hwnd);
void SetClient(wxWindow* c_Window);
wxWindow *GetClient();
friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
protected:
// common part of all ctors
void Init(void);
virtual WXHICON GetDefaultIcon(void) const;
// override base class virtuals
virtual void DoGetClientSize( int* pWidth
,int* pHeight
) const;
virtual void DoSetClientSize( int nWidth
,int nWeight
);
inline virtual bool IsMDIChild(void) const { return FALSE; }
#if wxUSE_MENUS_NATIVE
// helper
void DetachMenuBar(void);
// perform MSW-specific action when menubar is changed
virtual void AttachMenuBar(wxMenuBar* pMenubar);
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar(void);
#endif
// propagate our state change to all child frames
void IconizeChildFrames(bool bIconize);
// we add menu bar accel processing
bool OS2TranslateMessage(WXMSG* pMsg);
// window proc for the frames
MRESULT OS2WindowProc( WXUINT uMessage
,WXWPARAM wParam
,WXLPARAM lParam
);
bool m_bIconized;
WXHICON m_hDefaultIcon;
#if wxUSE_STATUSBAR
static bool m_bUseNativeStatusBar;
#endif // wxUSE_STATUSBAR
// Data to save/restore when calling ShowFullScreen
long m_lFsStyle; // Passed to ShowFullScreen
wxRect m_vFsOldSize;
long m_lFsOldWindowStyle;
int m_nFsStatusBarFields; // 0 for no status bar
int m_nFsStatusBarHeight;
int m_nFsToolBarHeight;
bool m_bFsIsMaximized;
bool m_bFsIsShowing;
bool m_bWasMinimized;
bool m_bIsShown;
private:
#if wxUSE_TOOLTIPS
WXHWND m_hWndToolTip;
#endif // tooltips
//
// Handles to child windows of the Frame, and the frame itself,
// that we don't have child objects for (m_hWnd in wxWindow is the
// handle of the Frame's client window!
//
WXHWND m_hTitleBar;
WXHWND m_hHScroll;
WXHWND m_hVScroll;
//
// Swp structures for various client data
// DW: Better off in attached RefData?
//
SWP m_vSwpTitleBar;
SWP m_vSwpMenuBar;
SWP m_vSwpHScroll;
SWP m_vSwpVScroll;
SWP m_vSwpStatusBar;
SWP m_vSwpToolBar;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxFrame)
};
MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
#endif
// _WX_FRAME_H_
| p0sixspwn/p0sixspwn | include/wxWidgets-2.9.2/include/wx/os2/frame.h | C | gpl-3.0 | 7,760 | [
30522,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*-------------------------------------------------------------------------
* Copyright (c) 2012,2013, Alex Athanasopoulos. All Rights Reserved.
* alex@melato.org
*-------------------------------------------------------------------------
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*-------------------------------------------------------------------------
*/
package org.melato.geometry.util;
public class Sequencer {
private int[] array;
private boolean[] visited;
public Sequencer(int[] array) {
super();
this.array = array;
visited = new boolean[array.length];
}
public void findSequence(int start, int end, Sequence sequence) {
int a = array[start];
sequence.start = start;
sequence.last = start;
sequence.length = 1;
int j = start + 1;
for( ; j < end ;j++ ) {
int b = array[j];
if ( b != -1 && ! visited[j]) {
if ( b == a + 1 ) {
a = b;
sequence.length++;
} else if ( b != a ) {
continue;
}
sequence.last = j;
visited[j] = true;
}
}
System.out.println( "findSequence start=" + start + " end=" + end + " sequence=" + sequence);
}
private void filter() {
System.out.println( "approaches sorted: " + toString(array, 0, array.length));
removeOutOfOrder(0, array.length );
//System.out.println( "approaches in-order: " + toString(approaches, 0, approaches.length));
removeDuplicates();
System.out.println( "approaches unique: " + toString(array, 0, array.length));
}
/** remove array so that the remaining array are in non-decreasing order.
* array are removed by setting them to -1.
* */
private void removeOutOfOrder(int start, int end) {
if ( end <= start )
return;
for( int i = start; i < end; i++ ) {
visited[i] = false;
}
Sequence bestSequence = null;
Sequence sequence = new Sequence();
// find the longest sub-sequence of sequential or equal array
for( int i = start; i < end; i++ ) {
int a = array[i];
if ( a != -1 ) {
//System.out.println( "i=" + i + " visited=" + a.visited);
if ( visited[i] )
continue;
findSequence(i, end, sequence);
if ( bestSequence == null || sequence.length > bestSequence.length ) {
bestSequence = sequence;
sequence = new Sequence();
}
}
}
if ( bestSequence == null ) {
// there is nothing
return;
}
System.out.println( "best sequence: " + bestSequence);
bestSequence.clearInside(array);
bestSequence.clearLeft(array, start);
bestSequence.clearRight(array, end);
//System.out.println( "a: " + toString( approaches, 0, approaches.length ));
// do the same on each side
removeOutOfOrder( start, bestSequence.start);
removeOutOfOrder( bestSequence.last + 1, end );
//System.out.println( "b: " + toString( approaches, 0, approaches.length ));
}
private void removeDuplicates() {
// keep the last position that has the lowest element
int item = -1;
int lastIndex = -1;
int i = 0;
for( ; i < array.length; i++ ) {
int a = array[i];
if ( a != -1 ) {
if ( item == -1 ) {
item = a;
lastIndex = i;
} else if ( item == a ) {
array[lastIndex] = -1;
lastIndex = i;
} else {
item = a;
i++;
break;
}
}
}
// for subsequent array, keep the first one among equal elements
for( ; i < array.length; i++ ) {
int a = array[i];
if ( a != -1 ) {
if ( item == a ) {
array[i] = -1;
} else {
item = a;
}
}
}
}
public static String toString( int[] array, int start, int end ) {
StringBuilder buf = new StringBuilder();
buf.append( "[");
int count = 0;
for( int i = start; i < end; i++ ) {
int a = array[i];
if ( a != -1 ) {
if ( count > 0 ) {
buf.append( " " );
}
count++;
buf.append( String.valueOf(a) );
}
}
buf.append("]");
return buf.toString();
}
/** Find a subsequence of increasing items by setting the remaining items to -1. */
public static void filter(int[] items) {
Sequencer sequencer = new Sequencer(items);
sequencer.filter();
}
}
| melato/next-bus | src/org/melato/geometry/util/Sequencer.java | Java | gpl-3.0 | 5,006 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Model\Memory;
class User
{
private $id;
private $name;
public function getId()
{
return $this->id;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
}
| vespolina/molino | tests/Model/Memory/User.php | PHP | mit | 299 | [
30522,
1026,
1029,
25718,
3415,
15327,
2944,
1032,
3638,
1025,
2465,
5310,
1063,
2797,
1002,
8909,
1025,
2797,
1002,
2171,
1025,
2270,
3853,
2131,
3593,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
8909,
1025,
1065,
2270,
3853,
2275,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
-- main.lua
-- Implements the plugin entrypoint (in this case the entire plugin)
-- Global variables:
local g_Plugin = nil
local g_PluginFolder = ""
local g_Stats = {}
local g_TrackedPages = {}
local function LoadAPIFiles(a_Folder, a_DstTable)
assert(type(a_Folder) == "string")
assert(type(a_DstTable) == "table")
local Folder = g_PluginFolder .. a_Folder;
for _, fnam in ipairs(cFile:GetFolderContents(Folder)) do
local FileName = Folder .. fnam;
-- We only want .lua files from the folder:
if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then
local TablesFn, Err = loadfile(FileName);
if (type(TablesFn) ~= "function") then
LOGWARNING("Cannot load API descriptions from " .. FileName .. ", Lua error '" .. Err .. "'.");
else
local Tables = TablesFn();
if (type(Tables) ~= "table") then
LOGWARNING("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").");
break
end
for k, cls in pairs(Tables) do
a_DstTable[k] = cls;
end
end -- if (TablesFn)
end -- if (is lua file)
end -- for fnam - Folder[]
end
local function CreateAPITables()
--[[
We want an API table of the following shape:
local API = {
{
Name = "cCuboid",
Functions = {
{Name = "Sort"},
{Name = "IsInside"}
},
Constants = {
},
Variables = {
},
Descendants = {}, -- Will be filled by ReadDescriptions(), array of class APIs (references to other member in the tree)
},
{
Name = "cBlockArea",
Functions = {
{Name = "Clear"},
{Name = "CopyFrom"},
...
},
Constants = {
{Name = "baTypes", Value = 0},
{Name = "baMetas", Value = 1},
...
},
Variables = {
},
...
},
cCuboid = {} -- Each array item also has the map item by its name
};
local Globals = {
Functions = {
...
},
Constants = {
...
}
};
--]]
local Globals = {Functions = {}, Constants = {}, Variables = {}, Descendants = {}};
local API = {};
local function Add(a_APIContainer, a_ObjName, a_ObjValue)
if (type(a_ObjValue) == "function") then
table.insert(a_APIContainer.Functions, {Name = a_ObjName});
elseif (
(type(a_ObjValue) == "number") or
(type(a_ObjValue) == "string")
) then
table.insert(a_APIContainer.Constants, {Name = a_ObjName, Value = a_ObjValue});
end
end
local function ParseClass(a_ClassName, a_ClassObj)
local res = {Name = a_ClassName, Functions = {}, Constants = {}, Variables = {}, Descendants = {}};
-- Add functions and constants:
for i, v in pairs(a_ClassObj) do
Add(res, i, v);
end
-- Member variables:
local SetField = a_ClassObj[".set"] or {};
if ((a_ClassObj[".get"] ~= nil) and (type(a_ClassObj[".get"]) == "table")) then
for k in pairs(a_ClassObj[".get"]) do
if (SetField[k] == nil) then
-- It is a read-only variable, add it as a constant:
table.insert(res.Constants, {Name = k, Value = ""});
else
-- It is a read-write variable, add it as a variable:
table.insert(res.Variables, { Name = k });
end
end
end
return res;
end
for i, v in pairs(_G) do
if (
(v ~= _G) and -- don't want the global namespace
(v ~= _G.packages) and -- don't want any packages
(v ~= _G[".get"]) and
(v ~= g_APIDesc)
) then
if (type(v) == "table") then
local cls = ParseClass(i, v)
table.insert(API, cls);
API[cls.Name] = cls
else
Add(Globals, i, v);
end
end
end
return API, Globals;
end
local function WriteArticles(f)
f:write([[
<a name="articles"><h2>Articles</h2></a>
<p>The following articles provide various extra information on plugin development</p>
<ul>
]]);
for _, extra in ipairs(g_APIDesc.ExtraPages) do
local SrcFileName = g_PluginFolder .. "/" .. extra.FileName;
if (cFile:Exists(SrcFileName)) then
local DstFileName = "API/" .. extra.FileName;
if (cFile:Exists(DstFileName)) then
cFile:Delete(DstFileName);
end
cFile:Copy(SrcFileName, DstFileName);
f:write("<li><a href=\"" .. extra.FileName .. "\">" .. extra.Title .. "</a></li>\n");
else
f:write("<li>" .. extra.Title .. " <i>(file is missing)</i></li>\n");
end
end
f:write("</ul><hr />");
end
-- Make a link out of anything with the special linkifying syntax {{link|title}}
local function LinkifyString(a_String, a_Referrer)
assert(a_Referrer ~= nil);
assert(a_Referrer ~= "");
--- Adds a page to the list of tracked pages (to be checked for existence at the end)
local function AddTrackedPage(a_PageName)
local Pg = (g_TrackedPages[a_PageName] or {});
table.insert(Pg, a_Referrer);
g_TrackedPages[a_PageName] = Pg;
end
--- Creates the HTML for the specified link and title
local function CreateLink(Link, Title)
if (Link:sub(1, 7) == "http://") then
-- The link is a full absolute URL, do not modify, do not track:
return "<a href=\"" .. Link .. "\">" .. Title .. "</a>";
end
local idxHash = Link:find("#");
if (idxHash ~= nil) then
-- The link contains an anchor:
if (idxHash == 1) then
-- Anchor in the current page, no need to track:
return "<a href=\"" .. Link .. "\">" .. Title .. "</a>";
end
-- Anchor in another page:
local PageName = Link:sub(1, idxHash - 1);
AddTrackedPage(PageName);
return "<a href=\"" .. PageName .. ".html#" .. Link:sub(idxHash + 1) .. "\">" .. Title .. "</a>";
end
-- Link without anchor:
AddTrackedPage(Link);
return "<a href=\"" .. Link .. ".html\">" .. Title .. "</a>";
end
-- Linkify the strings using the CreateLink() function:
local txt = a_String:gsub("{{([^|}]*)|([^}]*)}}", CreateLink) -- {{link|title}}
txt = txt:gsub("{{([^|}]*)}}", -- {{LinkAndTitle}}
function(LinkAndTitle)
local idxHash = LinkAndTitle:find("#");
if (idxHash ~= nil) then
-- The LinkAndTitle contains a hash, remove the hashed part from the title:
return CreateLink(LinkAndTitle, LinkAndTitle:sub(1, idxHash - 1));
end
return CreateLink(LinkAndTitle, LinkAndTitle);
end
);
return txt;
end
local function WriteHtmlHook(a_Hook, a_HookNav)
local fnam = "API/" .. a_Hook.DefaultFnName .. ".html";
local f, error = io.open(fnam, "w");
if (f == nil) then
LOG("Cannot write \"" .. fnam .. "\": \"" .. error .. "\".");
return;
end
local HookName = a_Hook.DefaultFnName;
f:write([[<!DOCTYPE html><html>
<head>
<title>MCServer API - ]], HookName, [[ Hook</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="prettify.css" />
<script src="prettify.js"></script>
<script src="lang-lua.js"></script>
</head>
<body>
<div id="content">
<header>
<h1>]], a_Hook.Name, [[</h1>
<hr />
</header>
<table><tr><td style="vertical-align: top;">
Index:<br />
<a href='index.html#articles'>Articles</a><br />
<a href='index.html#classes'>Classes</a><br />
<a href='index.html#hooks'>Hooks</a><br />
<br />
Quick navigation:<br />
]]);
f:write(a_HookNav);
f:write([[
</td><td style="vertical-align: top;"><p>
]]);
f:write(LinkifyString(a_Hook.Desc, HookName));
f:write("</p>\n<hr /><h1>Callback function</h1>\n<p>The default name for the callback function is ");
f:write(a_Hook.DefaultFnName, ". It has the following signature:\n");
f:write("<pre class=\"prettyprint lang-lua\">function ", HookName, "(");
if (a_Hook.Params == nil) then
a_Hook.Params = {};
end
for i, param in ipairs(a_Hook.Params) do
if (i > 1) then
f:write(", ");
end
f:write(param.Name);
end
f:write(")</pre>\n<hr /><h1>Parameters:</h1>\n<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
for _, param in ipairs(a_Hook.Params) do
f:write("<tr><td>", param.Name, "</td><td>", LinkifyString(param.Type, HookName), "</td><td>", LinkifyString(param.Notes, HookName), "</td></tr>\n");
end
f:write("</table>\n<p>" .. (a_Hook.Returns or "") .. "</p>\n\n");
f:write([[<hr /><h1>Code examples</h1><h2>Registering the callback</h2>]]);
f:write("<pre class=\"prettyprint lang-lua\">\n");
f:write([[cPluginManager:AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
f:write("</pre>\n\n");
local Examples = a_Hook.CodeExamples or {};
for _, example in ipairs(Examples) do
f:write("<h2>", (example.Title or "<i>missing Title</i>"), "</h2>\n");
f:write("<p>", (example.Desc or "<i>missing Desc</i>"), "</p>\n");
f:write("<pre class=\"prettyprint lang-lua\">", (example.Code or "<i>missing Code</i>"), "\n</pre>\n\n");
end
f:write([[</td></tr></table></div><script>prettyPrint();</script></body></html>]]);
f:close();
end
local function WriteHooks(f, a_Hooks, a_UndocumentedHooks, a_HookNav)
f:write([[
<a name="hooks"><h2>Hooks</h2></a>
<p>
A plugin can register to be called whenever an "interesting event" occurs. It does so by calling
<a href="cPluginManager.html">cPluginManager</a>'s AddHook() function and implementing a callback
function to handle the event.</p>
<p>
A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it
from them. This is determined by the return value from the hook callback function. If the function
returns false or no value, the event is propagated further. If the function returns true, the processing
is stopped, no other plugin receives the notification (and possibly MCServer disables the default
behavior for the event). See each hook's details to see the exact behavior.</p>
<table>
<tr>
<th>Hook name</th>
<th>Called when</th>
</tr>
]]);
for _, hook in ipairs(a_Hooks) do
if (hook.DefaultFnName == nil) then
-- The hook is not documented yet
f:write(" <tr>\n <td>" .. hook.Name .. "</td>\n <td><i>(No documentation yet)</i></td>\n </tr>\n");
table.insert(a_UndocumentedHooks, hook.Name);
else
f:write(" <tr>\n <td><a href=\"" .. hook.DefaultFnName .. ".html\">" .. hook.Name .. "</a></td>\n <td>" .. LinkifyString(hook.CalledWhen, hook.Name) .. "</td>\n </tr>\n");
WriteHtmlHook(hook, a_HookNav);
end
end
f:write([[
</table>
<hr />
]]);
end
local function ReadDescriptions(a_API)
-- Returns true if the class of the specified name is to be ignored
local function IsClassIgnored(a_ClsName)
if (g_APIDesc.IgnoreClasses == nil) then
return false;
end
for _, name in ipairs(g_APIDesc.IgnoreClasses) do
if (a_ClsName:match(name)) then
return true;
end
end
return false;
end
-- Returns true if the function is to be ignored
local function IsFunctionIgnored(a_ClassName, a_FnName)
if (g_APIDesc.IgnoreFunctions == nil) then
return false;
end
if (((g_APIDesc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then
-- The function is documented, don't ignore
return false;
end
local FnName = a_ClassName .. "." .. a_FnName;
for _, name in ipairs(g_APIDesc.IgnoreFunctions) do
if (FnName:match(name)) then
return true;
end
end
return false;
end
-- Returns true if the constant (specified by its fully qualified name) is to be ignored
local function IsConstantIgnored(a_CnName)
if (g_APIDesc.IgnoreConstants == nil) then
return false;
end;
for _, name in ipairs(g_APIDesc.IgnoreConstants) do
if (a_CnName:match(name)) then
return true;
end
end
return false;
end
-- Returns true if the member variable (specified by its fully qualified name) is to be ignored
local function IsVariableIgnored(a_VarName)
if (g_APIDesc.IgnoreVariables == nil) then
return false;
end;
for _, name in ipairs(g_APIDesc.IgnoreVariables) do
if (a_VarName:match(name)) then
return true;
end
end
return false;
end
-- Remove ignored classes from a_API:
local APICopy = {};
for _, cls in ipairs(a_API) do
if not(IsClassIgnored(cls.Name)) then
table.insert(APICopy, cls);
end
end
for i = 1, #a_API do
a_API[i] = APICopy[i];
end;
-- Process the documentation for each class:
for _, cls in ipairs(a_API) do
-- Initialize default values for each class:
cls.ConstantGroups = {};
cls.NumConstantsInGroups = 0;
cls.NumConstantsInGroupsForDescendants = 0;
-- Rename special functions:
for _, fn in ipairs(cls.Functions) do
if (fn.Name == ".call") then
fn.DocID = "constructor";
fn.Name = "() <i>(constructor)</i>";
elseif (fn.Name == ".add") then
fn.DocID = "operator_plus";
fn.Name = "<i>operator +</i>";
elseif (fn.Name == ".div") then
fn.DocID = "operator_div";
fn.Name = "<i>operator /</i>";
elseif (fn.Name == ".mul") then
fn.DocID = "operator_mul";
fn.Name = "<i>operator *</i>";
elseif (fn.Name == ".sub") then
fn.DocID = "operator_sub";
fn.Name = "<i>operator -</i>";
elseif (fn.Name == ".eq") then
fn.DocID = "operator_eq";
fn.Name = "<i>operator ==</i>";
end
end
local APIDesc = g_APIDesc.Classes[cls.Name];
if (APIDesc ~= nil) then
APIDesc.IsExported = true;
cls.Desc = APIDesc.Desc;
cls.AdditionalInfo = APIDesc.AdditionalInfo;
-- Process inheritance:
if (APIDesc.Inherits ~= nil) then
for _, icls in ipairs(a_API) do
if (icls.Name == APIDesc.Inherits) then
table.insert(icls.Descendants, cls);
cls.Inherits = icls;
end
end
end
cls.UndocumentedFunctions = {}; -- This will contain names of all the functions that are not documented
cls.UndocumentedConstants = {}; -- This will contain names of all the constants that are not documented
cls.UndocumentedVariables = {}; -- This will contain names of all the variables that are not documented
local DoxyFunctions = {}; -- This will contain all the API functions together with their documentation
local function AddFunction(a_Name, a_Params, a_Return, a_Notes)
table.insert(DoxyFunctions, {Name = a_Name, Params = a_Params, Return = a_Return, Notes = a_Notes});
end
if (APIDesc.Functions ~= nil) then
-- Assign function descriptions:
for _, func in ipairs(cls.Functions) do
local FnName = func.DocID or func.Name;
local FnDesc = APIDesc.Functions[FnName];
if (FnDesc == nil) then
-- No description for this API function
AddFunction(func.Name);
if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
else
-- Description is available
if (FnDesc[1] == nil) then
-- Single function definition
AddFunction(func.Name, FnDesc.Params, FnDesc.Return, FnDesc.Notes);
else
-- Multiple function overloads
for _, desc in ipairs(FnDesc) do
AddFunction(func.Name, desc.Params, desc.Return, desc.Notes);
end -- for k, desc - FnDesc[]
end
FnDesc.IsExported = true;
end
end -- for j, func
-- Replace functions with their described and overload-expanded versions:
cls.Functions = DoxyFunctions;
else -- if (APIDesc.Functions ~= nil)
for _, func in ipairs(cls.Functions) do
local FnName = func.DocID or func.Name;
if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
end
end -- if (APIDesc.Functions ~= nil)
if (APIDesc.Constants ~= nil) then
-- Assign constant descriptions:
for _, cons in ipairs(cls.Constants) do
local CnDesc = APIDesc.Constants[cons.Name];
if (CnDesc == nil) then
-- Not documented
if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
table.insert(cls.UndocumentedConstants, cons.Name);
end
else
cons.Notes = CnDesc.Notes;
CnDesc.IsExported = true;
end
end -- for j, cons
else -- if (APIDesc.Constants ~= nil)
for _, cons in ipairs(cls.Constants) do
if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
table.insert(cls.UndocumentedConstants, cons.Name);
end
end
end -- else if (APIDesc.Constants ~= nil)
-- Assign member variables' descriptions:
if (APIDesc.Variables ~= nil) then
for _, var in ipairs(cls.Variables) do
local VarDesc = APIDesc.Variables[var.Name];
if (VarDesc == nil) then
-- Not documented
if not(IsVariableIgnored(cls.Name .. "." .. var.Name)) then
table.insert(cls.UndocumentedVariables, var.Name);
end
else
-- Copy all documentation:
for k, v in pairs(VarDesc) do
var[k] = v
end
end
end -- for j, var
else -- if (APIDesc.Variables ~= nil)
for _, var in ipairs(cls.Variables) do
if not(IsVariableIgnored(cls.Name .. "." .. var.Name)) then
table.insert(cls.UndocumentedVariables, var.Name);
end
end
end -- else if (APIDesc.Variables ~= nil)
if (APIDesc.ConstantGroups ~= nil) then
-- Create links between the constants and the groups:
local NumInGroups = 0;
local NumInDescendantGroups = 0;
for j, group in pairs(APIDesc.ConstantGroups) do
group.Name = j;
group.Constants = {};
if (type(group.Include) == "string") then
group.Include = { group.Include };
end
local NumInGroup = 0;
for _, incl in ipairs(group.Include or {}) do
for _, cons in ipairs(cls.Constants) do
if ((cons.Group == nil) and cons.Name:match(incl)) then
cons.Group = group;
table.insert(group.Constants, cons);
NumInGroup = NumInGroup + 1;
end
end -- for cidx - cls.Constants[]
end -- for idx - group.Include[]
NumInGroups = NumInGroups + NumInGroup;
if (group.ShowInDescendants) then
NumInDescendantGroups = NumInDescendantGroups + NumInGroup;
end
-- Sort the constants:
table.sort(group.Constants,
function(c1, c2)
return (c1.Name < c2.Name);
end
);
end -- for j - APIDesc.ConstantGroups[]
cls.ConstantGroups = APIDesc.ConstantGroups;
cls.NumConstantsInGroups = NumInGroups;
cls.NumConstantsInGroupsForDescendants = NumInDescendantGroups;
-- Remove grouped constants from the normal list:
local NewConstants = {};
for _, cons in ipairs(cls.Constants) do
if (cons.Group == nil) then
table.insert(NewConstants, cons);
end
end
cls.Constants = NewConstants;
end -- if (ConstantGroups ~= nil)
else -- if (APIDesc ~= nil)
-- Class is not documented at all, add all its members to Undocumented lists:
cls.UndocumentedFunctions = {};
cls.UndocumentedConstants = {};
cls.UndocumentedVariables = {};
cls.Variables = cls.Variables or {};
g_Stats.NumUndocumentedClasses = g_Stats.NumUndocumentedClasses + 1;
for _, func in ipairs(cls.Functions) do
local FnName = func.DocID or func.Name;
if not(IsFunctionIgnored(cls.Name, FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
end -- for j, func - cls.Functions[]
for _, cons in ipairs(cls.Constants) do
if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
table.insert(cls.UndocumentedConstants, cons.Name);
end
end -- for j, cons - cls.Constants[]
for _, var in ipairs(cls.Variables) do
if not(IsConstantIgnored(cls.Name .. "." .. var.Name)) then
table.insert(cls.UndocumentedVariables, var.Name);
end
end -- for j, var - cls.Variables[]
end -- else if (APIDesc ~= nil)
-- Remove ignored functions:
local NewFunctions = {};
for _, fn in ipairs(cls.Functions) do
if (not(IsFunctionIgnored(cls.Name, fn.Name))) then
table.insert(NewFunctions, fn);
end
end -- for j, fn
cls.Functions = NewFunctions;
-- Sort the functions (they may have been renamed):
table.sort(cls.Functions,
function(f1, f2)
if (f1.Name == f2.Name) then
-- Same name, either comparing the same function to itself, or two overloads, in which case compare the params
if ((f1.Params == nil) or (f2.Params == nil)) then
return 0;
end
return (f1.Params < f2.Params);
end
return (f1.Name < f2.Name);
end
);
-- Remove ignored constants:
local NewConstants = {};
for _, cn in ipairs(cls.Constants) do
if (not(IsFunctionIgnored(cls.Name, cn.Name))) then
table.insert(NewConstants, cn);
end
end -- for j, cn
cls.Constants = NewConstants;
-- Sort the constants:
table.sort(cls.Constants,
function(c1, c2)
return (c1.Name < c2.Name);
end
);
-- Remove ignored member variables:
local NewVariables = {};
for _, var in ipairs(cls.Variables) do
if (not(IsVariableIgnored(cls.Name .. "." .. var.Name))) then
table.insert(NewVariables, var);
end
end -- for j, var
cls.Variables = NewVariables;
-- Sort the member variables:
table.sort(cls.Variables,
function(v1, v2)
return (v1.Name < v2.Name);
end
);
end -- for i, cls
-- Sort the descendants lists:
for _, cls in ipairs(a_API) do
table.sort(cls.Descendants,
function(c1, c2)
return (c1.Name < c2.Name);
end
);
end -- for i, cls
end
local function ReadHooks(a_Hooks)
--[[
a_Hooks = {
{ Name = "HOOK_1"},
{ Name = "HOOK_2"},
...
};
We want to add hook descriptions to each hook in this array
--]]
for _, hook in ipairs(a_Hooks) do
local HookDesc = g_APIDesc.Hooks[hook.Name];
if (HookDesc ~= nil) then
for key, val in pairs(HookDesc) do
hook[key] = val;
end
end
end -- for i, hook - a_Hooks[]
g_Stats.NumTotalHooks = #a_Hooks;
end
local function WriteHtmlClass(a_ClassAPI, a_ClassMenu)
local cf, err = io.open("API/" .. a_ClassAPI.Name .. ".html", "w");
if (cf == nil) then
LOGINFO("Cannot write HTML API for class " .. a_ClassAPI.Name .. ": " .. err)
return;
end
-- Writes a table containing all functions in the specified list, with an optional "inherited from" header when a_InheritedName is valid
local function WriteFunctions(a_Functions, a_InheritedName)
if (#a_Functions == 0) then
return;
end
if (a_InheritedName ~= nil) then
cf:write("<h2>Functions inherited from ", a_InheritedName, "</h2>\n");
end
cf:write("<table>\n<tr><th>Name</th><th>Parameters</th><th>Return value</th><th>Notes</th></tr>\n");
for _, func in ipairs(a_Functions) do
cf:write("<tr><td>", func.Name, "</td>\n");
cf:write("<td>", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
cf:write("<td>", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
cf:write("<td>", LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td></tr>\n");
end
cf:write("</table>\n");
end
local function WriteConstantTable(a_Constants, a_Source)
cf:write("<table>\n<tr><th>Name</th><th>Value</th><th>Notes</th></tr>\n");
for _, cons in ipairs(a_Constants) do
cf:write("<tr><td>", cons.Name, "</td>\n");
cf:write("<td>", cons.Value, "</td>\n");
cf:write("<td>", LinkifyString(cons.Notes or "", a_Source), "</td></tr>\n");
end
cf:write("</table>\n\n");
end
local function WriteConstants(a_Constants, a_ConstantGroups, a_NumConstantGroups, a_InheritedName)
if ((#a_Constants == 0) and (a_NumConstantGroups == 0)) then
return;
end
local Source = a_ClassAPI.Name
if (a_InheritedName ~= nil) then
cf:write("<h2>Constants inherited from ", a_InheritedName, "</h2>\n");
Source = a_InheritedName;
end
if (#a_Constants > 0) then
WriteConstantTable(a_Constants, Source);
end
for _, group in pairs(a_ConstantGroups) do
if ((a_InheritedName == nil) or group.ShowInDescendants) then
cf:write("<a name='", group.Name, "'><p>");
cf:write(LinkifyString(group.TextBefore or "", Source));
WriteConstantTable(group.Constants, a_InheritedName or a_ClassAPI.Name);
cf:write(LinkifyString(group.TextAfter or "", Source), "</a></p>");
end
end
end
local function WriteVariables(a_Variables, a_InheritedName)
if (#a_Variables == 0) then
return;
end
if (a_InheritedName ~= nil) then
cf:write("<h2>Member variables inherited from ", a_InheritedName, "</h2>\n");
end
cf:write("<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
for _, var in ipairs(a_Variables) do
cf:write("<tr><td>", var.Name, "</td>\n");
cf:write("<td>", LinkifyString(var.Type or "<i>(undocumented)</i>", a_InheritedName or a_ClassAPI.Name), "</td>\n");
cf:write("<td>", LinkifyString(var.Notes or "", a_InheritedName or a_ClassAPI.Name), "</td>\n </tr>\n");
end
cf:write("</table>\n\n");
end
local function WriteDescendants(a_Descendants)
if (#a_Descendants == 0) then
return;
end
cf:write("<ul>");
for _, desc in ipairs(a_Descendants) do
cf:write("<li><a href=\"", desc.Name, ".html\">", desc.Name, "</a>");
WriteDescendants(desc.Descendants);
cf:write("</li>\n");
end
cf:write("</ul>\n");
end
local ClassName = a_ClassAPI.Name;
-- Build an array of inherited classes chain:
local InheritanceChain = {};
local CurrInheritance = a_ClassAPI.Inherits;
while (CurrInheritance ~= nil) do
table.insert(InheritanceChain, CurrInheritance);
CurrInheritance = CurrInheritance.Inherits;
end
cf:write([[<!DOCTYPE html><html>
<head>
<title>MCServer API - ]], a_ClassAPI.Name, [[ Class</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="prettify.css" />
<script src="prettify.js"></script>
<script src="lang-lua.js"></script>
</head>
<body>
<div id="content">
<header>
<h1>]], a_ClassAPI.Name, [[</h1>
<hr />
</header>
<table><tr><td style="vertical-align: top;">
Index:<br />
<a href='index.html#articles'>Articles</a><br />
<a href='index.html#classes'>Classes</a><br />
<a href='index.html#hooks'>Hooks</a><br />
<br />
Quick navigation:<br />
]]);
cf:write(a_ClassMenu);
cf:write([[
</td><td style="vertical-align: top;"><h1>Contents</h1>
<p><ul>
]]);
local HasInheritance = ((#a_ClassAPI.Descendants > 0) or (a_ClassAPI.Inherits ~= nil));
local HasConstants = (#a_ClassAPI.Constants > 0) or (a_ClassAPI.NumConstantsInGroups > 0);
local HasFunctions = (#a_ClassAPI.Functions > 0);
local HasVariables = (#a_ClassAPI.Variables > 0);
for _, cls in ipairs(InheritanceChain) do
HasConstants = HasConstants or (#cls.Constants > 0) or (cls.NumConstantsInGroupsForDescendants > 0);
HasFunctions = HasFunctions or (#cls.Functions > 0);
HasVariables = HasVariables or (#cls.Variables > 0);
end
-- Write the table of contents:
if (HasInheritance) then
cf:write("<li><a href=\"#inherits\">Inheritance</a></li>\n");
end
if (HasConstants) then
cf:write("<li><a href=\"#constants\">Constants</a></li>\n");
end
if (HasVariables) then
cf:write("<li><a href=\"#variables\">Member variables</a></li>\n");
end
if (HasFunctions) then
cf:write("<li><a href=\"#functions\">Functions</a></li>\n");
end
if (a_ClassAPI.AdditionalInfo ~= nil) then
for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
cf:write("<li><a href=\"#additionalinfo_", i, "\">", (additional.Header or "<i>(No header)</i>"), "</a></li>\n");
end
end
cf:write("</ul></p>\n");
-- Write the class description:
cf:write("<hr /><a name=\"desc\"><h1>", ClassName, " class</h1></a>\n");
if (a_ClassAPI.Desc ~= nil) then
cf:write("<p>");
cf:write(LinkifyString(a_ClassAPI.Desc, ClassName));
cf:write("</p>\n\n");
end;
-- Write the inheritance, if available:
if (HasInheritance) then
cf:write("<hr /><a name=\"inherits\"><h1>Inheritance</h1></a>\n");
if (#InheritanceChain > 0) then
cf:write("<p>This class inherits from the following parent classes:<ul>\n");
for _, cls in ipairs(InheritanceChain) do
cf:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
end
cf:write("</ul></p>\n");
end
if (#a_ClassAPI.Descendants > 0) then
cf:write("<p>This class has the following descendants:\n");
WriteDescendants(a_ClassAPI.Descendants);
cf:write("</p>\n\n");
end
end
-- Write the constants:
if (HasConstants) then
cf:write("<a name=\"constants\"><hr /><h1>Constants</h1></a>\n");
WriteConstants(a_ClassAPI.Constants, a_ClassAPI.ConstantGroups, a_ClassAPI.NumConstantsInGroups, nil);
g_Stats.NumTotalConstants = g_Stats.NumTotalConstants + #a_ClassAPI.Constants + (a_ClassAPI.NumConstantsInGroups or 0);
for _, cls in ipairs(InheritanceChain) do
WriteConstants(cls.Constants, cls.ConstantGroups, cls.NumConstantsInGroupsForDescendants, cls.Name);
end;
end;
-- Write the member variables:
if (HasVariables) then
cf:write("<a name=\"variables\"><hr /><h1>Member variables</h1></a>\n");
WriteVariables(a_ClassAPI.Variables, nil);
g_Stats.NumTotalVariables = g_Stats.NumTotalVariables + #a_ClassAPI.Variables;
for _, cls in ipairs(InheritanceChain) do
WriteVariables(cls.Variables, cls.Name);
end;
end
-- Write the functions, including the inherited ones:
if (HasFunctions) then
cf:write("<a name=\"functions\"><hr /><h1>Functions</h1></a>\n");
WriteFunctions(a_ClassAPI.Functions, nil);
g_Stats.NumTotalFunctions = g_Stats.NumTotalFunctions + #a_ClassAPI.Functions;
for _, cls in ipairs(InheritanceChain) do
WriteFunctions(cls.Functions, cls.Name);
end
end
-- Write the additional infos:
if (a_ClassAPI.AdditionalInfo ~= nil) then
for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
cf:write("<a name=\"additionalinfo_", i, "\"><h1>", additional.Header, "</h1></a>\n");
cf:write(LinkifyString(additional.Contents, ClassName));
end
end
cf:write([[</td></tr></table></div><script>prettyPrint();</script></body></html>]]);
cf:close();
end
local function WriteClasses(f, a_API, a_ClassMenu)
f:write([[
<a name="classes"><h2>Class index</h2></a>
<p>The following classes are available in the MCServer Lua scripting language:
<ul>
]]);
for _, cls in ipairs(a_API) do
f:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
WriteHtmlClass(cls, a_ClassMenu);
end
f:write([[
</ul></p>
<hr />
]]);
end
--- Writes a list of undocumented objects into a file
local function ListUndocumentedObjects(API, UndocumentedHooks)
f = io.open("API/_undocumented.lua", "w");
if (f ~= nil) then
f:write("\n-- This is the list of undocumented API objects, automatically generated by APIDump\n\n");
f:write("g_APIDesc =\n{\n\tClasses =\n\t{\n");
for _, cls in ipairs(API) do
local HasFunctions = ((cls.UndocumentedFunctions ~= nil) and (#cls.UndocumentedFunctions > 0));
local HasConstants = ((cls.UndocumentedConstants ~= nil) and (#cls.UndocumentedConstants > 0));
local HasVariables = ((cls.UndocumentedVariables ~= nil) and (#cls.UndocumentedVariables > 0));
g_Stats.NumUndocumentedFunctions = g_Stats.NumUndocumentedFunctions + #cls.UndocumentedFunctions;
g_Stats.NumUndocumentedConstants = g_Stats.NumUndocumentedConstants + #cls.UndocumentedConstants;
g_Stats.NumUndocumentedVariables = g_Stats.NumUndocumentedVariables + #cls.UndocumentedVariables;
if (HasFunctions or HasConstants or HasVariables) then
f:write("\t\t" .. cls.Name .. " =\n\t\t{\n");
if ((cls.Desc == nil) or (cls.Desc == "")) then
f:write("\t\t\tDesc = \"\"\n");
end
end
if (HasFunctions) then
f:write("\t\t\tFunctions =\n\t\t\t{\n");
table.sort(cls.UndocumentedFunctions);
for _, fn in ipairs(cls.UndocumentedFunctions) do
f:write("\t\t\t\t" .. fn .. " = { Params = \"\", Return = \"\", Notes = \"\" },\n");
end -- for j, fn - cls.UndocumentedFunctions[]
f:write("\t\t\t},\n\n");
end
if (HasConstants) then
f:write("\t\t\tConstants =\n\t\t\t{\n");
table.sort(cls.UndocumentedConstants);
for _, cn in ipairs(cls.UndocumentedConstants) do
f:write("\t\t\t\t" .. cn .. " = { Notes = \"\" },\n");
end -- for j, fn - cls.UndocumentedConstants[]
f:write("\t\t\t},\n\n");
end
if (HasVariables) then
f:write("\t\t\tVariables =\n\t\t\t{\n");
table.sort(cls.UndocumentedVariables);
for _, vn in ipairs(cls.UndocumentedVariables) do
f:write("\t\t\t\t" .. vn .. " = { Type = \"\", Notes = \"\" },\n");
end -- for j, fn - cls.UndocumentedVariables[]
f:write("\t\t\t},\n\n");
end
if (HasFunctions or HasConstants or HasVariables) then
f:write("\t\t},\n\n");
end
end -- for i, cls - API[]
f:write("\t},\n");
if (#UndocumentedHooks > 0) then
f:write("\n\tHooks =\n\t{\n");
for i, hook in ipairs(UndocumentedHooks) do
if (i > 1) then
f:write("\n");
end
f:write("\t\t" .. hook .. " =\n\t\t{\n");
f:write("\t\t\tCalledWhen = \"\",\n");
f:write("\t\t\tDefaultFnName = \"On\", -- also used as pagename\n");
f:write("\t\t\tDesc = [[\n\t\t\t\t\n\t\t\t]],\n");
f:write("\t\t\tParams =\n\t\t\t{\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
f:write("\t\t\t},\n");
f:write("\t\t\tReturns = [[\n\t\t\t\t\n\t\t\t]],\n");
f:write("\t\t}, -- " .. hook .. "\n");
end
f:write("\t},\n");
end
f:write("}\n\n\n\n");
f:close();
end
g_Stats.NumUndocumentedHooks = #UndocumentedHooks;
end
--- Lists the API objects that are documented but not available in the API:
local function ListUnexportedObjects()
f = io.open("API/_unexported-documented.txt", "w");
if (f ~= nil) then
for clsname, cls in pairs(g_APIDesc.Classes) do
if not(cls.IsExported) then
-- The whole class is not exported
f:write("class\t" .. clsname .. "\n");
else
if (cls.Functions ~= nil) then
for fnname, fnapi in pairs(cls.Functions) do
if not(fnapi.IsExported) then
f:write("func\t" .. clsname .. "." .. fnname .. "\n");
end
end -- for j, fn - cls.Functions[]
end
if (cls.Constants ~= nil) then
for cnname, cnapi in pairs(cls.Constants) do
if not(cnapi.IsExported) then
f:write("const\t" .. clsname .. "." .. cnname .. "\n");
end
end -- for j, fn - cls.Functions[]
end
end
end -- for i, cls - g_APIDesc.Classes[]
f:close();
end
end
local function ListMissingPages()
local MissingPages = {};
local NumLinks = 0;
for PageName, Referrers in pairs(g_TrackedPages) do
NumLinks = NumLinks + 1;
if not(cFile:Exists("API/" .. PageName .. ".html")) then
table.insert(MissingPages, {Name = PageName, Refs = Referrers} );
end
end;
g_Stats.NumTrackedLinks = NumLinks;
g_TrackedPages = {};
if (#MissingPages == 0) then
-- No missing pages, congratulations!
return;
end
-- Sort the pages by name:
table.sort(MissingPages,
function (Page1, Page2)
return (Page1.Name < Page2.Name);
end
);
-- Output the pages:
local f, err = io.open("API/_missingPages.txt", "w");
if (f == nil) then
LOGWARNING("Cannot open _missingPages.txt for writing: '" .. err .. "'. There are " .. #MissingPages .. " pages missing.");
return;
end
for _, pg in ipairs(MissingPages) do
f:write(pg.Name .. ":\n");
-- Sort and output the referrers:
table.sort(pg.Refs);
f:write("\t" .. table.concat(pg.Refs, "\n\t"));
f:write("\n\n");
end
f:close();
g_Stats.NumInvalidLinks = #MissingPages;
end
--- Writes the documentation statistics (in g_Stats) into the given HTML file
local function WriteStats(f)
local function ExportMeter(a_Percent)
local Color;
if (a_Percent > 99) then
Color = "green";
elseif (a_Percent > 50) then
Color = "orange";
else
Color = "red";
end
local meter = {
"\n",
"<div style=\"background-color: black; padding: 1px; width: 100px\">\n",
"<div style=\"background-color: ",
Color,
"; width: ",
a_Percent,
"%; height: 16px\"></div></div>\n</td><td>",
string.format("%.2f", a_Percent),
" %",
};
return table.concat(meter, "");
end
f:write([[
<hr /><a name="docstats"><h2>Documentation statistics</h2></a>
<table><tr><th>Object</th><th>Total</th><th>Documented</th><th>Undocumented</th><th colspan="2">Documented %</th></tr>
]]);
f:write("<tr><td>Classes</td><td>", g_Stats.NumTotalClasses);
f:write("</td><td>", g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses);
f:write("</td><td>", g_Stats.NumUndocumentedClasses);
f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses) / g_Stats.NumTotalClasses));
f:write("</td></tr>\n");
f:write("<tr><td>Functions</td><td>", g_Stats.NumTotalFunctions);
f:write("</td><td>", g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions);
f:write("</td><td>", g_Stats.NumUndocumentedFunctions);
f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions) / g_Stats.NumTotalFunctions));
f:write("</td></tr>\n");
f:write("<tr><td>Member variables</td><td>", g_Stats.NumTotalVariables);
f:write("</td><td>", g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables);
f:write("</td><td>", g_Stats.NumUndocumentedVariables);
f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables) / g_Stats.NumTotalVariables));
f:write("</td></tr>\n");
f:write("<tr><td>Constants</td><td>", g_Stats.NumTotalConstants);
f:write("</td><td>", g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants);
f:write("</td><td>", g_Stats.NumUndocumentedConstants);
f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants) / g_Stats.NumTotalConstants));
f:write("</td></tr>\n");
f:write("<tr><td>Hooks</td><td>", g_Stats.NumTotalHooks);
f:write("</td><td>", g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks);
f:write("</td><td>", g_Stats.NumUndocumentedHooks);
f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks) / g_Stats.NumTotalHooks));
f:write("</td></tr>\n");
f:write([[
</table>
<p>There are ]], g_Stats.NumTrackedLinks, " internal links, ", g_Stats.NumInvalidLinks, " of them are invalid.</p>"
);
end
local function DumpAPIHtml(a_API)
LOG("Dumping all available functions and constants to API subfolder...");
-- Create the output folder
if not(cFile:IsFolder("API")) then
cFile:CreateFolder("API");
end
LOG("Copying static files..");
cFile:CreateFolder("API/Static");
local localFolder = g_Plugin:GetLocalFolder();
for _, fnam in ipairs(cFile:GetFolderContents(localFolder .. "/Static")) do
cFile:Delete("API/Static/" .. fnam);
cFile:Copy(localFolder .. "/Static/" .. fnam, "API/Static/" .. fnam);
end
-- Extract hook constants:
local Hooks = {};
local UndocumentedHooks = {};
for name, obj in pairs(cPluginManager) do
if (
(type(obj) == "number") and
name:match("HOOK_.*") and
(name ~= "HOOK_MAX") and
(name ~= "HOOK_NUM_HOOKS")
) then
table.insert(Hooks, { Name = name });
end
end
table.sort(Hooks,
function(Hook1, Hook2)
return (Hook1.Name < Hook2.Name);
end
);
ReadHooks(Hooks);
-- Create a "class index" file, write each class as a link to that file,
-- then dump class contents into class-specific file
LOG("Writing HTML files...");
local f, err = io.open("API/index.html", "w");
if (f == nil) then
LOGINFO("Cannot output HTML API: " .. err);
return;
end
-- Create a class navigation menu that will be inserted into each class file for faster navigation (#403)
local ClassMenuTab = {};
for _, cls in ipairs(a_API) do
table.insert(ClassMenuTab, "<a href='");
table.insert(ClassMenuTab, cls.Name);
table.insert(ClassMenuTab, ".html'>");
table.insert(ClassMenuTab, cls.Name);
table.insert(ClassMenuTab, "</a><br />");
end
local ClassMenu = table.concat(ClassMenuTab, "");
-- Create a hook navigation menu that will be inserted into each hook file for faster navigation(#403)
local HookNavTab = {};
for _, hook in ipairs(Hooks) do
table.insert(HookNavTab, "<a href='");
table.insert(HookNavTab, hook.DefaultFnName);
table.insert(HookNavTab, ".html'>");
table.insert(HookNavTab, (hook.Name:gsub("^HOOK_", ""))); -- remove the "HOOK_" part of the name
table.insert(HookNavTab, "</a><br />");
end
local HookNav = table.concat(HookNavTab, "");
-- Write the HTML file:
f:write([[<!DOCTYPE html>
<html>
<head>
<title>MCServer API - Index</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div id="content">
<header>
<h1>MCServer API - Index</h1>
<hr />
</header>
<p>The API reference is divided into the following sections:</p>
<ul>
<li><a href="#articles">Articles</a></li>
<li><a href="#classes">Class index</a></li>
<li><a href="#hooks">Hooks</a></li>
<li><a href="#docstats">Documentation statistics</a></li>
</ul>
<hr />
]]);
WriteArticles(f);
WriteClasses(f, a_API, ClassMenu);
WriteHooks(f, Hooks, UndocumentedHooks, HookNav);
-- Copy the static files to the output folder:
local StaticFiles =
{
"main.css",
"prettify.js",
"prettify.css",
"lang-lua.js",
};
for _, fnam in ipairs(StaticFiles) do
cFile:Delete("API/" .. fnam);
cFile:Copy(g_Plugin:GetLocalFolder() .. "/" .. fnam, "API/" .. fnam);
end
-- List the documentation problems:
LOG("Listing leftovers...");
ListUndocumentedObjects(a_API, UndocumentedHooks);
ListUnexportedObjects();
ListMissingPages();
WriteStats(f);
f:write([[ </ul>
</div>
</body>
</html>]]);
f:close();
LOG("API subfolder written");
end
--- Returns the string with extra tabs and CR/LFs removed
local function CleanUpDescription(a_Desc)
-- Get rid of indent and newlines, normalize whitespace:
local res = a_Desc:gsub("[\n\t]", "")
res = a_Desc:gsub("%s%s+", " ")
-- Replace paragraph marks with newlines:
res = res:gsub("<p>", "\n")
res = res:gsub("</p>", "")
-- Replace list items with dashes:
res = res:gsub("</?ul>", "")
res = res:gsub("<li>", "\n - ")
res = res:gsub("</li>", "")
return res
end
--- Writes a list of methods into the specified file in ZBS format
local function WriteZBSMethods(f, a_Methods)
for _, func in ipairs(a_Methods or {}) do
f:write("\t\t\t[\"", func.Name, "\"] =\n")
f:write("\t\t\t{\n")
f:write("\t\t\t\ttype = \"method\",\n")
if ((func.Notes ~= nil) and (func.Notes ~= "")) then
f:write("\t\t\t\tdescription = [[", CleanUpDescription(func.Notes or ""), " ]],\n")
end
f:write("\t\t\t},\n")
end
end
--- Writes a list of constants into the specified file in ZBS format
local function WriteZBSConstants(f, a_Constants)
for _, cons in ipairs(a_Constants or {}) do
f:write("\t\t\t[\"", cons.Name, "\"] =\n")
f:write("\t\t\t{\n")
f:write("\t\t\t\ttype = \"value\",\n")
if ((cons.Desc ~= nil) and (cons.Desc ~= "")) then
f:write("\t\t\t\tdescription = [[", CleanUpDescription(cons.Desc or ""), " ]],\n")
end
f:write("\t\t\t},\n")
end
end
--- Writes one MCS class definition into the specified file in ZBS format
local function WriteZBSClass(f, a_Class)
assert(type(a_Class) == "table")
-- Write class header:
f:write("\t", a_Class.Name, " =\n\t{\n")
f:write("\t\ttype = \"class\",\n")
f:write("\t\tdescription = [[", CleanUpDescription(a_Class.Desc or ""), " ]],\n")
f:write("\t\tchilds =\n")
f:write("\t\t{\n")
-- Export methods and constants:
WriteZBSMethods(f, a_Class.Functions)
WriteZBSConstants(f, a_Class.Constants)
-- Finish the class definition:
f:write("\t\t},\n")
f:write("\t},\n\n")
end
--- Dumps the entire API table into a file in the ZBS format
local function DumpAPIZBS(a_API)
LOG("Dumping ZBS API description...")
local f, err = io.open("mcserver_api.lua", "w")
if (f == nil) then
LOG("Cannot open mcserver_lua.lua for writing, ZBS API will not be dumped. " .. err)
return
end
-- Write the file header:
f:write("-- This is a MCServer API file automatically generated by the APIDump plugin\n")
f:write("-- Note that any manual changes will be overwritten by the next dump\n\n")
f:write("return {\n")
-- Export each class except Globals, store those aside:
local Globals
for _, cls in ipairs(a_API) do
if (cls.Name ~= "Globals") then
WriteZBSClass(f, cls)
else
Globals = cls
end
end
-- Export the globals:
if (Globals) then
WriteZBSMethods(f, Globals.Functions)
WriteZBSConstants(f, Globals.Constants)
end
-- Finish the file:
f:write("}\n")
f:close()
LOG("ZBS API dumped...")
end
--- Returns true if a_Descendant is declared to be a (possibly indirect) descendant of a_Base
local function IsDeclaredDescendant(a_DescendantName, a_BaseName, a_API)
-- Check params:
assert(type(a_DescendantName) == "string")
assert(type(a_BaseName) == "string")
assert(type(a_API) == "table")
if not(a_API[a_BaseName]) then
return false
end
assert(type(a_API[a_BaseName]) == "table", "Not a class name: " .. a_BaseName)
assert(type(a_API[a_BaseName].Descendants) == "table")
-- Check direct inheritance:
for _, desc in ipairs(a_API[a_BaseName].Descendants) do
if (desc.Name == a_DescendantName) then
return true
end
end -- for desc - a_BaseName's descendants
-- Check indirect inheritance:
for _, desc in ipairs(a_API[a_BaseName].Descendants) do
if (IsDeclaredDescendant(a_DescendantName, desc.Name, a_API)) then
return true
end
end -- for desc - a_BaseName's descendants
return false
end
--- Checks the specified class' inheritance
-- Reports any problems as new items in the a_Report table
local function CheckClassInheritance(a_Class, a_API, a_Report)
-- Check params:
assert(type(a_Class) == "table")
assert(type(a_API) == "table")
assert(type(a_Report) == "table")
-- Check that the declared descendants are really descendants:
local registry = debug.getregistry()
for _, desc in ipairs(a_Class.Descendants or {}) do
local isParent = false
local parents = registry["tolua_super"][_G[desc.Name]]
if not(parents[a_Class.Name]) then
table.insert(a_Report, desc.Name .. " is not a descendant of " .. a_Class.Name)
end
end -- for desc - a_Class.Descendants[]
-- Check that all inheritance is listed for the class:
local parents = registry["tolua_super"][_G[a_Class.Name]] -- map of "classname" -> true for each class that a_Class inherits
for clsName, isParent in pairs(parents or {}) do
if ((clsName ~= "") and not(clsName:match("const .*"))) then
if not(IsDeclaredDescendant(a_Class.Name, clsName, a_API)) then
table.insert(a_Report, a_Class.Name .. " inherits from " .. clsName .. " but this isn't documented")
end
end
end
end
--- Checks each class's declared inheritance versus the actual inheritance
local function CheckAPIDescendants(a_API)
-- Check each class:
local report = {}
for _, cls in ipairs(a_API) do
if (cls.Name ~= "Globals") then
CheckClassInheritance(cls, a_API, report)
end
end
-- If there's anything to report, output it to a file:
if (report[1] ~= nil) then
LOG("There are inheritance errors in the API description:")
for _, msg in ipairs(report) do
LOG(" " .. msg)
end
local f, err = io.open("API/_inheritance_errors.txt", "w")
if (f == nil) then
LOG("Cannot report inheritance problems to a file: " .. tostring(err))
return
end
f:write(table.concat(report, "\n"))
f:close()
end
end
local function DumpApi()
LOG("Dumping the API...")
-- Load the API descriptions from the Classes and Hooks subfolders:
-- This needs to be done each time the command is invoked because the export modifies the tables' contents
dofile(g_PluginFolder .. "/APIDesc.lua")
if (g_APIDesc.Classes == nil) then
g_APIDesc.Classes = {};
end
if (g_APIDesc.Hooks == nil) then
g_APIDesc.Hooks = {};
end
LoadAPIFiles("/Classes/", g_APIDesc.Classes);
LoadAPIFiles("/Hooks/", g_APIDesc.Hooks);
-- Reset the stats:
g_TrackedPages = {}; -- List of tracked pages, to be checked later whether they exist. Each item is an array of referring pagenames.
g_Stats = -- Statistics about the documentation
{
NumTotalClasses = 0,
NumUndocumentedClasses = 0,
NumTotalFunctions = 0,
NumUndocumentedFunctions = 0,
NumTotalConstants = 0,
NumUndocumentedConstants = 0,
NumTotalVariables = 0,
NumUndocumentedVariables = 0,
NumTotalHooks = 0,
NumUndocumentedHooks = 0,
NumTrackedLinks = 0,
NumInvalidLinks = 0,
}
-- Create the API tables:
local API, Globals = CreateAPITables();
-- Sort the classes by name:
table.sort(API,
function (c1, c2)
return (string.lower(c1.Name) < string.lower(c2.Name));
end
);
g_Stats.NumTotalClasses = #API;
-- Add Globals into the API:
Globals.Name = "Globals";
table.insert(API, Globals);
-- Read in the descriptions:
LOG("Reading descriptions...");
ReadDescriptions(API);
-- Check that the API lists the inheritance properly, report any problems to a file:
CheckAPIDescendants(API)
-- Dump all available API objects in HTML format into a subfolder:
DumpAPIHtml(API);
-- Dump all available API objects in format used by ZeroBraneStudio API descriptions:
DumpAPIZBS(API)
LOG("APIDump finished");
return true
end
local function HandleWebAdminDump(a_Request)
if (a_Request.PostParams["Dump"] ~= nil) then
DumpApi()
end
return
[[
<p>Pressing the button will generate the API dump on the server. Note that this can take some time.</p>
<form method="POST"><input type="submit" name="Dump" value="Dump the API"/></form>
]]
end
local function HandleCmdApi(a_Split)
DumpApi()
return true
end
function Initialize(Plugin)
g_Plugin = Plugin;
g_PluginFolder = Plugin:GetLocalFolder();
LOG("Initialising " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
-- Bind a console command to dump the API:
cPluginManager:BindConsoleCommand("api", HandleCmdApi, "Dumps the Lua API docs into the API/ subfolder")
-- Add a WebAdmin tab that has a Dump button
g_Plugin:AddWebTab("APIDump", HandleWebAdminDump)
return true
end
| jammet/MCServer | MCServer/Plugins/APIDump/main_APIDump.lua | Lua | apache-2.0 | 50,162 | [
30522,
1011,
1011,
2364,
1012,
11320,
2050,
1011,
1011,
22164,
1996,
13354,
2378,
4443,
8400,
1006,
1999,
2023,
2553,
1996,
2972,
13354,
2378,
1007,
1011,
1011,
3795,
10857,
1024,
2334,
1043,
1035,
13354,
2378,
1027,
9152,
2140,
2334,
1043,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_excite import GatherExcite
from .global_context import GlobalContext
from .halo_attn import HaloAttn
from .lambda_layer import LambdaLayer
from .non_local_attn import NonLocalAttn, BatNonLocalAttn
from .selective_kernel import SelectiveKernel
from .split_attn import SplitAttn
from .squeeze_excite import SEModule, EffectiveSEModule
def get_attn(attn_type):
if isinstance(attn_type, torch.nn.Module):
return attn_type
module_cls = None
if attn_type is not None:
if isinstance(attn_type, str):
attn_type = attn_type.lower()
# Lightweight attention modules (channel and/or coarse spatial).
# Typically added to existing network architecture blocks in addition to existing convolutions.
if attn_type == 'se':
module_cls = SEModule
elif attn_type == 'ese':
module_cls = EffectiveSEModule
elif attn_type == 'eca':
module_cls = EcaModule
elif attn_type == 'ecam':
module_cls = partial(EcaModule, use_mlp=True)
elif attn_type == 'ceca':
module_cls = CecaModule
elif attn_type == 'ge':
module_cls = GatherExcite
elif attn_type == 'gc':
module_cls = GlobalContext
elif attn_type == 'gca':
module_cls = partial(GlobalContext, fuse_add=True, fuse_scale=False)
elif attn_type == 'cbam':
module_cls = CbamModule
elif attn_type == 'lcbam':
module_cls = LightCbamModule
# Attention / attention-like modules w/ significant params
# Typically replace some of the existing workhorse convs in a network architecture.
# All of these accept a stride argument and can spatially downsample the input.
elif attn_type == 'sk':
module_cls = SelectiveKernel
elif attn_type == 'splat':
module_cls = SplitAttn
# Self-attention / attention-like modules w/ significant compute and/or params
# Typically replace some of the existing workhorse convs in a network architecture.
# All of these accept a stride argument and can spatially downsample the input.
elif attn_type == 'lambda':
return LambdaLayer
elif attn_type == 'bottleneck':
return BottleneckAttn
elif attn_type == 'halo':
return HaloAttn
elif attn_type == 'nl':
module_cls = NonLocalAttn
elif attn_type == 'bat':
module_cls = BatNonLocalAttn
# Woops!
else:
assert False, "Invalid attn module (%s)" % attn_type
elif isinstance(attn_type, bool):
if attn_type:
module_cls = SEModule
else:
module_cls = attn_type
return module_cls
def create_attn(attn_type, channels, **kwargs):
module_cls = get_attn(attn_type)
if module_cls is not None:
# NOTE: it's expected the first (positional) argument of all attention layers is the # input channels
return module_cls(channels, **kwargs)
return None
| rwightman/pytorch-image-models | timm/models/layers/create_attn.py | Python | apache-2.0 | 3,526 | [
30522,
1000,
1000,
1000,
3086,
4713,
28719,
2362,
2011,
1013,
9385,
25682,
5811,
20945,
2386,
1000,
1000,
1000,
12324,
12723,
2013,
4569,
6593,
13669,
2015,
12324,
7704,
2013,
1012,
5835,
18278,
1035,
2012,
2102,
2078,
12324,
5835,
18278,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: Tools
layout: page_small
comments: yes
---
<style>ol li{font-size:16px;padding:0;margin:2px 0 2px 36px} ol li strong{font-size:16px;padding:0;}</style>
## scripts:
### Python脚本
- **ESES_ElementArea.py** : 利用ESES计算各元素的面积,也会将各原子面积写到pqra文件中
- **ExtractXYZR.py** : 从PQR文件提取XYZR.
- **zap9radius4pqr.py** : 将PQR文件中半径部分替换为ZAP9半径
### Bash脚本
- **getPubChemSDF.sh** : 从PubChem上抓取相应CID的化合物.
- **gitsubmit** : Submit to Git with comment.
## bin:
## win:
## mac:
## params:
| platinhom/DailyTools | index.md | Markdown | gpl-2.0 | 601 | [
30522,
1011,
1011,
1011,
2516,
1024,
5906,
9621,
1024,
3931,
1035,
2235,
7928,
1024,
2748,
1011,
1011,
1011,
1026,
2806,
1028,
19330,
5622,
1063,
15489,
1011,
2946,
1024,
2385,
2361,
2595,
1025,
11687,
4667,
1024,
1014,
1025,
7785,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2018 Daniel Schultz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "nmod_mpoly.h"
#include "fq_nmod_mpoly.h"
void nmod_mpolyd_ctx_init(nmod_mpolyd_ctx_t dctx, slong nvars)
{
slong i;
dctx->nvars = nvars;
dctx->perm = (slong *) flint_malloc(nvars*sizeof(slong));
for (i = 0; i < nvars; i++)
{
dctx->perm[i] = i;
}
}
void nmod_mpolyd_ctx_clear(nmod_mpolyd_ctx_t dctx)
{
flint_free(dctx->perm);
}
void nmod_mpolyd_init(nmod_mpolyd_t poly, slong nvars)
{
slong i;
poly->nvars = nvars;
poly->degb_alloc = nvars;
poly->deg_bounds = (slong *) flint_malloc(poly->degb_alloc*sizeof(slong));
for (i = 0; i < nvars; i++)
{
poly->deg_bounds[i] = WORD(1);
}
poly->coeff_alloc = WORD(16);
poly->coeffs = (mp_limb_t *) flint_malloc(poly->coeff_alloc*sizeof(mp_limb_t));
for (i = 0; i < poly->coeff_alloc; i++)
{
poly->coeffs[i] = UWORD(0);
}
}
void nmod_mpolyd_fit_length(nmod_mpolyd_t poly, slong len) {
if (poly->coeff_alloc < len) {
/*flint_printf("realloc %wd -> %wd\n",poly->coeff_alloc, len);*/
poly->coeffs = (mp_limb_t *) flint_realloc(poly->coeffs, len*sizeof(mp_limb_t));
poly->coeff_alloc = len;
}
}
void nmod_mpolyd_set_nvars(nmod_mpolyd_t poly, slong nvars) {
poly->nvars = nvars;
if (poly->degb_alloc < nvars) {
poly->deg_bounds = (slong *) flint_realloc(poly->deg_bounds, nvars*sizeof(slong));
poly->degb_alloc = nvars;
}
}
void nmod_mpolyd_zero(nmod_mpolyd_t poly)
{
slong i;
for (i = 0; i < poly->nvars; i++)
{
poly->deg_bounds[i] = WORD(1);
}
poly->coeffs[0] = UWORD(0);
}
void nmod_mpolyd_clear(nmod_mpolyd_t poly)
{
flint_free(poly->deg_bounds);
flint_free(poly->coeffs);
poly->deg_bounds = NULL;
poly->coeffs = NULL;
}
int nmod_mpolyd_set_degbounds(nmod_mpolyd_t A, slong * bounds)
{
slong i;
int success = 0;
slong degb_prod;
degb_prod = 1;
for (i = 0; i < A->nvars; i++)
{
ulong hi;
A->deg_bounds[i] = bounds[i];
umul_ppmm(hi, degb_prod, degb_prod, A->deg_bounds[i]);
if (hi != WORD(0) || degb_prod < 0)
{
goto done;
}
}
success = 1;
nmod_mpolyd_fit_length(A, degb_prod);
done:
return success;
}
int nmod_mpolyd_set_degbounds_perm(nmod_mpolyd_t A, const nmod_mpolyd_ctx_t dctx, slong * bounds)
{
slong i;
int success = 0;
const slong * perm = dctx->perm;
slong degb_prod;
degb_prod = 1;
for (i = 0; i < A->nvars; i++)
{
ulong hi;
A->deg_bounds[i] = bounds[perm[i]];
umul_ppmm(hi, degb_prod, degb_prod, A->deg_bounds[i]);
if (hi != WORD(0) || degb_prod < 0)
{
goto done;
}
}
success = 1;
nmod_mpolyd_fit_length(A, degb_prod);
done:
return success;
}
/*
convert B to A assuming degree bounds have been set in A
*/
void nmod_mpoly_convert_to_nmod_mpolyd_degbound(nmod_mpolyd_t A,
const nmod_mpolyd_ctx_t dctx,
const nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx)
{
slong degb_prod;
slong i, j, N;
ulong * exps;
const slong * perm = dctx->perm;
slong nvars = ctx->minfo->nvars;
TMP_INIT;
FLINT_ASSERT(A->nvars == nvars);
FLINT_ASSERT(B->bits <= FLINT_BITS);
degb_prod = WORD(1);
for (i = 0; i < nvars; i++)
{
degb_prod *= A->deg_bounds[i];
}
for (i = 0; i < degb_prod; i++)
{
A->coeffs[i] = UWORD(0);
}
TMP_START;
exps = (ulong *) TMP_ALLOC(nvars*sizeof(ulong));
N = mpoly_words_per_exp(B->bits, ctx->minfo);
for (i = 0; i < B->length; i++)
{
slong off;
mpoly_get_monomial_ui(exps, B->exps + N*i, B->bits, ctx->minfo);
off = 0;
for (j = 0; j < nvars; j++)
{
off = exps[perm[j]] + A->deg_bounds[j]*off;
}
A->coeffs[off] = B->coeffs[i];
}
TMP_END;
}
/*
convert B to A - sets degree bounds in A
*/
void nmod_mpoly_convert_to_nmod_mpolyd(
nmod_mpolyd_t A, const nmod_mpolyd_ctx_t dctx,
const nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx)
{
slong degb_prod;
slong i, j, N;
slong * exps;
const slong * perm = dctx->perm;
slong nvars = ctx->minfo->nvars;
TMP_INIT;
nmod_mpolyd_set_nvars(A, ctx->minfo->nvars);
FLINT_ASSERT(B->bits <= FLINT_BITS);
if (B->length == 0)
{
nmod_mpolyd_zero(A);
return;
}
TMP_START;
exps = (slong *) TMP_ALLOC(ctx->minfo->nvars*sizeof(slong));
nmod_mpoly_degrees_si(exps, B, ctx);
degb_prod = WORD(1);
for (i = 0; i < nvars; i++)
{
A->deg_bounds[i] = exps[perm[i]] + 1;
degb_prod *= A->deg_bounds[i];
}
nmod_mpolyd_fit_length(A, degb_prod);
for (i = 0; i < degb_prod; i++)
{
A->coeffs[i] = UWORD(0);
}
N = mpoly_words_per_exp(B->bits, ctx->minfo);
for (i = 0; i < B->length; i++)
{
slong off = 0;
mpoly_get_monomial_ui((ulong *)exps, B->exps + N*i, B->bits, ctx->minfo);
for (j = 0; j < nvars; j++)
{
off = exps[perm[j]] + A->deg_bounds[j]*off;
}
A->coeffs[off] = B->coeffs[i];
}
TMP_END;
}
/*
Convert B to A
*/
void nmod_mpoly_convert_from_nmod_mpolyd(
nmod_mpoly_t A,
const nmod_mpoly_ctx_t ctx,
const nmod_mpolyd_t B,
const nmod_mpolyd_ctx_t dctx)
{
slong off, j, k, N;
slong bits, nvars = ctx->minfo->nvars;
slong Alen;
slong * perm = dctx->perm;
slong perm_nontrivial = 0;
ulong topmask;
ulong * exps, * pcurexp, * pexps;
TMP_INIT;
FLINT_ASSERT(nvars == B->nvars);
TMP_START;
exps = (ulong *) TMP_ALLOC(nvars*sizeof(ulong));
/* find bits needed for the result */
off = 1;
for (j = 0; j < nvars; j++)
{
off *= B->deg_bounds[j];
exps[perm[j]] = B->deg_bounds[j] - 1;
perm_nontrivial |= j ^ perm[j];
}
FLINT_ASSERT(off <= B->coeff_alloc);
bits = mpoly_exp_bits_required_ui(exps, ctx->minfo);
bits = mpoly_fix_bits(bits, ctx->minfo);
N = mpoly_words_per_exp(bits, ctx->minfo);
/* we are going to push back terms manually */
nmod_mpoly_fit_length_reset_bits(A, 0, bits, ctx);
Alen = 0;
/* find exponent vector for all variables */
pexps = (ulong *) TMP_ALLOC(N*nvars*sizeof(ulong));
for (k = 0; k < nvars; k++)
{
for (j = 0; j < nvars; j++)
exps[perm[j]] = (j == k);
mpoly_set_monomial_ui(pexps + k*N, exps, bits, ctx->minfo);
}
/* get most significant exponent in exps and its vector in ptempexp */
off--;
pcurexp = (ulong *) TMP_ALLOC(N*sizeof(ulong));
mpoly_monomial_zero(pcurexp, N);
k = off;
for (j = nvars - 1; j >= 0; j--)
{
exps[j] = k % B->deg_bounds[j];
k = k / B->deg_bounds[j];
mpoly_monomial_madd_inplace_mp(pcurexp, exps[j], pexps + N*j, N);
}
/* scan down through the exponents */
topmask = 0;
for (; off >= 0; off--)
{
if (B->coeffs[off] != UWORD(0))
{
_nmod_mpoly_fit_length(&A->coeffs, &A->coeffs_alloc,
&A->exps, &A->exps_alloc, N, Alen + 1);
A->coeffs[Alen] = B->coeffs[off];
mpoly_monomial_set(A->exps + N*Alen, pcurexp, N);
topmask |= (A->exps + N*Alen)[N - 1];
Alen++;
}
j = nvars - 1;
do {
--exps[j];
if ((slong)(exps[j]) < WORD(0))
{
FLINT_ASSERT(off == 0 || j > 0);
FLINT_ASSERT(exps[j] == -UWORD(1));
exps[j] = B->deg_bounds[j] - 1;
mpoly_monomial_madd_inplace_mp(pcurexp, exps[j], pexps + N*j, N);
} else
{
mpoly_monomial_sub_mp(pcurexp, pcurexp, pexps + N*j, N);
break;
}
} while (--j >= 0);
}
_nmod_mpoly_set_length(A, Alen, ctx);
/* sort the exponents if needed */
if (ctx->minfo->ord != ORD_LEX || perm_nontrivial != WORD(0))
{
slong msb;
mpoly_get_cmpmask(pcurexp, N, bits, ctx->minfo);
if (topmask != WORD(0))
{
count_leading_zeros(msb, topmask);
msb = (FLINT_BITS - 1)^msb;
} else
{
msb = -WORD(1);
}
if (N == 1) {
if (msb >= WORD(0))
{
_nmod_mpoly_radix_sort1(A, 0, A->length,
msb, pcurexp[0], topmask);
}
} else {
_nmod_mpoly_radix_sort(A, 0, A->length,
(N - 1)*FLINT_BITS + msb, N, pcurexp);
}
}
TMP_END;
}
void nmod_mpolyd_print(nmod_mpolyd_t poly)
{
int first = 0;
slong i, j;
slong degb_prod;
degb_prod = WORD(1);
for (j = 0; j < poly->nvars; j++) {
degb_prod *= poly->deg_bounds[j];
}
first = 1;
for (i = 0; i < degb_prod; i++) {
ulong k = i;
if (poly->coeffs[i] == 0)
continue;
if (!first)
printf(" + ");
flint_printf("%wu", poly->coeffs[i]);
for (j = poly->nvars - 1; j >= 0; j--)
{
ulong m = poly->deg_bounds[j];
ulong e = k % m;
k = k / m;
flint_printf("*x%wd^%wd", j, e);
}
FLINT_ASSERT(k == 0);
first = 0;
}
if (first)
flint_printf("0");
}
slong nmod_mpolyd_length(const nmod_mpolyd_t A)
{
slong i, j, degb_prod;
degb_prod = WORD(1);
for (j = 0; j < A->nvars; j++)
degb_prod *= A->deg_bounds[j];
for (i = degb_prod; i > 0; i--)
{
if (A->coeffs[i - 1] != UWORD(0))
break;
}
return i;
}
| wbhart/flint2 | nmod_mpoly/mpolyd.c | C | lgpl-2.1 | 10,274 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2760,
3817,
22378,
2023,
5371,
2003,
2112,
1997,
13493,
1012,
13493,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
1996,
3408,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*!
* OOjs UI v0.24.4
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2018 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
* Date: 2018-01-02T19:09:04Z
*/
.oo-ui-icon-add {
background-image: url('themes/apex/images/icons/add.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/add.svg');
}
.oo-ui-icon-advanced {
background-image: url('themes/apex/images/icons/advanced.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/advanced.svg');
}
.oo-ui-icon-browser {
background-image: url('themes/apex/images/icons/browser-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/browser-rtl.svg');
}
.oo-ui-icon-cancel {
background-image: url('themes/apex/images/icons/cancel.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/cancel.svg');
}
.oo-ui-icon-check {
background-image: url('themes/apex/images/icons/check.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/check.svg');
}
.oo-ui-icon-clear {
background-image: url('themes/apex/images/icons/clear.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/clear.svg');
}
.oo-ui-icon-clock {
background-image: url('themes/apex/images/icons/clock.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/clock.svg');
}
.oo-ui-icon-close {
background-image: url('themes/apex/images/icons/close.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/close.svg');
}
.oo-ui-icon-ellipsis {
background-image: url('themes/apex/images/icons/ellipsis.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/ellipsis.svg');
}
.oo-ui-icon-feedback {
background-image: url('themes/apex/images/icons/feedback-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/feedback-rtl.svg');
}
.oo-ui-icon-funnel {
background-image: url('themes/apex/images/icons/funnel-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/funnel-rtl.svg');
}
.oo-ui-icon-heart {
background-image: url('themes/apex/images/icons/heart.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/heart.svg');
}
.oo-ui-icon-help {
background-image: url('themes/apex/images/icons/help-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/help-rtl.svg');
}
/* @noflip */
.oo-ui-icon-help:lang(he) {
background-image: url('themes/apex/images/icons/help-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/help-ltr.svg');
}
/* @noflip */
.oo-ui-icon-help:lang(yi) {
background-image: url('themes/apex/images/icons/help-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/help-ltr.svg');
}
.oo-ui-icon-key {
background-image: url('themes/apex/images/icons/key-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/key-rtl.svg');
}
.oo-ui-icon-keyboard {
background-image: url('themes/apex/images/icons/keyboard-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/keyboard-rtl.svg');
}
.oo-ui-icon-lightbulb {
background-image: url('themes/apex/images/icons/lightbulb.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/lightbulb.svg');
}
.oo-ui-icon-logOut {
background-image: url('themes/apex/images/icons/logOut-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/logOut-rtl.svg');
}
.oo-ui-icon-newWindow {
background-image: url('themes/apex/images/icons/newWindow-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/newWindow-rtl.svg');
}
.oo-ui-icon-printer {
background-image: url('themes/apex/images/icons/printer-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/printer-rtl.svg');
}
.oo-ui-icon-reload {
background-image: url('themes/apex/images/icons/reload-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/reload-rtl.svg');
}
.oo-ui-icon-search {
background-image: url('themes/apex/images/icons/search-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/search-rtl.svg');
}
.oo-ui-icon-settings {
background-image: url('themes/apex/images/icons/settings.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/settings.svg');
}
.oo-ui-icon-subtract {
background-image: url('themes/apex/images/icons/subtract.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/subtract.svg');
}
.oo-ui-icon-watchlist {
background-image: url('themes/apex/images/icons/watchlist-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/icons/watchlist-rtl.svg');
}
| holtkamp/cdnjs | ajax/libs/oojs-ui/0.24.4/oojs-ui-apex-icons-interactions.rtl.css | CSS | mit | 5,790 | [
30522,
1013,
1008,
999,
1008,
1051,
29147,
2015,
21318,
1058,
2692,
1012,
2484,
1012,
1018,
1008,
16770,
1024,
1013,
1013,
7479,
1012,
2865,
9148,
3211,
1012,
8917,
1013,
15536,
3211,
1013,
1051,
29147,
2015,
1035,
21318,
1008,
1008,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
#pragma warning disable 1591
// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedParameter.Local
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable IntroduceOptionalParameters.Global
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable InconsistentNaming
namespace StackLang.Ide.Annotations
{
/// <summary>
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
/// so the check for <c>null</c> is necessary before its usage
/// </summary>
/// <example><code>
/// [CanBeNull] public object Test() { return null; }
/// public void UseTest() {
/// var p = Test();
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter |
AttributeTargets.Property | AttributeTargets.Delegate |
AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class CanBeNullAttribute : Attribute { }
/// <summary>
/// Indicates that the value of the marked element could never be <c>null</c>
/// </summary>
/// <example><code>
/// [NotNull] public object Foo() {
/// return null; // Warning: Possible 'null' assignment
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter |
AttributeTargets.Property | AttributeTargets.Delegate |
AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class NotNullAttribute : Attribute { }
/// <summary>
/// Indicates that the marked method builds string by format pattern and (optional) arguments.
/// Parameter, which contains format string, should be given in constructor. The format string
/// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form
/// </summary>
/// <example><code>
/// [StringFormatMethod("message")]
/// public void ShowError(string message, params object[] args) { /* do something */ }
/// public void Foo() {
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Constructor | AttributeTargets.Method,
AllowMultiple = false, Inherited = true)]
public sealed class StringFormatMethodAttribute : Attribute
{
/// <param name="formatParameterName">
/// Specifies which parameter of an annotated method should be treated as format-string
/// </param>
public StringFormatMethodAttribute(string formatParameterName)
{
FormatParameterName = formatParameterName;
}
public string FormatParameterName { get; private set; }
}
/// <summary>
/// Indicates that the function argument should be string literal and match one
/// of the parameters of the caller function. For example, ReSharper annotates
/// the parameter of <see cref="System.ArgumentNullException"/>
/// </summary>
/// <example><code>
/// public void Foo(string param) {
/// if (param == null)
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public sealed class InvokerParameterNameAttribute : Attribute { }
/// <summary>
/// Indicates that the method is contained in a type that implements
/// <see cref="System.ComponentModel.INotifyPropertyChanged"/> interface
/// and this method is used to notify that some property value changed
/// </summary>
/// <remarks>
/// The method should be non-static and conform to one of the supported signatures:
/// <list>
/// <item><c>NotifyChanged(string)</c></item>
/// <item><c>NotifyChanged(params string[])</c></item>
/// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
/// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
/// <item><c>SetProperty{T}(ref T, T, string)</c></item>
/// </list>
/// </remarks>
/// <example><code>
/// public class Foo : INotifyPropertyChanged {
/// public event PropertyChangedEventHandler PropertyChanged;
/// [NotifyPropertyChangedInvocator]
/// protected virtual void NotifyChanged(string propertyName) { ... }
///
/// private string _name;
/// public string Name {
/// get { return _name; }
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
/// }
/// }
/// </code>
/// Examples of generated notifications:
/// <list>
/// <item><c>NotifyChanged("Property")</c></item>
/// <item><c>NotifyChanged(() => Property)</c></item>
/// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
/// <item><c>SetProperty(ref myField, value, "Property")</c></item>
/// </list>
/// </example>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
{
public NotifyPropertyChangedInvocatorAttribute() { }
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
{
ParameterName = parameterName;
}
public string ParameterName { get; private set; }
}
/// <summary>
/// Describes dependency between method input and output
/// </summary>
/// <syntax>
/// <p>Function Definition Table syntax:</p>
/// <list>
/// <item>FDT ::= FDTRow [;FDTRow]*</item>
/// <item>FDTRow ::= Input => Output | Output <= Input</item>
/// <item>Input ::= ParameterName: Value [, Input]*</item>
/// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
/// <item>Value ::= true | false | null | notnull | canbenull</item>
/// </list>
/// If method has single input parameter, it's name could be omitted.<br/>
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
/// for method output means that the methos doesn't return normally.<br/>
/// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
/// or use single attribute with rows separated by semicolon.<br/>
/// </syntax>
/// <examples><list>
/// <item><code>
/// [ContractAnnotation("=> halt")]
/// public void TerminationMethod()
/// </code></item>
/// <item><code>
/// [ContractAnnotation("halt <= condition: false")]
/// public void Assert(bool condition, string text) // regular assertion method
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null => true")]
/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
/// </code></item>
/// <item><code>
/// // A method that returns null if the parameter is null, and not null if the parameter is not null
/// [ContractAnnotation("null => null; notnull => notnull")]
/// public object Transform(object data)
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
/// public bool TryParse(string s, out Person result)
/// </code></item>
/// </list></examples>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class ContractAnnotationAttribute : Attribute
{
public ContractAnnotationAttribute([NotNull] string contract)
: this(contract, false) { }
public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
{
Contract = contract;
ForceFullStates = forceFullStates;
}
public string Contract { get; private set; }
public bool ForceFullStates { get; private set; }
}
/// <summary>
/// Indicates that marked element should be localized or not
/// </summary>
/// <example><code>
/// [LocalizationRequiredAttribute(true)]
/// public class Foo {
/// private string str = "my string"; // Warning: Localizable string
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public sealed class LocalizationRequiredAttribute : Attribute
{
public LocalizationRequiredAttribute() : this(true) { }
public LocalizationRequiredAttribute(bool required)
{
Required = required;
}
public bool Required { get; private set; }
}
/// <summary>
/// Indicates that the value of the marked type (or its derivatives)
/// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
/// should be used instead. However, using '==' or '!=' for comparison
/// with <c>null</c> is always permitted.
/// </summary>
/// <example><code>
/// [CannotApplyEqualityOperator]
/// class NoEquality { }
/// class UsesNoEquality {
/// public void Test() {
/// var ca1 = new NoEquality();
/// var ca2 = new NoEquality();
/// if (ca1 != null) { // OK
/// bool condition = ca1 == ca2; // Warning
/// }
/// }
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Interface | AttributeTargets.Class |
AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
/// <summary>
/// When applied to a target attribute, specifies a requirement for any type marked
/// with the target attribute to implement or inherit specific type or types.
/// </summary>
/// <example><code>
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
/// public class ComponentAttribute : Attribute { }
/// [Component] // ComponentAttribute requires implementing IComponent interface
/// public class MyComponent : IComponent { }
/// </code></example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
[BaseTypeRequired(typeof(Attribute))]
public sealed class BaseTypeRequiredAttribute : Attribute
{
public BaseTypeRequiredAttribute([NotNull] Type baseType)
{
BaseType = baseType;
}
[NotNull] public Type BaseType { get; private set; }
}
/// <summary>
/// Indicates that the marked symbol is used implicitly
/// (e.g. via reflection, in external library), so this symbol
/// will not be marked as unused (as well as by other usage inspections)
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public sealed class UsedImplicitlyAttribute : Attribute
{
public UsedImplicitlyAttribute()
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
: this(ImplicitUseKindFlags.Default, targetFlags) { }
public UsedImplicitlyAttribute(
ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
{
UseKindFlags = useKindFlags;
TargetFlags = targetFlags;
}
public ImplicitUseKindFlags UseKindFlags { get; private set; }
public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
/// <summary>
/// Should be used on attributes and causes ReSharper
/// to not mark symbols marked with such attributes as unused
/// (as well as by other usage inspections)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class MeansImplicitUseAttribute : Attribute
{
public MeansImplicitUseAttribute()
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
: this(ImplicitUseKindFlags.Default, targetFlags) { }
public MeansImplicitUseAttribute(
ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
{
UseKindFlags = useKindFlags;
TargetFlags = targetFlags;
}
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
[Flags]
public enum ImplicitUseKindFlags
{
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
/// <summary>Only entity marked with attribute considered used</summary>
Access = 1,
/// <summary>Indicates implicit assignment to a member</summary>
Assign = 2,
/// <summary>
/// Indicates implicit instantiation of a type with fixed constructor signature.
/// That means any unused constructor parameters won't be reported as such.
/// </summary>
InstantiatedWithFixedConstructorSignature = 4,
/// <summary>Indicates implicit instantiation of a type</summary>
InstantiatedNoFixedConstructorSignature = 8,
}
/// <summary>
/// Specify what is considered used implicitly
/// when marked with <see cref="MeansImplicitUseAttribute"/>
/// or <see cref="UsedImplicitlyAttribute"/>
/// </summary>
[Flags]
public enum ImplicitUseTargetFlags
{
Default = Itself,
Itself = 1,
/// <summary>Members of entity marked with attribute are considered used</summary>
Members = 2,
/// <summary>Entity marked with attribute and all its members considered used</summary>
WithMembers = Itself | Members
}
/// <summary>
/// This attribute is intended to mark publicly available API
/// which should not be removed and so is treated as used
/// </summary>
[MeansImplicitUse]
public sealed class PublicAPIAttribute : Attribute
{
public PublicAPIAttribute() { }
public PublicAPIAttribute([NotNull] string comment)
{
Comment = comment;
}
[NotNull] public string Comment { get; private set; }
}
/// <summary>
/// Tells code analysis engine if the parameter is completely handled
/// when the invoked method is on stack. If the parameter is a delegate,
/// indicates that delegate is executed while the method is executed.
/// If the parameter is an enumerable, indicates that it is enumerated
/// while the method is executed
/// </summary>
[AttributeUsage(AttributeTargets.Parameter, Inherited = true)]
public sealed class InstantHandleAttribute : Attribute { }
/// <summary>
/// Indicates that a method does not make any observable state changes.
/// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>
/// </summary>
/// <example><code>
/// [Pure] private int Multiply(int x, int y) { return x * y; }
/// public void Foo() {
/// const int a = 2, b = 2;
/// Multiply(a, b); // Waring: Return value of pure method is not used
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public sealed class PureAttribute : Attribute { }
/// <summary>
/// Indicates that a parameter is a path to a file or a folder
/// within a web project. Path can be relative or absolute,
/// starting from web root (~)
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class PathReferenceAttribute : Attribute
{
public PathReferenceAttribute() { }
public PathReferenceAttribute([PathReference] string basePath)
{
BasePath = basePath;
}
[NotNull] public string BasePath { get; private set; }
}
// ASP.NET MVC attributes
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
{
public AspMvcAreaMasterLocationFormatAttribute(string format) { }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
{
public AspMvcAreaPartialViewLocationFormatAttribute(string format) { }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
{
public AspMvcAreaViewLocationFormatAttribute(string format) { }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcMasterLocationFormatAttribute : Attribute
{
public AspMvcMasterLocationFormatAttribute(string format) { }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
{
public AspMvcPartialViewLocationFormatAttribute(string format) { }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class AspMvcViewLocationFormatAttribute : Attribute
{
public AspMvcViewLocationFormatAttribute(string format) { }
}
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC action. If applied to a method, the MVC action name is calculated
/// implicitly from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcActionAttribute : Attribute
{
public AspMvcActionAttribute() { }
public AspMvcActionAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
[NotNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcAreaAttribute : PathReferenceAttribute
{
public AspMvcAreaAttribute() { }
public AspMvcAreaAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
[NotNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that
/// the parameter is an MVC controller. If applied to a method,
/// the MVC controller name is calculated implicitly from the context.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcControllerAttribute : Attribute
{
public AspMvcControllerAttribute() { }
public AspMvcControllerAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
[NotNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Controller.View(String, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcMasterAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Controller.View(String, Object)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcModelTypeAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that
/// the parameter is an MVC partial view. If applied to a method,
/// the MVC partial view name is calculated implicitly from the context.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcPartialViewAttribute : PathReferenceAttribute { }
/// <summary>
/// ASP.NET MVC attribute. Allows disabling all inspections
/// for MVC views within a class or a method.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class AspMvcSupressViewErrorAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcDisplayTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcEditorTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
/// Use this attribute for custom wrappers similar to
/// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcTemplateAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
/// from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Controller.View(Object)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcViewAttribute : PathReferenceAttribute { }
/// <summary>
/// ASP.NET MVC attribute. When applied to a parameter of an attribute,
/// indicates that this parameter is an MVC action name
/// </summary>
/// <example><code>
/// [ActionName("Foo")]
/// public ActionResult Login(string returnUrl) {
/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
/// return RedirectToAction("Bar"); // Error: Cannot resolve action
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
public sealed class AspMvcActionSelectorAttribute : Attribute { }
[AttributeUsage(
AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Field, Inherited = true)]
public sealed class HtmlElementAttributesAttribute : Attribute
{
public HtmlElementAttributesAttribute() { }
public HtmlElementAttributesAttribute([NotNull] string name)
{
Name = name;
}
[NotNull] public string Name { get; private set; }
}
[AttributeUsage(
AttributeTargets.Parameter | AttributeTargets.Field |
AttributeTargets.Property, Inherited = true)]
public sealed class HtmlAttributeValueAttribute : Attribute
{
public HtmlAttributeValueAttribute([NotNull] string name)
{
Name = name;
}
[NotNull] public string Name { get; private set; }
}
// Razor attributes
/// <summary>
/// Razor attribute. Indicates that a parameter or a method is a Razor section.
/// Use this attribute for custom wrappers similar to
/// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, Inherited = true)]
public sealed class RazorSectionAttribute : Attribute { }
} | TED-996/StackLang | StackLang.Ide/Properties/Annotations.cs | C# | mit | 23,772 | [
30522,
2478,
2291,
1025,
1001,
10975,
8490,
2863,
5432,
4487,
19150,
18914,
2487,
1013,
1013,
24501,
8167,
4842,
4487,
19150,
15171,
4168,
21784,
1012,
3795,
1013,
1013,
24501,
8167,
4842,
4487,
19150,
15171,
28689,
22828,
1012,
2334,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* packet-v5ef.c
* Routines for V5 envelope function frame disassembly
* Rolf Fiedler <rolf.fiedler@innoventif.de>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* V5 bitstream over HDLC handling
*
* V5 references:
*
* ETS 300 324-1
* ETS 300 347-1
*/
#include "config.h"
#include <epan/packet.h>
#include <wiretap/wtap.h>
void proto_register_v5ef(void);
static int proto_v5ef = -1;
static int hf_v5ef_direction = -1;
static int hf_v5ef_address = -1;
static int hf_v5ef_eah = -1;
static int hf_v5ef_ea1 = -1;
static int hf_v5ef_eal = -1;
static int hf_v5ef_ea2 = -1;
static gint ett_v5ef = -1;
static gint ett_v5ef_address = -1;
static dissector_handle_t v5dl_handle, lapd_handle;
/*
* Bits in the address field.
*/
#define V5EF_EAH 0xfc00 /* Service Access Point Identifier */
#define V5EF_EAH_SHIFT 10
#define V5EF_EA1 0x0100 /* First Address Extension bit */
#define V5EF_EAL 0x00fe /* Terminal Endpoint Identifier */
#define V5EF_EAL_SHIFT 1
#define V5EF_EA2 0x0001 /* Second Address Extension bit */
static const value_string v5ef_direction_vals[] = {
{ 0, "AN->LE"},
{ 1, "LE->AN"},
{ 0, NULL }
};
#define MAX_V5EF_PACKET_LEN 1024
static int
dissect_v5ef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *v5ef_tree, *addr_tree;
proto_item *v5ef_ti, *addr_ti;
int direction;
int v5ef_header_len;
guint16 addr, eah, eal, efaddr;
tvbuff_t *next_tvb;
const char *srcname = "src";
const char *dstname = "dst";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "V5-EF");
col_clear(pinfo->cinfo, COL_INFO);
addr = tvb_get_ntohs(tvb, 0);
eah = (addr & V5EF_EAH) >> V5EF_EAH_SHIFT;
eal = (addr & V5EF_EAL) >> V5EF_EAL_SHIFT;
efaddr = (eah << 7) + eal;
v5ef_header_len = 2; /* addr */
direction = pinfo->pseudo_header->isdn.uton;
if (direction==0) {
srcname = "LE";
dstname = "AN";
} else if (direction > 0) {
srcname = "AN";
dstname = "LE";
}
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, srcname);
col_set_str(pinfo->cinfo, COL_RES_DL_DST, dstname);
if (tree) {
proto_item *direction_ti;
v5ef_ti = proto_tree_add_item(tree, proto_v5ef, tvb, 0, -1,
ENC_NA);
v5ef_tree = proto_item_add_subtree(v5ef_ti, ett_v5ef);
/*
* Don't show the direction if we don't know it.
*/
if (direction != P2P_DIR_UNKNOWN) {
direction_ti = proto_tree_add_uint(v5ef_tree, hf_v5ef_direction,
tvb, 0, 0, direction);
PROTO_ITEM_SET_GENERATED(direction_ti);
}
addr_ti = proto_tree_add_uint(v5ef_tree, hf_v5ef_address, tvb,
0, 2, addr);
addr_tree = proto_item_add_subtree(addr_ti, ett_v5ef_address);
proto_tree_add_uint(addr_tree, hf_v5ef_eah, tvb, 0, 1, addr);
proto_tree_add_uint(addr_tree, hf_v5ef_ea1, tvb, 0, 1, addr);
proto_tree_add_uint(addr_tree, hf_v5ef_eal, tvb, 1, 1, addr);
proto_tree_add_uint(addr_tree, hf_v5ef_ea2, tvb, 1, 1, addr);
}
else {
v5ef_ti = NULL;
v5ef_tree = NULL;
}
if (tree)
proto_item_set_len(v5ef_ti, v5ef_header_len);
next_tvb = tvb_new_subset_remaining(tvb, v5ef_header_len);
if (efaddr>8175)
call_dissector(v5dl_handle,next_tvb, pinfo, tree);
else
call_dissector(lapd_handle,next_tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
void
proto_reg_handoff_v5ef(void);
void
proto_register_v5ef(void)
{
static hf_register_info hf[] = {
{ &hf_v5ef_direction,
{ "Direction", "v5ef.direction", FT_UINT8, BASE_DEC, VALS(v5ef_direction_vals), 0x0,
NULL, HFILL }},
{ &hf_v5ef_address,
{ "Address Field", "v5ef.address", FT_UINT16, BASE_HEX, NULL, 0x0,
"Address", HFILL }},
{ &hf_v5ef_eah,
{ "EAH", "v5ef.eah", FT_UINT16, BASE_DEC, NULL, V5EF_EAH,
"Envelope Address High Part", HFILL }},
{ &hf_v5ef_ea1,
{ "EA1", "v5ef.ea1", FT_UINT16, BASE_DEC, NULL, V5EF_EA1,
"First Address Extension bit", HFILL }},
{ &hf_v5ef_eal,
{ "EAL", "v5ef.eal", FT_UINT16, BASE_DEC, NULL, V5EF_EAL,
"Envelope Address Low Part", HFILL }},
{ &hf_v5ef_ea2,
{ "EA2", "v5ef.ea2", FT_UINT16, BASE_DEC, NULL, V5EF_EA2,
"Second Address Extension bit", HFILL }},
};
static gint *ett[] = {
&ett_v5ef,
&ett_v5ef_address,
};
proto_v5ef = proto_register_protocol("V5 Envelope Function (v5ef)",
"v5ef", "v5ef");
proto_register_field_array (proto_v5ef, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("v5ef", dissect_v5ef, proto_v5ef);
}
void
proto_reg_handoff_v5ef(void)
{
dissector_handle_t v5ef_handle;
v5ef_handle = find_dissector("v5ef");
dissector_add_uint("wtap_encap", WTAP_ENCAP_V5_EF, v5ef_handle);
lapd_handle = find_dissector("lapd");
v5dl_handle = find_dissector("v5dl");
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
| lemenkov/wireshark | epan/dissectors/packet-v5ef.c | C | gpl-2.0 | 5,761 | [
30522,
1013,
1008,
14771,
1011,
1058,
2629,
12879,
1012,
1039,
1008,
23964,
2005,
1058,
2629,
11255,
3853,
4853,
4487,
20939,
3366,
14905,
2135,
1008,
23381,
10882,
2098,
3917,
1026,
23381,
1012,
10882,
2098,
3917,
1030,
7601,
25592,
3775,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
* Copyright (c) 2021 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.samples.jaxrs;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
@WebServlet("/HelloRest20ClientServlet")
public class HelloRest20ClientServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter pw = resp.getWriter();
String port = req.getParameter("port");
if (port == null) {
pw.write("Can not get port");
return;
}
StringBuilder sb = new StringBuilder("http://localhost:").append(port).append("/rs20ApplicationWithClient/hello");
ClientBuilder cb = ClientBuilder.newBuilder();
Client c = cb.build();
WebTarget t = c.target(sb.toString());
Response response = t.request().get();
String result = response.readEntity(String.class);
pw.write(result);
}
}
| OpenLiberty/open-liberty | dev/io.openliberty.ws.jaxrs.global.handler.internal_fat/test-applications/rs20ApplicationWithClient/src/com/ibm/samples/jaxrs/HelloRest20ClientServlet.java | Java | epl-1.0 | 1,856 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
30524,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from .circleclient import __version__
| qba73/circleclient | circleclient/__init__.py | Python | mit | 39 | [
30522,
2013,
1012,
4418,
20464,
11638,
12324,
1035,
1035,
2544,
1035,
1035,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ****************************************************************************
**
** COPYRIGHT (C) 1987 MICROSOFT
**
** ****************************************************************************
*
* Module: Functions for Insert Field
*
**
** REVISIONS
**
** Date Who Rel Ver Remarks
**
** 10/15/87 yxy new file
**
** ************************************************************************* */
#define NOMINMAX
#define NOSCROLL
#define NOSHOWWINDOW
#define NOREGION
#define NOVIRTUALKEYCODES
#define NOWH
#define NORASTEROPS
#define NOGDI
#define NOMETAFILE
#define NOBITMAP
#define NOWNDCLASS
#define NOBRUSH
#define NOWINOFFSETS
#define NONCMESSAGES
#define NOKEYSTATE
#define NOCLIPBOARD
#define NOHDC
#define NOCREATESTRUCT
#define NOTEXTMETRIC
#define NOGDICAPMASKS
#define NODRAWTEXT
#define NOSYSMETRICS
#define NOMENUS
#define NOMB
#define NOCOLOR
#define NOPEN
#define NOFONT
#define NOOPENFILE
#define NOMEMMGR
#define NORESOURCE
#define NOSYSCOMMANDS
#define NOICON
#define NOKANJI
#define NOSOUND
#define NOCOMM
#include "word.h"
DEBUGASSERTSZ /* WIN - bogus macro for assert string */
#include "heap.h"
#include "doc.h"
#include "props.h"
#include "inter.h"
#include "debug.h"
#include "ch.h"
#include "sel.h"
#include "dlbenum.h"
#include "field.h"
#include "style.h"
#include "cmdtbl.h"
#include "opuscmd.h"
#include "ifld.h"
#include "insfield.h"
#include "idd.h"
#include "sdmdefs.h"
#include "sdmver.h"
#include "sdm.h"
#include "sdmtmpl.h"
#include "sdmparse.h"
#include "insfield.hs"
#include "insfield.sdm"
#ifdef PROTOTYPE
#include "insfield.cpt"
#endif /* PROTOTYPE */
extern struct SEL selCur;
extern CHAR szEmpty[];
extern CHAR (**vhmpiststcp)[];
extern int vfShowAllStd;
extern int vstcBackup;
extern int vdocStsh;
extern int vistLbMac;
CHAR *PchKeywordFromSyntax();
int FAbstEnumDateInst();
int FAbstEnumTimeInst();
int FAbstEnumGlossInst();
int FAbstEnumInfoInst();
int FAbstEnumNumInst();
int FAbstEnumPNumInst();
int FAbstEnumBkmkInst();
int FAbstEnumStyleInst();
int FAbstEnumTOCInst();
int FAbstEnumIndexInst();
int FAbstEnumEqInst();
int FAbstEnumMacroInst();
int FAbstEnumPrintInst();
/* Define the order in which they are listed (in insfield.h) */
csconst FD rgfd[] = rgfdDef;
csconst CHAR stzApFldSwFormat[] = stzApFldSwFormatDef;
/* %%Function: CmdInsField %%Owner: bobz */
CMD CmdInsField(pcmb)
CMB * pcmb;
{
int tmc;
int cmd = cmdOK;
CABINSFIELD *pcabifld;
if (pcmb->fDefaults)
{
pcabifld = (CABINSFIELD *) *pcmb->hcab;
pcabifld->uFlt = 0; /* Select the first entry. */
pcabifld->uInst = uNinch;
if (!FSetCabSz(pcmb->hcab, szEmpty, Iag(CABINSFIELD, hszFld)))
return cmdNoMemory;
}
if (pcmb->fDialog)
{
CHAR dlt [sizeof (dltInsField)];
BltDlt(dltInsField, dlt);
switch (TmcOurDoDlg(dlt, pcmb))
{
#ifdef DEBUG
default:
Assert(fFalse);
return cmdError;
#endif
case tmcError:
return cmdError;
case tmcCancel:
return cmdCancelled;
case tmcOK:
break;
}
}
if (pcmb->fAction)
{
CHAR szUser [ichMaxBufDlg];
GetCabSz(pcmb->hcab, szUser, ichMaxBufDlg,
Iag(CABINSFIELD, hszFld));
cmd = CmdInsFltSzAtSelCur(fltNil, szUser, imiInsField,
fTrue, fTrue, fTrue);
PushInsSelCur();
}
return cmd;
}
/* %%Function: FDlgInsField %%Owner: bobz */
BOOL FDlgInsField(dlm, tmc, wNew, wOld, wParam)
DLM dlm;
TMC tmc;
WORD wOld, wNew, wParam;
{
CABINSFIELD *pcabifld;
BOOL (*pfnFAbstEnum)();
int ifd;
HCAB hcab;
CHAR sz[ichMaxBufDlg];
switch (dlm)
{
case dlmInit:
/* Set the initial text */
hcab = HcabDlgCur();
Assert (hcab);
pcabifld = (CABINSFIELD *) *hcab;
FillLBoxInst(pcabifld->uFlt, sz);
break;
case dlmTerm:
if (tmc != tmcOK)
break;
if ((hcab = HcabFromDlg(fFalse)) == hcabNotFilled)
return fFalse;
if (hcab == hcabNull)
{
LRetErr:
/* sdm will take down the dialog */
return (fTrue);
}
/* Can't do this after exitting the dialog, because
(*pfnFAbstEnum)() requires the dialog to exist
to function properly. */
pcabifld = (CABINSFIELD *) *hcab;
if (pcabifld->uInst != uNinchList)
{
ifd = pcabifld->uFlt;
Assert(ifd != uNinchList && ifd < ifdMax);
pfnFAbstEnum = rgfd[ifd].pfnFAbstEnum;
Assert(pfnFAbstEnum != NULL);
GetCabSz(hcab, sz, ichMaxBufDlg,
Iag(CABINSFIELD, hszFld));
pcabifld = *hcab;
(*pfnFAbstEnum)(abmAppend, pcabifld->uInst,
sz, ichMaxBufDlg);
if (!FSetCabSz(hcab, sz, Iag(CABINSFIELD, hszFld)))
goto LRetErr;
}
break;
case dlmClick:
switch (tmc)
{
case tmcIFldAdd:
{
int i;
/* Append instructions here. */
i = ValGetTmc(tmcIFldInst);
if (i != LB_ERR)
{
ifd = ValGetTmc(tmcIFldFlt);
Assert(ifd < ifdMax);
pfnFAbstEnum = rgfd[ifd].pfnFAbstEnum;
Assert(pfnFAbstEnum != NULL);
GetTmcText(tmcIFldTxt, sz, ichMaxBufDlg);
(*pfnFAbstEnum)(abmAppend, i, sz, ichMaxBufDlg);
SetTmcText(tmcIFldTxt, sz);
SetTmcVal(tmcIFldInst, uNinchList);
/* have to do this if was disabled */
GrayButtonOnBlank(tmcIFldTxt, tmcOK);
/* should not be blank or add would
not be enabled
*/
Assert(FEnabledTmc(tmcOK));
SetFocusTmc(tmcOK);
EnableTmc(tmcIFldAdd, fFalse);
}
}
return fFalse; /* so this will not get recorded yet */
case tmcIFldInst:
EnableTmc(tmcIFldAdd,
ValGetTmc(tmcIFldInst) != LB_ERR);
break;
case tmcIFldFlt:
ifd = ValGetTmc(tmcIFldFlt);
if (ifd != uNinchList)
{
FillLBoxInst(ifd, sz);
}
else
{
EnableTmc(tmcIFldInst, fFalse);
SetTmcText(tmcIFldSyntax, szEmpty);
SetTmcText(tmcIFldHelp, szEmpty);
}
break;
}
break;
case dlmChange:
if (tmc == tmcIFldTxt)
{
GrayButtonOnBlank(tmcIFldTxt, tmcOK);
break;
}
break;
}
return fTrue;
}
/* F i l l L B o x I n s t */
/* %%Function: FillLBoxInst %%Owner: bobz */
FillLBoxInst(ifd, sz)
int ifd;
CHAR sz[];
{
BOOL (*pfnFAbstEnum)();
Assert(ifd < ifdMax);
SetFldDescrTxt(ifd, tmcIFldFlt, tmcIFldSyntax,
tmcIFldTxt, tmcIFldHelp);
pfnFAbstEnum = rgfd[ifd].pfnFAbstEnum;
if (pfnFAbstEnum == NULL ||
(*pfnFAbstEnum)(abmEnumInit, 0, NULL, 0) == 0)
{
SetTmcVal(tmcIFldInst, uNinchList);
StartListBoxUpdate(tmcIFldInst); /* empties box */
EndListBoxUpdate(tmcIFldInst);
EnableTmc(tmcIFldInst, fFalse);
EnableTmc(tmcIFldAdd, fFalse);
}
else
{
int i;
BOOL fEnable;
/* Fill the inst. list box here. */
EnableTmc(tmcIFldInst, fTrue); /* so scroll bars will be activated */
if (pfnFAbstEnum != FAbstEnumMacroInst)
StartListBoxUpdate(tmcIFldInst);
for (i = 0;
((*pfnFAbstEnum)(abmEnum, i, sz, ichMaxBufDlg));
i++)
{
AddListBoxEntry(tmcIFldInst, sz);
}
if (pfnFAbstEnum != FAbstEnumMacroInst)
EndListBoxUpdate(tmcIFldInst);
i = CEntryListBoxTmc(tmcIFldInst);
fEnable = (i != 0 && i != LB_ERR);
EnableTmc(tmcIFldInst, fEnable);
SetTmcVal(tmcIFldInst, uNinchList);
EnableTmc(tmcIFldAdd, fFalse);
}
}
/* P A R S E F L D L I S T */
/* %%Function: WListFld %%Owner: bobz */
WORD WListFld(tmm, sz, isz, filler, tmc, wParam)
TMM tmm;
CHAR * sz;
int isz;
WORD filler;
TMC tmc;
WORD wParam;
{
switch (tmm)
{
case tmmCount:
return -1;
case tmmText:
if (isz < ifdMax)
{
bltbx((CHAR FAR *) &((rgfd[isz].stzName)[1]),
(CHAR FAR *) sz,
(int) ((rgfd[isz].stzName)[0]));
return fTrue;
}
}
return 0;
}
/* S E T F L D D E S C R T X T */
/* Assumes the focus is in tmcFldFlt */
/* %%Function: SetFldDescrTxt %%Owner: bobz */
SetFldDescrTxt(ifd, tmcFldFlt, tmcFldSyntax, tmcFldTxt, tmcFldHelp)
int ifd;
int tmcFldFlt;
int tmcFldSyntax;
int tmcFldTxt;
int tmcFldHelp;
{
CHAR *pchPen;
int cch;
CHAR sz[cchSzFdMax];
Assert(ifd >= 0);
/* Syntax Text */
bltbx((CHAR FAR *) (&(rgfd[ifd].stzSyntax)[1]),
(CHAR FAR *) sz,
(int) ((rgfd[ifd].stzSyntax)[0]));
SetTmcText(tmcFldSyntax, sz);
pchPen = PchKeywordFromSyntax(sz);
*pchPen++ = chSpace;
*pchPen++ = '\0';
AnsiLower(sz);
SetTmcText(tmcFldTxt, sz);
#ifdef HORRIBLEFLUSHING
cch = CchSz(sz) - 2;
TmcSetSel(tmcFldTxt, cch, cch);
TmcSetFocus(tmcFldFlt);
EnableTmc(tmcFldTxt, fTrue);
#endif /* HORRIBLEFLUSHING */
/* Set help text. */
bltbx((CHAR FAR *) (&(rgfd[ifd].stzHelp)[1]),
(CHAR FAR *) sz,
(int) ((rgfd[ifd].stzHelp)[0]));
SetTmcText(tmcFldHelp, sz);
}
/* ------------- Set of FAbstEnumX functions ---------------- */
/* string table handle shared by FAbstEnumX functions. */
struct STTB **hsttbAbstEnum;
#ifdef DEBUG
struct STTB **hsttbAbstEnumUsed;
#endif
csconst AEPIC rgaepicDate[] = rgaepicDateDef;
csconst CHAR stzDTPicSw[] = stzDTPicSwDef;
/* %%Function: FAbstEnumDateInst %%Owner: bobz */
int FAbstEnumDateInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR *pch;
CHAR szT[cchMaxPic + cchDTPicSwMax + 2];
CHAR szT1[cchMaxPic];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaepicDateMax + 1;
case abmAppend:
bltbx((CHAR FAR *) &stzDTPicSw[1], (CHAR FAR *) szT,
(int) stzDTPicSw[0]);
pch = szT + stzDTPicSw[0] - 1;
GetTmcText(tmcIFldInst, pch, sizeof (szT) - stzDTPicSw[0]);
if (*pch != '\0')
{
FieldLegalSz(pch, szT1, cchMaxPic + 2, fFalse);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
case abmEnum:
if (iae < iaepicDateMax)
{
if (iae != 0)
{
bltbx((CHAR FAR *) &(rgaepicDate[iae - 1].stzPic[1]),
(CHAR FAR *) sz,
(int) (rgaepicDate[iae - 1].stzPic[0]));
}
else
{
DefSzPicDTTmplt(fTrue, szT1, cchMaxPic);
LocalSzPicDTTmplt(szT1, sz);
}
return (fTrue);
}
else if (iae == iaepicDateMax)
{
Assert(ichMax >= cchMaxPic * 2 + 1);
GetDefSzPicDT(sz);
return fTrue;
}
return (fFalse);
}
Assert (fFalse);
}
csconst AEPIC rgaepicTime[] = rgaepicTimeDef;
/* %%Function: FAbstEnumTimeInst %%Owner: bobz */
int FAbstEnumTimeInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR *pch;
CHAR szT[cchMaxPic + cchDTPicSwMax + 2];
CHAR szT1[cchMaxPic];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaepicTimeMax;
case abmAppend:
bltbx((CHAR FAR *) &stzDTPicSw[1], (CHAR FAR *) szT,
(int) stzDTPicSw[0]);
pch = szT + stzDTPicSw[0] - 1;
GetListBoxEntry(tmcIFldInst, iae, pch,
sizeof (szT) - stzDTPicSw[0]);
if (*pch != '\0')
{
FieldLegalSz(pch, szT1, cchMaxPic + 2, fFalse);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
case abmEnum:
if (iae < iaepicTimeMax)
{
bltbx((CHAR FAR *) &(rgaepicTime[iae].stzPic[1]),
(CHAR FAR *) szT1,
(int) (rgaepicTime[iae].stzPic[0]));
LocalSzPicDTTmplt(szT1, sz);
return (fTrue);
}
return (fFalse);
}
Assert (fFalse);
}
/* %%Function: FAbstEnumGlossInst %%Owner: bobz */
int FAbstEnumGlossInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchGlsyMax], szT1[cchGlsyMax];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return 1;
case abmEnum:
FEnsureGlsyInited();
FillTmcGlossary(tmcIFldInst, fFalse);
return (fFalse);
case abmAppend:
GetListBoxEntry(tmcIFldInst, iae, szT, sizeof (szT));
if (szT[0] != '\0')
{
FieldLegalSz(szT, szT1, cchGlsyMax, fFalse);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
}
Assert (fFalse);
}
csconst CHAR rgifdInfo[] = rgifdInfoDef;
/* %%Function: FAbstEnumInfoInst %%Owner: bobz */
int FAbstEnumInfoInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchMaxFieldKeyword + 1];
int ifd;
Assert(abmMin <= abm && abm < abmMax);
ifd = rgifdInfo[iae];
switch (abm)
{
case abmEnumInit:
return iifdInfoMax;
case abmEnum:
if (iae < iifdInfoMax)
{
bltbx((CHAR FAR *) &(rgfd[ifd].stzName[1]),
(CHAR FAR *) sz,
(int) (rgfd[ifd].stzName[0]));
return (fTrue);
}
return (fFalse);
case abmAppend:
if (iae >= iifdInfoMax)
{
/* Wimp out. */
return fFalse;
}
bltbx((CHAR FAR *) &(rgfd[ifd].stzSyntax[1]),
(CHAR FAR *) &szT[0], cchMaxFieldKeyword + 1);
szT[cchMaxFieldKeyword + 1] = '\0';
PchKeywordFromSyntax(&szT[0]);
AnsiLower(szT);
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
csconst AEPIC rgaepicNum[] = rgaepicNumDef;
csconst CHAR stzNumPicSw[] = stzNumPicSwDef;
/* %%Function: FAbstEnumNumInst %%Owner: bobz */
int FAbstEnumNumInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR *pch;
CHAR szT[cchMaxPic + cchNumPicSwMax + 2];
CHAR szT1[cchMaxPic];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaepicNumMax;
case abmAppend:
bltbx((CHAR FAR *) &stzNumPicSw[1], (CHAR FAR *) szT,
(int) stzNumPicSw[0]);
pch = szT + stzNumPicSw[0] - 1;
GetListBoxEntry(tmcIFldInst, iae, pch,
sizeof (szT) - stzNumPicSw[0]);
if (*pch != '\0')
{
FieldLegalSz(pch, szT1, cchMaxPic + 2, fTrue);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
case abmEnum:
if (iae < iaepicNumMax)
{
bltbx((CHAR FAR *) &(rgaepicNum[iae].stzPic[1]),
(CHAR FAR *) szT1,
(int) (rgaepicNum[iae].stzPic[0]));
LocalSzPicNumTmplt(szT1, sz);
return (fTrue);
}
return (fFalse);
}
Assert (fFalse);
}
csconst AELP rgaelpPNum[] = rgaelpPNumDef;
/* %%Function: FAbstEnumPNumInst %%Owner: bobz */
int FAbstEnumPNumInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR *pch;
int cch, cchCopy;
CHAR szT[cchMaxPNumActual + cchApFldSwFormat];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaelpPNumMax;
case abmEnum:
if (iae < iaelpPNumMax)
{
bltbx((CHAR FAR *) &(rgaelpPNum[iae].stzInstName[1]),
(CHAR FAR *) sz,
(int) (rgaelpPNum[iae].stzInstName[0]));
return fTrue;
}
return fFalse;
case abmAppend:
if (iae >= iaelpPNumMax)
{
/* Do nothing */
return fTrue;
}
bltbx((CHAR FAR *) &(stzApFldSwFormat[1]),
(CHAR FAR *) szT,
(int) (stzApFldSwFormat[0]));
pch = szT + stzApFldSwFormat[0] - 1;
bltbx((CHAR FAR *) &(rgaelpPNum[iae].stzInstActual[1]),
(CHAR FAR *) pch,
(int) (rgaelpPNum[iae].stzInstActual[0]));
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
/* %%Function: FAbstEnumBkmkInst %%Owner: bobz */
int FAbstEnumBkmkInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
int ichMac;
CHAR HUGE *hpst, *pch;
CHAR szT[cchBkmkMax + 2], szT1[cchBkmkMax + 2];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
hsttbAbstEnum = PdodMother(selCur.doc)->hsttbBkmk;
Debug(hsttbAbstEnumUsed = hsttbAbstEnum);
return ((hsttbAbstEnum == hNil) ? 0 : (*hsttbAbstEnum)->ibstMac);
case abmAppend:
GetListBoxEntry(tmcIFldInst, iae, szT, sizeof (szT));
if (szT[0] != '\0')
{
FieldLegalSz(szT, szT1, cchBkmkMax + 2, fFalse);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
case abmEnum:
pch = &szT[0];
Assert(hsttbAbstEnum != hNil &&
hsttbAbstEnumUsed == hsttbAbstEnum);
if (iae < (*hsttbAbstEnum)->ibstMac)
{
hpst = HpstFromSttb(hsttbAbstEnum, iae);
ichMac = *hpst++;
Assert(ichMac < cchBkmkMax);
ichMac = min(ichMac, cchBkmkMax);
bltbh(hpst, pch, ichMac);
*(pch + ichMac) = '\0';
bltbyte(szT, sz, ichMac + 1);
return (fTrue);
}
hsttbAbstEnum = hNil;
return (fFalse);
}
Assert (fFalse);
}
/* %%Function: FAbstEnumStyleInst %%Owner: bobz */
int FAbstEnumStyleInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
int ichMac;
CHAR *pst, *pch;
int stcp;
int stc;
struct STSH stsh;
CHAR szT[cchMaxStyle + 2], szT1[cchMaxStyle + 2];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
/* Ensure vhmpiststcp is not in use. */
Assert(vhmpiststcp == hNil);
vhmpiststcp = HAllocateCw(cwMpiststcp);
if (vhmpiststcp == hNil)
{
return 0;
}
else
{
vistLbMac = 0;
SetVdocStsh(selCur.doc);
vstcBackup = stcNil;
vfShowAllStd = fFalse;
GenLbStyleMapping();
return vistLbMac;
}
case abmAppend:
GetListBoxEntry(tmcIFldInst, iae, szT, sizeof (szT));
if (szT[0] != '\0')
{
FieldLegalSz(szT, szT1, cchMaxStyle + 2, fFalse);
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
case abmEnum:
if (vhmpiststcp != hNil && iae < vistLbMac)
{
pch = &szT[0];
stcp = (**vhmpiststcp)[iae];
RecordStshForDocNoExcp(vdocStsh, &stsh);
stc = StcFromStcp(stcp, stsh.cstcStd);
GenStyleNameForStcp(pch, stsh.hsttbName,
stsh.cstcStd, stcp);
Assert(*pch < cchMaxStyle);
ichMac = *pch;
StToSzInPlace(pch);
bltbyte(szT, sz, ichMac + 1);
return (fTrue);
}
/* Clean up the mess that we have created. */
if (vhmpiststcp != hNil)
{
vfShowAllStd = fFalse;
FreePh(&vhmpiststcp);
}
return (fFalse);
}
Assert (fFalse);
}
csconst AELP rgaelpTOC[] = rgaelpTOCDef;
/* %%Function: FAbstEnumTOCInst %%Owner: bobz */
int FAbstEnumTOCInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchMaxTOCActual];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaelpTOCMax;
case abmEnum:
if (iae < iaelpTOCMax)
{
bltbx((CHAR FAR *) &(rgaelpTOC[iae].stzInstName[1]),
(CHAR FAR *) sz,
(int) (rgaelpTOC[iae].stzInstName[0]));
return fTrue;
}
return fFalse;
case abmAppend:
if (iae >= iaelpTOCMax)
{
/* Wimp out. */
return fFalse;
}
bltbx((CHAR FAR *) &(rgaelpTOC[iae].stzInstActual[1]),
(CHAR FAR *) szT,
(int) (rgaelpTOC[iae].stzInstActual[0]));
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
csconst AELP rgaelpIndex[] = rgaelpIndexDef;
/* %%Function: FAbstEnumIndexInst %%Owner: bobz */
int FAbstEnumIndexInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchMaxIndexActual];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaelpIndexMax;
case abmEnum:
if (iae < iaelpIndexMax)
{
bltbx((CHAR FAR *) &(rgaelpIndex[iae].stzInstName[1]),
(CHAR FAR *) sz,
(int) (rgaelpIndex[iae].stzInstName[0]));
return fTrue;
}
return fFalse;
case abmAppend:
if (iae >= iaelpIndexMax)
{
/* Wimp out. */
return fFalse;
}
bltbx((CHAR FAR *) &(rgaelpIndex[iae].stzInstActual[1]),
(CHAR FAR *) szT,
(int) (rgaelpIndex[iae].stzInstActual[0]));
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
csconst AELP rgaelpPrint[] = rgaelpPrintDef;
/* %%Function: FAbstEnumPrintInst %%Owner: bobz */
int FAbstEnumPrintInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchMaxPrintActual];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaelpPrintMax;
case abmEnum:
if (iae < iaelpPrintMax)
{
bltbx((CHAR FAR *) &(rgaelpPrint[iae].stzInstName[1]),
(CHAR FAR *) sz,
(int) (rgaelpPrint[iae].stzInstName[0]));
return fTrue;
}
return fFalse;
case abmAppend:
if (iae >= iaelpPrintMax)
{
/* Wimp out. */
return fFalse;
}
bltbx((CHAR FAR *) &(rgaelpPrint[iae].stzInstActual[1]),
(CHAR FAR *) szT,
(int) (rgaelpPrint[iae].stzInstActual[0]));
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
csconst AELP rgaelpEq[] = rgaelpEqDef;
/* %%Function: FAbstEnumEqInst %%Owner: bradch */
int FAbstEnumEqInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
CHAR szT[cchMaxEqActual];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return iaelpEqMax;
case abmEnum:
if (iae < iaelpEqMax)
{
bltbx((CHAR FAR *) &(rgaelpEq[iae].stzInstName[1]),
(CHAR FAR *) sz,
(int) (rgaelpEq[iae].stzInstName[0]));
return fTrue;
}
return fFalse;
case abmAppend:
if (iae >= iaelpEqMax)
{
/* Wimp out. */
return fFalse;
}
bltbx((CHAR FAR *) &(rgaelpEq[iae].stzInstActual[1]),
(CHAR FAR *) szT,
(int) (rgaelpEq[iae].stzInstActual[0]));
AppendSzWordSz(sz, szT, ichMax);
return (fTrue);
}
Assert (fFalse);
}
/* %%Function: FAbstEnumMacroInst %%Owner: bradch */
int FAbstEnumMacroInst(abm, iae, sz, ichMax)
int abm, iae, ichMax;
CHAR sz[];
{
int cch;
CHAR szT[cchMaxSyName + 1];
Assert(abmMin <= abm && abm < abmMax);
switch (abm)
{
case abmEnumInit:
return 1;
case abmEnum:
/* We only need to this once */
StartLongOp();
FillMacroListTmc(tmcIFldInst, mctAll);
EndLongOp(fFalse);
return (fFalse);
case abmAppend:
GetListBoxEntry(tmcIFldInst, iae, szT, sizeof (szT));
if (szT[0] != '\0')
{
cch = CchSz(szT) - 1;
szT[cch] = chSpace;
szT[cch + 1] = '\0';
AppendSzWordSz(sz, szT, ichMax);
}
return (fTrue);
}
Assert (fFalse);
}
/* ------------- Miscellaneous Functions ---------------- */
/* %%Function: PchKeywordFromSyntax %%Owner: bobz */
CHAR *PchKeywordFromSyntax(sz)
CHAR *sz;
{
CHAR *pchLim, *pchEye, *pchPen;
/* Derive the field keyword from syntax string. */
pchLim = index(sz, chSpace);
if (pchLim != NULL)
{
for (pchEye = pchPen = sz; pchEye < pchLim; pchEye++)
{
if (*pchEye != chOptBeg && *pchEye != chOptEnd)
{
*pchPen++ = *pchEye;
}
}
}
else
{
pchPen = sz + CchSz(sz) - 1;
}
*pchPen = '\0';
return pchPen;
}
/* %%Function: AppendSzWordSz %%Owner: bobz */
AppendSzWordSz(szWord, sz, ichMax)
CHAR *szWord;
CHAR *sz;
int ichMax;
{
int cch, cchCopy;
CHAR *pch;
cch = CchSz(szWord) - 1;
if (cch >= ichMax)
{
/* It's full already. no can do... */
return;
}
pch = &szWord[cch - 1];
if (!FWhite(*pch))
{
*(++pch) = chSpace;
cch++;
}
pch++;
cchCopy = CchSz(sz);
cchCopy = min(cchCopy, ichMax - cch);
bltbyte(sz, pch, cchCopy);
szWord[ichMax - 1] = '\0';
}
/* %%Function: FieldLegalSz %%Owner: bobz */
FieldLegalSz(szSrc, szT, ichMax, fQuoteIt)
CHAR *szSrc;
CHAR *szT;
int ichMax;
BOOL fQuoteIt;
{
CHAR *pchEye, *pchPen, *pchLim;
int cch;
/* Reserve space for possible quotes. */
pchLim = szT + ichMax - 2;
for (pchEye = szSrc, pchPen = szT; pchPen < pchLim && *pchEye != '\0';
pchEye++, pchPen++)
{
if (FWhite(*pchEye))
{
fQuoteIt = fTrue;
#ifdef CRLF
if (*pchEye == chReturn || *pchEye == chEol)
#else
if (*pchEye == chEol)
#endif /* CRLF */
{
*pchPen = chSpace;
}
else
{
*pchPen = *pchEye;
}
}
else if (*pchEye == chGroupExternal)
{
*pchPen++ = chFieldEscape;
if (pchPen >= pchLim)
{
pchPen--;
break;
}
*pchPen = chGroupExternal;
}
else if (*pchEye == chFieldEscape)
{
*pchPen++ = chFieldEscape;
if (pchPen >= pchLim)
{
pchPen--;
break;
}
*pchPen = chFieldEscape;
}
else
{
*pchPen = *pchEye;
}
}
*pchPen = '\0';
cch = pchPen - szT;
pchPen = szSrc;
pchEye = szT;
if (fQuoteIt)
{
*pchPen++ = chGroupExternal;
}
bltbyte(pchEye, pchPen, cch);
pchPen += cch;
if (fQuoteIt)
{
*pchPen++ = chGroupExternal;
}
*pchPen = '\0';
}
| mindcont/OpenSource | Microsoft DOS/Word 1.1a CHM Distribution/Opus/insfield.c | C | cc0-1.0 | 23,239 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nav{height:64px;line-height:64px;border-bottom:1px solid gray}nav::after{content:'';display:block;clear:both}#nav-head{float:left;height:20px;line-height:20px}#nav-p{float:right;height:20px;line-height:20px}footer{position:fixed;bottom:0;left:0;right:0;text-align:center} | eyeA/www.eyeseau.com | dist/css/common.css | CSS | mit | 271 | [
30522,
6583,
2615,
1063,
4578,
1024,
4185,
2361,
2595,
1025,
2240,
1011,
4578,
1024,
4185,
2361,
2595,
1025,
3675,
1011,
3953,
1024,
1015,
2361,
2595,
5024,
3897,
1065,
6583,
2615,
1024,
1024,
2044,
1063,
4180,
1024,
1005,
1005,
1025,
465... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "copyright.h"
#include "qt.h"
// static void *qt_sp_bottom_save;
#ifdef QT_VARGS_DEFAULT
/* If the stack grows down, `vargs' is a pointer to the lowest
address in the block of arguments. If the stack grows up, it is a
pointer to the highest address in the block. */
qt_t *
qt_vargs (qt_t *sp, int nbytes, void *vargs,
void *pt, qt_startup_t *startup,
qt_vuserf_t *vuserf, qt_cleanup_t *cleanup)
{
int i;
sp = QT_VARGS_MD0 (sp, nbytes);
#ifdef QT_GROW_UP
for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
QT_SPUT (QT_VARGS_ADJUST(sp), i, ((qt_word_t *)vargs)[-i]);
}
#else
for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
QT_SPUT (QT_VARGS_ADJUST(sp), i-1, ((qt_word_t *)vargs)[i-1]);
}
#endif
QT_VARGS_MD1 (QT_VADJ(sp));
QT_SPUT (QT_VADJ(sp), QT_VARGT_INDEX, pt);
QT_SPUT (QT_VADJ(sp), QT_VSTARTUP_INDEX, startup);
QT_SPUT (QT_VADJ(sp), QT_VUSERF_INDEX, vuserf);
QT_SPUT (QT_VADJ(sp), QT_VCLEANUP_INDEX, cleanup);
return ((qt_t *)QT_VADJ(sp));
}
#endif /* def QT_VARGS_DEFAULT */
#ifdef __cplusplus
extern "C"
#endif
void
qt_null (void)
{
}
#ifdef __cplusplus
extern "C"
#endif
void
qt_error (void)
{
extern void abort(void);
abort();
}
| pombredanne/metamorphosys-desktop | metamorphosys/tonka/models/SystemC/systemc-2.3.0/src/sysc/qt/qt.c | C | mit | 1,269 | [
30522,
1001,
2421,
1000,
9385,
1012,
1044,
1000,
1001,
2421,
1000,
1053,
2102,
1012,
1044,
1000,
1013,
1013,
10763,
11675,
1008,
1053,
2102,
1035,
11867,
1035,
3953,
1035,
3828,
1025,
1001,
2065,
3207,
2546,
1053,
2102,
1035,
13075,
5620,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.subsys.web;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.jboss.as.console.client.Console;
import org.jboss.as.console.client.domain.model.SimpleCallback;
import org.jboss.as.console.client.shared.model.ModelAdapter;
import org.jboss.dmr.client.ModelDescriptionConstants;
import org.jboss.dmr.client.ModelNode;
import org.jboss.dmr.client.dispatch.DispatchAsync;
import org.jboss.dmr.client.dispatch.impl.DMRAction;
import org.jboss.dmr.client.dispatch.impl.DMRResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.jboss.dmr.client.ModelDescriptionConstants.INCLUDE_RUNTIME;
import static org.jboss.dmr.client.ModelDescriptionConstants.RECURSIVE;
/**
* @author Pavel Slegr
* @date 3/19/12
*/
public class LoadSocketBindingsCmd {
private DispatchAsync dispatcher;
private int syncCounter;
private Map<String,String> sgbBind;
private String finalSGB = "standard-sockets";
public LoadSocketBindingsCmd(DispatchAsync dispatcher) {
this.dispatcher = dispatcher;
}
public void loadSocketBindingGroupForName(String groupName, final AsyncCallback<List<String>> callback)
{
ModelNode op = new ModelNode();
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION);
op.get(ModelDescriptionConstants.ADDRESS).add("socket-binding-group", groupName);
op.get(ModelDescriptionConstants.CHILD_TYPE).set("socket-binding");
dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
if(ModelAdapter.wasSuccess(response))
{
List<ModelNode> payload = response.get("result").asList();
List<String> records = new ArrayList<String>(payload.size());
for(ModelNode binding : payload)
{
if(binding.asString().contains("socket-binding")){}
records.add(binding.asString());
}
callback.onSuccess(records);
}
else
{
callback.onFailure(new RuntimeException("Failed to load socket binding groups"));
}
}
});
}
private void loadServerGroupNames(final AsyncCallback<List<String>> callback)
{
ModelNode op = new ModelNode();
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION);
op.get(ModelDescriptionConstants.OP_ADDR).setEmptyList();
op.get(ModelDescriptionConstants.CHILD_TYPE).set("server-group");
dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
if(ModelAdapter.wasSuccess(response))
{
List<ModelNode> payload = response.get("result").asList();
List<String> records = new ArrayList<String>(payload.size());
for(ModelNode binding : payload)
{
records.add(binding.asString());
}
callback.onSuccess(records);
}
else
{
callback.onFailure(new RuntimeException("Failed to load socket binding groups"));
}
}
});
}
private void getSocketBindingGroupForServerGroup(final String groupName, final AsyncCallback<String[]> callback) {
ModelNode op = new ModelNode();
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_RESOURCE_OPERATION);
op.get(ModelDescriptionConstants.ADDRESS).add("server-group", groupName);
op.get(RECURSIVE).set(true);
op.get(INCLUDE_RUNTIME).set(true);
dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
if(ModelAdapter.wasSuccess(response))
{
List<ModelNode> payload = response.get("result").asList();
List<String> records = new ArrayList<String>(payload.size());
String profile = null;
String sbgRef = null;
for(ModelNode binding : payload)
{
if(binding.asString().contains("\"profile\"")){
profile = sanitizeProperty(binding.asString());
}
if(binding.asString().contains("\"socket-binding-group\"")){
sbgRef = sanitizeProperty(binding.asString());
}
records.add(binding.asString());
}
callback.onSuccess(new String[]{profile,sbgRef});
}
else
{
callback.onFailure(new RuntimeException("Failed load server config " + groupName));
}
}
});
}
public void loadSocketBindingGroupForSelectedProfile(final AsyncCallback<List<String>> callback) {
final String selectedProfile = Console.MODULES.getCurrentSelectedProfile().getName();
if(selectedProfile != null){
this.loadServerGroupNames(new SimpleCallback<List<String>>() {
@Override
public void onSuccess(final List<String> groupNames) {
sgbBind = new HashMap<String,String>();
if(groupNames.isEmpty())
{
//edge case: no server groups exist
callback.onSuccess(Collections.EMPTY_LIST);
}
else
{
// regular case
for(final String groupName : groupNames){
getSocketBindingGroupForServerGroup(groupName, new SimpleCallback<String[]>() {
@Override
public void onSuccess(String[] result) {
sgbBind.put(result[0], result[1]);
if(sync(groupNames.size())){
loadSocketBindingGroupForName(finalSGB,new SimpleCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
callback.onSuccess(result);
}
});
}
}
@Override
public void onFailure(Throwable caught) {
super.onFailure(caught);
// increase syncCounter in case of Failure to prevent to show empty list of sockets, but rather show standard-sockets one
syncCounter++;
}
});
}
}
}
});
}
else{
loadSocketBindingGroupForName(finalSGB,new SimpleCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
callback.onSuccess(result);
}
});
}
}
private String sanitizeProperty(String value){
String prop = value;
String propSubstr = prop.substring(prop.indexOf("=>"),prop.length());
int beginIndex = propSubstr.indexOf("\"");
int endIndex = propSubstr.lastIndexOf("\"");
return propSubstr.substring(beginIndex + 1, endIndex);
}
private boolean sync(int maxCounts){
this.syncCounter++;
if(this.syncCounter == maxCounts){
final String selectedProfile = Console.MODULES.getCurrentSelectedProfile().getName();
if(this.sgbBind.containsKey(selectedProfile)) {
this.finalSGB = this.sgbBind.get(selectedProfile);
}
else{
this.finalSGB = "standard-sockets";
}
this.syncCounter = 0;
this.sgbBind = new HashMap<String,String>();
return true;
}
return false;
}
}
| hal/core | gui/src/main/java/org/jboss/as/console/client/shared/subsys/web/LoadSocketBindingsCmd.java | Java | lgpl-2.1 | 10,339 | [
30522,
1013,
1008,
1008,
1046,
15853,
2015,
1010,
2188,
1997,
2658,
2330,
3120,
1008,
9385,
2249,
2417,
6045,
4297,
1012,
1998,
1013,
2030,
2049,
18460,
1998,
2060,
16884,
1008,
2004,
5393,
2011,
1996,
1030,
3166,
22073,
1012,
2035,
2916,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef _MFnPlugin
#define _MFnPlugin
//
//-
// ==========================================================================
// Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors. All
// rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its
// licensors, which is protected by U.S. and Canadian federal copyright law
// and by international treaties.
//
// The Data may not be disclosed or distributed to third parties or be
// copied or duplicated, in whole or in part, without the prior written
// consent of Autodesk.
//
// The copyright notices in the Software and this entire statement,
// including the above license grant, this restriction and the following
// disclaimer, must be included in all copies of the Software, in whole
// or in part, and all derivative works of the Software, unless such copies
// or derivative works are solely in the form of machine-executable object
// code generated by a source language processor.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
// AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED
// WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF
// NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
// OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO
// EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST
// REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR
// CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS
// BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.
// ==========================================================================
//+
//
// CLASS: MFnPlugin
//
// *****************************************************************************
//
// CLASS DESCRIPTION (MFnPlugin)
//
// This class is used in the initializePlugin and uninitializePlugin functions
// in a Maya plugin in order to register new services with Maya. The
// constructor for this class is passed the MObject provided by Maya as an
// argument to initializePlugin and uninitializePlugin. Subsequent calls are
// made to the various "register" methods from inside initializePlugin, and to
// the various "deregister" methods from inside uninitializePlugin.
//
// A plug-in's uninitializePlugin function is not called automatically when Maya
// exits. Meaning any code which deallocates resources or a similar task will
// be called when the plug-in is explicitly unloaded but not when Maya exits.
// In order to work-around this problem and execute the code when Maya exits use
// the MSceneMessage class's addCallback method with a message of "kMayaExiting".
// This will register a callback function that will be executed when the
// "kMayaExiting" message occurs. Use this message and the addCallback method
// to deallocate any resources when exiting.
//
// A side effect of including MFnPlugin.h is to embed an API version string
// into the .o file produced. If it is necessary to include MFnPlugin.h
// into more than one file that comprises a plugin, the preprocessor macro
// MNoVersionString should be defined in all but one of those files
// prior to the inclusion of MFnPlugin.h. If this is not done, the linker
// will produce warnings about multiple definitions of the variable
// MApiVersion as the .so file is being produced. These warning are
// harmless and can be ignored. Normally, this will not arise as only the
// file that contains the initializePlugin and uninitializePlugin
// routines should need to include MFnPlugin.h. Plugin developers on the
// Window's API developers will have to define MNoPluginEntry to suppress the
// the creation of multiple definitions of DllMain.
//
// *****************************************************************************
#if defined __cplusplus
// *****************************************************************************
// INCLUDED HEADER FILES
#include <maya/MFnBase.h>
#include <maya/MApiVersion.h>
#include <maya/MPxNode.h>
#include <maya/MPxData.h>
#if !defined(MNoPluginEntry)
#ifdef NT_PLUGIN
#include <maya/MTypes.h>
HINSTANCE MhInstPlugin;
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD /* dwReason */, LPVOID /* lpReserved */)
{
MhInstPlugin = hInstance;
return 1;
}
#endif // NT_PLUGIN
#endif // MNoPluginEntry
// *****************************************************************************
// DECLARATIONS
class MString;
class MFileObject;
class MTypeId;
class MPxMaterialInformation;
class MPxBakeEngine;
///
typedef MPxMaterialInformation* (*MMaterialInfoFactoryFnPtr) (MObject& object);
typedef MPxBakeEngine* (*MBakeEngineCreatorFnPtr)();
// *****************************************************************************
// CLASS DECLARATION (MFnPlugin)
/// Register and deregister plug-in services with Maya
/**
Register plug-in supplied, commands, dependency nodes, etc. with Maya
*/
#ifdef _WIN32
#pragma warning(disable: 4522)
#endif // _WIN32
class OPENMAYA_EXPORT MFnPlugin : public MFnBase
{
public:
///
MFnPlugin();
///
MFnPlugin( MObject& object,
const char* vendor = "Unknown",
const char* version = "Unknown",
const char* requiredApiVersion = "Any",
MStatus* ReturnStatus = 0L );
///
virtual ~MFnPlugin();
///
virtual MFn::Type type() const;
///
MString vendor( MStatus* ReturnStatus=NULL ) const;
///
MString version( MStatus* ReturnStatus=NULL ) const;
///
MString apiVersion( MStatus* ReturnStatus=NULL ) const;
///
MString name( MStatus* ReturnStatus=NULL ) const;
///
MString loadPath( MStatus* ReturnStatus=NULL ) const;
///
MStatus setName( const MString& newName,
bool allowRename = true );
///
MStatus setVersion( const MString& newVersion );
///
MStatus registerCommand(const MString& commandName,
MCreatorFunction creatorFunction,
MCreateSyntaxFunction
createSyntaxFunction = NULL);
///
MStatus deregisterCommand( const MString& commandName );
///
MStatus registerControlCommand(const MString& commandName,
MCreatorFunction creatorFunction
);
///
MStatus deregisterControlCommand(const MString& commandName);
///
MStatus registerModelEditorCommand(const MString& commandName,
MCreatorFunction creatorFunction,
MCreatorFunction paneCreatorFunction);
///
MStatus deregisterModelEditorCommand(const MString& commandName);
///
MStatus registerContextCommand( const MString& commandName,
MCreatorFunction creatorFunction);
///
MStatus registerContextCommand( const MString& commandName,
MCreatorFunction creatorFunction,
const MString& toolCmdName,
MCreatorFunction toolCmdCreator,
MCreateSyntaxFunction
toolCmdSyntax = NULL
);
///
MStatus deregisterContextCommand( const MString& commandName );
///
MStatus deregisterContextCommand( const MString& commandName,
const MString& toolCmdName );
///
MStatus registerNode( const MString& typeName,
const MTypeId& typeId,
MCreatorFunction creatorFunction,
MInitializeFunction initFunction,
MPxNode::Type type = MPxNode::kDependNode,
const MString* classification = NULL);
///
MStatus deregisterNode( const MTypeId& typeId );
///
MStatus registerShape( const MString& typeName,
const MTypeId& typeId,
MCreatorFunction creatorFunction,
MInitializeFunction initFunction,
MCreatorFunction uiCreatorFunction,
const MString* classification = NULL);
///
MStatus registerTransform( const MString& typeName,
const MTypeId& typeId,
MCreatorFunction creatorFunction,
MInitializeFunction initFunction,
MCreatorFunction xformCreatorFunction,
const MTypeId& xformId,
const MString* classification = NULL);
///
MStatus registerData( const MString& typeName,
const MTypeId& typeId,
MCreatorFunction creatorFunction,
MPxData::Type type = MPxData::kData );
///
MStatus deregisterData( const MTypeId& typeId );
///
MStatus registerDevice( const MString& deviceName,
MCreatorFunction creatorFunction );
///
MStatus deregisterDevice( const MString& deviceName );
///
MStatus registerFileTranslator( const MString& translatorName,
char* pixmapName,
MCreatorFunction creatorFunction,
char* optionsScriptName = NULL,
char* defaultOptionsString = NULL,
bool requiresFullMel = false );
///
MStatus deregisterFileTranslator( const MString& translatorName );
///
MStatus registerIkSolver( const MString& ikSolverName,
MCreatorFunction creatorFunction );
///
MStatus deregisterIkSolver( const MString& ikSolverName );
///
MStatus registerUI(const MString & creationProc,
const MString & deletionProc,
const MString & creationBatchProc = "",
const MString & deletionBatchProc = "");
///
MStatus registerDragAndDropBehavior( const MString& behaviorName,
MCreatorFunction creatorFunction);
///
MStatus deregisterDragAndDropBehavior( const MString& behaviorName );
///
MStatus registerImageFile( const MString& imageFormatName,
MCreatorFunction creatorFunction,
const MStringArray& imageFileExtensions);
///
MStatus deregisterImageFile( const MString& imageFormatName);
///
static MObject findPlugin( const MString& pluginName );
///
static bool isNodeRegistered( const MString& typeName);
///
MTypeId matrixTypeIdFromXformId(const MTypeId& xformTypeId, MStatus* ReturnStatus=NULL);
///
MStringArray addMenuItem(
const MString& menuItemName,
const MString& parentName,
const MString& commandName,
const MString& commandParams,
bool needOptionBox = false,
MString *optBoxFunction = NULL,
MStatus *retStatus = NULL
);
///
MStatus removeMenuItem(MStringArray& menuItemNames);
///
MStatus registerMaterialInfo(MString& type, MMaterialInfoFactoryFnPtr fnPtr );
///
MStatus unregisterMaterialInfo(const MString &typeName);
///
MStatus registerBakeEngine(MString &typeName, MBakeEngineCreatorFnPtr fnPtr );
///
MStatus unregisterBakeEngine(const MString &typeName);
protected:
virtual const char* className() const;
private:
MFnPlugin( const MObject& object,
const char* vendor = "Unknown",
const char* version = "Unknown",
const char* requiredApiVersion = "Any",
MStatus* ReturnStatus = 0L );
MFnPlugin& operator=( const MFnPlugin & ) const;
MFnPlugin& operator=( const MFnPlugin & );
MFnPlugin* operator& () const;
MFnPlugin* operator& ();
};
#ifdef _WIN32
#pragma warning(default: 4522)
#endif // _WIN32
// *****************************************************************************
#endif /* __cplusplus */
#endif /* _MFnPlugin */
| SCell555/hl2-asw-port | src/common/maya/8.0/maya/MFnPlugin.h | C | mit | 11,316 | [
30522,
1001,
2065,
13629,
2546,
1035,
1049,
2546,
16275,
7630,
11528,
1001,
9375,
1035,
1049,
2546,
16275,
7630,
11528,
1013,
1013,
1013,
1013,
1011,
1013,
1013,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Test get machiens
var fs = require('fs');
try {
fs.accessSync('testdb.json', fs.F_OK);
fs.unlinkSync('testdb.json');
// Do something
} catch (e) {
// It isn't accessible
console.log(e);
}
var server = require('../server.js').createServer(8000, 'testdb.json');
var addTestMachine = function(name) {
var newMachine = {};
newMachine.name = name;
newMachine.type = 'washer';
newMachine.queue = [];
newMachine.operational = true;
newMachine.problemMessage = "";
newMachine.activeJob = {};
server.db('machines').push(newMachine);
}
describe('ALL THE TESTS LOL', function() {
it('should add a machine', function(done) {
var options = {
method: 'POST',
url: '/machines',
payload: {
name: 'test1',
type: 'washer'
}
}
server.inject(options, function(response) {
expect(response.statusCode).toBe(200);
var p = JSON.parse(response.payload);
expect(p.name).toBe(options.payload.name);
expect(p.type).toBe(options.payload.type);
done();
})
});
it('should get all machines', function(done) {
var name = 'testMachine';
var name2 = 'anotherMachine';
addTestMachine(name);
addTestMachine(name2);
var options = {
method: 'GET',
url: '/machines',
}
server.inject(options, function(res) {
expect(res.statusCode).toBe(200);
var p = JSON.parse(res.payload);
// check p has test and anotherMachine
done();
});
});
it('should get one machine', function(done) {
var name = 'sweetTestMachine';
addTestMachine(name);
var options = {
method: 'GET',
url: '/machines/'+name
};
server.inject(options, function(res) {
expect(res.statusCode).toBe(200);
var p = JSON.parse(res.payload);
expect(p.name).toBe(name);
done();
});
});
it('should add a job the queue then th queue should have the person', function(done) {
addTestMachine('queueTest');
var addOptions = {
method: 'POST',
url: '/machines/queueTest/queue',
payload: {
user: 'test@mail.com',
pin: 1234,
minutes: 50
}
};
server.inject(addOptions, function(res) {
expect(res.statusCode).toBe(200);
var p = JSON.parse(res.payload);
expect(p.name).toBe('queueTest');
var getQueue = {
method: 'GET',
url: '/machines/queueTest/queue'
};
server.inject(getQueue, function(newRes) {
expect(newRes.statusCode).toBe(200);
var q = JSON.parse(newRes.payload);
console.log(q);
expect(q.queue[0].user).toBe('test@mail.com');
expect(q.queue[0].pin).toBe(1234);
done();
})
})
});
it('should delete a job from the queue', function(done) {
addTestMachine('anotherQueue');
var addOptions = {
method: 'POST',
url: '/machines/anotherQueue/queue',
payload: {
user: 'test@mail.com',
pin: 1235,
minutes: 50
}
};
server.inject(addOptions, function(res) {
var deleteOptions = addOptions;
deleteOptions.url = '/machines/anotherQueue/queue/delete';
deleteOptions.payload = {
user: addOptions.payload.user,
pin: addOptions.payload.pin
}
server.inject(deleteOptions, function(r) {
expect(r.statusCode).toBe(200);
console.log(JSON.parse(r.payload));
done();
})
})
})
it('should add a job to the active queue', function(done) {
addTestMachine('activeQueue');
var addOptions = {
method: 'POST',
url: '/machines/activeQueue/queue',
payload: {
user: 'test@mail.com',
pin: 1235,
minutes: 50
}
};
server.inject(addOptions, function(r) {
var runJobOptions = {
method: 'POST',
url: '/machines/activeQueue/queue/start',
payload: {
command: 'next',
pin: 1235,
minutes: 0
}
};
server.inject(runJobOptions, function(res) {
expect(res.statusCode).toBe(200);
done();
})
})
});
}); | sdierauf/laundrytime | spec/getMachinesSpec.js | JavaScript | mit | 4,145 | [
30522,
1013,
1013,
3231,
2131,
24532,
24836,
13075,
1042,
2015,
1027,
5478,
1006,
1005,
1042,
2015,
1005,
1007,
1025,
3046,
1063,
1042,
2015,
1012,
3229,
6508,
12273,
1006,
1005,
3231,
18939,
1012,
1046,
3385,
1005,
1010,
1042,
2015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// -*- C++ -*-
//==========================================================================
/**
* @file Null_Barrier.h
*
* $Id: Null_Barrier.h 80826 2008-03-04 14:51:23Z wotte $
*
* Moved from Synch.h.
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_NULL_BARRIER_H
#define ACE_NULL_BARRIER_H
#include /**/ "ace/pre.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
/**
* @class ACE_Null_Barrier
*
* @brief Implements "NULL barrier synchronization".
*/
class ACE_Null_Barrier
{
public:
/// Initialize the barrier to synchronize <count> threads.
ACE_Null_Barrier (unsigned int,
const char * = 0,
void * = 0) {};
/// Default dtor.
~ACE_Null_Barrier (void) {};
/// Block the caller until all <count> threads have called <wait> and
/// then allow all the caller threads to continue in parallel.
int wait (void) { return 0; };
/// Dump the state of an object.
void dump (void) const {};
/// Declare the dynamic allocation hooks.
//ACE_ALLOC_HOOK_DECLARE;
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Null_Barrier &);
ACE_Null_Barrier (const ACE_Null_Barrier &);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* ACE_NULL_BARRIER_H */
| web0316/WOW | dep/ACE_wrappers/ace/Null_Barrier.h | C | gpl-2.0 | 1,544 | [
30522,
1013,
1013,
1011,
1008,
1011,
1039,
1009,
1009,
1011,
1008,
1011,
1013,
1013,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Windows;
using System.Windows.Documents;
using Microsoft.VisualStudio.PlatformUI;
using NuGet.VisualStudio;
namespace NuGet.Dialog.PackageManagerUI
{
/// <summary>
/// Interaction logic for LicenseAcceptanceWindow.xaml
/// </summary>
public partial class LicenseAcceptanceWindow : DialogWindow
{
public LicenseAcceptanceWindow()
{
InitializeComponent();
}
private void OnDeclineButtonClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
private void OnAcceptButtonClick(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void OnViewLicenseTermsRequestNavigate(object sender, RoutedEventArgs e)
{
Hyperlink hyperlink = (Hyperlink)sender;
var licenseUrl = hyperlink.NavigateUri;
UriHelper.OpenExternalLink(licenseUrl);
}
}
} | anurse/NuGet | src/DialogServices/PackageManagerUI/LicenseAcceptanceWindow.xaml.cs | C# | apache-2.0 | 1,006 | [
30522,
2478,
2291,
1012,
3645,
1025,
2478,
2291,
1012,
3645,
1012,
5491,
1025,
2478,
7513,
1012,
26749,
8525,
20617,
1012,
4132,
10179,
1025,
2478,
16371,
18150,
1012,
26749,
8525,
20617,
1025,
3415,
15327,
16371,
18150,
1012,
13764,
8649,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This file has been generated by the GUI designer. Do not modify.
namespace Smuxi.Frontend.Gnome
{
public partial class EngineAssistantNameWidget
{
private global::Gtk.VBox vbox2;
private global::Gtk.VBox vbox3;
private global::Gtk.Label f_EngineNameLabel;
private global::Gtk.Entry f_EngineNameEntry;
private global::Gtk.Label label2;
private global::Gtk.VBox vbox4;
private global::Gtk.Label label7;
private global::Gtk.CheckButton f_MakeDefaultEngineCheckButton;
private global::Gtk.Label label8;
protected virtual void Build ()
{
global::Stetic.Gui.Initialize (this);
// Widget Smuxi.Frontend.Gnome.EngineAssistantNameWidget
global::Stetic.BinContainer.Attach (this);
this.Name = "Smuxi.Frontend.Gnome.EngineAssistantNameWidget";
// Container child Smuxi.Frontend.Gnome.EngineAssistantNameWidget.Gtk.Container+ContainerChild
this.vbox2 = new global::Gtk.VBox ();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 10;
this.vbox2.BorderWidth = ((uint)(5));
// Container child vbox2.Gtk.Box+BoxChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
// Container child vbox3.Gtk.Box+BoxChild
this.f_EngineNameLabel = new global::Gtk.Label ();
this.f_EngineNameLabel.Name = "f_EngineNameLabel";
this.f_EngineNameLabel.Xalign = 0f;
this.f_EngineNameLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("_Engine Name:");
this.f_EngineNameLabel.UseUnderline = true;
this.vbox3.Add (this.f_EngineNameLabel);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.f_EngineNameLabel]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.f_EngineNameEntry = new global::Gtk.Entry ();
this.f_EngineNameEntry.CanFocus = true;
this.f_EngineNameEntry.Name = "f_EngineNameEntry";
this.f_EngineNameEntry.IsEditable = true;
this.f_EngineNameEntry.InvisibleChar = '●';
this.vbox3.Add (this.f_EngineNameEntry);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.f_EngineNameEntry]));
w2.Position = 1;
w2.Expand = false;
w2.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.label2 = new global::Gtk.Label ();
this.label2.Name = "label2";
this.label2.Xpad = 50;
this.label2.Xalign = 0f;
this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("<span size=\"small\">Profile name of the new engine</span>");
this.label2.UseMarkup = true;
this.vbox3.Add (this.label2);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.label2]));
w3.Position = 2;
w3.Expand = false;
w3.Fill = false;
this.vbox2.Add (this.vbox3);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.vbox3]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
this.vbox4.Spacing = 6;
this.vbox4.BorderWidth = ((uint)(5));
// Container child vbox4.Gtk.Box+BoxChild
this.label7 = new global::Gtk.Label ();
this.label7.Name = "label7";
this.label7.Xalign = 0f;
this.label7.LabelProp = global::Mono.Unix.Catalog.GetString ("_Default Engine:");
this.label7.UseUnderline = true;
this.vbox4.Add (this.label7);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.label7]));
w5.Position = 0;
w5.Expand = false;
w5.Fill = false;
// Container child vbox4.Gtk.Box+BoxChild
this.f_MakeDefaultEngineCheckButton = new global::Gtk.CheckButton ();
this.f_MakeDefaultEngineCheckButton.CanFocus = true;
this.f_MakeDefaultEngineCheckButton.Name = "f_MakeDefaultEngineCheckButton";
this.f_MakeDefaultEngineCheckButton.Label = global::Mono.Unix.Catalog.GetString ("Use as new default engine");
this.f_MakeDefaultEngineCheckButton.DrawIndicator = true;
this.f_MakeDefaultEngineCheckButton.UseUnderline = true;
this.vbox4.Add (this.f_MakeDefaultEngineCheckButton);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.f_MakeDefaultEngineCheckButton]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
// Container child vbox4.Gtk.Box+BoxChild
this.label8 = new global::Gtk.Label ();
this.label8.Name = "label8";
this.label8.Xpad = 50;
this.label8.Xalign = 0f;
this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("<span size=\"small\">If enabled, the current engine will be the default next time Smuxi is started</span>");
this.label8.UseMarkup = true;
this.label8.Wrap = true;
this.vbox4.Add (this.label8);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.label8]));
w7.Position = 2;
w7.Expand = false;
w7.Fill = false;
this.vbox2.Add (this.vbox4);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.vbox4]));
w8.Position = 1;
w8.Expand = false;
w8.Fill = false;
this.Add (this.vbox2);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.f_EngineNameLabel.MnemonicWidget = this.f_EngineNameEntry;
this.label7.MnemonicWidget = this.f_MakeDefaultEngineCheckButton;
this.Hide ();
}
}
}
| tuukka/smuxi | src/Frontend-GNOME/gtk-gui/Smuxi.Frontend.Gnome.EngineAssistantNameWidget.cs | C# | gpl-2.0 | 5,273 | [
30522,
1013,
1013,
2023,
5371,
2038,
2042,
7013,
2011,
1996,
26458,
5859,
1012,
2079,
2025,
19933,
1012,
3415,
15327,
15488,
5602,
2072,
1012,
2392,
10497,
1012,
25781,
1063,
2270,
7704,
2465,
3194,
12054,
23137,
2102,
18442,
9148,
24291,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
/*global require, after, before*/
var async = require('async'),
assert = require('assert'),
db = require('../mocks/databasemock');
describe('Set methods', function() {
describe('setAdd()', function() {
it('should add to a set', function(done) {
db.setAdd('testSet1', 5, function(err) {
assert.equal(err, null);
assert.equal(arguments.length, 1);
done();
});
});
it('should add an array to a set', function(done) {
db.setAdd('testSet1', [1, 2, 3, 4], function(err) {
assert.equal(err, null);
assert.equal(arguments.length, 1);
done();
});
});
});
describe('getSetMembers()', function() {
before(function(done) {
db.setAdd('testSet2', [1,2,3,4,5], done);
});
it('should return an empty set', function(done) {
db.getSetMembers('doesnotexist', function(err, set) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(Array.isArray(set), true);
assert.equal(set.length, 0);
done();
});
});
it('should return a set with all elements', function(done) {
db.getSetMembers('testSet2', function(err, set) {
assert.equal(err, null);
assert.equal(set.length, 5);
set.forEach(function(value) {
assert.notEqual(['1', '2', '3', '4', '5'].indexOf(value), -1);
});
done();
});
});
});
describe('setsAdd()', function() {
it('should add to multiple sets', function(done) {
db.setsAdd(['set1', 'set2'], 'value', function(err) {
assert.equal(err, null);
assert.equal(arguments.length, 1);
done();
});
});
});
describe('getSetsMembers()', function() {
before(function(done) {
db.setsAdd(['set3', 'set4'], 'value', done);
});
it('should return members of two sets', function(done) {
db.getSetsMembers(['set3', 'set4'], function(err, sets) {
assert.equal(err, null);
assert.equal(Array.isArray(sets), true);
assert.equal(arguments.length, 2);
assert.equal(Array.isArray(sets[0]) && Array.isArray(sets[1]), true);
assert.strictEqual(sets[0][0], 'value');
assert.strictEqual(sets[1][0], 'value');
done();
});
});
});
describe('isSetMember()', function() {
before(function(done) {
db.setAdd('testSet3', 5, done);
});
it('should return false if element is not member of set', function(done) {
db.isSetMember('testSet3', 10, function(err, isMember) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(isMember, false);
done();
});
});
it('should return true if element is a member of set', function(done) {
db.isSetMember('testSet3', 5, function(err, isMember) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(isMember, true);
done();
});
});
});
describe('isSetMembers()', function() {
before(function(done) {
db.setAdd('testSet4', [1, 2, 3, 4, 5], done);
});
it('should return an array of booleans', function(done) {
db.isSetMembers('testSet4', ['1', '2', '10', '3'], function(err, members) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(Array.isArray(members), true);
assert.deepEqual(members, [true, true, false, true]);
done();
});
});
});
describe('isMemberOfSets()', function() {
before(function(done) {
db.setsAdd(['set1', 'set2'], 'value', done);
});
it('should return an array of booleans', function(done) {
db.isMemberOfSets(['set1', 'testSet1', 'set2', 'doesnotexist'], 'value', function(err, members) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(Array.isArray(members), true);
assert.deepEqual(members, [true, false, true, false]);
done();
});
});
});
describe('setCount()', function() {
before(function(done) {
db.setAdd('testSet5', [1,2,3,4,5], done);
});
it('should return the element count of set', function(done) {
db.setCount('testSet5', function(err, count) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.strictEqual(count, 5);
done();
});
});
});
describe('setsCount()', function() {
before(function(done) {
async.parallel([
async.apply(db.setAdd, 'set5', [1,2,3,4,5]),
async.apply(db.setAdd, 'set6', 1),
async.apply(db.setAdd, 'set7', 2)
], done);
});
it('should return the element count of sets', function(done) {
db.setsCount(['set5', 'set6', 'set7', 'doesnotexist'], function(err, counts) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(Array.isArray(counts), true);
assert.deepEqual(counts, [5, 1, 1, 0]);
done();
});
});
});
describe('setRemove()', function() {
before(function(done) {
db.setAdd('testSet6', [1, 2], done);
});
it('should remove a element from set', function(done) {
db.setRemove('testSet6', '2', function(err) {
assert.equal(err, null);
assert.equal(arguments.length, 1);
db.isSetMember('testSet6', '2', function(err, isMember) {
assert.equal(err, null);
assert.equal(isMember, false);
done();
});
});
});
});
describe('setsRemove()', function() {
before(function(done) {
db.setsAdd(['set1', 'set2'], 'value', done);
});
it('should remove a element from multiple sets', function(done) {
db.setsRemove(['set1', 'set2'], 'value', function(err) {
assert.equal(err, null);
assert.equal(arguments.length, 1);
db.isMemberOfSets(['set1', 'set2'], 'value', function(err, members) {
assert.equal(err, null);
assert.deepEqual(members, [false, false]);
done();
});
});
});
});
describe('setRemoveRandom()', function() {
before(function(done) {
db.setAdd('testSet7', [1,2,3,4,5], done);
});
it('should remove a random element from set', function(done) {
db.setRemoveRandom('testSet7', function(err, element) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
db.isSetMember('testSet', element, function(err, ismember) {
assert.equal(err, null);
assert.equal(ismember, false);
done();
});
});
});
});
after(function(done) {
db.flushdb(done);
});
});
| seafruit/NodeBB | test/database/sets.js | JavaScript | gpl-3.0 | 6,160 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
3795,
5478,
1010,
2044,
1010,
2077,
1008,
1013,
13075,
2004,
6038,
2278,
1027,
5478,
1006,
1005,
2004,
6038,
2278,
1005,
1007,
1010,
20865,
1027,
5478,
1006,
1005,
20865,
1005,
1007,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.vxquery.runtime.functions.cast;
import org.apache.vxquery.datamodel.values.ValueTag;
public class CastToPositiveIntegerOperation extends CastToIntegerOperation {
public CastToPositiveIntegerOperation() {
negativeAllowed = false;
returnTag = ValueTag.XS_POSITIVE_INTEGER_TAG;
}
} | innovimax/vxquery | vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToPositiveIntegerOperation.java | Java | apache-2.0 | 1,127 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from unittest import TestCase
from MyCapytain.resources.collections.cts import XmlCtsTextInventoryMetadata, XmlCtsTextgroupMetadata, XmlCtsWorkMetadata, XmlCtsEditionMetadata, XmlCtsTranslationMetadata
from MyCapytain.resources.prototypes.cts.inventory import CtsTextgroupMetadata
with open("tests/testing_data/examples/getcapabilities.seneca.xml") as f:
SENECA = f.read()
class TestCollectionCtsInheritance(TestCase):
def test_types(self):
TI = XmlCtsTextInventoryMetadata.parse(resource=SENECA)
self.assertCountEqual(
[type(descendant) for descendant in TI.descendants],
[XmlCtsTextgroupMetadata] + [XmlCtsWorkMetadata] * 10 + [XmlCtsEditionMetadata] * 10,
"Descendant should be correctly parsed into correct types"
)
self.assertCountEqual(
[type(descendant) for descendant in TI.readableDescendants],
[XmlCtsWorkMetadata] * 0 + [XmlCtsEditionMetadata] * 10,
"Descendant should be correctly parsed into correct types and filtered when readable"
)
def test_title(self):
TI = XmlCtsTextInventoryMetadata.parse(resource=SENECA)
self.assertCountEqual(
[str(descendant.get_label()) for descendant in TI.descendants],
["Seneca, Lucius Annaeus", "de Ira", "de Vita Beata", "de consolatione ad Helviam", "de Constantia",
"de Tranquilitate Animi", "de Brevitate Vitae", "de consolatione ad Polybium",
"de consolatione ad Marciam", "de Providentia", "de Otio Sapientis", "de Ira, Moral essays Vol 2",
"de Vita Beata, Moral essays Vol 2", "de consolatione ad Helviam, Moral essays Vol 2",
"de Constantia, Moral essays Vol 2", "de Tranquilitate Animi, Moral essays Vol 2",
"de Brevitate Vitae, Moral essays Vol 2", "de consolatione ad Polybium, Moral essays Vol 2",
"de consolatione ad Marciam, Moral essays Vol 2", "de Providentia, Moral essays Vol 2",
"de Otio Sapientis, Moral essays Vol 2"],
"Title should be computed correctly : default should be set"
)
def test_new_object(self):
""" When creating an object with same urn, we should retrieve the same metadata"""
TI = XmlCtsTextInventoryMetadata.parse(resource=SENECA)
a = TI["urn:cts:latinLit:stoa0255.stoa012.perseus-lat2"].metadata
b = (CtsTextgroupMetadata("urn:cts:latinLit:stoa0255")).metadata | Capitains/MyCapytain | tests/resources/collections/test_cts_collection_inheritance.py | Python | mpl-2.0 | 2,461 | [
30522,
2013,
3131,
22199,
12324,
3231,
18382,
2013,
2026,
17695,
22123,
8113,
1012,
4219,
1012,
6407,
1012,
14931,
2015,
12324,
20950,
16649,
18209,
2378,
15338,
10253,
11368,
8447,
2696,
1010,
20950,
16649,
18209,
17058,
11368,
8447,
2696,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Part of Component Akquickicons files.
*
* @copyright Copyright (C) 2014 Asikart. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Windwalker\Controller\Resolver\ControllerDelegator;
// No direct access
defined('_JEXEC') or die;
/**
* Akquickicons Articles delegator.
*
* @since 1.0
*/
class AkquickiconsControllerArticlesDelegator extends ControllerDelegator
{
/**
* Register aliases.
*
* @return void
*/
protected function registerAliases()
{
}
/**
* Create Controller.
*
* @param string $class Controller class name.
*
* @return \Windwalker\Controller\Controller Controller instance.
*/
protected function createController($class)
{
return parent::createController($class);
}
}
| asukademy/akblog | administrator/components/com_akquickicons/controller/articles/delegator.php | PHP | gpl-2.0 | 798 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2112,
1997,
6922,
17712,
15549,
18009,
8663,
2015,
6764,
1012,
1008,
1008,
1030,
30524,
2270,
6105,
2544,
1016,
2030,
2101,
1025,
2156,
6105,
1012,
19067,
2102,
1008,
1013,
2224,
3612,
26965... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
return array(
'_root_' => 'admin/index', // The default route
'_404_' => 'welcome/404', // The main 404 route
'admin/detail/:id' => array('admin/detail/$1', 'name' => 'detail'),
'admin/write' => '/admin/write/',
'test'=> 'api/test',
'blog'=> 'api/blog',
'blog/insert'=> 'api/blog/insert',
'blog/update'=> 'api/blog/update',
'admin/list/'=> '/admin/list',
'admin/edit/:id' => array('admin/edit/$1', 'name' => 'edit'),
'admin/view/:id' => array('admin/view/$1', 'name' => 'view'),
'test/insert'=> 'api/test/insert',
'hello(/:name)?' => array('welcome/hello', 'name' => 'hello'),
);
| yyoshinori/CastlePortal | fuel/app/config/routes.php | PHP | mit | 636 | [
30522,
1026,
1029,
25718,
2709,
9140,
1006,
1005,
1035,
7117,
1035,
1005,
1027,
1028,
1005,
4748,
10020,
1013,
5950,
1005,
1010,
1013,
1013,
1996,
12398,
2799,
1005,
1035,
24837,
1035,
1005,
1027,
1028,
1005,
6160,
1013,
24837,
1005,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% load compress %} {% load static from staticfiles %} {% load leaflet_tags %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>
{% block title %} kidlse {% endblock %}
</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
{% block styles %}
{% if debug %}
<!-- This is the client-side way to compile less and an ok choice for local dev -->
<link rel="stylesheet/less" type="text/css" media="all" href="{% static 'less/style.less' %}" />
{% else %}
{% compress css %}
<!-- This is the nifty django-compressor way to compile your less files in css -->
<link rel="stylesheet" type="text/less" media="all" href="{% static 'less/style.less' %}" /> {% endcompress %}
{% endif %}
{% endblock %}
</head>
<body>
{% include 'icons.svg' %}
<div class="navmenu navmenu-default navmenu-fixed-left">
<div class="navmenu-brand">
<h1>Kids in Leipzig</h1>
</div>
<div class="filter">
{% if 'daycare' in active_apps %}
<button id="kit" type="button" class="btn btn-lg btn-primary btn-block">Kitas ausblenden</button>
{% endif %}
{% if 'playgrounds' in active_apps %}
<button id="play" type="button" class="btn btn-lg btn-primary btn-block">Spielplätze ausblenden</button>
{% endif %}
{% if 'schools' in active_apps %}
<button id="school" type="button" class="btn btn-lg btn-primary btn-block">Schulen ausblenden</button>
{% endif %}
</div>
<div class="statics">
<button id="contact" type="button" class="btn btn-lg btn-link btn-block">Kontakt</button>
<button id="imprint" type="button" class="btn btn-lg btn-link btn-block">Impressum</button>
</div>
</div>
<div class="canvas">
<div class="navbar navbar-default navbar-fixed-top">
<button type="button" class="navbar-toggle" data-toggle="offcanvas" data-recalc="false" data-target=".navmenu" data-canvas=".canvas">
<svg class="icon-kid icon-sm ">
<use xlink:href="#icon-layer" />
</svg>
</button>
<button id="locate" type="button" class="navbar-toggle">
<svg class="icon-kid icon-sm ">
<use xlink:href="#icon-locate" />
</svg>
</button>
</div>
<div class="container">
{% leaflet_map "map" callback="window.setUpMap" %}
</div>
<!-- /.container -->
</div>
<!-- /.canvas -->
<!-- Contact Modal -->
<div class="modal fade" id="contactModal" tabindex="-1" role="dialog" aria-labelledby="contactModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close pull-right" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="contactModal">Kontakt</h4>
</div>
<div class="modal-body">
{% include 'contact.html' %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<!-- Imprint Modal -->
<div class="modal fade" id="imprintModal" tabindex="-1" role="dialog" aria-labelledby="imprintModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close pull-right" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="imprintModal">Impressum</h4>
</div>
<div class="modal-body">
{% include 'imprint.html' %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
{% block js %}
<!-- Leaflet -->
{% leaflet_js %}
<script type="text/javascript" charset="utf-8" src="{% static 'js/leaflet.markercluster.js' %}"></script>
<script type="text/javascript" charset="utf-8" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
{% if debug %}
<script type="text/javascript" charset="utf-8" src="{% static 'js/less-1.7.0.min.js' %}"></script>
{% endif %}
<script type="text/javascript" charset="utf-8">
var daycarecenterIcon = '{% static "img/kita.svg" %}';
var playgroundIcon = '{% static "img/playground3.svg" %}';
var schoolIcon = '{% static "img/school.svg" %}';
var posIcon = '{% static "img/marker-circle.svg" %}';
var daycarecenterDataUrl = '{% url "daycarecenter-list" %}';
var playgroundDataUrl = '{% url "playground-list" %}';
var schoolDataUrl = '{% url "school-list" %}';
var schoolsActive = {% if 'schools' in active_apps %}true{% else %}false{% endif %};
var daycareActive = {% if 'daycare' in active_apps %}true{% else %}false{% endif %};
var playgroundsActive = {% if 'playgrounds' in active_apps %}true{% else %}false{% endif %};
</script>
<script type="text/javascript" charset="utf-8" src="{% static 'js/leaveme.js' %}"></script>
<script type="text/javascript" charset="utf-8" src="{% static 'js/offcanvas.js' %}"></script>
<script>
(function($) {
$('#contact').on('click', function() {
$('#contactModal').modal('show');
});
$('#imprint').on('click', function() {
$('#imprintModal').modal('show');
});
})(jQuery);
</script>
{% endblock %}
</body>
</html>
| CodeforLeipzig/kidsle | project/templates/base.html | HTML | gpl-2.0 | 6,285 | [
30522,
1063,
1003,
7170,
4012,
20110,
1003,
1065,
1063,
1003,
7170,
10763,
2013,
10763,
8873,
4244,
1003,
1065,
1063,
1003,
7170,
7053,
7485,
1035,
22073,
1003,
1065,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/devtools/devtools_manager.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
namespace content {
// static
DevToolsManager* DevToolsManager::GetInstance() {
return base::Singleton<DevToolsManager>::get();
}
DevToolsManager::DevToolsManager()
: delegate_(
GetContentClient()->browser()->CreateDevToolsManagerDelegate()) {}
DevToolsManager::~DevToolsManager() = default;
} // namespace content
| scheib/chromium | content/browser/devtools/devtools_manager.cc | C++ | bsd-3-clause | 672 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
static void testOpCubicsMain(PathOpsThreadState* data) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
SkASSERT(data);
PathOpsThreadState& state = *data;
char pathStr[1024]; // gdb: set print elements 400
bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter?
if (progress) {
sk_bzero(pathStr, sizeof(pathStr));
}
for (int a = 0 ; a < 6; ++a) {
for (int b = a + 1 ; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1 ; d < 7; ++d) {
for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType; ++e) {
for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f) {
SkPath pathA, pathB;
if (progress) {
char* str = pathStr;
str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n",
e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state.fB);
str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", state.fC, state.fD,
b, a, d, c);
str += sprintf(str, " path.close();\n");
str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n",
f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
state.fB, state.fA, state.fD, state.fC);
str += sprintf(str, " pathB.close();\n");
}
pathA.setFillType((SkPath::FillType) e);
pathA.moveTo(SkIntToScalar(state.fA), SkIntToScalar(state.fB));
pathA.cubicTo(SkIntToScalar(state.fC), SkIntToScalar(state.fD), SkIntToScalar(b),
SkIntToScalar(a), SkIntToScalar(d), SkIntToScalar(c));
pathA.close();
pathB.setFillType((SkPath::FillType) f);
pathB.moveTo(SkIntToScalar(a), SkIntToScalar(b));
pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(state.fB),
SkIntToScalar(state.fA), SkIntToScalar(state.fD), SkIntToScalar(state.fC));
pathB.close();
for (int op = 0 ; op <= kXOR_PathOp; ++op) {
if (progress) {
outputProgress(state.fPathStr, pathStr, (SkPathOp) op);
}
testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cubics");
}
}
}
}
}
}
}
}
DEF_TEST(PathOpsOpCubicsThreaded, reporter) {
int threadCount = initializeTests(reporter, "cubicOp");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 6; ++a) { // outermost
for (int b = a + 1; b < 7; ++b) {
for (int c = 0 ; c < 6; ++c) {
for (int d = c + 1; d < 7; ++d) {
*testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreadedRunnable,
(&testOpCubicsMain, a, b, c, d, &testRunner));
}
}
if (!reporter->allowExtendedTest()) goto finish;
}
}
finish:
testRunner.render();
ShowTestArray();
}
| ench0/external_skia | tests/PathOpsOpCubicThreadedTest.cpp | C++ | bsd-3-clause | 3,732 | [
30522,
1013,
1008,
1008,
9385,
2262,
8224,
4297,
1012,
1008,
1008,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
30524,
11923,
2705,
16416,
5732,
9006,
8202,
1012,
1044,
1000,
10763,
11675,
3231,
7361,
10841,
13592,
262... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div ng-controller="navbarCtrl">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<!-- Navbar header -->
<div class="navbar-header">
<!-- Website logo-->
<a class="navbar-brand" class="active" href="#!/home">Blog Name</a>
<!-- Button for mobile navbar-->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collapsing section -->
<div class="collapse navbar-collapse" id="myNavbar">
<!-- List of link next to logo-->
<ul class="nav navbar-nav">
<li><a href="#!/about">About</a></li>
<li><a href="#!/contact">Authors</a></li>
<li><a href="#!/article">Article</a></li>
</ul>
<!-- Right Side Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Account settings menu-->
<li>
<form class="navbar-form">
<div class="input-group">
<!-- Text Field -->
<input type="text" class="form-control" placeholder="Search Articles">
<!-- Submmit Button -->
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<i class="glyphicon glyphicon-search"></i>
</button>
</div>
</div>
</form>
</li>
<!-- Account settings menu -->
<li class="dropdown">
<a class="button-default" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user"></span>Acount
</a>
<ul class="dropdown-menu">
<li><a href="#loginModal" data-toggle="modal">Login</a></li>
<li><a>Logout</a></li>
<li><a>Settings</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog" role="document">
<div ng-include="'templates/login/login.html'"></div>
</div>
</div>
</div> | golson2295/BlogWebApp | templates/navbar/navbar.html | HTML | apache-2.0 | 2,375 | [
30522,
1026,
4487,
2615,
12835,
1011,
11486,
1027,
1000,
6583,
26493,
2906,
6593,
12190,
1000,
1028,
1026,
6583,
2615,
2465,
1027,
1000,
6583,
26493,
2906,
6583,
26493,
2906,
1011,
19262,
6583,
26493,
2906,
1011,
10763,
1011,
2327,
1000,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import sys
[_, ms, _, ns] = list(sys.stdin)
ms = set(int(m) for m in ms.split(' '))
ns = set(int(n) for n in ns.split(' '))
print(sep='\n', *sorted(ms.difference(ns).union(ns.difference(ms))))
| alexander-matsievsky/HackerRank | All_Domains/Python/Sets/symmetric-difference.py | Python | mit | 194 | [
30522,
12324,
25353,
2015,
1031,
1035,
1010,
5796,
1010,
1035,
1010,
24978,
1033,
1027,
2862,
1006,
25353,
2015,
1012,
2358,
8718,
1007,
5796,
1027,
2275,
1006,
20014,
1006,
1049,
1007,
2005,
1049,
1999,
5796,
1012,
3975,
1006,
1005,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<title>Coverage for /usr/local/lib/python2.7/dist-packages/pexpect/__init__.py: 100%</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.hotkeys.js"></script>
<script type="text/javascript" src="jquery.isonscreen.js"></script>
<script type="text/javascript" src="coverage_html.js"></script>
<script type="text/javascript">
jQuery(document).ready(coverage.pyfile_ready);
</script>
</head>
<body class="pyfile">
<div id="header">
<div class="content">
<h1>Coverage for <b>/usr/local/lib/python2.7/dist-packages/pexpect/__init__.py</b> :
<span class="pc_cov">100%</span>
</h1>
<img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
<h2 class="stats">
11 statements
<span class="run hide_run shortkey_r button_toggle_run">11 run</span>
<span class="mis shortkey_m button_toggle_mis">0 missing</span>
<span class="exc shortkey_x button_toggle_exc">0 excluded</span>
</h2>
</div>
</div>
<div class="help_panel">
<img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" />
<p class="legend">Hot-keys on this page</p>
<div>
<p class="keyhelp">
<span class="key">r</span>
<span class="key">m</span>
<span class="key">x</span>
<span class="key">p</span> toggle line displays
</p>
<p class="keyhelp">
<span class="key">j</span>
<span class="key">k</span> next/prev highlighted chunk
</p>
<p class="keyhelp">
<span class="key">0</span> (zero) top of page
</p>
<p class="keyhelp">
<span class="key">1</span> (one) first highlighted chunk
</p>
</div>
</div>
<div id="source">
<table>
<tr>
<td class="linenos">
<p id="n1" class="pln"><a href="#n1">1</a></p>
<p id="n2" class="pln"><a href="#n2">2</a></p>
<p id="n3" class="pln"><a href="#n3">3</a></p>
<p id="n4" class="pln"><a href="#n4">4</a></p>
<p id="n5" class="pln"><a href="#n5">5</a></p>
<p id="n6" class="pln"><a href="#n6">6</a></p>
<p id="n7" class="pln"><a href="#n7">7</a></p>
<p id="n8" class="pln"><a href="#n8">8</a></p>
<p id="n9" class="pln"><a href="#n9">9</a></p>
<p id="n10" class="pln"><a href="#n10">10</a></p>
<p id="n11" class="pln"><a href="#n11">11</a></p>
<p id="n12" class="pln"><a href="#n12">12</a></p>
<p id="n13" class="pln"><a href="#n13">13</a></p>
<p id="n14" class="pln"><a href="#n14">14</a></p>
<p id="n15" class="pln"><a href="#n15">15</a></p>
<p id="n16" class="pln"><a href="#n16">16</a></p>
<p id="n17" class="pln"><a href="#n17">17</a></p>
<p id="n18" class="pln"><a href="#n18">18</a></p>
<p id="n19" class="pln"><a href="#n19">19</a></p>
<p id="n20" class="pln"><a href="#n20">20</a></p>
<p id="n21" class="pln"><a href="#n21">21</a></p>
<p id="n22" class="pln"><a href="#n22">22</a></p>
<p id="n23" class="pln"><a href="#n23">23</a></p>
<p id="n24" class="pln"><a href="#n24">24</a></p>
<p id="n25" class="pln"><a href="#n25">25</a></p>
<p id="n26" class="pln"><a href="#n26">26</a></p>
<p id="n27" class="pln"><a href="#n27">27</a></p>
<p id="n28" class="pln"><a href="#n28">28</a></p>
<p id="n29" class="pln"><a href="#n29">29</a></p>
<p id="n30" class="pln"><a href="#n30">30</a></p>
<p id="n31" class="pln"><a href="#n31">31</a></p>
<p id="n32" class="pln"><a href="#n32">32</a></p>
<p id="n33" class="pln"><a href="#n33">33</a></p>
<p id="n34" class="pln"><a href="#n34">34</a></p>
<p id="n35" class="pln"><a href="#n35">35</a></p>
<p id="n36" class="pln"><a href="#n36">36</a></p>
<p id="n37" class="pln"><a href="#n37">37</a></p>
<p id="n38" class="pln"><a href="#n38">38</a></p>
<p id="n39" class="pln"><a href="#n39">39</a></p>
<p id="n40" class="pln"><a href="#n40">40</a></p>
<p id="n41" class="pln"><a href="#n41">41</a></p>
<p id="n42" class="pln"><a href="#n42">42</a></p>
<p id="n43" class="pln"><a href="#n43">43</a></p>
<p id="n44" class="pln"><a href="#n44">44</a></p>
<p id="n45" class="pln"><a href="#n45">45</a></p>
<p id="n46" class="pln"><a href="#n46">46</a></p>
<p id="n47" class="pln"><a href="#n47">47</a></p>
<p id="n48" class="pln"><a href="#n48">48</a></p>
<p id="n49" class="pln"><a href="#n49">49</a></p>
<p id="n50" class="pln"><a href="#n50">50</a></p>
<p id="n51" class="pln"><a href="#n51">51</a></p>
<p id="n52" class="pln"><a href="#n52">52</a></p>
<p id="n53" class="pln"><a href="#n53">53</a></p>
<p id="n54" class="pln"><a href="#n54">54</a></p>
<p id="n55" class="pln"><a href="#n55">55</a></p>
<p id="n56" class="pln"><a href="#n56">56</a></p>
<p id="n57" class="pln"><a href="#n57">57</a></p>
<p id="n58" class="pln"><a href="#n58">58</a></p>
<p id="n59" class="pln"><a href="#n59">59</a></p>
<p id="n60" class="pln"><a href="#n60">60</a></p>
<p id="n61" class="pln"><a href="#n61">61</a></p>
<p id="n62" class="pln"><a href="#n62">62</a></p>
<p id="n63" class="pln"><a href="#n63">63</a></p>
<p id="n64" class="pln"><a href="#n64">64</a></p>
<p id="n65" class="pln"><a href="#n65">65</a></p>
<p id="n66" class="stm run hide_run"><a href="#n66">66</a></p>
<p id="n67" class="stm run hide_run"><a href="#n67">67</a></p>
<p id="n68" class="pln"><a href="#n68">68</a></p>
<p id="n69" class="stm run hide_run"><a href="#n69">69</a></p>
<p id="n70" class="stm run hide_run"><a href="#n70">70</a></p>
<p id="n71" class="stm run hide_run"><a href="#n71">71</a></p>
<p id="n72" class="pln"><a href="#n72">72</a></p>
<p id="n73" class="stm run hide_run"><a href="#n73">73</a></p>
<p id="n74" class="pln"><a href="#n74">74</a></p>
<p id="n75" class="stm run hide_run"><a href="#n75">75</a></p>
<p id="n76" class="stm run hide_run"><a href="#n76">76</a></p>
<p id="n77" class="pln"><a href="#n77">77</a></p>
<p id="n78" class="stm run hide_run"><a href="#n78">78</a></p>
<p id="n79" class="stm run hide_run"><a href="#n79">79</a></p>
<p id="n80" class="stm run hide_run"><a href="#n80">80</a></p>
<p id="n81" class="pln"><a href="#n81">81</a></p>
<p id="n82" class="pln"><a href="#n82">82</a></p>
<p id="n83" class="pln"><a href="#n83">83</a></p>
<p id="n84" class="pln"><a href="#n84">84</a></p>
<p id="n85" class="pln"><a href="#n85">85</a></p>
</td>
<td class="text">
<p id="t1" class="pln"><span class="str">'''Pexpect is a Python module for spawning child applications and controlling</span><span class="strut"> </span></p>
<p id="t2" class="pln"><span class="str">them automatically. Pexpect can be used for automating interactive applications</span><span class="strut"> </span></p>
<p id="t3" class="pln"><span class="str">such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup</span><span class="strut"> </span></p>
<p id="t4" class="pln"><span class="str">scripts for duplicating software package installations on different servers. It</span><span class="strut"> </span></p>
<p id="t5" class="pln"><span class="str">can be used for automated software testing. Pexpect is in the spirit of Don</span><span class="strut"> </span></p>
<p id="t6" class="pln"><span class="str">Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python</span><span class="strut"> </span></p>
<p id="t7" class="pln"><span class="str">require TCL and Expect or require C extensions to be compiled. Pexpect does not</span><span class="strut"> </span></p>
<p id="t8" class="pln"><span class="str">use C, Expect, or TCL extensions. It should work on any platform that supports</span><span class="strut"> </span></p>
<p id="t9" class="pln"><span class="str">the standard Python pty module. The Pexpect interface focuses on ease of use so</span><span class="strut"> </span></p>
<p id="t10" class="pln"><span class="str">that simple tasks are easy.</span><span class="strut"> </span></p>
<p id="t11" class="pln"><span class="strut"> </span></p>
<p id="t12" class="pln"><span class="str">There are two main interfaces to the Pexpect system; these are the function,</span><span class="strut"> </span></p>
<p id="t13" class="pln"><span class="str">run() and the class, spawn. The spawn class is more powerful. The run()</span><span class="strut"> </span></p>
<p id="t14" class="pln"><span class="str">function is simpler than spawn, and is good for quickly calling program. When</span><span class="strut"> </span></p>
<p id="t15" class="pln"><span class="str">you call the run() function it executes a given program and then returns the</span><span class="strut"> </span></p>
<p id="t16" class="pln"><span class="str">output. This is a handy replacement for os.system().</span><span class="strut"> </span></p>
<p id="t17" class="pln"><span class="strut"> </span></p>
<p id="t18" class="pln"><span class="str">For example::</span><span class="strut"> </span></p>
<p id="t19" class="pln"><span class="strut"> </span></p>
<p id="t20" class="pln"><span class="str"> pexpect.run('ls -la')</span><span class="strut"> </span></p>
<p id="t21" class="pln"><span class="strut"> </span></p>
<p id="t22" class="pln"><span class="str">The spawn class is the more powerful interface to the Pexpect system. You can</span><span class="strut"> </span></p>
<p id="t23" class="pln"><span class="str">use this to spawn a child program then interact with it by sending input and</span><span class="strut"> </span></p>
<p id="t24" class="pln"><span class="str">expecting responses (waiting for patterns in the child's output).</span><span class="strut"> </span></p>
<p id="t25" class="pln"><span class="strut"> </span></p>
<p id="t26" class="pln"><span class="str">For example::</span><span class="strut"> </span></p>
<p id="t27" class="pln"><span class="strut"> </span></p>
<p id="t28" class="pln"><span class="str"> child = pexpect.spawn('scp foo user@example.com:.')</span><span class="strut"> </span></p>
<p id="t29" class="pln"><span class="str"> child.expect('Password:')</span><span class="strut"> </span></p>
<p id="t30" class="pln"><span class="str"> child.sendline(mypassword)</span><span class="strut"> </span></p>
<p id="t31" class="pln"><span class="strut"> </span></p>
<p id="t32" class="pln"><span class="str">This works even for commands that ask for passwords or other input outside of</span><span class="strut"> </span></p>
<p id="t33" class="pln"><span class="str">the normal stdio streams. For example, ssh reads input directly from the TTY</span><span class="strut"> </span></p>
<p id="t34" class="pln"><span class="str">device which bypasses stdin.</span><span class="strut"> </span></p>
<p id="t35" class="pln"><span class="strut"> </span></p>
<p id="t36" class="pln"><span class="str">Credits: Noah Spurrier, Richard Holden, Marco Molteni, Kimberley Burchett,</span><span class="strut"> </span></p>
<p id="t37" class="pln"><span class="str">Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids</span><span class="strut"> </span></p>
<p id="t38" class="pln"><span class="str">vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin,</span><span class="strut"> </span></p>
<p id="t39" class="pln"><span class="str">Jacques-Etienne Baudoux, Geoffrey Marshall, Francisco Lourenco, Glen Mabey,</span><span class="strut"> </span></p>
<p id="t40" class="pln"><span class="str">Karthik Gurusamy, Fernando Perez, Corey Minyard, Jon Cohen, Guillaume</span><span class="strut"> </span></p>
<p id="t41" class="pln"><span class="str">Chazarain, Andrew Ryan, Nick Craig-Wood, Andrew Stone, Jorgen Grahn, John</span><span class="strut"> </span></p>
<p id="t42" class="pln"><span class="str">Spiegel, Jan Grant, and Shane Kerr. Let me know if I forgot anyone.</span><span class="strut"> </span></p>
<p id="t43" class="pln"><span class="strut"> </span></p>
<p id="t44" class="pln"><span class="str">Pexpect is free, open source, and all that good stuff.</span><span class="strut"> </span></p>
<p id="t45" class="pln"><span class="str">http://pexpect.sourceforge.net/</span><span class="strut"> </span></p>
<p id="t46" class="pln"><span class="strut"> </span></p>
<p id="t47" class="pln"><span class="str">PEXPECT LICENSE</span><span class="strut"> </span></p>
<p id="t48" class="pln"><span class="strut"> </span></p>
<p id="t49" class="pln"><span class="str"> This license is approved by the OSI and FSF as GPL-compatible.</span><span class="strut"> </span></p>
<p id="t50" class="pln"><span class="str"> http://opensource.org/licenses/isc-license.txt</span><span class="strut"> </span></p>
<p id="t51" class="pln"><span class="strut"> </span></p>
<p id="t52" class="pln"><span class="str"> Copyright (c) 2012, Noah Spurrier <noah@noah.org></span><span class="strut"> </span></p>
<p id="t53" class="pln"><span class="str"> PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY</span><span class="strut"> </span></p>
<p id="t54" class="pln"><span class="str"> PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE</span><span class="strut"> </span></p>
<p id="t55" class="pln"><span class="str"> COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.</span><span class="strut"> </span></p>
<p id="t56" class="pln"><span class="str"> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES</span><span class="strut"> </span></p>
<p id="t57" class="pln"><span class="str"> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF</span><span class="strut"> </span></p>
<p id="t58" class="pln"><span class="str"> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR</span><span class="strut"> </span></p>
<p id="t59" class="pln"><span class="str"> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES</span><span class="strut"> </span></p>
<p id="t60" class="pln"><span class="str"> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN</span><span class="strut"> </span></p>
<p id="t61" class="pln"><span class="str"> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF</span><span class="strut"> </span></p>
<p id="t62" class="pln"><span class="str"> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</span><span class="strut"> </span></p>
<p id="t63" class="pln"><span class="strut"> </span></p>
<p id="t64" class="pln"><span class="str">'''</span><span class="strut"> </span></p>
<p id="t65" class="pln"><span class="strut"> </span></p>
<p id="t66" class="stm run hide_run"><span class="key">import</span> <span class="nam">sys</span><span class="strut"> </span></p>
<p id="t67" class="stm run hide_run"><span class="nam">PY3</span> <span class="op">=</span> <span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">>=</span> <span class="num">3</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t68" class="pln"><span class="strut"> </span></p>
<p id="t69" class="stm run hide_run"><span class="key">from</span> <span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ExceptionPexpect</span><span class="op">,</span> <span class="nam">EOF</span><span class="op">,</span> <span class="nam">TIMEOUT</span><span class="strut"> </span></p>
<p id="t70" class="stm run hide_run"><span class="key">from</span> <span class="op">.</span><span class="nam">utils</span> <span class="key">import</span> <span class="nam">split_command_line</span><span class="op">,</span> <span class="nam">which</span><span class="op">,</span> <span class="nam">is_executable_file</span><span class="strut"> </span></p>
<p id="t71" class="stm run hide_run"><span class="key">from</span> <span class="op">.</span><span class="nam">expect</span> <span class="key">import</span> <span class="nam">Expecter</span><span class="op">,</span> <span class="nam">searcher_re</span><span class="op">,</span> <span class="nam">searcher_string</span><span class="strut"> </span></p>
<p id="t72" class="pln"><span class="strut"> </span></p>
<p id="t73" class="stm run hide_run"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">platform</span> <span class="op">!=</span> <span class="str">'win32'</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t74" class="pln"> <span class="com"># On Unix, these are available at the top level for backwards compatibility</span><span class="strut"> </span></p>
<p id="t75" class="stm run hide_run"> <span class="key">from</span> <span class="op">.</span><span class="nam">pty_spawn</span> <span class="key">import</span> <span class="nam">spawn</span><span class="op">,</span> <span class="nam">spawnu</span><span class="strut"> </span></p>
<p id="t76" class="stm run hide_run"> <span class="key">from</span> <span class="op">.</span><span class="nam">run</span> <span class="key">import</span> <span class="nam">run</span><span class="op">,</span> <span class="nam">runu</span><span class="strut"> </span></p>
<p id="t77" class="pln"><span class="strut"> </span></p>
<p id="t78" class="stm run hide_run"><span class="nam">__version__</span> <span class="op">=</span> <span class="str">'4.2.1'</span><span class="strut"> </span></p>
<p id="t79" class="stm run hide_run"><span class="nam">__revision__</span> <span class="op">=</span> <span class="str">''</span><span class="strut"> </span></p>
<p id="t80" class="stm run hide_run"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span><span class="str">'ExceptionPexpect'</span><span class="op">,</span> <span class="str">'EOF'</span><span class="op">,</span> <span class="str">'TIMEOUT'</span><span class="op">,</span> <span class="str">'spawn'</span><span class="op">,</span> <span class="str">'spawnu'</span><span class="op">,</span> <span class="str">'run'</span><span class="op">,</span> <span class="str">'runu'</span><span class="op">,</span><span class="strut"> </span></p>
<p id="t81" class="pln"> <span class="str">'which'</span><span class="op">,</span> <span class="str">'split_command_line'</span><span class="op">,</span> <span class="str">'__version__'</span><span class="op">,</span> <span class="str">'__revision__'</span><span class="op">]</span><span class="strut"> </span></p>
<p id="t82" class="pln"><span class="strut"> </span></p>
<p id="t83" class="pln"><span class="strut"> </span></p>
<p id="t84" class="pln"><span class="strut"> </span></p>
<p id="t85" class="pln"><span class="com"># vim: set shiftround expandtab tabstop=4 shiftwidth=4 ft=python autoindent :</span><span class="strut"> </span></p>
</td>
</tr>
</table>
</div>
<div id="footer">
<div class="content">
<p>
<a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io">coverage.py v4.3.4</a>,
created at 2017-04-14 18:38
</p>
</div>
</div>
</body>
</html>
| ianmiell/shutit-test | htmlcov/_usr_local_lib_python2_7_dist-packages_pexpect___init___py.html | HTML | mit | 19,780 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef WIDGETSKU_H
#define WIDGETSKU_H
#include <TaoApiCpp/TaoDomain.h>
#include <QString>
/**
* @brief 组件sku信息
*
* @author sd44 <sd44sdd44@yeah.net>
*/
class WidgetSku : public TaoDomain
{
public:
virtual ~WidgetSku() { }
QString getPrice() const;
void setPrice (QString price);
QString getProps() const;
void setProps (QString props);
qlonglong getQuantity() const;
void setQuantity (qlonglong quantity);
qlonglong getSkuId() const;
void setSkuId (qlonglong skuId);
virtual void parseResponse();
private:
/**
* @brief sku的价格,对应Sku的price字段
**/
QString price;
/**
* @brief sku的属性串,根据pid的大小从小到大排列,前后都加";"。类型Sku的properties字段
**/
QString props;
/**
* @brief sku的库存数量,对应Sku的quantity字段
**/
qlonglong quantity;
/**
* @brief sku的id,对应Sku的sku_id字段
**/
qlonglong skuId;
};
#endif /* WIDGETSKU_H */
| sd44/TaobaoCppQtSDK | TaoApiCpp/domain/WidgetSku.h | C | gpl-2.0 | 961 | [
30522,
1001,
2065,
13629,
2546,
15536,
28682,
5283,
1035,
1044,
1001,
9375,
15536,
28682,
5283,
1035,
1044,
1001,
2421,
1026,
20216,
9331,
2594,
9397,
1013,
20216,
9527,
8113,
1012,
1044,
1028,
1001,
2421,
1026,
1053,
3367,
4892,
1028,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: default
title: (unrecognied function)(FIXME!)
---
[Top](../index.html)
---
### 定義場所(file name)
hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
### 説明(description)
```
// This method is used by System.gc() and JVMTI.
```
### 名前(function name)
```
void ParallelScavengeHeap::collect(GCCause::Cause cause) {
```
### 本体部(body)
```
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(!Heap_lock->owned_by_self(),
"this thread should not own the Heap_lock");
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
unsigned int gc_count = 0;
unsigned int full_gc_count = 0;
{
MutexLocker ml(Heap_lock);
// This value is guarded by the Heap_lock
gc_count = Universe::heap()->total_collections();
full_gc_count = Universe::heap()->total_full_collections();
}
{- -------------------------------------------
(1) VM_ParallelGCSystemGC を実行する.
---------------------------------------- -}
VM_ParallelGCSystemGC op(gc_count, full_gc_count, cause);
VMThread::execute(&op);
}
```
| hsmemo/hsmemo.github.com | articles/no28916-3E.md | Markdown | gpl-2.0 | 1,262 | [
30522,
1011,
1011,
1011,
9621,
1024,
12398,
2516,
1024,
1006,
4895,
2890,
3597,
29076,
2098,
3853,
1007,
1006,
8081,
4168,
999,
1007,
1011,
1011,
1011,
1031,
2327,
1033,
1006,
1012,
1012,
1013,
5950,
1012,
16129,
1007,
1011,
1011,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var fs = require("fs");
var longStr = (new Array(10000)).join("welefen");
while(true){
fs.writeFileSync("1.txt", longStr);
} | welefen/node-test | file/a.js | JavaScript | mit | 125 | [
30522,
13075,
1042,
2015,
1027,
5478,
1006,
1000,
1042,
2015,
1000,
1007,
1025,
13075,
2146,
3367,
2099,
1027,
1006,
2047,
9140,
1006,
6694,
2692,
1007,
1007,
1012,
3693,
1006,
1000,
2057,
2571,
18940,
1000,
1007,
1025,
2096,
1006,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
--DDD死偉王ヘル・アーマゲドン
function c47198668.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_PZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetTarget(c47198668.atktg1)
e2:SetOperation(c47198668.atkop1)
c:RegisterEffect(e2)
--atk up
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCountLimit(1)
e3:SetCost(c47198668.atkcost)
e3:SetTarget(c47198668.atktg2)
e3:SetOperation(c47198668.atkop2)
c:RegisterEffect(e3)
--indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetValue(c47198668.efilter)
c:RegisterEffect(e4)
end
function c47198668.filter1(c)
return c:IsFaceup() and c:IsSetCard(0xaf)
end
function c47198668.atktg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c47198668.filter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(c47198668.filter1,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c47198668.filter1,tp,LOCATION_MZONE,0,1,1,nil)
end
function c47198668.atkop1(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(800)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
function c47198668.filter2(c,e,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsType(TYPE_MONSTER)
and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
and c:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and c:IsCanBeEffectTarget(e)
end
function c47198668.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsDirectAttacked() end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function c47198668.atktg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return eg:IsContains(chkc) and c47198668.filter2(chkc,e,tp) end
if chk==0 then return eg:IsExists(c47198668.filter2,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=eg:FilterSelect(tp,c47198668.filter2,1,1,nil,e,tp)
Duel.SetTargetCard(g)
end
function c47198668.atkop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(tc:GetBaseAttack())
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c47198668.efilter(e,re,rp)
if not re:IsActiveType(TYPE_SPELL+TYPE_TRAP) then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not g:IsContains(e:GetHandler())
end
| mercury233/ygopro-scripts | c47198668.lua | Lua | gpl-2.0 | 3,662 | [
30522,
1011,
1011,
20315,
2094,
100,
100,
1909,
1721,
30259,
1738,
1693,
30265,
30249,
30229,
30240,
30263,
3853,
1039,
22610,
16147,
20842,
2575,
2620,
1012,
3988,
1035,
3466,
1006,
1039,
1007,
1011,
1011,
28300,
18654,
19554,
1012,
9585,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#include "createpartnereventsourcerequest.h"
#include "createpartnereventsourcerequest_p.h"
#include "createpartnereventsourceresponse.h"
#include "eventbridgerequest_p.h"
namespace QtAws {
namespace EventBridge {
/*!
* \class QtAws::EventBridge::CreatePartnerEventSourceRequest
* \brief The CreatePartnerEventSourceRequest class provides an interface for EventBridge CreatePartnerEventSource requests.
*
* \inmodule QtAwsEventBridge
*
* Amazon EventBridge helps you to respond to state changes in your AWS resources. When your resources change state, they
* automatically send events into an event stream. You can create rules that match selected events in the stream and route
* them to targets to take action. You can also use rules to take action on a predetermined schedule. For example, you can
* configure rules
*
* to> <ul> <li>
*
* Automatically invoke an AWS Lambda function to update DNS entries when an event notifies you that Amazon EC2 instance
* enters the running
*
* state> </li> <li>
*
* Direct specific API records from AWS CloudTrail to an Amazon Kinesis data stream for detailed analysis of potential
* security or availability
*
* risks> </li> <li>
*
* Periodically invoke a built-in target to create a snapshot of an Amazon EBS
*
* volume> </li> </ul>
*
* For more information about the features of Amazon EventBridge, see the <a
* href="https://docs.aws.amazon.com/eventbridge/latest/userguide">Amazon EventBridge User
*
* \sa EventBridgeClient::createPartnerEventSource
*/
/*!
* Constructs a copy of \a other.
*/
CreatePartnerEventSourceRequest::CreatePartnerEventSourceRequest(const CreatePartnerEventSourceRequest &other)
: EventBridgeRequest(new CreatePartnerEventSourceRequestPrivate(*other.d_func(), this))
{
}
/*!
* Constructs a CreatePartnerEventSourceRequest object.
*/
CreatePartnerEventSourceRequest::CreatePartnerEventSourceRequest()
: EventBridgeRequest(new CreatePartnerEventSourceRequestPrivate(EventBridgeRequest::CreatePartnerEventSourceAction, this))
{
}
/*!
* \reimp
*/
bool CreatePartnerEventSourceRequest::isValid() const
{
return false;
}
/*!
* Returns a CreatePartnerEventSourceResponse object to process \a reply.
*
* \sa QtAws::Core::AwsAbstractClient::send
*/
QtAws::Core::AwsAbstractResponse * CreatePartnerEventSourceRequest::response(QNetworkReply * const reply) const
{
return new CreatePartnerEventSourceResponse(*this, reply);
}
/*!
* \class QtAws::EventBridge::CreatePartnerEventSourceRequestPrivate
* \brief The CreatePartnerEventSourceRequestPrivate class provides private implementation for CreatePartnerEventSourceRequest.
* \internal
*
* \inmodule QtAwsEventBridge
*/
/*!
* Constructs a CreatePartnerEventSourceRequestPrivate object for EventBridge \a action,
* with public implementation \a q.
*/
CreatePartnerEventSourceRequestPrivate::CreatePartnerEventSourceRequestPrivate(
const EventBridgeRequest::Action action, CreatePartnerEventSourceRequest * const q)
: EventBridgeRequestPrivate(action, q)
{
}
/*!
* Constructs a copy of \a other, with public implementation \a q.
*
* This copy-like constructor exists for the benefit of the CreatePartnerEventSourceRequest
* class' copy constructor.
*/
CreatePartnerEventSourceRequestPrivate::CreatePartnerEventSourceRequestPrivate(
const CreatePartnerEventSourceRequestPrivate &other, CreatePartnerEventSourceRequest * const q)
: EventBridgeRequestPrivate(other, q)
{
}
} // namespace EventBridge
} // namespace QtAws
| pcolby/libqtaws | src/eventbridge/createpartnereventsourcerequest.cpp | C++ | lgpl-3.0 | 4,283 | [
30522,
1013,
1008,
9385,
2286,
1011,
25682,
2703,
18650,
2023,
5371,
2003,
2112,
1997,
1053,
2696,
9333,
1012,
1053,
2696,
9333,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===-- CoreFoundation/URL/CFURLSessionInterface.h - Very brief description -----------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains wrappes / helpers to import libcurl into Swift.
/// It is used to implement the NSURLSession API.
///
/// In most cases each `curl_…` API is mapped 1-to-1 to a corresponding
/// `CFURLSession_…` API.
///
/// This approach lets us keep most of the logic inside Swift code as opposed
/// to more C code.
///
/// - SeeAlso: https://curl.haxx.se/libcurl/c/
///
//===----------------------------------------------------------------------===//
#if !defined(__COREFOUNDATION_URLSESSIONINTERFACE__)
#define __COREFOUNDATION_URLSESSIONINTERFACE__ 1
#include <stdio.h>
CF_IMPLICIT_BRIDGING_ENABLED
CF_EXTERN_C_BEGIN
/// CURL
typedef void * CFURLSessionEasyHandle;
/// CURLM
typedef void * CFURLSessionMultiHandle;
// This must match libcurl's curl_socket_t
typedef int CFURLSession_socket_t;
typedef struct CFURLSessionEasyCode {
int value;
} CFURLSessionEasyCode;
CF_EXPORT CFStringRef _Nonnull CFURLSessionCreateErrorDescription(int value);
CF_EXPORT int const CFURLSessionEasyErrorSize;
/// CURLcode
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOK; // CURLE_OK
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeUNSUPPORTED_PROTOCOL; // CURLE_UNSUPPORTED_PROTOCOL
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFAILED_INIT; // CURLE_FAILED_INIT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeURL_MALFORMAT; // CURLE_URL_MALFORMAT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeNOT_BUILT_IN; // CURLE_NOT_BUILT_IN
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCOULDNT_RESOLVE_PROXY; // CURLE_COULDNT_RESOLVE_PROXY
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCOULDNT_RESOLVE_HOST; // CURLE_COULDNT_RESOLVE_HOST
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCOULDNT_CONNECT; // CURLE_COULDNT_CONNECT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_WEIRD_SERVER_REPLY; // CURLE_FTP_WEIRD_SERVER_REPLY
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeREMOTE_ACCESS_DENIED; // CURLE_REMOTE_ACCESS_DENIED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_ACCEPT_FAILED; // CURLE_FTP_ACCEPT_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_WEIRD_PASS_REPLY; // CURLE_FTP_WEIRD_PASS_REPLY
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_ACCEPT_TIMEOUT; // CURLE_FTP_ACCEPT_TIMEOUT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_WEIRD_PASV_REPLY; // CURLE_FTP_WEIRD_PASV_REPLY
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_WEIRD_227_FORMAT; // CURLE_FTP_WEIRD_227_FORMAT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_CANT_GET_HOST; // CURLE_FTP_CANT_GET_HOST
//CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeHTTP2; // CURLE_HTTP2
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_COULDNT_SET_TYPE; // CURLE_FTP_COULDNT_SET_TYPE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodePARTIAL_FILE; // CURLE_PARTIAL_FILE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_COULDNT_RETR_FILE; // CURLE_FTP_COULDNT_RETR_FILE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE20; // CURLE_OBSOLETE20
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeQUOTE_ERROR; // CURLE_QUOTE_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeHTTP_RETURNED_ERROR; // CURLE_HTTP_RETURNED_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeWRITE_ERROR; // CURLE_WRITE_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE24; // CURLE_OBSOLETE24
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeUPLOAD_FAILED; // CURLE_UPLOAD_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeREAD_ERROR; // CURLE_READ_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOUT_OF_MEMORY; // CURLE_OUT_OF_MEMORY
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOPERATION_TIMEDOUT; // CURLE_OPERATION_TIMEDOUT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE29; // CURLE_OBSOLETE29
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_PORT_FAILED; // CURLE_FTP_PORT_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_COULDNT_USE_REST; // CURLE_FTP_COULDNT_USE_REST
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE32; // CURLE_OBSOLETE32
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeRANGE_ERROR; // CURLE_RANGE_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeHTTP_POST_ERROR; // CURLE_HTTP_POST_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CONNECT_ERROR; // CURLE_SSL_CONNECT_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeBAD_DOWNLOAD_RESUME; // CURLE_BAD_DOWNLOAD_RESUME
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFILE_COULDNT_READ_FILE; // CURLE_FILE_COULDNT_READ_FILE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeLDAP_CANNOT_BIND; // CURLE_LDAP_CANNOT_BIND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeLDAP_SEARCH_FAILED; // CURLE_LDAP_SEARCH_FAILED
//CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE40; // CURLE_OBSOLETE40
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFUNCTION_NOT_FOUND; // CURLE_FUNCTION_NOT_FOUND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeABORTED_BY_CALLBACK; // CURLE_ABORTED_BY_CALLBACK
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeBAD_FUNCTION_ARGUMENT; // CURLE_BAD_FUNCTION_ARGUMENT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE44; // CURLE_OBSOLETE44
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeINTERFACE_FAILED; // CURLE_INTERFACE_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE46; // CURLE_OBSOLETE46
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTOO_MANY_REDIRECTS; // CURLE_TOO_MANY_REDIRECTS
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeUNKNOWN_OPTION; // CURLE_UNKNOWN_OPTION
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTELNET_OPTION_SYNTAX; // CURLE_TELNET_OPTION_SYNTAX
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE50; // CURLE_OBSOLETE50
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodePEER_FAILED_VERIFICATION; // CURLE_PEER_FAILED_VERIFICATION
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeGOT_NOTHING; // CURLE_GOT_NOTHING
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_ENGINE_NOTFOUND; // CURLE_SSL_ENGINE_NOTFOUND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_ENGINE_SETFAILED; // CURLE_SSL_ENGINE_SETFAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSEND_ERROR; // CURLE_SEND_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeRECV_ERROR; // CURLE_RECV_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeOBSOLETE57; // CURLE_OBSOLETE57
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CERTPROBLEM; // CURLE_SSL_CERTPROBLEM
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CIPHER; // CURLE_SSL_CIPHER
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CACERT; // CURLE_SSL_CACERT
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeBAD_CONTENT_ENCODING; // CURLE_BAD_CONTENT_ENCODING
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeLDAP_INVALID_URL; // CURLE_LDAP_INVALID_URL
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFILESIZE_EXCEEDED; // CURLE_FILESIZE_EXCEEDED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeUSE_SSL_FAILED; // CURLE_USE_SSL_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSEND_FAIL_REWIND; // CURLE_SEND_FAIL_REWIND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_ENGINE_INITFAILED; // CURLE_SSL_ENGINE_INITFAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeLOGIN_DENIED; // CURLE_LOGIN_DENIED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTFTP_NOTFOUND; // CURLE_TFTP_NOTFOUND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTFTP_PERM; // CURLE_TFTP_PERM
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeREMOTE_DISK_FULL; // CURLE_REMOTE_DISK_FULL
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTFTP_ILLEGAL; // CURLE_TFTP_ILLEGAL
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTFTP_UNKNOWNID; // CURLE_TFTP_UNKNOWNID
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeREMOTE_FILE_EXISTS; // CURLE_REMOTE_FILE_EXISTS
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeTFTP_NOSUCHUSER; // CURLE_TFTP_NOSUCHUSER
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCONV_FAILED; // CURLE_CONV_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCONV_REQD; // CURLE_CONV_REQD
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CACERT_BADFILE; // CURLE_SSL_CACERT_BADFILE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeREMOTE_FILE_NOT_FOUND; // CURLE_REMOTE_FILE_NOT_FOUND
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSH; // CURLE_SSH
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_SHUTDOWN_FAILED; // CURLE_SSL_SHUTDOWN_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeAGAIN; // CURLE_AGAIN
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_CRL_BADFILE; // CURLE_SSL_CRL_BADFILE
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_ISSUER_ERROR; // CURLE_SSL_ISSUER_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_PRET_FAILED; // CURLE_FTP_PRET_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeRTSP_CSEQ_ERROR; // CURLE_RTSP_CSEQ_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeRTSP_SESSION_ERROR; // CURLE_RTSP_SESSION_ERROR
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeFTP_BAD_FILE_LIST; // CURLE_FTP_BAD_FILE_LIST
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeCHUNK_FAILED; // CURLE_CHUNK_FAILED
CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeNO_CONNECTION_AVAILABLE; // CURLE_NO_CONNECTION_AVAILABLE
//CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_PINNEDPUBKEYNOTMATCH; // CURLE_SSL_PINNEDPUBKEYNOTMATCH
//CF_EXPORT CFURLSessionEasyCode const CFURLSessionEasyCodeSSL_INVALIDCERTSTATUS; // CURLE_SSL_INVALIDCERTSTATUS
/// CURLOPTTYPE
typedef enum {
CFURLSessionOptTypeLONG = 0, // CURLOPTTYPE_LONG
CFURLSessionOptTypeOBJECTPOINT = 10000, // CURLOPTTYPE_OBJECTPOINT
CFURLSessionOptTypeFUNCTIONPOINT = 20000, // CURLOPTTYPE_FUNCTIONPOINT
CFURLSessionOptTypeOFF_T = 30000, // CURLOPTTYPE_OFF_T
} CFURLSessionOptType;
typedef struct CFURLSessionOption {
int value;
} CFURLSessionOption;
/// CURLoption
CF_EXPORT CFURLSessionOption const CFURLSessionOptionWRITEDATA; // CURLOPT_WRITEDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionURL; // CURLOPT_URL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPORT; // CURLOPT_PORT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXY; // CURLOPT_PROXY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUSERPWD; // CURLOPT_USERPWD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYUSERPWD; // CURLOPT_PROXYUSERPWD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRANGE; // CURLOPT_RANGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionREADDATA; // CURLOPT_READDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionERRORBUFFER; // CURLOPT_ERRORBUFFER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionWRITEFUNCTION; // CURLOPT_WRITEFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionREADFUNCTION; // CURLOPT_READFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTIMEOUT; // CURLOPT_TIMEOUT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionINFILESIZE; // CURLOPT_INFILESIZE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOSTFIELDS; // CURLOPT_POSTFIELDS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionREFERER; // CURLOPT_REFERER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTPPORT; // CURLOPT_FTPPORT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUSERAGENT; // CURLOPT_USERAGENT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionLOW_SPEED_LIMIT; // CURLOPT_LOW_SPEED_LIMIT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionLOW_SPEED_TIME; // CURLOPT_LOW_SPEED_TIME
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRESUME_FROM; // CURLOPT_RESUME_FROM
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOOKIE; // CURLOPT_COOKIE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTPHEADER; // CURLOPT_HTTPHEADER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTPPOST; // CURLOPT_HTTPPOST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLCERT; // CURLOPT_SSLCERT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionKEYPASSWD; // CURLOPT_KEYPASSWD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCRLF; // CURLOPT_CRLF
CF_EXPORT CFURLSessionOption const CFURLSessionOptionQUOTE; // CURLOPT_QUOTE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHEADERDATA; // CURLOPT_HEADERDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOOKIEFILE; // CURLOPT_COOKIEFILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLVERSION; // CURLOPT_SSLVERSION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTIMECONDITION; // CURLOPT_TIMECONDITION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTIMEVALUE; // CURLOPT_TIMEVALUE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCUSTOMREQUEST; // CURLOPT_CUSTOMREQUEST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSTDERR; // CURLOPT_STDERR
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOSTQUOTE; // CURLOPT_POSTQUOTE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionOBSOLETE40; // CURLOPT_OBSOLETE40
CF_EXPORT CFURLSessionOption const CFURLSessionOptionVERBOSE; // CURLOPT_VERBOSE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHEADER; // CURLOPT_HEADER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNOPROGRESS; // CURLOPT_NOPROGRESS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNOBODY; // CURLOPT_NOBODY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFAILONERROR; // CURLOPT_FAILONERROR
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUPLOAD; // CURLOPT_UPLOAD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOST; // CURLOPT_POST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDIRLISTONLY; // CURLOPT_DIRLISTONLY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionAPPEND; // CURLOPT_APPEND
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNETRC; // CURLOPT_NETRC
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFOLLOWLOCATION; // CURLOPT_FOLLOWLOCATION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTRANSFERTEXT; // CURLOPT_TRANSFERTEXT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPUT; // CURLOPT_PUT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROGRESSFUNCTION; // CURLOPT_PROGRESSFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROGRESSDATA; // CURLOPT_PROGRESSDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionAUTOREFERER; // CURLOPT_AUTOREFERER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYPORT; // CURLOPT_PROXYPORT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOSTFIELDSIZE; // CURLOPT_POSTFIELDSIZE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTPPROXYTUNNEL; // CURLOPT_HTTPPROXYTUNNEL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionINTERFACE; // CURLOPT_INTERFACE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionKRBLEVEL; // CURLOPT_KRBLEVEL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_VERIFYPEER; // CURLOPT_SSL_VERIFYPEER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCAINFO; // CURLOPT_CAINFO
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAXREDIRS; // CURLOPT_MAXREDIRS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFILETIME; // CURLOPT_FILETIME
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTELNETOPTIONS; // CURLOPT_TELNETOPTIONS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAXCONNECTS; // CURLOPT_MAXCONNECTS
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionOBSOLETE72; // CURLOPT_OBSOLETE72
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFRESH_CONNECT; // CURLOPT_FRESH_CONNECT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFORBID_REUSE; // CURLOPT_FORBID_REUSE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRANDOM_FILE; // CURLOPT_RANDOM_FILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionEGDSOCKET; // CURLOPT_EGDSOCKET
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONNECTTIMEOUT; // CURLOPT_CONNECTTIMEOUT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHEADERFUNCTION; // CURLOPT_HEADERFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTPGET; // CURLOPT_HTTPGET
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_VERIFYHOST; // CURLOPT_SSL_VERIFYHOST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOOKIEJAR; // CURLOPT_COOKIEJAR
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_CIPHER_LIST; // CURLOPT_SSL_CIPHER_LIST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTP_VERSION; // CURLOPT_HTTP_VERSION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_USE_EPSV; // CURLOPT_FTP_USE_EPSV
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLCERTTYPE; // CURLOPT_SSLCERTTYPE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLKEY; // CURLOPT_SSLKEY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLKEYTYPE; // CURLOPT_SSLKEYTYPE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLENGINE; // CURLOPT_SSLENGINE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSLENGINE_DEFAULT; // CURLOPT_SSLENGINE_DEFAULT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_USE_GLOBAL_CACHE; // CURLOPT_DNS_USE_GLOBAL_CACHE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_CACHE_TIMEOUT; // CURLOPT_DNS_CACHE_TIMEOUT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPREQUOTE; // CURLOPT_PREQUOTE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDEBUGFUNCTION; // CURLOPT_DEBUGFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDEBUGDATA; // CURLOPT_DEBUGDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOOKIESESSION; // CURLOPT_COOKIESESSION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCAPATH; // CURLOPT_CAPATH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionBUFFERSIZE; // CURLOPT_BUFFERSIZE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNOSIGNAL; // CURLOPT_NOSIGNAL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSHARE; // CURLOPT_SHARE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYTYPE; // CURLOPT_PROXYTYPE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionACCEPT_ENCODING; // CURLOPT_ACCEPT_ENCODING
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPRIVATE; // CURLOPT_PRIVATE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTP200ALIASES; // CURLOPT_HTTP200ALIASES
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUNRESTRICTED_AUTH; // CURLOPT_UNRESTRICTED_AUTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_USE_EPRT; // CURLOPT_FTP_USE_EPRT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTPAUTH; // CURLOPT_HTTPAUTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_CTX_FUNCTION; // CURLOPT_SSL_CTX_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_CTX_DATA; // CURLOPT_SSL_CTX_DATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_CREATE_MISSING_DIRS; // CURLOPT_FTP_CREATE_MISSING_DIRS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYAUTH; // CURLOPT_PROXYAUTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_RESPONSE_TIMEOUT; // CURLOPT_FTP_RESPONSE_TIMEOUT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionIPRESOLVE; // CURLOPT_IPRESOLVE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAXFILESIZE; // CURLOPT_MAXFILESIZE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionINFILESIZE_LARGE; // CURLOPT_INFILESIZE_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRESUME_FROM_LARGE; // CURLOPT_RESUME_FROM_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAXFILESIZE_LARGE; // CURLOPT_MAXFILESIZE_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNETRC_FILE; // CURLOPT_NETRC_FILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUSE_SSL; // CURLOPT_USE_SSL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOSTFIELDSIZE_LARGE; // CURLOPT_POSTFIELDSIZE_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTCP_NODELAY; // CURLOPT_TCP_NODELAY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTPSSLAUTH; // CURLOPT_FTPSSLAUTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionIOCTLFUNCTION; // CURLOPT_IOCTLFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionIOCTLDATA; // CURLOPT_IOCTLDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_ACCOUNT; // CURLOPT_FTP_ACCOUNT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOOKIELIST; // CURLOPT_COOKIELIST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionIGNORE_CONTENT_LENGTH; // CURLOPT_IGNORE_CONTENT_LENGTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_SKIP_PASV_IP; // CURLOPT_FTP_SKIP_PASV_IP
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_FILEMETHOD; // CURLOPT_FTP_FILEMETHOD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionLOCALPORT; // CURLOPT_LOCALPORT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionLOCALPORTRANGE; // CURLOPT_LOCALPORTRANGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONNECT_ONLY; // CURLOPT_CONNECT_ONLY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONV_FROM_NETWORK_FUNCTION; // CURLOPT_CONV_FROM_NETWORK_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONV_TO_NETWORK_FUNCTION; // CURLOPT_CONV_TO_NETWORK_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONV_FROM_UTF8_FUNCTION; // CURLOPT_CONV_FROM_UTF8_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAX_SEND_SPEED_LARGE; // CURLOPT_MAX_SEND_SPEED_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAX_RECV_SPEED_LARGE; // CURLOPT_MAX_RECV_SPEED_LARGE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_ALTERNATIVE_TO_USER; // CURLOPT_FTP_ALTERNATIVE_TO_USER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSOCKOPTFUNCTION; // CURLOPT_SOCKOPTFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSOCKOPTDATA; // CURLOPT_SOCKOPTDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_SESSIONID_CACHE; // CURLOPT_SSL_SESSIONID_CACHE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_AUTH_TYPES; // CURLOPT_SSH_AUTH_TYPES
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_PUBLIC_KEYFILE; // CURLOPT_SSH_PUBLIC_KEYFILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_PRIVATE_KEYFILE; // CURLOPT_SSH_PRIVATE_KEYFILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_SSL_CCC; // CURLOPT_FTP_SSL_CCC
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTIMEOUT_MS; // CURLOPT_TIMEOUT_MS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCONNECTTIMEOUT_MS; // CURLOPT_CONNECTTIMEOUT_MS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTP_TRANSFER_DECODING; // CURLOPT_HTTP_TRANSFER_DECODING
CF_EXPORT CFURLSessionOption const CFURLSessionOptionHTTP_CONTENT_DECODING; // CURLOPT_HTTP_CONTENT_DECODING
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNEW_FILE_PERMS; // CURLOPT_NEW_FILE_PERMS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNEW_DIRECTORY_PERMS; // CURLOPT_NEW_DIRECTORY_PERMS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPOSTREDIR; // CURLOPT_POSTREDIR
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_HOST_PUBLIC_KEY_MD5; // CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
CF_EXPORT CFURLSessionOption const CFURLSessionOptionOPENSOCKETFUNCTION; // CURLOPT_OPENSOCKETFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionOPENSOCKETDATA; // CURLOPT_OPENSOCKETDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCOPYPOSTFIELDS; // CURLOPT_COPYPOSTFIELDS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXY_TRANSFER_MODE; // CURLOPT_PROXY_TRANSFER_MODE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSEEKFUNCTION; // CURLOPT_SEEKFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSEEKDATA; // CURLOPT_SEEKDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCRLFILE; // CURLOPT_CRLFILE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionISSUERCERT; // CURLOPT_ISSUERCERT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionADDRESS_SCOPE; // CURLOPT_ADDRESS_SCOPE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCERTINFO; // CURLOPT_CERTINFO
CF_EXPORT CFURLSessionOption const CFURLSessionOptionUSERNAME; // CURLOPT_USERNAME
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPASSWORD; // CURLOPT_PASSWORD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYUSERNAME; // CURLOPT_PROXYUSERNAME
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYPASSWORD; // CURLOPT_PROXYPASSWORD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionNOPROXY; // CURLOPT_NOPROXY
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTFTP_BLKSIZE; // CURLOPT_TFTP_BLKSIZE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSOCKS5_GSSAPI_SERVICE; // CURLOPT_SOCKS5_GSSAPI_SERVICE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSOCKS5_GSSAPI_NEC; // CURLOPT_SOCKS5_GSSAPI_NEC
CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROTOCOLS; // CURLOPT_PROTOCOLS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionREDIR_PROTOCOLS; // CURLOPT_REDIR_PROTOCOLS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_KNOWNHOSTS; // CURLOPT_SSH_KNOWNHOSTS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_KEYFUNCTION; // CURLOPT_SSH_KEYFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSH_KEYDATA; // CURLOPT_SSH_KEYDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAIL_FROM; // CURLOPT_MAIL_FROM
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAIL_RCPT; // CURLOPT_MAIL_RCPT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFTP_USE_PRET; // CURLOPT_FTP_USE_PRET
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_REQUEST; // CURLOPT_RTSP_REQUEST
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_SESSION_ID; // CURLOPT_RTSP_SESSION_ID
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_STREAM_URI; // CURLOPT_RTSP_STREAM_URI
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_TRANSPORT; // CURLOPT_RTSP_TRANSPORT
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_CLIENT_CSEQ; // CURLOPT_RTSP_CLIENT_CSEQ
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRTSP_SERVER_CSEQ; // CURLOPT_RTSP_SERVER_CSEQ
CF_EXPORT CFURLSessionOption const CFURLSessionOptionINTERLEAVEDATA; // CURLOPT_INTERLEAVEDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionINTERLEAVEFUNCTION; // CURLOPT_INTERLEAVEFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionWILDCARDMATCH; // CURLOPT_WILDCARDMATCH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCHUNK_BGN_FUNCTION; // CURLOPT_CHUNK_BGN_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCHUNK_END_FUNCTION; // CURLOPT_CHUNK_END_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFNMATCH_FUNCTION; // CURLOPT_FNMATCH_FUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCHUNK_DATA; // CURLOPT_CHUNK_DATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionFNMATCH_DATA; // CURLOPT_FNMATCH_DATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionRESOLVE; // CURLOPT_RESOLVE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTLSAUTH_USERNAME; // CURLOPT_TLSAUTH_USERNAME
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTLSAUTH_PASSWORD; // CURLOPT_TLSAUTH_PASSWORD
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTLSAUTH_TYPE; // CURLOPT_TLSAUTH_TYPE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTRANSFER_ENCODING; // CURLOPT_TRANSFER_ENCODING
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCLOSESOCKETFUNCTION; // CURLOPT_CLOSESOCKETFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionCLOSESOCKETDATA; // CURLOPT_CLOSESOCKETDATA
CF_EXPORT CFURLSessionOption const CFURLSessionOptionGSSAPI_DELEGATION; // CURLOPT_GSSAPI_DELEGATION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_SERVERS; // CURLOPT_DNS_SERVERS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionACCEPTTIMEOUT_MS; // CURLOPT_ACCEPTTIMEOUT_MS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTCP_KEEPALIVE; // CURLOPT_TCP_KEEPALIVE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTCP_KEEPIDLE; // CURLOPT_TCP_KEEPIDLE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionTCP_KEEPINTVL; // CURLOPT_TCP_KEEPINTVL
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_OPTIONS; // CURLOPT_SSL_OPTIONS
CF_EXPORT CFURLSessionOption const CFURLSessionOptionMAIL_AUTH; // CURLOPT_MAIL_AUTH
CF_EXPORT CFURLSessionOption const CFURLSessionOptionSASL_IR; // CURLOPT_SASL_IR
CF_EXPORT CFURLSessionOption const CFURLSessionOptionXFERINFOFUNCTION; // CURLOPT_XFERINFOFUNCTION
CF_EXPORT CFURLSessionOption const CFURLSessionOptionXFERINFODATA;
CF_EXPORT CFURLSessionOption const CFURLSessionOptionXOAUTH2_BEARER; // CURLOPT_XOAUTH2_BEARER
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_INTERFACE; // CURLOPT_DNS_INTERFACE
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_LOCAL_IP4; // CURLOPT_DNS_LOCAL_IP4
CF_EXPORT CFURLSessionOption const CFURLSessionOptionDNS_LOCAL_IP6; // CURLOPT_DNS_LOCAL_IP6
CF_EXPORT CFURLSessionOption const CFURLSessionOptionLOGIN_OPTIONS; // CURLOPT_LOGIN_OPTIONS
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_ENABLE_NPN; // CURLOPT_SSL_ENABLE_NPN
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_ENABLE_ALPN; // CURLOPT_SSL_ENABLE_ALPN
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionEXPECT_100_TIMEOUT_MS; // CURLOPT_EXPECT_100_TIMEOUT_MS
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXYHEADER; // CURLOPT_PROXYHEADER
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionHEADEROPT; // CURLOPT_HEADEROPT
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionPINNEDPUBLICKEY; // CURLOPT_PINNEDPUBLICKEY
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionUNIX_SOCKET_PATH; // CURLOPT_UNIX_SOCKET_PATH
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_VERIFYSTATUS; // CURLOPT_SSL_VERIFYSTATUS
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSSL_FALSESTART; // CURLOPT_SSL_FALSESTART
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionPATH_AS_IS; // CURLOPT_PATH_AS_IS
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionPROXY_SERVICE_NAME; // CURLOPT_PROXY_SERVICE_NAME
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionSERVICE_NAME; // CURLOPT_SERVICE_NAME
//CF_EXPORT CFURLSessionOption const CFURLSessionOptionPIPEWAIT; // CURLOPT_PIPEWAIT
/// This is a mash-up of these two types:
/// curl_infotype & CURLoption
typedef struct CFURLSessionInfo {
int value;
} CFURLSessionInfo;
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoTEXT; // CURLINFO_TEXT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoHEADER_IN; // CURLINFO_HEADER_IN
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoHEADER_OUT; // CURLINFO_HEADER_OUT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoDATA_IN; // CURLINFO_DATA_IN
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoDATA_OUT; // CURLINFO_DATA_OUT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSSL_DATA_IN; // CURLINFO_SSL_DATA_IN
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSSL_DATA_OUT; // CURLINFO_SSL_DATA_OUT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoEND; // CURLINFO_END
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoNONE; // CURLINFO_NONE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoEFFECTIVE_URL; // CURLINFO_EFFECTIVE_URL
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoRESPONSE_CODE; // CURLINFO_RESPONSE_CODE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoTOTAL_TIME; // CURLINFO_TOTAL_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoNAMELOOKUP_TIME; // CURLINFO_NAMELOOKUP_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCONNECT_TIME; // CURLINFO_CONNECT_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoPRETRANSFER_TIME; // CURLINFO_PRETRANSFER_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSIZE_UPLOAD; // CURLINFO_SIZE_UPLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSIZE_DOWNLOAD; // CURLINFO_SIZE_DOWNLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSPEED_DOWNLOAD; // CURLINFO_SPEED_DOWNLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSPEED_UPLOAD; // CURLINFO_SPEED_UPLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoHEADER_SIZE; // CURLINFO_HEADER_SIZE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoREQUEST_SIZE; // CURLINFO_REQUEST_SIZE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSSL_VERIFYRESULT; // CURLINFO_SSL_VERIFYRESULT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoFILETIME; // CURLINFO_FILETIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCONTENT_LENGTH_DOWNLOAD; // CURLINFO_CONTENT_LENGTH_DOWNLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCONTENT_LENGTH_UPLOAD; // CURLINFO_CONTENT_LENGTH_UPLOAD
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSTARTTRANSFER_TIME; // CURLINFO_STARTTRANSFER_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCONTENT_TYPE; // CURLINFO_CONTENT_TYPE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoREDIRECT_TIME; // CURLINFO_REDIRECT_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoREDIRECT_COUNT; // CURLINFO_REDIRECT_COUNT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoPRIVATE; // CURLINFO_PRIVATE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoHTTP_CONNECTCODE; // CURLINFO_HTTP_CONNECTCODE
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoHTTPAUTH_AVAIL; // CURLINFO_HTTPAUTH_AVAIL
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoPROXYAUTH_AVAIL; // CURLINFO_PROXYAUTH_AVAIL
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoOS_ERRNO; // CURLINFO_OS_ERRNO
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoNUM_CONNECTS; // CURLINFO_NUM_CONNECTS
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoSSL_ENGINES; // CURLINFO_SSL_ENGINES
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCOOKIELIST; // CURLINFO_COOKIELIST
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoLASTSOCKET; // CURLINFO_LASTSOCKET
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoFTP_ENTRY_PATH; // CURLINFO_FTP_ENTRY_PATH
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoREDIRECT_URL; // CURLINFO_REDIRECT_URL
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoPRIMARY_IP; // CURLINFO_PRIMARY_IP
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoAPPCONNECT_TIME; // CURLINFO_APPCONNECT_TIME
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCERTINFO; // CURLINFO_CERTINFO
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoCONDITION_UNMET; // CURLINFO_CONDITION_UNMET
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoRTSP_SESSION_ID; // CURLINFO_RTSP_SESSION_ID
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoRTSP_CLIENT_CSEQ; // CURLINFO_RTSP_CLIENT_CSEQ
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoRTSP_SERVER_CSEQ; // CURLINFO_RTSP_SERVER_CSEQ
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoRTSP_CSEQ_RECV; // CURLINFO_RTSP_CSEQ_RECV
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoPRIMARY_PORT; // CURLINFO_PRIMARY_PORT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoLOCAL_IP; // CURLINFO_LOCAL_IP
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoLOCAL_PORT; // CURLINFO_LOCAL_PORT
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoTLS_SESSION; // CURLINFO_TLS_SESSION
CF_EXPORT CFURLSessionInfo const CFURLSessionInfoLASTONE; // CURLINFO_LASTONE
typedef struct CFURLSessionMultiOption {
int value;
} CFURLSessionMultiOption;
/// CURLMoption
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionSOCKETFUNCTION; // CURLMOPT_SOCKETFUNCTION
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionSOCKETDATA; // CURLMOPT_SOCKETDATA
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionPIPELINING; // CURLMOPT_PIPELINING
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionTIMERFUNCTION; // CURLMOPT_TIMERFUNCTION
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionTIMERDATA; // CURLMOPT_TIMERDATA
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionMAXCONNECTS; // CURLMOPT_MAXCONNECTS
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionMAX_HOST_CONNECTIONS; // CURLMOPT_MAX_HOST_CONNECTIONS
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionMAX_PIPELINE_LENGTH; // CURLMOPT_MAX_PIPELINE_LENGTH
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionCONTENT_LENGTH_PENALTY_SIZE; // CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionCHUNK_LENGTH_PENALTY_SIZE; // CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionPIPELINING_SITE_BL; // CURLMOPT_PIPELINING_SITE_BL
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionPIPELINING_SERVER_BL; // CURLMOPT_PIPELINING_SERVER_BL
CF_EXPORT CFURLSessionMultiOption const CFURLSessionMultiOptionMAX_TOTAL_CONNECTIONS; // CURLMOPT_MAX_TOTAL_CONNECTIONS
typedef struct CFURLSessionMultiCode {
int value;
} CFURLSessionMultiCode;
/// CURLMcode
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeCALL_MULTI_PERFORM; // CURLM_CALL_MULTI_PERFORM
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeOK; // CURLM_OK
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeBAD_HANDLE; // CURLM_BAD_HANDLE
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeBAD_EASY_HANDLE; // CURLM_BAD_EASY_HANDLE
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeOUT_OF_MEMORY; // CURLM_OUT_OF_MEMORY
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeINTERNAL_ERROR; // CURLM_INTERNAL_ERROR
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeBAD_SOCKET; // CURLM_BAD_SOCKET
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeUNKNOWN_OPTION; // CURLM_UNKNOWN_OPTION
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeADDED_ALREADY; // CURLM_ADDED_ALREADY
CF_EXPORT CFURLSessionMultiCode const CFURLSessionMultiCodeLAST; // CURLM_LAST
typedef struct CFURLSessionPoll {
int value;
} CFURLSessionPoll;
CF_EXPORT CFURLSessionPoll const CFURLSessionPollNone; // CURL_POLL_NONE
CF_EXPORT CFURLSessionPoll const CFURLSessionPollIn; // CURL_POLL_IN
CF_EXPORT CFURLSessionPoll const CFURLSessionPollOut; // CURL_POLL_OUT
CF_EXPORT CFURLSessionPoll const CFURLSessionPollInOut; // CURL_POLL_INOUT
CF_EXPORT CFURLSessionPoll const CFURLSessionPollRemove; // CURL_POLL_REMOVE
typedef long CFURLSessionProtocol;
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolHTTP; // CURLPROTO_HTTP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolHTTPS; // CURLPROTO_HTTPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolFTP; // CURLPROTO_FTP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolFTPS; // CURLPROTO_FTPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSCP; // CURLPROTO_SCP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSFTP; // CURLPROTO_SFTP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolTELNET; // CURLPROTO_TELNET
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolLDAP; // CURLPROTO_LDAP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolLDAPS; // CURLPROTO_LDAPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolDICT; // CURLPROTO_DICT
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolFILE; // CURLPROTO_FILE
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolTFTP; // CURLPROTO_TFTP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolIMAP; // CURLPROTO_IMAP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolIMAPS; // CURLPROTO_IMAPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolPOP3; // CURLPROTO_POP3
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolPOP3S; // CURLPROTO_POP3S
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSMTP; // CURLPROTO_SMTP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSMTPS; // CURLPROTO_SMTPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTSP; // CURLPROTO_RTSP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMP; // CURLPROTO_RTMP
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMPT; // CURLPROTO_RTMPT
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMPE; // CURLPROTO_RTMPE
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMPTE; // CURLPROTO_RTMPTE
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMPS; // CURLPROTO_RTMPS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolRTMPTS; // CURLPROTO_RTMPTS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolGOPHER; // CURLPROTO_GOPHER
//CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSMB; // CURLPROTO_SMB
//CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolSMBS; // CURLPROTO_SMBS
CF_EXPORT CFURLSessionProtocol const CFURLSessionProtocolALL; // CURLPROTO_ALL
CF_EXPORT size_t const CFURLSessionMaxWriteSize; // CURL_MAX_WRITE_SIZE
CF_EXPORT char * _Nonnull CFURLSessionCurlVersionString(void);
typedef struct CFURLSessionCurlVersion {
int major;
int minor;
int patch;
} CFURLSessionCurlVersion;
CF_EXPORT CFURLSessionCurlVersion CFURLSessionCurlVersionInfo(void);
CF_EXPORT int const CFURLSessionWriteFuncPause;
CF_EXPORT int const CFURLSessionReadFuncPause;
CF_EXPORT int const CFURLSessionReadFuncAbort;
CF_EXPORT int const CFURLSessionSocketTimeout;
CF_EXPORT int const CFURLSessionSeekOk;
CF_EXPORT int const CFURLSessionSeekCantSeek;
CF_EXPORT int const CFURLSessionSeekFail;
CF_EXPORT CFURLSessionEasyHandle _Nonnull CFURLSessionEasyHandleInit(void);
CF_EXPORT void CFURLSessionEasyHandleDeinit(CFURLSessionEasyHandle _Nonnull handle);
CF_EXPORT CFURLSessionEasyCode CFURLSessionEasyHandleSetPauseState(CFURLSessionEasyHandle _Nonnull handle, int send, int receive);
CF_EXPORT CFURLSessionMultiHandle _Nonnull CFURLSessionMultiHandleInit(void);
CF_EXPORT CFURLSessionMultiCode CFURLSessionMultiHandleDeinit(CFURLSessionMultiHandle _Nonnull handle);
CF_EXPORT CFURLSessionMultiCode CFURLSessionMultiHandleAddHandle(CFURLSessionMultiHandle _Nonnull handle, CFURLSessionEasyHandle _Nonnull curl);
CF_EXPORT CFURLSessionMultiCode CFURLSessionMultiHandleRemoveHandle(CFURLSessionMultiHandle _Nonnull handle, CFURLSessionEasyHandle _Nonnull curl);
CF_EXPORT CFURLSessionMultiCode CFURLSessionMultiHandleAssign(CFURLSessionMultiHandle _Nonnull handle, CFURLSession_socket_t socket, void * _Nullable sockp);
CF_EXPORT CFURLSessionMultiCode CFURLSessionMultiHandleAction(CFURLSessionMultiHandle _Nonnull handle, CFURLSession_socket_t socket, int bitmask, int * _Nonnull running_handles);
typedef struct CFURLSessionMultiHandleInfo {
CFURLSessionEasyHandle _Nullable easyHandle;
CFURLSessionEasyCode resultCode;
} CFURLSessionMultiHandleInfo;
CF_EXPORT CFURLSessionMultiHandleInfo CFURLSessionMultiHandleInfoRead(CFURLSessionMultiHandle _Nonnull handle, int * _Nonnull msgs_in_queue);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_fptr(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, void *_Nullable a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_ptr(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, void *_Nullable a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_int(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, int a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_long(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, long a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_int64(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, int64_t a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_wc(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, size_t(*_Nonnull a)(char *_Nonnull, size_t, size_t, void *_Nullable));
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_fwc(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, size_t(*_Nonnull a)(char *_Nonnull, size_t, size_t, void *_Nullable));
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_dc(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, int(*_Nonnull a)(CFURLSessionEasyHandle _Nonnull handle, int type, char *_Nonnull data, size_t size, void *_Nullable userptr));
typedef enum {
CFURLSessionSocketTypeIPCXN, // socket created for a specific IP connection
CFURLSessionSocketTypeAccept, // socket created by accept() call
} CFURLSessionSocketType;
typedef int (CFURLSessionSocketOptionCallback)(void *_Nullable clientp, int fd, CFURLSessionSocketType purpose);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_sc(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, CFURLSessionSocketOptionCallback * _Nullable a);
typedef int (CFURLSessionSeekCallback)(void *_Nullable userp, int64_t offset, int origin);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_seek(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, CFURLSessionSeekCallback * _Nullable a);
typedef int (CFURLSessionTransferInfoCallback)(void *_Nullable userp, int64_t dltotal, int64_t dlnow, int64_t ultotal, int64_t ulnow);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_setopt_tc(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionOption option, CFURLSessionTransferInfoCallback * _Nullable a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_getinfo_long(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionInfo info, long *_Nonnull a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_getinfo_double(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionInfo info, double *_Nonnull a);
CF_EXPORT CFURLSessionEasyCode CFURLSession_easy_getinfo_charp(CFURLSessionEasyHandle _Nonnull curl, CFURLSessionInfo info, char *_Nullable*_Nonnull a);
CF_EXPORT CFURLSessionMultiCode CFURLSession_multi_setopt_ptr(CFURLSessionMultiHandle _Nonnull multi_handle, CFURLSessionMultiOption option, void *_Nullable a);
CF_EXPORT CFURLSessionMultiCode CFURLSession_multi_setopt_l(CFURLSessionMultiHandle _Nonnull multi_handle, CFURLSessionMultiOption option, long a);
CF_EXPORT CFURLSessionMultiCode CFURLSession_multi_setopt_sf(CFURLSessionMultiHandle _Nonnull multi_handle, CFURLSessionMultiOption option, int (*_Nonnull a)(CFURLSessionEasyHandle _Nonnull, CFURLSession_socket_t, int, void *_Nullable, void *_Nullable));
CF_EXPORT CFURLSessionMultiCode CFURLSession_multi_setopt_tf(CFURLSessionMultiHandle _Nonnull multi_handle, CFURLSessionMultiOption option, int (*_Nonnull a)(CFURLSessionMultiHandle _Nonnull, long, void *_Nullable));
CF_EXPORT CFURLSessionEasyCode CFURLSessionInit(void);
typedef struct CFURLSessionSList CFURLSessionSList;
CF_EXPORT CFURLSessionSList *_Nullable CFURLSessionSListAppend(CFURLSessionSList *_Nullable list, const char * _Nullable string);
CF_EXPORT void CFURLSessionSListFreeAll(CFURLSessionSList *_Nullable list);
CF_EXTERN_C_END
CF_IMPLICIT_BRIDGING_DISABLED
#endif /* __COREFOUNDATION_URLSESSIONINTERFACE__ */
| johnno1962b/swift-corelibs-foundation | CoreFoundation/URL.subproj/CFURLSessionInterface.h | C | apache-2.0 | 47,599 | [
30522,
1013,
1013,
1027,
1027,
1027,
1011,
1011,
4563,
14876,
18426,
3508,
1013,
24471,
2140,
1013,
12935,
3126,
4877,
7971,
3258,
18447,
2121,
12172,
1012,
1044,
1011,
2200,
4766,
6412,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use style::computed_values::font_weight;
use platform::font_context::FontContextHandle;
use platform::font::FontHandle;
use platform::font_template::FontTemplateData;
use sync::{Arc, Weak};
use font::FontHandleMethods;
/// Describes how to select a font from a given family.
/// This is very basic at the moment and needs to be
/// expanded or refactored when we support more of the
/// font styling parameters.
#[deriving(Clone)]
pub struct FontTemplateDescriptor {
pub weight: font_weight::T,
pub italic: bool,
}
impl FontTemplateDescriptor {
pub fn new(weight: font_weight::T, italic: bool) -> FontTemplateDescriptor {
FontTemplateDescriptor {
weight: weight,
italic: italic,
}
}
}
impl PartialEq for FontTemplateDescriptor {
fn eq(&self, other: &FontTemplateDescriptor) -> bool {
self.weight.is_bold() == other.weight.is_bold() &&
self.italic == other.italic
}
}
/// This describes all the information needed to create
/// font instance handles. It contains a unique
/// FontTemplateData structure that is platform specific.
pub struct FontTemplate {
identifier: String,
descriptor: Option<FontTemplateDescriptor>,
data: Option<Weak<FontTemplateData>>,
}
/// Holds all of the template information for a font that
/// is common, regardless of the number of instances of
/// this font handle per thread.
impl FontTemplate {
pub fn new(identifier: &str) -> FontTemplate {
FontTemplate {
identifier: identifier.to_string(),
descriptor: None,
data: None,
}
}
/// Get the data for creating a font if it matches a given descriptor.
pub fn get_if_matches(&mut self, fctx: &FontContextHandle,
requested_desc: &FontTemplateDescriptor) -> Option<Arc<FontTemplateData>> {
// The font template data can be unloaded when nothing is referencing
// it (via the Weak reference to the Arc above). However, if we have
// already loaded a font, store the style information about it separately,
// so that we can do font matching against it again in the future
// without having to reload the font (unless it is an actual match).
match self.descriptor {
Some(actual_desc) => {
if *requested_desc == actual_desc {
Some(self.get_data())
} else {
None
}
},
None => {
let data = self.get_data();
let handle = FontHandleMethods::new_from_template(fctx, data.clone(), None);
let handle: FontHandle = match handle {
Ok(handle) => handle,
Err(()) => fail!("TODO - Handle failure to create a font from template."),
};
let actual_desc = FontTemplateDescriptor::new(handle.boldness(),
handle.is_italic());
let desc_match = actual_desc == *requested_desc;
self.descriptor = Some(actual_desc);
if desc_match {
Some(data)
} else {
None
}
}
}
}
/// Get the font template data. If any strong references still
/// exist, it will return a clone, otherwise it will load the
/// font data and store a weak reference to it internally.
pub fn get_data(&mut self) -> Arc<FontTemplateData> {
let maybe_data = match self.data {
Some(ref data) => data.upgrade(),
None => None,
};
match maybe_data {
Some(data) => data,
None => {
let template_data = Arc::new(FontTemplateData::new(self.identifier.as_slice()));
self.data = Some(template_data.downgrade());
template_data
}
}
}
}
| seanmonstar/servo | src/components/gfx/font_template.rs | Rust | mpl-2.0 | 4,170 | [
30522,
1013,
1008,
2023,
3120,
3642,
2433,
2003,
3395,
2000,
1996,
3408,
1997,
1996,
9587,
5831,
4571,
2270,
1008,
6105,
1010,
1058,
1012,
1016,
1012,
1014,
1012,
2065,
1037,
6100,
1997,
1996,
6131,
2140,
2001,
2025,
5500,
2007,
2023,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"33035060","logradouro":"Rua R","bairro":"Boa Esperan\u00e7a","cidade":"Santa Luzia","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/33035060.jsonp.js | JavaScript | cc0-1.0 | 135 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
14210,
19481,
2692,
16086,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
1054,
1000,
1010,
1000,
21790,
18933,
1000,
1024,
1000,
8945,
2050... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div id="search">
<input type="text" value="Search" />
</div>
<div id="head-nav">
{pyro:navigation:links group="header"}
</div>
| wret36/marinersTraining | addons/themes/mariners/views/partials/header.html | HTML | apache-2.0 | 130 | [
30522,
1026,
4487,
2615,
8909,
1027,
1000,
3945,
1000,
1028,
1026,
7953,
2828,
1027,
1000,
3793,
1000,
3643,
1027,
1000,
3945,
1000,
1013,
1028,
1026,
1013,
4487,
2615,
1028,
1026,
4487,
2615,
8909,
1027,
1000,
2132,
1011,
6583,
2615,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.jitsi.nabus.device;
import org.jitsi.impl.neomedia.device.MediaDeviceImpl;
import org.jitsi.nabus.access.CameraAccess;
import org.jitsi.service.neomedia.MediaType;
import org.jitsi.service.neomedia.device.MediaDevice;
import org.jitsi.service.neomedia.format.MediaFormat;
import javax.media.CaptureDeviceInfo;
import java.awt.*;
import java.util.List;
/**
* Created by Sergey on 11/2/2014.
*/
public class Camera implements CameraAccess {
private MediaDevice device;
private CaptureDeviceInfo captureDeviceInfo;
private int frameRate;
private Dimension size;
public Camera(CaptureDeviceInfo captureDeviceInfo) {
this.device = new MediaDeviceImpl(captureDeviceInfo, MediaType.VIDEO);
this.captureDeviceInfo = captureDeviceInfo;
}
public String getName() {
return captureDeviceInfo.getName();
}
public MediaDevice getDevice() {
return this.device;
}
public MediaFormat getMediaFormat() {
return this.device.getFormat();
}
@Override
public void setFrameRate(int frameRate) {
this.frameRate = frameRate;
}
@Override
public List<Dimension> getAvailableCaptureSizes() {
return null;
}
@Override
public void setCaptureSize(Dimension size) {
this.size = size;
}
@Override
public void crateScreenShot() {
}
@Override
public void startRecording(String cameraDataHandler) {
}
@Override
public void stopRecording() {
}
}
| kerenby/nabus | src/org/jitsi/nabus/device/Camera.java | Java | lgpl-2.1 | 1,525 | [
30522,
7427,
8917,
1012,
10147,
3215,
2072,
1012,
6583,
8286,
1012,
5080,
1025,
12324,
8917,
1012,
10147,
3215,
2072,
1012,
17727,
2140,
1012,
9253,
16969,
1012,
5080,
1012,
2865,
24844,
6610,
5714,
24759,
1025,
12324,
8917,
1012,
10147,
32... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (c) 2008 Health Market Science, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.healthmarketscience.jackcess.impl.query;
import java.util.List;
import static com.healthmarketscience.jackcess.impl.query.QueryFormat.*;
import com.healthmarketscience.jackcess.query.UnionQuery;
/**
* Concrete Query subclass which represents a UNION query, e.g.:
* {@code SELECT <query1> UNION SELECT <query2>}
*
* @author James Ahlborn
*/
public class UnionQueryImpl extends QueryImpl implements UnionQuery
{
public UnionQueryImpl(String name, List<Row> rows, int objectId,
int objectFlag) {
super(name, rows, objectId, objectFlag, Type.UNION);
}
@Override
public String getUnionType() {
return(hasFlag(UNION_FLAG) ? DEFAULT_TYPE : "ALL");
}
@Override
public String getUnionString1() {
return getUnionString(UNION_PART1);
}
@Override
public String getUnionString2() {
return getUnionString(UNION_PART2);
}
@Override
public List<String> getOrderings() {
return super.getOrderings();
}
private String getUnionString(String id) {
for(Row row : getTableRows()) {
if(id.equals(row.name2)) {
return cleanUnionString(row.expression);
}
}
throw new IllegalStateException(
"Could not find union query with id " + id);
}
@Override
protected void toSQLString(StringBuilder builder)
{
builder.append(getUnionString1()).append(NEWLINE)
.append("UNION ");
String unionType = getUnionType();
if(!DEFAULT_TYPE.equals(unionType)) {
builder.append(unionType).append(' ');
}
builder.append(getUnionString2());
List<String> orderings = getOrderings();
if(!orderings.isEmpty()) {
builder.append(NEWLINE).append("ORDER BY ").append(orderings);
}
}
private static String cleanUnionString(String str)
{
return str.trim().replaceAll("[\r\n]+", NEWLINE);
}
}
| jahlborn/jackcess | src/main/java/com/healthmarketscience/jackcess/impl/query/UnionQueryImpl.java | Java | apache-2.0 | 2,428 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2263,
2740,
3006,
2671,
1010,
4297,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This file is part of Warbirds BDA Script Generator.
// Foobar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Warbirds BDA Script Generator is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// (c) Noflyz - United Mud Movers - noflyz.wix.com/united-mud-movers
(function() {
var assets = [{"name": "G0", "label" : "88Flack", "damage" : "500", "sdesc" : "0 otOT_88_FLACK Runway gun or 88 Flack", "required" : "N", "description" : "Large flak gun in sandbag ring."},
{"name": "G1", "label" : "MG", "damage" : "200", "sdesc" : "1 otOT_RUNWAY_GUN Aircraft factory gun", "required" : "N", "description" : "Twin MG position with man."},
{"name": "G2", "label" : "20mm", "damage" : "200", "sdesc" : "2 otOT_FUEL_FACTORY_GUN Fuel factory gun", "required" : "N", "description" : "Small flak position in dirt ring OR medium sandbag ring with MG and man." },
{"name": "G3", "label" : "40mm", "damage" : "300", "sdesc" : "3 otOT_MUNITION_FACTORY_GUN Munition factory gun", "required" : "N", "description" : "Medium flak postion in dirt ring OR large sandbag ring with wheeled gun." },
{"name": "G4", "label" : "HQGun", "damage" : "500", "sdesc" : "4 otOT_HQ_GUN HQ gun", "required" : "Y", "description" : "Camo Arty Ring Position with special significance." },
{"name": "HG", "label" : "Hanger", "damage" : "2500", "sdesc" : "5 otOT_HANGER Hangar", "required" : "Y", "description" : "Airfield Structures of various types and sizes to house aircraft." },
{"name": "RW", "label" : "Runway", "damage" : "20000", "sdesc" : "6 otOT_RUNWAY Runway", "required" : "N", "description" : "Ground texture representing base layer of airfields and towns." },
{"name": "HQ", "label" : "HQ", "damage" : "2000", "sdesc" : "7 otOT_HQ HQ (head quarters)", "required" : "Y", "description" : "Any building with special significance." },
{"name": "TW", "label" : "Tower", "damage" : "2000", "sdesc" : "8 otOT_TOWER Tower", "required" : "N", "description" : "Control object for each field of various types, needed for capture." },
{"name": "TX", "label" : "TaxiWay", "damage" : "8000", "sdesc" : "9 otOT_TAXY_WAY Taxi way", "required" : "N", "description" : "Ground texture representing a specific base area of airfields and towns." },
{"name": "BO", "label" : "Unit", "damage" : "100", "sdesc" : "10 otOT_BOMBABLE_OBJECT Bombable object", "required" : "N", "description" : "Any small unimportant structure not necessary for base closure." },
{"name": "BE", "label" : "BoatEntry", "damage" : "20000", "sdesc" : "11 otOT_BOAT_ENTRY Boat entry", "required" : "N", "description" : "Any very large structure not necessary for base closure." },
{"name": "CB", "label" : "Carrier", "damage" : "250", "sdesc" : "12 otOT_CARRIER Carrier", "required" : "Y", "description" : "Trucks and M5 HTs - carrier of supplies and troops." },
{"name": "BB", "label" : "Boat", "damage" : "1000", "sdesc" : "13 otOT_BOMBABLE_BOAT Bombable boat", "required" : "Y", "description" : "Vic56 small coastal boat" },
{"name": "ST", "label" : "Strat", "damage" : "10000", "sdesc" : "14 otOT_STRAT_OBJECT Strat object", "required" : "N", "description" : "Not in use - possible special strategic target" },
{"name": "RD", "label" : "RadarEm", "damage" : "2000", "sdesc" : "15 otOT_RADAR_EMITTER Radar emitter", "required" : "Y", "description" : "Square radar mast or circular listening dish - determines radar ingame." },
{"name": "C0", "label" : "ReadyRoom", "damage" : "1250", "sdesc" : "16 otOT_READY_ROOM Ready room", "required" : "Y", "description" : "Squadron assembly room at airfields" },
{"name": "C1", "label" : "Capital", "damage" : "2000", "sdesc" : "17 otOT_CAPITAL Capital", "required" : "Y", "description" : "DD1 or DD2 Destroyer - capital ship" },
{"name": "AS", "label" : "Asteroid", "damage" : "500", "sdesc" : "18 otOT_ASTERIOD Asteroid", "required" : "Y", "description" : "Barrage or Observation Balloons" },
{"name": "FM", "label" : "FacMod", "damage" : "4000", "sdesc" : "19 otOT_FACTORY_MODULE Factory module", "required" : "Y", "description" : "Various medium-sized associated factory buildings." },
{"name": "LM", "label" : "LivMod", "damage" : "2000", "sdesc" : "20 otOT_LIVING_MODULE Living module", "required" : "Y", "description" : "Various large housing developments at industry and urban areas." },
{"name": "DM", "label" : "Dock", "damage" : "1000", "sdesc" : "21 otOT_DOCKING_MODULE Docking module", "required" : "Y", "description" : "Wood dock or steel bridge span" },
{"name": "SM", "label" : "Struct", "damage" : "500", "sdesc" : "22 otOT_STRUCTURE_MODULE Structure module", "required" : "Y", "description" : "Any small structure necessary for base closure." },
{"name": "CM", "label" : "Cargo", "damage" : "1500", "sdesc" : "23 otOT_CARGO_MODULE Cargo module", "required" : "Y", "description" : "Freighter - cargo ship" },
{"name": "WM", "label" : "Weapon", "damage" : "750", "sdesc" : "24 otOT_WEAPONS_MODULE Weapons module", "required" : "Y", "description" : "Tanks, M16s or M3s - armoured weapons" },
{"name": "PL", "label" : "Planet", "damage" : "50000", "sdesc" : "25 otOT_PLANET Planet", "required" : "N", "description" : "Not in use - possible terrain object indestructable" },
{"name": "X?","label" : "Link", "damage" : "100", "sdesc" : "26 otOT_LINK Link", "required" : "N", "description" : "Not in use - possible communication link between fields" },
{"name": "PA", "label" : "ParkedAC", "damage" : "350", "sdesc" : "27 otOT_PARKED_AIRCRAFT Parked Aircraft", "required" : "Y", "description" : "Parked a/c types - various types specific to terrains." },
{"name": "A0", "label" : "Arty0", "damage" : "500", "sdesc" : "28 otOT_ARTILLERY0 Artillery Type 0", "required" : "Y", "description" : "Camo Arty Ring Position representing field artillery(up to 105mm)" },
{"name": "A1", "label" : "Arty1", "damage" : "700", "sdesc" : "29 otOT_ARTILLERY1 Artillery Type 1", "required" : "Y", "description" : "Camo Arty Ring Position representing heavy artillery(above 105mm)" },
{"name": "A2", "label" : "Arty2", "damage" : "1000", "sdesc" : "30 otOT_ARTILLERY2 Artillery Type 2", "required" : "Y", "description" : "Camo Arty Ring Position representing coastal artillery(above 200mm)" },
{"name": "FD", "label" : "FuelDmp", "damage" : "500", "sdesc" : "31 otOT_FUEL_DUMP Fuel Dump", "required" : "Y", "description" : "Small fuel tanks at airfields and other locations." },
{"name": "RS", "label" : "RadarStn", "damage" : "1500", "sdesc" : "32 otOT_RADAR_STATION Radar Station", "required" : "Y", "description" : "Radar control building with mast - does not determine radar ingame." },
{"name": "WH", "label" : "Warehouse", "damage" : "2000", "sdesc" : "33 otOT_WAREHOUSE Warehouse", "required" : "Y", "description" : "Various large buildings that store goods at all locations." },
{"name": "AD", "label" : "AmmoDump", "damage" : "1250", "sdesc" : "34 otOT_AMMO_DUMP Ammunition Dump", "required" : "Y", "description" : "Various fortified ammunition storage bunkers at airfields and tactical positions." },
{"name": "HT", "label" : "Hut", "damage" : "600", "sdesc" : "35 otOT_HUT Hut/Tent", "required" : "Y", "description" : "Tent and tent hangars." },
{"name": "HS", "label" : "House", "damage" : "800", "sdesc" : "36 otOT_HOUSE House", "required" : "Y", "description" : "Various small general structures at all locations." },
{"name": "RK", "label" : "Rock", "damage" : "500", "sdesc" : "37 otOT_ROCK Rock", "required" : "Y", "description" : "Stone bridge span OR similar stone structure like walls." },
{"name": "TR", "label" : "Tree", "damage" : "200", "sdesc" : "38 otOT_TREE Tree", "required" : "N", "description" : "Tree object - different than tree clutter objects" },
{"name": "B1", "label" : "Bridge", "damage" : "2500", "sdesc" : "39 otOT_BRIDGE", "required" : "N", "description" : "Port base object - TERRAIN SPECIFIC" },
{"name": "G5", "label" : "37mm-AT", "damage" : "300", "sdesc" : "40 otOT_ANTITANK_1", "required" : "Y", "description" : "Large sandbag ring with wheeled gun." },
{"name": "G6", "label" : "75mm-AT", "damage" : "400", "sdesc" : "41 otOT_ANTITANK_2", "required" : "Y" , "description" : "Camo Arty Ring Position representing large AT guns." },
{"name": "EA", "label" : "Factory", "damage" : "3000", "sdesc" : "42 otOT_FACTORY Factory", "required" : "Y", "description" : "Various large factory buildings at industry locations." },
{"name": "EB", "label" : "FactComplex", "damage" : "5000", "sdesc" : "43 otOT_FACTCOMPLEX FactComplex", "required" : "Y", "description" : "Very large factory building at industry locations." },
{"name": "EC", "label" : "FactAvionics", "damage" : "3000", "sdesc" : "44 otOT_FACTAVIONICS FactAvionics", "required" : "Y", "description" : "Large peaked factory building at industry locations." },
{"name": "ED", "label" : "FactBall1", "damage" : "3000", "sdesc" : "45 otOT_FACTBALL FactBall1", "required" : "Y", "description" : "Medium factory building at industry locations." },
{"name": "EE", "label" : "FactBall2", "damage" : "4000", "sdesc" : "46 otOT_FACTBALL2 FactBall2", "required" : "Y", "description" : "Large factory building at industry locations." },
{"name": "EF", "label" : "Warehouse2", "damage" : "3000", "sdesc" : "47 otOT_WAREHOUSE2 Warehouse2", "required" : "Y", "description" : "Various very large buildings that store goods at major locations." },
{"name": "EG", "label" : "Crane", "damage" : "1000", "sdesc" : "48 otOT_CRANE Crane", "required" : "Y", "description" : "Cranes at ports, industry and railway yards - two types." },
{"name": "EH", "label" : "Pontoon", "damage" : "300", "sdesc" : "49 otOT_PONTOON Pontoon", "required" : "Y", "description" : "Pontoon bridge span" },
{"name": "EI", "label" : "ReFinBuild1", "damage" : "4000", "sdesc" : "50 otOT_REFINBUILD1 ReFinBuild1", "required" : "Y", "description" : "Medium refinery building at industry locations." },
{"name": "EJ", "label" : "RefFinSep", "damage" : "700", "sdesc" : "51 otOT_REFINSTEP RefFinSep", "required" : "Y", "description" : "Oil industry refinery seperation tower." },
{"name": "EK", "label" : "ReFinTank", "damage" : "1250", "sdesc" : "52 otOT_REFINTANK ReFinTank", "required" : "Y", "description" : "Large fuel tanks at industry and port locations." },
{"name": "EL", "label" : "RefinPipe", "damage" : "700", "sdesc" : "53 otOT_REFINPIPE RefinPipe", "required" : "Y", "description" : "Industry smoke stack - all industry types" },
{"name": "EM", "label" : "Power1", "damage" : "1000", "sdesc" : "54 otOT_POWER1 Power1", "required" : "Y", "description" : "Small power generator building at industry locations." },
{"name": "EN", "label" : "Power2", "damage" : "1500", "sdesc" : "55 otOT_POWER2 Power2", "required" : "Y", "description" : "Medium power generator building at industry locations." },
{"name": "EO", "label" : "Power3", "damage" : "2000", "sdesc" : "56 otOT_POWER3 Power3", "required" : "Y", "description" : "Large power generator building at industry locations." },
{"name": "EP", "label" : "Uboat", "damage" : "1000", "sdesc" : "57 otOT_UBOAT Uboat", "required" : "Y", "description" : "Not in use - possible submarine target" },
{"name": "EQ", "label" : "Gas1", "damage" : "750", "sdesc" : "58 otOT_GAS1 Gas1", "required" : "Y", "description" : "Medium sized fuel tanks at industry locations." },
{"name": "ER", "label" : "Subpen", "damage" : "3000", "sdesc" : "59 otOT_SUBPEN Subpen", "required" : "Y", "description" : "Large concrete sub hangars at ports OR dam sections across rivers." },
{"name": "ES", "label" : "ObsCnCr", "damage" : "1000", "sdesc" : "60 otOT_OBSCNCR ObsCnCr", "required" : "Y", "description" : "Observation Control Center - control bunker in fortified defenses." },
{"name": "ET", "label" : "Barracks01", "damage" : "2000", "sdesc" : "61 otOT_BARRACKS01 Barracks01", "required" : "Y", "description" : "Various large buildings that house troops at airfields, bases and ports." },
{"name": "EU", "label" : "Bunker", "damage" : "1500", "sdesc" : "62 otOT_BUNKER Bunker", "required" : "Y", "description" : "Various small fortified buildings at airfields or tactical postions." },
{"name": "EV", "label" : "LightTower", "damage" : "1000", "sdesc" : "63 otOT_LIGHTTOWER LightTower", "required" : "Y", "description" : "Coastal lighthouse - on coastlines and at seaports." },
{"name": "EW", "label" : "CntrlRail", "damage" : "1500", "sdesc" : "64 otOT_CNTRLRAIL CntrlRail", "required" : "Y", "description" : "Railway platform for passenger trains." },
{"name": "EX", "label" : "MLine1", "damage" : "2000", "sdesc" : "65 otOT_MLINE1 MLine1", "required" : "Y", "description" : "Small concrete blockhouse with MG turrets - in fortified areas." },
{"name": "EY", "label" : "MLine2", "damage" : "3000", "sdesc" : "66 otOT_MLINE2 MLine2", "required" : "Y", "description" : "Large concrete blockhouse with gun turrets - in fortified areas." },
{"name": "G7", "label" : "DOAFlack", "damage" : "500", "sdesc" : "67 otOT_DOA_FLACK", "required" : "N", "description" : "DOA specific" },
{"name": "G8", "label" : "BritRifle", "damage" : "10", "sdesc" : "68 otOT_BRITRIFLE", "required" : "N", "description" : "DOA specific" },
{"name": "G9", "label" : "GermRifle", "damage" : "10", "sdesc" : "69 otOT_GERMRIFLE", "required" : "N", "description" : "DOA specific" },
{"name": "GA", "label" : "TrenchMG", "damage" : "200", "sdesc" : "70 otOT_TRENCHMG", "required" : "N", "description" : "DOA specific" },
{"name": "GB", "label" : "AAAMG", "damage" : "200", "sdesc" : "71 otOT_AAAMG", "required" : "N", "description" : "DOA specific"}];
var app = angular.module('assets', []);
app.directive('assetList', function() {
var o= { restrict: 'E',
templateUrl: 'asset-list.html',
controller:
function() {
var ctrl = this;
this.assets = assets;
this.sel = assets[0];
this.dtf = "%%\n%%\n";
this.selNo = 1;
this.startNo = 1;
this.fieldNum = 1;
this.numbers = [1,2,3,4,5,6,7,8,9,10];
this.needed = {};
this.get_asset = function(k) {
for (var i = 0; i < this.assets.length; ++i) {
if (this.assets[i].name === k) {
return this.assets[i];
}
}
return null;
};
this.add_asset = function() {
this.needed[this.sel.name] = [this.sel.description, this.startNo, this.selNo];
this.gen_dtf();
};
this.remove_asset = function(k) {
console.log(k);
delete this.needed[k];
this.gen_dtf();
};
this.gen_dtf = function() {
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
};
this.dtf = "%%\n";
// Initialize variables
for (var k in this.needed) {
this.dtf += ".intsto " + k + "_count 0\n";
};
// Generate counts
for (var k in this.needed) {
var o = this.needed[k];
var s = o[1];
var e = o[2];
for (var i = s; i <= e; ++i) {
this.dtf += "if (DESTROYED(GROUNDOBJECT(\"F" +
this.fieldNum.pad(3) + k + i.pad(3)
+ "\")))\n{\n}\nelse\n{\n"
+ ".intadd " + k + "_count 1\n}\n";
}
};
// Print Report
for (var k in this.needed) {
console.log(k);
this.dtf += ".echo @" + k + "_count@ - "
+ this.get_asset(k).description + "\n";
};
// Free the variables
for (var k in this.needed) {
this.dtf += ".varfree " + k + "_count\n";
};
this.dtf += "%%\n";
};
},
controllerAs: 'assetCtrl'
};
return o;
});
})();
| raviyer/warbirds | warbirds/bda/assets.js | JavaScript | gpl-2.0 | 17,033 | [
30522,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
2162,
12887,
1038,
2850,
5896,
13103,
1012,
1013,
1013,
29379,
8237,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1013,
1013,
2009,
2104,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* This is where the magic happens. The Game object is the heart of your game,
* providing quick access to common functions and handling the boot process.
*
* "Hell, there are no rules here - we're trying to accomplish something."
* Thomas A. Edison
*
* @class Phaser.Game
* @constructor
* @param {object} [gameConfig={}] - The game configuration object
*/
Phaser.Game = function (gameConfig) {
/**
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
* @readonly
*/
this.id = Phaser.GAMES.push(this) - 1;
/**
* @property {object} config - The Phaser.Game configuration object.
*/
this.config = null;
/**
* @property {object} physicsConfig - The Phaser.Physics.World configuration object.
*/
this.physicsConfig = null;
/**
* @property {string|HTMLElement} parent - The Games DOM parent.
* @default
*/
this.parent = '';
/**
* The current Game Width in pixels.
*
* _Do not modify this property directly:_ use {@link Phaser.ScaleManager#setGameSize} - eg. `game.scale.setGameSize(width, height)` - instead.
*
* @property {integer} width
* @readonly
* @default
*/
this.width = 800;
/**
* The current Game Height in pixels.
*
* _Do not modify this property directly:_ use {@link Phaser.ScaleManager#setGameSize} - eg. `game.scale.setGameSize(width, height)` - instead.
*
* @property {integer} height
* @readonly
* @default
*/
this.height = 600;
/**
* The resolution of your game. This value is read only, but can be changed at start time it via a game configuration object.
*
* @property {integer} resolution
* @readonly
* @default
*/
this.resolution = 1;
/**
* @property {integer} _width - Private internal var.
* @private
*/
this._width = 800;
/**
* @property {integer} _height - Private internal var.
* @private
*/
this._height = 600;
/**
* @property {boolean} transparent - Use a transparent canvas background or not.
* @default
*/
this.transparent = false;
/**
* @property {boolean} antialias - Anti-alias graphics. By default scaled images are smoothed in Canvas and WebGL, set anti-alias to false to disable this globally.
* @default
*/
this.antialias = false;
/**
* @property {boolean} preserveDrawingBuffer - The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
* @default
*/
this.preserveDrawingBuffer = false;
/**
* Clear the Canvas each frame before rendering the display list.
* You can set this to `false` to gain some performance if your game always contains a background that completely fills the display.
* @property {boolean} clearBeforeRender
* @default
*/
this.clearBeforeRender = true;
/**
* @property {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - The Pixi Renderer.
* @protected
*/
this.renderer = null;
/**
* @property {number} renderType - The Renderer this game will use. Either Phaser.AUTO, Phaser.CANVAS, Phaser.WEBGL, or Phaser.HEADLESS.
* @readonly
*/
this.renderType = Phaser.AUTO;
/**
* @property {Phaser.StateManager} state - The StateManager.
*/
this.state = null;
/**
* @property {boolean} isBooted - Whether the game engine is booted, aka available.
* @readonly
*/
this.isBooted = false;
/**
* @property {boolean} isRunning - Is game running or paused?
* @readonly
*/
this.isRunning = false;
/**
* @property {Phaser.RequestAnimationFrame} raf - Automatically handles the core game loop via requestAnimationFrame or setTimeout
* @protected
*/
this.raf = null;
/**
* @property {Phaser.GameObjectFactory} add - Reference to the Phaser.GameObjectFactory.
*/
this.add = null;
/**
* @property {Phaser.GameObjectCreator} make - Reference to the GameObject Creator.
*/
this.make = null;
/**
* @property {Phaser.Cache} cache - Reference to the assets cache.
*/
this.cache = null;
/**
* @property {Phaser.Input} input - Reference to the input manager
*/
this.input = null;
/**
* @property {Phaser.Loader} load - Reference to the assets loader.
*/
this.load = null;
/**
* @property {Phaser.Math} math - Reference to the math helper.
*/
this.math = null;
/**
* @property {Phaser.Net} net - Reference to the network class.
*/
this.net = null;
/**
* @property {Phaser.ScaleManager} scale - The game scale manager.
*/
this.scale = null;
/**
* @property {Phaser.SoundManager} sound - Reference to the sound manager.
*/
this.sound = null;
/**
* @property {Phaser.Stage} stage - Reference to the stage.
*/
this.stage = null;
/**
* @property {Phaser.Time} time - Reference to the core game clock.
*/
this.time = null;
/**
* @property {Phaser.TweenManager} tweens - Reference to the tween manager.
*/
this.tweens = null;
/**
* @property {Phaser.World} world - Reference to the world.
*/
this.world = null;
/**
* @property {Phaser.Physics} physics - Reference to the physics manager.
*/
this.physics = null;
/**
* @property {Phaser.PluginManager} plugins - Reference to the plugin manager.
*/
this.plugins = null;
/**
* @property {Phaser.RandomDataGenerator} rnd - Instance of repeatable random data generator helper.
*/
this.rnd = null;
/**
* @property {Phaser.Device} device - Contains device information and capabilities.
*/
this.device = Phaser.Device;
/**
* @property {Phaser.Camera} camera - A handy reference to world.camera.
*/
this.camera = null;
/**
* @property {HTMLCanvasElement} canvas - A handy reference to renderer.view, the canvas that the game is being rendered in to.
*/
this.canvas = null;
/**
* @property {CanvasRenderingContext2D} context - A handy reference to renderer.context (only set for CANVAS games, not WebGL)
*/
this.context = null;
/**
* @property {Phaser.Utils.Debug} debug - A set of useful debug utilities.
*/
this.debug = null;
/**
* @property {Phaser.Particles} particles - The Particle Manager.
*/
this.particles = null;
/**
* @property {Phaser.Create} create - The Asset Generator.
*/
this.create = null;
/**
* If `false` Phaser will automatically render the display list every update. If `true` the render loop will be skipped.
* You can toggle this value at run-time to gain exact control over when Phaser renders. This can be useful in certain types of game or application.
* Please note that if you don't render the display list then none of the game object transforms will be updated, so use this value carefully.
* @property {boolean} lockRender
* @default
*/
this.lockRender = false;
/**
* @property {boolean} stepping - Enable core loop stepping with Game.enableStep().
* @default
* @readonly
*/
this.stepping = false;
/**
* @property {boolean} pendingStep - An internal property used by enableStep, but also useful to query from your own game objects.
* @default
* @readonly
*/
this.pendingStep = false;
/**
* @property {number} stepCount - When stepping is enabled this contains the current step cycle.
* @default
* @readonly
*/
this.stepCount = 0;
/**
* @property {Phaser.Signal} onPause - This event is fired when the game pauses.
*/
this.onPause = null;
/**
* @property {Phaser.Signal} onResume - This event is fired when the game resumes from a paused state.
*/
this.onResume = null;
/**
* @property {Phaser.Signal} onBlur - This event is fired when the game no longer has focus (typically on page hide).
*/
this.onBlur = null;
/**
* @property {Phaser.Signal} onFocus - This event is fired when the game has focus (typically on page show).
*/
this.onFocus = null;
/**
* @property {boolean} _paused - Is game paused?
* @private
*/
this._paused = false;
/**
* @property {boolean} _codePaused - Was the game paused via code or a visibility change?
* @private
*/
this._codePaused = false;
/**
* The ID of the current/last logic update applied this render frame, starting from 0.
* The first update is `currentUpdateID === 0` and the last update is `currentUpdateID === updatesThisFrame.`
* @property {integer} currentUpdateID
* @protected
*/
this.currentUpdateID = 0;
/**
* Number of logic updates expected to occur this render frame; will be 1 unless there are catch-ups required (and allowed).
* @property {integer} updatesThisFrame
* @protected
*/
this.updatesThisFrame = 1;
/**
* @property {number} _deltaTime - Accumulate elapsed time until a logic update is due.
* @private
*/
this._deltaTime = 0;
/**
* @property {number} _lastCount - Remember how many 'catch-up' iterations were used on the logicUpdate last frame.
* @private
*/
this._lastCount = 0;
/**
* @property {number} _spiraling - If the 'catch-up' iterations are spiraling out of control, this counter is incremented.
* @private
*/
this._spiraling = 0;
/**
* @property {boolean} _kickstart - Force a logic update + render by default (always set on Boot and State swap)
* @private
*/
this._kickstart = true;
/**
* If the game is struggling to maintain the desired FPS, this signal will be dispatched.
* The desired/chosen FPS should probably be closer to the {@link Phaser.Time#suggestedFps} value.
* @property {Phaser.Signal} fpsProblemNotifier
* @public
*/
this.fpsProblemNotifier = new Phaser.Signal();
/**
* @property {boolean} forceSingleUpdate - Should the game loop force a logic update, regardless of the delta timer? Set to true if you know you need this. You can toggle it on the fly.
*/
this.forceSingleUpdate = true;
/**
* @property {number} _nextNotification - The soonest game.time.time value that the next fpsProblemNotifier can be dispatched.
* @private
*/
this._nextFpsNotification = 0;
// Parse the configuration object
if (typeof gameConfig !== 'object')
{
throw new Error('Missing game configuration object: ' + gameConfig);
}
this.parseConfig(gameConfig);
this.device.whenReady(this.boot, this);
return this;
};
Phaser.Game.prototype = {
/**
* Parses a Game configuration object.
*
* @method Phaser.Game#parseConfig
* @protected
*/
parseConfig: function (config) {
this.config = config;
if (config['enableDebug'] === undefined)
{
this.config.enableDebug = true;
}
if (config['width'])
{
this._width = config['width'];
}
if (config['height'])
{
this._height = config['height'];
}
if (config['renderer'])
{
this.renderType = config['renderer'];
}
if (config['parent'])
{
this.parent = config['parent'];
}
if (config['transparent'] !== undefined)
{
this.transparent = config['transparent'];
}
if (config['antialias'] !== undefined)
{
this.antialias = config['antialias'];
}
if (config['resolution'])
{
this.resolution = config['resolution'];
}
if (config['preserveDrawingBuffer'] !== undefined)
{
this.preserveDrawingBuffer = config['preserveDrawingBuffer'];
}
if (config['clearBeforeRender'] !== undefined)
{
this.clearBeforeRender = config['clearBeforeRender'];
}
if (config['physicsConfig'])
{
this.physicsConfig = config['physicsConfig'];
}
var seed = [(Date.now() * Math.random()).toString()];
if (config['seed'])
{
seed = config['seed'];
}
this.rnd = new Phaser.RandomDataGenerator(seed);
var state = null;
if (config['state'])
{
state = config['state'];
}
this.state = new Phaser.StateManager(this, state);
},
/**
* Initialize engine sub modules and start the game.
*
* @method Phaser.Game#boot
* @protected
*/
boot: function () {
if (this.isBooted)
{
return;
}
this.onPause = new Phaser.Signal();
this.onResume = new Phaser.Signal();
this.onBlur = new Phaser.Signal();
this.onFocus = new Phaser.Signal();
this.isBooted = true;
PIXI.game = this;
this.math = Phaser.Math;
this.scale = new Phaser.ScaleManager(this, this._width, this._height);
this.stage = new Phaser.Stage(this);
this.setUpRenderer();
this.world = new Phaser.World(this);
this.add = new Phaser.GameObjectFactory(this);
this.make = new Phaser.GameObjectCreator(this);
this.cache = new Phaser.Cache(this);
this.load = new Phaser.Loader(this);
this.time = new Phaser.Time(this);
this.tweens = new Phaser.TweenManager(this);
this.input = new Phaser.Input(this);
this.sound = new Phaser.SoundManager(this);
this.physics = new Phaser.Physics(this, this.physicsConfig);
this.particles = new Phaser.Particles(this);
this.create = new Phaser.Create(this);
this.plugins = new Phaser.PluginManager(this);
this.net = new Phaser.Net(this);
this.time.boot();
this.stage.boot();
this.world.boot();
this.scale.boot();
this.input.boot();
this.sound.boot();
this.state.boot();
if (this.config['enableDebug'])
{
this.debug = new Phaser.Utils.Debug(this);
this.debug.boot();
}
else
{
this.debug = { preUpdate: function () {}, update: function () {}, reset: function () {} };
}
this.showDebugHeader();
this.isRunning = true;
if (this.config && this.config['forceSetTimeOut'])
{
this.raf = new Phaser.RequestAnimationFrame(this, this.config['forceSetTimeOut']);
}
else
{
this.raf = new Phaser.RequestAnimationFrame(this, false);
}
this._kickstart = true;
if (window['focus'])
{
if (!window['PhaserGlobal'] || (window['PhaserGlobal'] && !window['PhaserGlobal'].stopFocus))
{
window.focus();
}
}
this.raf.start();
},
/**
* Displays a Phaser version debug header in the console.
*
* @method Phaser.Game#showDebugHeader
* @protected
*/
showDebugHeader: function () {
if (window['PhaserGlobal'] && window['PhaserGlobal'].hideBanner)
{
return;
}
var v = Phaser.VERSION;
var r = 'Canvas';
var a = 'HTML Audio';
var c = 1;
if (this.renderType === Phaser.WEBGL)
{
r = 'WebGL';
c++;
}
else if (this.renderType === Phaser.HEADLESS)
{
r = 'Headless';
}
if (this.device.webAudio)
{
a = 'WebAudio';
c++;
}
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #fb8cb3',
'background: #d44a52',
'color: #ffffff; background: #871905;',
'background: #d44a52',
'background: #fb8cb3',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
{
if (i < c)
{
args.push('color: #ff2424; background: #fff');
}
else
{
args.push('color: #959595; background: #fff');
}
}
console.log.apply(console, args);
}
else if (window['console'])
{
console.log('Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' | http://phaser.io');
}
},
/**
* Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
*
* @method Phaser.Game#setUpRenderer
* @protected
*/
setUpRenderer: function () {
if (this.config['canvas'])
{
this.canvas = this.config['canvas'];
}
else
{
this.canvas = Phaser.Canvas.create(this, this.width, this.height, this.config['canvasID'], true);
}
if (this.config['canvasStyle'])
{
this.canvas.style = this.config['canvasStyle'];
}
else
{
this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
}
if (this.renderType === Phaser.HEADLESS || this.renderType === Phaser.CANVAS || (this.renderType === Phaser.AUTO && !this.device.webGL))
{
if (this.device.canvas)
{
// They requested Canvas and their browser supports it
this.renderType = Phaser.CANVAS;
this.renderer = new PIXI.CanvasRenderer(this);
this.context = this.renderer.context;
}
else
{
throw new Error('Phaser.Game - Cannot create Canvas or WebGL context, aborting.');
}
}
else
{
// They requested WebGL and their browser supports it
this.renderType = Phaser.WEBGL;
this.renderer = new PIXI.WebGLRenderer(this);
this.context = null;
this.canvas.addEventListener('webglcontextlost', this.contextLost.bind(this), false);
this.canvas.addEventListener('webglcontextrestored', this.contextRestored.bind(this), false);
}
if (this.device.cocoonJS)
{
this.canvas.screencanvas = (this.renderType === Phaser.CANVAS) ? true : false;
}
if (this.renderType !== Phaser.HEADLESS)
{
this.stage.smoothed = this.antialias;
Phaser.Canvas.addToDOM(this.canvas, this.parent, false);
Phaser.Canvas.setTouchAction(this.canvas);
}
},
/**
* Handles WebGL context loss.
*
* @method Phaser.Game#contextLost
* @private
* @param {Event} event - The webglcontextlost event.
*/
contextLost: function (event) {
event.preventDefault();
this.renderer.contextLost = true;
},
/**
* Handles WebGL context restoration.
*
* @method Phaser.Game#contextRestored
* @private
*/
contextRestored: function () {
this.renderer.initContext();
this.cache.clearGLTextures();
this.renderer.contextLost = false;
},
/**
* The core game loop.
*
* @method Phaser.Game#update
* @protected
* @param {number} time - The current time as provided by RequestAnimationFrame.
*/
update: function (time) {
this.time.update(time);
if (this._kickstart)
{
this.updateLogic(this.time.desiredFpsMult);
// call the game render update exactly once every frame
this.updateRender(this.time.slowMotion * this.time.desiredFps);
this._kickstart = false;
return;
}
// if the logic time is spiraling upwards, skip a frame entirely
if (this._spiraling > 1 && !this.forceSingleUpdate)
{
// cause an event to warn the program that this CPU can't keep up with the current desiredFps rate
if (this.time.time > this._nextFpsNotification)
{
// only permit one fps notification per 10 seconds
this._nextFpsNotification = this.time.time + 10000;
// dispatch the notification signal
this.fpsProblemNotifier.dispatch();
}
// reset the _deltaTime accumulator which will cause all pending dropped frames to be permanently skipped
this._deltaTime = 0;
this._spiraling = 0;
// call the game render update exactly once every frame
this.updateRender(this.time.slowMotion * this.time.desiredFps);
}
else
{
// step size taking into account the slow motion speed
var slowStep = this.time.slowMotion * 1000.0 / this.time.desiredFps;
// accumulate time until the slowStep threshold is met or exceeded... up to a limit of 3 catch-up frames at slowStep intervals
this._deltaTime += Math.max(Math.min(slowStep * 3, this.time.elapsed), 0);
// call the game update logic multiple times if necessary to "catch up" with dropped frames
// unless forceSingleUpdate is true
var count = 0;
this.updatesThisFrame = Math.floor(this._deltaTime / slowStep);
if (this.forceSingleUpdate)
{
this.updatesThisFrame = Math.min(1, this.updatesThisFrame);
}
while (this._deltaTime >= slowStep)
{
this._deltaTime -= slowStep;
this.currentUpdateID = count;
this.updateLogic(this.time.desiredFpsMult);
count++;
if (this.forceSingleUpdate && count === 1)
{
break;
}
else
{
this.time.refresh();
}
}
// detect spiraling (if the catch-up loop isn't fast enough, the number of iterations will increase constantly)
if (count > this._lastCount)
{
this._spiraling++;
}
else if (count < this._lastCount)
{
// looks like it caught up successfully, reset the spiral alert counter
this._spiraling = 0;
}
this._lastCount = count;
// call the game render update exactly once every frame unless we're playing catch-up from a spiral condition
this.updateRender(this._deltaTime / slowStep);
}
},
/**
* Updates all logic subsystems in Phaser. Called automatically by Game.update.
*
* @method Phaser.Game#updateLogic
* @protected
* @param {number} timeStep - The current timeStep value as determined by Game.update.
*/
updateLogic: function (timeStep) {
if (!this._paused && !this.pendingStep)
{
if (this.stepping)
{
this.pendingStep = true;
}
this.scale.preUpdate();
this.debug.preUpdate();
this.camera.preUpdate();
this.physics.preUpdate();
this.state.preUpdate(timeStep);
this.plugins.preUpdate(timeStep);
this.stage.preUpdate();
this.state.update();
this.stage.update();
this.tweens.update();
this.sound.update();
this.input.update();
this.physics.update();
this.particles.update();
this.plugins.update();
this.stage.postUpdate();
this.plugins.postUpdate();
}
else
{
// Scaling and device orientation changes are still reflected when paused.
this.scale.pauseUpdate();
this.state.pauseUpdate();
this.debug.preUpdate();
}
this.stage.updateTransform();
},
/**
* Runs the Render cycle.
* It starts by calling State.preRender. In here you can do any last minute adjustments of display objects as required.
* It then calls the renderer, which renders the entire display list, starting from the Stage object and working down.
* It then calls plugin.render on any loaded plugins, in the order in which they were enabled.
* After this State.render is called. Any rendering that happens here will take place on-top of the display list.
* Finally plugin.postRender is called on any loaded plugins, in the order in which they were enabled.
* This method is called automatically by Game.update, you don't need to call it directly.
* Should you wish to have fine-grained control over when Phaser renders then use the `Game.lockRender` boolean.
* Phaser will only render when this boolean is `false`.
*
* @method Phaser.Game#updateRender
* @protected
* @param {number} elapsedTime - The time elapsed since the last update.
*/
updateRender: function (elapsedTime) {
if (this.lockRender)
{
return;
}
this.state.preRender(elapsedTime);
if (this.renderType !== Phaser.HEADLESS)
{
this.renderer.render(this.stage);
this.plugins.render(elapsedTime);
this.state.render(elapsedTime);
}
this.plugins.postRender(elapsedTime);
},
/**
* Enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?)
* Calling step will advance the game loop by one frame. This is extremely useful for hard to track down errors!
*
* @method Phaser.Game#enableStep
*/
enableStep: function () {
this.stepping = true;
this.pendingStep = false;
this.stepCount = 0;
},
/**
* Disables core game loop stepping.
*
* @method Phaser.Game#disableStep
*/
disableStep: function () {
this.stepping = false;
this.pendingStep = false;
},
/**
* When stepping is enabled you must call this function directly (perhaps via a DOM button?) to advance the game loop by one frame.
* This is extremely useful to hard to track down errors! Use the internal stepCount property to monitor progress.
*
* @method Phaser.Game#step
*/
step: function () {
this.pendingStep = false;
this.stepCount++;
},
/**
* Nukes the entire game from orbit.
*
* Calls destroy on Game.state, Game.sound, Game.scale, Game.stage, Game.input, Game.physics and Game.plugins.
*
* Then sets all of those local handlers to null, destroys the renderer, removes the canvas from the DOM
* and resets the PIXI default renderer.
*
* @method Phaser.Game#destroy
*/
destroy: function () {
this.raf.stop();
this.state.destroy();
this.sound.destroy();
this.scale.destroy();
this.stage.destroy();
this.input.destroy();
this.physics.destroy();
this.plugins.destroy();
this.state = null;
this.sound = null;
this.scale = null;
this.stage = null;
this.input = null;
this.physics = null;
this.plugins = null;
this.cache = null;
this.load = null;
this.time = null;
this.world = null;
this.isBooted = false;
this.renderer.destroy(false);
Phaser.Canvas.removeFromDOM(this.canvas);
PIXI.defaultRenderer = null;
Phaser.GAMES[this.id] = null;
},
/**
* Called by the Stage visibility handler.
*
* @method Phaser.Game#gamePaused
* @param {object} event - The DOM event that caused the game to pause, if any.
* @protected
*/
gamePaused: function (event) {
// If the game is already paused it was done via game code, so don't re-pause it
if (!this._paused)
{
this._paused = true;
this.time.gamePaused();
if (this.sound.muteOnPause)
{
this.sound.setMute();
}
this.onPause.dispatch(event);
// Avoids Cordova iOS crash event: https://github.com/photonstorm/phaser/issues/1800
if (this.device.cordova && this.device.iOS)
{
this.lockRender = true;
}
}
},
/**
* Called by the Stage visibility handler.
*
* @method Phaser.Game#gameResumed
* @param {object} event - The DOM event that caused the game to pause, if any.
* @protected
*/
gameResumed: function (event) {
// Game is paused, but wasn't paused via code, so resume it
if (this._paused && !this._codePaused)
{
this._paused = false;
this.time.gameResumed();
this.input.reset();
if (this.sound.muteOnPause)
{
this.sound.unsetMute();
}
this.onResume.dispatch(event);
// Avoids Cordova iOS crash event: https://github.com/photonstorm/phaser/issues/1800
if (this.device.cordova && this.device.iOS)
{
this.lockRender = false;
}
}
},
/**
* Called by the Stage visibility handler.
*
* @method Phaser.Game#focusLoss
* @param {object} event - The DOM event that caused the game to pause, if any.
* @protected
*/
focusLoss: function (event) {
this.onBlur.dispatch(event);
if (!this.stage.disableVisibilityChange)
{
this.gamePaused(event);
}
},
/**
* Called by the Stage visibility handler.
*
* @method Phaser.Game#focusGain
* @param {object} event - The DOM event that caused the game to pause, if any.
* @protected
*/
focusGain: function (event) {
this.onFocus.dispatch(event);
if (!this.stage.disableVisibilityChange)
{
this.gameResumed(event);
}
}
};
Phaser.Game.prototype.constructor = Phaser.Game;
/**
* The paused state of the Game. A paused game doesn't update any of its subsystems.
* When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched.
* @name Phaser.Game#paused
* @property {boolean} paused - Gets and sets the paused state of the Game.
*/
Object.defineProperty(Phaser.Game.prototype, "paused", {
get: function () {
return this._paused;
},
set: function (value) {
if (value === true)
{
if (this._paused === false)
{
this._paused = true;
this.sound.setMute();
this.time.gamePaused();
this.onPause.dispatch(this);
}
this._codePaused = true;
}
else
{
if (this._paused)
{
this._paused = false;
this.input.reset();
this.sound.unsetMute();
this.time.gameResumed();
this.onResume.dispatch(this);
}
this._codePaused = false;
}
}
});
/**
*
* "Deleted code is debugged code." - Jeff Sickel
*
* ヽ(〃^▽^〃)ノ
*
*/
| vpmedia/phaser2-lite | src/core/Game.js | JavaScript | mit | 31,942 | [
30522,
1013,
1008,
1008,
1008,
1030,
3166,
2957,
20436,
1026,
4138,
1030,
26383,
19718,
1012,
4012,
1028,
1008,
1030,
9385,
2355,
26383,
4040,
5183,
1012,
1008,
1030,
6105,
1063,
1030,
4957,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: "Pulse"
description: "Memory and lifetime analysis."
---
Memory and lifetime analysis.
Activate with `--pulse`.
Supported languages:
- C/C++/ObjC: Yes
- C#/.Net: No
- Erlang: Yes
- Java: Yes
### What is Infer:Pulse?
Pulse is an interprocedural memory safety analysis. Pulse can detect, for instance, [Null dereferences](/docs/next/all-issue-types#nullptr_dereference) in Java. Errors are only reported when all conditions on the erroneous path are true regardless of input. Pulse should gradually replace the original [biabduction](/docs/next/checker-biabduction) analysis of Infer. An example of a Null dereference found by Pulse is given below.
```java
class Person {
Person emergencyContact;
String address;
Person getEmergencyContact() {
return this.emergencyContact;
}
}
class Registry {
void create() {
Person p = new Person();
Person c = p.getEmergencyContact();
// Null dereference here
System.out.println(c.address);
}
void printContact(Person p) {
// No null dereference, as we don't know anything about `p`
System.out.println(p.getEmergencyContact().address);
}
}
```
How to run pulse for Java:
```bash
infer run --pulse -- javac Test.java
```
Pulse reports a Null dereference on this file on `create()`, as it tries to access the field `address` of object `c`, and `c` has value `null`. In contrast, Pulse gives no report for `printContact(Person p)`, as we cannot be sure that `p.getEmergencyContact()` will return `null`. Pulse then labels this error as latent and only reports if there is a call to `printContact(Person p)` satisfying the condition for Null dereference.
### Pulse x Nullsafe
[Nullsafe](/docs/next/checker-eradicate) is a type checker for `@Nullable` annotations for Java. Classes following the Nullsafe discipline are annotated with `@Nullsafe`.
Consider the classes `Person` and `Registry` from the previous example. Assuming that class `Person` is annotated with `@Nullsafe`. In this case, we also annotate `getEmergencyContact()` with `@Nullable`, to make explicit that this method can return the `null` value. There is still the risk that classes depending on `Person` have Null dereferences. In this case, Pulse would report a Null dereference on `Registry`. It could also be the case that class `Registry` is annotated with `@Nullsafe`. By default Pulse reports on `@Nullsafe` files too, see the `--pulse-nullsafe-report-npe` option (Facebook-specific: Pulse does not report on `@Nullsafe` files).
```java
@Nullsafe(Nullsafe.Mode.LOCAL)
class Person {
Person emergencyContact;
String address;
@Nullable Person getEmergencyContact() {
return this.emergencyContact;
}
}
class Registry {
... // Pulse reports here
}
```
## List of Issue Types
The following issue types are reported by this checker:
- [BAD_KEY](/docs/next/all-issue-types#bad_key)
- [BAD_MAP](/docs/next/all-issue-types#bad_map)
- [BAD_RECORD](/docs/next/all-issue-types#bad_record)
- [CONSTANT_ADDRESS_DEREFERENCE](/docs/next/all-issue-types#constant_address_dereference)
- [MEMORY_LEAK](/docs/next/all-issue-types#memory_leak)
- [NIL_BLOCK_CALL](/docs/next/all-issue-types#nil_block_call)
- [NIL_INSERTION_INTO_COLLECTION](/docs/next/all-issue-types#nil_insertion_into_collection)
- [NIL_MESSAGING_TO_NON_POD](/docs/next/all-issue-types#nil_messaging_to_non_pod)
- [NO_MATCHING_BRANCH_IN_TRY](/docs/next/all-issue-types#no_matching_branch_in_try)
- [NO_MATCHING_CASE_CLAUSE](/docs/next/all-issue-types#no_matching_case_clause)
- [NO_MATCHING_FUNCTION_CLAUSE](/docs/next/all-issue-types#no_matching_function_clause)
- [NO_MATCH_OF_RHS](/docs/next/all-issue-types#no_match_of_rhs)
- [NO_TRUE_BRANCH_IN_IF](/docs/next/all-issue-types#no_true_branch_in_if)
- [NULLPTR_DEREFERENCE](/docs/next/all-issue-types#nullptr_dereference)
- [OPTIONAL_EMPTY_ACCESS](/docs/next/all-issue-types#optional_empty_access)
- [PULSE_UNINITIALIZED_VALUE](/docs/next/all-issue-types#pulse_uninitialized_value)
- [STACK_VARIABLE_ADDRESS_ESCAPE](/docs/next/all-issue-types#stack_variable_address_escape)
- [USE_AFTER_DELETE](/docs/next/all-issue-types#use_after_delete)
- [USE_AFTER_FREE](/docs/next/all-issue-types#use_after_free)
- [USE_AFTER_LIFETIME](/docs/next/all-issue-types#use_after_lifetime)
- [VECTOR_INVALIDATION](/docs/next/all-issue-types#vector_invalidation)
| jvillard/infer | website/docs/checker-pulse.md | Markdown | mit | 4,396 | [
30522,
1011,
1011,
1011,
2516,
1024,
1000,
8187,
1000,
6412,
1024,
1000,
3638,
1998,
6480,
4106,
1012,
1000,
1011,
1011,
1011,
3638,
1998,
6480,
4106,
1012,
20544,
2007,
1036,
1011,
1011,
8187,
1036,
1012,
3569,
4155,
1024,
1011,
1039,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*****************************************************************************
* Copyright (C) jparsec.org *
* ------------------------------------------------------------------------- *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
*****************************************************************************/
package org.jparsec.examples.sql.parser;
import static org.jparsec.examples.sql.parser.TerminalParser.phrase;
import static org.jparsec.examples.sql.parser.TerminalParser.term;
import java.util.List;
import java.util.function.BinaryOperator;
import java.util.function.UnaryOperator;
import org.jparsec.OperatorTable;
import org.jparsec.Parser;
import org.jparsec.Parsers;
import org.jparsec.examples.sql.ast.BetweenExpression;
import org.jparsec.examples.sql.ast.BinaryExpression;
import org.jparsec.examples.sql.ast.BinaryRelationalExpression;
import org.jparsec.examples.sql.ast.Expression;
import org.jparsec.examples.sql.ast.FullCaseExpression;
import org.jparsec.examples.sql.ast.FunctionExpression;
import org.jparsec.examples.sql.ast.LikeExpression;
import org.jparsec.examples.sql.ast.NullExpression;
import org.jparsec.examples.sql.ast.NumberExpression;
import org.jparsec.examples.sql.ast.Op;
import org.jparsec.examples.sql.ast.QualifiedName;
import org.jparsec.examples.sql.ast.QualifiedNameExpression;
import org.jparsec.examples.sql.ast.Relation;
import org.jparsec.examples.sql.ast.SimpleCaseExpression;
import org.jparsec.examples.sql.ast.StringExpression;
import org.jparsec.examples.sql.ast.TupleExpression;
import org.jparsec.examples.sql.ast.UnaryExpression;
import org.jparsec.examples.sql.ast.UnaryRelationalExpression;
import org.jparsec.examples.sql.ast.WildcardExpression;
import org.jparsec.functors.Pair;
/**
* Parser for expressions.
*
* @author Ben Yu
*/
public final class ExpressionParser {
static final Parser<Expression> NULL = term("null").<Expression>retn(NullExpression.instance);
static final Parser<Expression> NUMBER = TerminalParser.NUMBER.map(NumberExpression::new);
static final Parser<Expression> QUALIFIED_NAME = TerminalParser.QUALIFIED_NAME
.map(QualifiedNameExpression::new);
static final Parser<Expression> QUALIFIED_WILDCARD = TerminalParser.QUALIFIED_NAME
.followedBy(phrase(". *"))
.map(WildcardExpression::new);
static final Parser<Expression> WILDCARD =
term("*").<Expression>retn(new WildcardExpression(QualifiedName.of()))
.or(QUALIFIED_WILDCARD);
static final Parser<Expression> STRING = TerminalParser.STRING.map(StringExpression::new);
static Parser<Expression> functionCall(Parser<Expression> param) {
return Parsers.sequence(
TerminalParser.QUALIFIED_NAME, paren(param.sepBy(TerminalParser.term(","))),
FunctionExpression::new);
}
static Parser<Expression> tuple(Parser<Expression> expr) {
return paren(expr.sepBy(term(","))).map(TupleExpression::new);
}
static Parser<Expression> simpleCase(Parser<Expression> expr) {
return Parsers.sequence(
term("case").next(expr),
whenThens(expr, expr),
term("else").next(expr).optional().followedBy(term("end")),
SimpleCaseExpression::new);
}
static Parser<Expression> fullCase(Parser<Expression> cond, Parser<Expression> expr) {
return Parsers.sequence(
term("case").next(whenThens(cond, expr)),
term("else").next(expr).optional().followedBy(term("end")),
FullCaseExpression::new);
}
private static Parser<List<Pair<Expression, Expression>>> whenThens(
Parser<Expression> cond, Parser<Expression> expr) {
return Parsers.pair(term("when").next(cond), term("then").next(expr)).many1();
}
static <T> Parser<T> paren(Parser<T> parser) {
return parser.between(term("("), term(")"));
}
static Parser<Expression> arithmetic(Parser<Expression> atom) {
Parser.Reference<Expression> reference = Parser.newReference();
Parser<Expression> operand =
Parsers.or(paren(reference.lazy()), functionCall(reference.lazy()), atom);
Parser<Expression> parser = new OperatorTable<Expression>()
.infixl(binary("+", Op.PLUS), 10)
.infixl(binary("-", Op.MINUS), 10)
.infixl(binary("*", Op.MUL), 20)
.infixl(binary("/", Op.DIV), 20)
.infixl(binary("%", Op.MOD), 20)
.prefix(unary("-", Op.NEG), 50)
.build(operand);
reference.set(parser);
return parser;
}
static Parser<Expression> expression(Parser<Expression> cond) {
Parser.Reference<Expression> reference = Parser.newReference();
Parser<Expression> lazyExpr = reference.lazy();
Parser<Expression> atom = Parsers.or(
NUMBER, WILDCARD, QUALIFIED_NAME, simpleCase(lazyExpr), fullCase(cond, lazyExpr));
Parser<Expression> expression = arithmetic(atom).label("expression");
reference.set(expression);
return expression;
}
/************************** boolean expressions ****************************/
static Parser<Expression> compare(Parser<Expression> expr) {
return Parsers.or(
compare(expr, ">", Op.GT), compare(expr, ">=", Op.GE),
compare(expr, "<", Op.LT), compare(expr, "<=", Op.LE),
compare(expr, "=", Op.EQ), compare(expr, "<>", Op.NE),
nullCheck(expr), like(expr), between(expr));
}
static Parser<Expression> like(Parser<Expression> expr) {
return Parsers.sequence(
expr, Parsers.or(term("like").retn(true), phrase("not like").retn(false)),
expr, term("escape").next(expr).optional(),
LikeExpression::new);
}
static Parser<Expression> nullCheck(Parser<Expression> expr) {
return Parsers.sequence(
expr, phrase("is not").retn(Op.NOT).or(phrase("is").retn(Op.IS)), NULL,
BinaryExpression::new);
}
static Parser<Expression> logical(Parser<Expression> expr) {
Parser.Reference<Expression> ref = Parser.newReference();
Parser<Expression> parser = new OperatorTable<Expression>()
.prefix(unary("not", Op.NOT), 30)
.infixl(binary("and", Op.AND), 20)
.infixl(binary("or", Op.OR), 10)
.build(paren(ref.lazy()).or(expr)).label("logical expression");
ref.set(parser);
return parser;
}
static Parser<Expression> between(Parser<Expression> expr) {
return Parsers.sequence(
expr, Parsers.or(term("between").retn(true), phrase("not between").retn(false)),
expr, term("and").next(expr),
BetweenExpression::new);
}
static Parser<Expression> exists(Parser<Relation> relation) {
return term("exists").next(relation).map(e -> new UnaryRelationalExpression(e, Op.EXISTS));
}
static Parser<Expression> notExists(Parser<Relation> relation) {
return phrase("not exists").next(relation)
.map(e -> new UnaryRelationalExpression(e, Op.NOT_EXISTS));
}
static Parser<Expression> inRelation(Parser<Expression> expr, Parser<Relation> relation) {
return Parsers.sequence(
expr, Parsers.between(phrase("in ("), relation, term(")")),
(e, r) -> new BinaryRelationalExpression(e, Op.IN, r));
}
static Parser<Expression> notInRelation(Parser<Expression> expr, Parser<Relation> relation) {
return Parsers.sequence(
expr, Parsers.between(phrase("not in ("), relation, term(")")),
(e, r) -> new BinaryRelationalExpression(e, Op.NOT_IN, r));
}
static Parser<Expression> in(Parser<Expression> expr) {
return Parsers.sequence(
expr, term("in").next(tuple(expr)),
(e, t) -> new BinaryExpression(e, Op.IN, t));
}
static Parser<Expression> notIn(Parser<Expression> expr) {
return Parsers.sequence(
expr, phrase("not in").next(tuple(expr)),
(e, t) -> new BinaryExpression(e, Op.NOT_IN, t));
}
static Parser<Expression> condition(Parser<Expression> expr, Parser<Relation> rel) {
Parser<Expression> atom = Parsers.or(
compare(expr), in(expr), notIn(expr),
exists(rel), notExists(rel), inRelation(expr, rel), notInRelation(expr, rel));
return logical(atom);
}
/************************** utility methods ****************************/
private static Parser<Expression> compare(
Parser<Expression> operand, String name, Op op) {
return Parsers.sequence(
operand, term(name).retn(op), operand,
BinaryExpression::new);
}
private static Parser<BinaryOperator<Expression>> binary(String name, Op op) {
return term(name).retn((l, r) -> new BinaryExpression(l, op, r));
}
private static Parser<UnaryOperator<Expression>> unary(String name, Op op) {
return term(name).retn(e -> new UnaryExpression(op, e));
}
}
| jparsec/jparsec | jparsec-examples/src/main/java/org/jparsec/examples/sql/parser/ExpressionParser.java | Java | apache-2.0 | 9,523 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef __SYS_DIRENT_H__
#define __SYS_DIRENT_H__
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#define DT_INVALID 0xff
#define DT_UNKNOWN 0
#define DT_FIFO DT_INVALID
#define DT_CHR DT_INVALID
#define DT_DIR 1
#define DT_BLK DT_INVALID
#define DT_REG 2
#define DT_LNK 3
#define DT_SOCK DT_INVALID
#define DT_WHT DT_INVALID
#define dirfd(dp) ((dp)->dd_fd)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _dirdesc
{
int32_t dd_fd;
int32_t dd_loc;
int32_t dd_size;
void *dd_buf;
size_t dd_len;
int32_t dd_seek;
int32_t dd_rewind;
int32_t dd_flags;
} DIR;
struct dirent
{
union {
ino_t d_ino;
ino_t d_fileno;
};
uint8_t d_type;
uint16_t d_seekoff;
uint16_t d_reclen;
uint16_t d_namlen;
char d_name[MAXPATHLEN + 1];
};
int closedir(DIR *dirp);
DIR *opendir(const char *dirname);
struct dirent *readdir(DIR *dirp);
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
void rewinddir(DIR *dirp);
void seekdir(DIR *dirp, long int loc);
long int telldir(DIR *dirp);
#ifdef __cplusplus
}
#endif
#endif //__DIRENT_H__
| ps3dev/newlib-1.19.0-PS3 | newlib/libc/sys/lv2/sys/dirent.h | C | gpl-2.0 | 1,144 | [
30522,
1001,
2065,
13629,
2546,
1035,
1035,
25353,
2015,
1035,
18704,
3372,
1035,
1044,
1035,
1035,
1001,
9375,
1035,
1035,
25353,
2015,
1035,
18704,
3372,
1035,
1044,
1035,
1035,
1001,
2421,
1026,
2358,
8718,
2102,
1012,
1044,
1028,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'spec_helper'
describe ApplicationHelper do
describe "full_title" do
it "should include the page title" do
full_title("foo").should =~ /foo/
end
it "should include the base title" do
full_title("foo").should =~ /^Ruby on Rails Tutorial Sample App/
end
it "should not include a bar for the home page" do
full_title("").should_not =~ /\|/
end
end
end
| niltonvasques/sample_app | spec/helpers/application_helper_spec.rb | Ruby | mit | 409 | [
30522,
5478,
1005,
28699,
1035,
2393,
2121,
1005,
6235,
4646,
16001,
4842,
2079,
6235,
1000,
2440,
1035,
2516,
1000,
2079,
2009,
1000,
2323,
2421,
1996,
3931,
2516,
1000,
2079,
2440,
1035,
2516,
1006,
1000,
29379,
1000,
1007,
1012,
2323,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.