answer stringlengths 15 1.25M |
|---|
#ifndef _COMPOSITEPROTO_H_
#define _COMPOSITEPROTO_H_
#include <nx-X11/Xmd.h>
#include <nx-X11/extensions/composite.h>
#define Window CARD32
#define Region CARD32
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} <API key>;
#define <API key> 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} <API key>;
#define <API key> 32
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} <API key>;
#define <API key> 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} <API key>;
#define <API key> 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} <API key>;
#define <API key> 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} <API key>;
#define <API key> 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Region region B32;
Window window B32;
} <API key>;
#define <API key> 12
/* Version 0.2 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window B32;
Pixmap pixmap B32;
} <API key>;
#define <API key> 12
#undef Window
#undef Region
#endif /* _COMPOSITEPROTO_H_ */ |
var i = 0;
var t = 0;
var nlclass = "druid";
var nlclassFolder = "druid";
nltree[i] = "Balance"; i++;
nltree[i] = "Feral Combat"; i++;
nltree[i] = "Restoration"; i++;
i = 0;
nltalent[i] = ["Starlight Wrath"]; i++;
nltalent[i] = ["Nature's Grasp"]; i++;
nltalent[i] = ["Improved Nature's Grasp"]; i++;
nltalent[i] = ["Control of Nature"]; i++;
nltalent[i] = ["Focused Starlight"]; i++;
nltalent[i] = ["Improved Moonfire"]; i++;
nltalent[i] = ["Brambles"]; i++;
nltalent[i] = ["Insect Swarm"]; i++;
nltalent[i] = ["Nature's Reach"]; i++;
nltalent[i] = ["Vengeance"]; i++;
nltalent[i] = ["Celestial Focus"]; i++;
nltalent[i] = ["Lunar Guidance"]; i++;
nltalent[i] = ["Nature's Grace"]; i++;
nltalent[i] = ["Moonglow"]; i++;
nltalent[i] = ["Moonfury"]; i++;
nltalent[i] = ["Balance of Power"]; i++;
nltalent[i] = ["Dreamstate"]; i++;
nltalent[i] = ["Moonkin Form"]; i++;
nltalent[i] = ["Improved Faerie Fire"]; i++;
nltalent[i] = ["Wrath of Cenarius"]; i++;
nltalent[i] = ["Force of Nature"]; i++;
treeStartStop[t] = i -1;
t++;
//feral talents
nltalent[i] = ["Ferocity"]; i++;
nltalent[i] = ["Feral Aggression"]; i++;
nltalent[i] = ["Feral Instinct"]; i++;
nltalent[i] = ["Brutal Impact"]; i++;
nltalent[i] = ["Thick Hide"]; i++;
nltalent[i] = ["Feral Swiftness"]; i++;
nltalent[i] = ["Feral Charge"]; i++;
nltalent[i] = ["Sharpened Claws"]; i++;
nltalent[i] = ["Shredding Attacks"]; i++;
nltalent[i] = ["Predatory Strikes"]; i++;
nltalent[i] = ["Primal Fury"]; i++;
nltalent[i] = ["Savage Fury"]; i++;
nltalent[i] = ["Faerie Fire (Feral)"]; i++;
nltalent[i] = ["Nurturing Instinct"]; i++;
nltalent[i] = ["Heart of the Wild"]; i++;
nltalent[i] = ["Survival of the Fittest"]; i++;
nltalent[i] = ["Primal Tenacity"]; i++;
nltalent[i] = ["Leader of the Pack"]; i++;
nltalent[i] = ["Improved Leader of the Pack"]; i++;
nltalent[i] = ["Predatory Instincts"]; i++;
nltalent[i] = ["Mangle"]; i++;
treeStartStop[t] = i -1;
t++;
//restoration talents
nltalent[i] = ["Improved Mark of the Wild"]; i++;
nltalent[i] = ["Furor"]; i++;
nltalent[i] = ["Naturalist"]; i++;
nltalent[i] = ["Nature's Focus"]; i++;
nltalent[i] = ["Natural Shapeshifter"]; i++;
nltalent[i] = ["Intensity"]; i++;
nltalent[i] = ["Subtlety"]; i++;
nltalent[i] = ["Omen of Clarity"]; i++;
nltalent[i] = ["Tranquil Spirit"]; i++;
nltalent[i] = ["Improved Rejuvenation"]; i++;
nltalent[i] = ["Nature's Swiftness"]; i++;
nltalent[i] = ["Gift of Nature"]; i++;
nltalent[i] = ["Improved Tranquility"]; i++;
nltalent[i] = ["Empowered Touch"]; i++;
nltalent[i] = ["Improved Regrowth"]; i++;
nltalent[i] = ["Living Spirit"]; i++;
nltalent[i] = ["Swiftmend"]; i++;
nltalent[i] = ["Natural Perfection"]; i++;
nltalent[i] = ["Empowered Rejuvenation"]; i++;
nltalent[i] = ["Tree of Life"]; i++;
treeStartStop[t] = i -1;
t++; |
/**
** Ucsym.h - Usecode compiler symbol table.
**
** Written: 1/2/01 - JSF
**/
#ifndef INCL_UCSYM
#define INCL_UCSYM
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string>
#include <map>
#include <vector>
#include <iostream>
using std::vector;
#include "opcodes.h"
class Uc_array_expression;
class Uc_expression;
class Uc_function;
class Usecode_symbol;
class Uc_class;
class Uc_struct_symbol;
class Uc_scope;
class Basic_block;
inline bool is_int_32bit(int val)
{
int high = val >> 16;
return !(high == -1 || high == 0);
}
inline bool is_sint_32bit(int val)
{
return (val < -32768 || val > 32767);
}
/*
* For comparing names:
*/
class String_compare
{
public:
bool operator()(char * const &x, char * const &y) const;
};
/*
* A formal parameter or local symbol within a function.
*/
class Uc_symbol
{
protected:
std::string name; // This will be the key.
public:
enum Sym_types
{
Generic = 0,
Constant,
String,
Variable,
//Struct,
Class, // Class *instances*.
Member_var, // Class member variable.
//Member_struct
};
friend class Uc_scope;
Uc_symbol(const char *nm) : name(nm)
{ }
virtual ~Uc_symbol()
{ }
const char *get_name() { return name.c_str(); }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
// Gen. to assign from stack.
virtual int gen_assign(Basic_block *out);
// Generate function/procedure call.
virtual int gen_call(Basic_block *out, Uc_function *fun, bool orig,
Uc_expression *item, Uc_array_expression *parms,
bool retvalue, Uc_class *scope_vtbl = 0);
virtual int get_string_offset() // Get offset in text_data.
{ return -1; }
// Return var/int expression.
virtual Uc_expression *create_expression();
virtual Uc_class *get_cls() const
{ return 0; }
virtual Uc_struct_symbol *get_struct() const
{ return 0; }
virtual bool is_static() const
{ return false; }
virtual int get_sym_type() const
{ return Generic; }
virtual Uc_symbol *get_sym()
{ return this; }
};
/*
* A variable (untyped) that can be assigned to.
*/
class Uc_var_symbol : public Uc_symbol
{
protected:
int offset; // Within function. Locals follow
// formal parameters.
int is_obj_fun;
public:
friend class Uc_scope;
Uc_var_symbol(const char *nm, int off, int obj = -1)
: Uc_symbol(nm), offset(off), is_obj_fun(obj)
{ }
int get_offset()
{ return offset; }
void set_offset(int off)
{ offset = off; }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
// Gen. to assign from stack.
virtual int gen_assign(Basic_block *out);
// Return var/int expression.
virtual Uc_expression *create_expression();
virtual int is_object_function(bool error = true) const;
virtual void set_is_obj_fun(int s)
{ is_obj_fun = s; }
virtual int get_sym_type() const
{ return Uc_symbol::Variable; }
};
/*
* A struct variable (weakly typed) that can be assigned to.
* Basically, a wrapper around an usecode array.
*/
class <API key> : public Uc_var_symbol
{
protected:
Uc_struct_symbol *type;
public:
friend class Uc_scope;
<API key>(const char *nm, Uc_struct_symbol *t, int off)
: Uc_var_symbol(nm, off), type(t)
{ }
/*
virtual int get_sym_type() const
{ return Uc_symbol::Struct; }
*/
virtual Uc_struct_symbol *get_struct() const
{ return type; }
};
/*
* A class instance, a typed variable which can be assigned to.
*/
class <API key> : public Uc_var_symbol
{
protected:
Uc_class *cls;
public:
<API key>(const char *nm, Uc_class *c, int off)
: Uc_var_symbol(nm, off), cls(c)
{ }
virtual Uc_expression *create_expression();
virtual Uc_class *get_cls() const
{ return cls; }
virtual int get_sym_type() const
{ return Uc_symbol::Class; }
};
/*
* A static (persistent) variable.
*/
class <API key> : public Uc_var_symbol
{
public:
<API key>(const char *nm, int off) : Uc_var_symbol(nm, off)
{ }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
// Gen. to assign from stack.
virtual int gen_assign(Basic_block *out);
virtual bool is_static() const
{ return true; }
};
/*
* A struct variable (weakly typed) that can be assigned to.
* Basically, a wrapper around an usecode array.
*/
class <API key> : public <API key>
{
protected:
Uc_struct_symbol *type;
public:
friend class Uc_scope;
<API key>(const char *nm, int off, Uc_struct_symbol *t)
: <API key>(nm, off), type(t)
{ }
/*
virtual int get_sym_type() const
{ return Uc_symbol::Struct; }
*/
virtual Uc_struct_symbol *get_struct() const
{ return type; }
};
/*
* A static (persistent) class.
*/
class <API key> : public <API key>
{
protected:
Uc_class *cls;
public:
<API key>(const char *nm, Uc_class *c, int off)
: <API key>(nm, off), cls(c)
{ }
virtual Uc_expression *create_expression();
virtual Uc_class *get_cls() const
{ return cls; }
virtual int get_sym_type() const
{ return Uc_symbol::Class; }
};
/*
* A symbol alias.
*/
class Uc_alias_symbol : public Uc_var_symbol
{
protected:
Uc_var_symbol *var;
public:
friend class Uc_scope;
Uc_alias_symbol(const char *nm, Uc_var_symbol* v)
: Uc_var_symbol(nm, v->get_offset()), var(v)
{ }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out)
{ return var->gen_value(out); }
// Gen. to assign from stack.
virtual int gen_assign(Basic_block *out)
{ return var->gen_assign(out); }
// Return var/int expression.
virtual bool is_static() const
{ return var->is_static(); }
virtual int is_object_function(bool error = true) const
{ return var->is_object_function(); }
virtual void set_is_obj_fun(int s)
{ var->set_is_obj_fun(s); }
virtual Uc_symbol *get_sym()
{ return var; }
virtual int get_sym_type() const
{ return Uc_symbol::Variable; }
virtual Uc_struct_symbol *get_struct() const
{ return 0; }
virtual Uc_class *get_cls() const
{ return 0; }
};
/*
* A symbol alias with a struct type.
*/
class <API key> : public Uc_alias_symbol
{
protected:
Uc_struct_symbol *type;
public:
friend class Uc_scope;
<API key>(const char *nm, Uc_var_symbol* v, Uc_struct_symbol *t)
: Uc_alias_symbol(nm, v), type(t)
{ }
/*
virtual int get_sym_type() const
{ return Uc_symbol::Struct; }
*/
virtual Uc_struct_symbol *get_struct() const
{ return type; }
};
/*
* A symbol alias with a struct type.
*/
class <API key> : public Uc_alias_symbol
{
protected:
Uc_class *cls;
public:
friend class Uc_scope;
<API key>(const char *nm, Uc_var_symbol* v, Uc_class *c)
: Uc_alias_symbol(nm, v), cls(c)
{ }
virtual int get_sym_type() const
{ return Uc_symbol::Class; }
virtual Uc_class *get_cls() const
{ return cls; }
virtual int is_object_function(bool error = true) const
{ return false; }
virtual void set_is_obj_fun(int s)
{ }
};
/*
* A class.
*/
class Uc_class_symbol : public Uc_symbol
{
Uc_class *cls;
public:
Uc_class_symbol(const char *nm, Uc_class *c) : Uc_symbol(nm), cls(c)
{ }
static Uc_class_symbol *create(char *nm, Uc_class *c);
Uc_class *get_cls() const
{ return cls; }
};
/*
* This represents a usecode struct (vaguely like in C++).
* Performs no checks whatsoever about the size of assigned
* usecode variable -- this is left to Exult.
*/
class Uc_struct_symbol : public Uc_symbol
{
typedef std::map<char *, int, String_compare> Var_map;
Var_map vars;
int num_vars; // # member variables.
public:
Uc_struct_symbol(const char *nm)
: Uc_symbol(nm), num_vars(0)
{ }
~Uc_struct_symbol();
int add(char *nm)
{
if (is_dup(nm))
return 0;
// Add struct variable.
vars[nm] = ++num_vars;
return num_vars;
}
void merge_struct(Uc_struct_symbol *other);
const char *get_name() const
{ return name.c_str(); }
int get_num_vars() const
{ return num_vars; }
int search(const char *nm)
{
char *nm1 = const_cast<char *>(nm);
Var_map::const_iterator it = vars.find(nm1);
if (it == vars.end())
return -1;
else
return (*it).second;
}
bool is_dup(char *nm); // Already declared?
};
/*
* A class member variable.
*/
class Uc_class_var_symbol : public Uc_var_symbol
{
public:
Uc_class_var_symbol(const char *nm, int off) : Uc_var_symbol(nm, off)
{ }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
// Gen. to assign from stack.
virtual int gen_assign(Basic_block *out);
virtual int get_sym_type() const
{ return Uc_symbol::Member_var; }
};
/*
* A class member struct variable.
*/
class <API key> : public Uc_class_var_symbol
{
protected:
Uc_struct_symbol *type;
public:
friend class Uc_scope;
<API key>(const char *nm, Uc_struct_symbol *t, int off)
: Uc_class_var_symbol(nm, off), type(t)
{ }
//virtual int get_sym_type() const
// { return Uc_symbol::Member_struct; }
virtual Uc_struct_symbol *get_struct() const
{ return type; }
};
/*
* A constant integer variable.
*/
class Uc_const_int_symbol : public Uc_symbol
{
int value;
int opcode;
public:
Uc_const_int_symbol(const char *nm, int v, int op = UC_PUSHI)
: Uc_symbol(nm), opcode(op)
{
if (opcode == UC_PUSHB)
value = (char)(v & 0xff);
else if (opcode == UC_PUSHI)
value = (short)(v & 0xffff);
else
value = (int)(v & 0xffffffff);
}
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
// Return var/int expression.
virtual Uc_expression *create_expression();
int get_value() const
{ return value; }
bool get_opcode() const
{ return opcode; }
virtual int get_sym_type() const
{ return Uc_symbol::Constant; }
};
/*
* A (constant) string. The offset is within the usecode function's
* text_data field.
*/
class Uc_string_symbol : public Uc_symbol
{
int offset; // In function's text_data.
public:
Uc_string_symbol(const char *nm, int off) : Uc_symbol(nm), offset(off)
{ }
// Gen. code to put result on stack.
virtual int gen_value(Basic_block *out);
virtual int get_string_offset() // Get offset in text_data.
{ return offset; }
// Return var/int expression.
virtual Uc_expression *create_expression();
virtual int get_sym_type() const
{ return Uc_symbol::String; }
};
/*
* An intrinsic symbol:
*/
class Uc_intrinsic_symbol : public Uc_symbol
{
int intrinsic_num; // Intrinsic
int num_parms; // # parms. +++++Not used/set yet.
public:
Uc_intrinsic_symbol(const char *nm, int n) : Uc_symbol(nm), intrinsic_num(n),
num_parms(0)
{ }
int get_intrinsic_num()
{ return intrinsic_num; }
int get_num_parms() // ++++Not valid yet.
{ return num_parms; }
// Generate function/procedure call.
virtual int gen_call(Basic_block *out, Uc_function *fun, bool orig,
Uc_expression *item, Uc_array_expression *parms,
bool retvalue, Uc_class *scope_vtbl = 0);
};
/*
* A function-prototype symbol:
*/
class Uc_function_symbol : public Uc_symbol
{
static int last_num; // Last 'usecode_num', so we can
// assign automatically.
static bool new_auto_num; // Prevents autoassigning of
// function numbers if function already
// has a number of its own.
public:
enum Function_kind
{
utility_fun,
shape_fun,
object_fun
};
enum Function_ret
{
no_ret = 0,
var_ret,
struct_ret,
class_ret
};
union Ret_symbol
{
Uc_struct_symbol *str;
Uc_class *cls;
};
// Keep track of #'s used.
typedef std::map<int, Uc_function_symbol *> Sym_nums;
private:
static Sym_nums nums_used;
// Note: offset = Usecode fun.
std::vector<Uc_var_symbol *> parms; // Parameters.
int usecode_num; // Usecode function
int method_num; // Index with class if a method.
int shape_num; // Shape # this function is for.
bool externed;
bool inherited;
Function_ret ret_type;
Ret_symbol ret_sym;
bool high_id;
Function_kind type;
public:
friend class Uc_scope;
Uc_function_symbol(const char *nm, int num,
std::vector<Uc_var_symbol *>& p,
int shp = 0, Function_kind kind = utility_fun);
static Uc_function_symbol *create(char *nm, int num,
std::vector<Uc_var_symbol *>& p, bool is_extern=false,
Uc_scope *scope = 0, Function_kind kind = utility_fun);
const std::vector<Uc_var_symbol *>& get_parms()
{ return parms; }
int get_usecode_num()
{ return usecode_num; }
const bool has_high_id()
{ return high_id; }
void set_method_num(int n)
{ method_num = n; }
int get_method_num()
{ return method_num; }
int get_shape_num()
{ return shape_num; }
int get_num_parms()
{ return parms.size(); }
void clear_externed()
{ externed = false; }
void set_externed()
{ externed = true; }
bool is_externed()
{ return externed; }
void set_inherited()
{ inherited = true; }
bool is_inherited()
{ return inherited; }
// Return var/int expression.
virtual Uc_expression *create_expression();
// Generate function/procedure call.
virtual int gen_call(Basic_block *out, Uc_function *fun, bool orig,
Uc_expression *item, Uc_array_expression *parms,
bool retvalue, Uc_class *scope_vtbl = 0);
static void set_last_num(int n)
{
last_num = n;
new_auto_num = true;
}
static Uc_function_symbol *search_num(int ucnum)
{
Sym_nums::const_iterator it = nums_used.find(ucnum);
if (it == nums_used.end()) // Unused? That's good.
return 0;
return (*it).second;
}
virtual bool has_ret() const
{ return ret_type != no_ret; }
virtual Function_ret get_ret_type() const
{ return ret_type; }
virtual void set_ret_type(bool var)
{ ret_type = var ? var_ret : no_ret; }
virtual void set_ret_type(Uc_class *c)
{
ret_type = class_ret;
ret_sym.cls = c;
}
virtual void set_ret_type(Uc_struct_symbol *s)
{
ret_type = struct_ret;
ret_sym.str = s;
}
virtual Uc_class *get_cls() const
{ return ret_type == class_ret ? ret_sym.cls : 0; }
virtual Uc_struct_symbol *get_struct() const
{ return ret_type == struct_ret ? ret_sym.str : 0; }
virtual Function_kind get_function_type() const
{ return type; }
};
/*
* A 'scope' in the symbol table:
*/
class Uc_scope
{
Uc_scope *parent; // ->parent.
// For finding syms. by name.
typedef std::map<char *, Uc_symbol *, String_compare> Sym_map;
Sym_map symbols;
std::vector<Uc_scope *> scopes; // Scopes within.
public:
Uc_scope(Uc_scope *p) : parent(p)
{ }
~Uc_scope();
Uc_scope *get_parent()
{ return parent; }
Uc_symbol *search(const char *nm) // Look in this scope.
{
char *nm1 = const_cast<char *>(nm);
Sym_map::const_iterator it = symbols.find(nm1);
if (it == symbols.end())
return 0;
else
return (*it).second;
}
// Search upwards through scopes.
Uc_symbol *search_up(const char *nm);
void add(Uc_symbol *sym) // Add (does NOT check for dups.)
{
const char *nm = sym->name.c_str();
char *nm1 = const_cast<char *>(nm); // ???Can't figure this out!
symbols[nm1] = sym;
}
Uc_scope *add_scope() // Create new scope.
{
Uc_scope *newscope = new Uc_scope(this);
scopes.push_back(newscope);
return newscope;
}
// Add a function decl.
int add_function_symbol(Uc_function_symbol *fun, Uc_scope *parent=0);
bool is_dup(char *nm); // Already declared?
};
/*
* Abstract top-level code (functions, classes).
*/
class Uc_design_unit
{
public:
virtual ~Uc_design_unit() { }
virtual void gen(std::ostream& out) = 0; // Generate Usecode.
virtual Usecode_symbol *create_sym() = 0;
virtual bool is_class() const
{ return false; }
};
#endif |
#include <scsi/iscsi_proto.h>
#include "be_main.h"
#include "be.h"
#include "be_mgmt.h"
int <API key>(struct beiscsi_hba *phba)
{
u32 sreset;
u8 *pci_reset_offset = 0;
u8 *pci_online0_offset = 0;
u8 *pci_online1_offset = 0;
u32 pconline0 = 0;
u32 pconline1 = 0;
u32 i;
pci_reset_offset = (u8 *)phba->pci_va + BE2_SOFT_RESET;
pci_online0_offset = (u8 *)phba->pci_va + BE2_PCI_ONLINE0;
pci_online1_offset = (u8 *)phba->pci_va + BE2_PCI_ONLINE1;
sreset = readl((void *)pci_reset_offset);
sreset |= BE2_SET_RESET;
writel(sreset, (void *)pci_reset_offset);
i = 0;
while (sreset & BE2_SET_RESET) {
if (i > 64)
break;
msleep(100);
sreset = readl((void *)pci_reset_offset);
i++;
}
if (sreset & BE2_SET_RESET) {
printk(KERN_ERR DRV_NAME
" Soft Reset did not deassert\n");
return -EIO;
}
pconline1 = BE2_MPU_IRAM_ONLINE;
writel(pconline0, (void *)pci_online0_offset);
writel(pconline1, (void *)pci_online1_offset);
sreset |= BE2_SET_RESET;
writel(sreset, (void *)pci_reset_offset);
i = 0;
while (sreset & BE2_SET_RESET) {
if (i > 64)
break;
msleep(1);
sreset = readl((void *)pci_reset_offset);
i++;
}
if (sreset & BE2_SET_RESET) {
printk(KERN_ERR DRV_NAME
" MPU Online Soft Reset did not deassert\n");
return -EIO;
}
return 0;
}
int <API key>(struct beiscsi_hba *phba)
{
unsigned int num_loop;
u8 *mpu_sem = 0;
u32 status;
num_loop = 1000;
mpu_sem = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE;
msleep(5000);
while (num_loop) {
status = readl((void *)mpu_sem);
if ((status & 0x80000000) || (status & 0x0000FFFF) == 0xC000)
break;
msleep(60);
num_loop
}
if ((status & 0x80000000) || (!num_loop)) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BC_%d : Failed in <API key>"
"status = 0x%x\n", status);
return -EIO;
}
return 0;
}
void be_mcc_notify(struct beiscsi_hba *phba)
{
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
u32 val = 0;
val |= mccq->id & <API key>;
val |= 1 << <API key>;
iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
}
unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
{
unsigned int tag = 0;
if (phba->ctrl.mcc_tag_available) {
tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
phba->ctrl.mcc_numtag[tag] = 0;
}
if (tag) {
phba->ctrl.mcc_tag_available
if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1))
phba->ctrl.mcc_alloc_index = 0;
else
phba->ctrl.mcc_alloc_index++;
}
return tag;
}
/*
* beiscsi_mccq_compl()- Wait for completion of MBX
* @phba: Driver private structure
* @tag: Tag for the MBX Command
* @wrb: the WRB used for the MBX Command
* @mbx_cmd_mem: ptr to memory allocated for MBX Cmd
*
* Waits for MBX completion with the passed TAG.
*
* return
* Success: 0
* Failure: Non-Zero
**/
int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint32_t tag, struct be_mcc_wrb **wrb,
struct be_dma_mem *mbx_cmd_mem)
{
int rc = 0;
uint32_t mcc_tag_response;
uint16_t status = 0, addl_status = 0, wrb_num = 0;
struct be_mcc_wrb *temp_wrb;
struct be_cmd_req_hdr *mbx_hdr;
struct be_cmd_resp_hdr *mbx_resp_hdr;
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
if (beiscsi_error(phba)) {
free_mcc_tag(&phba->ctrl, tag);
return -EPERM;
}
/* Set MBX Tag state to Active */
spin_lock(&phba->ctrl.mbox_lock);
phba->ctrl.ptag_state[tag].tag_state = <API key>;
spin_unlock(&phba->ctrl.mbox_lock);
/* wait for the mccq completion */
rc = <API key>(
phba->ctrl.mcc_wait[tag],
phba->ctrl.mcc_numtag[tag],
msecs_to_jiffies(
<API key>));
if (rc <= 0) {
struct be_dma_mem *tag_mem;
/* Set MBX Tag state to timeout */
spin_lock(&phba->ctrl.mbox_lock);
phba->ctrl.ptag_state[tag].tag_state = <API key>;
spin_unlock(&phba->ctrl.mbox_lock);
/* Store resource addr to be freed later */
tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;
if (mbx_cmd_mem) {
tag_mem->size = mbx_cmd_mem->size;
tag_mem->va = mbx_cmd_mem->va;
tag_mem->dma = mbx_cmd_mem->dma;
} else
tag_mem->size = 0;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
BEISCSI_LOG_CONFIG,
"BC_%d : MBX Cmd Completion timed out\n");
return -EBUSY;
} else {
rc = 0;
/* Set MBX Tag state to completed */
spin_lock(&phba->ctrl.mbox_lock);
phba->ctrl.ptag_state[tag].tag_state = <API key>;
spin_unlock(&phba->ctrl.mbox_lock);
}
mcc_tag_response = phba->ctrl.mcc_numtag[tag];
status = (mcc_tag_response & CQE_STATUS_MASK);
addl_status = ((mcc_tag_response & <API key>) >>
<API key>);
if (mbx_cmd_mem) {
mbx_hdr = (struct be_cmd_req_hdr *)mbx_cmd_mem->va;
} else {
wrb_num = (mcc_tag_response & CQE_STATUS_WRB_MASK) >>
<API key>;
temp_wrb = (struct be_mcc_wrb *)queue_get_wrb(mccq, wrb_num);
mbx_hdr = embedded_payload(temp_wrb);
if (wrb)
*wrb = temp_wrb;
}
if (status || addl_status) {
beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
BEISCSI_LOG_CONFIG,
"BC_%d : MBX Cmd Failed for "
"Subsys : %d Opcode : %d with "
"Status : %d and Extd_Status : %d\n",
mbx_hdr->subsystem,
mbx_hdr->opcode,
status, addl_status);
if (status == <API key>) {
mbx_resp_hdr = (struct be_cmd_resp_hdr *) mbx_hdr;
beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
BEISCSI_LOG_CONFIG,
"BC_%d : Insufficent Buffer Error "
"Resp_Len : %d Actual_Resp_Len : %d\n",
mbx_resp_hdr->response_length,
mbx_resp_hdr->actual_resp_len);
rc = -EAGAIN;
goto release_mcc_tag;
}
rc = -EIO;
}
release_mcc_tag:
/* Release the MCC entry */
free_mcc_tag(&phba->ctrl, tag);
return rc;
}
void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
{
spin_lock(&ctrl->mbox_lock);
tag = tag & 0x000000FF;
ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
ctrl->mcc_free_index = 0;
else
ctrl->mcc_free_index++;
ctrl->mcc_tag_available++;
spin_unlock(&ctrl->mbox_lock);
}
bool is_link_state_evt(u32 trailer)
{
return (((trailer >> <API key>) &
<API key>) ==
<API key>);
}
static bool is_iscsi_evt(u32 trailer)
{
return (((trailer >> <API key>) &
<API key>) ==
<API key>);
}
static int iscsi_evt_type(u32 trailer)
{
return ((trailer >> <API key>) &
<API key>);
}
static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
{
if (compl->flags != 0) {
compl->flags = le32_to_cpu(compl->flags);
WARN_ON((compl->flags & <API key>) == 0);
return true;
} else
return false;
}
static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
{
compl->flags = 0;
}
/*
* <API key>()- Check the MBX comapletion status
* @ctrl: Function specific MBX data structure
* @compl: Completion status of MBX Command
*
* Check for the MBX completion status when BMBX method used
*
* return
* Success: Zero
* Failure: Non-Zero
**/
static int <API key>(struct be_ctrl_info *ctrl,
struct be_mcc_compl *compl)
{
u16 compl_status, extd_status;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
struct be_cmd_req_hdr *hdr = embedded_payload(wrb);
struct be_cmd_resp_hdr *resp_hdr;
be_dws_le_to_cpu(compl, 4);
compl_status = (compl->status >> <API key>) &
<API key>;
if (compl_status != MCC_STATUS_SUCCESS) {
extd_status = (compl->status >> <API key>) &
<API key>;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : error in cmd completion: "
"Subsystem : %d Opcode : %d "
"status(compl/extd)=%d/%d\n",
hdr->subsystem, hdr->opcode,
compl_status, extd_status);
if (compl_status == <API key>) {
resp_hdr = (struct be_cmd_resp_hdr *) hdr;
if (resp_hdr->response_length)
return 0;
}
return -EBUSY;
}
return 0;
}
int <API key>(struct be_ctrl_info *ctrl,
struct be_mcc_compl *compl)
{
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
u16 compl_status, extd_status;
unsigned short tag;
be_dws_le_to_cpu(compl, 4);
compl_status = (compl->status >> <API key>) &
<API key>;
/* The ctrl.mcc_numtag[tag] is filled with
* [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
* [7:0] = compl_status
*/
tag = (compl->tag0 & 0x000000FF);
extd_status = (compl->status >> <API key>) &
<API key>;
ctrl->mcc_numtag[tag] = 0x80000000;
ctrl->mcc_numtag[tag] |= (compl->tag0 & 0x00FF0000);
ctrl->mcc_numtag[tag] |= (extd_status & 0x000000FF) << 8;
ctrl->mcc_numtag[tag] |= (compl_status & 0x000000FF);
if (ctrl->ptag_state[tag].tag_state == <API key>) {
<API key>(&ctrl->mcc_wait[tag]);
} else if (ctrl->ptag_state[tag].tag_state == <API key>) {
struct be_dma_mem *tag_mem;
tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_MBOX | BEISCSI_LOG_INIT |
BEISCSI_LOG_CONFIG,
"BC_%d : MBX Completion for timeout Command "
"from FW\n");
/* Check if memory needs to be freed */
if (tag_mem->size)
pci_free_consistent(ctrl->pdev, tag_mem->size,
tag_mem->va, tag_mem->dma);
/* Change tag state */
spin_lock(&phba->ctrl.mbox_lock);
ctrl->ptag_state[tag].tag_state = <API key>;
spin_unlock(&phba->ctrl.mbox_lock);
/* Free MCC Tag */
free_mcc_tag(ctrl, tag);
}
return 0;
}
static struct be_mcc_compl *be_mcc_compl_get(struct beiscsi_hba *phba)
{
struct be_queue_info *mcc_cq = &phba->ctrl.mcc_obj.cq;
struct be_mcc_compl *compl = queue_tail_node(mcc_cq);
if (be_mcc_compl_is_new(compl)) {
queue_tail_inc(mcc_cq);
return compl;
}
return NULL;
}
/**
* <API key>(): Closing session with appropriate error
* @cls_session: ptr to session
*
* Depending on adapter state appropriate error flag is passed.
**/
void <API key>(struct iscsi_cls_session *cls_session)
{
struct Scsi_Host *shost = <API key>(cls_session);
struct beiscsi_hba *phba = iscsi_host_priv(shost);
uint32_t iscsi_err_flag;
if (phba->state & <API key>)
iscsi_err_flag = <API key>;
else
iscsi_err_flag = <API key>;
<API key>(cls_session->dd_data, <API key>);
}
void <API key>(struct beiscsi_hba *phba,
struct <API key> *evt)
{
if ((evt->port_link_status == <API key>) ||
((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
(evt->port_fault != <API key>))) {
phba->state = <API key>;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
"BC_%d : Link Down on Port %d\n",
evt->physical_port);
<API key>(phba->shost,
<API key>);
} else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
(evt->port_fault == <API key>))) {
phba->state = BE_ADAPTER_LINK_UP | <API key>;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
"BC_%d : Link UP on Port %d\n",
evt->physical_port);
}
}
int beiscsi_process_mcc(struct beiscsi_hba *phba)
{
struct be_mcc_compl *compl;
int num = 0, status = 0;
struct be_ctrl_info *ctrl = &phba->ctrl;
spin_lock_bh(&phba->ctrl.mcc_cq_lock);
while ((compl = be_mcc_compl_get(phba))) {
if (compl->flags & <API key>) {
/* Interpret flags as an async trailer */
if (is_link_state_evt(compl->flags))
/* Interpret compl as a async link evt */
<API key>(phba,
(struct <API key> *) compl);
else if (is_iscsi_evt(compl->flags)) {
switch (iscsi_evt_type(compl->flags)) {
case <API key>:
case <API key>:
case <API key>:
phba->state |= <API key>;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG |
BEISCSI_LOG_MBOX,
"BC_%d : Async iscsi Event, flags "
"handled = 0x%08x\n",
compl->flags);
break;
default:
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG |
BEISCSI_LOG_MBOX,
"BC_%d : Unsupported Async iscsi "
"Event, flags = 0x%08x\n",
compl->flags);
}
} else
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG |
BEISCSI_LOG_MBOX,
"BC_%d : Unsupported Async Event, flags"
" = 0x%08x\n", compl->flags);
} else if (compl->flags & <API key>) {
status = <API key>(ctrl, compl);
atomic_dec(&phba->ctrl.mcc_obj.q.used);
}
be_mcc_compl_use(compl);
num++;
}
if (num)
hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1, 0);
spin_unlock_bh(&phba->ctrl.mcc_cq_lock);
return status;
}
/*
* be_mcc_wait_compl()- Wait for MBX completion
* @phba: driver private structure
*
* Wait till no more pending mcc requests are present
*
* return
* Success: 0
* Failure: Non-Zero
*
**/
static int be_mcc_wait_compl(struct beiscsi_hba *phba)
{
int i, status;
for (i = 0; i < mcc_timeout; i++) {
if (beiscsi_error(phba))
return -EIO;
status = beiscsi_process_mcc(phba);
if (status)
return status;
if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
break;
udelay(100);
}
if (i == mcc_timeout) {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : FW Timed Out\n");
phba->fw_timeout = true;
beiscsi_ue_detect(phba);
return -EBUSY;
}
return 0;
}
/*
* be_mcc_notify_wait()- Notify and wait for Compl
* @phba: driver private structure
*
* Notify MCC requests and wait for completion
*
* return
* Success: 0
* Failure: Non-Zero
**/
int be_mcc_notify_wait(struct beiscsi_hba *phba)
{
be_mcc_notify(phba);
return be_mcc_wait_compl(phba);
}
/*
* <API key>()- Check ready status
* @ctrl: Function specific MBX data structure
*
* Check for the ready status of FW to send BMBX
* commands to adapter.
*
* return
* Success: 0
* Failure: Non-Zero
**/
static int <API key>(struct be_ctrl_info *ctrl)
{
#define <API key> 4000 /* 4sec */
void __iomem *db = ctrl->db + <API key>;
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
unsigned long timeout;
bool read_flag = false;
int ret = 0, i;
u32 ready;
<API key>(rdybit_check_q);
if (beiscsi_error(phba))
return -EIO;
timeout = jiffies + (HZ * 110);
do {
for (i = 0; i < <API key>; i++) {
ready = ioread32(db) & <API key>;
if (ready) {
read_flag = true;
break;
}
mdelay(1);
}
if (!read_flag) {
wait_event_timeout(rdybit_check_q,
(read_flag != true),
HZ * 5);
}
} while ((time_before(jiffies, timeout)) && !read_flag);
if (!read_flag) {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : FW Timed Out\n");
phba->fw_timeout = true;
beiscsi_ue_detect(phba);
ret = -EBUSY;
}
return ret;
}
/*
* be_mbox_notify: Notify adapter of new BMBX command
* @ctrl: Function specific MBX data structure
*
* Ring doorbell to inform adapter of a BMBX command
* to process
*
* return
* Success: 0
* Failure: Non-Zero
**/
int be_mbox_notify(struct be_ctrl_info *ctrl)
{
int status;
u32 val = 0;
void __iomem *db = ctrl->db + <API key>;
struct be_dma_mem *mbox_mem = &ctrl->mbox_mem;
struct be_mcc_mailbox *mbox = mbox_mem->va;
struct be_mcc_compl *compl = &mbox->compl;
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
status = <API key>(ctrl);
if (status)
return status;
val &= ~<API key>;
val |= <API key>;
val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
iowrite32(val, db);
status = <API key>(ctrl);
if (status)
return status;
val = 0;
val &= ~<API key>;
val &= ~<API key>;
val |= (u32) (mbox_mem->dma >> 4) << 2;
iowrite32(val, db);
status = <API key>(ctrl);
if (status)
return status;
if (be_mcc_compl_is_new(compl)) {
status = <API key>(ctrl, &mbox->compl);
be_mcc_compl_use(compl);
if (status) {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : After <API key>\n");
return status;
}
} else {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : Invalid Mailbox Completion\n");
return -EBUSY;
}
return 0;
}
/*
* Insert the mailbox address into the doorbell in two steps
* Polls on the mbox doorbell till a command completion (or a timeout) occurs
*/
static int be_mbox_notify_wait(struct beiscsi_hba *phba)
{
int status;
u32 val = 0;
void __iomem *db = phba->ctrl.db + <API key>;
struct be_dma_mem *mbox_mem = &phba->ctrl.mbox_mem;
struct be_mcc_mailbox *mbox = mbox_mem->va;
struct be_mcc_compl *compl = &mbox->compl;
struct be_ctrl_info *ctrl = &phba->ctrl;
status = <API key>(ctrl);
if (status)
return status;
val |= <API key>;
/* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
iowrite32(val, db);
/* wait for ready to be set */
status = <API key>(ctrl);
if (status != 0)
return status;
val = 0;
/* at bits 2 - 31 place mbox dma addr lsb bits 4 - 33 */
val |= (u32)(mbox_mem->dma >> 4) << 2;
iowrite32(val, db);
status = <API key>(ctrl);
if (status != 0)
return status;
/* A cq entry has been made now */
if (be_mcc_compl_is_new(compl)) {
status = <API key>(ctrl, &mbox->compl);
be_mcc_compl_use(compl);
if (status)
return status;
} else {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
"BC_%d : invalid mailbox completion\n");
return -EBUSY;
}
return 0;
}
void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
bool embedded, u8 sge_cnt)
{
if (embedded)
wrb->embedded |= <API key>;
else
wrb->embedded |= (sge_cnt & <API key>) <<
<API key>;
wrb->payload_length = payload_len;
be_dws_cpu_to_le(wrb, 8);
}
void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
u8 subsystem, u8 opcode, int cmd_len)
{
req_hdr->opcode = opcode;
req_hdr->subsystem = subsystem;
req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr));
req_hdr->timeout = <API key>;
}
static void <API key>(struct phys_addr *pages, u32 max_pages,
struct be_dma_mem *mem)
{
int i, buf_pages;
u64 dma = (u64) mem->dma;
buf_pages = min(PAGES_4K_SPANNED(mem->va, mem->size), max_pages);
for (i = 0; i < buf_pages; i++) {
pages[i].lo = cpu_to_le32(dma & 0xFFFFFFFF);
pages[i].hi = cpu_to_le32(upper_32_bits(dma));
dma += PAGE_SIZE_4K;
}
}
static u32 eq_delay_to_mult(u32 usec_delay)
{
#define MAX_INTR_RATE 651042
const u32 round = 10;
u32 multiplier;
if (usec_delay == 0)
multiplier = 0;
else {
u32 interrupt_rate = 1000000 / usec_delay;
if (interrupt_rate == 0)
multiplier = 1023;
else {
multiplier = (MAX_INTR_RATE - interrupt_rate) * round;
multiplier /= interrupt_rate;
multiplier = (multiplier + round / 2) / round;
multiplier = min(multiplier, (u32) 1023);
}
}
return multiplier;
}
struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem)
{
return &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb;
}
struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
{
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
struct be_mcc_wrb *wrb;
WARN_ON(atomic_read(&mccq->used) >= mccq->len);
wrb = queue_head_node(mccq);
memset(wrb, 0, sizeof(*wrb));
wrb->tag0 = (mccq->head & 0x000000FF) << 16;
queue_head_inc(mccq);
atomic_inc(&mccq->used);
return wrb;
}
int <API key>(struct be_ctrl_info *ctrl,
struct be_queue_info *eq, int eq_delay)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
struct <API key> *resp = embedded_payload(wrb);
struct be_dma_mem *q_mem = &eq->dma_mem;
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>, sizeof(*req));
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
AMAP_SET_BITS(struct amap_eq_context, func, req->context,
PCI_FUNC(ctrl->pdev->devfn));
AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1);
AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0);
AMAP_SET_BITS(struct amap_eq_context, count, req->context,
__ilog2_u32(eq->len / 256));
AMAP_SET_BITS(struct amap_eq_context, delaymult, req->context,
eq_delay_to_mult(eq_delay));
be_dws_cpu_to_le(req->context, sizeof(req->context));
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify(ctrl);
if (!status) {
eq->id = le16_to_cpu(resp->eq_id);
eq->created = true;
}
spin_unlock(&ctrl->mbox_lock);
return status;
}
/**
* <API key>()- Initialize FW
* @ctrl: Pointer to function control structure
*
* Send FW initialize pattern for the function.
*
* return
* Success: 0
* Failure: Non-Zero value
**/
int <API key>(struct be_ctrl_info *ctrl)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
int status;
u8 *endian_check;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
endian_check = (u8 *) wrb;
*endian_check++ = 0xFF;
*endian_check++ = 0x12;
*endian_check++ = 0x34;
*endian_check++ = 0xFF;
*endian_check++ = 0xFF;
*endian_check++ = 0x56;
*endian_check++ = 0x78;
*endian_check++ = 0xFF;
be_dws_cpu_to_le(wrb, sizeof(*wrb));
status = be_mbox_notify(ctrl);
if (status)
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BC_%d : <API key> Failed\n");
spin_unlock(&ctrl->mbox_lock);
return status;
}
/**
* be_cmd_fw_uninit()- Uinitialize FW
* @ctrl: Pointer to function control structure
*
* Send FW uninitialize pattern for the function
*
* return
* Success: 0
* Failure: Non-Zero value
**/
int be_cmd_fw_uninit(struct be_ctrl_info *ctrl)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
int status;
u8 *endian_check;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
endian_check = (u8 *) wrb;
*endian_check++ = 0xFF;
*endian_check++ = 0xAA;
*endian_check++ = 0xBB;
*endian_check++ = 0xFF;
*endian_check++ = 0xFF;
*endian_check++ = 0xCC;
*endian_check++ = 0xDD;
*endian_check = 0xFF;
be_dws_cpu_to_le(wrb, sizeof(*wrb));
status = be_mbox_notify(ctrl);
if (status)
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BC_%d : be_cmd_fw_uninit Failed\n");
spin_unlock(&ctrl->mbox_lock);
return status;
}
int <API key>(struct be_ctrl_info *ctrl,
struct be_queue_info *cq, struct be_queue_info *eq,
bool sol_evts, bool no_delay, int coalesce_wm)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
struct <API key> *resp = embedded_payload(wrb);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
struct be_dma_mem *q_mem = &cq->dma_mem;
void *ctxt = &req->context;
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>, sizeof(*req));
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
if (is_chip_be2_be3r(phba)) {
AMAP_SET_BITS(struct amap_cq_context, coalescwm,
ctxt, coalesce_wm);
AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
AMAP_SET_BITS(struct amap_cq_context, count, ctxt,
__ilog2_u32(cq->len / 256));
AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts);
AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
PCI_FUNC(ctrl->pdev->devfn));
} else {
req->hdr.version = MBX_CMD_VER2;
req->page_size = 1;
AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
ctxt, coalesce_wm);
AMAP_SET_BITS(struct amap_cq_context_v2, nodelay,
ctxt, no_delay);
AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
__ilog2_u32(cq->len / 256));
AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
AMAP_SET_BITS(struct amap_cq_context_v2, armed, ctxt, 1);
}
be_dws_cpu_to_le(ctxt, sizeof(req->context));
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify(ctrl);
if (!status) {
cq->id = le16_to_cpu(resp->cq_id);
cq->created = true;
} else
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BC_%d : In be_cmd_cq_create, status=ox%08x\n",
status);
spin_unlock(&ctrl->mbox_lock);
return status;
}
static u32 be_encoded_q_len(int q_len)
{
u32 len_encoded = fls(q_len); /* log2(len) + 1 */
if (len_encoded == 16)
len_encoded = 0;
return len_encoded;
}
int <API key>(struct beiscsi_hba *phba,
struct be_queue_info *mccq,
struct be_queue_info *cq)
{
struct be_mcc_wrb *wrb;
struct <API key> *req;
struct be_dma_mem *q_mem = &mccq->dma_mem;
struct be_ctrl_info *ctrl;
void *ctxt;
int status;
spin_lock(&phba->ctrl.mbox_lock);
ctrl = &phba->ctrl;
wrb = wrb_from_mbox(&ctrl->mbox_mem);
memset(wrb, 0, sizeof(*wrb));
req = embedded_payload(wrb);
ctxt = &req->context;
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>, sizeof(*req));
req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt,
PCI_FUNC(phba->pcidev->devfn));
AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1);
AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt,
be_encoded_q_len(mccq->len));
AMAP_SET_BITS(struct amap_mcc_context, cq_id, ctxt, cq->id);
be_dws_cpu_to_le(ctxt, sizeof(req->context));
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify_wait(phba);
if (!status) {
struct <API key> *resp = embedded_payload(wrb);
mccq->id = le16_to_cpu(resp->id);
mccq->created = true;
}
spin_unlock(&phba->ctrl.mbox_lock);
return status;
}
int <API key>(struct be_ctrl_info *ctrl, struct be_queue_info *q,
int queue_type)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
u8 subsys = 0, opcode = 0;
int status;
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
"BC_%d : In <API key> "
"queue_type : %d\n", queue_type);
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
switch (queue_type) {
case QTYPE_EQ:
subsys = <API key>;
opcode = <API key>;
break;
case QTYPE_CQ:
subsys = <API key>;
opcode = <API key>;
break;
case QTYPE_MCCQ:
subsys = <API key>;
opcode = <API key>;
break;
case QTYPE_WRBQ:
subsys = CMD_SUBSYSTEM_ISCSI;
opcode = <API key>;
break;
case QTYPE_DPDUQ:
subsys = CMD_SUBSYSTEM_ISCSI;
opcode = <API key>;
break;
case QTYPE_SGL:
subsys = CMD_SUBSYSTEM_ISCSI;
opcode = <API key>;
break;
default:
spin_unlock(&ctrl->mbox_lock);
BUG();
return -ENXIO;
}
be_cmd_hdr_prepare(&req->hdr, subsys, opcode, sizeof(*req));
if (queue_type != QTYPE_SGL)
req->id = cpu_to_le16(q->id);
status = be_mbox_notify(ctrl);
spin_unlock(&ctrl->mbox_lock);
return status;
}
/**
* <API key>()- Create DEFQ for the adapter
* @ctrl: ptr to ctrl_info
* @cq: Completion Queue
* @dq: Default Queue
* @lenght: ring size
* @entry_size: size of each entry in DEFQ
* @is_header: Header or Data DEFQ
* @ulp_num: Bind to which ULP
*
* Create HDR/Data DEFQ for the passed ULP. Unsol PDU are posted
* on this queue by the FW
*
* return
* Success: 0
* Failure: Non-Zero Value
*
**/
int <API key>(struct be_ctrl_info *ctrl,
struct be_queue_info *cq,
struct be_queue_info *dq, int length,
int entry_size, uint8_t is_header,
uint8_t ulp_num)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct be_defq_create_req *req = embedded_payload(wrb);
struct be_dma_mem *q_mem = &dq->dma_mem;
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
void *ctxt = &req->context;
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
<API key>, sizeof(*req));
req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
if (phba->fw_config.dual_ulp_aware) {
req->ulp_num = ulp_num;
req->dua_feature |= (1 << <API key>);
req->dua_feature |= (1 << <API key>);
}
if (is_chip_be2_be3r(phba)) {
AMAP_SET_BITS(struct <API key>,
rx_pdid, ctxt, 0);
AMAP_SET_BITS(struct <API key>,
rx_pdid_valid, ctxt, 1);
AMAP_SET_BITS(struct <API key>,
pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn));
AMAP_SET_BITS(struct <API key>,
ring_size, ctxt,
be_encoded_q_len(length /
sizeof(struct phys_addr)));
AMAP_SET_BITS(struct <API key>,
default_buffer_size, ctxt, entry_size);
AMAP_SET_BITS(struct <API key>,
cq_id_recv, ctxt, cq->id);
} else {
AMAP_SET_BITS(struct <API key>,
rx_pdid, ctxt, 0);
AMAP_SET_BITS(struct <API key>,
rx_pdid_valid, ctxt, 1);
AMAP_SET_BITS(struct <API key>,
ring_size, ctxt,
be_encoded_q_len(length /
sizeof(struct phys_addr)));
AMAP_SET_BITS(struct <API key>,
default_buffer_size, ctxt, entry_size);
AMAP_SET_BITS(struct <API key>,
cq_id_recv, ctxt, cq->id);
}
be_dws_cpu_to_le(ctxt, sizeof(req->context));
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify(ctrl);
if (!status) {
struct be_ring *defq_ring;
struct be_defq_create_resp *resp = embedded_payload(wrb);
dq->id = le16_to_cpu(resp->id);
dq->created = true;
if (is_header)
defq_ring = &phba->phwi_ctrlr->default_pdu_hdr[ulp_num];
else
defq_ring = &phba->phwi_ctrlr->
default_pdu_data[ulp_num];
defq_ring->id = dq->id;
if (!phba->fw_config.dual_ulp_aware) {
defq_ring->ulp_num = BEISCSI_ULP0;
defq_ring->doorbell_offset = DB_RXULP0_OFFSET;
} else {
defq_ring->ulp_num = resp->ulp_num;
defq_ring->doorbell_offset = resp->doorbell_offset;
}
}
spin_unlock(&ctrl->mbox_lock);
return status;
}
/**
* be_cmd_wrbq_create()- Create WRBQ
* @ctrl: ptr to ctrl_info
* @q_mem: memory details for the queue
* @wrbq: queue info
* @pwrb_context: ptr to wrb_context
* @ulp_num: ULP on which the WRBQ is to be created
*
* Create WRBQ on the passed ULP_NUM.
*
**/
int be_cmd_wrbq_create(struct be_ctrl_info *ctrl,
struct be_dma_mem *q_mem,
struct be_queue_info *wrbq,
struct hwi_wrb_context *pwrb_context,
uint8_t ulp_num)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct be_wrbq_create_req *req = embedded_payload(wrb);
struct be_wrbq_create_resp *resp = embedded_payload(wrb);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
<API key>, sizeof(*req));
req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
if (phba->fw_config.dual_ulp_aware) {
req->ulp_num = ulp_num;
req->dua_feature |= (1 << <API key>);
req->dua_feature |= (1 << <API key>);
}
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify(ctrl);
if (!status) {
wrbq->id = le16_to_cpu(resp->cid);
wrbq->created = true;
pwrb_context->cid = wrbq->id;
if (!phba->fw_config.dual_ulp_aware) {
pwrb_context->doorbell_offset = DB_TXULP0_OFFSET;
pwrb_context->ulp_num = BEISCSI_ULP0;
} else {
pwrb_context->ulp_num = resp->ulp_num;
pwrb_context->doorbell_offset = resp->doorbell_offset;
}
}
spin_unlock(&ctrl->mbox_lock);
return status;
}
int <API key>(struct be_ctrl_info *ctrl,
struct be_dma_mem *q_mem)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>,
sizeof(*req));
req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
req->type = <API key>;
<API key>(req->pages, ARRAY_SIZE(req->pages), q_mem);
status = be_mbox_notify(ctrl);
spin_unlock(&ctrl->mbox_lock);
return status;
}
int <API key>(struct be_ctrl_info *ctrl)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
int status;
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>,
sizeof(*req));
req->type = <API key>;
status = be_mbox_notify(ctrl);
spin_unlock(&ctrl->mbox_lock);
return status;
}
int <API key>(struct be_ctrl_info *ctrl,
struct be_dma_mem *q_mem,
u32 page_offset, u32 num_pages)
{
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
int status;
unsigned int curr_pages;
u32 <API key> = 0;
u32 temp_num_pages = num_pages;
if (num_pages == 0xff)
num_pages = 1;
spin_lock(&ctrl->mbox_lock);
do {
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
<API key>,
sizeof(*req));
curr_pages = BE_NUMBER_OF_FIELD(struct <API key>,
pages);
req->num_pages = min(num_pages, curr_pages);
req->page_offset = page_offset;
<API key>(req->pages, req->num_pages, q_mem);
q_mem->dma = q_mem->dma + (req->num_pages * PAGE_SIZE);
<API key> += req->num_pages;
page_offset += req->num_pages;
num_pages -= req->num_pages;
if (temp_num_pages == 0xff)
req->num_pages = temp_num_pages;
status = be_mbox_notify(ctrl);
if (status) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BC_%d : FW CMD to map iscsi frags failed.\n");
goto error;
}
} while (num_pages > 0);
error:
spin_unlock(&ctrl->mbox_lock);
if (status != 0)
<API key>(ctrl, NULL, QTYPE_SGL);
return status;
}
int <API key>(struct beiscsi_hba *phba)
{
struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct <API key> *req = embedded_payload(wrb);
int status;
spin_lock(&ctrl->mbox_lock);
req = embedded_payload(wrb);
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, <API key>,
<API key>, sizeof(*req));
status = be_mbox_notify_wait(phba);
spin_unlock(&ctrl->mbox_lock);
return status;
}
/**
* be_cmd_set_vlan()- Configure VLAN paramters on the adapter
* @phba: device priv structure instance
* @vlan_tag: TAG to be set
*
* Set the VLAN_TAG for the adapter or Disable VLAN on adapter
*
* returns
* TAG for the MBX Cmd
* **/
int be_cmd_set_vlan(struct beiscsi_hba *phba,
uint16_t vlan_tag)
{
unsigned int tag = 0;
struct be_mcc_wrb *wrb;
struct be_cmd_set_vlan_req *req;
struct be_ctrl_info *ctrl = &phba->ctrl;
spin_lock(&ctrl->mbox_lock);
tag = alloc_mcc_tag(phba);
if (!tag) {
spin_unlock(&ctrl->mbox_lock);
return tag;
}
wrb = wrb_from_mccq(phba);
req = embedded_payload(wrb);
wrb->tag0 |= tag;
be_wrb_hdr_prepare(wrb, sizeof(*wrb), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
<API key>,
sizeof(*req));
req->interface_hndl = phba->interface_handle;
req->vlan_priority = vlan_tag;
be_mcc_notify(phba);
spin_unlock(&ctrl->mbox_lock);
return tag;
} |
#include <string>
#include <cstring>
#include <cstddef>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <random>
#include <stdexcept>
#include "rdmini/vandercorput.h"
#include "rdmini/ssa_direct.h"
#include "gtest/gtest.h"
//class ssa_distribution : public ::testing:Test {
//protected:
// virtual void SetUp () {
namespace KHineq {
// Compute theoretical bound on the discrepancy of the VdC sequence:
// see P.Kritzer, "A new upper bound on the star discrepancy of
// (0,1)-sequences", Electronic journal of combinatorial number theory 2005:
// Dstar(x1,...,xN) <= f_b * logN/N + c_b * 1/N
// This value is then used in Koksma-Hlawka inequality.
constexpr size_t base = 10;
constexpr double a_b = (base%2)?((base-1.)/4.):((base*base)/(4.*(base+1.)));
constexpr double f_b = a_b/std::log(base);
constexpr double c_b = (2.0>1.0+1.0/base+a_b)?(2.0):(1.0+1.0/base+a_b);
template <typename Fun>
void kh_test(const rdmini::ssa_direct<size_t,double>& ssa, const Fun& f, double V_f, double exact_mu, std::size_t n_events) {
rdmini::counting_generator Rlin;
rdmini::<API key><double> U_vdc(0.,1.);
double approx_mu =0.;
double err_bound_theory = 0.;
std::ostringstream os;
for (std::size_t N=1; N<=n_events; ++N) {
approx_mu = ( approx_mu*(N-1) + f(ssa.inverse_cdf(U_vdc(Rlin))) )/N;
err_bound_theory = V_f*(f_b*std::log(N)/N+c_b/N);
if (std::abs(approx_mu-exact_mu) > err_bound_theory) {
os << "After " << N << " iterations:"
<< " expected max error " << err_bound_theory
<< " but observed error " << std::abs(approx_mu-exact_mu) << "\n";
throw(std::runtime_error(os.str()));
}
}
}
}
TEST(SsaDistribution, MomentTest) {
// Random generator and distributions
std::minstd_rand R;
rdmini::counting_generator Rlin;
std::<API key><double> U(0.5,1);
rdmini::<API key><double> U_vdc(0.,1.);
// Populate vector of propensities and compute the sum
constexpr size_t n_proc = 20;
std::vector<double> prop(n_proc);
for (size_t i=0; i<n_proc; ++i)
prop[i] = i+1;//std::ldexp(U(R),-i);
std::shuffle(prop.begin(),prop.end(),R);
double total = std::accumulate(prop.begin(),prop.end(),0.0);
// Compute exact moments of the event indexes distribution
double exact_mu1 = 0.;
double exact_mu2 = 0.;
for (size_t j=0; j<n_proc; ++j) {
exact_mu1 += double(j) * prop[j] / total ;
exact_mu2 += double(j*j) * prop[j] / total ;
}
// Instantiate a ssa_direct object and add all propensities
rdmini::ssa_direct<size_t,double> ssa(prop.size());
for (size_t i=0; i<prop.size(); ++i) ssa.update(i,prop[i]);
// Generate several events and compute approximations of mu1 and mu2. Then,
// compute the error with respect to the exact value and check whether this
// error satisfies the theoretical error estimate by Koksma-Hlawka
// err_N <= V_fun * Dstar(x1,...,xN)
// where V_fun is the total variation of the integrand.
constexpr double V_f_mu1 = n_proc;
constexpr double V_f_mu2 = n_proc*n_proc;
constexpr size_t n_events = 1000*1000;
try {
KHineq::kh_test(ssa, [](size_t j){return j;}, V_f_mu1, exact_mu1, n_events);
KHineq::kh_test(ssa, [](size_t j){return j*j;}, V_f_mu2, exact_mu2, n_events);
}
catch (const std::runtime_error& err) {
FAIL() << err.what();
}
} |
#include "FlatPoint.hpp"
#include <algorithm>
#include <math.h>
fixed
FlatPoint::CrossProduct(const FlatPoint &p2) const
{
return x * p2.y - p2.x * y;
}
void
FlatPoint::MultiplyY(const fixed a)
{
y *= a;
}
void
FlatPoint::Subtract(const FlatPoint &p2)
{
x -= p2.x;
y -= p2.y;
}
void
FlatPoint::Add(const FlatPoint &p2)
{
x += p2.x;
y += p2.y;
}
void
FlatPoint::Rotate(const Angle angle)
{
const fixed _x = x;
const fixed _y = y;
const auto sc = angle.SinCos();
const fixed sa = sc.first, ca = sc.second;
x = _x * ca - _y * sa;
y = _x * sa + _y * ca;
}
fixed
FlatPoint::Distance(const FlatPoint &p) const
{
return MediumHypot(p.x - x, p.y - y);
}
fixed
FlatPoint::MagnitudeSquared() const {
return sqr(x)+sqr(y);
}
fixed
FlatPoint::Magnitude() const
{
return MediumHypot(x, y);
} |
#include <linux/file.h>
#include <linux/vmalloc.h>
#include <linux/pagemap.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/crypto.h>
#include <linux/fs_stack.h>
#include <linux/slab.h>
#include <linux/xattr.h>
#include <asm/unaligned.h>
#include "ecryptfs_kernel.h"
static struct dentry *lock_parent(struct dentry *dentry)
{
struct dentry *dir;
dir = dget_parent(dentry);
mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT);
return dir;
}
static void unlock_dir(struct dentry *dir)
{
mutex_unlock(&dir->d_inode->i_mutex);
dput(dir);
}
static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
{
if (<API key>(inode) == (struct inode *)lower_inode)
return 1;
return 0;
}
static int ecryptfs_inode_set(struct inode *inode, void *opaque)
{
struct inode *lower_inode = opaque;
<API key>(inode, lower_inode);
<API key>(inode, lower_inode);
/* i_size will be overwritten for encrypted regular files */
<API key>(inode, lower_inode);
inode->i_ino = lower_inode->i_ino;
inode->i_version++;
inode->i_mapping->a_ops = &ecryptfs_aops;
inode->i_mapping->backing_dev_info = inode->i_sb->s_bdi;
if (S_ISLNK(inode->i_mode))
inode->i_op = &<API key>;
else if (S_ISDIR(inode->i_mode))
inode->i_op = &ecryptfs_dir_iops;
else
inode->i_op = &ecryptfs_main_iops;
if (S_ISDIR(inode->i_mode))
inode->i_fop = &ecryptfs_dir_fops;
else if (special_file(inode->i_mode))
init_special_inode(inode, inode->i_mode, inode->i_rdev);
else
inode->i_fop = &ecryptfs_main_fops;
return 0;
}
static struct inode *<API key>(struct inode *lower_inode,
struct super_block *sb)
{
struct inode *inode;
if (lower_inode->i_sb != <API key>(sb))
return ERR_PTR(-EXDEV);
if (!igrab(lower_inode))
return ERR_PTR(-ESTALE);
inode = iget5_locked(sb, (unsigned long)lower_inode,
ecryptfs_inode_test, ecryptfs_inode_set,
lower_inode);
if (!inode) {
iput(lower_inode);
return ERR_PTR(-EACCES);
}
if (!(inode->i_state & I_NEW))
iput(lower_inode);
return inode;
}
struct inode *ecryptfs_get_inode(struct inode *lower_inode,
struct super_block *sb)
{
struct inode *inode = <API key>(lower_inode, sb);
if (!IS_ERR(inode) && (inode->i_state & I_NEW))
unlock_new_inode(inode);
return inode;
}
/**
* ecryptfs_interpose
* @lower_dentry: Existing dentry in the lower filesystem
* @dentry: ecryptfs' dentry
* @sb: ecryptfs's super_block
*
* Interposes upper and lower dentries.
*
* Returns zero on success; non-zero otherwise
*/
static int ecryptfs_interpose(struct dentry *lower_dentry,
struct dentry *dentry, struct super_block *sb)
{
struct inode *inode = ecryptfs_get_inode(lower_dentry->d_inode, sb);
if (IS_ERR(inode))
return PTR_ERR(inode);
d_instantiate(dentry, inode);
return 0;
}
static int ecryptfs_do_unlink(struct inode *dir, struct dentry *dentry,
struct inode *inode)
{
struct dentry *lower_dentry = <API key>(dentry);
struct inode *lower_dir_inode = <API key>(dir);
struct dentry *lower_dir_dentry;
int rc;
dget(lower_dentry);
lower_dir_dentry = lock_parent(lower_dentry);
rc = vfs_unlink(lower_dir_inode, lower_dentry, NULL);
if (rc) {
printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
goto out_unlock;
}
<API key>(dir, lower_dir_inode);
set_nlink(inode, <API key>(inode)->i_nlink);
inode->i_ctime = dir->i_ctime;
d_drop(dentry);
out_unlock:
unlock_dir(lower_dir_dentry);
dput(lower_dentry);
return rc;
}
/**
* ecryptfs_do_create
* @directory_inode: inode of the new file's dentry's parent in ecryptfs
* @ecryptfs_dentry: New file's dentry in ecryptfs
* @mode: The mode of the new file
* @nd: nameidata of ecryptfs' parent's dentry & vfsmount
*
* Creates the underlying file and the eCryptfs inode which will link to
* it. It will also update the eCryptfs directory inode to mimic the
* stat of the lower directory inode.
*
* Returns the new eCryptfs inode on success; an ERR_PTR on error condition
*/
static struct inode *
ecryptfs_do_create(struct inode *directory_inode,
struct dentry *ecryptfs_dentry, umode_t mode)
{
int rc;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
struct inode *inode;
lower_dentry = <API key>(ecryptfs_dentry);
lower_dir_dentry = lock_parent(lower_dentry);
if (IS_ERR(lower_dir_dentry)) {
ecryptfs_printk(KERN_ERR, "Error locking directory of "
"dentry\n");
inode = ERR_CAST(lower_dir_dentry);
goto out;
}
rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true);
if (rc) {
printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
"rc = [%d]\n", __func__, rc);
inode = ERR_PTR(rc);
goto out_lock;
}
inode = <API key>(lower_dentry->d_inode,
directory_inode->i_sb);
if (IS_ERR(inode)) {
vfs_unlink(lower_dir_dentry->d_inode, lower_dentry, NULL);
goto out_lock;
}
<API key>(directory_inode, lower_dir_dentry->d_inode);
<API key>(directory_inode, lower_dir_dentry->d_inode);
out_lock:
unlock_dir(lower_dir_dentry);
out:
return inode;
}
/**
* <API key>
*
* Cause the file to be changed from a basic empty file to an ecryptfs
* file with a header and first data page.
*
* Returns zero on success
*/
int <API key>(struct dentry *ecryptfs_dentry,
struct inode *ecryptfs_inode)
{
struct ecryptfs_crypt_stat *crypt_stat =
&<API key>(ecryptfs_inode)->crypt_stat;
int rc = 0;
if (S_ISDIR(ecryptfs_inode->i_mode)) {
ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
goto out;
}
ecryptfs_printk(KERN_DEBUG, "Initializing crypto context\n");
rc = <API key>(ecryptfs_inode);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error creating new file "
"context; rc = [%d]\n", rc);
goto out;
}
rc = <API key>(ecryptfs_dentry, ecryptfs_inode);
if (rc) {
printk(KERN_ERR "%s: Error attempting to initialize "
"the lower file for the dentry with name "
"[%s]; rc = [%d]\n", __func__,
ecryptfs_dentry->d_name.name, rc);
goto out;
}
rc = <API key>(ecryptfs_dentry, ecryptfs_inode);
if (rc)
printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc);
<API key>(ecryptfs_inode);
out:
return rc;
}
/**
* ecryptfs_create
* @dir: The inode of the directory in which to create the file.
* @dentry: The eCryptfs dentry
* @mode: The mode of the new file.
*
* Creates a new file.
*
* Returns zero on success; non-zero on error condition
*/
static int
ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
umode_t mode, bool excl)
{
struct inode *ecryptfs_inode;
int rc;
ecryptfs_inode = ecryptfs_do_create(directory_inode, ecryptfs_dentry,
mode);
if (unlikely(IS_ERR(ecryptfs_inode))) {
ecryptfs_printk(KERN_WARNING, "Failed to create file in"
"lower filesystem\n");
rc = PTR_ERR(ecryptfs_inode);
goto out;
}
/* At this point, a file exists on "disk"; we need to make sure
* that this on disk file is prepared to be an ecryptfs file */
rc = <API key>(ecryptfs_dentry, ecryptfs_inode);
if (rc) {
ecryptfs_do_unlink(directory_inode, ecryptfs_dentry,
ecryptfs_inode);
make_bad_inode(ecryptfs_inode);
unlock_new_inode(ecryptfs_inode);
iput(ecryptfs_inode);
goto out;
}
unlock_new_inode(ecryptfs_inode);
d_instantiate(ecryptfs_dentry, ecryptfs_inode);
out:
return rc;
}
static int <API key>(struct dentry *dentry, struct inode *inode)
{
struct ecryptfs_crypt_stat *crypt_stat;
int rc;
rc = <API key>(dentry, inode);
if (rc) {
printk(KERN_ERR "%s: Error attempting to initialize "
"the lower file for the dentry with name "
"[%s]; rc = [%d]\n", __func__,
dentry->d_name.name, rc);
return rc;
}
crypt_stat = &<API key>(inode)->crypt_stat;
/* TODO: lock for crypt_stat comparison */
if (!(crypt_stat->flags & <API key>))
<API key>(crypt_stat);
rc = <API key>(inode);
<API key>(inode);
if (rc) {
rc = <API key>(dentry, inode);
if (!rc)
crypt_stat->flags |= <API key>;
}
/* Must return 0 to allow non-eCryptfs files to be looked up, too */
return 0;
}
/**
* <API key> - Dentry interposition for a lookup
*/
static int <API key>(struct dentry *dentry,
struct dentry *lower_dentry,
struct inode *dir_inode)
{
struct inode *inode, *lower_inode = lower_dentry->d_inode;
struct <API key> *dentry_info;
struct vfsmount *lower_mnt;
int rc = 0;
dentry_info = kmem_cache_alloc(<API key>, GFP_KERNEL);
if (!dentry_info) {
printk(KERN_ERR "%s: Out of memory whilst attempting "
"to allocate <API key> struct\n",
__func__);
dput(lower_dentry);
return -ENOMEM;
}
lower_mnt = mntget(<API key>(dentry->d_parent));
<API key>(dir_inode, lower_dentry->d_parent->d_inode);
BUG_ON(!d_count(lower_dentry));
<API key>(dentry, dentry_info);
<API key>(dentry, lower_dentry);
<API key>(dentry, lower_mnt);
if (!lower_dentry->d_inode) {
/* We want to add because we couldn't find in lower */
d_add(dentry, NULL);
return 0;
}
inode = <API key>(lower_inode, dir_inode->i_sb);
if (IS_ERR(inode)) {
printk(KERN_ERR "%s: Error interposing; rc = [%ld]\n",
__func__, PTR_ERR(inode));
return PTR_ERR(inode);
}
if (S_ISREG(inode->i_mode)) {
rc = <API key>(dentry, inode);
if (rc) {
make_bad_inode(inode);
return rc;
}
}
if (inode->i_state & I_NEW)
unlock_new_inode(inode);
d_add(dentry, inode);
return rc;
}
/**
* ecryptfs_lookup
* @ecryptfs_dir_inode: The eCryptfs directory inode
* @ecryptfs_dentry: The eCryptfs dentry that we are looking up
* @ecryptfs_nd: nameidata; may be NULL
*
* Find a file on disk. If the file does not exist, then we'll add it to the
* dentry cache and continue on to read it from the disk.
*/
static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
struct dentry *ecryptfs_dentry,
unsigned int flags)
{
char *<API key> = NULL;
size_t <API key>;
struct <API key> *mount_crypt_stat = NULL;
struct dentry *lower_dir_dentry, *lower_dentry;
int rc = 0;
lower_dir_dentry = <API key>(ecryptfs_dentry->d_parent);
mutex_lock(&lower_dir_dentry->d_inode->i_mutex);
lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name,
lower_dir_dentry,
ecryptfs_dentry->d_name.len);
mutex_unlock(&lower_dir_dentry->d_inode->i_mutex);
if (IS_ERR(lower_dentry)) {
rc = PTR_ERR(lower_dentry);
ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
"[%d] on lower_dentry = [%s]\n", __func__, rc,
ecryptfs_dentry->d_name.name);
goto out;
}
if (lower_dentry->d_inode)
goto interpose;
mount_crypt_stat = &<API key>(
ecryptfs_dentry->d_sb)->mount_crypt_stat;
if (!(mount_crypt_stat
&& (mount_crypt_stat->flags & <API key>)))
goto interpose;
dput(lower_dentry);
rc = <API key>(
&<API key>, &<API key>,
NULL, mount_crypt_stat, ecryptfs_dentry->d_name.name,
ecryptfs_dentry->d_name.len);
if (rc) {
printk(KERN_ERR "%s: Error attempting to encrypt and encode "
"filename; rc = [%d]\n", __func__, rc);
goto out;
}
mutex_lock(&lower_dir_dentry->d_inode->i_mutex);
lower_dentry = lookup_one_len(<API key>,
lower_dir_dentry,
<API key>);
mutex_unlock(&lower_dir_dentry->d_inode->i_mutex);
if (IS_ERR(lower_dentry)) {
rc = PTR_ERR(lower_dentry);
ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
"[%d] on lower_dentry = [%s]\n", __func__, rc,
<API key>);
goto out;
}
interpose:
rc = <API key>(ecryptfs_dentry, lower_dentry,
ecryptfs_dir_inode);
out:
kfree(<API key>);
return ERR_PTR(rc);
}
static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir,
struct dentry *new_dentry)
{
struct dentry *lower_old_dentry;
struct dentry *lower_new_dentry;
struct dentry *lower_dir_dentry;
u64 file_size_save;
int rc;
file_size_save = i_size_read(old_dentry->d_inode);
lower_old_dentry = <API key>(old_dentry);
lower_new_dentry = <API key>(new_dentry);
dget(lower_old_dentry);
dget(lower_new_dentry);
lower_dir_dentry = lock_parent(lower_new_dentry);
rc = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
lower_new_dentry, NULL);
if (rc || !lower_new_dentry->d_inode)
goto out_lock;
rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb);
if (rc)
goto out_lock;
<API key>(dir, lower_dir_dentry->d_inode);
<API key>(dir, lower_dir_dentry->d_inode);
set_nlink(old_dentry->d_inode,
<API key>(old_dentry->d_inode)->i_nlink);
i_size_write(new_dentry->d_inode, file_size_save);
out_lock:
unlock_dir(lower_dir_dentry);
dput(lower_new_dentry);
dput(lower_old_dentry);
return rc;
}
static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
{
return ecryptfs_do_unlink(dir, dentry, dentry->d_inode);
}
static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
const char *symname)
{
int rc;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
char *encoded_symname;
size_t encoded_symlen;
struct <API key> *mount_crypt_stat = NULL;
lower_dentry = <API key>(dentry);
dget(lower_dentry);
lower_dir_dentry = lock_parent(lower_dentry);
mount_crypt_stat = &<API key>(
dir->i_sb)->mount_crypt_stat;
rc = <API key>(&encoded_symname,
&encoded_symlen,
NULL,
mount_crypt_stat, symname,
strlen(symname));
if (rc)
goto out_lock;
rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
encoded_symname);
kfree(encoded_symname);
if (rc || !lower_dentry->d_inode)
goto out_lock;
rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
if (rc)
goto out_lock;
<API key>(dir, lower_dir_dentry->d_inode);
<API key>(dir, lower_dir_dentry->d_inode);
out_lock:
unlock_dir(lower_dir_dentry);
dput(lower_dentry);
if (!dentry->d_inode)
d_drop(dentry);
return rc;
}
static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
int rc;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
lower_dentry = <API key>(dentry);
lower_dir_dentry = lock_parent(lower_dentry);
rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode);
if (rc || !lower_dentry->d_inode)
goto out;
rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
if (rc)
goto out;
<API key>(dir, lower_dir_dentry->d_inode);
<API key>(dir, lower_dir_dentry->d_inode);
set_nlink(dir, lower_dir_dentry->d_inode->i_nlink);
out:
unlock_dir(lower_dir_dentry);
if (!dentry->d_inode)
d_drop(dentry);
return rc;
}
static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
{
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
int rc;
lower_dentry = <API key>(dentry);
dget(dentry);
lower_dir_dentry = lock_parent(lower_dentry);
dget(lower_dentry);
rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);
if (!rc && dentry->d_inode)
clear_nlink(dentry->d_inode);
<API key>(dir, lower_dir_dentry->d_inode);
set_nlink(dir, lower_dir_dentry->d_inode->i_nlink);
unlock_dir(lower_dir_dentry);
if (!rc)
d_drop(dentry);
dput(dentry);
return rc;
}
static int
ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
{
int rc;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
lower_dentry = <API key>(dentry);
lower_dir_dentry = lock_parent(lower_dentry);
rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev);
if (rc || !lower_dentry->d_inode)
goto out;
rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb);
if (rc)
goto out;
<API key>(dir, lower_dir_dentry->d_inode);
<API key>(dir, lower_dir_dentry->d_inode);
out:
unlock_dir(lower_dir_dentry);
if (!dentry->d_inode)
d_drop(dentry);
return rc;
}
static int
ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
int rc;
struct dentry *lower_old_dentry;
struct dentry *lower_new_dentry;
struct dentry *<API key>;
struct dentry *<API key>;
struct dentry *trap = NULL;
struct inode *target_inode;
lower_old_dentry = <API key>(old_dentry);
lower_new_dentry = <API key>(new_dentry);
dget(lower_old_dentry);
dget(lower_new_dentry);
<API key> = dget_parent(lower_old_dentry);
<API key> = dget_parent(lower_new_dentry);
target_inode = new_dentry->d_inode;
trap = lock_rename(<API key>, <API key>);
/* source should not be ancestor of target */
if (trap == lower_old_dentry) {
rc = -EINVAL;
goto out_lock;
}
/* target should not be ancestor of source */
if (trap == lower_new_dentry) {
rc = -ENOTEMPTY;
goto out_lock;
}
rc = vfs_rename(<API key>->d_inode, lower_old_dentry,
<API key>->d_inode, lower_new_dentry,
NULL, 0);
if (rc)
goto out_lock;
if (target_inode)
<API key>(target_inode,
<API key>(target_inode));
<API key>(new_dir, <API key>->d_inode);
if (new_dir != old_dir)
<API key>(old_dir, <API key>->d_inode);
out_lock:
unlock_rename(<API key>, <API key>);
dput(<API key>);
dput(<API key>);
dput(lower_new_dentry);
dput(lower_old_dentry);
return rc;
}
static int <API key>(struct dentry *dentry, char **buf,
size_t *bufsiz)
{
struct dentry *lower_dentry = <API key>(dentry);
char *lower_buf;
mm_segment_t old_fs;
int rc;
lower_buf = kmalloc(PATH_MAX, GFP_KERNEL);
if (!lower_buf) {
rc = -ENOMEM;
goto out;
}
old_fs = get_fs();
set_fs(get_ds());
rc = lower_dentry->d_inode->i_op->readlink(lower_dentry,
(char __user *)lower_buf,
PATH_MAX);
set_fs(old_fs);
if (rc < 0)
goto out;
rc = <API key>(buf, bufsiz, dentry,
lower_buf, rc);
out:
kfree(lower_buf);
return rc;
}
static void *<API key>(struct dentry *dentry, struct nameidata *nd)
{
char *buf;
size_t len = PATH_MAX;
int rc;
rc = <API key>(dentry, &buf, &len);
if (rc)
goto out;
<API key>(dentry->d_inode,
<API key>(dentry)->d_inode);
buf[len] = '\0';
out:
nd_set_link(nd, buf);
return NULL;
}
/**
* <API key>
* @crypt_stat: Crypt_stat associated with file
* @upper_size: Size of the upper file
*
* Calculate the required size of the lower file based on the
* specified size of the upper file. This calculation is based on the
* number of headers in the underlying file and the extent size.
*
* Returns Calculated size of the lower file.
*/
static loff_t
<API key>(struct ecryptfs_crypt_stat *crypt_stat,
loff_t upper_size)
{
loff_t lower_size;
lower_size = <API key>(crypt_stat);
if (upper_size != 0) {
loff_t num_extents;
num_extents = upper_size >> crypt_stat->extent_shift;
if (upper_size & ~crypt_stat->extent_mask)
num_extents++;
lower_size += (num_extents * crypt_stat->extent_size);
}
return lower_size;
}
/**
* truncate_upper
* @dentry: The ecryptfs layer dentry
* @ia: Address of the ecryptfs inode's attributes
* @lower_ia: Address of the lower inode's attributes
*
* Function to handle truncations modifying the size of the file. Note
* that the file sizes are interpolated. When expanding, we are simply
* writing strings of 0's out. When truncating, we truncate the upper
* inode and update the lower_ia according to the page index
* interpolations. If ATTR_SIZE is set in lower_ia->ia_valid upon return,
* the caller must use lower_ia in a call to notify_change() to perform
* the truncation of the lower inode.
*
* Returns zero on success; non-zero otherwise
*/
static int truncate_upper(struct dentry *dentry, struct iattr *ia,
struct iattr *lower_ia)
{
int rc = 0;
struct inode *inode = dentry->d_inode;
struct ecryptfs_crypt_stat *crypt_stat;
loff_t i_size = i_size_read(inode);
loff_t <API key>;
loff_t <API key>;
if (unlikely((ia->ia_size == i_size))) {
lower_ia->ia_valid &= ~ATTR_SIZE;
return 0;
}
rc = <API key>(dentry, inode);
if (rc)
return rc;
crypt_stat = &<API key>(dentry->d_inode)->crypt_stat;
/* Switch on growing or shrinking file */
if (ia->ia_size > i_size) {
char zero[] = { 0x00 };
lower_ia->ia_valid &= ~ATTR_SIZE;
/* Write a single 0 at the last position of the file;
* this triggers code that will fill in 0's throughout
* the intermediate portion of the previous end of the
* file and the new and of the file */
rc = ecryptfs_write(inode, zero,
(ia->ia_size - 1), 1);
} else { /* ia->ia_size < i_size_read(inode) */
/* We're chopping off all the pages down to the page
* in which ia->ia_size is located. Fill in the end of
* that page from (ia->ia_size & ~PAGE_CACHE_MASK) to
* PAGE_CACHE_SIZE with zeros. */
size_t num_zeros = (PAGE_CACHE_SIZE
- (ia->ia_size & ~PAGE_CACHE_MASK));
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
truncate_setsize(inode, ia->ia_size);
lower_ia->ia_size = ia->ia_size;
lower_ia->ia_valid |= ATTR_SIZE;
goto out;
}
if (num_zeros) {
char *zeros_virt;
zeros_virt = kzalloc(num_zeros, GFP_KERNEL);
if (!zeros_virt) {
rc = -ENOMEM;
goto out;
}
rc = ecryptfs_write(inode, zeros_virt,
ia->ia_size, num_zeros);
kfree(zeros_virt);
if (rc) {
printk(KERN_ERR "Error attempting to zero out "
"the remainder of the end page on "
"reducing truncate; rc = [%d]\n", rc);
goto out;
}
}
truncate_setsize(inode, ia->ia_size);
rc = <API key>(inode);
if (rc) {
printk(KERN_ERR "Problem with "
"<API key>; "
"rc = [%d]\n", rc);
goto out;
}
/* We are reducing the size of the ecryptfs file, and need to
* know if we need to reduce the size of the lower file. */
<API key> =
<API key>(crypt_stat, i_size);
<API key> =
<API key>(crypt_stat, ia->ia_size);
if (<API key> < <API key>) {
lower_ia->ia_size = <API key>;
lower_ia->ia_valid |= ATTR_SIZE;
} else
lower_ia->ia_valid &= ~ATTR_SIZE;
}
out:
<API key>(inode);
return rc;
}
static int <API key>(struct inode *inode, loff_t offset)
{
struct ecryptfs_crypt_stat *crypt_stat;
loff_t lower_oldsize, lower_newsize;
crypt_stat = &<API key>(inode)->crypt_stat;
lower_oldsize = <API key>(crypt_stat,
i_size_read(inode));
lower_newsize = <API key>(crypt_stat, offset);
if (lower_newsize > lower_oldsize) {
/*
* The eCryptfs inode and the new *lower* size are mixed here
* because we may not have the lower i_mutex held and/or it may
* not be appropriate to call inode_newsize_ok() with inodes
* from other filesystems.
*/
return inode_newsize_ok(inode, lower_newsize);
}
return 0;
}
/**
* ecryptfs_truncate
* @dentry: The ecryptfs layer dentry
* @new_length: The length to expand the file to
*
* Simple function that handles the truncation of an eCryptfs inode and
* its corresponding lower inode.
*
* Returns zero on success; non-zero otherwise
*/
int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
{
struct iattr ia = { .ia_valid = ATTR_SIZE, .ia_size = new_length };
struct iattr lower_ia = { .ia_valid = 0 };
int rc;
rc = <API key>(dentry->d_inode, new_length);
if (rc)
return rc;
rc = truncate_upper(dentry, &ia, &lower_ia);
if (!rc && lower_ia.ia_valid & ATTR_SIZE) {
struct dentry *lower_dentry = <API key>(dentry);
mutex_lock(&lower_dentry->d_inode->i_mutex);
rc = notify_change(lower_dentry, &lower_ia, NULL);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
}
return rc;
}
static int
ecryptfs_permission(struct inode *inode, int mask)
{
return inode_permission(<API key>(inode), mask);
}
/**
* ecryptfs_setattr
* @dentry: dentry handle to the inode to modify
* @ia: Structure with flags of what to change and values
*
* Updates the metadata of an inode. If the update is to the size
* i.e. truncation, then ecryptfs_truncate will handle the size modification
* of both the ecryptfs inode and the lower inode.
*
* All other metadata changes will be passed right to the lower filesystem,
* and we will just update our inode to look like the lower.
*/
static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
{
int rc = 0;
struct dentry *lower_dentry;
struct iattr lower_ia;
struct inode *inode;
struct inode *lower_inode;
struct ecryptfs_crypt_stat *crypt_stat;
crypt_stat = &<API key>(dentry->d_inode)->crypt_stat;
if (!(crypt_stat->flags & <API key>))
<API key>(crypt_stat);
inode = dentry->d_inode;
lower_inode = <API key>(inode);
lower_dentry = <API key>(dentry);
mutex_lock(&crypt_stat->cs_mutex);
if (S_ISDIR(dentry->d_inode->i_mode))
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
else if (S_ISREG(dentry->d_inode->i_mode)
&& (!(crypt_stat->flags & <API key>)
|| !(crypt_stat->flags & ECRYPTFS_KEY_VALID))) {
struct <API key> *mount_crypt_stat;
mount_crypt_stat = &<API key>(
dentry->d_sb)->mount_crypt_stat;
rc = <API key>(dentry, inode);
if (rc) {
mutex_unlock(&crypt_stat->cs_mutex);
goto out;
}
rc = <API key>(dentry);
<API key>(inode);
if (rc) {
if (!(mount_crypt_stat->flags
& <API key>)) {
rc = -EIO;
printk(KERN_WARNING "Either the lower file "
"is not in a valid eCryptfs format, "
"or the key could not be retrieved. "
"Plaintext passthrough mode is not "
"enabled; returning -EIO\n");
mutex_unlock(&crypt_stat->cs_mutex);
goto out;
}
rc = 0;
crypt_stat->flags &= ~(<API key>
| ECRYPTFS_ENCRYPTED);
}
}
mutex_unlock(&crypt_stat->cs_mutex);
rc = inode_change_ok(inode, ia);
if (rc)
goto out;
if (ia->ia_valid & ATTR_SIZE) {
rc = <API key>(inode, ia->ia_size);
if (rc)
goto out;
}
memcpy(&lower_ia, ia, sizeof(lower_ia));
if (ia->ia_valid & ATTR_FILE)
lower_ia.ia_file = <API key>(ia->ia_file);
if (ia->ia_valid & ATTR_SIZE) {
rc = truncate_upper(dentry, ia, &lower_ia);
if (rc < 0)
goto out;
}
/*
* mode change is for clearing setuid/setgid bits. Allow lower fs
* to interpret this in its own way.
*/
if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
lower_ia.ia_valid &= ~ATTR_MODE;
mutex_lock(&lower_dentry->d_inode->i_mutex);
rc = notify_change(lower_dentry, &lower_ia, NULL);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
out:
<API key>(inode, lower_inode);
return rc;
}
static int <API key>(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct <API key> *mount_crypt_stat;
int rc = 0;
mount_crypt_stat = &<API key>(
dentry->d_sb)->mount_crypt_stat;
generic_fillattr(dentry->d_inode, stat);
if (mount_crypt_stat->flags & <API key>) {
char *target;
size_t targetsiz;
rc = <API key>(dentry, &target, &targetsiz);
if (!rc) {
kfree(target);
stat->size = targetsiz;
}
}
return rc;
}
static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct kstat lower_stat;
int rc;
rc = vfs_getattr(<API key>(dentry), &lower_stat);
if (!rc) {
<API key>(dentry->d_inode,
<API key>(dentry->d_inode));
generic_fillattr(dentry->d_inode, stat);
stat->blocks = lower_stat.blocks;
}
return rc;
}
int
ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags)
{
int rc = 0;
struct dentry *lower_dentry;
lower_dentry = <API key>(dentry);
if (!lower_dentry->d_inode->i_op->setxattr) {
rc = -EOPNOTSUPP;
goto out;
}
rc = vfs_setxattr(lower_dentry, name, value, size, flags);
if (!rc)
<API key>(dentry->d_inode, lower_dentry->d_inode);
out:
return rc;
}
ssize_t
<API key>(struct dentry *lower_dentry, const char *name,
void *value, size_t size)
{
int rc = 0;
if (!lower_dentry->d_inode->i_op->getxattr) {
rc = -EOPNOTSUPP;
goto out;
}
mutex_lock(&lower_dentry->d_inode->i_mutex);
rc = lower_dentry->d_inode->i_op->getxattr(lower_dentry, name, value,
size);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
out:
return rc;
}
static ssize_t
ecryptfs_getxattr(struct dentry *dentry, const char *name, void *value,
size_t size)
{
return <API key>(<API key>(dentry), name,
value, size);
}
static ssize_t
ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size)
{
int rc = 0;
struct dentry *lower_dentry;
lower_dentry = <API key>(dentry);
if (!lower_dentry->d_inode->i_op->listxattr) {
rc = -EOPNOTSUPP;
goto out;
}
mutex_lock(&lower_dentry->d_inode->i_mutex);
rc = lower_dentry->d_inode->i_op->listxattr(lower_dentry, list, size);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
out:
return rc;
}
static int <API key>(struct dentry *dentry, const char *name)
{
int rc = 0;
struct dentry *lower_dentry;
lower_dentry = <API key>(dentry);
if (!lower_dentry->d_inode->i_op->removexattr) {
rc = -EOPNOTSUPP;
goto out;
}
mutex_lock(&lower_dentry->d_inode->i_mutex);
rc = lower_dentry->d_inode->i_op->removexattr(lower_dentry, name);
mutex_unlock(&lower_dentry->d_inode->i_mutex);
out:
return rc;
}
const struct inode_operations <API key> = {
.readlink = generic_readlink,
.follow_link = <API key>,
.put_link = kfree_put_link,
.permission = ecryptfs_permission,
.setattr = ecryptfs_setattr,
.getattr = <API key>,
.setxattr = ecryptfs_setxattr,
.getxattr = ecryptfs_getxattr,
.listxattr = ecryptfs_listxattr,
.removexattr = <API key>
};
const struct inode_operations ecryptfs_dir_iops = {
.create = ecryptfs_create,
.lookup = ecryptfs_lookup,
.link = ecryptfs_link,
.unlink = ecryptfs_unlink,
.symlink = ecryptfs_symlink,
.mkdir = ecryptfs_mkdir,
.rmdir = ecryptfs_rmdir,
.mknod = ecryptfs_mknod,
.rename = ecryptfs_rename,
.permission = ecryptfs_permission,
.setattr = ecryptfs_setattr,
.setxattr = ecryptfs_setxattr,
.getxattr = ecryptfs_getxattr,
.listxattr = ecryptfs_listxattr,
.removexattr = <API key>
};
const struct inode_operations ecryptfs_main_iops = {
.permission = ecryptfs_permission,
.setattr = ecryptfs_setattr,
.getattr = ecryptfs_getattr,
.setxattr = ecryptfs_setxattr,
.getxattr = ecryptfs_getxattr,
.listxattr = ecryptfs_listxattr,
.removexattr = <API key>
}; |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Thu Oct 02 16:39:52 BST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.apache.jena.riot.lang (Apache Jena ARQ)</title>
<meta name="date" content="2014-10-02">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../../../org/apache/jena/riot/lang/package-summary.html" target="classFrame">org.apache.jena.riot.lang</a></h1>
<div class="indexContainer">
<h2 title="Interfaces">Interfaces</h2>
<ul title="Interfaces">
<li><a href="BlankNodeAllocator.html" title="interface in org.apache.jena.riot.lang" target="classFrame"><i>BlankNodeAllocator</i></a></li>
<li><a href="LangRIOT.html" title="interface in org.apache.jena.riot.lang" target="classFrame"><i>LangRIOT</i></a></li>
<li><a href="StreamRDFCounting.html" title="interface in org.apache.jena.riot.lang" target="classFrame"><i>StreamRDFCounting</i></a></li>
</ul>
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="CollectorStreamBase.html" title="class in org.apache.jena.riot.lang" target="classFrame">CollectorStreamBase</a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="CollectorStreamRDF.html" title="class in org.apache.jena.riot.lang" target="classFrame">CollectorStreamRDF</a></li>
<li><a href="<API key>.html" title="class in org.apache.jena.riot.lang" target="classFrame"><API key></a></li>
<li><a href="JsonLDReader.html" title="class in org.apache.jena.riot.lang" target="classFrame">JsonLDReader</a></li>
<li><a href="LabelToNode.html" title="class in org.apache.jena.riot.lang" target="classFrame">LabelToNode</a></li>
<li><a href="LangBase.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangBase</a></li>
<li><a href="LangCSV.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangCSV</a></li>
<li><a href="LangEngine.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangEngine</a></li>
<li><a href="LangNQuads.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangNQuads</a></li>
<li><a href="LangNTriples.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangNTriples</a></li>
<li><a href="LangNTuple.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangNTuple</a></li>
<li><a href="LangNull.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangNull</a></li>
<li><a href="LangRDFJSON.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangRDFJSON</a></li>
<li><a href="LangRDFXML.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangRDFXML</a></li>
<li><a href="LangTriG.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangTriG</a></li>
<li><a href="LangTurtle.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangTurtle</a></li>
<li><a href="LangTurtleBase.html" title="class in org.apache.jena.riot.lang" target="classFrame">LangTurtleBase</a></li>
<li><a href="PipedQuadsStream.html" title="class in org.apache.jena.riot.lang" target="classFrame">PipedQuadsStream</a></li>
<li><a href="PipedRDFIterator.html" title="class in org.apache.jena.riot.lang" target="classFrame">PipedRDFIterator</a></li>
<li><a href="PipedRDFStream.html" title="class in org.apache.jena.riot.lang" target="classFrame">PipedRDFStream</a></li>
<li><a href="PipedTriplesStream.html" title="class in org.apache.jena.riot.lang" target="classFrame">PipedTriplesStream</a></li>
<li><a href="PipedTuplesStream.html" title="class in org.apache.jena.riot.lang" target="classFrame">PipedTuplesStream</a></li>
<li><a href="SinkQuadsToDataset.html" title="class in org.apache.jena.riot.lang" target="classFrame">SinkQuadsToDataset</a></li>
<li><a href="SinkTriplesToGraph.html" title="class in org.apache.jena.riot.lang" target="classFrame">SinkTriplesToGraph</a></li>
</ul>
</div>
</body>
</html> |
#include "SharedSection.h"
#define MAXSHAREDACCESSES 5000
CSharedSection::CSharedSection()
{
m_sharedLock = 0;
m_exclusive = false;
<API key>(&m_critSection);
m_eventFree = CreateEvent(NULL, TRUE, FALSE, NULL);
}
CSharedSection::~CSharedSection()
{
<API key>(&m_critSection);
CloseHandle(m_eventFree);
}
void CSharedSection::EnterShared()
{
<API key>(&m_critSection);
ResetEvent(m_eventFree);
m_sharedLock++;
<API key>(&m_critSection);
}
void CSharedSection::LeaveShared()
{
<API key>(&m_critSection);
m_sharedLock
if (m_sharedLock == 0)
{
<API key>(&m_critSection);
SetEvent(m_eventFree);
return;
}
<API key>(&m_critSection);
}
void CSharedSection::EnterExclusive()
{
<API key>(&m_critSection);
while( m_sharedLock != 0 )
{
<API key>(&m_critSection);
WaitForSingleObject(m_eventFree, INFINITE);
<API key>(&m_critSection);
}
m_exclusive = true;
}
void CSharedSection::LeaveExclusive()
{
m_exclusive = false;
<API key>(&m_critSection);
}
// SharedLock
CSharedLock::CSharedLock(CSharedSection& cs)
: m_cs( cs )
, m_bIsOwner( false )
{
Enter();
}
CSharedLock::CSharedLock(const CSharedSection& cs)
: m_cs( const_cast<CSharedSection&>(cs) )
, m_bIsOwner( false )
{
Enter();
}
CSharedLock::~CSharedLock()
{
Leave();
}
bool CSharedLock::IsOwner() const
{
return m_bIsOwner;
}
bool CSharedLock::Enter()
{
// Test if we already own the critical section
if ( true == m_bIsOwner )
{
return true;
}
// Blocking call
m_cs.EnterShared();
m_bIsOwner = true;
return m_bIsOwner;
}
void CSharedLock::Leave()
{
if ( false == m_bIsOwner )
{
return ;
}
m_cs.LeaveShared();
m_bIsOwner = false;
}
// ExclusiveLock
CExclusiveLock::CExclusiveLock(CSharedSection& cs)
: m_cs( cs )
, m_bIsOwner( false )
{
Enter();
}
CExclusiveLock::CExclusiveLock(const CSharedSection& cs)
: m_cs( const_cast<CSharedSection&>(cs) )
, m_bIsOwner( false )
{
Enter();
}
CExclusiveLock::~CExclusiveLock()
{
Leave();
}
bool CExclusiveLock::IsOwner() const
{
return m_bIsOwner;
}
bool CExclusiveLock::Enter()
{
// Test if we already own the critical section
if ( true == m_bIsOwner )
{
return true;
}
// Blocking call
m_cs.EnterExclusive();
m_bIsOwner = true;
return m_bIsOwner;
}
void CExclusiveLock::Leave()
{
if ( false == m_bIsOwner )
{
return ;
}
m_cs.LeaveExclusive();
m_bIsOwner = false;
} |
<!
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http:
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
<!
The progress bars are for situations where the percentage completed can be
determined. They give users a quick sense of how much longer an operation
will take.
Example:
<paper-progress value="10"></paper-progress>
There is also a secondary progress which is useful for displaying intermediate
progress, such as the buffer level during a streaming playback progress bar.
Example:
<paper-progress value="10" secondaryProgesss="30"></paper-progress>
Styling progress bar:
To change the active progress bar color:
paper-progress::shadow #activeProgress {
background-color: #e91e63;
}
To change the secondary progress bar color:
paper-progress::shadow #secondaryProgress {
background-color: #f8bbd0;
}
To change the progress bar background color:
paper-progress::shadow #progressContainer {
background-color: #64ffda;
}
@group Paper Elements
@element paper-progress
@extends core-range
@homepage github.io
<link rel="import" href="../core-range/core-range.html">
<polymer-element name="paper-progress" extends="core-range" attributes="secondaryProgress">
<template>
<link rel="stylesheet" href="paper-progress.css">
<div id="progressContainer" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="{{min}}" aria-valuemax="{{max}}">
<div id="secondaryProgress" _style="width: {{secondaryRatio}}%;"></div>
<div id="activeProgress" _style="width: {{ratio}}%;"></div>
</div>
</template>
<script>
Polymer('paper-progress', {
/**
* The number that represents the current secondary progress.
*
* @attribute secondaryProgress
* @type number
* @default 0
*/
secondaryProgress: 0,
step: 0,
observe: {
'value secondaryProgress min max': 'update'
},
update: function() {
this.super();
this.secondaryProgress = this.clampValue(this.secondaryProgress);
this.secondaryRatio = this.calcRatio(this.secondaryProgress) * 100;
}
});
</script>
</polymer-element> |
<?php
// Check to ensure this file is within the rest of the framework
defined( '_JEXEC' ) or die( 'Restricted index access' );
/**
* Renders a text element
*
* @package Joomla.Framework
* @subpackage Parameter
* @since 1.5
*/
class JFormFieldYjsgcheck extends JFormField
{
public $type = 'Yjsgcheck';
public function getInput(){
if (!defined( 'YJSGRUN' )) {
echo '<h1 style="color:red;">'.JText::_('<API key>').'</h1>';
return;
}
$document = YjsgDochead::getDocument();
$document->addJsInhead("var comp_dis ='".JText::_('<API key>')."';");
$yjsg = Yjsg::getInstance();
$YjsgCurrentVersion = $yjsg->version;
$YjsgHasUpdate = $yjsg->hasupdate;
$YjsgLatestVersion = $yjsg->getUpdateVersion();
$template_folder = basename(dirname(dirname(__FILE__)));
$params_obj = $this->form->getValue('params');
$params = new JRegistry();
$params->loadObject($params_obj);
$comp_dis ='<div id="option-resut">';
if($params->get('component_switch')){
$comp_dis .= JText::_('<API key>');
}
$comp_dis .='</div>';
$yjsgManageLink ='index.php?option=com_plugins&view=plugins&filter_folder=system&filter_search=Yjsg';
$yjsgText =''.JText::_('YJSG_INS_PUB')." <strong>v".$YjsgCurrentVersion."</strong> ".JText::_('YJSG_INS_PUB2').' <a href="'.$yjsgManageLink.'">'.JText::_('YJSC_MAN_EXT').'</a>';
if($YjsgHasUpdate == 1){
$updateclass =' updateavailable';
}else{
$updateclass ='';
}
// yjsg
$syshtml ='<div class="yj_system_check">';
$syshtml .='<div id="yjsgBox" class="systemBox'.$updateclass.'">';
$syshtml .='<h2 id="yjmmpTitle" class="systemBoxTitle yjsgtips" data-original-title="'.JText::_('YJSG_CHECK').'" data-content="'.JText::_('YJSG_CHECK_TIP').'">'.JText::_('YJSG_CHECK').'</h2>';
if($YjsgHasUpdate == 1){
$syshtml .='<div class="infoText"><span class="showIcon"></span> ';
$syshtml .=JText::_('<API key>').'<strong>'.$YjsgCurrentVersion.'</strong>';
$syshtml .=JText::_('<API key>').'<strong>'.$YjsgLatestVersion.'</strong>';
$syshtml .='<a href="index.php?option=com_installer&view=update">'.JText::_('<API key>').'</a>';
$syshtml .='</div>';
}else{
$syshtml .='<div class="infoText"><span class="showIcon"></span>'.$yjsgText.'</div>';
}
$syshtml .='</div>';
$syshtml .='<div id="settmsgBox" class="systemBox hide">';
$syshtml .='<h2 id="yjjbpTitle" class="systemBoxTitle yjsgtips" data-original-title="'.JText::_('YJSG_SETT_MSG').'" data-content="'.JText::_('YJSG_SETT_MSG_TIP').'">'.JText::_('YJSG_SETT_MSG').'</h2>';
$syshtml .='<div class="infoText"><span class="showIcon"></span>'.$comp_dis.'</div>';
$syshtml .='</div>';
$syshtml .='</div>';// close yj_system_check
// Output
echo $syshtml;
}
public function getLabel() {
return false;
}
} |
module RSA.Break where
import RSA.Break.Data
import RSA.Euclid
import Faktor.Prim
import Faktor.Certify ( powmod )
import Data.Typeable
import Challenger.Partial
import Autolib.ToDoc
import Autolib.Reporter
import Autolib.Ana
import Inter.Types
data RSA_Code_Break = RSA_Code_Break deriving ( Read, Show, Typeable )
instance OrderScore RSA_Code_Break where
scoringOrder _ = None
instance Partial RSA_Code_Break Config Integer where
describe RSA_Code_Break conf = vcat
[ text "Finden Sie den Klartext für eine RSA-Verschlüsselung mit"
, nest 4 $ toDoc conf
]
initial RSA_Code_Break conf =
let (d, n) = public_key conf
b = 3
xs = based b n
in unbased b $ reverse xs
total RSA_Code_Break conf x = do
let ( d, n ) = public_key conf
let y = powmod x d n
inform $ vcat
[ text "bei Verschlüsselung von" <+> toDoc x
, fsep [ text "erhält man"
, toDoc x, text "^", toDoc d, text "="
, toDoc y, text "mod", toDoc n
]
]
assert ( y == message conf )
$ text "Stimmt das mit vorliegender Nachricht überein?"
instance Measure RSA_Code_Break Config Integer where
measure RSA_Code_Break c i = 0
break :: Config -> Integer -> Integer
break conf x =
let (d, n) = public_key conf
Just [(p, 1), (q, 1)] = factor n
phi = pred p * pred q
(a, b) = euclid phi d
e = b `mod` phi
in powmod x e n
make :: Make
make = direct RSA_Code_Break RSA.Break.Data.example |
#include <QCheckBox>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "DolphinQt2/Config/Mapping/GCKeyboardEmu.h"
#include "DolphinQt2/Config/Mapping/GCMicrophone.h"
#include "DolphinQt2/Config/Mapping/GCPadEmu.h"
#include "DolphinQt2/Config/Mapping/Hotkey3D.h"
#include "DolphinQt2/Config/Mapping/HotkeyDebugging.h"
#include "DolphinQt2/Config/Mapping/HotkeyGeneral.h"
#include "DolphinQt2/Config/Mapping/HotkeyGraphics.h"
#include "DolphinQt2/Config/Mapping/HotkeyStates.h"
#include "DolphinQt2/Config/Mapping/HotkeyTAS.h"
#include "DolphinQt2/Config/Mapping/HotkeyWii.h"
#include "DolphinQt2/Config/Mapping/WiimoteEmuExtension.h"
#include "DolphinQt2/Config/Mapping/WiimoteEmuGeneral.h"
#include "DolphinQt2/Config/Mapping/<API key>.h"
#include "DolphinQt2/QtUtils/WrapInScrollArea.h"
#include "DolphinQt2/Settings.h"
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/ControllerInterface/Device.h"
#include "InputCommon/InputConfig.h"
MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
: QDialog(parent), m_port(port_num)
{
setWindowTitle(tr("Port %1").arg(port_num + 1));
setWindowFlags(windowFlags() & ~Qt::<API key>);
CreateDevicesLayout();
<API key>();
CreateResetLayout();
CreateMainLayout();
ConnectWidgets();
SetMappingType(type);
}
void MappingWindow::CreateDevicesLayout()
{
m_devices_layout = new QHBoxLayout();
m_devices_box = new QGroupBox(tr("Device"));
m_devices_combo = new QComboBox();
m_devices_refresh = new QPushButton(tr("Refresh"));
m_devices_refresh->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_devices_layout->addWidget(m_devices_combo);
m_devices_layout->addWidget(m_devices_refresh);
m_devices_box->setLayout(m_devices_layout);
}
void MappingWindow::<API key>()
{
m_profiles_layout = new QHBoxLayout();
m_profiles_box = new QGroupBox(tr("Profile"));
m_profiles_combo = new QComboBox();
m_profiles_load = new QPushButton(tr("Load"));
m_profiles_save = new QPushButton(tr("Save"));
m_profiles_delete = new QPushButton(tr("Delete"));
auto* button_layout = new QHBoxLayout();
m_profiles_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_profiles_combo->setEditable(true);
m_profiles_layout->addWidget(m_profiles_combo);
button_layout->addWidget(m_profiles_load);
button_layout->addWidget(m_profiles_save);
button_layout->addWidget(m_profiles_delete);
m_profiles_layout->addItem(button_layout);
m_profiles_box->setLayout(m_profiles_layout);
}
void MappingWindow::CreateResetLayout()
{
m_reset_layout = new QHBoxLayout();
m_reset_box = new QGroupBox(tr("Reset"));
m_reset_clear = new QPushButton(tr("Clear"));
m_reset_default = new QPushButton(tr("Default"));
m_reset_box->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_reset_layout->addWidget(m_reset_default);
m_reset_layout->addWidget(m_reset_clear);
m_reset_box->setLayout(m_reset_layout);
}
void MappingWindow::CreateMainLayout()
{
m_main_layout = new QVBoxLayout();
m_config_layout = new QHBoxLayout();
m_iterative_input = new QCheckBox(tr("Iterative Input"));
m_tab_widget = new QTabWidget();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
m_iterative_input->setToolTip(tr("Automatically progress one button after another during "
"configuration. Useful for first-time setup."));
m_config_layout->addWidget(m_devices_box);
m_config_layout->addWidget(m_reset_box);
m_config_layout->addWidget(m_profiles_box);
m_main_layout->addItem(m_config_layout);
m_main_layout->addWidget(m_iterative_input);
m_main_layout->addWidget(m_tab_widget);
m_main_layout->addWidget(m_button_box);
setLayout(m_main_layout);
}
void MappingWindow::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MappingWindow::OnDeviceChanged);
connect(m_reset_clear, &QPushButton::clicked, this, [this] { emit ClearFields(); });
connect(m_reset_default, &QPushButton::clicked, this, &MappingWindow::<API key>);
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::<API key>);
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::<API key>);
connect(m_profiles_delete, &QPushButton::clicked, this, &MappingWindow::<API key>);
}
void MappingWindow::<API key>()
{
const QString profile_name = m_profiles_combo->currentText();
const QString profile_path = m_profiles_combo->currentData().toString();
if (!File::Exists(profile_path.toStdString()))
{
QMessageBox error(this);
error.setIcon(QMessageBox::Critical);
error.setText(tr("The profile '%1' does not exist").arg(profile_name));
error.exec();
return;
}
QMessageBox confirm(this);
confirm.setIcon(QMessageBox::Warning);
confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name));
confirm.setInformativeText(tr("This cannot be undone!"));
confirm.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
if (confirm.exec() != QMessageBox::Yes)
{
return;
}
m_profiles_combo->removeItem(m_profiles_combo->currentIndex());
File::Delete(profile_path.toStdString());
QMessageBox result(this);
result.setIcon(QMessageBox::Information);
result.setText(tr("Successfully deleted '%1'.").arg(profile_name));
}
void MappingWindow::<API key>()
{
const QString profile_path = m_profiles_combo->currentData().toString();
if (m_profiles_combo->currentIndex() == 0)
return;
IniFile ini;
ini.Load(profile_path.toStdString());
m_controller->LoadConfig(ini.GetOrCreateSection("Profile"));
m_controller->UpdateReferences(<API key>);
emit Update();
RefreshDevices();
}
void MappingWindow::<API key>()
{
const QString profile_name = m_profiles_combo->currentText();
const QString profile_path = m_profiles_combo->currentData().toString();
if (profile_name.isEmpty())
return;
File::CreateFullPath(profile_path.toStdString());
IniFile ini;
m_controller->SaveConfig(ini.GetOrCreateSection("Profile"));
ini.Save(profile_path.toStdString());
if (m_profiles_combo->currentIndex() == 0)
{
m_profiles_combo->addItem(profile_name, profile_path);
m_profiles_combo->setCurrentIndex(m_profiles_combo->count() - 1);
}
}
void MappingWindow::OnDeviceChanged(int index)
{
const auto device = m_devices_combo->currentText().toStdString();
m_controller->SetDefaultDevice(device);
}
void MappingWindow::RefreshDevices()
{
m_devices_combo->clear();
Core::RunAsCPUThread([&] {
<API key>.RefreshDevices();
m_controller->UpdateReferences(<API key>);
const auto default_device = m_controller->GetDefaultDevice().ToString();
if (!default_device.empty())
m_devices_combo->addItem(QString::fromStdString(default_device));
for (const auto& name : <API key>.GetAllDeviceStrings())
{
if (name != default_device)
m_devices_combo->addItem(QString::fromStdString(name));
}
m_devices_combo->setCurrentIndex(0);
});
}
void MappingWindow::SetMappingType(MappingWindow::Type type)
{
MappingWidget* widget;
switch (type)
{
case Type::MAPPING_GC_KEYBOARD:
widget = new GCKeyboardEmu(this);
AddWidget(tr("GameCube Keyboard"), widget);
setWindowTitle(tr("GameCube Keyboard at Port %1").arg(GetPort() + 1));
break;
case Type::MAPPING_GC_BONGOS:
case Type::<API key>:
case Type::MAPPING_GC_DANCEMAT:
case Type::MAPPING_GCPAD:
widget = new GCPadEmu(this);
setWindowTitle(tr("GameCube Controller at Port %1").arg(GetPort() + 1));
AddWidget(tr("GameCube Controller"), widget);
break;
case Type::<API key>:
widget = new GCMicrophone(this);
setWindowTitle(tr("GameCube Microphone Slot %1")
.arg(GetPort() == 0 ? QStringLiteral("A") : QStringLiteral("B")));
AddWidget(tr("Microphone"), widget);
break;
case Type::MAPPING_WIIMOTE_EMU:
{
auto* extension = new WiimoteEmuExtension(this);
widget = new WiimoteEmuGeneral(this, extension);
setWindowTitle(tr("Wii Remote %1").arg(GetPort() + 1));
AddWidget(tr("General and Options"), widget);
AddWidget(tr("Motion Controls and IR"), new <API key>(this));
AddWidget(tr("Extension"), extension);
break;
}
case Type::MAPPING_HOTKEYS:
{
widget = new HotkeyGeneral(this);
AddWidget(tr("General"), widget);
AddWidget(tr("TAS Tools"), new HotkeyTAS(this));
AddWidget(tr("Debugging"), new HotkeyDebugging(this));
AddWidget(tr("Wii and Wii Remote"), new HotkeyWii(this));
AddWidget(tr("Graphics"), new HotkeyGraphics(this));
AddWidget(tr("3D"), new Hotkey3D(this));
AddWidget(tr("Save and Load State"), new HotkeyStates(this));
setWindowTitle(tr("Hotkey Settings"));
break;
}
default:
return;
}
widget->LoadSettings();
m_config = widget->GetConfig();
m_controller = m_config->GetController(GetPort());
m_profiles_combo->addItem(QStringLiteral(""));
const std::string profiles_path =
File::GetUserPath(D_CONFIG_IDX) + "Profiles/" + m_config->GetProfileName();
for (const auto& filename : Common::DoFileSearch({profiles_path}, {".ini"}))
{
std::string basename;
SplitPath(filename, nullptr, &basename, nullptr);
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
}
RefreshDevices();
}
void MappingWindow::AddWidget(const QString& name, QWidget* widget)
{
m_tab_widget->addTab(GetWrappedWidget(widget, this, 150, 150), name);
}
int MappingWindow::GetPort() const
{
return m_port;
}
ControllerEmu::EmulatedController* MappingWindow::GetController() const
{
return m_controller;
}
std::shared_ptr<ciface::Core::Device> MappingWindow::GetDevice() const
{
return <API key>.FindDevice(GetController()->GetDefaultDevice());
}
void MappingWindow::<API key>()
{
m_controller->LoadDefaults(<API key>);
m_controller->UpdateReferences(<API key>);
emit Update();
}
bool MappingWindow::IsIterativeInput() const
{
return m_iterative_input->isChecked();
} |
#ifndef <API key>
#define <API key>
#include <QObject>
#include <QModelIndex>
class QAbstractItemModel;
class ModelObserver : public QObject
{
Q_OBJECT
public:
ModelObserver( QAbstractItemModel *source );
private slots:
void slotRowsInserted( const QModelIndex & parent, int start, int end );
void slotColumnsInserted( const QModelIndex & parent, int start, int end );
void slotRowsRemoved( const QModelIndex & parent, int start, int end );
void slotColumnsRemoved( const QModelIndex & parent, int start, int end );
void slotModelReset();
public:
QAbstractItemModel *m_source;
int m_numRows;
int m_numCols;
};
#endif // <API key> |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta name="generator" content="AWStats 7.0 (build 1.971) from config file awstats.mc-aster.com.conf (http://awstats.sourceforge.net)">
<meta name="robots" content="noindex,nofollow">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="description" content="Awstats - Advanced Web Statistics for mc-aster.com (2012-03) - main">
<title>Statistics for mc-aster.com (2012-03) - main</title>
<style type="text/css">
<!
body { font: 11px verdana, arial, helvetica, sans-serif; background-color: #FFFFFF; margin-top: 0; margin-bottom: 0; }
.aws_bodyl { }
.aws_border { border-collapse: collapse; background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0px; margin-bottom: 0px; }
.aws_title { font: 13px verdana, arial, helvetica, sans-serif; font-weight: bold; background-color: #CCCCDD; text-align: center; margin-top: 0; margin-bottom: 0; padding: 1px 1px 1px 1px; color: #000000; }
.aws_blank { font: 13px verdana, arial, helvetica, sans-serif; background-color: #FFFFFF; text-align: center; margin-bottom: 0; padding: 1px 1px 1px 1px; }
.aws_data {
background-color: #FFFFFF;
border-top-width: 1px;
border-left-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
}
.aws_formfield { font: 13px verdana, arial, helvetica; }
.aws_button {
font-family: arial,verdana,helvetica, sans-serif;
font-size: 12px;
border: 1px solid #ccd7e0;
background-image : url(/awstatsicons/other/button.gif);
}
th { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000; }
th.aws { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font-size: 13px; font-weight: bold; }
td { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000; }
td.aws { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000; padding: 0px;}
td.awsm { border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000; padding: 0px; }
b { font-weight: bold; }
a { font: 11px verdana, arial, helvetica, sans-serif; }
a:link { color: #0011BB; text-decoration: none; }
a:visited { color: #0011BB; text-decoration: none; }
a:hover { color: #605040; text-decoration: underline; }
.currentday { font-weight: bold; }
</style>
</head>
<body style="margin-top: 0px">
<a name="top"></a>
<a name="menu"> </a>
<form name="FormDateFilter" action="/cgi-bin/awstats.pl?config=mc-aster.com&staticlinks&staticlinksext=032012.html" style="padding: 0px 0px 0px 0px; margin-top: 0">
<table class="aws_border" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td>
<table class="aws_data sortable" border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td class="aws" valign="middle"><b>Statistics for:</b> </td><td class="aws" valign="middle"><span style="font-size: 14px;">mc-aster.com</span></td><td align="right" rowspan="3"><a href="http://awstats.sourceforge.net" target="awstatshome"><img src="/awstatsicons/other/awstats_logo6.png" border="0" alt='Awstats Web Site' title='Awstats Web Site' /></a></td></tr>
<tr valign="middle"><td class="aws" valign="middle" width="150"><b>Last Update:</b> </td><td class="aws" valign="middle"><span style="font-size: 12px;">30 Apr 2012 - 00:03</span></td></tr>
<tr><td class="aws" valign="middle"><b>Reported period:</b></td><td class="aws" valign="middle"><span style="font-size: 14px;">Month Mar 2012</span></td></tr>
</table>
</td></tr></table>
</form>
<table>
<tr><td class="awsm" width="150" valign="top"><b>When:</b></td>
<td class="awsm"><a href="#month">Monthly history</a> <a href="#daysofmonth">Days of month</a> <a href="#daysofweek">Days of week</a> <a href="#hours">Hours</a> </td></tr>
<tr><td class="awsm" width="150" valign="top"><b>Who:</b></td>
<td class="awsm"><a href="#countries">Countries</a> <a href="awstats.mc-aster.com.alldomains.032012.html" target="awstatsbis">Full list</a>
<a href="#visitors">Hosts</a> <a href="awstats.mc-aster.com.allhosts.032012.html" target="awstatsbis">Full list</a>
<a href="awstats.mc-aster.com.lasthosts.032012.html" target="awstatsbis">Last visit</a>
<a href="awstats.mc-aster.com.unknownip.032012.html" target="awstatsbis">Unresolved IP Address</a>
<a href="#robots">Robots/Spiders visitors</a> <a href="awstats.mc-aster.com.allrobots.032012.html" target="awstatsbis">Full list</a>
<a href="awstats.mc-aster.com.lastrobots.032012.html" target="awstatsbis">Last visit</a>
</td></tr>
<tr><td class="awsm" valign="top"><b>Navigation:</b></td>
<td class="awsm"><a href="#sessions">Visits duration</a> <a href="#filetypes">File type</a> <a href="#downloads">Downloads</a> <a href="awstats.mc-aster.com.downloads.032012.html" target="awstatsbis">Full list</a>
<a href="#urls">Viewed</a>
<a href="awstats.mc-aster.com.urldetail.032012.html" target="awstatsbis">Full list</a>
<a href="awstats.mc-aster.com.urlentry.032012.html" target="awstatsbis">Entry</a>
<a href="awstats.mc-aster.com.urlexit.032012.html" target="awstatsbis">Exit</a>
<a href="#os">Operating Systems</a> <a href="awstats.mc-aster.com.osdetail.032012.html" target="awstatsbis">Versions</a>
<a href="awstats.mc-aster.com.unknownos.032012.html" target="awstatsbis">Unknown</a>
<a href="#browsers">Browsers</a> <a href="awstats.mc-aster.com.browserdetail.032012.html" target="awstatsbis">Versions</a>
<a href="awstats.mc-aster.com.unknownbrowser.032012.html" target="awstatsbis">Unknown</a>
</td></tr>
<tr><td class="awsm" width="150" valign="top"><b>Referrers:</b></td>
<td class="awsm"><a href="#referer">Origin</a> <a href="awstats.mc-aster.com.refererse.032012.html" target="awstatsbis">Referring search engines</a>
<a href="awstats.mc-aster.com.refererpages.032012.html" target="awstatsbis">Referring sites</a>
<a href="#keys">Search</a> <a href="awstats.mc-aster.com.keyphrases.032012.html" target="awstatsbis">Search Keyphrases</a>
<a href="awstats.mc-aster.com.keywords.032012.html" target="awstatsbis">Search Keywords</a>
</td></tr>
<tr><td class="awsm" width="150" valign="top"><b>Others:</b></td>
<td class="awsm"><a href="#misc">Miscellaneous</a> <a href="#errors">HTTP Status codes</a> <a href="awstats.mc-aster.com.errors404.032012.html" target="awstatsbis">Pages not found</a>
</td></tr>
</table>
<br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Summary </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><td class="aws"><b>Reported period</b></td><td class="aws" colspan="5">
Month Mar 2012</td></tr>
<tr bgcolor="#ECECEC"><td class="aws"><b>First visit</b></td>
<td class="aws" colspan="5">01 Mar 2012 - 07:21</td></tr>
<tr bgcolor="#ECECEC"><td class="aws"><b>Last visit</b></td>
<td class="aws" colspan="5">31 Mar 2012 - 20:59</td>
</tr>
<tr><td bgcolor="#CCCCDD"> </td><td width="17%" bgcolor="#FFAA66">Unique visitors</td><td width="17%" bgcolor="#F4F090">Number of visits</td><td width="17%" bgcolor="#4477DD">Pages</td><td width="17%" bgcolor="#66DDEE">Hits</td><td width="17%" bgcolor="#2EA495">Bandwidth</td></tr>
<tr><td class="aws">Viewed traffic *</td><td><b>361</b><br /> </td><td><b>481</b><br />(1.33 visits/visitor)</td><td><b>1,350</b><br />(2.8 Pages/Visit)</td><td><b>6,789</b><br />(14.11 Hits/Visit)</td><td><b>88.86 MB</b><br />(189.18 KB/Visit)</td></tr>
<tr><td class="aws">Not viewed traffic *</td><td colspan="2"> <br /> </td>
<td><b>1,076</b></td><td><b>1,326</b></td><td><b>23.47 MB</b></td></tr>
</table></td></tr></table><span style="font: 11px verdana, arial, helvetica;">* Not viewed traffic includes traffic generated by robots, worms, or replies with special HTTP status codes.</span><br />
<br />
<a name="month"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Monthly history </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="center">
<center>
<table>
<tr valign="bottom"><td> </td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="16" width="6" alt='Unique visitors: 98' title='Unique visitors: 98' /><img align="bottom" src="/awstatsicons/other/vv.png" height="23" width="6" alt='Number of visits: 140' title='Number of visits: 140' /><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="6" alt='Pages: 737' title='Pages: 737' /><img align="bottom" src="/awstatsicons/other/vh.png" height="43" width="6" alt='Hits: 3551' title='Hits: 3551' /><img align="bottom" src="/awstatsicons/other/vk.png" height="26" width="6" alt='Bandwidth: 24.89 MB' title='Bandwidth: 24.89 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="26" width="6" alt='Unique visitors: 158' title='Unique visitors: 158' /><img align="bottom" src="/awstatsicons/other/vv.png" height="30" width="6" alt='Number of visits: 187' title='Number of visits: 187' /><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="6" alt='Pages: 691' title='Pages: 691' /><img align="bottom" src="/awstatsicons/other/vh.png" height="44" width="6" alt='Hits: 3638' title='Hits: 3638' /><img align="bottom" src="/awstatsicons/other/vk.png" height="49" width="6" alt='Bandwidth: 47.57 MB' title='Bandwidth: 47.57 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="58" width="6" alt='Unique visitors: 361' title='Unique visitors: 361' /><img align="bottom" src="/awstatsicons/other/vv.png" height="77" width="6" alt='Number of visits: 481' title='Number of visits: 481' /><img align="bottom" src="/awstatsicons/other/vp.png" height="17" width="6" alt='Pages: 1350' title='Pages: 1350' /><img align="bottom" src="/awstatsicons/other/vh.png" height="82" width="6" alt='Hits: 6789' title='Hits: 6789' /><img align="bottom" src="/awstatsicons/other/vk.png" height="91" width="6" alt='Bandwidth: 88.86 MB' title='Bandwidth: 88.86 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="67" width="6" alt='Unique visitors: 420' title='Unique visitors: 420' /><img align="bottom" src="/awstatsicons/other/vv.png" height="91" width="6" alt='Number of visits: 565' title='Number of visits: 565' /><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 1094' title='Pages: 1094' /><img align="bottom" src="/awstatsicons/other/vh.png" height="91" width="6" alt='Hits: 7468' title='Hits: 7468' /><img align="bottom" src="/awstatsicons/other/vk.png" height="90" width="6" alt='Bandwidth: 88.80 MB' title='Bandwidth: 88.80 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td><img align="bottom" src="/awstatsicons/other/vu.png" height="1" width="6" alt='Unique visitors: 0' title='Unique visitors: 0' /><img align="bottom" src="/awstatsicons/other/vv.png" height="1" width="6" alt='Number of visits: 0' title='Number of visits: 0' /><img align="bottom" src="/awstatsicons/other/vp.png" height="1" width="6" alt='Pages: 0' title='Pages: 0' /><img align="bottom" src="/awstatsicons/other/vh.png" height="1" width="6" alt='Hits: 0' title='Hits: 0' /><img align="bottom" src="/awstatsicons/other/vk.png" height="1" width="6" alt='Bandwidth: 0' title='Bandwidth: 0' /></td>
<td> </td></tr>
<tr valign="middle"><td> </td><td>Jan<br />2012</td><td>Feb<br />2012</td><td>Mar<br />2012</td><td>Apr<br />2012</td><td>May<br />2012</td><td>Jun<br />2012</td><td>Jul<br />2012</td><td>Aug<br />2012</td><td>Sep<br />2012</td><td>Oct<br />2012</td><td>Nov<br />2012</td><td>Dec<br />2012</td><td> </td></tr>
</table>
<br />
<table>
<tr><td width="80" bgcolor="#ECECEC">Month</td><td width="80" bgcolor="#FFAA66">Unique visitors</td><td width="80" bgcolor="#F4F090">Number of visits</td><td width="80" bgcolor="#4477DD">Pages</td><td width="80" bgcolor="#66DDEE">Hits</td><td width="80" bgcolor="#2EA495">Bandwidth</td></tr>
<tr><td>Jan 2012</td><td>98</td><td>140</td><td>737</td><td>3,551</td><td>24.89 MB</td></tr>
<tr><td>Feb 2012</td><td>158</td><td>187</td><td>691</td><td>3,638</td><td>47.57 MB</td></tr>
<tr><td>Mar 2012</td><td>361</td><td>481</td><td>1,350</td><td>6,789</td><td>88.86 MB</td></tr>
<tr><td>Apr 2012</td><td>420</td><td>565</td><td>1,094</td><td>7,468</td><td>88.80 MB</td></tr>
<tr><td>May 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Jun 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Jul 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Aug 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Sep 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Oct 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Nov 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>Dec 2012</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td bgcolor="#ECECEC">Total</td><td bgcolor="#ECECEC">1,037</td><td bgcolor="#ECECEC">1,373</td><td bgcolor="#ECECEC">3,872</td><td bgcolor="#ECECEC">21,446</td><td bgcolor="#ECECEC">250.12 MB</td></tr>
</table>
<br />
</center>
</td></tr>
</table></td></tr></table><br />
<a name="when"> </a>
<a name="daysofmonth"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Days of month </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="center">
<center>
<table>
<tr valign="bottom">
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="28" width="4" alt='Number of visits: 10' title='Number of visits: 10' /><img align="bottom" src="/awstatsicons/other/vp.png" height="5" width="4" alt='Pages: 20' title='Pages: 20' /><img align="bottom" src="/awstatsicons/other/vh.png" height="29" width="4" alt='Hits: 124' title='Hits: 124' /><img align="bottom" src="/awstatsicons/other/vk.png" height="21" width="4" alt='Bandwidth: 1.43 MB' title='Bandwidth: 1.43 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="22" width="4" alt='Number of visits: 8' title='Number of visits: 8' /><img align="bottom" src="/awstatsicons/other/vp.png" height="6" width="4" alt='Pages: 22' title='Pages: 22' /><img align="bottom" src="/awstatsicons/other/vh.png" height="19" width="4" alt='Hits: 81' title='Hits: 81' /><img align="bottom" src="/awstatsicons/other/vk.png" height="17" width="4" alt='Bandwidth: 1.14 MB' title='Bandwidth: 1.14 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="11" width="4" alt='Number of visits: 4' title='Number of visits: 4' /><img align="bottom" src="/awstatsicons/other/vp.png" height="2" width="4" alt='Pages: 7' title='Pages: 7' /><img align="bottom" src="/awstatsicons/other/vh.png" height="11" width="4" alt='Hits: 44' title='Hits: 44' /><img align="bottom" src="/awstatsicons/other/vk.png" height="9" width="4" alt='Bandwidth: 579.24 KB' title='Bandwidth: 579.24 KB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="33" width="4" alt='Number of visits: 12' title='Number of visits: 12' /><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="4" alt='Pages: 39' title='Pages: 39' /><img align="bottom" src="/awstatsicons/other/vh.png" height="29" width="4" alt='Hits: 121' title='Hits: 121' /><img align="bottom" src="/awstatsicons/other/vk.png" height="22" width="4" alt='Bandwidth: 1.48 MB' title='Bandwidth: 1.48 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="91" width="4" alt='Number of visits: 33' title='Number of visits: 33' /><img align="bottom" src="/awstatsicons/other/vp.png" height="53" width="4" alt='Pages: 227' title='Pages: 227' /><img align="bottom" src="/awstatsicons/other/vh.png" height="73" width="4" alt='Hits: 311' title='Hits: 311' /><img align="bottom" src="/awstatsicons/other/vk.png" height="85" width="4" alt='Bandwidth: 5.85 MB' title='Bandwidth: 5.85 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="36" width="4" alt='Number of visits: 13' title='Number of visits: 13' /><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="4" alt='Pages: 40' title='Pages: 40' /><img align="bottom" src="/awstatsicons/other/vh.png" height="31" width="4" alt='Hits: 132' title='Hits: 132' /><img align="bottom" src="/awstatsicons/other/vk.png" height="36" width="4" alt='Bandwidth: 2.48 MB' title='Bandwidth: 2.48 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="36" width="4" alt='Number of visits: 13' title='Number of visits: 13' /><img align="bottom" src="/awstatsicons/other/vp.png" height="6" width="4" alt='Pages: 22' title='Pages: 22' /><img align="bottom" src="/awstatsicons/other/vh.png" height="30" width="4" alt='Hits: 128' title='Hits: 128' /><img align="bottom" src="/awstatsicons/other/vk.png" height="21" width="4" alt='Bandwidth: 1.44 MB' title='Bandwidth: 1.44 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="22" width="4" alt='Number of visits: 8' title='Number of visits: 8' /><img align="bottom" src="/awstatsicons/other/vp.png" height="4" width="4" alt='Pages: 16' title='Pages: 16' /><img align="bottom" src="/awstatsicons/other/vh.png" height="21" width="4" alt='Hits: 87' title='Hits: 87' /><img align="bottom" src="/awstatsicons/other/vk.png" height="15" width="4" alt='Bandwidth: 996.71 KB' title='Bandwidth: 996.71 KB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="44" width="4" alt='Number of visits: 16' title='Number of visits: 16' /><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="4" alt='Pages: 28' title='Pages: 28' /><img align="bottom" src="/awstatsicons/other/vh.png" height="32" width="4" alt='Hits: 133' title='Hits: 133' /><img align="bottom" src="/awstatsicons/other/vk.png" height="25" width="4" alt='Bandwidth: 1.71 MB' title='Bandwidth: 1.71 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="50" width="4" alt='Number of visits: 18' title='Number of visits: 18' /><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="4" alt='Pages: 49' title='Pages: 49' /><img align="bottom" src="/awstatsicons/other/vh.png" height="62" width="4" alt='Hits: 262' title='Hits: 262' /><img align="bottom" src="/awstatsicons/other/vk.png" height="53" width="4" alt='Bandwidth: 3.61 MB' title='Bandwidth: 3.61 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="58" width="4" alt='Number of visits: 21' title='Number of visits: 21' /><img align="bottom" src="/awstatsicons/other/vp.png" height="17" width="4" alt='Pages: 72' title='Pages: 72' /><img align="bottom" src="/awstatsicons/other/vh.png" height="81" width="4" alt='Hits: 344' title='Hits: 344' /><img align="bottom" src="/awstatsicons/other/vk.png" height="69" width="4" alt='Bandwidth: 4.75 MB' title='Bandwidth: 4.75 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="39" width="4" alt='Number of visits: 14' title='Number of visits: 14' /><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="4" alt='Pages: 41' title='Pages: 41' /><img align="bottom" src="/awstatsicons/other/vh.png" height="51" width="4" alt='Hits: 218' title='Hits: 218' /><img align="bottom" src="/awstatsicons/other/vk.png" height="40" width="4" alt='Bandwidth: 2.71 MB' title='Bandwidth: 2.71 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="28" width="4" alt='Number of visits: 10' title='Number of visits: 10' /><img align="bottom" src="/awstatsicons/other/vp.png" height="4" width="4" alt='Pages: 17' title='Pages: 17' /><img align="bottom" src="/awstatsicons/other/vh.png" height="38" width="4" alt='Hits: 162' title='Hits: 162' /><img align="bottom" src="/awstatsicons/other/vk.png" height="28" width="4" alt='Bandwidth: 1.91 MB' title='Bandwidth: 1.91 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="50" width="4" alt='Number of visits: 18' title='Number of visits: 18' /><img align="bottom" src="/awstatsicons/other/vp.png" height="11" width="4" alt='Pages: 44' title='Pages: 44' /><img align="bottom" src="/awstatsicons/other/vh.png" height="64" width="4" alt='Hits: 274' title='Hits: 274' /><img align="bottom" src="/awstatsicons/other/vk.png" height="49" width="4" alt='Bandwidth: 3.37 MB' title='Bandwidth: 3.37 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="17" width="4" alt='Number of visits: 6' title='Number of visits: 6' /><img align="bottom" src="/awstatsicons/other/vp.png" height="6" width="4" alt='Pages: 22' title='Pages: 22' /><img align="bottom" src="/awstatsicons/other/vh.png" height="35" width="4" alt='Hits: 148' title='Hits: 148' /><img align="bottom" src="/awstatsicons/other/vk.png" height="28" width="4" alt='Bandwidth: 1.90 MB' title='Bandwidth: 1.90 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="39" width="4" alt='Number of visits: 14' title='Number of visits: 14' /><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="4" alt='Pages: 40' title='Pages: 40' /><img align="bottom" src="/awstatsicons/other/vh.png" height="61" width="4" alt='Hits: 261' title='Hits: 261' /><img align="bottom" src="/awstatsicons/other/vk.png" height="51" width="4" alt='Bandwidth: 3.48 MB' title='Bandwidth: 3.48 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="39" width="4" alt='Number of visits: 14' title='Number of visits: 14' /><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="4" alt='Pages: 48' title='Pages: 48' /><img align="bottom" src="/awstatsicons/other/vh.png" height="56" width="4" alt='Hits: 240' title='Hits: 240' /><img align="bottom" src="/awstatsicons/other/vk.png" height="50" width="4" alt='Bandwidth: 3.45 MB' title='Bandwidth: 3.45 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="28" width="4" alt='Number of visits: 10' title='Number of visits: 10' /><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="4" alt='Pages: 31' title='Pages: 31' /><img align="bottom" src="/awstatsicons/other/vh.png" height="37" width="4" alt='Hits: 155' title='Hits: 155' /><img align="bottom" src="/awstatsicons/other/vk.png" height="29" width="4" alt='Bandwidth: 1.95 MB' title='Bandwidth: 1.95 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="44" width="4" alt='Number of visits: 16' title='Number of visits: 16' /><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="4" alt='Pages: 29' title='Pages: 29' /><img align="bottom" src="/awstatsicons/other/vh.png" height="56" width="4" alt='Hits: 239' title='Hits: 239' /><img align="bottom" src="/awstatsicons/other/vk.png" height="39" width="4" alt='Bandwidth: 2.67 MB' title='Bandwidth: 2.67 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="58" width="4" alt='Number of visits: 21' title='Number of visits: 21' /><img align="bottom" src="/awstatsicons/other/vp.png" height="11" width="4" alt='Pages: 45' title='Pages: 45' /><img align="bottom" src="/awstatsicons/other/vh.png" height="62" width="4" alt='Hits: 265' title='Hits: 265' /><img align="bottom" src="/awstatsicons/other/vk.png" height="49" width="4" alt='Bandwidth: 3.39 MB' title='Bandwidth: 3.39 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="50" width="4" alt='Number of visits: 18' title='Number of visits: 18' /><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="4" alt='Pages: 33' title='Pages: 33' /><img align="bottom" src="/awstatsicons/other/vh.png" height="56" width="4" alt='Hits: 236' title='Hits: 236' /><img align="bottom" src="/awstatsicons/other/vk.png" height="39" width="4" alt='Bandwidth: 2.65 MB' title='Bandwidth: 2.65 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="63" width="4" alt='Number of visits: 23' title='Number of visits: 23' /><img align="bottom" src="/awstatsicons/other/vp.png" height="15" width="4" alt='Pages: 63' title='Pages: 63' /><img align="bottom" src="/awstatsicons/other/vh.png" height="88" width="4" alt='Hits: 377' title='Hits: 377' /><img align="bottom" src="/awstatsicons/other/vk.png" height="71" width="4" alt='Bandwidth: 4.91 MB' title='Bandwidth: 4.91 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="52" width="4" alt='Number of visits: 19' title='Number of visits: 19' /><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="4" alt='Pages: 38' title='Pages: 38' /><img align="bottom" src="/awstatsicons/other/vh.png" height="59" width="4" alt='Hits: 249' title='Hits: 249' /><img align="bottom" src="/awstatsicons/other/vk.png" height="40" width="4" alt='Bandwidth: 2.72 MB' title='Bandwidth: 2.72 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="66" width="4" alt='Number of visits: 24' title='Number of visits: 24' /><img align="bottom" src="/awstatsicons/other/vp.png" height="11" width="4" alt='Pages: 44' title='Pages: 44' /><img align="bottom" src="/awstatsicons/other/vh.png" height="61" width="4" alt='Hits: 258' title='Hits: 258' /><img align="bottom" src="/awstatsicons/other/vk.png" height="45" width="4" alt='Bandwidth: 3.11 MB' title='Bandwidth: 3.11 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="31" width="4" alt='Number of visits: 11' title='Number of visits: 11' /><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="4" alt='Pages: 26' title='Pages: 26' /><img align="bottom" src="/awstatsicons/other/vh.png" height="47" width="4" alt='Hits: 199' title='Hits: 199' /><img align="bottom" src="/awstatsicons/other/vk.png" height="36" width="4" alt='Bandwidth: 2.48 MB' title='Bandwidth: 2.48 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="33" width="4" alt='Number of visits: 12' title='Number of visits: 12' /><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="4" alt='Pages: 31' title='Pages: 31' /><img align="bottom" src="/awstatsicons/other/vh.png" height="46" width="4" alt='Hits: 197' title='Hits: 197' /><img align="bottom" src="/awstatsicons/other/vk.png" height="38" width="4" alt='Bandwidth: 2.61 MB' title='Bandwidth: 2.61 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="74" width="4" alt='Number of visits: 27' title='Number of visits: 27' /><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="4" alt='Pages: 57' title='Pages: 57' /><img align="bottom" src="/awstatsicons/other/vh.png" height="78" width="4" alt='Hits: 334' title='Hits: 334' /><img align="bottom" src="/awstatsicons/other/vk.png" height="60" width="4" alt='Bandwidth: 4.10 MB' title='Bandwidth: 4.10 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="44" width="4" alt='Number of visits: 16' title='Number of visits: 16' /><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="4" alt='Pages: 30' title='Pages: 30' /><img align="bottom" src="/awstatsicons/other/vh.png" height="45" width="4" alt='Hits: 189' title='Hits: 189' /><img align="bottom" src="/awstatsicons/other/vk.png" height="33" width="4" alt='Bandwidth: 2.26 MB' title='Bandwidth: 2.26 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="66" width="4" alt='Number of visits: 24' title='Number of visits: 24' /><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="4" alt='Pages: 60' title='Pages: 60' /><img align="bottom" src="/awstatsicons/other/vh.png" height="77" width="4" alt='Hits: 330' title='Hits: 330' /><img align="bottom" src="/awstatsicons/other/vk.png" height="64" width="4" alt='Bandwidth: 4.38 MB' title='Bandwidth: 4.38 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="44" width="4" alt='Number of visits: 16' title='Number of visits: 16' /><img align="bottom" src="/awstatsicons/other/vp.png" height="17" width="4" alt='Pages: 70' title='Pages: 70' /><img align="bottom" src="/awstatsicons/other/vh.png" height="91" width="4" alt='Hits: 386' title='Hits: 386' /><img align="bottom" src="/awstatsicons/other/vk.png" height="91" width="4" alt='Bandwidth: 6.25 MB' title='Bandwidth: 6.25 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vv.png" height="33" width="4" alt='Number of visits: 12' title='Number of visits: 12' /><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="4" alt='Pages: 39' title='Pages: 39' /><img align="bottom" src="/awstatsicons/other/vh.png" height="72" width="4" alt='Hits: 305' title='Hits: 305' /><img align="bottom" src="/awstatsicons/other/vk.png" height="46" width="4" alt='Bandwidth: 3.13 MB' title='Bandwidth: 3.13 MB' /></td>
<td> </td><td><img align="bottom" src="/awstatsicons/other/vv.png" height="43" width="4" alt='Number of visits: 15.52' title='Number of visits: 15.52' /><img align="bottom" src="/awstatsicons/other/vp.png" height="11" width="4" alt='Pages: 43.55' title='Pages: 43.55' /><img align="bottom" src="/awstatsicons/other/vh.png" height="52" width="4" alt='Hits: 219.00' title='Hits: 219.00' /><img align="bottom" src="/awstatsicons/other/vk.png" height="42" width="4" alt='Bandwidth: 3005796.10' title='Bandwidth: 3005796.10' /></td>
</tr>
<tr valign="middle"><td>01<br /><span style="font-size: 9px;">Mar</span></td>
<td>02<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">03<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">04<br /><span style="font-size: 9px;">Mar</span></td>
<td>05<br /><span style="font-size: 9px;">Mar</span></td>
<td>06<br /><span style="font-size: 9px;">Mar</span></td>
<td>07<br /><span style="font-size: 9px;">Mar</span></td>
<td>08<br /><span style="font-size: 9px;">Mar</span></td>
<td>09<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">10<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">11<br /><span style="font-size: 9px;">Mar</span></td>
<td>12<br /><span style="font-size: 9px;">Mar</span></td>
<td>13<br /><span style="font-size: 9px;">Mar</span></td>
<td>14<br /><span style="font-size: 9px;">Mar</span></td>
<td>15<br /><span style="font-size: 9px;">Mar</span></td>
<td>16<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">17<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">18<br /><span style="font-size: 9px;">Mar</span></td>
<td>19<br /><span style="font-size: 9px;">Mar</span></td>
<td>20<br /><span style="font-size: 9px;">Mar</span></td>
<td>21<br /><span style="font-size: 9px;">Mar</span></td>
<td>22<br /><span style="font-size: 9px;">Mar</span></td>
<td>23<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">24<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">25<br /><span style="font-size: 9px;">Mar</span></td>
<td>26<br /><span style="font-size: 9px;">Mar</span></td>
<td>27<br /><span style="font-size: 9px;">Mar</span></td>
<td>28<br /><span style="font-size: 9px;">Mar</span></td>
<td>29<br /><span style="font-size: 9px;">Mar</span></td>
<td>30<br /><span style="font-size: 9px;">Mar</span></td>
<td bgcolor="#EAEAEA">31<br /><span style="font-size: 9px;">Mar</span></td>
<td> </td><td valign="middle">Average</td>
</tr>
</table>
<br />
<table>
<tr><td width="80" bgcolor="#ECECEC">Day</td><td width="80" bgcolor="#F4F090">Number of visits</td><td width="80" bgcolor="#4477DD">Pages</td><td width="80" bgcolor="#66DDEE">Hits</td><td width="80" bgcolor="#2EA495">Bandwidth</td></tr><tr><td>01 Mar 2012</td><td>10</td><td>20</td><td>124</td><td>1.43 MB</td></tr>
<tr><td>02 Mar 2012</td><td>8</td><td>22</td><td>81</td><td>1.14 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>03 Mar 2012</td><td>4</td><td>7</td><td>44</td><td>579.24 KB</td></tr>
<tr bgcolor="#EAEAEA"><td>04 Mar 2012</td><td>12</td><td>39</td><td>121</td><td>1.48 MB</td></tr>
<tr><td>05 Mar 2012</td><td>33</td><td>227</td><td>311</td><td>5.85 MB</td></tr>
<tr><td>06 Mar 2012</td><td>13</td><td>40</td><td>132</td><td>2.48 MB</td></tr>
<tr><td>07 Mar 2012</td><td>13</td><td>22</td><td>128</td><td>1.44 MB</td></tr>
<tr><td>08 Mar 2012</td><td>8</td><td>16</td><td>87</td><td>996.71 KB</td></tr>
<tr><td>09 Mar 2012</td><td>16</td><td>28</td><td>133</td><td>1.71 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>10 Mar 2012</td><td>18</td><td>49</td><td>262</td><td>3.61 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>11 Mar 2012</td><td>21</td><td>72</td><td>344</td><td>4.75 MB</td></tr>
<tr><td>12 Mar 2012</td><td>14</td><td>41</td><td>218</td><td>2.71 MB</td></tr>
<tr><td>13 Mar 2012</td><td>10</td><td>17</td><td>162</td><td>1.91 MB</td></tr>
<tr><td>14 Mar 2012</td><td>18</td><td>44</td><td>274</td><td>3.37 MB</td></tr>
<tr><td>15 Mar 2012</td><td>6</td><td>22</td><td>148</td><td>1.90 MB</td></tr>
<tr><td>16 Mar 2012</td><td>14</td><td>40</td><td>261</td><td>3.48 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>17 Mar 2012</td><td>14</td><td>48</td><td>240</td><td>3.45 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>18 Mar 2012</td><td>10</td><td>31</td><td>155</td><td>1.95 MB</td></tr>
<tr><td>19 Mar 2012</td><td>16</td><td>29</td><td>239</td><td>2.67 MB</td></tr>
<tr><td>20 Mar 2012</td><td>21</td><td>45</td><td>265</td><td>3.39 MB</td></tr>
<tr><td>21 Mar 2012</td><td>18</td><td>33</td><td>236</td><td>2.65 MB</td></tr>
<tr><td>22 Mar 2012</td><td>23</td><td>63</td><td>377</td><td>4.91 MB</td></tr>
<tr><td>23 Mar 2012</td><td>19</td><td>38</td><td>249</td><td>2.72 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>24 Mar 2012</td><td>24</td><td>44</td><td>258</td><td>3.11 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>25 Mar 2012</td><td>11</td><td>26</td><td>199</td><td>2.48 MB</td></tr>
<tr><td>26 Mar 2012</td><td>12</td><td>31</td><td>197</td><td>2.61 MB</td></tr>
<tr><td>27 Mar 2012</td><td>27</td><td>57</td><td>334</td><td>4.10 MB</td></tr>
<tr><td>28 Mar 2012</td><td>16</td><td>30</td><td>189</td><td>2.26 MB</td></tr>
<tr><td>29 Mar 2012</td><td>24</td><td>60</td><td>330</td><td>4.38 MB</td></tr>
<tr><td>30 Mar 2012</td><td>16</td><td>70</td><td>386</td><td>6.25 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>31 Mar 2012</td><td>12</td><td>39</td><td>305</td><td>3.13 MB</td></tr>
<tr bgcolor="#ECECEC"><td>Average</td><td>15</td><td>43</td><td>219</td><td>2.87 MB</td></tr>
<tr bgcolor="#ECECEC"><td>Total</td><td>481</td><td>1,350</td><td>6,789</td><td>88.86 MB</td></tr>
</table>
<br /></center>
</td></tr>
</table></td></tr></table><br />
<a name="daysofweek"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Days of week </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="center"><center>
<table>
<tr valign="bottom">
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="31" width="6" alt='Pages: 82' title='Pages: 82' /><img align="bottom" src="/awstatsicons/other/vh.png" height="91" width="6" alt='Hits: 241.25' title='Hits: 241.25' /><img align="bottom" src="/awstatsicons/other/vk.png" height="91" width="6" alt='Bandwidth: 3.46 MB' title='Bandwidth: 3.46 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="15" width="6" alt='Pages: 39.75' title='Pages: 39.75' /><img align="bottom" src="/awstatsicons/other/vh.png" height="84" width="6" alt='Hits: 223.25' title='Hits: 223.25' /><img align="bottom" src="/awstatsicons/other/vk.png" height="78" width="6" alt='Bandwidth: 2.97 MB' title='Bandwidth: 2.97 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="13" width="6" alt='Pages: 32.25' title='Pages: 32.25' /><img align="bottom" src="/awstatsicons/other/vh.png" height="78" width="6" alt='Hits: 206.75' title='Hits: 206.75' /><img align="bottom" src="/awstatsicons/other/vk.png" height="64" width="6" alt='Bandwidth: 2.43 MB' title='Bandwidth: 2.43 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 36.20' title='Pages: 36.20' /><img align="bottom" src="/awstatsicons/other/vh.png" height="80" width="6" alt='Hits: 213.20' title='Hits: 213.20' /><img align="bottom" src="/awstatsicons/other/vk.png" height="71" width="6" alt='Bandwidth: 2.72 MB' title='Bandwidth: 2.72 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="15" width="6" alt='Pages: 39.60' title='Pages: 39.60' /><img align="bottom" src="/awstatsicons/other/vh.png" height="83" width="6" alt='Hits: 222' title='Hits: 222' /><img align="bottom" src="/awstatsicons/other/vk.png" height="80" width="6" alt='Bandwidth: 3.06 MB' title='Bandwidth: 3.06 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 37.40' title='Pages: 37.40' /><img align="bottom" src="/awstatsicons/other/vh.png" height="83" width="6" alt='Hits: 221.80' title='Hits: 221.80' /><img align="bottom" src="/awstatsicons/other/vk.png" height="73" width="6" alt='Bandwidth: 2.77 MB' title='Bandwidth: 2.77 MB' /></td>
<td valign="bottom"><img align="bottom" src="/awstatsicons/other/vp.png" height="16" width="6" alt='Pages: 42' title='Pages: 42' /><img align="bottom" src="/awstatsicons/other/vh.png" height="77" width="6" alt='Hits: 204.75' title='Hits: 204.75' /><img align="bottom" src="/awstatsicons/other/vk.png" height="70" width="6" alt='Bandwidth: 2.67 MB' title='Bandwidth: 2.67 MB' /></td>
</tr>
<tr>
<td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td bgcolor="#EAEAEA">Sat</td><td bgcolor="#EAEAEA">Sun</td></tr>
</table>
<br />
<table>
<tr><td width="80" bgcolor="#ECECEC">Day</td><td width="80" bgcolor="#4477DD">Pages</td><td width="80" bgcolor="#66DDEE">Hits</td><td width="80" bgcolor="#2EA495">Bandwidth</td></tr><tr><td>Mon</td><td>82</td><td>241</td><td>3.46 MB</td></tr>
<tr><td>Tue</td><td>39</td><td>223</td><td>2.97 MB</td></tr>
<tr><td>Wed</td><td>32</td><td>206</td><td>2.43 MB</td></tr>
<tr><td>Thu</td><td>36</td><td>213</td><td>2.72 MB</td></tr>
<tr><td>Fri</td><td>39</td><td>222</td><td>3.06 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>Sat</td><td>37</td><td>221</td><td>2.77 MB</td></tr>
<tr bgcolor="#EAEAEA"><td>Sun</td><td>42</td><td>204</td><td>2.67 MB</td></tr>
</table>
<br />
</center></td></tr>
</table></td></tr></table><br />
<a name="hours"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Hours </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="center">
<center>
<table>
<tr valign="bottom">
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="6" alt='Pages: 70' title='Pages: 70' /><img align="bottom" src="/awstatsicons/other/vh.png" height="23" width="6" alt='Hits: 134' title='Hits: 134' /><img align="bottom" src="/awstatsicons/other/vk.png" height="41" width="6" alt='Bandwidth: 2.85 MB' title='Bandwidth: 2.85 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="6" alt='Pages: 68' title='Pages: 68' /><img align="bottom" src="/awstatsicons/other/vh.png" height="34" width="6" alt='Hits: 199' title='Hits: 199' /><img align="bottom" src="/awstatsicons/other/vk.png" height="41" width="6" alt='Bandwidth: 2.88 MB' title='Bandwidth: 2.88 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="6" alt='Pages: 58' title='Pages: 58' /><img align="bottom" src="/awstatsicons/other/vh.png" height="32" width="6" alt='Hits: 183' title='Hits: 183' /><img align="bottom" src="/awstatsicons/other/vk.png" height="37" width="6" alt='Bandwidth: 2.54 MB' title='Bandwidth: 2.54 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="6" alt='Pages: 51' title='Pages: 51' /><img align="bottom" src="/awstatsicons/other/vh.png" height="42" width="6" alt='Hits: 245' title='Hits: 245' /><img align="bottom" src="/awstatsicons/other/vk.png" height="68" width="6" alt='Bandwidth: 4.70 MB' title='Bandwidth: 4.70 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="13" width="6" alt='Pages: 71' title='Pages: 71' /><img align="bottom" src="/awstatsicons/other/vh.png" height="35" width="6" alt='Hits: 205' title='Hits: 205' /><img align="bottom" src="/awstatsicons/other/vk.png" height="52" width="6" alt='Bandwidth: 3.60 MB' title='Bandwidth: 3.60 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="4" width="6" alt='Pages: 21' title='Pages: 21' /><img align="bottom" src="/awstatsicons/other/vh.png" height="20" width="6" alt='Hits: 113' title='Hits: 113' /><img align="bottom" src="/awstatsicons/other/vk.png" height="19" width="6" alt='Bandwidth: 1.28 MB' title='Bandwidth: 1.28 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="6" alt='Pages: 46' title='Pages: 46' /><img align="bottom" src="/awstatsicons/other/vh.png" height="39" width="6" alt='Hits: 225' title='Hits: 225' /><img align="bottom" src="/awstatsicons/other/vk.png" height="41" width="6" alt='Bandwidth: 2.84 MB' title='Bandwidth: 2.84 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="6" alt='Pages: 41' title='Pages: 41' /><img align="bottom" src="/awstatsicons/other/vh.png" height="39" width="6" alt='Hits: 226' title='Hits: 226' /><img align="bottom" src="/awstatsicons/other/vk.png" height="37" width="6" alt='Bandwidth: 2.58 MB' title='Bandwidth: 2.58 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="10" width="6" alt='Pages: 54' title='Pages: 54' /><img align="bottom" src="/awstatsicons/other/vh.png" height="69" width="6" alt='Hits: 405' title='Hits: 405' /><img align="bottom" src="/awstatsicons/other/vk.png" height="71" width="6" alt='Bandwidth: 4.93 MB' title='Bandwidth: 4.93 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="6" alt='Pages: 52' title='Pages: 52' /><img align="bottom" src="/awstatsicons/other/vh.png" height="45" width="6" alt='Hits: 262' title='Hits: 262' /><img align="bottom" src="/awstatsicons/other/vk.png" height="50" width="6" alt='Bandwidth: 3.47 MB' title='Bandwidth: 3.47 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 79' title='Pages: 79' /><img align="bottom" src="/awstatsicons/other/vh.png" height="65" width="6" alt='Hits: 382' title='Hits: 382' /><img align="bottom" src="/awstatsicons/other/vk.png" height="71" width="6" alt='Bandwidth: 4.97 MB' title='Bandwidth: 4.97 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="13" width="6" alt='Pages: 76' title='Pages: 76' /><img align="bottom" src="/awstatsicons/other/vh.png" height="74" width="6" alt='Hits: 434' title='Hits: 434' /><img align="bottom" src="/awstatsicons/other/vk.png" height="75" width="6" alt='Bandwidth: 5.23 MB' title='Bandwidth: 5.23 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 78' title='Pages: 78' /><img align="bottom" src="/awstatsicons/other/vh.png" height="91" width="6" alt='Hits: 529' title='Hits: 529' /><img align="bottom" src="/awstatsicons/other/vk.png" height="89" width="6" alt='Bandwidth: 6.21 MB' title='Bandwidth: 6.21 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="6" alt='Pages: 46' title='Pages: 46' /><img align="bottom" src="/awstatsicons/other/vh.png" height="51" width="6" alt='Hits: 295' title='Hits: 295' /><img align="bottom" src="/awstatsicons/other/vk.png" height="53" width="6" alt='Bandwidth: 3.65 MB' title='Bandwidth: 3.65 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="8" width="6" alt='Pages: 46' title='Pages: 46' /><img align="bottom" src="/awstatsicons/other/vh.png" height="54" width="6" alt='Hits: 312' title='Hits: 312' /><img align="bottom" src="/awstatsicons/other/vk.png" height="51" width="6" alt='Bandwidth: 3.53 MB' title='Bandwidth: 3.53 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="6" alt='Pages: 65' title='Pages: 65' /><img align="bottom" src="/awstatsicons/other/vh.png" height="69" width="6" alt='Hits: 400' title='Hits: 400' /><img align="bottom" src="/awstatsicons/other/vk.png" height="73" width="6" alt='Bandwidth: 5.12 MB' title='Bandwidth: 5.12 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="9" width="6" alt='Pages: 50' title='Pages: 50' /><img align="bottom" src="/awstatsicons/other/vh.png" height="46" width="6" alt='Hits: 265' title='Hits: 265' /><img align="bottom" src="/awstatsicons/other/vk.png" height="51" width="6" alt='Bandwidth: 3.57 MB' title='Bandwidth: 3.57 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="5" width="6" alt='Pages: 27' title='Pages: 27' /><img align="bottom" src="/awstatsicons/other/vh.png" height="34" width="6" alt='Hits: 198' title='Hits: 198' /><img align="bottom" src="/awstatsicons/other/vk.png" height="30" width="6" alt='Bandwidth: 2.09 MB' title='Bandwidth: 2.09 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="7" width="6" alt='Pages: 37' title='Pages: 37' /><img align="bottom" src="/awstatsicons/other/vh.png" height="42" width="6" alt='Hits: 245' title='Hits: 245' /><img align="bottom" src="/awstatsicons/other/vk.png" height="41" width="6" alt='Bandwidth: 2.83 MB' title='Bandwidth: 2.83 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="6" alt='Pages: 69' title='Pages: 69' /><img align="bottom" src="/awstatsicons/other/vh.png" height="67" width="6" alt='Hits: 392' title='Hits: 392' /><img align="bottom" src="/awstatsicons/other/vk.png" height="54" width="6" alt='Bandwidth: 3.76 MB' title='Bandwidth: 3.76 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="14" width="6" alt='Pages: 81' title='Pages: 81' /><img align="bottom" src="/awstatsicons/other/vh.png" height="72" width="6" alt='Hits: 420' title='Hits: 420' /><img align="bottom" src="/awstatsicons/other/vk.png" height="91" width="6" alt='Bandwidth: 6.31 MB' title='Bandwidth: 6.31 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="11" width="6" alt='Pages: 63' title='Pages: 63' /><img align="bottom" src="/awstatsicons/other/vh.png" height="50" width="6" alt='Hits: 293' title='Hits: 293' /><img align="bottom" src="/awstatsicons/other/vk.png" height="56" width="6" alt='Bandwidth: 3.88 MB' title='Bandwidth: 3.88 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="6" width="6" alt='Pages: 34' title='Pages: 34' /><img align="bottom" src="/awstatsicons/other/vh.png" height="38" width="6" alt='Hits: 218' title='Hits: 218' /><img align="bottom" src="/awstatsicons/other/vk.png" height="37" width="6" alt='Bandwidth: 2.58 MB' title='Bandwidth: 2.58 MB' /></td>
<td><img align="bottom" src="/awstatsicons/other/vp.png" height="12" width="6" alt='Pages: 67' title='Pages: 67' /><img align="bottom" src="/awstatsicons/other/vh.png" height="36" width="6" alt='Hits: 209' title='Hits: 209' /><img align="bottom" src="/awstatsicons/other/vk.png" height="50" width="6" alt='Bandwidth: 3.48 MB' title='Bandwidth: 3.48 MB' /></td>
</tr>
<tr><th width="19">0</th>
<th width="19">1</th>
<th width="19">2</th>
<th width="19">3</th>
<th width="19">4</th>
<th width="19">5</th>
<th width="19">6</th>
<th width="19">7</th>
<th width="19">8</th>
<th width="19">9</th>
<th width="19">10</th>
<th width="19">11</th>
<th width="19">12</th>
<th width="19">13</th>
<th width="19">14</th>
<th width="19">15</th>
<th width="19">16</th>
<th width="19">17</th>
<th width="19">18</th>
<th width="19">19</th>
<th width="19">20</th>
<th width="19">21</th>
<th width="19">22</th>
<th width="19">23</th>
</tr>
<tr>
<td><img src="/awstatsicons/clock/hr1.png" width="12" alt="0:00 - 1:00 am" /></td>
<td><img src="/awstatsicons/clock/hr2.png" width="12" alt="1:00 - 2:00 am" /></td>
<td><img src="/awstatsicons/clock/hr3.png" width="12" alt="2:00 - 3:00 am" /></td>
<td><img src="/awstatsicons/clock/hr4.png" width="12" alt="3:00 - 4:00 am" /></td>
<td><img src="/awstatsicons/clock/hr5.png" width="12" alt="4:00 - 5:00 am" /></td>
<td><img src="/awstatsicons/clock/hr6.png" width="12" alt="5:00 - 6:00 am" /></td>
<td><img src="/awstatsicons/clock/hr7.png" width="12" alt="6:00 - 7:00 am" /></td>
<td><img src="/awstatsicons/clock/hr8.png" width="12" alt="7:00 - 8:00 am" /></td>
<td><img src="/awstatsicons/clock/hr9.png" width="12" alt="8:00 - 9:00 am" /></td>
<td><img src="/awstatsicons/clock/hr10.png" width="12" alt="9:00 - 10:00 am" /></td>
<td><img src="/awstatsicons/clock/hr11.png" width="12" alt="10:00 - 11:00 am" /></td>
<td><img src="/awstatsicons/clock/hr12.png" width="12" alt="11:00 - 12:00 am" /></td>
<td><img src="/awstatsicons/clock/hr1.png" width="12" alt="0:00 - 1:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr2.png" width="12" alt="1:00 - 2:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr3.png" width="12" alt="2:00 - 3:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr4.png" width="12" alt="3:00 - 4:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr5.png" width="12" alt="4:00 - 5:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr6.png" width="12" alt="5:00 - 6:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr7.png" width="12" alt="6:00 - 7:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr8.png" width="12" alt="7:00 - 8:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr9.png" width="12" alt="8:00 - 9:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr10.png" width="12" alt="9:00 - 10:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr11.png" width="12" alt="10:00 - 11:00 pm" /></td>
<td><img src="/awstatsicons/clock/hr12.png" width="12" alt="11:00 - 12:00 pm" /></td>
</tr>
</table>
<br />
<table width="650"><tr>
<td align="center"><center>
<table>
<tr><td width="80" bgcolor="#ECECEC">Hours</td><td width="80" bgcolor="#4477DD">Pages</td><td width="80" bgcolor="#66DDEE">Hits</td><td width="80" bgcolor="#2EA495">Bandwidth</td></tr><tr><td>00</td><td>70</td><td>134</td><td>2.85 MB</td></tr>
<tr><td>01</td><td>68</td><td>199</td><td>2.88 MB</td></tr>
<tr><td>02</td><td>58</td><td>183</td><td>2.54 MB</td></tr>
<tr><td>03</td><td>51</td><td>245</td><td>4.70 MB</td></tr>
<tr><td>04</td><td>71</td><td>205</td><td>3.60 MB</td></tr>
<tr><td>05</td><td>21</td><td>113</td><td>1.28 MB</td></tr>
<tr><td>06</td><td>46</td><td>225</td><td>2.84 MB</td></tr>
<tr><td>07</td><td>41</td><td>226</td><td>2.58 MB</td></tr>
<tr><td>08</td><td>54</td><td>405</td><td>4.93 MB</td></tr>
<tr><td>09</td><td>52</td><td>262</td><td>3.47 MB</td></tr>
<tr><td>10</td><td>79</td><td>382</td><td>4.97 MB</td></tr>
<tr><td>11</td><td>76</td><td>434</td><td>5.23 MB</td></tr>
</table>
</center></td><td width="10"> </td><td align="center"><center>
<table>
<tr><td width="80" bgcolor="#ECECEC">Hours</td><td width="80" bgcolor="#4477DD">Pages</td><td width="80" bgcolor="#66DDEE">Hits</td><td width="80" bgcolor="#2EA495">Bandwidth</td></tr>
<tr><td>12</td><td>78</td><td>529</td><td>6.21 MB</td></tr>
<tr><td>13</td><td>46</td><td>295</td><td>3.65 MB</td></tr>
<tr><td>14</td><td>46</td><td>312</td><td>3.53 MB</td></tr>
<tr><td>15</td><td>65</td><td>400</td><td>5.12 MB</td></tr>
<tr><td>16</td><td>50</td><td>265</td><td>3.57 MB</td></tr>
<tr><td>17</td><td>27</td><td>198</td><td>2.09 MB</td></tr>
<tr><td>18</td><td>37</td><td>245</td><td>2.83 MB</td></tr>
<tr><td>19</td><td>69</td><td>392</td><td>3.76 MB</td></tr>
<tr><td>20</td><td>81</td><td>420</td><td>6.31 MB</td></tr>
<tr><td>21</td><td>63</td><td>293</td><td>3.88 MB</td></tr>
<tr><td>22</td><td>34</td><td>218</td><td>2.58 MB</td></tr>
<tr><td>23</td><td>67</td><td>209</td><td>3.48 MB</td></tr>
</table>
</center></td></tr></table>
<br />
</center></td></tr>
</table></td></tr></table><br />
<a name="who"> </a>
<a name="countries"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Visitors domains/countries (Top 10) - <a href="awstats.mc-aster.com.alldomains.032012.html" target="awstatsbis">Full list</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th width="32"> </th><th colspan="2">Domains/Countries</th><th bgcolor="#4477DD" width="80">Pages</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#2EA495" width="80">Bandwidth</th><th> </th></tr>
<tr><td width="32"><img src="/awstatsicons/flags/ip.png" height="14" alt='Unknown' title='Unknown' /></td><td class="aws">Unknown</td><td>ip</td><td>1,350</td><td>6,789</td><td>88.86 MB</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="52" height="5" alt='' title='' /><br />
<img src="/awstatsicons/other/hh.png" width="261" height="5" alt='' title='' /><br />
<img src="/awstatsicons/other/hk.png" width="261" height="5" alt='' title='' /></td></tr>
<tr><td width="32"> </td><td colspan="2" class="aws"><span style="color: #666688">Others</span></td><td>0</td><td>0</td><td>0</td><td class="aws"> </td></tr>
</table></td></tr></table><br />
<a name="visitors"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Hosts (Top 10) - <a href="awstats.mc-aster.com.allhosts.032012.html" target="awstatsbis">Full list</a> - <a href="awstats.mc-aster.com.lasthosts.032012.html" target="awstatsbis">Last visit</a> - <a href="awstats.mc-aster.com.unknownip.032012.html" target="awstatsbis">Unresolved IP Address</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>Hosts : 0 Known, 365 Unknown (unresolved ip)<br />361 Unique visitors</th><th bgcolor="#4477DD" width="80">Pages</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#2EA495" width="80">Bandwidth</th><th width="120">Last visit</th></tr>
<tr><td class="aws">91.224.161.250</td><td>49</td><td>49</td><td>1.14 MB</td><td nowrap="nowrap">05 Mar 2012 - 21:06</td></tr>
<tr><td class="aws">109.230.216.60</td><td>32</td><td>32</td><td>718.86 KB</td><td nowrap="nowrap">05 Mar 2012 - 19:03</td></tr>
<tr><td class="aws">109.230.216.225</td><td>32</td><td>32</td><td>736.31 KB</td><td nowrap="nowrap">05 Mar 2012 - 19:57</td></tr>
<tr><td class="aws">94.244.157.122</td><td>30</td><td>161</td><td>2.49 MB</td><td nowrap="nowrap">22 Mar 2012 - 01:11</td></tr>
<tr><td class="aws">92.249.127.111</td><td>26</td><td>26</td><td>566.11 KB</td><td nowrap="nowrap">12 Mar 2012 - 19:05</td></tr>
<tr><td class="aws">95.167.117.130</td><td>20</td><td>48</td><td>1.24 MB</td><td nowrap="nowrap">27 Mar 2012 - 04:33</td></tr>
<tr><td class="aws">188.92.0.198</td><td>20</td><td>66</td><td>2.22 MB</td><td nowrap="nowrap">30 Mar 2012 - 03:15</td></tr>
<tr><td class="aws">178.90.232.143</td><td>19</td><td>43</td><td>985.50 KB</td><td nowrap="nowrap">11 Mar 2012 - 12:47</td></tr>
<tr><td class="aws">92.241.124.89</td><td>17</td><td>90</td><td>1006.01 KB</td><td nowrap="nowrap">31 Mar 2012 - 20:46</td></tr>
<tr><td class="aws">77.35.225.233</td><td>17</td><td>43</td><td>984.08 KB</td><td nowrap="nowrap">29 Mar 2012 - 04:09</td></tr>
<tr><td class="aws"><span style="color: #666688">Others</span></td><td>1,088</td><td>6,199</td><td>76.90 MB</td><td> </td></tr>
</table></td></tr></table><br />
<a name="robots"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Robots/Spiders visitors (Top 10) - <a href="awstats.mc-aster.com.allrobots.032012.html" target="awstatsbis">Full list</a> - <a href="awstats.mc-aster.com.lastrobots.032012.html" target="awstatsbis">Last visit</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>18 different robots*</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#2EA495" width="80">Bandwidth</th><th width="120">Last visit</th></tr>
<tr><td class="aws">Yandex bot</td><td>682</td><td>14.01 MB</td><td>31 Mar 2012 - 23:33</td></tr>
<tr><td class="aws"><a href="http:
<tr><td class="aws"><a href="http:
<tr><td class="aws">Mail.ru bot</td><td>39</td><td>859.58 KB</td><td>31 Mar 2012 - 14:03</td></tr>
<tr><td class="aws">Unknown robot (identified by 'bot*')</td><td>34</td><td>788.15 KB</td><td>31 Mar 2012 - 21:00</td></tr>
<tr><td class="aws"><a href="http:
<tr><td class="aws">Unknown robot (identified by 'crawl')</td><td>15</td><td>399.57 KB</td><td>10 Mar 2012 - 00:01</td></tr>
<tr><td class="aws"><a href="http:
<tr><td class="aws">Unknown robot (identified by '*bot')</td><td>5</td><td>181.63 KB</td><td>24 Mar 2012 - 09:42</td></tr>
<tr><td class="aws">Unknown robot (identified by empty user agent string)</td><td>3</td><td>92.95 KB</td><td>08 Mar 2012 - 22:47</td></tr>
<tr><td class="aws"><span style="color: #666688">Others</span></td><td>15</td><td>306.88 KB</td><td> </td></tr>
</table></td></tr></table><span style="font: 11px verdana, arial, helvetica;">* Robots shown here gave hits or traffic "not viewed" by visitors, so they are not included in other charts.</span><br />
<br />
<a name="how"> </a>
<a name="sessions"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Visits duration </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>Number of visits: 481 - Average: 222 s</th><th bgcolor="#8888DD" width="80">Number of visits</th><th bgcolor="#8888DD" width="80">Percent</th></tr>
<tr><td class="aws">0s-30s</td><td>340</td><td>70.6 %</td></tr>
<tr><td class="aws">30s-2mn</td><td>47</td><td>9.7 %</td></tr>
<tr><td class="aws">2mn-5mn</td><td>31</td><td>6.4 %</td></tr>
<tr><td class="aws">5mn-15mn</td><td>25</td><td>5.1 %</td></tr>
<tr><td class="aws">15mn-30mn</td><td>21</td><td>4.3 %</td></tr>
<tr><td class="aws">30mn-1h</td><td>14</td><td>2.9 %</td></tr>
<tr><td class="aws">1h+</td><td>3</td><td>0.6 %</td></tr>
</table></td></tr></table><br />
<a name="filetypes"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">File type </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th colspan="3">File type</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">Percent</th><th bgcolor="#2EA495" width="80">Bandwidth</th><th bgcolor="#2EA495" width="80">Percent</th></tr>
<tr><td width="32"><img src="/awstatsicons/mime/image.png" alt='' title='' /></td><td class="aws">gif</td><td class="aws">Image</td><td>2,255</td><td>33.2 %</td><td nowrap="nowrap">4.05 MB</td><td>4.5 %</td></tr>
<tr><td><img src="/awstatsicons/mime/image.png" alt='' title='' /></td><td class="aws">png</td><td class="aws">Image</td><td>1,365</td><td>20.1 %</td><td nowrap="nowrap">23.54 MB</td><td>26.4 %</td></tr>
<tr><td><img src="/awstatsicons/mime/css.png" alt='' title='' /></td><td class="aws">css</td><td class="aws">Cascading Style Sheet file</td><td>1,190</td><td>17.5 %</td><td nowrap="nowrap">9.72 MB</td><td>10.9 %</td></tr>
<tr><td><img src="/awstatsicons/mime/unknown.png" alt='' title='' /></td><td class="aws" colspan="2"><span style="color: #666688">Unknown</span></td><td>991</td><td>14.5 %</td><td nowrap="nowrap">24.10 MB</td><td>27.1 %</td></tr>
<tr><td><img src="/awstatsicons/mime/image.png" alt='' title='' /></td><td class="aws">jpg</td><td class="aws">Image</td><td>629</td><td>9.2 %</td><td nowrap="nowrap">19.82 MB</td><td>22.3 %</td></tr>
<tr><td><img src="/awstatsicons/mime/page.png" alt='' title='' /></td><td class="aws">html</td><td class="aws">HTML or XML static page</td><td>359</td><td>5.2 %</td><td nowrap="nowrap">7.63 MB</td><td>8.5 %</td></tr>
</table></td></tr></table><br />
<a name="downloads"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Downloads (Top 10) - <a href="awstats.mc-aster.com.downloads.032012.html" target="awstatsbis">Full list</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th colspan="2">Downloads: 0</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">206 Hits</th><th bgcolor="#2EA495" width="80">Bandwidth</th><th bgcolor="#2EA495" width="80">Average size</th></tr>
</table></td></tr></table><br />
<a name="urls"> </a><a name="entry"> </a><a name="exit"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Pages-URL (Top 10) - <a href="awstats.mc-aster.com.urldetail.032012.html" target="awstatsbis">Full list</a> - <a href="awstats.mc-aster.com.urlentry.032012.html" target="awstatsbis">Entry</a> - <a href="awstats.mc-aster.com.urlexit.032012.html" target="awstatsbis">Exit</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>18 different pages-url</th><th bgcolor="#4477DD" width="80">Viewed</th><th bgcolor="#2EA495" width="80">Average size</th><th bgcolor="#CEC2E8" width="80">Entry</th><th bgcolor="#C1B2E2" width="80">Exit</th><th> </th></tr>
<tr><td class="aws"><a href="http://mc-aster.com/" target="url">/</a></td><td>355</td><td>21.77 KB</td><td>228</td><td>153</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="261" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="171" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="167" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="113" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Cordyceps-Lingzhi" target="url">/production/Cordyceps-Lingzhi</a></td><td>171</td><td>33.25 KB</td><td>83</td><td>90</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="126" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="261" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="61" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="66" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Kings-Secret" target="url">/production/Kings-Secret</a></td><td>115</td><td>24.07 KB</td><td>55</td><td>59</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="85" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="189" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="41" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="44" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/business" target="url">/business</a></td><td>89</td><td>17.98 KB</td><td>12</td><td>27</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="66" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="141" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="9" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="20" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Golden-Pearl" target="url">/production/Golden-Pearl</a></td><td>78</td><td>20.91 KB</td><td>24</td><td>28</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="58" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="164" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="18" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="21" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/contacts" target="url">/contacts</a></td><td>64</td><td>13.14 KB</td><td>3</td><td>30</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="47" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="103" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="3" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="22" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Ocean-Pride" target="url">/production/Ocean-Pride</a></td><td>64</td><td>20.92 KB</td><td>12</td><td>16</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="47" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="164" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="9" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="12" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Dragon-Power" target="url">/production/Dragon-Power</a></td><td>62</td><td>20.30 KB</td><td>15</td><td>13</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="46" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="159" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="11" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="10" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/<API key>" target="url">/production/<API key></a></td><td>58</td><td>23.19 KB</td><td>8</td><td>8</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="43" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="182" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="6" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="6" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><a href="http://mc-aster.com/production/Vital-Energy" target="url">/production/Vital-Energy</a></td><td>57</td><td>20.21 KB</td><td>11</td><td>12</td><td class="aws"><img src="/awstatsicons/other/hp.png" width="42" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hk.png" width="159" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/he.png" width="9" height="4" alt='' title='' /><br /><img src="/awstatsicons/other/hx.png" width="9" height="4" alt='' title='' /></td></tr>
<tr><td class="aws"><span style="color: #666688">Others</span></td><td>237</td><td>30.13 KB</td><td>30</td><td>45</td><td> </td></tr>
</table></td></tr></table><br />
<a name="os"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Operating Systems (Top 10) - <a href="awstats.mc-aster.com.osdetail.032012.html" target="awstatsbis">Full list/Versions</a> - <a href="awstats.mc-aster.com.unknownos.032012.html" target="awstatsbis">Unknown</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th width="32"> </th><th>Operating Systems</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">Percent</th></tr>
<tr><td width="32"><img src="/awstatsicons/os/win.png" alt='' title='' /></td><td class="aws"><b>Windows</b></td><td>6,389</td><td>94.1 %</td></tr>
<tr><td><img src="/awstatsicons/os/unknown.png" alt='' title='' /></td><td class="aws"><span style="color: #666688">Unknown</span></td><td>267</td><td>3.9 %</td></tr>
<tr><td><img src="/awstatsicons/os/j2me.png" alt='' title='' /></td><td class="aws"><a href="http://mobile.java.com/" title="Java Mobile home page [new window]" target="_blank">Java Mobile</a></td><td>73</td><td>1 %</td></tr>
<tr><td><img src="/awstatsicons/os/linux.png" alt='' title='' /></td><td class="aws"><b>Linux</b></td><td>38</td><td>0.5 %</td></tr>
<tr><td><img src="/awstatsicons/os/mac.png" alt='' title='' /></td><td class="aws"><b>Macintosh</b></td><td>22</td><td>0.3 %</td></tr>
</table></td></tr></table><br />
<a name="browsers"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Browsers (Top 10) - <a href="awstats.mc-aster.com.browserdetail.032012.html" target="awstatsbis">Full list/Versions</a> - <a href="awstats.mc-aster.com.unknownbrowser.032012.html" target="awstatsbis">Unknown</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th width="32"> </th><th>Browsers</th><th width="80">Grabber</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">Percent</th></tr>
<tr><td width="32"><img src="/awstatsicons/browser/msie.png" alt='' title='' /></td><td class="aws"><b>MS Internet Explorer</b></td><td>No</td><td>2,318</td><td>34.1 %</td></tr>
<tr><td><img src="/awstatsicons/browser/opera.png" alt='' title='' /></td><td class="aws"><b>Opera</b></td><td>No</td><td>1,938</td><td>28.5 %</td></tr>
<tr><td><img src="/awstatsicons/browser/firefox.png" alt='' title='' /></td><td class="aws"><b>Firefox</b></td><td>No</td><td>1,242</td><td>18.2 %</td></tr>
<tr><td><img src="/awstatsicons/browser/chrome.png" alt='' title='' /></td><td class="aws"><b>Google Chrome</b></td><td>No</td><td>1,077</td><td>15.8 %</td></tr>
<tr><td><img src="/awstatsicons/browser/mozilla.png" alt='' title='' /></td><td class="aws">Mozilla</td><td>No</td><td>64</td><td>0.9 %</td></tr>
<tr><td><img src="/awstatsicons/browser/safari.png" alt='' title='' /></td><td class="aws"><b>Safari</b></td><td>No</td><td>56</td><td>0.8 %</td></tr>
<tr><td><img src="/awstatsicons/browser/unknown.png" alt='' title='' /></td><td class="aws"><span style="color: #666688">Unknown</span></td><td width="80">?</td><td>51</td><td>0.7 %</td></tr>
<tr><td><img src="/awstatsicons/browser/netscape.png" alt='' title='' /></td><td class="aws"><b>Netscape</b></td><td>No</td><td>22</td><td>0.3 %</td></tr>
<tr><td><img src="/awstatsicons/browser/android.png" alt='' title='' /></td><td class="aws">Android browser (PDA/Phone browser)</td><td>No</td><td>20</td><td>0.2 %</td></tr>
<tr><td><img src="/awstatsicons/browser/iceweasel.png" alt='' title='' /></td><td class="aws">Iceweasel</td><td>No</td><td>1</td><td>0 %</td></tr>
</table></td></tr></table><br />
<a name="refering"> </a>
<a name="referer"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Connect to site from </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>Origin</th><th bgcolor="#4477DD" width="80">Pages</th><th bgcolor="#4477DD" width="80">Percent</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">Percent</th></tr>
<tr><td class="aws"><b>Direct address / Bookmark / Link in email...</b></td><td>287</td><td>34 %</td><td>410</td><td>41.5 %</td></tr>
<tr><td class="aws"><b>Links from an Internet Search Engine</b> - <a href="awstats.mc-aster.com.refererse.032012.html" target="awstatsbis">Full list</a><br />
<table>
<tr><td class="aws">- Yandex</td><td>283</td><td> / 284</td></tr>
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- Rambler</td><td>4</td><td> / 4</td></tr>
<tr><td class="aws">- Unknown search engines</td><td>3</td><td> / 3</td></tr>
<tr><td class="aws">- Aport</td><td>2</td><td> / 2</td></tr>
<tr><td class="aws">- <a href="http:
</table></td>
<td valign="top">314</td><td valign="top">37.2 %</td><td valign="top">317</td><td valign="top">32.1 %</td></tr>
<tr><td class="aws"><b>Links from an external page (other web sites except search engines)</b> - <a href="awstats.mc-aster.com.refererpages.032012.html" target="awstatsbis">Full list</a><br />
<table>
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws">- <a href="http:
<tr><td class="aws"><span style="color: #666688">- Others</span></td><td>75</td><td>92</td></tr>
</table></td>
<td valign="top">198</td><td valign="top">23.4 %</td><td valign="top">215</td><td valign="top">21.7 %</td></tr>
<tr><td class="aws"><b>Unknown Origin</b></td><td>45</td><td>5.3 %</td><td>45</td><td>4.5 %</td></tr>
</table></td></tr></table><br />
<a name="keys"> </a>
<a name="keyphrases"> </a><a name="keywords"> </a><br />
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="50%" valign="top">
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="95%">Search Keyphrases (Top 10)<br /><a href="awstats.mc-aster.com.keyphrases.032012.html" target="awstatsbis">Full list</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>106 different keyphrases</th><th bgcolor="#8888DD" width="80">Search</th><th bgcolor="#8888DD" width="80">Percent</th></tr>
<tr><td class="aws">ëèí÷æè êîðäèöåïñ</td><td>31</td><td>10.2 %</td></tr>
<tr><td class="aws">mcaster</td><td>30</td><td>9.9 %</td></tr>
<tr><td class="aws">ñåêðåò èìïåðàòîðà</td><td>25</td><td>8.2 %</td></tr>
<tr><td class="aws">êîðäèöåïñ ëèí÷æè</td><td>17</td><td>5.6 %</td></tr>
<tr><td class="aws">mc-aster.com</td><td>12</td><td>3.9 %</td></tr>
<tr><td class="aws">ýêñòðàêò êîðäèöåïñà</td><td>10</td><td>3.3 %</td></tr>
<tr><td class="aws">ìåæäóíàðîäíàÿ êîìïàíèÿ àñòåð</td><td>10</td><td>3.3 %</td></tr>
<tr><td class="aws">ñåêðåò èìïåðàòîðà öåíà</td><td>9</td><td>2.9 %</td></tr>
<tr><td class="aws">çîëîòàÿ æåì÷óæèíà</td><td>9</td><td>2.9 %</td></tr>
<tr><td class="aws">www.mcaster.net</td><td>8</td><td>2.6 %</td></tr>
<tr><td class="aws"><span style="color: #666688">Other phrases</span></td><td>142</td><td>46.8 %</td></tr>
</table></td></tr></table><br />
</td>
<td> </td><td width="50%" valign="top">
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="95%">Search Keywords (Top 10)<br /><a href="awstats.mc-aster.com.keywords.032012.html" target="awstatsbis">Full list</a> </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>180 different keywords</th><th bgcolor="#8888DD" width="80">Search</th><th bgcolor="#8888DD" width="80">Percent</th></tr>
<tr><td class="aws">êîðäèöåïñ</td><td>49</td><td>7 %</td></tr>
<tr><td class="aws">ëèí÷æè</td><td>49</td><td>7 %</td></tr>
<tr><td class="aws">èìïåðàòîðà</td><td>42</td><td>6 %</td></tr>
<tr><td class="aws">ñåêðåò</td><td>40</td><td>5.7 %</td></tr>
<tr><td class="aws">mcaster</td><td>36</td><td>5.1 %</td></tr>
<tr><td class="aws">aster</td><td>24</td><td>3.4 %</td></tr>
<tr><td class="aws">компаниÑ</td><td>21</td><td>3 %</td></tr>
<tr><td class="aws">аÑÑеÑ</td><td>19</td><td>2.7 %</td></tr>
<tr><td class="aws">êîìïàíèÿ</td><td>18</td><td>2.5 %</td></tr>
<tr><td class="aws">mc-aster.com</td><td>12</td><td>1.7 %</td></tr>
<tr><td class="aws"><span style="color: #666688">Other words</span></td><td>385</td><td>55.3 %</td></tr>
</table></td></tr></table><br />
</td>
</tr></table>
<a name="other"> </a>
<a name="misc"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">Miscellaneous </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th>Miscellaneous</th><th width="100"> </th><th width="100"> </th></tr>
<tr><td class="aws">Successful hits on favicon.ico</td><td>0 / 361 Visitors</td><td>0 %</td></tr>
</table></td></tr></table><br />
<a name="errors"> </a><br />
<table class="aws_border sortable" border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="aws_title" width="70%">HTTP Status codes </td><td class="aws_blank"> </td></tr>
<tr><td colspan="2">
<table class="aws_data" border="1" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#ECECEC"><th colspan="2">HTTP Status codes*</th><th bgcolor="#66DDEE" width="80">Hits</th><th bgcolor="#66DDEE" width="80">Percent</th><th bgcolor="#2EA495" width="80">Bandwidth</th></tr>
<tr><td><a href="awstats.mc-aster.com.errors404.032012.html" target="awstatsbis">404</a></td><td class="aws">Document Not Found (hits on favicon excluded)</td><td>180</td><td>99.4 %</td><td>202.17 KB</td></tr>
<tr><td valign="top">206</td><td class="aws">Partial Content</td><td>1</td><td>0.5 %</td><td>1.35 KB</td></tr>
</table></td></tr></table><span style="font: 11px verdana, arial, helvetica;">* Codes shown here gave hits or traffic "not viewed" by visitors, so they are not included in other charts.</span><br />
<br />
<br /><br />
<span dir="ltr" style="font: 11px verdana, arial, helvetica; color:
<br />
</body>
</html> |
/* ScriptData
SDName: Boss_Skadi
SD%Complete: 20%
SDComment: starts at trigger 4991
SDCategory: Utgarde Pinnacle
EndScriptData */
#include "precompiled.h"
#include "utgarde_pinnacle.h"
enum
{
SAY_AGGRO = -1575019,
SAY_DRAKEBREATH_1 = -1575020,
SAY_DRAKEBREATH_2 = -1575021,
SAY_DRAKEBREATH_3 = -1575022,
SAY_DRAKE_HARPOON_1 = -1575023,
SAY_DRAKE_HARPOON_2 = -1575024,
SAY_KILL_1 = -1575025,
SAY_KILL_2 = -1575026,
SAY_KILL_3 = -1575027,
SAY_DEATH = -1575028,
SAY_DRAKE_DEATH = -1575029,
EMOTE_HARPOON_RANGE = -1575030,
SPELL_CRUSH = 50234,
SPELL_CRUSH_H = 59330,
SPELL_WHIRLWIND = 50228,
SPELL_WHIRLWIND_H = 59322,
<API key> = 50255,
<API key> = 59331,
// casted with base of creature 22515 (World Trigger), so we must make sure
// to use the close one by the door leading further in to instance.
<API key> = 48630, // tick every 30 sec
<API key> = 59275, // tick every 25 sec
<API key> = 47546, // what is this? Unknown use/effect, but probably related
<API key> = 48642, // this spell hit drake to reduce HP (force triggered from 48641)
};
struct MANGOS_DLL_DECL boss_skadiAI : public ScriptedAI
{
boss_skadiAI(Creature* pCreature) : ScriptedAI(pCreature)
{
m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
Reset();
}
ScriptedInstance* m_pInstance;
bool m_bIsRegularMode;
void Reset()
{
}
void JustReachedHome()
{
if (m_pInstance)
m_pInstance->SetData(TYPE_SKADI, NOT_STARTED);
}
void Aggro(Unit* pWho)
{
DoScriptText(SAY_AGGRO, m_creature);
}
void KilledUnit(Unit* pVictim)
{
switch(urand(0, 2))
{
case 0: DoScriptText(SAY_KILL_1, m_creature); break;
case 1: DoScriptText(SAY_KILL_2, m_creature); break;
case 2: DoScriptText(SAY_KILL_3, m_creature); break;
}
}
void JustDied(Unit* pKiller)
{
DoScriptText(SAY_DEATH, m_creature);
if (m_pInstance)
m_pInstance->SetData(TYPE_SKADI, DONE);
}
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
<API key>();
}
};
CreatureAI* GetAI_boss_skadi(Creature* pCreature)
{
return new boss_skadiAI(pCreature);
}
bool <API key>(Player* pPlayer, AreaTriggerEntry const* pAt)
{
if (ScriptedInstance* pInstance = (ScriptedInstance*)pPlayer->GetInstanceData())
{
if (pInstance->GetData(TYPE_SKADI) == NOT_STARTED)
pInstance->SetData(TYPE_SKADI, SPECIAL);
}
return false;
}
void AddSC_boss_skadi()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_skadi";
newscript->GetAI = &GetAI_boss_skadi;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "at_skadi";
newscript->pAreaTrigger = &<API key>;
newscript->RegisterSelf();
} |
#include "cpuminer-config.h"
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#else
#include <errno.h>
#include <signal.h>
#include <sys/resource.h>
#if HAVE_SYS_SYSCTL_H
#include <sys/types.h>
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/sysctl.h>
#endif
#endif
#include <jansson.h>
#include <curl/curl.h>
#include "compat.h"
#include "miner.h"
#define PROGRAM_NAME "minerd"
#define DEF_RPC_URL "http://127.0.0.1:9332/"
#define LP_SCANTIME 60
#ifdef __linux /* Linux specific policy and affinity management */
#include <sched.h>
static inline void drop_policy(void)
{
struct sched_param param;
#ifdef SCHED_IDLE
if (unlikely(sched_setscheduler(0, SCHED_IDLE, ¶m) == -1))
#endif
#ifdef SCHED_BATCH
sched_setscheduler(0, SCHED_BATCH, ¶m);
#endif
}
static inline void affine_to_cpu(int id, int cpu) {
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(cpu, &set);
sched_setaffinity(0, sizeof(&set), &set);
}
#elif defined(__FreeBSD__) /* FreeBSD specific policy and affinity management */
#include <sys/cpuset.h>
static inline void drop_policy(void) {
}
static inline void affine_to_cpu(int id, int cpu) {
cpuset_t set;
CPU_ZERO(&set);
CPU_SET(cpu, &set);
cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_CPUSET, -1, sizeof(cpuset_t), &set);
}
#else
static inline void drop_policy(void) { }
static inline void affine_to_cpu(int id, int cpu) { }
#endif
enum workio_commands {
WC_GET_WORK,
WC_SUBMIT_WORK,
};
struct workio_cmd {
enum workio_commands cmd;
struct thr_info *thr;
union {
struct work *work;
} u;
};
enum sha256_algos {
ALGO_SCRYPT, /* scrypt(1024,1,1) */
ALGO_SHA256D, /* SHA-256d */
ALGO_QUARK, /* Quark Coin */
ALGO_JACKPOT, /* JackPot Coin */
};
static const char *algo_names[] = {
[ALGO_SCRYPT] = "scrypt",
[ALGO_SHA256D] = "sha256d",
[ALGO_QUARK] = "quark",
[ALGO_JACKPOT] = "jackpot",
};
bool opt_hashdebug = false;
bool opt_debug = false;
bool opt_protocol = false;
bool want_longpoll = true;
bool have_longpoll = false;
bool want_stratum = true;
bool have_stratum = false;
static bool submit_old = false;
bool use_syslog = false;
static bool opt_background = false;
static bool opt_quiet = false;
static int opt_retries = -1;
static int opt_fail_pause = 30;
int opt_timeout = 270;
int opt_scantime = 5;
static json_t *opt_config;
static const bool opt_time = true;
static enum sha256_algos opt_algo = ALGO_JACKPOT;
static int opt_n_threads;
static int num_processors;
static char *rpc_url;
static char *rpc_userpass;
static char *rpc_user, *rpc_pass;
char *opt_cert;
char *opt_proxy;
long opt_proxy_type;
struct thr_info *thr_info;
static int work_thr_id;
int longpoll_thr_id = -1;
int stratum_thr_id = -1;
struct work_restart *work_restart = NULL;
static struct stratum_ctx stratum;
pthread_mutex_t applog_lock;
pthread_mutex_t stats_lock;
static unsigned long accepted_count = 0L;
static unsigned long rejected_count = 0L;
double *thr_hashrates;
#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
#else
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
#endif
static char const usage[] = "\
Usage: " PROGRAM_NAME " [OPTIONS]\n\
Options:\n\
-a, --algo=ALGO specify the algorithm to use\n\
scrypt scrypt(1024, 1, 1) (default)\n\
sha256d SHA-256d\n\
quark Quarkcoin\n\
jackpot Jackpotcoin\n\
-o, --url=URL URL of mining server (default: " DEF_RPC_URL ")\n\
-O, --userpass=U:P username:password pair for mining server\n\
-u, --user=USERNAME username for mining server\n\
-p, --pass=PASSWORD password for mining server\n\
--cert=FILE certificate for mining server using SSL\n\
-x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy\n\
-t, --threads=N number of miner threads (default: number of processors)\n\
-r, --retries=N number of times to retry if a network call fails\n\
(default: retry indefinitely)\n\
-R, --retry-pause=N time to pause between retries, in seconds (default: 30)\n\
-T, --timeout=N network timeout, in seconds (default: 270)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 5)\n\
--no-longpoll disable X-Long-Polling support\n\
--no-stratum disable X-Stratum support\n\
-q, --quiet disable per-thread hashmeter output\n\
-D, --debug enable debug output\n\
-H, --hashdebug enable hash debug output\n\
-P, --protocol-dump verbose dump of protocol-level activities\n"
#ifdef HAVE_SYSLOG_H
"\
-S, --syslog use system log for output messages\n"
#endif
#ifndef WIN32
"\
-B, --background run the miner in the background\n"
#endif
"\
-c, --config=FILE load a JSON-format configuration file\n\
-V, --version display version information and exit\n\
-h, --help display this help text and exit\n\
";
static char const short_options[] =
#ifndef WIN32
"B"
#endif
#ifdef HAVE_SYSLOG_H
"S"
#endif
"a:c:DHhp:Px:qr:R:s:t:T:o:u:O:V";
static struct option const options[] = {
{ "algo", 1, NULL, 'a' },
#ifndef WIN32
{ "background", 0, NULL, 'B' },
#endif
{ "cert", 1, NULL, 1001 },
{ "config", 1, NULL, 'c' },
{ "debug", 0, NULL, 'D' },
{ "hashdebug", 0, NULL, 'H' },
{ "help", 0, NULL, 'h' },
{ "no-longpoll", 0, NULL, 1003 },
{ "no-stratum", 0, NULL, 1007 },
{ "pass", 1, NULL, 'p' },
{ "protocol-dump", 0, NULL, 'P' },
{ "proxy", 1, NULL, 'x' },
{ "quiet", 0, NULL, 'q' },
{ "retries", 1, NULL, 'r' },
{ "retry-pause", 1, NULL, 'R' },
{ "scantime", 1, NULL, 's' },
#ifdef HAVE_SYSLOG_H
{ "syslog", 0, NULL, 'S' },
#endif
{ "threads", 1, NULL, 't' },
{ "timeout", 1, NULL, 'T' },
{ "url", 1, NULL, 'o' },
{ "user", 1, NULL, 'u' },
{ "userpass", 1, NULL, 'O' },
{ "version", 0, NULL, 'V' },
{ 0, 0, 0, 0 }
};
struct work {
uint32_t data[32];
uint32_t target[8];
char job_id[128];
size_t xnonce2_len;
unsigned char xnonce2[32];
};
static struct work g_work;
static time_t g_work_time;
static pthread_mutex_t g_work_lock;
static bool jobj_binary(const json_t *obj, const char *key, void *buf, size_t buflen) {
const char *hexstr;
json_t *tmp;
tmp = json_object_get(obj, key);
if (unlikely(!tmp)) {
applog(LOG_ERR, "JSON key '%s' not found", key);
return false;
}
hexstr = json_string_value(tmp);
if (unlikely(!hexstr)) {
applog(LOG_ERR, "JSON key '%s' is not a string", key);
return false;
}
if (!hex2bin(buf, hexstr, buflen))
return false;
return true;
}
static bool work_decode(const json_t *val, struct work *work) {
int i;
if (unlikely(!jobj_binary(val, "data", work->data, sizeof(work->data)))) {
applog(LOG_ERR, "JSON inval data");
goto err_out;
}
if (unlikely(!jobj_binary(val, "target", work->target, sizeof(work->target)))) {
applog(LOG_ERR, "JSON inval target");
goto err_out;
}
for (i = 0; i < ARRAY_SIZE(work->data); i++)
work->data[i] = le32dec(work->data + i);
for (i = 0; i < ARRAY_SIZE(work->target); i++)
work->target[i] = le32dec(work->target + i);
return true;
err_out:
return false;
}
static void share_result(int result, const char *reason) {
char s[345];
double hashrate;
int i;
hashrate = 0.;
pthread_mutex_lock(&stats_lock);
for (i = 0; i < opt_n_threads; i++) {
hashrate += thr_hashrates[i];
}
result ? accepted_count++ : rejected_count++;
<API key>(&stats_lock);
sprintf(s, hashrate >= 1e6 ? "%.0f" : "%.2f", 1e-3 * hashrate);
applog(LOG_INFO, "accepted: %lu/%lu (%.2f%%), %s khash/s %s",
accepted_count,
accepted_count + rejected_count,
100. * accepted_count / (accepted_count + rejected_count),
s,
result ? "(yay!!!)" : "(booooo)");
if ((opt_debug || opt_hashdebug) && reason) {
applog(LOG_DEBUG, "Reject reason: %s", reason);
}
}
static bool <API key>(CURL *curl, struct work *work) {
char *str = NULL;
json_t *val, *res, *reason;
char s[345];
int i;
bool rc = false;
/* pass if the previous hash is not the current previous hash */
if (!submit_old && memcmp(work->data + 1, g_work.data + 1, 32)) {
if (opt_debug || opt_hashdebug) {
printf("stale work detected, discarding\n");
if (opt_hashdebug) {
int ii=0;
for (ii=0; ii < 32; ii++) {
printf ("%.2x",((uint8_t*)(work->data + 1))[ii]);
};
printf ("\n");
for (ii=0; ii < 32; ii++) {
printf ("%.2x",((uint8_t*)(g_work.data + 1))[ii]);
};
printf ("\n");
}
}
return true;
}
if (have_stratum) {
uint32_t ntime, nonce;
char *ntimestr, *noncestr, *xnonce2str;
if (!work->job_id) {
return true;
}
le32enc(&ntime, work->data[17]);
le32enc(&nonce, work->data[19]);
ntimestr = bin2hex((const unsigned char *)(&ntime), 4);
noncestr = bin2hex((const unsigned char *)(&nonce), 4);
xnonce2str = bin2hex(work->xnonce2, work->xnonce2_len);
sprintf(s,
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}",
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr);
free(ntimestr);
free(noncestr);
free(xnonce2str);
if ((opt_debug) && (opt_hashdebug)) {
printf("JSON-RPC Submit for stratum: %s \n", s);
}
if (unlikely(!stratum_send_line(&stratum, s))) {
applog(LOG_ERR, "<API key> stratum_send_line failed");
goto out;
}
} else {
/* build hex string */
for (i = 0; i < ARRAY_SIZE(work->data); i++)
le32enc(work->data + i, work->data[i]);
str = bin2hex((unsigned char *)work->data, sizeof(work->data));
if (unlikely(!str)) {
applog(LOG_ERR, "<API key> OOM");
goto out;
}
/* build JSON-RPC request */
sprintf(s,
"{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
str);
if (opt_debug && opt_hashdebug) {
printf("JSON-RPC Submit for getwork: %s \n", s);
}
/* issue JSON-RPC request */
val = json_rpc_call(curl, rpc_url, rpc_userpass, s, false, false, NULL);
if (unlikely(!val)) {
applog(LOG_ERR, "<API key> json_rpc_call failed");
goto out;
}
res = json_object_get(val, "result");
reason = json_object_get(val, "reject-reason");
share_result(json_is_true(res), reason ? json_string_value(reason) : NULL);
json_decref(val);
}
rc = true;
out:
free(str);
return rc;
}
static const char *rpc_req =
"{\"method\": \"getwork\", \"params\": [], \"id\":0}\r\n";
static bool get_upstream_work(CURL *curl, struct work *work) {
json_t *val;
bool rc;
struct timeval tv_start, tv_end, diff;
gettimeofday(&tv_start, NULL);
val = json_rpc_call(curl, rpc_url, rpc_userpass, rpc_req, want_longpoll, false, NULL);
gettimeofday(&tv_end, NULL);
if (have_stratum) {
if (val) json_decref(val);
return true;
}
if (!val) return false;
rc = work_decode(json_object_get(val, "result"), work);
if (opt_debug && rc) {
timeval_subtract(&diff, &tv_end, &tv_start);
applog(LOG_DEBUG, "Got new work in %d ms", diff.tv_sec * 1000 + diff.tv_usec / 1000);
}
json_decref(val);
return rc;
}
static void workio_cmd_free(struct workio_cmd *wc) {
if (!wc) return;
switch (wc->cmd) {
case WC_SUBMIT_WORK:
free(wc->u.work);
break;
default: /* do nothing */
break;
}
memset(wc, 0, sizeof(*wc)); /* poison */
free(wc);
}
static bool workio_get_work(struct workio_cmd *wc, CURL *curl)
{
struct work *ret_work;
int failures = 0;
ret_work = calloc(1, sizeof(*ret_work));
if (!ret_work) {
return false;
}
/* obtain new work from bitcoin via JSON-RPC */
while (!get_upstream_work(curl, ret_work)) {
if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) {
applog(LOG_ERR, "json_rpc_call failed, terminating workio thread");
free(ret_work);
return false;
}
/* pause, then restart work-request loop */
applog(LOG_ERR, "json_rpc_call failed, retry after %d seconds", opt_fail_pause);
sleep(opt_fail_pause);
}
/* send work to requesting thread */
if (!tq_push(wc->thr->q, ret_work))
free(ret_work);
return true;
}
static bool workio_submit_work(struct workio_cmd *wc, CURL *curl)
{
int failures = 0;
/* submit solution to bitcoin via JSON-RPC */
while (!<API key>(curl, wc->u.work)) {
if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) {
applog(LOG_ERR, "...terminating workio thread");
return false;
}
/* pause, then restart work-request loop */
applog(LOG_ERR, "...retry after %d seconds",
opt_fail_pause);
sleep(opt_fail_pause);
}
return true;
}
static void *workio_thread(void *userdata)
{
struct thr_info *mythr = userdata;
CURL *curl;
bool ok = true;
curl = curl_easy_init();
if (unlikely(!curl)) {
applog(LOG_ERR, "CURL initialization failed");
return NULL;
}
while (ok) {
struct workio_cmd *wc;
/* wait for workio_cmd sent to us, on our queue */
wc = tq_pop(mythr->q, NULL);
if (!wc) {
ok = false;
break;
}
/* process workio_cmd */
switch (wc->cmd) {
case WC_GET_WORK:
ok = workio_get_work(wc, curl);
break;
case WC_SUBMIT_WORK:
ok = workio_submit_work(wc, curl);
break;
default: /* should never happen */
ok = false;
break;
}
workio_cmd_free(wc);
}
tq_freeze(mythr->q);
curl_easy_cleanup(curl);
return NULL;
}
static bool get_work(struct thr_info *thr, struct work *work)
{
struct workio_cmd *wc;
struct work *work_heap;
/* fill out work request message */
wc = calloc(1, sizeof(*wc));
if (!wc)
return false;
wc->cmd = WC_GET_WORK;
wc->thr = thr;
/* send work request to workio thread */
if (!tq_push(thr_info[work_thr_id].q, wc)) {
workio_cmd_free(wc);
return false;
}
/* wait for response, a unit of work */
work_heap = tq_pop(thr->q, NULL);
if (!work_heap) {
return false;
}
/* copy returned work into storage provided by caller */
memcpy(work, work_heap, sizeof(*work));
free(work_heap);
if (opt_debug && opt_hashdebug) {
int ii = 0;
printf ("\n get work data dump =>");
for (ii = 0; ii < 128; ii++) {
printf ("%.2x",((uint8_t * )(work->data))[ii]);
}
printf ("\n");
}
return true;
}
static bool submit_work(struct thr_info *thr, const struct work *work_in)
{
struct workio_cmd *wc;
/* fill out work request message */
wc = calloc(1, sizeof(*wc));
if (!wc)
return false;
wc->u.work = malloc(sizeof(*work_in));
if (!wc->u.work)
goto err_out;
wc->cmd = WC_SUBMIT_WORK;
wc->thr = thr;
memcpy(wc->u.work, work_in, sizeof(*work_in));
/* send solution to workio thread */
if (!tq_push(thr_info[work_thr_id].q, wc))
goto err_out;
return true;
err_out:
workio_cmd_free(wc);
return false;
}
static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
{
unsigned char merkle_root[64];
int i;
pthread_mutex_lock(&sctx->work_lock);
strcpy(work->job_id, sctx->job.job_id);
work->xnonce2_len = sctx->xnonce2_size;
memcpy(work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size);
/* Generate merkle root */
sha256d(merkle_root, sctx->job.coinbase, sctx->job.coinbase_size);
for (i = 0; i < sctx->job.merkle_count; i++) {
memcpy(merkle_root + 32, sctx->job.merkle[i], 32);
sha256d(merkle_root, merkle_root, 64);
}
/* Increment extranonce2 */
for (i = 0; i < sctx->xnonce2_size && !++sctx->job.xnonce2[i]; i++);
/* Assemble block header */
memset(work->data, 0, 128);
work->data[0] = le32dec(sctx->job.version);
for (i = 0; i < 8; i++)
work->data[1 + i] = le32dec((uint32_t *)sctx->job.prevhash + i);
for (i = 0; i < 8; i++)
work->data[9 + i] = be32dec((uint32_t *)merkle_root + i);
work->data[17] = le32dec(sctx->job.ntime);
work->data[18] = le32dec(sctx->job.nbits);
work->data[20] = 0x80000000;
work->data[31] = 0x00000280;
<API key>(&sctx->work_lock);
if (opt_debug) {
char *xnonce2str = bin2hex(work->xnonce2, sctx->xnonce2_size);
applog(LOG_DEBUG, "Job_id='%s' extranonce2=%s ntime=%08x",
work->job_id, xnonce2str, swab32(work->data[17]));
free(xnonce2str);
}
if ((opt_algo == ALGO_SCRYPT) || (opt_algo == ALGO_JACKPOT)) {
diff_to_target(work->target, sctx->job.diff / 65536.0);
}
else {
diff_to_target(work->target, sctx->job.diff);
}
if (opt_debug && opt_hashdebug) {
int ii = 0;
printf ("\n gen work data dump =>");
for (ii = 0; ii < 128; i++) {
printf ("%.2x",((uint8_t * )(work->data))[ii]);
}
printf ("\n");
}
}
static void *miner_thread(void *userdata)
{
struct thr_info *mythr = userdata;
int thr_id = mythr->id;
struct work work;
uint32_t max_nonce;
uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - 0x20;
unsigned char *scratchbuf = NULL;
char s[16];
int i;
/* Cpu affinity only makes sense if the number of threads is a multiple
* of the number of CPUs */
if (num_processors > 1 && opt_n_threads % num_processors == 0) {
if (!opt_quiet) {
applog(LOG_INFO, "Binding thread %d to cpu %d", thr_id, thr_id % num_processors);
}
affine_to_cpu(thr_id, thr_id % num_processors);
}
if (opt_algo == ALGO_SCRYPT) {
scratchbuf = scrypt_buffer_alloc();
}
while (1) {
unsigned long hashes_done;
struct timeval tv_start, tv_end, diff;
int64_t max64;
int rc;
if (have_stratum) {
while (!*g_work.job_id || time(NULL) >= g_work_time + 120)
sleep(1);
pthread_mutex_lock(&g_work_lock);
if (work.data[19] >= end_nonce)
stratum_gen_work(&stratum, &g_work);
} else {
/* obtain new work from internal workio thread */
pthread_mutex_lock(&g_work_lock);
if (!(have_longpoll || have_stratum) || time(NULL) >= g_work_time + LP_SCANTIME*3/4 || work.data[19] >= end_nonce) {
if (unlikely(!get_work(mythr, &g_work))) {
applog(LOG_ERR, "work retrieval failed, exiting mining thread %d", mythr->id);
<API key>(&g_work_lock);
goto out;
}
time(&g_work_time);
}
if (have_stratum) {
<API key>(&g_work_lock);
continue;
}
}
if (memcmp(work.data, g_work.data, 76)) {
memcpy(&work, &g_work, sizeof(struct work));
work.data[19] = 0xffffffffU / opt_n_threads * thr_id;
}
else {
work.data[19]++;
}
<API key>(&g_work_lock);
work_restart[thr_id].restart = 0;
/* adjust max_nonce to meet target scan time */
if (have_stratum) {
max64 = LP_SCANTIME;
}
else {
max64 = g_work_time + (have_longpoll ? LP_SCANTIME : opt_scantime) - time(NULL);
}
max64 *= thr_hashrates[thr_id];
if (max64 <= 0) {
max64 = ((opt_algo == ALGO_SCRYPT) || (opt_algo == ALGO_JACKPOT)) ? 0x1fffLL : 0xfffffLL;
}
if (work.data[19] + max64 > end_nonce) {
max_nonce = end_nonce;
}
else {
max_nonce = work.data[19] + max64;
}
hashes_done = 0;
gettimeofday(&tv_start, NULL);
/* scan nonces for a proof-of-work hash */
switch (opt_algo) {
case ALGO_SCRYPT:
rc = scanhash_scrypt(thr_id, work.data, scratchbuf, work.target, max_nonce, &hashes_done);
break;
case ALGO_SHA256D:
rc = scanhash_sha256d(thr_id, work.data, work.target, max_nonce, &hashes_done);
break;
case ALGO_QUARK:
rc = scanhash_quark(thr_id, work.data, work.target, max_nonce, &hashes_done);
break;
case ALGO_JACKPOT:
rc = scanhash_jackpot(thr_id, work.data, work.target, max_nonce, &hashes_done);
break;
default:
/* should never happen */
goto out;
}
/* record scanhash elapsed time */
gettimeofday(&tv_end, NULL);
timeval_subtract(&diff, &tv_end, &tv_start);
if (diff.tv_usec || diff.tv_sec) {
pthread_mutex_lock(&stats_lock);
thr_hashrates[thr_id] = hashes_done / (diff.tv_sec + 1e-6 * diff.tv_usec);
<API key>(&stats_lock);
}
if (!opt_quiet) {
sprintf(s, thr_hashrates[thr_id] >= 1e6 ? "%.0f" : "%.2f", 1e-3 * thr_hashrates[thr_id]);
applog(LOG_INFO, "thread %d: %lu hashes, %s khash/s", thr_id, hashes_done, s);
}
/* if nonce found, submit work */
if (rc && !submit_work(mythr, &work)) {
break;
}
}
out:
tq_freeze(mythr->q);
return NULL;
}
static void restart_threads(void) {
int i;
for (i = 0; i < opt_n_threads; i++)
work_restart[i].restart = 1;
}
static void *longpoll_thread(void *userdata) {
struct thr_info *mythr = userdata;
CURL *curl = NULL;
char *copy_start, *hdr_path = NULL, *lp_url = NULL;
bool need_slash = false;
curl = curl_easy_init();
if (unlikely(!curl)) {
applog(LOG_ERR, "CURL initialization failed");
goto out;
}
start:
hdr_path = tq_pop(mythr->q, NULL);
if (!hdr_path)
goto out;
/* full URL */
if (strstr(hdr_path, ":
lp_url = hdr_path;
hdr_path = NULL;
}
/* absolute path, on current server */
else {
copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path;
if (rpc_url[strlen(rpc_url) - 1] != '/')
need_slash = true;
lp_url = malloc(strlen(rpc_url) + strlen(copy_start) + 2);
if (!lp_url)
goto out;
sprintf(lp_url, "%s%s%s", rpc_url, need_slash ? "/" : "", copy_start);
}
applog(LOG_INFO, "Long-polling activated for %s", lp_url);
while (1) {
json_t *val, *soval;
int err;
val = json_rpc_call(curl, lp_url, rpc_userpass, rpc_req,
false, true, &err);
if (have_stratum) {
if (val)
json_decref(val);
goto out;
}
if (likely(val)) {
applog(LOG_INFO, "LONGPOLL detected new block");
soval = json_object_get(json_object_get(val, "result"), "submitold");
submit_old = soval ? json_is_true(soval) : false;
pthread_mutex_lock(&g_work_lock);
if (work_decode(json_object_get(val, "result"), &g_work)) {
if (opt_debug) {
applog(LOG_DEBUG, "Got new work");
}
time(&g_work_time);
restart_threads();
}
<API key>(&g_work_lock);
json_decref(val);
} else {
pthread_mutex_lock(&g_work_lock);
g_work_time -= LP_SCANTIME;
<API key>(&g_work_lock);
if (err == <API key>) {
restart_threads();
} else {
have_longpoll = false;
restart_threads();
free(hdr_path);
free(lp_url);
lp_url = NULL;
sleep(opt_fail_pause);
goto start;
}
}
}
out:
free(hdr_path);
free(lp_url);
tq_freeze(mythr->q);
if (curl)
curl_easy_cleanup(curl);
return NULL;
}
static bool <API key>(char *buf) {
json_t *val, *err_val, *res_val, *id_val;
json_error_t err;
bool ret = false;
val = JSON_LOADS(buf, &err);
if (!val) {
applog(LOG_INFO, "JSON decode failed(%d): %s", err.line, err.text);
goto out;
}
res_val = json_object_get(val, "result");
err_val = json_object_get(val, "error");
id_val = json_object_get(val, "id");
if (!id_val || json_is_null(id_val) || !res_val)
goto out;
share_result(json_is_true(res_val),
err_val ? json_string_value(json_array_get(err_val, 1)) : NULL);
ret = true;
out:
if (val)
json_decref(val);
return ret;
}
static void *stratum_thread(void *userdata) {
struct thr_info *mythr = userdata;
char *s;
stratum.url = tq_pop(mythr->q, NULL);
if (!stratum.url)
goto out;
applog(LOG_INFO, "Starting Stratum on %s", stratum.url);
while (1) {
int failures = 0;
while (!stratum.curl) {
pthread_mutex_lock(&g_work_lock);
g_work_time = 0;
<API key>(&g_work_lock);
restart_threads();
if (!stratum_connect(&stratum, stratum.url) ||
!stratum_subscribe(&stratum) ||
!stratum_authorize(&stratum, rpc_user, rpc_pass)) {
stratum_disconnect(&stratum);
if (opt_retries >= 0 && ++failures > opt_retries) {
applog(LOG_ERR, "...terminating workio thread");
tq_push(thr_info[work_thr_id].q, NULL);
goto out;
}
applog(LOG_ERR, "...retry after %d seconds", opt_fail_pause);
sleep(opt_fail_pause);
}
}
if (stratum.job.job_id &&
(strcmp(stratum.job.job_id, g_work.job_id) || !g_work_time)) {
pthread_mutex_lock(&g_work_lock);
stratum_gen_work(&stratum, &g_work);
time(&g_work_time);
<API key>(&g_work_lock);
if (stratum.job.clean) {
applog(LOG_INFO, "Stratum detected new block");
restart_threads();
}
}
if (!stratum_socket_full(&stratum, 120)) {
applog(LOG_ERR, "Stratum connection timed out");
s = NULL;
} else
s = stratum_recv_line(&stratum);
if (!s) {
stratum_disconnect(&stratum);
applog(LOG_ERR, "Stratum connection interrupted");
continue;
}
if (!<API key>(&stratum, s))
<API key>(s);
free(s);
}
out:
return NULL;
}
static void <API key>(void) {
printf("%s\n%s\n", PACKAGE_STRING, curl_version());
exit(0);
}
static void show_usage_and_exit(int status) {
if (status)
fprintf(stderr, "Try `" PROGRAM_NAME " --help' for more information.\n");
else
printf(usage);
exit(status);
}
static void parse_arg (int key, char *arg)
{
char *p;
int v, i;
switch(key) {
case 'a':
for (i = 0; i < ARRAY_SIZE(algo_names); i++) {
if (algo_names[i] &&
!strcmp(arg, algo_names[i])) {
opt_algo = i;
break;
}
}
if (i == ARRAY_SIZE(algo_names))
show_usage_and_exit(1);
break;
case 'B':
opt_background = true;
break;
case 'c': {
json_error_t err;
if (opt_config)
json_decref(opt_config);
#if JANSSON_VERSION_HEX >= 0x020000
opt_config = json_load_file(arg, 0, &err);
#else
opt_config = json_load_file(arg, &err);
#endif
if (!json_is_object(opt_config)) {
applog(LOG_ERR, "JSON decode of %s failed", arg);
exit(1);
}
break;
}
case 'q':
opt_quiet = true;
break;
case 'D':
opt_debug = true;
break;
case 'H':
opt_hashdebug = true;
break;
case 'p':
free(rpc_pass);
rpc_pass = strdup(arg);
break;
case 'P':
opt_protocol = true;
break;
case 'r':
v = atoi(arg);
if (v < -1 || v > 9999) /* sanity check */
show_usage_and_exit(1);
opt_retries = v;
break;
case 'R':
v = atoi(arg);
if (v < 1 || v > 9999) /* sanity check */
show_usage_and_exit(1);
opt_fail_pause = v;
break;
case 's':
v = atoi(arg);
if (v < 1 || v > 9999) /* sanity check */
show_usage_and_exit(1);
opt_scantime = v;
break;
case 'T':
v = atoi(arg);
if (v < 1 || v > 99999) /* sanity check */
show_usage_and_exit(1);
opt_timeout = v;
break;
case 't':
v = atoi(arg);
if (v < 1 || v > 9999) /* sanity check */
show_usage_and_exit(1);
opt_n_threads = v;
break;
case 'u':
free(rpc_user);
rpc_user = strdup(arg);
break;
case 'o': /* --url */
p = strstr(arg, ":
if (p) {
if (strncasecmp(arg, "http:
strncasecmp(arg, "stratum+tcp:
show_usage_and_exit(1);
free(rpc_url);
rpc_url = strdup(arg);
} else {
if (!strlen(arg) || *arg == '/')
show_usage_and_exit(1);
free(rpc_url);
rpc_url = malloc(strlen(arg) + 8);
sprintf(rpc_url, "http://%s", arg);
}
p = strrchr(rpc_url, '@');
if (p) {
char *sp, *ap;
*p = '\0';
ap = strstr(rpc_url, ":
sp = strchr(ap, ':');
if (sp) {
free(rpc_userpass);
rpc_userpass = strdup(ap);
free(rpc_user);
rpc_user = calloc(sp - ap + 1, 1);
strncpy(rpc_user, ap, sp - ap);
free(rpc_pass);
rpc_pass = strdup(sp + 1);
} else {
free(rpc_user);
rpc_user = strdup(ap);
}
memmove(ap, p + 1, strlen(p + 1) + 1);
}
have_stratum = !strncasecmp(rpc_url, "stratum", 7);
break;
case 'O': /* --userpass */
p = strchr(arg, ':');
if (!p)
show_usage_and_exit(1);
free(rpc_userpass);
rpc_userpass = strdup(arg);
free(rpc_user);
rpc_user = calloc(p - arg + 1, 1);
strncpy(rpc_user, arg, p - arg);
free(rpc_pass);
rpc_pass = strdup(p + 1);
break;
case 'x': /* --proxy */
if (!strncasecmp(arg, "socks4:
opt_proxy_type = CURLPROXY_SOCKS4;
else if (!strncasecmp(arg, "socks5:
opt_proxy_type = CURLPROXY_SOCKS5;
#if LIBCURL_VERSION_NUM >= 0x071200
else if (!strncasecmp(arg, "socks4a:
opt_proxy_type = CURLPROXY_SOCKS4A;
else if (!strncasecmp(arg, "socks5h:
opt_proxy_type = <API key>;
#endif
else
opt_proxy_type = CURLPROXY_HTTP;
free(opt_proxy);
opt_proxy = strdup(arg);
break;
case 1001:
free(opt_cert);
opt_cert = strdup(arg);
break;
case 1003:
want_longpoll = false;
break;
case 1007:
want_stratum = false;
break;
case 'S':
use_syslog = true;
break;
case 'V':
<API key>();
case 'h':
show_usage_and_exit(0);
default:
show_usage_and_exit(1);
}
}
static void parse_config(void)
{
int i;
json_t *val;
if (!json_is_object(opt_config))
return;
for (i = 0; i < ARRAY_SIZE(options); i++) {
if (!options[i].name)
break;
if (!strcmp(options[i].name, "config"))
continue;
val = json_object_get(opt_config, options[i].name);
if (!val)
continue;
if (options[i].has_arg && json_is_string(val)) {
char *s = strdup(json_string_value(val));
if (!s)
break;
parse_arg(options[i].val, s);
free(s);
} else if (!options[i].has_arg && json_is_true(val))
parse_arg(options[i].val, "");
else
applog(LOG_ERR, "JSON option %s invalid",
options[i].name);
}
}
static void parse_cmdline(int argc, char *argv[])
{
int key;
while (1) {
#if HAVE_GETOPT_LONG
key = getopt_long(argc, argv, short_options, options, NULL);
#else
key = getopt(argc, argv, short_options);
#endif
if (key < 0)
break;
parse_arg(key, optarg);
}
if (optind < argc) {
fprintf(stderr, "%s: unsupported non-option argument '%s'\n",
argv[0], argv[optind]);
show_usage_and_exit(1);
}
parse_config();
}
#ifndef WIN32
void signal_handler(int sig)
{
switch (sig) {
case SIGHUP:
applog(LOG_INFO, "SIGHUP received");
break;
case SIGINT:
applog(LOG_INFO, "SIGINT received, exiting");
exit(0);
break;
case SIGTERM:
applog(LOG_INFO, "SIGTERM received, exiting");
exit(0);
break;
}
}
#endif
int main(int argc, char *argv[])
{
struct thr_info *thr;
long flags;
int i;
rpc_url = strdup(DEF_RPC_URL);
rpc_user = strdup("");
rpc_pass = strdup("");
/* parse command line */
parse_cmdline(argc, argv);
if (opt_algo==ALGO_QUARK) {
<API key>();
}
pthread_mutex_init(&applog_lock, NULL);
pthread_mutex_init(&stats_lock, NULL);
pthread_mutex_init(&g_work_lock, NULL);
pthread_mutex_init(&stratum.sock_lock, NULL);
pthread_mutex_init(&stratum.work_lock, NULL);
flags = strncmp(rpc_url, "https:", 6)
? (CURL_GLOBAL_ALL & ~CURL_GLOBAL_SSL)
: CURL_GLOBAL_ALL;
if (curl_global_init(flags)) {
applog(LOG_ERR, "CURL initialization failed");
return 1;
}
#ifndef WIN32
if (opt_background) {
i = fork();
if (i < 0) exit(1);
if (i > 0) exit(0);
i = setsid();
if (i < 0)
applog(LOG_ERR, "setsid() failed (errno = %d)", errno);
i = chdir("/");
if (i < 0)
applog(LOG_ERR, "chdir() failed (errno = %d)", errno);
signal(SIGHUP, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
}
#endif
#if defined(WIN32)
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
num_processors = sysinfo.<API key>;
#elif defined(<API key>)
num_processors = sysconf(<API key>);
#elif defined(HW_NCPU)
int req[] = { CTL_HW, HW_NCPU };
size_t len = sizeof(num_processors);
v = sysctl(req, 2, &num_processors, &len, NULL, 0);
#else
num_processors = 1;
#endif
if (num_processors < 1)
num_processors = 1;
if (!opt_n_threads)
opt_n_threads = num_processors;
if (!rpc_userpass) {
rpc_userpass = malloc(strlen(rpc_user) + strlen(rpc_pass) + 2);
if (!rpc_userpass)
return 1;
sprintf(rpc_userpass, "%s:%s", rpc_user, rpc_pass);
}
#ifdef HAVE_SYSLOG_H
if (use_syslog)
openlog("cpuminer", LOG_PID, LOG_USER);
#endif
work_restart = calloc(opt_n_threads, sizeof(*work_restart));
if (!work_restart)
return 1;
thr_info = calloc(opt_n_threads + 3, sizeof(*thr));
if (!thr_info)
return 1;
thr_hashrates = (double *) calloc(opt_n_threads, sizeof(double));
if (!thr_hashrates)
return 1;
/* init workio thread info */
work_thr_id = opt_n_threads;
thr = &thr_info[work_thr_id];
thr->id = work_thr_id;
thr->q = tq_new();
if (!thr->q)
return 1;
/* start work I/O thread */
if (pthread_create(&thr->pth, NULL, workio_thread, thr)) {
applog(LOG_ERR, "workio thread create failed");
return 1;
}
if (want_longpoll && !have_stratum) {
/* init longpoll thread info */
longpoll_thr_id = opt_n_threads + 1;
thr = &thr_info[longpoll_thr_id];
thr->id = longpoll_thr_id;
thr->q = tq_new();
if (!thr->q)
return 1;
/* start longpoll thread */
if (unlikely(pthread_create(&thr->pth, NULL, longpoll_thread, thr))) {
applog(LOG_ERR, "longpoll thread create failed");
return 1;
}
}
if (want_stratum) {
/* init stratum thread info */
stratum_thr_id = opt_n_threads + 2;
thr = &thr_info[stratum_thr_id];
thr->id = stratum_thr_id;
thr->q = tq_new();
if (!thr->q)
return 1;
/* start stratum thread */
if (unlikely(pthread_create(&thr->pth, NULL, stratum_thread, thr))) {
applog(LOG_ERR, "stratum thread create failed");
return 1;
}
if (have_stratum)
tq_push(thr_info[stratum_thr_id].q, strdup(rpc_url));
}
/* start mining threads */
for (i = 0; i < opt_n_threads; i++) {
thr = &thr_info[i];
thr->id = i;
thr->q = tq_new();
if (!thr->q)
return 1;
if (unlikely(pthread_create(&thr->pth, NULL, miner_thread, thr))) {
applog(LOG_ERR, "thread %d create failed", i);
return 1;
}
}
applog(LOG_INFO, "%d miner threads started, "
"using '%s' algorithm.",
opt_n_threads,
algo_names[opt_algo]);
/* main loop - simply wait for workio thread to exit */
pthread_join(thr_info[work_thr_id].pth, NULL);
applog(LOG_INFO, "workio thread dead, exiting.");
return 0;
} |
<?php
$codebase="http://appletserverurl.com/path";
$defaultHost="defaulthost.com";
$defaultPort="992";
$defaultDeviceName="";
$defaultAppletWidth="640";
$defaultAppletHeight="480";
?>
<html>
<head>
<title>Applet Parameter Configuration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<br>
<a href="<?php echo "$codebase/SSLinstructions.html"; ?>">Client Setup Instructions</a>
<form method="post" action="My5250SSLApplet.php">
<input name="CODEBASE" type="hidden" id="CODEBASE"
value="<?php echo $codebase; ?>">
<p><strong>Connection Settings:</strong><br>
Host:
<input name="HOST" type="text" id="HOST" value="<?php echo $defaultHost; ?>" size="40"><br>
Port:
<input name="PORT" type="text" id="PORT" value="<?php echo $defaultPort; ?>" size="7">
SSL Type:
<select name="SSLTYPE" id="SSLTYPE">
<option value="NONE">NONE</option>
<option value="SSLv2">SSLv2</option>
<option value="SSLv3">SSLv3</option>
<option value="TLS" selected>TLS</option>
</select>
<br>
Device Name:
<input name="DEVICE" type="text" id="DEVICE" value="<?php echo $defaultDeviceName; ?>">
</p>
<p><strong>Screen Settings</strong> <br>
Width:
<input name="WIDTH" type="text" id="WIDTH" value="<?php echo $defaultAppletWidth; ?>" size="6" maxlength="4">
Pixels
<input type="submit" name="Submit" value="Connect">
<br>
Height:
<input name="HEIGHT" type="text" id="HEIGHT" value="<?php echo $defaultAppletHeight; ?>" size="6" maxlength="4">
Pixels<br>
</p>
</form>
<br>
<br>
<br>
</body>
</html> |
#ifndef SPARC64_TDEP_H
#define SPARC64_TDEP_H 1
struct frame_info;
struct gdbarch;
struct regcache;
struct sparc_gregmap;
struct <API key>;
#include "sparc-tdep.h"
/* The stack pointer is offset from the stack frame by a BIAS of 2047
(0x7ff) for 64-bit code. BIAS is likely to be defined on SPARC
hosts, so undefine it first. */
#undef BIAS
#define BIAS 2047
/* Register offsets for the general-purpose register set. */
/* UltraSPARC doesn't have %psr. */
#define r_tstate_offset r_psr_offset
/* UltraSPARC doesn't have %wim either. */
#define r_fprs_offset r_wim_offset
/* Register numbers of various important registers. */
enum sparc64_regnum
{
SPARC64_F32_REGNUM /* %f32 */
= SPARC_F0_REGNUM + 32,
SPARC64_F62_REGNUM /* %f62 */
= SPARC64_F32_REGNUM + 15,
SPARC64_PC_REGNUM,
SPARC64_NPC_REGNUM, /* %npc */
<API key>,
SPARC64_FSR_REGNUM, /* %fsr */
SPARC64_FPRS_REGNUM, /* %fprs */
SPARC64_Y_REGNUM,
};
/* Pseudo registers. */
enum <API key>
{
SPARC64_CWP_REGNUM = 0, /* %cwp */
<API key>, /* %pstate */
SPARC64_ASI_REGNUM, /* %asi */
SPARC64_CCR_REGNUM, /* %ccr */
SPARC64_D0_REGNUM,
SPARC64_D10_REGNUM /* %d10 */
= SPARC64_D0_REGNUM + 5,
SPARC64_D30_REGNUM /* %d30 */
= SPARC64_D0_REGNUM + 15,
SPARC64_D32_REGNUM /* %d32 */
= SPARC64_D0_REGNUM + 16,
SPARC64_D62_REGNUM /* %d62 */
= SPARC64_D0_REGNUM + 31,
SPARC64_Q0_REGNUM,
SPARC64_Q8_REGNUM
= SPARC64_Q0_REGNUM + 2,
SPARC64_Q28_REGNUM /* %q28 */
= SPARC64_Q0_REGNUM + 7,
SPARC64_Q32_REGNUM /* %q32 */
= SPARC64_Q0_REGNUM + 8,
SPARC64_Q60_REGNUM /* %q60 */
= SPARC64_Q0_REGNUM + 15
};
/* Processor state bits. */
#define SPARC64_PSTATE_AG 0x001
#define SPARC64_PSTATE_IE 0x002
#define SPARC64_PSTATE_PRIV 0x004
#define SPARC64_PSTATE_AM 0x008
#define SPARC64_PSTATE_PEF 0x010
#define SPARC64_PSTATE_RED 0x020
#define SPARC64_PSTATE_TLE 0x100
#define SPARC64_PSTATE_CLE 0x200
#define SPARC64_PSTATE_PID0 0x400
#define SPARC64_PSTATE_PID1 0x800
extern void sparc64_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
extern void <API key> (const struct sparc_gregmap *gregmap,
struct regcache *regcache,
int regnum, const void *gregs);
extern void <API key> (const struct sparc_gregmap *gregmap,
const struct regcache *regcache,
int regnum, void *gregs);
extern void <API key> (const struct sparc_fpregmap *fpregmap,
struct regcache *regcache,
int regnum, const void *fpregs);
extern void <API key> (const struct sparc_fpregmap *fpregmap,
const struct regcache *regcache,
int regnum, void *fpregs);
/* Functions and variables exported from sparc64-sol2-tdep.c. */
/* Register offsets for Solaris 2. */
extern const struct sparc_gregmap <API key>;
extern const struct sparc_fpregmap <API key>;
extern void <API key> (struct gdbarch_info info,
struct gdbarch *gdbarch);
/* Variables exported from sparc64-fbsd-tdep.c. */
/* Register offsets for FreeBSD/sparc64. */
extern const struct sparc_gregmap sparc64fbsd_gregmap;
/* Functions and variables exported from sparc64-nbsd-tdep.c. */
/* Register offsets for NetBSD/sparc64. */
extern const struct sparc_gregmap sparc64nbsd_gregmap;
extern struct <API key> *
<API key> (CORE_ADDR sigcontext_addr,
struct frame_info *next_frame);
extern const struct sparc_fpregmap <API key>;
extern void <API key> (pid_t pid);
#endif /* sparc64-tdep.h */ |
#ifndef __TEST_H_
#define __TEST_H_
#include <tomcrypt.h>
/* enable stack testing */
// #define STACK_TEST
/* stack testing, define this if stack usage goes downwards [e.g. x86] */
#define STACK_DOWN
typedef struct {
char *name, *prov, *req;
int (*entry)(void);
} test_entry;
extern prng_state yarrow_prng;
void run_cmd(int res, int line, char *file, char *cmd);
#define DO(x) { run_cmd((x), __LINE__, __FILE__,
/* TESTS */
int cipher_hash_test(void);
int modes_test(void);
int mac_test(void);
int pkcs_1_test(void);
int store_test(void);
int rsa_test(void);
int ecc_tests(void);
int dsa_test(void);
int dh_tests(void);
int der_tests(void);
/* timing */
#define KTIMES 25
#define TIMES 100000
extern struct list {
int id;
unsigned long spd1, spd2, avg;
} results[];
extern int no_results;
int sorter(const void *a, const void *b);
void tally_results(int type);
ulong64 rdtsc (void);
void t_start(void);
ulong64 t_read(void);
void init_timer(void);
/* register default algs */
void reg_algs(void);
int time_keysched(void);
int time_cipher(void);
int time_cipher2(void);
int time_cipher3(void);
int time_hash(void);
void time_mult(void);
void time_sqr(void);
void time_prng(void);
void time_rsa(void);
void time_ecc(void);
void time_dh(void);
void time_macs_(unsigned long MAC_SIZE);
void time_macs(void);
void time_encmacs(void);
#endif
/* $Source: /usr/local/dslrepos/uClinux-dist/user/dropbear-0.48.1/libtomcrypt/testprof/tomcrypt_test.h,v $ */
/* $Revision: 1.1 $ */ |
#include "tomcrypt.h"
/**
@file dsa_verify_hash.c
DSA implementation, verify a signature, Tom St Denis
*/
#ifdef MDSA
/**
Verify a DSA signature
@param r DSA "r" parameter
@param s DSA "s" parameter
@param hash The hash that was signed
@param hashlen The length of the hash that was signed
@param stat [out] The result of the signature verification, 1==valid, 0==invalid
@param key The corresponding public DH key
@return CRYPT_OK if successful (even if the signature is invalid)
*/
int dsa_verify_hash_raw( mp_int *r, mp_int *s,
const unsigned char *hash, unsigned long hashlen,
int *stat, dsa_key *key)
{
mp_int w, v, u1, u2;
int err;
LTC_ARGCHK(r != NULL);
LTC_ARGCHK(s != NULL);
LTC_ARGCHK(stat != NULL);
LTC_ARGCHK(key != NULL);
/* default to invalid signature */
*stat = 0;
/* init our variables */
if ((err = mp_init_multi(&w, &v, &u1, &u2, NULL)) != MP_OKAY) {
return mpi_to_ltc_error(err);
}
/* neither r or s can be null or >q*/
if (mp_iszero(r) == MP_YES || mp_iszero(s) == MP_YES || mp_cmp(r, &key->q) != MP_LT || mp_cmp(s, &key->q) != MP_LT) {
err = <API key>;
goto done;
}
/* w = 1/s mod q */
if ((err = mp_invmod(s, &key->q, &w)) != MP_OKAY) { goto error; }
/* u1 = m * w mod q */
if ((err = <API key>(&u1, (unsigned char *)hash, hashlen)) != MP_OKAY) { goto error; }
if ((err = mp_mulmod(&u1, &w, &key->q, &u1)) != MP_OKAY) { goto error; }
/* u2 = r*w mod q */
if ((err = mp_mulmod(r, &w, &key->q, &u2)) != MP_OKAY) { goto error; }
/* v = g^u1 * y^u2 mod p mod q */
if ((err = mp_exptmod(&key->g, &u1, &key->p, &u1)) != MP_OKAY) { goto error; }
if ((err = mp_exptmod(&key->y, &u2, &key->p, &u2)) != MP_OKAY) { goto error; }
if ((err = mp_mulmod(&u1, &u2, &key->p, &v)) != MP_OKAY) { goto error; }
if ((err = mp_mod(&v, &key->q, &v)) != MP_OKAY) { goto error; }
/* if r = v then we're set */
if (mp_cmp(r, &v) == MP_EQ) {
*stat = 1;
}
err = CRYPT_OK;
goto done;
error : err = mpi_to_ltc_error(err);
done : mp_clear_multi(&w, &v, &u1, &u2, NULL);
return err;
}
/**
Verify a DSA signature
@param sig The signature
@param siglen The length of the signature (octets)
@param hash The hash that was signed
@param hashlen The length of the hash that was signed
@param stat [out] The result of the signature verification, 1==valid, 0==invalid
@param key The corresponding public DH key
@return CRYPT_OK if successful (even if the signature is invalid)
*/
int dsa_verify_hash(const unsigned char *sig, unsigned long siglen,
const unsigned char *hash, unsigned long hashlen,
int *stat, dsa_key *key)
{
int err;
mp_int r, s;
if ((err = mp_init_multi(&r, &s, NULL)) != CRYPT_OK) {
return CRYPT_MEM;
}
/* decode the sequence */
if ((err = <API key>(sig, siglen,
LTC_ASN1_INTEGER, 1UL, &r,
LTC_ASN1_INTEGER, 1UL, &s,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto LBL_ERR;
}
/* do the op */
err = dsa_verify_hash_raw(&r, &s, hash, hashlen, stat, key);
LBL_ERR:
mp_clear_multi(&r, &s, NULL);
return err;
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */ |
package password.pwm.http;
public enum PwmRequestFlag {
HIDE_LOCALE,
HIDE_IDLE,
HIDE_FOOTER_TEXT,
HIDE_HEADER_BUTTONS,
<API key>,
NO_REQ_COUNTER,
NO_IDLE_TIMEOUT,
NO_MOBILE_CSS,
<API key>,
INCLUDE_CONFIG_CSS,
} |
#include <config.h>
#include <compat.h>
#include <dpkg/i18n.h>
#include <unistd.h>
#include <stdio.h>
#include "progress.h"
void
progress_init(struct progress *progress, const char *text, int max)
{
progress->text = text;
progress->max = max;
progress->cur = 0;
progress->last_percent = 0;
progress->on_tty = isatty(1);
printf("%s", text);
}
void
progress_step(struct progress *progress)
{
int cur_percent;
if (!progress->on_tty)
return;
progress->cur++;
cur_percent = (progress->cur * 100) / progress->max;
if (cur_percent <= progress->last_percent)
return;
if (cur_percent % 5)
return;
progress->last_percent = cur_percent;
printf("\r%s%d%%", progress->text, cur_percent);
}
void
progress_done(struct progress *progress)
{
if (progress->on_tty)
printf("\r%s", progress->text);
} |
<?php
$settings = get_option('_wpmp_settings');
$currency_sign = get_option('_wpmp_curr_sign','$');
$cart = "<div class='wp-marketplace'>"
. "<form method='post' class='abc' action='' name='cart_form' id='cart_form'>"
. "<input type='hidden' name='wpmp_update_cart' value='1' />"
. "<table class='wpdm_cart'>"
. "<tr class='cart_header'>"
. "<th style='width:20px !important'></th>"
. "<th>".__("Title","wpmarketplace")."</th>"
. "<th>".__("Unit Price","wpmarketplace")."</th>"
. "<th> ".__("Role Discount","wpmarketplace")."</th>"
. "<th> ".__("Coupon Code","wpmarketplace")."</th>"
. "<th>".__("Quantity","wpmarketplace")."</th>"
. "<th class='amt'>".__("Total","wpmarketplace")."</th>"
. "</tr>";
if(is_array($cart_data)){
//print_r($cart_data);
foreach($cart_data as $item){
//echo "<pre>" ; print_r($item); echo "</pre>";
//filter for adding various message after cart item
$cart_item_info="";
$cart_item_info = apply_filters("wpmp_cart_item_info", $cart_item_info, $item['ID']);
if(isset($item['item']) && !empty($item['item'])):
foreach ($item['item'] as $key => $var):
//echo "<pre>" ; print_r($item['item']); echo "</pre>";
if(isset($var['coupon_amount']) && $var['coupon_amount'] != ""){
$discount_amount=$var['coupon_amount'];
$discount_style="style='color:#008000; text-decoration:underline;'";
$discount_title='Discounted $'.$discount_amount." for coupon code '{$item['coupon']}'";
} else{
$discount_amount="";
$discount_style="";
$discount_title="";
}
if($var['error'] != ""){
$coupon_style="style='border:1px solid #ff0000;'";
$title=$var['error'];
} else {
$coupon_style="";
$title="";
}
if($var['variations'])
$variation = "<small><i>".implode(", ",$var['variations'])."</i></small>";
$cart .= "<tr id='cart_item_{$item['ID']}_{$key}'>"
. "<td>"
. "<a class='<API key>' href='#' onclick='return <API key>({$item['ID']},{$key})'>"
. "<i class='icon icon-trash glyphicon glyphicon-trash'></i>"
. "</a>"
. "</td>"
. "<td class='cart_item_title'>{$item['post_title']}<br>$variation".$cart_item_info ."</td>"
. "<td class='<API key>' $discount_style ><span class='ttip' title='$discount_title'>".$currency_sign.number_format($item[price],2,".","")."</span></td>"
. "<td class='' >" .$currency_sign.number_format($var['discount_amount'],2,'.','') . "</td>"
. "<td><input style='$coupon_style' title='$title' type='text' name='cart_items[$item[ID]][coupon]' value='{$item['coupon']}' id='$item[ID]' class='ttip' size=3 /></td>"
. "<td class='cart_item_quantity'><input type='text' name='cart_items[$item[ID]][item][$key][quantity]' value='{$item['item'][$key]['quantity']}' size=3 /></td>"
. "<td class='cart_item_subtotal amt'>".$currency_sign.number_format((($item['price']+$var['prices'])*$var['quantity'])-$var['discount_amount'] - $var['coupon_amount'],2,".","")."</td>"
. "</tr>";
endforeach;
else:
//echo "<pre>"; print_r($item); echo "</pre>";
if($item['variations'])
$variations .= "<small><i>".implode(", ",$item['variations'])."</i></small>";
if($item['coupon_amount']){
$discount_amount=$item['coupon_amount'];
$discount_style="style='color:#008000; text-decoration:underline;'";
$discount_title='Discounted $'.$discount_amount." for coupon code '{$item['coupon']}'";
} else{
$discount_amount="";
$discount_style="";
$discount_title="";
}
if($item['error']){
$coupon_style="style='border:1px solid #ff0000;'";
$title=$item['error'];
} else {
$coupon_style="";
$title="";
}
$cart .= "<tr id='cart_item_{$item[ID]}'>"
. "<td>"
. "<a class='<API key>' href='#' onclick='return <API key>($item[ID])'>"
. "<i class='icon icon-trash glyphicon glyphicon-trash'></i>"
. "</a>"
. "</td>"
. "<td class='cart_item_title'>$item[post_title]<br>$variations".$cart_item_info."</td>"
. "<td class='<API key>' $discount_style ><span class='ttip' title='$discount_title'>".$currency_sign.number_format($item[price],2,".","")."</span></td>"
. "<td class=''>".$currency_sign.number_format($item['discount_amount'],2,'.','')."</td>"
. "<td><input style='$coupon_style' title='$title' type='text' name='cart_items[$item[ID]][coupon]' value='$item[coupon]' id='$item[ID]' class='ttip' size=3 /></td>"
. "<td class='cart_item_quantity'><input type='text' name='cart_items[$item[ID]][quantity]' value='$item[quantity]' size=3 /></td>"
. "<td class='cart_item_subtotal amt'>".$currency_sign.number_format((($item['price']+$item['prices'])*$item['quantity'])-$item['coupon_amount'] - $item['discount_amount'],2,".","")."</td>"
. "</tr>";
endif;
}}
<API key>();
$extra_row = '';
$cart .= apply_filters('wpmp_cart_extra_row',$extra_row);
$cart .= "
<tr><td colspan=6 align=right class='text-right'>".__("Total:","wpmarketplace")."</td><td class='amt' id='wpmp_cart_total'>". $currency_sign.number_format((double)str_replace(',','',<API key>()),2)."</td></tr>
<tr><td colspan=2><button type='button' class='btn btn-info ' onclick='location.href=\"".$settings['<API key>']."\"'><i class='icon-white icon-repeat glyphicon glyphicon-repeat'></i> ".__("Continue Shopping","wpmarketplace")."</button></td><td colspan=4 align=right class='text-right'><button class='btn btn-primary' type='button' onclick='document.getElementById(\"cart_form\").submit();'><i class='icon-white icon-edit glyphicon glyphicon-edit'></i> ".__("Update Cart","wpmarketplace")."</button> <button class='btn btn-success' type='button' onclick='location.href=\"".get_permalink($settings['check_page_id'])."\"'><i class='glyphicon <API key> icon-white icon-shopping-cart'></i> ".__("Checkout","wpmarketplace")."</button></td></tr>
</table>
</form></div>
<script language='JavaScript'>
<!
function <API key>(id){
if(!confirm('Are you sure?')) return false;
jQuery('#cart_item_'+id+' *').css('color','#ccc');
jQuery.post('".home_url('?<API key>=')."'+id
,function(res){
var obj = jQuery.parseJSON(res);
jQuery('#cart_item_'+id).fadeOut().remove();
jQuery('#wpmp_cart_total').html(obj.cart_total);
jQuery('#wpmp_cart_discount').html(obj.cart_discount);
jQuery('#wpmp_cart_subtotal').html(obj.cart_subtotal); });
return false;
}
function <API key>(id,item){
if(!confirm('Are you sure?')) return false;
jQuery('#cart_item_'+id+'_'+item+' *').css('color','#ccc');
jQuery.post('".home_url('?<API key>=')."'+id + '&item_id='+item
,function(res){
var obj = jQuery.parseJSON(res);
jQuery('#cart_item_'+id+'_'+item).fadeOut().remove();
jQuery('#wpmp_cart_total').html(obj.cart_total);
jQuery('#wpmp_cart_discount').html(obj.cart_discount);
jQuery('#wpmp_cart_subtotal').html(obj.cart_subtotal); });
return false;
}
jQuery(function(){
jQuery('.ttip').tooltip();
});
</script>
";
if(count($cart_data)==0) $cart = __("No item in cart.","wpmarketplace")."<br/><a href='".$settings['<API key>']."'>".__("Continue shopping","wpmarketplace")."</a>"; |
#include "tbb/compat/condition_variable"
#include "tbb/mutex.h"
#include "tbb/recursive_mutex.h"
#include "tbb/tick_count.h"
#include "tbb/atomic.h"
#include "harness.h"
// This test deliberately avoids a "using tbb" statement,
// so that the error of putting types in the wrong namespace will be caught.
using namespace std;
template<typename M>
struct Counter {
typedef M mutex_type;
M mutex;
volatile long value;
void <API key>( size_t mode );
void <API key>( size_t mode );
};
template<typename M>
void Counter<M>::<API key>(size_t mode)
/** Increments counter once for each iteration in the iteration space. */
{
if( mode&1 ) {
// Try acquire and release with implicit lock_guard
// precondition: if mutex_type is not a recursive mutex, the calling thread does not own the mutex m.
// if the prcondition is not met, either dead-lock incorrect 'value' would result in.
lock_guard<M> lg(mutex);
value = value+1;
} else {
// Try acquire and release with adopt lock_quard
// precodition: the calling thread owns the mutex m.
// if the prcondition is not met, incorrect 'value' would result in because the thread unlocks
// mutex that it does not own.
mutex.lock();
lock_guard<M> lg( mutex, adopt_lock );
value = value+1;
}
}
template<typename M>
void Counter<M>::<API key>(size_t mode)
/** Increments counter once for each iteration in the iteration space. */
{
switch( mode&7 ) {
case 0:
{// implicitly acquire and release mutex with unique_lock
unique_lock<M> ul( mutex );
value = value+1;
ASSERT( ul==true, NULL );
}
break;
case 1:
{// unique_lock with defer_lock
unique_lock<M> ul( mutex, defer_lock );
ASSERT( ul.owns_lock()==false, NULL );
ul.lock();
value = value+1;
ASSERT( ul.owns_lock()==true, NULL );
}
break;
case 2:
{// unique_lock::try_lock() with try_to_lock
unique_lock<M> ul( mutex, try_to_lock );
if( !ul )
while( !ul.try_lock() )
__TBB_Yield();
value = value+1;
}
break;
case 3:
{// unique_lock::try_lock_for() with try_to_lock
unique_lock<M> ul( mutex, defer_lock );
tbb::tick_count::interval_t i(1.0);
while( !ul.try_lock_for( i ) )
;
value = value+1;
ASSERT( ul.owns_lock()==true, NULL );
}
break;
case 4:
{
unique_lock<M> ul_o4;
{// unique_lock with adopt_lock
mutex.lock();
unique_lock<M> ul( mutex, adopt_lock );
value = value+1;
ASSERT( ul.owns_lock()==true, NULL );
ASSERT( ul.mutex()==&mutex, NULL );
ASSERT( ul_o4.owns_lock()==false, NULL );
ASSERT( ul_o4.mutex()==NULL, NULL );
swap( ul, ul_o4 );
ASSERT( ul.owns_lock()==false, NULL );
ASSERT( ul.mutex()==NULL, NULL );
ASSERT( ul_o4.owns_lock()==true, NULL );
ASSERT( ul_o4.mutex()==&mutex, NULL );
ul_o4.unlock();
}
ASSERT( ul_o4.owns_lock()==false, NULL );
}
break;
case 5:
{
unique_lock<M> ul_o5;
{// unique_lock with adopt_lock
mutex.lock();
unique_lock<M> ul( mutex, adopt_lock );
value = value+1;
ASSERT( ul.owns_lock()==true, NULL );
ASSERT( ul.mutex()==&mutex, NULL );
ASSERT( ul_o5.owns_lock()==false, NULL );
ASSERT( ul_o5.mutex()==NULL, NULL );
ul_o5.swap( ul );
ASSERT( ul.owns_lock()==false, NULL );
ASSERT( ul.mutex()==NULL, NULL );
ASSERT( ul_o5.owns_lock()==true, NULL );
ASSERT( ul_o5.mutex()==&mutex, NULL );
ul_o5.unlock();
}
ASSERT( ul_o5.owns_lock()==false, NULL );
}
break;
default:
{// unique_lock with adopt_lock, and release()
mutex.lock();
unique_lock<M> ul( mutex, adopt_lock );
ASSERT( ul==true, NULL );
value = value+1;
M* old_m = ul.release();
old_m->unlock();
ASSERT( ul.owns_lock()==false, NULL );
}
break;
}
}
static tbb::atomic<size_t> Order;
template<typename State, long TestSize>
struct WorkForLocks: NoAssign {
static const size_t chunk = 100;
State& state;
WorkForLocks( State& state_ ) : state(state_) {}
void operator()( int ) const {
size_t step;
while( (step=Order.fetch_and_add<tbb::acquire>(chunk))<TestSize ) {
for( size_t i=0; i<chunk && step<TestSize; ++i, ++step ) {
state.<API key>(step);
state.<API key>(step);
}
}
}
};
template<typename M>
void TestLocks( const char* name, int nthread ) {
REMARK("testing %s in TestLocks\n",name);
Counter<M> counter;
counter.value = 0;
Order = 0;
// use the macro because of a gcc 4.6 bug
#define TEST_SIZE 100000
NativeParallelFor( nthread, WorkForLocks<Counter<M>, TEST_SIZE>(counter) );
if( counter.value!=2*TEST_SIZE )
REPORT("ERROR for %s in TestLocks: counter.value=%ld != 2 * %ld=test_size\n",name,counter.value,TEST_SIZE);
#undef TEST_SIZE
}
static tbb::atomic<int> barrier;
// Test if the constructor works and if native_handle() works
template<typename M>
struct WorkForCondVarCtor: NoAssign {
condition_variable& my_cv;
M& my_mtx;
WorkForCondVarCtor( condition_variable& cv_, M& mtx_ ) : my_cv(cv_), my_mtx(mtx_) {}
void operator()( int tid ) const {
ASSERT( tid<=1, NULL ); // test with 2 threads.
condition_variable::native_handle_type handle = my_cv.native_handle();
if( tid&1 ) {
my_mtx.lock();
++barrier;
#if _WIN32||_WIN64
if( !tbb::interface5::internal::<API key>( *handle, &my_mtx ) ) {
int ec = GetLastError();
ASSERT( ec!=WAIT_TIMEOUT, NULL );
throw_exception( tbb::internal::<API key> );
}
#else
if( pthread_cond_wait( handle, my_mtx.native_handle() ) )
throw_exception( tbb::internal::<API key> );
#endif
++barrier;
my_mtx.unlock();
} else {
bool res;
while( (res=my_mtx.try_lock())==true && barrier==0 ) {
my_mtx.unlock();
__TBB_Yield();
}
if( res ) my_mtx.unlock();
do {
#if _WIN32||_WIN64
tbb::interface5::internal::<API key>( *handle );
#else
pthread_cond_signal( handle );
#endif
__TBB_Yield();
} while ( barrier<2 );
}
}
};
static condition_variable* test_cv;
static tbb::atomic<int> n_waiters;
// Test if the destructor works
template<typename M>
struct WorkForCondVarDtor: NoAssign {
int nthread;
M& my_mtx;
WorkForCondVarDtor( int n, M& mtx_ ) : nthread(n), my_mtx(mtx_) {}
void operator()( int tid ) const {
if( tid==0 ) {
unique_lock<M> ul( my_mtx, defer_lock );
test_cv = new condition_variable;
while( n_waiters<nthread-1 )
__TBB_Yield();
ul.lock();
test_cv->notify_all();
ul.unlock();
while( n_waiters>0 )
__TBB_Yield();
delete test_cv;
} else {
while( test_cv==NULL )
__TBB_Yield();
unique_lock<M> ul(my_mtx);
++n_waiters;
test_cv->wait( ul );
--n_waiters;
}
}
};
static const int max_ticket = 100;
static const int short_delay = 10;
static const int long_delay = 100;
tbb::atomic<int> n_signaled;
tbb::atomic<int> n_done, n_done_1, n_done_2;
tbb::atomic<int> n_timed_out;
static bool false_to_true;
struct <API key> {
<API key>() {}
bool operator()() { return false_to_true; }
};
struct TestPredicateFalse {
TestPredicateFalse() {}
bool operator()() { return false; }
};
struct TestPredicateTrue {
TestPredicateTrue() {}
bool operator()() { return true; }
};
// Test timed wait and timed wait with pred
template<typename M>
struct <API key>: NoAssign {
int nthread;
condition_variable& test_cv;
M& my_mtx;
<API key>( int n_, condition_variable& cv_, M& mtx_ ) : nthread(n_), test_cv(cv_), my_mtx(mtx_) {}
void operator()( int tid ) const {
tbb::tick_count t1, t2;
unique_lock<M> ul( my_mtx, defer_lock );
ASSERT( n_timed_out==0, NULL );
++barrier;
while( barrier<nthread ) __TBB_Yield();
// test if a thread times out with wait_for()
for( int i=1; i<10; ++i ) {
tbb::tick_count::interval_t intv((double)i*0.0999 /*seconds*/);
ul.lock();
cv_status st = no_timeout;
__TBB_TRY {
/** Some version of glibc return EINVAL instead 0 when spurious wakeup occurs on <API key>() **/
st = test_cv.wait_for( ul, intv );
} __TBB_CATCH( std::runtime_error& ) {}
ASSERT( ul, "mutex should have been reacquired" );
ul.unlock();
if( st==timeout )
++n_timed_out;
}
ASSERT( n_timed_out>0, "should have been timed-out at least once\n" );
++n_done_1;
while( n_done_1<nthread ) __TBB_Yield();
for( int i=1; i<10; ++i ) {
tbb::tick_count::interval_t intv((double)i*0.0001 /*seconds*/);
ul.lock();
__TBB_TRY {
/** Some version of glibc return EINVAL instead 0 when spurious wakeup occurs on <API key>() **/
ASSERT( false==test_cv.wait_for( ul, intv, TestPredicateFalse()), "incorrect return value" );
} __TBB_CATCH( std::runtime_error& ) {}
ASSERT( ul, "mutex should have been reacquired" );
ul.unlock();
}
if( tid==0 )
n_waiters = 0;
// barrier
++n_done_2;
while( n_done_2<nthread ) __TBB_Yield();
// at this point, we know wait_for() successfully times out.
// so test if a thread blocked on wait_for() could receive a signal before its waiting time elapses.
if( tid==0 ) {
// signaler
n_signaled = 0;
ASSERT( n_waiters==0, NULL );
++n_done_2; // open gate 1
while( n_waiters<(nthread-1) ) __TBB_Yield(); // wait until all other threads block on cv. flag_1
ul.lock();
test_cv.notify_all();
n_waiters = 0;
ul.unlock();
while( n_done_2<2*nthread ) __TBB_Yield();
ASSERT( n_signaled>0, "too small an interval?" );
n_signaled = 0;
} else {
while( n_done_2<nthread+1 ) __TBB_Yield(); // gate 1
// sleeper
tbb::tick_count::interval_t intv((double)2.0 /*seconds*/);
ul.lock();
++n_waiters; // raise flag 1/(nthread-1)
t1 = tbb::tick_count::now();
cv_status st = test_cv.wait_for( ul, intv ); // gate 2
t2 = tbb::tick_count::now();
ul.unlock();
if( st==no_timeout ) {
++n_signaled;
ASSERT( (t2-t1).seconds()<intv.seconds(), "got a signal after timed-out?" );
}
}
ASSERT( n_done==0, NULL );
++n_done_2;
if( tid==0 ) {
ASSERT( n_waiters==0, NULL );
++n_done; // open gate 3
while( n_waiters<(nthread-1) ) __TBB_Yield(); // wait until all other threads block on cv.
for( int i=0; i<2*short_delay; ++i ) __TBB_Yield(); // give some time to waiters so that all of them in the waitq
ul.lock();
false_to_true = true;
test_cv.notify_all(); // open gate 4
ul.unlock();
while( n_done<nthread ) __TBB_Yield(); // wait until all other threads wake up.
ASSERT( n_signaled>0, "too small an interval?" );
} else {
while( n_done<1 ) __TBB_Yield(); // gate 3
tbb::tick_count::interval_t intv((double)2.0 /*seconds*/);
ul.lock();
++n_waiters;
// wait_for w/ predciate
t1 = tbb::tick_count::now();
ASSERT( test_cv.wait_for( ul, intv, <API key>())==true, NULL ); // gate 4
t2 = tbb::tick_count::now();
ul.unlock();
if( (t2-t1).seconds()<intv.seconds() )
++n_signaled;
++n_done;
}
}
};
tbb::atomic<int> ticket_for_sleep, ticket_for_wakeup, signaled_ticket, wokeup_ticket;
tbb::atomic<unsigned> n_visit_to_waitq;
unsigned max_waitq_length;
template<typename M>
struct <API key>: NoAssign {
int nthread;
condition_variable& test_cv;
M& my_mtx;
<API key>( int n_, condition_variable& cv_, M& mtx_ ) : nthread(n_), test_cv(cv_), my_mtx(mtx_) {}
void operator()( int tid ) const {
if( tid&1 ) {
// exercise signal part
while( ticket_for_wakeup<max_ticket ) {
int my_ticket = ++ticket_for_wakeup; // atomically grab the next ticket
if( my_ticket>max_ticket )
break;
for( ;; ) {
unique_lock<M> ul( my_mtx, defer_lock );
ul.lock();
if( n_waiters>0 && my_ticket<=ticket_for_sleep && my_ticket==(wokeup_ticket+1) ) {
signaled_ticket = my_ticket;
test_cv.notify_one();
++n_signaled;
ul.unlock();
break;
}
ul.unlock();
__TBB_Yield();
}
// give waiters time to go to sleep.
for( int m=0; m<short_delay; ++m )
__TBB_Yield();
}
} else {
while( ticket_for_sleep<max_ticket ) {
unique_lock<M> ul( my_mtx, defer_lock );
ul.lock();
// exercise wait part
int my_ticket = ++ticket_for_sleep; // grab my ticket
if( my_ticket>max_ticket ) break;
// each waiter should go to sleep at least once
unsigned nw = ++n_waiters;
for( ;; ) {
// update to max_waitq_length
if( nw>max_waitq_length ) max_waitq_length = nw;
++n_visit_to_waitq;
test_cv.wait( ul );
// if( ret==false ) ++n_timedout;
ASSERT( ul, "mutex should have been locked" );
--n_waiters;
if( signaled_ticket==my_ticket ) {
wokeup_ticket = my_ticket;
break;
}
if( n_waiters>0 )
test_cv.notify_one();
nw = ++n_waiters; // update to max_waitq_length occurs above
}
ul.unlock();
__TBB_Yield(); // give other threads chance to run.
}
}
++n_done;
spin_wait_until_eq( n_done, nthread );
ASSERT( n_signaled==max_ticket, "incorrect number of notifications sent" );
}
};
struct TestPredicate1 {
int target;
TestPredicate1( int i_ ) : target(i_) {}
bool operator()( ) { return signaled_ticket==target; }
};
template<typename M>
struct <API key>: NoAssign {
int nthread;
condition_variable& test_cv;
M& my_mtx;
int multiple;
<API key>( int n_, condition_variable& cv_, M& mtx_, int m_ ) :
nthread(n_), test_cv(cv_), my_mtx(mtx_), multiple(m_) {}
void operator()( int tid ) const {
if( tid&1 ) {
while( ticket_for_sleep<max_ticket ) {
unique_lock<M> ul( my_mtx, defer_lock );
// exercise wait part
int my_ticket = ++ticket_for_sleep; // grab my ticket
if( my_ticket>max_ticket )
break;
ul.lock();
++n_visit_to_waitq;
unsigned nw = ++n_waiters;
if( nw>max_waitq_length ) max_waitq_length = nw;
test_cv.wait( ul, TestPredicate1( my_ticket ) );
wokeup_ticket = my_ticket;
--n_waiters;
ASSERT( ul, "mutex should have been locked" );
ul.unlock();
__TBB_Yield(); // give other threads chance to run.
}
} else {
// exercise signal part
while( ticket_for_wakeup<max_ticket ) {
int my_ticket = ++ticket_for_wakeup; // atomically grab the next ticket
if( my_ticket>max_ticket )
break;
for( ;; ) {
unique_lock<M> ul( my_mtx );
if( n_waiters>0 && my_ticket<=ticket_for_sleep && my_ticket==(wokeup_ticket+1) ) {
signaled_ticket = my_ticket;
test_cv.notify_all();
++n_signaled;
ul.unlock();
break;
}
ul.unlock();
__TBB_Yield();
}
// give waiters time to go to sleep.
for( int m=0; m<long_delay*multiple; ++m )
__TBB_Yield();
}
}
++n_done;
spin_wait_until_eq( n_done, nthread );
ASSERT( n_signaled==max_ticket, "incorrect number of notifications sent" );
}
};
void InitGlobalCounters()
{
ticket_for_sleep = ticket_for_wakeup = signaled_ticket = wokeup_ticket = 0;
n_waiters = 0;
n_signaled = 0;
n_done = n_done_1 = n_done_2 = 0;
n_visit_to_waitq = 0;
n_timed_out = 0;
}
template<typename M>
void <API key>( const char* name, int nthread )
{
REMARK("testing %s in <API key>\n",name);
Counter<M> counter;
M mtx;
ASSERT( nthread>1, "at least two threads are needed for testing condition_variable" );
REMARK(" - constructor\n" );
// Test constructor.
{
condition_variable cv1;
#if _WIN32||_WIN64
condition_variable::native_handle_type handle = cv1.native_handle();
ASSERT( uintptr_t(&handle->cv_event)==uintptr_t(&handle->cv_native), NULL );
#endif
M mtx1;
barrier = 0;
NativeParallelFor( 2, WorkForCondVarCtor<M>( cv1, mtx1 ) );
}
REMARK(" - destructor\n" );
// Test destructor.
{
M mtx2;
test_cv = NULL;
n_waiters = 0;
NativeParallelFor( nthread, WorkForCondVarDtor<M>( nthread, mtx2 ) );
}
REMARK(" - timed_wait (i.e., wait_for)\n");
// Test timed wait.
{
condition_variable cv_tw;
M mtx_tw;
barrier = 0;
InitGlobalCounters();
int nthr = nthread>4?4:nthread;
NativeParallelFor( nthr, <API key><M>( nthr, cv_tw, mtx_tw ) );
}
REMARK(" - wait with notify_one\n");
// Test wait and notify_one
do {
condition_variable cv3;
M mtx3;
InitGlobalCounters();
NativeParallelFor( nthread, <API key><M>( nthread, cv3, mtx3 ) );
} while( n_visit_to_waitq==0 || max_waitq_length==0 );
REMARK(" - predicated wait with notify_all\n");
// Test wait_pred and notify_all
int delay_multiple = 1;
do {
condition_variable cv4;
M mtx4;
InitGlobalCounters();
NativeParallelFor( nthread, <API key><M>( nthread, cv4, mtx4, delay_multiple ) );
if( max_waitq_length<unsigned(nthread/2) )
++delay_multiple;
} while( n_visit_to_waitq<=0 || max_waitq_length<unsigned(nthread/2) );
}
#if TBB_USE_EXCEPTIONS
static tbb::atomic<int> err_count;
#define <API key>(op,msg) \
try { \
op; \
++err_count; \
} catch( std::runtime_error& e ) {ASSERT( strstr(e.what(), msg) , NULL );} catch(...) {++err_count;}
template<typename M>
void <API key>( const char * name ) {
REMARK("testing %s <API key>\n",name);
M mtx;
unique_lock<M> ul_0;
err_count = 0;
<API key>( ul_0.lock(), "Operation not permitted" );
<API key>( ul_0.try_lock(), "Operation not permitted" );
unique_lock<M> ul_1( mtx );
<API key>( ul_1.lock(), "Resource deadlock" );
<API key>( ul_1.try_lock(), "Resource deadlock" );
ul_1.unlock();
<API key>( ul_1.unlock(), "Operation not permitted" );
ASSERT( !err_count, "Some exceptions are not thrown or incorrect ones are thrown" );
}
template<typename M>
void <API key>( const char * name ) {
REMARK("testing %s in <API key>; yet to be implemented\n",name);
}
#endif /* TBB_USE_EXCEPTIONS */
template<typename Mutex, typename RecursiveMutex>
void DoCondVarTest()
{
for( int p=MinThread; p<=MaxThread; ++p ) {
REMARK( "testing with %d threads\n", p );
TestLocks<Mutex>( "mutex", p );
TestLocks<RecursiveMutex>( "recursive_mutex", p );
if( p<=1 ) continue;
// for testing condition_variable, at least one sleeper and one notifier are needed
<API key><Mutex>( "mutex", p );
}
#if <API key>
REPORT("Known issue: exception handling tests are skipped.\n");
#elif TBB_USE_EXCEPTIONS
<API key><Mutex>( "mutex" );
<API key><RecursiveMutex>( "recursive_mutex" );
<API key><Mutex>( "mutex" );
#endif /* TBB_USE_EXCEPTIONS */
} |
.welcomeMsg{
text-align: center;
font-family:'Arial';
}
body{
font-family: 'Verdana';
font-size: 18px;
height: ;
width: 100%;
background-repeat: no-repeat;
background-image: url("../images/way4.jpg");
-moz-background-size: cover;
-<API key>: cover;
background-size: cover;
background-position: top center !important;
background-repeat: no-repeat !important;
<API key>: fixed;
}
.oneWay {
float: left;
position: center;
}
.roundTrip {
float: right;
position: center;
}
.tripSelection{
position: absolute;
}
ul{
list-style-type: none;
margin: 0;
padding: 0;
}
li{
float: left;
display: inline-block;
width: 100px;
background-color: ;
}
.table{
margin: 0 auto ;
border-radius: 10px;
background-color: rgb(128,128,128);
box-shadow: -1px 2px 2px 1px rgba(0, 0, 0, 1);
}
.header{
position: relative;
width: 100%;
}
.logo1{
text-align:center;
margin: -50px 50px 0em;
padding: -45px -5px 0em;
}
.form{
font-size: 22px;
width: 40%;
padding: 40px;
margin: 0 auto ;
border-radius: 10px;
background-color: rgb(128,128,128);
box-shadow: -1px 2px 2px 1px rgba(0, 0, 0, 1);
}
.selectedRoute{
text-align: center;
}
footer , h5{
color: white;
}
.ui-autocomplete {
width: 170;
}
#ui-id-1 {
width: 170px;
}
#ui-id-8{
width:9px;
}
.btnbtn-default{
display: inline-block;
padding: 10px 19px;
margin-bottom: 0;
font-size: 19px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
font-size: 23px;
} |
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/kobject.h>
#include <linux/namei.h>
#include <linux/debugfs.h>
#include <linux/fsnotify.h>
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/parser.h>
#include <linux/magic.h>
#include <linux/slab.h>
#define <API key> 0700
static struct vfsmount *debugfs_mount;
static int debugfs_mount_count;
static bool debugfs_registered;
static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev,
void *data, const struct file_operations *fops)
{
struct inode *inode = new_inode(sb);
if (inode) {
inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
break;
case S_IFREG:
inode->i_fop = fops ? fops : &<API key>;
inode->i_private = data;
break;
case S_IFLNK:
inode->i_op = &<API key>;
inode->i_private = data;
break;
case S_IFDIR:
inode->i_op = &<API key>;
inode->i_fop = &<API key>;
/* directory inodes start off with i_nlink == 2
* (for "." entry) */
inc_nlink(inode);
break;
}
}
return inode;
}
/* SMP-safe */
static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
umode_t mode, dev_t dev, void *data,
const struct file_operations *fops)
{
struct inode *inode;
int error = -EPERM;
if (dentry->d_inode)
return -EEXIST;
inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops);
if (inode) {
d_instantiate(dentry, inode);
dget(dentry);
error = 0;
}
return error;
}
static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
int res;
mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
res = debugfs_mknod(dir, dentry, mode, 0, NULL, NULL);
if (!res) {
inc_nlink(dir);
fsnotify_mkdir(dir, dentry);
}
return res;
}
static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode,
void *data)
{
mode = (mode & S_IALLUGO) | S_IFLNK;
return debugfs_mknod(dir, dentry, mode, 0, data, NULL);
}
static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
void *data, const struct file_operations *fops)
{
int res;
mode = (mode & S_IALLUGO) | S_IFREG;
res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
if (!res)
fsnotify_create(dir, dentry);
return res;
}
static inline int debugfs_positive(struct dentry *dentry)
{
return dentry->d_inode && !d_unhashed(dentry);
}
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
umode_t mode;
};
enum {
Opt_uid,
Opt_gid,
Opt_mode,
Opt_err
};
static const match_table_t tokens = {
{Opt_uid, "uid=%u"},
{Opt_gid, "gid=%u"},
{Opt_mode, "mode=%o"},
{Opt_err, NULL}
};
struct debugfs_fs_info {
struct debugfs_mount_opts mount_opts;
};
static int <API key>(char *data, struct debugfs_mount_opts *opts)
{
substring_t args[MAX_OPT_ARGS];
int option;
int token;
kuid_t uid;
kgid_t gid;
char *p;
opts->mode = <API key>;
while ((p = strsep(&data, ",")) != NULL) {
if (!*p)
continue;
token = match_token(p, tokens, args);
switch (token) {
case Opt_uid:
if (match_int(&args[0], &option))
return -EINVAL;
uid = make_kuid(current_user_ns(), option);
if (!uid_valid(uid))
return -EINVAL;
opts->uid = uid;
break;
case Opt_gid:
if (match_int(&args[0], &option))
return -EINVAL;
gid = make_kgid(current_user_ns(), option);
if (!gid_valid(gid))
return -EINVAL;
opts->gid = gid;
break;
case Opt_mode:
if (match_octal(&args[0], &option))
return -EINVAL;
opts->mode = option & S_IALLUGO;
break;
/*
* We might like to report bad mount options here;
* but traditionally debugfs has ignored all mount options
*/
}
}
return 0;
}
static int <API key>(struct super_block *sb)
{
struct debugfs_fs_info *fsi = sb->s_fs_info;
struct inode *inode = sb->s_root->d_inode;
struct debugfs_mount_opts *opts = &fsi->mount_opts;
inode->i_mode &= ~S_IALLUGO;
inode->i_mode |= opts->mode;
inode->i_uid = opts->uid;
inode->i_gid = opts->gid;
return 0;
}
static int debugfs_remount(struct super_block *sb, int *flags, char *data)
{
int err;
struct debugfs_fs_info *fsi = sb->s_fs_info;
err = <API key>(data, &fsi->mount_opts);
if (err)
goto fail;
<API key>(sb);
fail:
return err;
}
static int <API key>(struct seq_file *m, struct dentry *root)
{
struct debugfs_fs_info *fsi = root->d_sb->s_fs_info;
struct debugfs_mount_opts *opts = &fsi->mount_opts;
if (!uid_eq(opts->uid, GLOBAL_ROOT_UID))
seq_printf(m, ",uid=%u",
from_kuid_munged(&init_user_ns, opts->uid));
if (!gid_eq(opts->gid, GLOBAL_ROOT_GID))
seq_printf(m, ",gid=%u",
from_kgid_munged(&init_user_ns, opts->gid));
if (opts->mode != <API key>)
seq_printf(m, ",mode=%o", opts->mode);
return 0;
}
static const struct super_operations <API key> = {
.statfs = simple_statfs,
.remount_fs = debugfs_remount,
.show_options = <API key>,
};
static int debug_fill_super(struct super_block *sb, void *data, int silent)
{
static struct tree_descr debug_files[] = {{""}};
struct debugfs_fs_info *fsi;
int err;
save_mount_options(sb, data);
fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL);
sb->s_fs_info = fsi;
if (!fsi) {
err = -ENOMEM;
goto fail;
}
err = <API key>(data, &fsi->mount_opts);
if (err)
goto fail;
err = simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
if (err)
goto fail;
sb->s_op = &<API key>;
<API key>(sb);
return 0;
fail:
kfree(fsi);
sb->s_fs_info = NULL;
return err;
}
static struct dentry *debug_mount(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data)
{
return mount_single(fs_type, flags, data, debug_fill_super);
}
static struct file_system_type debug_fs_type = {
.owner = THIS_MODULE,
.name = "debugfs",
.mount = debug_mount,
.kill_sb = kill_litter_super,
};
MODULE_ALIAS_FS("debugfs");
static struct dentry *__create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops)
{
struct dentry *dentry = NULL;
int error;
pr_debug("debugfs: creating file '%s'\n",name);
error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
&debugfs_mount_count);
if (error)
goto exit;
/* If the parent is not specified, we create it in the root.
* We need the root dentry to do this, which is in the super
* block. A pointer to that is in the struct vfsmount that we
* have around.
*/
if (!parent)
parent = debugfs_mount->mnt_root;
mutex_lock(&parent->d_inode->i_mutex);
dentry = lookup_one_len(name, parent, strlen(name));
if (!IS_ERR(dentry)) {
switch (mode & S_IFMT) {
case S_IFDIR:
error = debugfs_mkdir(parent->d_inode, dentry, mode);
break;
case S_IFLNK:
error = debugfs_link(parent->d_inode, dentry, mode,
data);
break;
default:
error = debugfs_create(parent->d_inode, dentry, mode,
data, fops);
break;
}
dput(dentry);
} else
error = PTR_ERR(dentry);
mutex_unlock(&parent->d_inode->i_mutex);
if (error) {
dentry = NULL;
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
}
exit:
return dentry;
}
struct dentry *debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops)
{
switch (mode & S_IFMT) {
case S_IFREG:
case 0:
break;
default:
BUG();
}
return __create_file(name, mode, parent, data, fops);
}
EXPORT_SYMBOL_GPL(debugfs_create_file);
/**
* debugfs_create_dir - create a directory in the debugfs filesystem
* @name: a pointer to a string containing the name of the directory to
* create.
* @parent: a pointer to the parent dentry for this file. This should be a
* directory dentry if set. If this paramater is NULL, then the
* directory will be created in the root of the debugfs filesystem.
*
* This function creates a directory in debugfs with the given name.
*
* This function will return a pointer to a dentry if it succeeds. This
* pointer must be passed to the debugfs_remove() function when the file is
* to be removed (no automatic cleanup happens if your module is unloaded,
* you are responsible here.) If an error occurs, %NULL will be returned.
*
* If debugfs is not enabled in the kernel, the value -%ENODEV will be
* returned.
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
return __create_file(name, S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
parent, NULL, NULL);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
/**
* <API key>- create a symbolic link in the debugfs filesystem
* @name: a pointer to a string containing the name of the symbolic link to
* create.
* @parent: a pointer to the parent dentry for this symbolic link. This
* should be a directory dentry if set. If this paramater is NULL,
* then the symbolic link will be created in the root of the debugfs
* filesystem.
* @target: a pointer to a string containing the path to the target of the
* symbolic link.
*
* This function creates a symbolic link with the given name in debugfs that
* links to the given target path.
*
* This function will return a pointer to a dentry if it succeeds. This
* pointer must be passed to the debugfs_remove() function when the symbolic
* link is to be removed (no automatic cleanup happens if your module is
* unloaded, you are responsible here.) If an error occurs, %NULL will be
* returned.
*
* If debugfs is not enabled in the kernel, the value -%ENODEV will be
* returned.
*/
struct dentry *<API key>(const char *name, struct dentry *parent,
const char *target)
{
struct dentry *result;
char *link;
link = kstrdup(target, GFP_KERNEL);
if (!link)
return NULL;
result = __create_file(name, S_IFLNK | S_IRWXUGO, parent, link, NULL);
if (!result)
kfree(link);
return result;
}
EXPORT_SYMBOL_GPL(<API key>);
static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
{
int ret = 0;
if (debugfs_positive(dentry)) {
if (dentry->d_inode) {
dget(dentry);
switch (dentry->d_inode->i_mode & S_IFMT) {
case S_IFDIR:
ret = simple_rmdir(parent->d_inode, dentry);
break;
case S_IFLNK:
kfree(dentry->d_inode->i_private);
/* fall through */
default:
simple_unlink(parent->d_inode, dentry);
break;
}
if (!ret)
d_delete(dentry);
dput(dentry);
}
}
return ret;
}
/**
* debugfs_remove - removes a file or directory from the debugfs filesystem
* @dentry: a pointer to a the dentry of the file or directory to be
* removed.
*
* This function removes a file or directory in debugfs that was previously
* created with a call to another debugfs function (like
* debugfs_create_file() or variants thereof.)
*
* This function is required to be called in order for the file to be
* removed, no automatic cleanup of files will happen when a module is
* removed, you are responsible here.
*/
void debugfs_remove(struct dentry *dentry)
{
struct dentry *parent;
int ret;
if (IS_ERR_OR_NULL(dentry))
return;
parent = dentry->d_parent;
if (!parent || !parent->d_inode)
return;
mutex_lock(&parent->d_inode->i_mutex);
ret = __debugfs_remove(dentry, parent);
mutex_unlock(&parent->d_inode->i_mutex);
if (!ret)
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
/**
* <API key> - recursively removes a directory
* @dentry: a pointer to a the dentry of the directory to be removed.
*
* This function recursively removes a directory tree in debugfs that
* was previously created with a call to another debugfs function
* (like debugfs_create_file() or variants thereof.)
*
* This function is required to be called in order for the file to be
* removed, no automatic cleanup of files will happen when a module is
* removed, you are responsible here.
*/
void <API key>(struct dentry *dentry)
{
struct dentry *child, *parent;
if (IS_ERR_OR_NULL(dentry))
return;
parent = dentry->d_parent;
if (!parent || !parent->d_inode)
return;
parent = dentry;
down:
mutex_lock(&parent->d_inode->i_mutex);
loop:
/*
* The parent->d_subdirs is protected by the d_lock. Outside that
* lock, the child can be unlinked and set to be freed which can
* use the d_child as the rcu head and corrupt this list.
*/
spin_lock(&parent->d_lock);
list_for_each_entry(child, &parent->d_subdirs, d_child) {
if (!debugfs_positive(child))
continue;
/* perhaps simple_empty(child) makes more sense */
if (!list_empty(&child->d_subdirs)) {
spin_unlock(&parent->d_lock);
mutex_unlock(&parent->d_inode->i_mutex);
parent = child;
goto down;
}
spin_unlock(&parent->d_lock);
if (!__debugfs_remove(child, parent))
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
/*
* The parent->d_lock protects agaist child from unlinking
* from d_subdirs. When releasing the parent->d_lock we can
* no longer trust that the next pointer is valid.
* Restart the loop. We'll skip this one with the
* debugfs_positive() check.
*/
goto loop;
}
spin_unlock(&parent->d_lock);
mutex_unlock(&parent->d_inode->i_mutex);
child = parent;
parent = parent->d_parent;
mutex_lock(&parent->d_inode->i_mutex);
if (child != dentry)
/* go up */
goto loop;
if (!__debugfs_remove(child, parent))
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
mutex_unlock(&parent->d_inode->i_mutex);
}
EXPORT_SYMBOL_GPL(<API key>);
/**
* debugfs_rename - rename a file/directory in the debugfs filesystem
* @old_dir: a pointer to the parent dentry for the renamed object. This
* should be a directory dentry.
* @old_dentry: dentry of an object to be renamed.
* @new_dir: a pointer to the parent dentry where the object should be
* moved. This should be a directory dentry.
* @new_name: a pointer to a string containing the target name.
*
* This function renames a file/directory in debugfs. The target must not
* exist for rename to succeed.
*
* This function will return a pointer to old_dentry (which is updated to
* reflect renaming) if it succeeds. If an error occurs, %NULL will be
* returned.
*
* If debugfs is not enabled in the kernel, the value -%ENODEV will be
* returned.
*/
struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
struct dentry *new_dir, const char *new_name)
{
int error;
struct dentry *dentry = NULL, *trap;
const char *old_name;
trap = lock_rename(new_dir, old_dir);
/* Source or destination directories don't exist? */
if (!old_dir->d_inode || !new_dir->d_inode)
goto exit;
/* Source does not exist, cyclic rename, or mountpoint? */
if (!old_dentry->d_inode || old_dentry == trap ||
d_mountpoint(old_dentry))
goto exit;
dentry = lookup_one_len(new_name, new_dir, strlen(new_name));
/* Lookup failed, cyclic rename or target exists? */
if (IS_ERR(dentry) || dentry == trap || dentry->d_inode)
goto exit;
old_name = <API key>(old_dentry->d_name.name);
error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode,
dentry);
if (error) {
<API key>(old_name);
goto exit;
}
d_move(old_dentry, dentry);
fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name,
S_ISDIR(old_dentry->d_inode->i_mode),
NULL, old_dentry);
<API key>(old_name);
unlock_rename(new_dir, old_dir);
dput(dentry);
return old_dentry;
exit:
if (dentry && !IS_ERR(dentry))
dput(dentry);
unlock_rename(new_dir, old_dir);
return NULL;
}
EXPORT_SYMBOL_GPL(debugfs_rename);
/**
* debugfs_initialized - Tells whether debugfs has been registered
*/
bool debugfs_initialized(void)
{
return debugfs_registered;
}
EXPORT_SYMBOL_GPL(debugfs_initialized);
static struct kobject *debug_kobj;
static int __init debugfs_init(void)
{
int retval;
debug_kobj = <API key>("debug", kernel_kobj);
if (!debug_kobj)
return -EINVAL;
retval = register_filesystem(&debug_fs_type);
if (retval)
kobject_put(debug_kobj);
else
debugfs_registered = true;
return retval;
}
core_initcall(debugfs_init); |
# Brian C. Lane <bcl@redhat.com>
# copy, or redistribute it subject to the terms and conditions of the GNU
# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
import unittest
from tests.baseclass import CommandTest
from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN, KS_WAIT
class FC3_TestCase(CommandTest):
command = "reboot"
def runTest(self):
# pass
cmd = self.assert_parse("reboot")
self.assertEqual(cmd.action, KS_REBOOT)
self.assertEqual(str(cmd), "# Reboot after installation\nreboot\n")
cmd = self.assert_parse("shutdown")
self.assertEqual(cmd.action, KS_SHUTDOWN)
self.assertEqual(str(cmd), "# Shutdown after installation\nshutdown\n")
cmd = self.assert_parse("halt")
# halt changed in F18
if self.__class__.__name__ in ("FC3_TestCase", "FC6_TestCase"):
self.assertEqual(cmd.action, KS_SHUTDOWN)
cmd = self.assert_parse("poweroff")
self.assertEqual(cmd.action, KS_SHUTDOWN)
class FC6_TestCase(FC3_TestCase):
def runTest(self):
FC3_TestCase.runTest(self)
# pass
cmd = self.assert_parse("reboot --eject")
self.assertEqual(cmd.action, KS_REBOOT)
self.assertEqual(cmd.eject, True)
self.assertEqual(str(cmd), "# Reboot after installation\nreboot --eject\n")
class F18_TestCase(FC6_TestCase):
def runTest(self):
FC6_TestCase.runTest(self)
# pass
cmd = self.assert_parse("halt")
self.assertEqual(cmd.action, KS_WAIT)
self.assertEqual(str(cmd), "# Halt after installation\nhalt\n")
cmd = self.assert_parse("halt --eject")
self.assertEqual(cmd.eject, True)
self.assertEqual(str(cmd), "# Halt after installation\nhalt --eject\n")
if __name__ == "__main__":
unittest.main() |
// $Id: SOCK_Dgram.cpp 91622 2010-09-06 08:26:30Z sma $
#include "ace/SOCK_Dgram.h"
#include "ace/Log_Msg.h"
#include "ace/INET_Addr.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_ctype.h"
#include "ace/os_include/net/os_if.h"
#include "ace/Truncate.h"
#if !defined (__ACE_INLINE__)
# include "ace/SOCK_Dgram.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32)
#include <iphlpapi.h>
#endif
// This is a workaround for platforms with non-standard
// definitions of the ip_mreq structure
#if ! defined (IMR_MULTIADDR)
#define IMR_MULTIADDR imr_multiaddr
#endif /* ! defined (IMR_MULTIADDR) */
<API key>
<API key> (ACE_SOCK_Dgram)
void
ACE_SOCK_Dgram::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_SOCK_Dgram::dump");
#endif /* ACE_HAS_DUMP */
}
// Allows a client to read from a socket without having to provide a
// buffer to read. This method determines how much data is in the
// socket, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
ssize_t
ACE_SOCK_Dgram::recv (iovec *io_vec,
ACE_Addr &addr,
int flags,
const ACE_Time_Value *timeout) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
#if defined (FIONREAD)
if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 )
{
return -1;
}
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int addr_len = addr.get_size ();
int inlen;
if (ACE_OS::ioctl (this->get_handle (),
FIONREAD,
&inlen) == -1)
return -1;
else if (inlen > 0)
{
ACE_NEW_RETURN (io_vec->iov_base,
char[inlen],
-1);
ssize_t rcv_len = ACE_OS::recvfrom (this->get_handle (),
(char *) io_vec->iov_base,
inlen,
flags,
(sockaddr *) saddr,
&addr_len);
if (rcv_len < 0)
{
delete[] (char *)io_vec->iov_base;
io_vec->iov_base = 0;
}
else
{
io_vec->iov_len = ACE_Utils::truncate_cast<u_long> (rcv_len);
addr.set_size (addr_len);
}
return rcv_len;
}
else
return 0;
#else
ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (addr);
ACE_UNUSED_ARG (io_vec);
ACE_UNUSED_ARG (timeout);
ACE_NOTSUP_RETURN (-1);
#endif /* FIONREAD */
}
// Here's the shared open function. Note that if we are using the
// PF_INET protocol family and the address of LOCAL == the address of
// the special variable SAP_ANY then we are going to arbitrarily bind
// to a portnumber.
int
ACE_SOCK_Dgram::shared_open (const ACE_Addr &local,
int protocol_family)
{
ACE_TRACE ("ACE_SOCK_Dgram::shared_open");
bool error = false;
if (local == ACE_Addr::sap_any)
{
if (protocol_family == PF_INET
#if defined (ACE_HAS_IPV6)
|| protocol_family == PF_INET6
#endif /* ACE_HAS_IPV6 */
)
{
if (ACE::bind_port (this->get_handle (),
INADDR_ANY,
protocol_family) == -1)
error = true;
}
}
else if (ACE_OS::bind (this->get_handle (),
reinterpret_cast<sockaddr *> (local.get_addr ()),
local.get_size ()) == -1)
error = true;
if (error)
this->close ();
return error ? -1 : 0;
}
int
ACE_SOCK_Dgram::open (const ACE_Addr &local,
int protocol_family,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr)
{
if (ACE_SOCK::open (SOCK_DGRAM,
protocol_family,
protocol,
protocolinfo,
g,
flags,
reuse_addr) == -1)
return -1;
else if (this->shared_open (local,
protocol_family) == -1)
return -1;
else
return 0;
}
// Here's the general-purpose open routine.
int
ACE_SOCK_Dgram::open (const ACE_Addr &local,
int protocol_family,
int protocol,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::open");
if (local != ACE_Addr::sap_any)
protocol_family = local.get_type ();
else if (protocol_family == PF_UNSPEC)
{
#if defined (ACE_HAS_IPV6)
protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET;
#else
protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
}
if (ACE_SOCK::open (SOCK_DGRAM,
protocol_family,
protocol,
reuse_addr) == -1)
return -1;
else
return this->shared_open (local,
protocol_family);
}
// Here's the general-purpose constructor used by a connectionless
// datagram ``server''...
ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
int protocol_family,
int protocol,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
if (this->open (local,
protocol_family,
protocol,
reuse_addr) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Dgram")));
}
ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
int protocol_family,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
if (this->open (local,
protocol_family,
protocol,
protocolinfo,
g,
flags,
reuse_addr) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_SOCK_Dgram")));
}
#if defined (ACE_HAS_MSG)
// Send an iovec of size N to ADDR as a datagram (connectionless
// version).
ssize_t
ACE_SOCK_Dgram::send (const iovec iov[],
int n,
const ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
msghdr send_msg;
send_msg.msg_iov = (iovec *) iov;
send_msg.msg_iovlen = n;
#if defined (<API key>)
send_msg.msg_name = (struct sockaddr *) addr.get_addr ();
#else
send_msg.msg_name = (char *) addr.get_addr ();
#endif /* <API key> */
send_msg.msg_namelen = addr.get_size ();
#if defined (<API key>)
send_msg.msg_control = 0;
send_msg.msg_controllen = 0;
send_msg.msg_flags = 0;
#else
send_msg.msg_accrights = 0;
send_msg.msg_accrightslen = 0;
#endif /* <API key> */
return ACE_OS::sendmsg (this->get_handle (),
&send_msg,
flags);
}
// Recv an iovec of size N to ADDR as a datagram (connectionless
// version).
ssize_t
ACE_SOCK_Dgram::recv (iovec iov[],
int n,
ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
msghdr recv_msg;
recv_msg.msg_iov = (iovec *) iov;
recv_msg.msg_iovlen = n;
#if defined (<API key>)
recv_msg.msg_name = (struct sockaddr *) addr.get_addr ();
#else
recv_msg.msg_name = (char *) addr.get_addr ();
#endif /* <API key> */
recv_msg.msg_namelen = addr.get_size ();
#if defined (<API key>)
recv_msg.msg_control = 0 ;
recv_msg.msg_controllen = 0 ;
#else
recv_msg.msg_accrights = 0;
recv_msg.msg_accrightslen = 0;
#endif /* <API key> */
ssize_t status = ACE_OS::recvmsg (this->get_handle (),
&recv_msg,
flags);
addr.set_size (recv_msg.msg_namelen);
addr.set_type (((sockaddr_in *) addr.get_addr())->sin_family);
return status;
}
#else /* ACE_HAS_MSG */
// Send an iovec of size N to ADDR as a datagram (connectionless
// version).
ssize_t
ACE_SOCK_Dgram::send (const iovec iov[],
int n,
const ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
size_t length = 0;
int i;
// Determine the total length of all the buffers in <iov>.
for (i = 0; i < n; i++)
#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS))
// The iov_len is unsigned on Linux, RTEMS and with Borland. If we go
// ahead and try the if, it will emit a warning.
if (iov[i].iov_len < 0)
return -1;
else
#endif
length += iov[i].iov_len;
char *buf = 0;
#if defined (ACE_HAS_ALLOCA)
buf = alloca (length);
#else
ACE_NEW_RETURN (buf,
char[length],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
char *ptr = buf;
for (i = 0; i < n; i++)
{
ACE_OS::memcpy (ptr, iov[i].iov_base, iov[i].iov_len);
ptr += iov[i].iov_len;
}
ssize_t result = ACE_SOCK_Dgram::send (buf, length, addr, flags);
#if !defined (ACE_HAS_ALLOCA)
delete[] buf;
#endif /* !defined (ACE_HAS_ALLOCA) */
return result;
}
// Recv an iovec of size N to ADDR as a datagram (connectionless
// version).
ssize_t
ACE_SOCK_Dgram::recv (iovec iov[],
int n,
ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
ssize_t length = 0;
int i;
for (i = 0; i < n; i++)
#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS))
// The iov_len is unsigned on Linux, RTEMS and with Borland. If we go
// ahead and try the if, it will emit a warning.
if (iov[i].iov_len < 0)
return -1;
else
#endif
length += iov[i].iov_len;
char *buf = 0;
#if defined (ACE_HAS_ALLOCA)
buf = alloca (length);
#else
ACE_NEW_RETURN (buf,
char[length],
-1);
#endif /* !defined (ACE_HAS_ALLOCA) */
length = ACE_SOCK_Dgram::recv (buf, length, addr, flags);
if (length != -1)
{
char *ptr = buf;
int copyn = length;
for (i = 0;
i < n && copyn > 0;
i++)
{
ACE_OS::memcpy (iov[i].iov_base, ptr,
// iov_len is int on some platforms, size_t on others
copyn > (int) iov[i].iov_len
? (size_t) iov[i].iov_len
: (size_t) copyn);
ptr += iov[i].iov_len;
copyn -= iov[i].iov_len;
}
}
#if !defined (ACE_HAS_ALLOCA)
delete[] buf;
#endif /* !defined (ACE_HAS_ALLOCA) */
return length;
}
#endif /* ACE_HAS_MSG */
ssize_t
ACE_SOCK_Dgram::recv (void *buf,
size_t n,
ACE_Addr &addr,
int flags,
const ACE_Time_Value *timeout) const
{
if( ACE::handle_read_ready (this->get_handle (), timeout) == 1 )
{
// Goes fine, call <recv> to get data
return this->recv (buf, n, addr, flags);
}
else
{
return -1;
}
}
ssize_t
ACE_SOCK_Dgram::send (const void *buf,
size_t n,
const ACE_Addr &addr,
int flags,
const ACE_Time_Value *timeout) const
{
// Check the status of the current socket.
if( ACE::handle_write_ready (this->get_handle (), timeout) == 1 )
{
// Goes fine, call <send> to transmit the data.
return this->send (buf, n, addr, flags);
}
else
{
return -1;
}
}
int
ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
int addr_family)
{
#if defined (IP_MULTICAST_IF) && (IP_MULTICAST_IF != 0)
# if defined (ACE_HAS_IPV6)
bool ipv6_mif_set = false;
if (addr_family == AF_INET6 || addr_family == AF_UNSPEC)
{
ACE_INET_Addr addr;
addr.set (static_cast<u_short> (0), ACE_IPV6_ANY);
ipv6_mreq send_mreq;
if (this-><API key> (&send_mreq,
addr,
net_if) == -1)
return -1;
// Only let this attempt to set unknown interface when INET6 is
// specifically requested. Otherwise we will just try INET.
if (send_mreq.ipv6mr_interface != 0 || addr_family == AF_INET6)
{
if (this->ACE_SOCK::set_option
(IPPROTO_IPV6, IPV6_MULTICAST_IF,
&(send_mreq.ipv6mr_interface),
sizeof send_mreq.ipv6mr_interface) == -1)
return -1;
}
ipv6_mif_set = send_mreq.ipv6mr_interface != 0;
}
# if defined (ACE_WIN32)
// For Win32 net_if is distintly different between INET6 and INET
// so it is always either an INET6 if or an INET if.
if (!ipv6_mif_set && (addr_family == AF_INET || addr_family == AF_UNSPEC))
# else
if (addr_family == AF_INET || addr_family == AF_UNSPEC)
# endif
{
ACE_INET_Addr addr (static_cast<u_short> (0));
ip_mreq send_mreq;
if (this-><API key> (&send_mreq,
addr,
net_if) == -1)
{
if (!ipv6_mif_set)
return -1;
}
else if (this->ACE_SOCK::set_option (IPPROTO_IP,
IP_MULTICAST_IF,
&(send_mreq.imr_interface),
sizeof send_mreq.imr_interface) == -1)
{
if (!ipv6_mif_set)
return -1;
}
}
# else /* ACE_HAS_IPV6 */
ACE_UNUSED_ARG (addr_family);
ACE_INET_Addr addr (static_cast<u_short> (0));
ip_mreq send_mreq;
if (this-><API key> (&send_mreq,
addr,
net_if) == -1)
return -1;
if (this->ACE_SOCK::set_option (IPPROTO_IP,
IP_MULTICAST_IF,
&(send_mreq.imr_interface),
sizeof send_mreq.imr_interface) == -1)
return -1;
# endif /* !ACE_HAS_IPV6 */
#else /* IP_MULTICAST_IF */
// Send interface option not supported - ignore it.
// (We may have been invoked by ::subscribe, so we have to allow
// a non-null interface parameter in this function.)
ACE_UNUSED_ARG (net_if);
ACE_UNUSED_ARG (addr_family);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Send interface specification not ")
ACE_TEXT ("supported - IGNORED.\n")));
#endif /* !IP_MULTICAST_IF */
return 0;
}
int
ACE_SOCK_Dgram::<API key> (ip_mreq *ret_mreq,
const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if)
{
ACE_TRACE ("<API key>::<API key>");
ip_mreq lmreq; // Scratch copy.
if (net_if != 0)
{
#if defined (ACE_WIN32) || defined(__INTERIX)
// This port number is not necessary, just convenient
ACE_INET_Addr interface_addr;
if (interface_addr.set (mcast_addr.get_port_number (), net_if) == -1)
return -1;
lmreq.imr_interface.s_addr =
ACE_HTONL (interface_addr.get_ip_address ());
#else
ifreq if_address;
ACE_OS::strcpy (if_address.ifr_name, <API key> (net_if));
if (ACE_OS::ioctl (this->get_handle (),
SIOCGIFADDR,
&if_address) == -1)
return -1;
sockaddr_in *socket_address =
reinterpret_cast<sockaddr_in*> (&if_address.ifr_addr);
lmreq.imr_interface.s_addr = socket_address->sin_addr.s_addr;
#endif /* ACE_WIN32 || __INTERIX */
}
else
lmreq.imr_interface.s_addr = INADDR_ANY;
lmreq.IMR_MULTIADDR.s_addr = ACE_HTONL (mcast_addr.get_ip_address ());
// Set return info, if requested.
if (ret_mreq)
*ret_mreq = lmreq;
return 0;
}
#if defined (ACE_HAS_IPV6)
// XXX: This will not work on any operating systems that do not support
// if_nametoindex or that is not Win32 >= Windows XP/Server 2003
int
ACE_SOCK_Dgram::<API key> (ipv6_mreq *ret_mreq,
const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if)
{
ACE_TRACE ("<API key>::<API key>");
ipv6_mreq lmreq; // Scratch copy.
ACE_OS::memset (&lmreq,
0,
sizeof (lmreq));
#if defined(__linux__)
if (net_if != 0)
{
lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (<API key>(net_if));
}
else
#elif defined (ACE_WIN32)
if (net_if != 0)
{
int if_ix = 0;
bool num_if =
ACE_OS::ace_isdigit (net_if[0]) &&
(if_ix = ACE_OS::atoi (net_if)) > 0;
<API key> tmp_addrs;
// Initial call to determine actual memory size needed
DWORD dwRetVal;
ULONG bufLen = 0;
if ((dwRetVal = ::<API key> (AF_INET6,
0,
0,
&tmp_addrs,
&bufLen)) != <API key>)
return -1; // With output bufferlength 0 this can't be right.
// Get required output buffer and retrieve info for real.
<API key> pAddrs;
char *buf;
ACE_NEW_RETURN (buf,
char[bufLen],
-1);
pAddrs = reinterpret_cast<<API key>> (buf);
if ((dwRetVal = ::<API key> (AF_INET6,
0,
0,
pAddrs,
&bufLen)) != NO_ERROR)
{
delete[] buf; // clean up
return -1;
}
lmreq.ipv6mr_interface = 0; // initialize
while (pAddrs)
{
if ((num_if && pAddrs->Ipv6IfIndex == static_cast<unsigned int>(if_ix))
|| (!num_if &&
(ACE_OS::strcmp (<API key> (net_if),
pAddrs->AdapterName) == 0
|| ACE_OS::strcmp (<API key> (net_if),
ACE_Wide_To_Ascii (pAddrs->FriendlyName).char_rep()) == 0)))
{
lmreq.ipv6mr_interface = pAddrs->Ipv6IfIndex;
break;
}
pAddrs = pAddrs->Next;
}
delete[] buf; // clean up
}
else
#else /* ACE_WIN32 */
ACE_UNUSED_ARG(net_if);
#endif /* ACE_WIN32 */
lmreq.ipv6mr_interface = 0;
// now set the multicast address
ACE_OS::memcpy (&lmreq.ipv6mr_multiaddr,
&((sockaddr_in6 *) mcast_addr.get_addr ())->sin6_addr,
sizeof (in6_addr));
// Set return info, if requested.
if (ret_mreq)
*ret_mreq = lmreq;
return 0;
}
#endif /* __linux__ && ACE_HAS_IPV6 */
<API key> |
#include "../config.h"
#include "../lib/mbselib.h"
#include "taskstat.h"
#include "callstat.h"
#include "outstat.h"
#include "taskibc.h"
#include "taskutil.h"
/*
* Semafores
*/
int s_scanout = FALSE;
int s_mailout = FALSE;
int s_mailin = FALSE;
int s_reqindex = FALSE;
int s_index = FALSE;
int s_msglink = FALSE;
int s_newnews = FALSE;
int s_bbsopen = FALSE;
int s_do_inet = FALSE;
int tosswait = TOSSWAIT_TIME;
extern int UPSalarm;
extern int UPSdown;
extern int ptimer;
extern int rescan;
extern struct taskrec TCFG;
extern int internet;
extern int ZMH;
typedef struct {
int tot_clt; /* Total client connects */
int peak_clt; /* Peak simultaneous tot_cltes */
int s_error; /* Syntax errors from clients */
int c_error; /* Comms errors from clients */
} cl_stat;
typedef struct {
int start; /* Start date/time */
int laststart; /* Last start date/time */
int daily; /* Last daily update */
int startups; /* Total starts */
int clients; /* Connected clients */
cl_stat total; /* Total statistics */
cl_stat today; /* Todays statistics */
unsigned open : 1; /* Is BBS open */
unsigned int sequence; /* Sequencer counter */
unsigned int mkbrcvd; /* MIB mailer Kbytes received */
unsigned int mkbsent; /* MIB mailer Kbytes sent */
unsigned int msessin; /* MIB mailer inbound sessions */
unsigned int msessout; /* MIB mailer outbound sessions */
unsigned int msesssecure; /* MIB mailer secure sessions */
unsigned int msessunsec; /* MIB mailer unsecure sessions */
unsigned int msessbad; /* MIB mailer bad sessions */
unsigned int mftsc; /* MIB mailer FTSC sessions */
unsigned int myoohoo; /* MIB mailer YooHoo sessions */
unsigned int memsi; /* MIB mailer EMSI sessions */
unsigned int mbinkp; /* MIB mailer Binkp sessions */
unsigned int mfreqs; /* MIB mailer file requests */
unsigned int tmsgsin; /* MIB tosser messages in */
unsigned int tmsgsout; /* MIB tosser messages out */
unsigned int tmsgsbad; /* MIB tosser messages bad */
unsigned int tmsgsdupe; /* MIB tosser messages dupe */
unsigned int tnetin; /* MIB tosser netmail in */
unsigned int tnetout; /* MIB tosser netmail out */
unsigned int tnetbad; /* MIB tosser netmail bad */
unsigned int temailin; /* MIB tosser email in */
unsigned int temailout; /* MIB tosser email out */
unsigned int temailbad; /* MIB tosser email bad */
unsigned int techoin; /* MIB tosser echomail in */
unsigned int techoout; /* MIB tosser echomail out */
unsigned int techobad; /* MIB tosser echomail bad */
unsigned int techodupe; /* MIB tosser echomail dupe */
unsigned int tnewsin; /* MIB tosser news in */
unsigned int tnewsout; /* MIB tosser news out */
unsigned int tnewsbad; /* MIB tosser news bad */
unsigned int tnewsdupe; /* MIB tosser news dupe */
unsigned int tfilesin; /* MIB tosser files in */
unsigned int tfilesout; /* MIB tosser files out */
unsigned int tfilesbad; /* MIB tosser bad files */
unsigned int tfilesdupe; /* MIB tosser dupe files */
unsigned int tfilesmagic; /* MIB tosser files magics */
unsigned int tfileshatched; /* MIB tosser files hatched */
unsigned int ooutsize; /* MIB outbound size */
unsigned int bsessions; /* MIB BBS sessions */
unsigned int bminutes; /* MIB BBS minutes used */
unsigned int bposted; /* MIB BBS msgs posted */
unsigned int buploads; /* MIB BBS file uploads */
unsigned int bkbupload; /* MIB BBS kbytes uploaded */
unsigned int bdownloads; /* MIB BBS file downloads */
unsigned int bkbdownload; /* MIB BBS kbytes downloaded */
unsigned int bchats; /* MIB BBS chatsessions */
unsigned int bchatminutes; /* MIB BBS chat minutes */
} status_r;
static char stat_fn[PATH_MAX]; /* Statusfile name */
static status_r status; /* Status data */
extern double Load; /* System Load */
extern int Processing; /* Is system running */
/************************************************************************
*
* Initialize the statusfile, create it if necesary.
*/
void status_init()
{
size_t cnt;
int stat_fd;
snprintf(stat_fn, PATH_MAX, "%s/var/status.mbsed", getenv("MBSE_ROOT"));
/*
* First check if this is the very first time we start the show.
* If so, we generate an empty status file with only the start
* date in it.
*/
memset((char *)&status, 0, sizeof(status_r));
stat_fd = open(stat_fn, O_RDWR);
if (stat_fd == -1) {
status.start = (int)time(NULL);
status.daily = (int)time(NULL);
status.sequence = (unsigned int)time(NULL);
stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
cnt = write(stat_fd, &status, sizeof(status_r));
Syslog('+', "New statusfile created");
lseek(stat_fd, 0, SEEK_SET);
}
cnt = read(stat_fd, &status, sizeof(status_r));
if ((cnt != sizeof(status_r)) && (cnt < 50)) {
printf("Error reading status file\n");
exit(MBERR_INIT_ERROR);
}
status.startups++;
status.laststart = (int)time(NULL);
status.clients = 1; /* We are a client ourself */
s_bbsopen = status.open;
lseek(stat_fd, 0, SEEK_SET);
cnt = write(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
Syslog('?', "$Error rewrite status file\n");
exit(MBERR_INIT_ERROR);
}
close(stat_fd);
}
/*
* Writeback the updated status record.
*/
void status_write(void);
void status_write(void)
{
int d, stat_fd, yday;
struct tm ttm;
time_t temp;
temp = time(NULL);
localtime_r(&temp, &ttm);
yday = ttm.tm_yday;
temp = (time_t)status.daily;
localtime_r(&temp, &ttm);
/*
* If we passed to the next day, zero the today counters
*/
if (yday != ttm.tm_yday) {
Syslog('+', "Last days statistics:");
Syslog('+', "Total clients : %lu", status.today.tot_clt);
Syslog('+', "Peak clients : %lu", status.today.peak_clt);
Syslog('+', "Syntax errors : %lu", status.today.s_error);
Syslog('+', "Comms errors : %lu", status.today.c_error);
memset((char *)&status.today, 0, sizeof(cl_stat));
status.daily = time(NULL);
Syslog('+', "Zeroed todays status counters");
}
if ((stat_fd = open(stat_fn, O_RDWR)) == -1) {
Syslog('?', "$Error open statusfile %s", stat_fn);
return;
}
if ((d = lseek(stat_fd, 0, SEEK_SET)) != 0) {
Syslog('?', "$Error seeking in statusfile");
return;
}
d = write(stat_fd, &status, sizeof(status_r));
if (d != sizeof(status_r))
Syslog('?', "$Error writing statusfile, only %d bytes", d);
/*
* CLose the statusfile
*/
if (close(stat_fd) != 0)
Syslog('?', "$Error closing statusfile");
}
/*************************************************************************
*
* Various actions on the statusfile.
*/
/*
* Check for Zone Mail Hour, return TRUE if it is.
*/
int get_zmh()
{
struct tm l_date;
char sstime[6];
time_t Now;
Now = time(NULL);
gmtime_r(&Now, &l_date);
snprintf(sstime, 6, "%02d:%02d", l_date.tm_hour, l_date.tm_min);
if ((strncmp(sstime, TCFG.zmh_start, 5) >= 0) && (strncmp(sstime, TCFG.zmh_end, 5) < 0)) {
if (!ZMH) {
CreateSema((char *)"zmh");
Syslog('!', "Start of Zone Mail Hour");
ZMH = TRUE;
}
} else {
if (ZMH) {
RemoveSema((char *)"zmh");
Syslog('!', "End of Zone Mail Hour");
ZMH = FALSE;
}
}
return ZMH;
}
void stat_inc_clients()
{
status.clients++;
status.total.tot_clt++;
status.today.tot_clt++;
if (status.clients >= status.total.peak_clt)
status.total.peak_clt = status.clients;
if (status.clients >= status.today.peak_clt)
status.today.peak_clt = status.clients;
status_write();
}
void stat_dec_clients()
{
status.clients
status_write();
}
void stat_set_open(int op)
{
if (op) {
if (!s_bbsopen) {
Syslog('!', "The bbs is open");
sem_set((char *)"scanout", TRUE);
}
} else {
if (s_bbsopen) {
Syslog('!', "The bbs is closed");
}
}
s_bbsopen = status.open = op;
status_write();
}
void stat_inc_serr()
{
status.total.s_error++;
status.today.s_error++;
status_write();
}
void stat_inc_cerr()
{
status.total.c_error++;
status.today.c_error++;
status_write();
}
void stat_status_r(char *buf)
{
int i, srvcnt = 0, chncnt = 0, usrcnt = 0;
for (i = 0; i < MAXIBC_SRV; i++)
if (strlen(srv_list[i].server))
srvcnt++;
for (i = 0; i < MAXIBC_CHN; i++)
if (strlen(chn_list[i].server))
chncnt++;
for (i = 0; i < MAXIBC_USR; i++)
if (strlen(usr_list[i].server))
usrcnt++;
snprintf(buf, SS_BUFSIZE, "100:23,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%u,%d,%d,%d;",
status.start, status.laststart, status.daily,
status.startups, status.clients,
status.total.tot_clt, status.total.peak_clt,
status.total.s_error, status.total.c_error,
status.today.tot_clt, status.today.peak_clt,
status.today.s_error, status.today.c_error,
status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence,
srvcnt, chncnt, usrcnt);
return;
}
/*
* Return open status:
* 0 = open.
* 1 = closed.
* 2 = Zone Mail Hour.
*/
int stat_bbs_stat()
{
if (!status.open)
return 1;
if (get_zmh())
return 2;
return 0;
}
/*
* Get next sequence number
*/
void getseq_r(char *buf)
{
status.sequence++;
status_write();
snprintf(buf, 80, "100:1,%u;", status.sequence);
return;
}
unsigned int gettoken(void)
{
status.sequence++;
status_write();
return status.sequence;
}
int sem_set(char *sem, int value)
{
if (!strcmp(sem, "scanout")) {
s_scanout = value;
if (value)
rescan = TRUE;
} else if (!strcmp(sem, "mailout")) {
s_mailout = value;
} else if (!strcmp(sem, "mailin")) {
s_mailin = value;
if (value)
tosswait = TOSSWAIT_TIME;
} else if (!strcmp(sem, "mbindex")) {
s_index = value;
} else if (!strcmp(sem, "newnews")) {
s_newnews = value;
} else if (!strcmp(sem, "msglink")) {
s_msglink = value;
} else if (!strcmp(sem, "reqindex")) {
s_reqindex = value;
} else if (!strcmp(sem, "do_inet")) {
s_do_inet = value;
} else {
return FALSE;
}
ptimer = PAUSETIME;
return TRUE;
}
void sem_status_r(char *data, char *buf)
{
char *sem;
int value;
snprintf(buf, 40, "200:1,16;");
strtok(data, ",");
sem = strtok(NULL, ";");
if (!strcmp(sem, "scanout")) {
value = s_scanout;
} else if (!strcmp(sem, "mailout")) {
value = s_mailout;
} else if (!strcmp(sem, "mailin")) {
value = s_mailin;
} else if (!strcmp(sem, "mbindex")) {
value = s_index;
} else if (!strcmp(sem, "newnews")) {
value = s_newnews;
} else if (!strcmp(sem, "msglink")) {
value = s_msglink;
} else if (!strcmp(sem, "reqindex")) {
value = s_reqindex;
} else if (!strcmp(sem, "upsalarm")) {
value = UPSalarm;
} else if (!strcmp(sem, "upsdown")) {
value = UPSdown;
} else if (!strcmp(sem, "do_inet")) {
value = s_do_inet;
} else {
Syslog('s', "sem_status(%s) buf=%s", sem, buf);
return;
}
snprintf(buf, 40, "100:1,%s;", value ? "1":"0");
return;
}
void sem_create_r(char *data, char *buf)
{
char *sem;
strtok(data, ",");
sem = xstrcpy(strtok(NULL, ";"));
if (sem_set(sem, TRUE))
snprintf(buf, 40, "100:0;");
else
snprintf(buf, 40, "200:1,16;");
free(sem);
return;
}
void sem_remove_r(char *data, char *buf)
{
char *sem;
strtok(data, ",");
sem = xstrcpy(strtok(NULL, ";"));
if (sem_set(sem, FALSE))
snprintf(buf, 40, "100:0;");
else
snprintf(buf, 40, "200:1,16;");
free(sem);
return;
}
void mib_set_mailer(char *data)
{
unsigned int kbrcvd, kbsent, direction, state, type, freqs;
Syslog('m', "MIB set mailer %s", data);
strtok(data, ",");
kbrcvd = atoi(strtok(NULL, ","));
kbsent = atoi(strtok(NULL, ","));
direction = atoi(strtok(NULL, ","));
state = atoi(strtok(NULL, ","));
type = atoi(strtok(NULL, ","));
freqs = atoi(strtok(NULL, ";"));
status.mkbrcvd += kbrcvd;
status.mkbsent += kbsent;
if (direction)
status.msessout++;
else
status.msessin++;
switch (state) {
case 0: status.msesssecure++; break;
case 1: status.msessunsec++; break;
case 2: status.msessbad++; break;
}
switch (type) {
case 1: status.mftsc++; break;
case 2: status.myoohoo++; break;
case 3: status.memsi++; break;
case 4: status.mbinkp++; break;
}
status.mfreqs += freqs;
Syslog('m', "MIB mailer: rcvd=%d sent=%d in=%d out=%d sec=%d unsec=%d bad=%d ftsc=%d yoohoo=%d emsi=%d binkp=%d freq=%d",
status.mkbrcvd, status.mkbsent, status.msessin,
status.msessout, status.msesssecure, status.msessunsec, status.msessbad,
status.mftsc, status.myoohoo, status.memsi, status.mbinkp, status.mfreqs);
status_write();
}
void mib_get_mailer_r(char *buf)
{
snprintf(buf, 127, "100:12,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d;",
status.mkbrcvd, status.mkbsent, status.msessin,
status.msessout, status.msesssecure, status.msessunsec, status.msessbad,
status.mftsc, status.myoohoo, status.memsi, status.mbinkp, status.mfreqs);
return;
}
void mib_set_netmail(char *data)
{
unsigned int in, out, bad;
Syslog('m', "MIB set netmail %s", data);
strtok(data, ",");
in = atoi(strtok(NULL, ","));
out = atoi(strtok(NULL, ","));
bad = atoi(strtok(NULL, ";"));
status.tmsgsin += in;
status.tnetin += in;
status.tmsgsout += out;
status.tnetout += out;
status.tmsgsbad += bad;
status.tnetbad += bad;
Syslog('m', "MIB netmail: in=%d out=%d bad=%d in=%d out=%d bad=%d", status.tmsgsin, status.tmsgsout, status.tmsgsbad,
status.tnetin, status.tnetout, status.tnetbad);
status_write();
}
void mib_get_netmail_r(char *buf)
{
snprintf(buf, 127, "100:3,%d,%d,%d;", status.tnetin, status.tnetout, status.tnetbad);
return;
}
void mib_set_email(char *data)
{
unsigned int in, out, bad;
Syslog('m', "MIB set email %s", data);
strtok(data, ",");
in = atoi(strtok(NULL, ","));
out = atoi(strtok(NULL, ","));
bad = atoi(strtok(NULL, ";"));
status.tmsgsin += in;
status.temailin += in;
status.tmsgsout += out;
status.temailout += out;
status.tmsgsbad += bad;
status.temailbad += bad;
Syslog('m', "MIB email: in=%d out=%d bad=%d in=%d out=%d bad=%d", status.tmsgsin, status.tmsgsout, status.tmsgsbad,
status.temailin, status.temailout, status.temailbad);
status_write();
}
void mib_get_email_r(char *buf)
{
snprintf(buf, 127, "100:3,%d,%d,%d;", status.temailin, status.temailout, status.temailbad);
return;
}
void mib_set_news(char *data)
{
unsigned int in, out, bad, dupe;
Syslog('m', "MIB set news %s", data);
strtok(data, ",");
in = atoi(strtok(NULL, ","));
out = atoi(strtok(NULL, ","));
bad = atoi(strtok(NULL, ","));
dupe = atoi(strtok(NULL, ";"));
status.tmsgsin += in;
status.tnewsin += in;
status.tmsgsout += out;
status.tnewsout += out;
status.tmsgsbad += bad;
status.tnewsbad += bad;
status.tmsgsdupe += dupe;
status.tnewsdupe += dupe;
Syslog('m', "MIB news: in=%d out=%d bad=%d dupe=%d in=%d out=%d bad=%d dupe=%d",
status.tmsgsin, status.tmsgsout, status.tmsgsbad, status.tmsgsdupe,
status.tnewsin, status.tnewsout, status.tnewsbad, status.tnewsdupe);
status_write();
}
void mib_get_news_r(char *buf)
{
snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.tnewsin, status.tnewsout, status.tnewsbad, status.tnewsdupe);
return;
}
void mib_set_echo(char *data)
{
unsigned int in, out, bad, dupe;
Syslog('m', "MIB set echo %s", data);
strtok(data, ",");
in = atoi(strtok(NULL, ","));
out = atoi(strtok(NULL, ","));
bad = atoi(strtok(NULL, ","));
dupe = atoi(strtok(NULL, ";"));
status.tmsgsin += in;
status.techoin += in;
status.tmsgsout += out;
status.techoout += out;
status.tmsgsbad += bad;
status.techobad += bad;
status.tmsgsdupe += dupe;
status.techodupe += dupe;
Syslog('m', "MIB echo: in=%d out=%d bad=%d dupe=%d in=%d out=%d bad=%d dupe=%d",
status.tmsgsin, status.tmsgsout, status.tmsgsbad, status.tmsgsdupe,
status.techoin, status.techoout, status.techobad, status.techodupe);
status_write();
}
void mib_get_echo_r(char *buf)
{
snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.techoin, status.techoout, status.techobad, status.techodupe);
return;
}
void mib_get_tosser_r(char *buf)
{
snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.tmsgsin, status.tmsgsout, status.tmsgsbad, status.tmsgsdupe);
return;
}
void mib_set_files(char *data)
{
unsigned int in, out, bad, dupe, magics, hatched;
Syslog('m', "MIB set files %s", data);
strtok(data, ",");
in = atoi(strtok(NULL, ","));
out = atoi(strtok(NULL, ","));
bad = atoi(strtok(NULL, ","));
dupe = atoi(strtok(NULL, ","));
magics = atoi(strtok(NULL, ","));
hatched = atoi(strtok(NULL, ";"));
status.tfilesin += in;
status.tfilesout += out;
status.tfilesbad += bad;
status.tfilesdupe += dupe;
status.tfilesmagic += magics;
status.tfileshatched += hatched;
Syslog('m', "MIB files: in=%d out=%d bad=%d dupe=%d magic=%d hatch=%d",
status.tfilesin, status.tfilesout, status.tfilesbad, status.tfilesdupe,
status.tfilesmagic, status.tfileshatched);
status_write();
}
void mib_get_files_r(char *buf)
{
snprintf(buf, 127, "100:6,%d,%d,%d,%d,%d,%d;", status.tfilesin, status.tfilesout, status.tfilesbad, status.tfilesdupe,
status.tfilesmagic, status.tfileshatched);
return;
}
void mib_set_outsize(unsigned int size)
{
status.ooutsize = size;
Syslog('m', "MIB outbound: %d", status.ooutsize);
status_write();
}
void mib_get_outsize_r(char *buf)
{
snprintf(buf, 127, "100:1,%d;", status.ooutsize);
return;
}
void mib_set_bbs(char *data)
{
unsigned int sessions, minutes, posted, uploads, kbupload, downloads, kbdownload, chats, chatminutes;
Syslog('m', "MIB set bbs %s", data);
strtok(data, ",");
sessions = atoi(strtok(NULL, ","));
minutes = atoi(strtok(NULL, ","));
posted = atoi(strtok(NULL, ","));
uploads = atoi(strtok(NULL, ","));
kbupload = atoi(strtok(NULL, ","));
downloads = atoi(strtok(NULL, ","));
kbdownload = atoi(strtok(NULL, ","));
chats = atoi(strtok(NULL, ","));
chatminutes = atoi(strtok(NULL, ";"));
status.bsessions += sessions;
status.bminutes += minutes;
status.bposted += posted;
status.buploads += uploads;
status.bkbupload += kbupload;
status.bdownloads += downloads;
status.bkbdownload += kbdownload;
status.bchats += chats;
status.bchatminutes += chatminutes;
Syslog('m', "MIB bbs: sess=%d mins=%d posted=%d upls=%d kbup=%d downs=%d kbdown=%d chat=%d chatmins=%d",
status.bsessions, status.bminutes, status.bposted, status.buploads, status.bkbupload,
status.bdownloads, status.bkbdownload, status.bchats, status.bchatminutes);
status_write();
}
void mib_get_bbs_r(char *buf)
{
snprintf(buf, 127, "100:9,%d,%d,%d,%d,%d,%d,%d,%d,%d;",
status.bsessions, status.bminutes, status.bposted, status.buploads, status.bkbupload,
status.bdownloads, status.bkbdownload, status.bchats, status.bchatminutes);
return;
} |
package tuwien.auto.calimero.link;
import org.slf4j.Logger;
import tuwien.auto.calimero.CloseEvent;
import tuwien.auto.calimero.FrameEvent;
import tuwien.auto.calimero.KNXFormatException;
import tuwien.auto.calimero.<API key>;
import tuwien.auto.calimero.cemi.CEMI;
import tuwien.auto.calimero.cemi.CEMIBusMon;
import tuwien.auto.calimero.cemi.CEMIFactory;
import tuwien.auto.calimero.link.medium.KNXMediumSettings;
import tuwien.auto.calimero.link.medium.PLSettings;
import tuwien.auto.calimero.link.medium.RawFrame;
import tuwien.auto.calimero.link.medium.RawFrameFactory;
import tuwien.auto.calimero.log.LogService;
/**
* Provides an abstract KNX network monitor implementation, independent of the actual communication
* protocol and medium access. The monitor supports EMI1/EMI2/cEMI format. Subtypes extend the
* abstract monitor by specifying the protocol, e.g., KNXnet/IP, or providing a specific
* implementation of medium access, e.g., via a serial port driver. In most cases, it is sufficient
* for a subtype to provide an implementation of {@link #onClose()}. For receiving and dispatching
* frames from the specified protocol, a subtype uses the KNXListener {@link AbstractLink#notifier}
* as connection listener.
* <p>
* In general, once a monitor has been closed, it is not available for further communication and
* cannot be reopened.
*
* @author B. Malinowsky
*/
public abstract class AbstractMonitor<T extends AutoCloseable> implements KNXNetworkMonitor
{
/** Implements KNXListener to listen to the monitor connection. */
protected final MonitorNotifier notifier;
protected final Logger logger;
final T conn;
private volatile boolean closed;
private KNXMediumSettings medium;
private final String name;
private static final class MonitorNotifier extends EventNotifier<LinkListener>
{
volatile boolean decode;
private boolean extBusmon;
MonitorNotifier(final Object source, final Logger logger, final boolean extBusmon)
{
super(source, logger);
this.extBusmon = extBusmon;
}
@Override
public void frameReceived(final FrameEvent e)
{
try {
final CEMI frame = e.getFrame();
final CEMIBusMon mon;
if (frame == null)
mon = (CEMIBusMon) CEMIFactory.fromEmiBusmon(e.getFrameBytes());
else if (frame instanceof CEMIBusMon)
mon = (CEMIBusMon) frame;
else {
logger.warn("received unsupported frame type with msg code 0x"
+ Integer.toHexString(frame.getMessageCode()));
return;
}
logger.trace("{}", mon);
final AbstractMonitor<?> netmon = (AbstractMonitor<?>) source;
MonitorFrameEvent mfe = new MonitorFrameEvent(netmon, mon);
if (decode) {
try {
final RawFrame rf = RawFrameFactory.create(netmon.medium.getMedium(),
mon.getPayload(), 0, extBusmon);
mfe = new MonitorFrameEvent(netmon, mon, rf);
}
catch (final KNXFormatException ex) {
logger.warn("decoding raw frame", ex);
mfe = new MonitorFrameEvent(netmon, mon, ex);
// workaround for PL, BCU might not have switched to ext. busmonitor
if (extBusmon) {
extBusmon = false;
logger.warn("disable extended busmonitor mode, maybe this helps");
}
}
}
final var event = mfe;
addEvent(l -> l.indication(event));
}
catch (KNXFormatException | RuntimeException ex) {
logger.warn("unspecified frame event - ignored", ex);
}
}
@Override
public void connectionClosed(final CloseEvent e)
{
((AbstractMonitor<?>) source).closed = true;
super.connectionClosed(e);
logger.info("monitor closed");
}
}
protected AbstractMonitor(final T conn, final String name, final KNXMediumSettings settings) {
this.conn = conn;
this.name = name;
logger = LogService.getLogger("calimero.link." + getName());
if (settings instanceof PLSettings)
logger.info("power-line medium, assuming BCU has extended busmonitor enabled");
setKNXMedium(settings);
notifier = new MonitorNotifier(this, logger, settings instanceof PLSettings);
notifier.start();
}
@Override
public final void setKNXMedium(final KNXMediumSettings settings)
{
if (settings == null)
throw new <API key>("medium settings are mandatory");
if (medium != null && !settings.getClass().isAssignableFrom(medium.getClass())
&& !medium.getClass().isAssignableFrom(settings.getClass()))
throw new <API key>("medium differs");
medium = settings;
}
@Override
public final KNXMediumSettings getKNXMedium()
{
return medium;
}
@Override
public void addMonitorListener(final LinkListener l)
{
notifier.addListener(l);
}
@Override
public void <API key>(final LinkListener l)
{
notifier.removeListener(l);
}
@Override
public final void setDecodeRawFrames(final boolean decode)
{
notifier.decode = decode;
logger.info((decode ? "enable" : "disable") + " decoding of raw frames");
}
@Override
public final String getName()
{
return name;
}
@Override
public boolean isOpen()
{
return !closed;
}
@Override
public final void close()
{
synchronized (this) {
if (closed)
return;
closed = true;
}
try {
leaveBusmonitor();
}
catch (final <API key> e) {
Thread.currentThread().interrupt();
}
onClose();
try {
if (conn != null)
conn.close();
}
catch (final Exception ignore) {}
notifier.quit();
}
@Override
public String toString()
{
return "monitor " + getName() + " " + medium.getMediumString() + " medium"
+ (notifier.decode ? ", raw frame decoding" : "") + (closed ? " (closed)" : "");
}
/**
* Invoked on {@link #close()} to execute additional close sequences of the communication
* protocol, or releasing link-specific resources.
*/
protected void onClose()
{}
/**
* Invoked on {@link #close()} to allow the communication protocol to leave busmonitor mode.
*
* @throws <API key> on interrupted thread
*/
@SuppressWarnings("unused")
protected void leaveBusmonitor() throws <API key>
{}
} |
<?php
function <API key>(){
echo '<a target="_blank" class="button button-primary" href="http://sevenspark.com/docs/shiftnav"><i class="fa fa-book"></i> Knowledgebase</a> ';
}
add_action( '<API key>' , '<API key>' );
function <API key>(){
$prefix = SHIFTNAV_PREFIX;
$main_assigned = '';
if(!has_nav_menu('shiftnav')){
$main_assigned = 'No Menu Assigned';
}
else{
$menus = <API key>();
$menu_title = <API key>($menus['shiftnav'])->name;
$main_assigned = $menu_title;
}
$main_assigned = '<span class="<API key>">'.$main_assigned.'</span> <p class="<API key>">The menu assigned to the <strong>ShiftNav [Main]</strong> theme location will be displayed. <a href="'.admin_url( 'nav-menus.php?action=locations' ).'">Assign a menu</a></p>';
$fields = array(
$prefix.'shiftnav-main' => array(
array(
'name' => 'menu_assignment',
'label' => __( 'Assigned Menu' , 'shiftnav' ),
'desc' => $main_assigned,
'type' => 'html',
),
array(
'name' => 'display_main',
'label' => __( 'Display Main ShiftNav Panel', 'shiftnav' ),
'desc' => __( 'Do not uncheck this unless you want to disable the main ShiftNav panel entirely.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'edge',
'label' => __( 'Edge' , 'shiftnav' ),
'type' => 'radio',
'desc' => __( 'Which edge of the viewport should the ShiftNav panel appear on?', 'ubermenu' ),
'options' => array(
'left' => 'Left',
'right' => 'Right',
),
'default' => 'left'
),
array(
'name' => 'swipe_open',
'label' => __( 'Swipe Open', 'shiftnav' ),
'desc' => __( 'Swipe to open the main ShiftNav Panel in iOS and Android. Not all themes will be compatible, as touch swipes can conflict with theme scripts. Make sure enabling this doesn\'t prevent other touch functionality on your site from working', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'skin',
'label' => __( 'Skin' , 'shiftnav' ),
'type' => 'select',
'options' => <API key>(),
'default' => 'standard-dark',
//'options' => <API key>()
),
array(
'name' => 'indent_submenus',
'label' => __( 'Indent Always Visible Submenus' , 'shiftnav' ),
'desc' => __( 'Check this to indent submenu items of always-visible submenus' , 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off',
),
array(
'name' => 'display_site_title',
'label' => __( 'Display Site Title', 'shiftnav' ),
'desc' => __( 'Display the site title in the menu panel', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
/*
array(
'name' => '<API key>',
'label' => __( 'Inherit UberMenu Icons', 'shiftnav' ),
'desc' => __( 'Display the icon from the UberMenu icon setting if no icon is selected', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
*/
),
// array(
// 'name' => 'section_toggle',
// 'label' => '<h4 class="<API key>">'.__( 'Top Bar Toggle Settings' , 'shiftnav' ).'</h4>',
// 'desc' => '<span class="<API key>">'.__( 'These settings control the main ShiftNav toggle' , 'shiftnav' ).'</span>',
// 'type' => 'html',
$prefix.'togglebar' => array(
array(
'name' => 'display_toggle',
'label' => __( 'Display Toggle Bar', 'shiftnav' ),
'desc' => __( 'Uncheck this to disable the default toggle bar and add your own custom toggle', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'breakpoint',
'label' => __( 'Toggle Breakpoint', 'shiftnav' ),
'desc' => __( 'Show the toggle bar only below this pixel width. Leave blank to show at all times. Do not include "px"', 'shiftnav' ),
'type' => 'text',
'default' => ''
),
array(
'name' => 'hide_theme_menu',
'label' => __( 'Hide Theme Menu', 'shiftnav' ),
'desc' => __( 'Enter the selector of the theme\'s menu if you wish to hide it below the breakpoint above. For example, <code>#primary-nav</code> or <code>.topnav</code>. ', 'shiftnav' ),
'type' => 'text',
'default' => ''
),
array(
'name' => 'hide_ubermenu',
'label' => __( 'Hide UberMenu 3', 'shiftnav' ),
'desc' => __( 'Hide all UberMenu 3 instances when ShiftNav is displayed. If you would like to only hide a specific UberMenu, use the setting above with a specific UberMenu ID.', 'shiftnav' ) . ' ( <a href="http://wpmegamenu.com">What is UberMenu?</a> )',
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'toggle_content',
'label' => __( 'Toggle Content' , 'shiftnav' ),
'desc' => __( 'The content to display in the main toggle bar. Default: [shift_toggle_title]' , 'shiftnav' ),
'type' => 'textarea',
'default' => '[shift_toggle_title]', //get_bloginfo( 'title' )
'sanitize_callback' => 'shiftnav_allow_html',
),
array(
'name' => 'toggle_target',
'label' => __( 'Toggle Target' , 'shiftnav' ),
'desc' => __( 'The area which will trigger the ShiftNav Panel to open.' ),
'type' => 'radio',
'options' => array(
'burger_only' => __( 'Bars/Burger Icon Only' , 'shiftnav' ),
'entire_bar' => __( 'Entire Bar' , 'shiftnav' ),
),
'default' => 'burger_only',
),
array(
'name' => 'toggle_close_icon',
'label' => __( 'Close Icon' , 'shiftnav' ),
'desc' => __( 'When the toggle is open, choose which icon to display.', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'bars' => '<i class="fa fa-bars"></i> Hamburger Bars',
'x' => '<i class="fa fa-times"></i> Close button',
),
'default' => 'x',
),
array(
'name' => 'toggle_position',
'label' => __( 'Toggle Bar Position' , 'shiftnav' ),
'desc' => __( 'Choose Fixed if you\'d like the toggle bar to always be visible, or Absolute if you\'d like it only to be visible when scrolled to the very top of the page', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'fixed' => __( 'Fixed', 'shiftnav' ),
'absolute' => __( 'Absolute' , 'shiftnav' ),
),
'default' => 'fixed',
),
array(
'name' => 'align',
'label' => __( 'Align Text' , 'shiftnav' ),
'desc' => __( 'Align text left, right, or center. Applies to inline elements only.', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'center'=> 'Center',
'left' => 'Left',
'right' => 'Right',
),
'default' => 'center',
),
array(
'name' => 'background_color',
'label' => __( 'Background Color' , 'shiftnav' ),
'desc' => __( '' , 'shiftnav' ),
'type' => 'color',
//'default' => '#1D1D20',
),
array(
'name' => 'text_color',
'label' => __( 'Text Color' , 'shiftnav' ),
'desc' => __( '' , 'shiftnav' ),
'type' => 'color',
//'default' => '#eeeeee',
),
array(
'name' => 'font_size',
'label' => __( 'Font Size', 'shiftnav' ),
'desc' => __( 'Override the default font size of the toggle bar by setting a value here.', 'shiftnav' ),
'type' => 'text',
'default' => ''
),
/*
array(
'name' => 'display_condition',
'label' => __( 'Display on', 'shiftnav' ),
'desc' => __( '', 'shiftnav' ),
'type' => 'multicheck',
'options' => array(
'all' => 'All',
'posts' => 'Posts',
'pages' => 'Pages',
'home' => 'Home Page',
'blog' => 'Blog Page',
),
'default' => array( 'all' => 'all' )
),
*/
),
);
$fields = apply_filters( '<API key>' , $fields );
$fields[$prefix.'general'] = array(
array(
'name' => 'css_tweaks',
'label' => __( 'CSS Tweaks' , 'shiftnav' ),
'desc' => __( 'Add custom CSS here, which will be printed in the site head.' , 'shiftnav' ),
'type' => 'textarea',
'sanitize_callback' => 'shiftnav_allow_html',
),
array(
'name' => 'footer_content',
'label' => __( 'Footer Content' , 'shiftnav' ),
'desc' => __( 'Add HTML or Shortcodes here and it will be injected at the wp_footer() hook. Useful for fixed position elements' , 'shiftnav' ),
'type' => 'textarea',
'sanitize_callback' => 'shiftnav_allow_html',
),
array(
'name' => 'mobile_only',
'label' => __( 'Mobile Only' , 'shiftnav' ),
'desc' => __( 'Only display ShiftNav when a mobile device is detected via wp_is_mobile(). If you are using a caching plugin, make sure you have separate mobile and desktop caches.' , 'shiftnav' ),
'type' => 'checkbox',
'default'=> 'off',
),
array(
'name' => 'target_size',
'label' => __( 'Button Size', 'shiftnav' ),
'desc' => __( 'The size of the padding on the links in the menu. The larger the setting, the easier to click; but fewer menu items will appear on the screen at a time.', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'default' => 'Default',
'medium' => 'Medium',
'large' => 'Large',
'enormous' => 'Enormous',
),
'default' => 'default',
),
array(
'name' => 'text_size',
'label' => __( 'Text Size', 'shiftnav' ),
'desc' => __( 'The size of the font on the links in the menu (will override all levels).', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'default' => 'Default',
'small' => 'Small',
'medium' => 'Medium',
'large' => 'Large',
'enormous' => 'Enormous',
),
'default' => 'default',
),
array(
'name' => 'icon_size',
'label' => __( 'Icon Size', 'shiftnav' ),
'desc' => __( 'The size of the icons in the menu.', 'shiftnav' ),
'type' => 'radio',
'options' => array(
'default' => 'Default',
'small' => 'Small',
'medium' => 'Medium',
'large' => 'Large',
'enormous' => 'Enormous',
),
'default' => 'default',
),
array(
'name' => 'shift_body',
'label' => __( 'Shift Body', 'shiftnav' ),
'desc' => __( 'Shift the body of the site when the menu is revealed. For some themes, this may negatively affect the site content, so this can be disabled.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'shift_body_wrapper',
'label' => __( 'Shift Body Wrapper', 'shiftnav' ),
'desc' => __( 'Leave this blank to automatically create a ShiftNav Wrapper via javascript (this may have side effects). Set a selector here to turn a specific div (which must wrap all body contents) into the wrapper. Please note that if the wrapper you select is also styled by the theme, this may cause a conflict.', 'shiftnav' ),
'type' => 'text',
'default' => ''
),
array(
'name' => 'disable_transforms',
'label' => __( 'Disable Transforms & Transitions' , 'shiftnav' ),
'desc' => __( 'Disable CSS3 transformations and transitions. This will disable smooth animations, but may work better on browsers that don\'t properly implement CSS3 transforms, especially old non-standard Android browsers. Note that ShiftNav attempts to detect these browsers and fall back automatically, but some browsers have incomplete implementations of CSS3 transforms, which produce false positives when testing.' , 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off',
),
array(
'name' => 'touch_off_close',
'label' => __( 'Touch-off close', 'shiftnav' ),
'desc' => __( 'Close the ShiftNav panel when touching any content not in the panel.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'scroll_offset',
'label' => __( 'Scroll Offset', 'shiftnav' ),
'desc' => __( 'When using the ScrollTo functionality, this is the number of pixels to offset the scroll by, to account for the toggle bar and any spacing you want.', 'shiftnav' ),
'type' => 'text',
'default' => 100,
),
array(
'name' => 'swipe_close',
'label' => __( 'Swipe Close', 'shiftnav' ),
'desc' => __( 'Enable swiping to close the ShiftNav panel on Android and iOS. Touch events may not interact well with all themes.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'swipe_tolerance_x',
'label' => __( 'Swipe Tolerance: Horizontal', 'shiftnav' ),
'desc' => __( 'The minimum horizontal pixel distance before the swipe is triggered. Do not include <code>px</code>', 'shiftnav' ),
'type' => 'text',
'default' => 150
),
array(
'name' => 'swipe_tolerance_y',
'label' => __( 'Swipe Tolerance: Vertical', 'shiftnav' ),
'desc' => __( 'The maximum horizontal pixel distance allowed for the swipe to be triggered. Do not include <code>px</code>', 'shiftnav' ),
'type' => 'text',
'default' => 60
),
array(
'name' => '<API key>',
'label' => __( 'Swipe Edge Proximity', 'shiftnav' ),
'desc' => __( 'The distance from the edge, within which the first touch event must occur for the swipe to be triggered. Do not include <code>px</code>', 'shiftnav' ),
'type' => 'text',
'default' => 80
),
array(
'name' => 'open_current',
'label' => __( 'Open Current Accordion Submenu', 'shiftnav' ),
'desc' => __( 'Open the submenu of the current menu item on page load (accordion submenus only).', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'collapse_accordions',
'label' => __( 'Collapse Accordions', 'shiftnav' ),
'desc' => __( 'When an accordion menu is opened, collapse any other accordions on that level.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'scroll_panel',
'label' => __( 'Scroll Shift Submenus to Top', 'shiftnav' ),
'desc' => __( 'When a Shift submenu is activated, scroll that item to the top to maximize submenu visibility.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'active_on_hover',
'label' => __( 'Highlight Targets on Hover', 'shiftnav' ),
'desc' => __( 'With this setting enabled, the links will be highlighted when hovered or touched.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'active_highlight',
'label' => __( 'Highlight Targets on :active', 'shiftnav' ),
'desc' => __( 'With this setting enabled, the links will be highlighted while in the :active state. May not be desirable for touch scrolling.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'admin_tips',
'label' => __( 'Show Tips to Admins', 'shiftnav' ),
'desc' => __( 'Display tips to admin users', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'lock_body_x',
'label' => __( 'Lock Horizontal Scroll', 'shiftnav' ),
'desc' => __( 'Attempt to prevent the content from scrolling horizontally when the menu is active. On some themes, may also prevent vertical scrolling. May not prevent touch scrolling in Chrome. No effect if <strong>Shift Body</strong> is disabled.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'lock_body',
'label' => __( 'Lock Scroll', 'shiftnav' ),
'desc' => __( 'Lock both vertical and horizontal scrolling on site content when menu is active. No effect if <strong>Shift Body</strong> is disabled.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => 'load_fontawesome',
'label' => __( 'Load Font Awesome', 'shiftnav' ),
'desc' => __( 'If you are already loading Font Awesome 4 elsewhere in your setup, you can disable this.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'on'
),
array(
'name' => '<API key>',
'label' => __( 'Inherit UberMenu Conditionals', 'shiftnav' ),
'desc' => __( 'Display menu items based on UberMenu Conditionals settings', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'force_filter',
'label' => __( 'Force Filter Menu Args', 'shiftnav' ),
'desc' => __( 'Some themes will filter the menu arguments on all menus on the site, which can break things. This will re-filter those arguments for ShiftNav menus only.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
array(
'name' => 'kill_class_filter',
'label' => __( 'Kill Menu Class Filter', 'shiftnav' ),
'desc' => __( 'Some themes filter the menu item classes and strip out core WordPress functionality. This will change the structure of ShiftNav and prevent styles from being applies. This will prevent any actions on the <code>nav_menu_css_class</code> filter.', 'shiftnav' ),
'type' => 'checkbox',
'default' => 'off'
),
/*
array(
'name' => 'multicheck',
'label' => __( 'Multile checkbox', 'shiftnav' ),
'desc' => __( 'Multi checkbox description', 'shiftnav' ),
'type' => 'multicheck',
'options' => array(
'one' => 'One',
'two' => 'Two',
'three' => 'Three',
'four' => 'Four'
)
),
array(
'name' => 'selectbox',
'label' => __( 'A Dropdown', 'shiftnav' ),
'desc' => __( 'Dropdown description', 'shiftnav' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
)
*/
);
return $fields;
}
function <API key>(){
$prefix = SHIFTNAV_PREFIX;
$sections = array(
/*array(
'id' => $prefix.'basics',
'title' => __( 'Basic Configuration', 'shiftnav' )
),*/
array(
'id' => $prefix.'shiftnav-main',
'title' => __( 'Main ShiftNav Settings', 'shiftnav' )
),
array(
'id' => $prefix.'togglebar',
'title' => __( 'Toggle Bar', 'shiftnav' )
)
);
$sections = apply_filters( '<API key>' , $sections );
$sections[] = array(
'id' => $prefix.'general',
'title' => __( 'General Settings' , 'shiftnav' ),
);
return $sections;
}
/**
* Registers settings section and fields
*/
function shiftnav_admin_init() {
$prefix = SHIFTNAV_PREFIX;
$sections = <API key>();
$fields = <API key>();
//set up defaults so they are accessible
_SHIFTNAV()->set_defaults( $fields );
$settings_api = _SHIFTNAV()->settings_api();
//set sections and fields
$settings_api->set_sections( $sections );
$settings_api->set_fields( $fields );
//initialize them
$settings_api->admin_init();
}
add_action( 'admin_init', 'shiftnav_admin_init' );
function <API key>(){
if( !is_admin() ){
_SHIFTNAV()->set_defaults( <API key>() );
}
}
add_action( 'init', '<API key>' );
/**
* Register the plugin page
*/
function shiftnav_admin_menu() {
add_submenu_page(
'themes.php',
'ShiftNav Settings',
'ShiftNav',
'manage_options',
'shiftnav-settings',
'<API key>'
);
//add_options_page( 'Settings API', 'Settings API', 'manage_options', 'settings_api_test', '<API key>' );
}
add_action( 'admin_menu', 'shiftnav_admin_menu' );
function <API key>(){
$menus = wp_get_nav_menus( array('orderby' => 'name') );
$m = array( '_none' => 'Choose Menu, or use Theme Location Setting' );
foreach( $menus as $menu ){
$m[$menu->slug] = $menu->name;
}
return $m;
}
function <API key>(){
$locs = <API key>();
$default = array( '_none' => 'Select Theme Location or use Menu Setting' );
//$locs = array_unshift( $default, $locs );
$locs = $default + $locs;
//shiftp( $locs );
return $locs;
}
/**
* Display the plugin settings options page
*/
function <API key>() {
do_action( '<API key>' );
$settings_api = _SHIFTNAV()->settings_api();
?>
<div class="wrap shiftnav-wrap">
<?php settings_errors(); ?>
<div class="<API key>">
<?php do_action( '<API key>' ); ?>
</div>
<h2>ShiftNav <?php if( SHIFTNAV_PRO ) echo 'Pro <i class="fa fa-rocket"></i>'; ?></h2>
<?php
do_action( '<API key>' );
$settings_api->show_navigation();
$settings_api->show_forms();
do_action( '<API key>' );
?>
</div>
<?php
}
/**
* Get the value of a settings field
*
* @param string $option settings field name
* @param string $section the section name this field belongs to
* @param string $default default text if it's not found
* @return mixed
*/
function shiftnav_op( $option, $section, $default = null ) {
if( $section == '<API key>' ){
$section = _SHIFTNAV()-><API key>();
}
$options = get_option( SHIFTNAV_PREFIX.$section );
if ( isset( $options[$option] ) ) {
return $options[$option];
}
if( $default == null ){
//$default = _SHIFTNAV()->settings_api()->get_default( $option, SHIFTNAV_PREFIX.$section );
$default = _SHIFTNAV()->get_default( $option, SHIFTNAV_PREFIX.$section );
}
return $default;
}
function <API key>( $instance ){
//echo SHIFTNAV_PREFIX.$instance;
$defaults = _SHIFTNAV()->get_defaults( SHIFTNAV_PREFIX.$instance );
$options = get_option( SHIFTNAV_PREFIX.$instance , $defaults );
if( !is_array( $options ) || count( $options ) == 0 ) return $defaults;
return $options;
}
function <API key>(){
?>
<style>
</style>
<?php
}
//add_action( '<API key>' , '<API key>' );
function <API key>( $hook ){
if( $hook == '<API key>' ){
wp_enqueue_script( 'shiftnav' , SHIFTNAV_URL . 'admin/assets/admin.settings.js' );
wp_enqueue_style( '<API key>' , SHIFTNAV_URL.'admin/assets/admin.settings.css' );
wp_enqueue_style( '<API key>' , SHIFTNAV_URL.'assets/css/fontawesome/css/font-awesome.min.css' );
}
}
add_action( '<API key>' , '<API key>' );
function <API key>(){
$display = shiftnav_op( 'display_main' , 'shiftnav-main' );
if( $display == 'on' ){
if( !has_nav_menu( 'shiftnav' ) ){
?>
<div class="update-nag"><strong>Important!</strong> There is no menu assigned to the <strong>ShiftNav [Main]</strong> Menu Location. <a href="<?php echo admin_url( 'nav-menus.php?action=locations' ); ?>">Assign a menu</a></div>
<br/><br/>
<?php
}
}
}
add_action( '<API key>' , '<API key>' );
function shiftnav_allow_html( $str ){
return $str;
} |
{
package GCLang::GL::GCModels::GCperiodicals;
use utf8;
# This file is part of GCstar.
# GCstar is free software; you can redistribute it and/or modify
# (at your option) any later version.
# GCstar is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with GCstar; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
use strict;
use base 'Exporter';
our @EXPORT = qw(%lang);
our %lang = (
<API key> => 'Periodicals collection',
Items => {0 => 'Periodical',
1 => 'Periodical',
X => 'Periodicals'},
NewItem => 'New periodical',
Title => 'Title',
Cover => 'Cover',
Periodical => 'Periodical',
Number => 'Number',
Date => 'Date',
Subject => 'Subject',
Articles => 'Articles',
General => 'General',
);
}
1; |
<?php
require_once( CUAR_INCLUDES_DIR . '/core-classes/addon-page.class.php' );
if (!class_exists('<API key>')) :
/**
* Add-on to show the customer dashboard page
*
* @author Vincent Prat @ MarvinLabs
*/
class <API key> extends <API key> {
public function __construct() {
parent::__construct( 'customer-dashboard', '4.0.0' );
$this->set_page_parameters( 5, array(
'slug' => 'customer-dashboard',
'parent_slug' => 'customer-home',
)
);
$this->set_page_shortcode( '<API key>' );
}
public function get_label() {
return __( 'Dashboard', 'cuar' );
}
public function get_title() {
return __( 'Dashboard', 'cuar' );
}
public function get_hint() {
return __( "Shows a summary of the user's private content (files, pages, messages, ...).", 'cuar' );
}
public function run_addon( $plugin ) {
parent::run_addon( $plugin );
// Widget area for our sidebar
$this->enable_sidebar();
}
public function get_page_addon_path() {
return CUAR_INCLUDES_DIR . '/core-addons/customer-dashboard';
}
}
// Make sure the addon is loaded
new <API key>();
endif; // if (!class_exists('<API key>')) : |
#include "LogoView.hpp"
#include "Screen/Canvas.hpp"
#include "resource.h"
#include "Version.hpp"
LogoView::LogoView()
:logo(IDB_SWIFT), big_logo(IDB_SWIFT_HD),
title(IDB_TITLE), big_title(IDB_TITLE_HD)
{
#ifndef USE_GDI
font.set("Droid Sans", 12);
#endif
}
void
LogoView::draw(Canvas &canvas, const PixelRect &rc)
{
const unsigned width = rc.right - rc.left, height = rc.bottom - rc.top;
// Load logo
Bitmap &bitmap_logo = (width >= 290 && height >= 170) ||
(width >= 170 && height >= 210)
? big_logo : logo;
// Adjust the title to larger screens
Bitmap &bitmap_title = (width >= 530 && height >= 60) ||
(width >= 330 && height >= 250)
? big_title : title;
// Determine logo size
PixelSize logo_size = bitmap_logo.get_size();
// Determine title image size
PixelSize title_size = bitmap_title.get_size();
int logox, logoy, titlex, titley;
bool hidetitle = false;
// Determine logo and title positions
if ((unsigned)(logo_size.cx + title_size.cy + title_size.cx) <= width) {
// Landscape
logox = (width - (logo_size.cx + title_size.cy + title_size.cx)) / 2;
logoy = (height - logo_size.cy) / 2;
titlex = logox + logo_size.cx + title_size.cy;
titley = (height - title_size.cy) / 2;
} else if ((unsigned)(logo_size.cy + title_size.cy * 2) <= height) {
// Portrait
logox = (width - logo_size.cx) / 2;
logoy = (height - (logo_size.cy + title_size.cy * 2)) / 2;
titlex = (width - title_size.cx) / 2;
titley = logoy + logo_size.cy + title_size.cy;
} else {
// Square screen
logox = (width - logo_size.cx) / 2;
logoy = (height - logo_size.cy) / 2;
hidetitle = true;
}
// Draw 'XCSoar N.N' title
if (!hidetitle)
canvas.copy(titlex, titley, title_size.cx, title_size.cy, bitmap_title, 0, 0);
// Draw XCSoar swift logo
canvas.copy(logox, logoy, logo_size.cx, logo_size.cy, bitmap_logo, 0, 0);
// Draw full XCSoar version number
#ifndef USE_GDI
canvas.select(font);
#endif
canvas.set_text_color(COLOR_BLACK);
canvas.<API key>();
canvas.text(2, 2, XCSoar_ProductToken);
} |
package de.metas.async.processor.impl;
import de.metas.async.model.<API key>;
import de.metas.async.spi.<API key>;
/**
* Wraps one instance of {@link <API key>} and always delegate all method calls to that instance.
*
* In this way we ensure that even if we instantiate this class more then one time, a common {@link <API key>} will be shared.
*
* @author tsa
*
*/
public class <API key> implements <API key>
{
private static <API key> processor = new <API key>();
@Override
public Result processWorkPackage(<API key> workpackage, String localTrxName)
{
return processor.processWorkPackage(workpackage, localTrxName);
}
/**
*
* @return underlying {@link <API key>}
*/
public static <API key> <API key>()
{
return processor;
}
public static void reset()
{
processor = new <API key>();
}
} |
<?php get_template_part('templates/head'); ?>
<body <?php body_class(); ?>>
<!--[if lt IE 8]>
<div class="alert alert-warning">
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'roots'); ?>
</div>
<![endif]
<?php get_template_part('templates/landing'); ?>
<?php
do_action('get_header');
// Use Bootstrap's navbar if enabled in config.php
if (<API key>('<API key>')) {
/* get_template_part('templates/header-top-navbar'); */
} else {
get_template_part('templates/full-width');
}
?>
<div class="wrap container-fluid" role="document">
<main class="main <?php echo roots_main_class(); ?>" role="main">
<?php include roots_template_path(); ?>
</main><!-- /.main -->
<?php if (<API key>()) : ?>
<aside class="sidebar <?php echo roots_sidebar_class(); ?>" role="complementary">
<?php include roots_sidebar_path(); ?>
</aside><!-- /.sidebar -->
<?php endif; ?>
</div><!-- /.content -->
</div><!-- /.wrap -->
<?php get_template_part('templates/footer'); ?>
</body>
</html> |
/*** Autogenerated by WIDL 1.5.25 from include/textstor.idl - Do not edit ***/
#ifndef <API key>
#define <API key> 475
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifndef COM_NO_WINDOWS_H
#include <windows.h>
#include <ole2.h>
#endif
#ifndef __textstor_h__
#define __textstor_h__
/* Forward declarations */
#ifndef <API key>
#define <API key>
typedef interface ITextStoreACPSink ITextStoreACPSink;
#endif
#ifndef <API key>
#define <API key>
typedef interface ITextStoreACP ITextStoreACP;
#endif
/* Headers for imported files */
#include <oaidl.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TS_E_INVALIDPOS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200)
#define TS_E_NOLOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)
#define TS_E_NOOBJECT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202)
#define TS_E_NOSERVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0203)
#define TS_E_NOINTERFACE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0204)
#define TS_E_NOSELECTION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0205)
#define TS_E_NOLAYOUT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0206)
#define TS_E_INVALIDPOINT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0207)
#define TS_E_SYNCHRONOUS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0208)
#define TS_E_READONLY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0209)
#define TS_E_FORMAT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x020a)
#define TS_S_ASYNC MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x0300)
#define <API key> (~0)
#define TS_SD_READONLY (0x1)
#define TS_SD_LOADING (0x2)
#define TS_SS_DISJOINTSEL (0x1)
#define TS_SS_REGIONS (0x2)
#define TS_SS_TRANSITORY (0x4)
#define TS_SS_NOHIDDENTEXT (0x8)
#define TS_AS_TEXT_CHANGE (0x1)
#define TS_AS_SEL_CHANGE (0x2)
#define TS_AS_LAYOUT_CHANGE (0x4)
#define TS_AS_ATTR_CHANGE (0x8)
#define TS_AS_STATUS_CHANGE (0x10)
#define TS_AS_ALL_SINKS ((((TS_AS_TEXT_CHANGE | TS_AS_SEL_CHANGE) | TS_AS_LAYOUT_CHANGE) | TS_AS_ATTR_CHANGE) | TS_AS_STATUS_CHANGE)
#define TS_LF_SYNC (0x1)
#define TS_LF_READ (0x2)
#define TS_LF_READWRITE (0x6)
#define TS_CHAR_EMBEDDED (0xfffc)
#define TS_CHAR_REGION (0x0)
#define TS_CHAR_REPLACEMENT (0xfffd)
#define TS_IAS_NOQUERY (0x1)
#define TS_IAS_QUERYONLY (0x2)
#define TS_ST_CORRECTION (0x1)
typedef enum <API key> {
TS_AE_NONE = 0,
TS_AE_START = 1,
TS_AE_END = 2
} TsActiveSelEnd;
typedef enum <API key> {
TS_RT_PLAIN = 0,
TS_RT_HIDDEN = 1,
TS_RT_OPAQUE = 2
} TsRunType;
typedef GUID TS_ATTRID;
typedef struct TS_STATUS {
DWORD dwDynamicFlags;
DWORD dwStaticFlags;
} TS_STATUS;
typedef struct TS_TEXTCHANGE {
LONG acpStart;
LONG acpOldEnd;
LONG acpNewEnd;
} TS_TEXTCHANGE;
typedef struct TS_SELECTIONSTYLE {
TsActiveSelEnd ase;
WINBOOL fInterimChar;
} TS_SELECTIONSTYLE;
typedef struct TS_SELECTION_ACP {
LONG acpStart;
LONG acpEnd;
TS_SELECTIONSTYLE style;
} TS_SELECTION_ACP;
typedef struct TS_RUNINFO {
ULONG uCount;
TsRunType type;
} TS_RUNINFO;
typedef struct TS_ATTRVAL {
TS_ATTRID idAttr;
DWORD dwOverlapId;
VARIANT varValue;
} TS_ATTRVAL;
#define <API key> (0x1)
#define <API key> (0x2)
#define <API key> (0x4)
#define <API key> (0x8)
#define <API key> (0x10)
#define TS_ATTR_FIND_HIDDEN (0x20)
typedef enum <API key> {
TS_LC_CREATE = 0,
TS_LC_CHANGE = 1,
TS_LC_DESTROY = 2
} TsLayoutCode;
typedef DWORD TsViewCookie;
/*****************************************************************************
* ITextStoreACPSink interface
*/
#ifndef <API key>
#define <API key>
DEFINE_GUID(<API key>, 0x22d44c94, 0xa419, 0x4542, 0xa2,0x72, 0xae,0x26,0x09,0x3e,0xce,0xcf);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("<API key>")
ITextStoreACPSink : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE OnTextChange(
DWORD dwFlags,
const TS_TEXTCHANGE *pChange) = 0;
virtual HRESULT STDMETHODCALLTYPE OnSelectionChange(
) = 0;
virtual HRESULT STDMETHODCALLTYPE OnLayoutChange(
TsLayoutCode lcode,
TsViewCookie vcView) = 0;
virtual HRESULT STDMETHODCALLTYPE OnStatusChange(
DWORD dwFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE OnAttrsChange(
LONG acpStart,
LONG acpEnd,
ULONG cAttrs,
const TS_ATTRID *paAttrs) = 0;
virtual HRESULT STDMETHODCALLTYPE OnLockGranted(
DWORD dwLockFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
) = 0;
};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(ITextStoreACPSink, 0x22d44c94, 0xa419, 0x4542, 0xa2,0x72, 0xae,0x26,0x09,0x3e,0xce,0xcf)
#endif
#else
typedef struct <API key> {
BEGIN_INTERFACE
/*** IUnknown methods ***/
HRESULT (STDMETHODCALLTYPE *QueryInterface)(
ITextStoreACPSink* This,
REFIID riid,
void **ppvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(
ITextStoreACPSink* This);
ULONG (STDMETHODCALLTYPE *Release)(
ITextStoreACPSink* This);
/*** ITextStoreACPSink methods ***/
HRESULT (STDMETHODCALLTYPE *OnTextChange)(
ITextStoreACPSink* This,
DWORD dwFlags,
const TS_TEXTCHANGE *pChange);
HRESULT (STDMETHODCALLTYPE *OnSelectionChange)(
ITextStoreACPSink* This);
HRESULT (STDMETHODCALLTYPE *OnLayoutChange)(
ITextStoreACPSink* This,
TsLayoutCode lcode,
TsViewCookie vcView);
HRESULT (STDMETHODCALLTYPE *OnStatusChange)(
ITextStoreACPSink* This,
DWORD dwFlags);
HRESULT (STDMETHODCALLTYPE *OnAttrsChange)(
ITextStoreACPSink* This,
LONG acpStart,
LONG acpEnd,
ULONG cAttrs,
const TS_ATTRID *paAttrs);
HRESULT (STDMETHODCALLTYPE *OnLockGranted)(
ITextStoreACPSink* This,
DWORD dwLockFlags);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACPSink* This);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACPSink* This);
END_INTERFACE
} <API key>;
interface ITextStoreACPSink {
CONST_VTBL <API key>* lpVtbl;
};
#ifdef COBJMACROS
#ifndef <API key>
/*** IUnknown methods ***/
#define <API key>(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define <API key>(This) (This)->lpVtbl->AddRef(This)
#define <API key>(This) (This)->lpVtbl->Release(This)
/*** ITextStoreACPSink methods ***/
#define <API key>(This,dwFlags,pChange) (This)->lpVtbl->OnTextChange(This,dwFlags,pChange)
#define <API key>(This) (This)->lpVtbl->OnSelectionChange(This)
#define <API key>(This,lcode,vcView) (This)->lpVtbl->OnLayoutChange(This,lcode,vcView)
#define <API key>(This,dwFlags) (This)->lpVtbl->OnStatusChange(This,dwFlags)
#define <API key>(This,acpStart,acpEnd,cAttrs,paAttrs) (This)->lpVtbl->OnAttrsChange(This,acpStart,acpEnd,cAttrs,paAttrs)
#define <API key>(This,dwLockFlags) (This)->lpVtbl->OnLockGranted(This,dwLockFlags)
#define <API key>(This) (This)->lpVtbl-><API key>(This)
#define <API key>(This) (This)->lpVtbl-><API key>(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,REFIID riid,void **ppvObject) {
return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG <API key>(ITextStoreACPSink* This) {
return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG <API key>(ITextStoreACPSink* This) {
return This->lpVtbl->Release(This);
}
/*** ITextStoreACPSink methods ***/
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,DWORD dwFlags,const TS_TEXTCHANGE *pChange) {
return This->lpVtbl->OnTextChange(This,dwFlags,pChange);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This) {
return This->lpVtbl->OnSelectionChange(This);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,TsLayoutCode lcode,TsViewCookie vcView) {
return This->lpVtbl->OnLayoutChange(This,lcode,vcView);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,DWORD dwFlags) {
return This->lpVtbl->OnStatusChange(This,dwFlags);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,LONG acpStart,LONG acpEnd,ULONG cAttrs,const TS_ATTRID *paAttrs) {
return This->lpVtbl->OnAttrsChange(This,acpStart,acpEnd,cAttrs,paAttrs);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This,DWORD dwLockFlags) {
return This->lpVtbl->OnLockGranted(This,dwLockFlags);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This) {
return This->lpVtbl-><API key>(This);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACPSink* This) {
return This->lpVtbl-><API key>(This);
}
#endif
#endif
#endif
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This,
DWORD dwFlags,
const TS_TEXTCHANGE *pChange);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This,
TsLayoutCode lcode,
TsViewCookie vcView);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This,
DWORD dwFlags);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This,
LONG acpStart,
LONG acpEnd,
ULONG cAttrs,
const TS_ATTRID *paAttrs);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This,
DWORD dwLockFlags);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACPSink* This);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
#endif /* <API key> */
/*****************************************************************************
* ITextStoreACP interface
*/
#ifndef <API key>
#define <API key>
DEFINE_GUID(IID_ITextStoreACP, 0x28888fe3, 0xc2a0, 0x483a, 0xa3,0xea, 0x8c,0xb1,0xce,0x51,0xff,0x3d);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("<API key>")
ITextStoreACP : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE AdviseSink(
REFIID riid,
IUnknown *punk,
DWORD dwMask) = 0;
virtual HRESULT STDMETHODCALLTYPE UnadviseSink(
IUnknown *punk) = 0;
virtual HRESULT STDMETHODCALLTYPE RequestLock(
DWORD dwLockFlags,
HRESULT *phrSession) = 0;
virtual HRESULT STDMETHODCALLTYPE GetStatus(
TS_STATUS *pdcs) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryInsert(
LONG acpTestStart,
LONG acpTestEnd,
ULONG cch,
LONG *pacpResultStart,
LONG *pacpResultEnd) = 0;
virtual HRESULT STDMETHODCALLTYPE GetSelection(
ULONG ulIndex,
ULONG ulCount,
TS_SELECTION_ACP *pSelection,
ULONG *pcFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE SetSelection(
ULONG ulCount,
const TS_SELECTION_ACP *pSelection) = 0;
virtual HRESULT STDMETHODCALLTYPE GetText(
LONG acpStart,
LONG acpEnd,
WCHAR *pchPlain,
ULONG cchPlainReq,
ULONG *pcchPlainRet,
TS_RUNINFO *prgRunInfo,
ULONG cRunInfoReq,
ULONG *pcRunInfoRet,
LONG *pacpNext) = 0;
virtual HRESULT STDMETHODCALLTYPE SetText(
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
const WCHAR *pchText,
ULONG cch,
TS_TEXTCHANGE *pChange) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFormattedText(
LONG acpStart,
LONG acpEnd,
IDataObject **ppDataObject) = 0;
virtual HRESULT STDMETHODCALLTYPE GetEmbedded(
LONG acpPos,
REFGUID rguidService,
REFIID riid,
IUnknown **ppunk) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryInsertEmbedded(
const GUID *pguidService,
const FORMATETC *pFormatEtc,
WINBOOL *pfInsertable) = 0;
virtual HRESULT STDMETHODCALLTYPE InsertEmbedded(
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
IDataObject *pDataObject,
TS_TEXTCHANGE *pChange) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
DWORD dwFlags,
const WCHAR *pchText,
ULONG cch,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
DWORD dwFlags,
IDataObject *pDataObject,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
DWORD dwFlags,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
LONG acpStart,
LONG acpHalt,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags,
LONG *pacpNext,
WINBOOL *pfFound,
LONG *plFoundOffset) = 0;
virtual HRESULT STDMETHODCALLTYPE <API key>(
ULONG ulCount,
TS_ATTRVAL *paAttrVals,
ULONG *pcFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE GetEndACP(
LONG *pacp) = 0;
virtual HRESULT STDMETHODCALLTYPE GetActiveView(
TsViewCookie *pvcView) = 0;
virtual HRESULT STDMETHODCALLTYPE GetACPFromPoint(
TsViewCookie vcView,
const POINT *ptScreen,
DWORD dwFlags,
LONG *pacp) = 0;
virtual HRESULT STDMETHODCALLTYPE GetTextExt(
TsViewCookie vcView,
LONG acpStart,
LONG acpEnd,
RECT *prc,
WINBOOL *pfClipped) = 0;
virtual HRESULT STDMETHODCALLTYPE GetScreenExt(
TsViewCookie vcView,
RECT *prc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetWnd(
TsViewCookie vcView,
HWND *phwnd) = 0;
};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(ITextStoreACP, 0x28888fe3, 0xc2a0, 0x483a, 0xa3,0xea, 0x8c,0xb1,0xce,0x51,0xff,0x3d)
#endif
#else
typedef struct ITextStoreACPVtbl {
BEGIN_INTERFACE
/*** IUnknown methods ***/
HRESULT (STDMETHODCALLTYPE *QueryInterface)(
ITextStoreACP* This,
REFIID riid,
void **ppvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(
ITextStoreACP* This);
ULONG (STDMETHODCALLTYPE *Release)(
ITextStoreACP* This);
/*** ITextStoreACP methods ***/
HRESULT (STDMETHODCALLTYPE *AdviseSink)(
ITextStoreACP* This,
REFIID riid,
IUnknown *punk,
DWORD dwMask);
HRESULT (STDMETHODCALLTYPE *UnadviseSink)(
ITextStoreACP* This,
IUnknown *punk);
HRESULT (STDMETHODCALLTYPE *RequestLock)(
ITextStoreACP* This,
DWORD dwLockFlags,
HRESULT *phrSession);
HRESULT (STDMETHODCALLTYPE *GetStatus)(
ITextStoreACP* This,
TS_STATUS *pdcs);
HRESULT (STDMETHODCALLTYPE *QueryInsert)(
ITextStoreACP* This,
LONG acpTestStart,
LONG acpTestEnd,
ULONG cch,
LONG *pacpResultStart,
LONG *pacpResultEnd);
HRESULT (STDMETHODCALLTYPE *GetSelection)(
ITextStoreACP* This,
ULONG ulIndex,
ULONG ulCount,
TS_SELECTION_ACP *pSelection,
ULONG *pcFetched);
HRESULT (STDMETHODCALLTYPE *SetSelection)(
ITextStoreACP* This,
ULONG ulCount,
const TS_SELECTION_ACP *pSelection);
HRESULT (STDMETHODCALLTYPE *GetText)(
ITextStoreACP* This,
LONG acpStart,
LONG acpEnd,
WCHAR *pchPlain,
ULONG cchPlainReq,
ULONG *pcchPlainRet,
TS_RUNINFO *prgRunInfo,
ULONG cRunInfoReq,
ULONG *pcRunInfoRet,
LONG *pacpNext);
HRESULT (STDMETHODCALLTYPE *SetText)(
ITextStoreACP* This,
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
const WCHAR *pchText,
ULONG cch,
TS_TEXTCHANGE *pChange);
HRESULT (STDMETHODCALLTYPE *GetFormattedText)(
ITextStoreACP* This,
LONG acpStart,
LONG acpEnd,
IDataObject **ppDataObject);
HRESULT (STDMETHODCALLTYPE *GetEmbedded)(
ITextStoreACP* This,
LONG acpPos,
REFGUID rguidService,
REFIID riid,
IUnknown **ppunk);
HRESULT (STDMETHODCALLTYPE *QueryInsertEmbedded)(
ITextStoreACP* This,
const GUID *pguidService,
const FORMATETC *pFormatEtc,
WINBOOL *pfInsertable);
HRESULT (STDMETHODCALLTYPE *InsertEmbedded)(
ITextStoreACP* This,
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
IDataObject *pDataObject,
TS_TEXTCHANGE *pChange);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
DWORD dwFlags,
const WCHAR *pchText,
ULONG cch,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
DWORD dwFlags,
IDataObject *pDataObject,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
DWORD dwFlags,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
LONG acpStart,
LONG acpHalt,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags,
LONG *pacpNext,
WINBOOL *pfFound,
LONG *plFoundOffset);
HRESULT (STDMETHODCALLTYPE *<API key>)(
ITextStoreACP* This,
ULONG ulCount,
TS_ATTRVAL *paAttrVals,
ULONG *pcFetched);
HRESULT (STDMETHODCALLTYPE *GetEndACP)(
ITextStoreACP* This,
LONG *pacp);
HRESULT (STDMETHODCALLTYPE *GetActiveView)(
ITextStoreACP* This,
TsViewCookie *pvcView);
HRESULT (STDMETHODCALLTYPE *GetACPFromPoint)(
ITextStoreACP* This,
TsViewCookie vcView,
const POINT *ptScreen,
DWORD dwFlags,
LONG *pacp);
HRESULT (STDMETHODCALLTYPE *GetTextExt)(
ITextStoreACP* This,
TsViewCookie vcView,
LONG acpStart,
LONG acpEnd,
RECT *prc,
WINBOOL *pfClipped);
HRESULT (STDMETHODCALLTYPE *GetScreenExt)(
ITextStoreACP* This,
TsViewCookie vcView,
RECT *prc);
HRESULT (STDMETHODCALLTYPE *GetWnd)(
ITextStoreACP* This,
TsViewCookie vcView,
HWND *phwnd);
END_INTERFACE
} ITextStoreACPVtbl;
interface ITextStoreACP {
CONST_VTBL ITextStoreACPVtbl* lpVtbl;
};
#ifdef COBJMACROS
#ifndef <API key>
/*** IUnknown methods ***/
#define <API key>(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define <API key>(This) (This)->lpVtbl->AddRef(This)
#define <API key>(This) (This)->lpVtbl->Release(This)
/*** ITextStoreACP methods ***/
#define <API key>(This,riid,punk,dwMask) (This)->lpVtbl->AdviseSink(This,riid,punk,dwMask)
#define <API key>(This,punk) (This)->lpVtbl->UnadviseSink(This,punk)
#define <API key>(This,dwLockFlags,phrSession) (This)->lpVtbl->RequestLock(This,dwLockFlags,phrSession)
#define <API key>(This,pdcs) (This)->lpVtbl->GetStatus(This,pdcs)
#define <API key>(This,acpTestStart,acpTestEnd,cch,pacpResultStart,pacpResultEnd) (This)->lpVtbl->QueryInsert(This,acpTestStart,acpTestEnd,cch,pacpResultStart,pacpResultEnd)
#define <API key>(This,ulIndex,ulCount,pSelection,pcFetched) (This)->lpVtbl->GetSelection(This,ulIndex,ulCount,pSelection,pcFetched)
#define <API key>(This,ulCount,pSelection) (This)->lpVtbl->SetSelection(This,ulCount,pSelection)
#define <API key>(This,acpStart,acpEnd,pchPlain,cchPlainReq,pcchPlainRet,prgRunInfo,cRunInfoReq,pcRunInfoRet,pacpNext) (This)->lpVtbl->GetText(This,acpStart,acpEnd,pchPlain,cchPlainReq,pcchPlainRet,prgRunInfo,cRunInfoReq,pcRunInfoRet,pacpNext)
#define <API key>(This,dwFlags,acpStart,acpEnd,pchText,cch,pChange) (This)->lpVtbl->SetText(This,dwFlags,acpStart,acpEnd,pchText,cch,pChange)
#define <API key>(This,acpStart,acpEnd,ppDataObject) (This)->lpVtbl->GetFormattedText(This,acpStart,acpEnd,ppDataObject)
#define <API key>(This,acpPos,rguidService,riid,ppunk) (This)->lpVtbl->GetEmbedded(This,acpPos,rguidService,riid,ppunk)
#define <API key>(This,pguidService,pFormatEtc,pfInsertable) (This)->lpVtbl->QueryInsertEmbedded(This,pguidService,pFormatEtc,pfInsertable)
#define <API key>(This,dwFlags,acpStart,acpEnd,pDataObject,pChange) (This)->lpVtbl->InsertEmbedded(This,dwFlags,acpStart,acpEnd,pDataObject,pChange)
#define <API key>(This,dwFlags,pchText,cch,pacpStart,pacpEnd,pChange) (This)->lpVtbl-><API key>(This,dwFlags,pchText,cch,pacpStart,pacpEnd,pChange)
#define <API key>(This,dwFlags,pDataObject,pacpStart,pacpEnd,pChange) (This)->lpVtbl-><API key>(This,dwFlags,pDataObject,pacpStart,pacpEnd,pChange)
#define <API key>(This,dwFlags,cFilterAttrs,paFilterAttrs) (This)->lpVtbl-><API key>(This,dwFlags,cFilterAttrs,paFilterAttrs)
#define <API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags) (This)->lpVtbl-><API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags)
#define <API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags) (This)->lpVtbl-><API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags)
#define <API key>(This,acpStart,acpHalt,cFilterAttrs,paFilterAttrs,dwFlags,pacpNext,pfFound,plFoundOffset) (This)->lpVtbl-><API key>(This,acpStart,acpHalt,cFilterAttrs,paFilterAttrs,dwFlags,pacpNext,pfFound,plFoundOffset)
#define <API key>(This,ulCount,paAttrVals,pcFetched) (This)->lpVtbl-><API key>(This,ulCount,paAttrVals,pcFetched)
#define <API key>(This,pacp) (This)->lpVtbl->GetEndACP(This,pacp)
#define <API key>(This,pvcView) (This)->lpVtbl->GetActiveView(This,pvcView)
#define <API key>(This,vcView,ptScreen,dwFlags,pacp) (This)->lpVtbl->GetACPFromPoint(This,vcView,ptScreen,dwFlags,pacp)
#define <API key>(This,vcView,acpStart,acpEnd,prc,pfClipped) (This)->lpVtbl->GetTextExt(This,vcView,acpStart,acpEnd,prc,pfClipped)
#define <API key>(This,vcView,prc) (This)->lpVtbl->GetScreenExt(This,vcView,prc)
#define <API key>(This,vcView,phwnd) (This)->lpVtbl->GetWnd(This,vcView,phwnd)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,REFIID riid,void **ppvObject) {
return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG <API key>(ITextStoreACP* This) {
return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG <API key>(ITextStoreACP* This) {
return This->lpVtbl->Release(This);
}
/*** ITextStoreACP methods ***/
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,REFIID riid,IUnknown *punk,DWORD dwMask) {
return This->lpVtbl->AdviseSink(This,riid,punk,dwMask);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,IUnknown *punk) {
return This->lpVtbl->UnadviseSink(This,punk);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwLockFlags,HRESULT *phrSession) {
return This->lpVtbl->RequestLock(This,dwLockFlags,phrSession);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TS_STATUS *pdcs) {
return This->lpVtbl->GetStatus(This,pdcs);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpTestStart,LONG acpTestEnd,ULONG cch,LONG *pacpResultStart,LONG *pacpResultEnd) {
return This->lpVtbl->QueryInsert(This,acpTestStart,acpTestEnd,cch,pacpResultStart,pacpResultEnd);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,ULONG ulIndex,ULONG ulCount,TS_SELECTION_ACP *pSelection,ULONG *pcFetched) {
return This->lpVtbl->GetSelection(This,ulIndex,ulCount,pSelection,pcFetched);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,ULONG ulCount,const TS_SELECTION_ACP *pSelection) {
return This->lpVtbl->SetSelection(This,ulCount,pSelection);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpStart,LONG acpEnd,WCHAR *pchPlain,ULONG cchPlainReq,ULONG *pcchPlainRet,TS_RUNINFO *prgRunInfo,ULONG cRunInfoReq,ULONG *pcRunInfoRet,LONG *pacpNext) {
return This->lpVtbl->GetText(This,acpStart,acpEnd,pchPlain,cchPlainReq,pcchPlainRet,prgRunInfo,cRunInfoReq,pcRunInfoRet,pacpNext);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwFlags,LONG acpStart,LONG acpEnd,const WCHAR *pchText,ULONG cch,TS_TEXTCHANGE *pChange) {
return This->lpVtbl->SetText(This,dwFlags,acpStart,acpEnd,pchText,cch,pChange);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpStart,LONG acpEnd,IDataObject **ppDataObject) {
return This->lpVtbl->GetFormattedText(This,acpStart,acpEnd,ppDataObject);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpPos,REFGUID rguidService,REFIID riid,IUnknown **ppunk) {
return This->lpVtbl->GetEmbedded(This,acpPos,rguidService,riid,ppunk);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,const GUID *pguidService,const FORMATETC *pFormatEtc,WINBOOL *pfInsertable) {
return This->lpVtbl->QueryInsertEmbedded(This,pguidService,pFormatEtc,pfInsertable);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwFlags,LONG acpStart,LONG acpEnd,IDataObject *pDataObject,TS_TEXTCHANGE *pChange) {
return This->lpVtbl->InsertEmbedded(This,dwFlags,acpStart,acpEnd,pDataObject,pChange);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwFlags,const WCHAR *pchText,ULONG cch,LONG *pacpStart,LONG *pacpEnd,TS_TEXTCHANGE *pChange) {
return This->lpVtbl-><API key>(This,dwFlags,pchText,cch,pacpStart,pacpEnd,pChange);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwFlags,IDataObject *pDataObject,LONG *pacpStart,LONG *pacpEnd,TS_TEXTCHANGE *pChange) {
return This->lpVtbl-><API key>(This,dwFlags,pDataObject,pacpStart,pacpEnd,pChange);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,DWORD dwFlags,ULONG cFilterAttrs,const TS_ATTRID *paFilterAttrs) {
return This->lpVtbl-><API key>(This,dwFlags,cFilterAttrs,paFilterAttrs);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpPos,ULONG cFilterAttrs,const TS_ATTRID *paFilterAttrs,DWORD dwFlags) {
return This->lpVtbl-><API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpPos,ULONG cFilterAttrs,const TS_ATTRID *paFilterAttrs,DWORD dwFlags) {
return This->lpVtbl-><API key>(This,acpPos,cFilterAttrs,paFilterAttrs,dwFlags);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG acpStart,LONG acpHalt,ULONG cFilterAttrs,const TS_ATTRID *paFilterAttrs,DWORD dwFlags,LONG *pacpNext,WINBOOL *pfFound,LONG *plFoundOffset) {
return This->lpVtbl-><API key>(This,acpStart,acpHalt,cFilterAttrs,paFilterAttrs,dwFlags,pacpNext,pfFound,plFoundOffset);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,ULONG ulCount,TS_ATTRVAL *paAttrVals,ULONG *pcFetched) {
return This->lpVtbl-><API key>(This,ulCount,paAttrVals,pcFetched);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,LONG *pacp) {
return This->lpVtbl->GetEndACP(This,pacp);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TsViewCookie *pvcView) {
return This->lpVtbl->GetActiveView(This,pvcView);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TsViewCookie vcView,const POINT *ptScreen,DWORD dwFlags,LONG *pacp) {
return This->lpVtbl->GetACPFromPoint(This,vcView,ptScreen,dwFlags,pacp);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TsViewCookie vcView,LONG acpStart,LONG acpEnd,RECT *prc,WINBOOL *pfClipped) {
return This->lpVtbl->GetTextExt(This,vcView,acpStart,acpEnd,prc,pfClipped);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TsViewCookie vcView,RECT *prc) {
return This->lpVtbl->GetScreenExt(This,vcView,prc);
}
static FORCEINLINE HRESULT <API key>(ITextStoreACP* This,TsViewCookie vcView,HWND *phwnd) {
return This->lpVtbl->GetWnd(This,vcView,phwnd);
}
#endif
#endif
#endif
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
REFIID riid,
IUnknown *punk,
DWORD dwMask);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
IUnknown *punk);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwLockFlags,
HRESULT *phrSession);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TS_STATUS *pdcs);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpTestStart,
LONG acpTestEnd,
ULONG cch,
LONG *pacpResultStart,
LONG *pacpResultEnd);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
ULONG ulIndex,
ULONG ulCount,
TS_SELECTION_ACP *pSelection,
ULONG *pcFetched);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
ULONG ulCount,
const TS_SELECTION_ACP *pSelection);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpStart,
LONG acpEnd,
WCHAR *pchPlain,
ULONG cchPlainReq,
ULONG *pcchPlainRet,
TS_RUNINFO *prgRunInfo,
ULONG cRunInfoReq,
ULONG *pcRunInfoRet,
LONG *pacpNext);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
const WCHAR *pchText,
ULONG cch,
TS_TEXTCHANGE *pChange);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpStart,
LONG acpEnd,
IDataObject **ppDataObject);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpPos,
REFGUID rguidService,
REFIID riid,
IUnknown **ppunk);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
const GUID *pguidService,
const FORMATETC *pFormatEtc,
WINBOOL *pfInsertable);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwFlags,
LONG acpStart,
LONG acpEnd,
IDataObject *pDataObject,
TS_TEXTCHANGE *pChange);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwFlags,
const WCHAR *pchText,
ULONG cch,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwFlags,
IDataObject *pDataObject,
LONG *pacpStart,
LONG *pacpEnd,
TS_TEXTCHANGE *pChange);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
DWORD dwFlags,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpPos,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG acpStart,
LONG acpHalt,
ULONG cFilterAttrs,
const TS_ATTRID *paFilterAttrs,
DWORD dwFlags,
LONG *pacpNext,
WINBOOL *pfFound,
LONG *plFoundOffset);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
ULONG ulCount,
TS_ATTRVAL *paAttrVals,
ULONG *pcFetched);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
LONG *pacp);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TsViewCookie *pvcView);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TsViewCookie vcView,
const POINT *ptScreen,
DWORD dwFlags,
LONG *pacp);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TsViewCookie vcView,
LONG acpStart,
LONG acpEnd,
RECT *prc,
WINBOOL *pfClipped);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TsViewCookie vcView,
RECT *prc);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE <API key>(
ITextStoreACP* This,
TsViewCookie vcView,
HWND *phwnd);
void __RPC_STUB <API key>(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
#endif /* <API key> */
/* Begin additional prototypes for all interfaces */
ULONG __RPC_USER CLIPFORMAT_UserSize (ULONG *, ULONG, CLIPFORMAT *);
unsigned char * __RPC_USER <API key> (ULONG *, unsigned char *, CLIPFORMAT *);
unsigned char * __RPC_USER <API key>(ULONG *, unsigned char *, CLIPFORMAT *);
void __RPC_USER CLIPFORMAT_UserFree (ULONG *, CLIPFORMAT *);
ULONG __RPC_USER VARIANT_UserSize (ULONG *, ULONG, VARIANT *);
unsigned char * __RPC_USER VARIANT_UserMarshal (ULONG *, unsigned char *, VARIANT *);
unsigned char * __RPC_USER <API key>(ULONG *, unsigned char *, VARIANT *);
void __RPC_USER VARIANT_UserFree (ULONG *, VARIANT *);
ULONG __RPC_USER HWND_UserSize (ULONG *, ULONG, HWND *);
unsigned char * __RPC_USER HWND_UserMarshal (ULONG *, unsigned char *, HWND *);
unsigned char * __RPC_USER HWND_UserUnmarshal(ULONG *, unsigned char *, HWND *);
void __RPC_USER HWND_UserFree (ULONG *, HWND *);
/* End additional prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __textstor_h__ */ |
#ifndef _LINUX_TCP_H
#define _LINUX_TCP_H
#include <linux/types.h>
#include <asm/byteorder.h>
#include <linux/socket.h>
struct tcphdr {
__be16 source;
__be16 dest;
__be32 seq;
__be32 ack_seq;
#if defined(<API key>)
__u16 res1:4,
doff:4,
fin:1,
syn:1,
rst:1,
psh:1,
ack:1,
urg:1,
ece:1,
cwr:1;
#elif defined(<API key>)
__u16 doff:4,
res1:4,
cwr:1,
ece:1,
urg:1,
ack:1,
psh:1,
rst:1,
syn:1,
fin:1;
#else
#error "Adjust your <asm/byteorder.h> defines"
#endif
__be16 window;
__sum16 check;
__be16 urg_ptr;
};
/*
* The union cast uses a gcc extension to avoid aliasing problems
* (union is compatible to any of its members)
* This means this part of the code is -fstrict-aliasing safe now.
*/
union tcp_word_hdr {
struct tcphdr hdr;
__be32 words[5];
};
#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
enum {
TCP_FLAG_CWR = __cpu_to_be32(0x00800000),
TCP_FLAG_ECE = __cpu_to_be32(0x00400000),
TCP_FLAG_URG = __cpu_to_be32(0x00200000),
TCP_FLAG_ACK = __cpu_to_be32(0x00100000),
TCP_FLAG_PSH = __cpu_to_be32(0x00080000),
TCP_FLAG_RST = __cpu_to_be32(0x00040000),
TCP_FLAG_SYN = __cpu_to_be32(0x00020000),
TCP_FLAG_FIN = __cpu_to_be32(0x00010000),
TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000),
TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
};
/*
* TCP general constants
*/
#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */
#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */
/* TCP socket options */
#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
#define TCP_MAXSEG 2 /* Limit MSS */
#define TCP_CORK 3 /* Never send partially complete segments */
#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
#define TCP_KEEPINTVL 5 /* Interval between keepalives */
#define TCP_KEEPCNT 6 /* Number of keepalives before death */
#define TCP_SYNCNT 7 /* Number of SYN retransmits */
#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
#define TCP_INFO 11 /* Information about this connection. */
#define TCP_QUICKACK 12 /* Block/reenable quick acks */
#define TCP_CONGESTION 13 /* Congestion control algorithm */
#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
#define <API key> 15 /* TCP Cookie Transactions */
#define <API key> 16 /* Use linear timeouts for thin streams*/
#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
/* for TCP_INFO socket option */
#define TCPI_OPT_TIMESTAMPS 1
#define TCPI_OPT_SACK 2
#define TCPI_OPT_WSCALE 4
#define TCPI_OPT_ECN 8
enum tcp_ca_state {
TCP_CA_Open = 0,
#define TCPF_CA_Open (1<<TCP_CA_Open)
TCP_CA_Disorder = 1,
#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
TCP_CA_CWR = 2,
#define TCPF_CA_CWR (1<<TCP_CA_CWR)
TCP_CA_Recovery = 3,
#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
TCP_CA_Loss = 4
#define TCPF_CA_Loss (1<<TCP_CA_Loss)
};
struct tcp_info {
__u8 tcpi_state;
__u8 tcpi_ca_state;
__u8 tcpi_retransmits;
__u8 tcpi_probes;
__u8 tcpi_backoff;
__u8 tcpi_options;
__u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
__u32 tcpi_rto;
__u32 tcpi_ato;
__u32 tcpi_snd_mss;
__u32 tcpi_rcv_mss;
__u32 tcpi_unacked;
__u32 tcpi_sacked;
__u32 tcpi_lost;
__u32 tcpi_retrans;
__u32 tcpi_fackets;
/* Times. */
__u32 tcpi_last_data_sent;
__u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
__u32 tcpi_last_data_recv;
__u32 tcpi_last_ack_recv;
/* Metrics. */
__u32 tcpi_pmtu;
__u32 tcpi_rcv_ssthresh;
__u32 tcpi_rtt;
__u32 tcpi_rttvar;
__u32 tcpi_snd_ssthresh;
__u32 tcpi_snd_cwnd;
__u32 tcpi_advmss;
__u32 tcpi_reordering;
__u32 tcpi_rcv_rtt;
__u32 tcpi_rcv_space;
__u32 tcpi_total_retrans;
};
/* for TCP_MD5SIG socket option */
#define <API key> 80
struct tcp_md5sig {
struct <API key> tcpm_addr; /* address associated */
__u16 __tcpm_pad1; /* zero */
__u16 tcpm_keylen; /* key length */
__u32 __tcpm_pad2; /* zero */
__u8 tcpm_key[<API key>]; /* key (binary) */
};
/* for <API key> (TCPCT) socket option */
#define TCP_COOKIE_MIN 8 /* 64-bits */
#define TCP_COOKIE_MAX 16 /* 128-bits */
#define <API key> (2*TCP_COOKIE_MAX)
/* Flags for both getsockopt and setsockopt */
#define <API key> (1 << 0) /* Discard SYN without cookie */
#define <API key> (1 << 1) /* Prohibit outgoing cookies,
* supercedes everything. */
/* Flags for getsockopt */
#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
/* <API key> data */
struct <API key> {
__u16 tcpct_flags; /* see above */
__u8 __tcpct_pad1; /* zero */
__u8 <API key>; /* bytes */
__u16 <API key>; /* bytes of variable data */
__u16 tcpct_used; /* bytes in value */
__u8 tcpct_value[TCP_MSS_DEFAULT];
};
#ifdef __KERNEL__
#include <linux/skbuff.h>
#include <linux/dmaengine.h>
#include <net/sock.h>
#include <net/<API key>.h>
#include <net/inet_timewait_sock.h>
static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
{
return (struct tcphdr *)<API key>(skb);
}
static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
{
return tcp_hdr(skb)->doff * 4;
}
static inline unsigned int tcp_optlen(const struct sk_buff *skb)
{
return (tcp_hdr(skb)->doff - 5) * 4;
}
/* This defines a selective acknowledgement block. */
struct tcp_sack_block_wire {
__be32 start_seq;
__be32 end_seq;
};
struct tcp_sack_block {
u32 start_seq;
u32 end_seq;
};
struct <API key> {
/* PAWS/RTTM data */
long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
u32 ts_recent; /* Time stamp to echo next */
u32 rcv_tsval; /* Time stamp value */
u32 rcv_tsecr; /* Time stamp echo reply */
u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */
tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */
dsack : 1, /* D-SACK is scheduled */
wscale_ok : 1, /* Wscale seen on SYN packet */
sack_ok : 4, /* SACK seen on SYN packet */
snd_wscale : 4, /* Window scaling received from sender */
rcv_wscale : 4; /* Window scaling to send to receiver */
u8 cookie_plus:6, /* bytes in authenticator/cookie option */
cookie_out_never:1,
cookie_in_always:1;
u8 num_sacks; /* Number of SACK blocks */
u16 user_mss; /* mss requested by user in ioctl */
u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
};
static inline void tcp_clear_options(struct <API key> *rx_opt)
{
rx_opt->tstamp_ok = rx_opt->sack_ok = 0;
rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
rx_opt->cookie_plus = 0;
}
/* This is the max number of SACKS that we'll generate and process. It's safe
* to increase this, although since:
* size = <API key> (4) + n * <API key> (8)
* only four options will fit in a standard TCP header */
#define TCP_NUM_SACKS 4
struct tcp_cookie_values;
struct <API key>;
struct tcp_request_sock {
struct inet_request_sock req;
#ifdef CONFIG_TCP_MD5SIG
/* Only used by TCP MD5 Signature so far. */
const struct <API key> *af_specific;
#endif
u32 rcv_isn;
u32 snt_isn;
};
static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
{
return (struct tcp_request_sock *)req;
}
struct tcp_sock {
/* <API key> has to be the first member of tcp_sock */
struct <API key> inet_conn;
u16 tcp_header_len; /* Bytes of tcp header to send */
u16 xmit_size_goal_segs; /* Goal for segmenting output packets */
/*
* Header prediction flags
* 0x5?10 << 16 + snd_wnd in net byte order
*/
__be32 pred_flags;
/*
* RFC793 variables by their proper names. This means you can
* read the code and the spec side by side (and laugh ...)
* See RFC793 and RFC1122. The RFC writes these in capitals.
*/
u32 rcv_nxt; /* What we want to receive next */
u32 copied_seq; /* Head of yet unread data */
u32 rcv_wup; /* rcv_nxt on last window update sent */
u32 snd_nxt; /* Next sequence we send */
u32 snd_una; /* First byte we want an ack for */
u32 snd_sml; /* Last byte of the most recently transmitted small packet */
u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
/* Data for direct copy to user */
struct {
struct sk_buff_head prequeue;
struct task_struct *task;
struct iovec *iov;
int memory;
int len;
#ifdef CONFIG_NET_DMA
/* members for async copy */
struct dma_chan *dma_chan;
int wakeup;
struct dma_pinned_list *pinned_list;
dma_cookie_t dma_cookie;
#endif
} ucopy;
u32 snd_wl1; /* Sequence for window update */
u32 snd_wnd; /* The window we expect to receive */
u32 max_window; /* Maximal window ever seen from peer */
u32 mss_cache; /* Cached effective mss, not including SACKS */
u32 window_clamp; /* Maximal window to advertise */
u32 rcv_ssthresh; /* Current window clamp */
u32 frto_highmark; /* snd_nxt when RTO occurred */
u16 advmss; /* Advertised MSS */
u8 frto_counter; /* Number of new acks after RTO */
u8 nonagle : 4,/* Disable Nagle algorithm? */
thin_lto : 1,/* Use linear timeouts for thin streams */
thin_dupack : 1,/* Fast retransmit on first dupack */
unused : 2;
/* RTT measurement */
u32 srtt; /* smoothed round trip time << 3 */
u32 mdev; /* medium deviation */
u32 mdev_max; /* maximal mdev for the last rtt period */
u32 rttvar; /* smoothed mdev_max */
u32 rtt_seq; /* sequence number to update rttvar */
u32 packets_out; /* Packets which are "in flight" */
u32 retrans_out; /* Retransmitted packets out */
u16 urg_data; /* Saved octet of OOB data and control flags */
u8 ecn_flags; /* ECN status bits. */
u8 reordering; /* Packet reordering metric. */
u32 snd_up; /* Urgent pointer */
u8 keepalive_probes; /* num of allowed keep alive probes */
/*
* Options received (usually on last packet, some only on SYN packets).
*/
struct <API key> rx_opt;
/*
* Slow start and congestion control (see also Nagle, and Karn & Partridge)
*/
u32 snd_ssthresh; /* Slow start size threshold */
u32 snd_cwnd; /* Sending congestion window */
u32 snd_cwnd_cnt; /* Linear increase counter */
u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
u32 snd_cwnd_used;
u32 snd_cwnd_stamp;
u32 prior_cwnd; /* Congestion window at start of Recovery. */
u32 prr_delivered; /* Number of newly delivered packets to
* receiver in Recovery. */
u32 prr_out; /* Total number of pkts sent during Recovery. */
u32 rcv_wnd; /* Current receiver window */
u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
u32 pushed_seq; /* Last pushed seq, required to talk to windows */
u32 lost_out; /* Lost packets */
u32 sacked_out; /* SACK'd packets */
u32 fackets_out; /* FACK'd packets */
u32 tso_deferred;
u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
/* from STCP, retrans queue hinting */
struct sk_buff* lost_skb_hint;
struct sk_buff *scoreboard_skb_hint;
struct sk_buff *retransmit_skb_hint;
struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
/* SACKs data, these 2 need to be together (see <API key>) */
struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
struct tcp_sack_block recv_sack_cache[4];
struct sk_buff *highest_sack; /* highest skb with SACK received
* (validity guaranteed only if
* sacked_out > 0)
*/
int lost_cnt_hint;
u32 retransmit_high; /* L-bits may be on up to this seqno */
u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
u32 prior_ssthresh; /* ssthresh saved at recovery start */
u32 high_seq; /* snd_nxt at onset of congestion */
u32 retrans_stamp; /* Timestamp of the last retransmit,
* also used in SYN-SENT to remember stamp of
* the first SYN. */
u32 undo_marker; /* tracking retrans started here. */
int undo_retrans; /* number of undoable retransmissions. */
u32 total_retrans; /* Total retransmits for entire connection */
u32 urg_seq; /* Seq of received urgent pointer */
unsigned int keepalive_time; /* time before keep alive takes place */
unsigned int keepalive_intvl; /* time interval between keep alive probes */
int linger2;
/* Receiver side RTT estimation */
struct {
u32 rtt;
u32 seq;
u32 time;
} rcv_rtt_est;
/* Receiver queue space */
struct {
int space;
u32 seq;
u32 time;
} rcvq_space;
/* TCP-specific MTU probe information. */
struct {
u32 probe_seq_start;
u32 probe_seq_end;
} mtu_probe;
#ifdef CONFIG_TCP_MD5SIG
/* TCP AF-Specific parts; only used by MD5 Signature support so far */
const struct tcp_sock_af_ops *af_specific;
/* TCP MD5 Signature Option information */
struct tcp_md5sig_info *md5sig_info;
#endif
/* When the cookie options are generated and exchanged, then this
* object holds a reference to them (cookie_values->kref). Also
* contains related <API key> fields.
*/
struct tcp_cookie_values *cookie_values;
};
static inline struct tcp_sock *tcp_sk(const struct sock *sk)
{
return (struct tcp_sock *)sk;
}
struct tcp_timewait_sock {
struct inet_timewait_sock tw_sk;
u32 tw_rcv_nxt;
u32 tw_snd_nxt;
u32 tw_rcv_wnd;
u32 tw_ts_recent;
long tw_ts_recent_stamp;
#ifdef CONFIG_TCP_MD5SIG
u16 tw_md5_keylen;
u8 tw_md5_key[<API key>];
#endif
/* Few sockets in timewait have cookies; in that case, then this
* object holds a reference to them (tw_cookie_values->kref).
*/
struct tcp_cookie_values *tw_cookie_values;
};
static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
{
return (struct tcp_timewait_sock *)sk;
}
#endif /* __KERNEL__ */
#endif /* _LINUX_TCP_H */ |
#ifndef __BATHOS_GPIO_H__
#define __BATHOS_GPIO_H__
/* for gpio_dir() and gpio_dir_af() */
#define GPIO_DIR_IN 0
#define GPIO_DIR_OUT 1
/* for gpio_dir_af() */
#define GPIO_AF_GPIO 0
#define GPIO_AF(x) x
#ifdef CONFIG_HAS_GPIO
#include <arch/gpio.h>
#else
/*
* Empty GPIO definitions, to allow libraries to be built
* (then, clearly, we can't link with those functions, like w1-gpio)
*/
extern void <API key>(); /* link error */
static inline int gpio_dir_af(int gpio, int output, int value, int afnum)
{
<API key>();
return 0;
}
static inline void gpio_dir(int gpio, int output, int value)
{
<API key>();
}
static inline int gpio_get(int gpio)
{
<API key>();
return -1;
}
#define __gpio_get gpio_get
static inline void gpio_set(int gpio, int value)
{
<API key>();
}
#define __gpio_set gpio_set
#endif /* CONFIG_HAS_GPIO */
#endif /* __BATHOS_GPIO_H__ */ |
<?php
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-basic-grid.php' );
class <API key> extends <API key> {
protected function getFileName() {
return 'vc_basic_grid';
}
public function shortcodeScripts() {
parent::shortcodeScripts();
wp_register_script( 'vc_masonry', vc_asset_url( 'lib/bower/masonry/dist/masonry.pkgd.min.js' ) );
wp_register_script( '<API key>', vc_asset_url( 'js/components/<API key>.js' ),
array( 'vc_grid-style-all' ), WPB_VC_VERSION, true );
wp_register_script( '<API key>', vc_asset_url( 'js/components/<API key>.js' ),
array( 'vc_grid-style-all' ), WPB_VC_VERSION, true );
wp_register_script( '<API key>', vc_asset_url( 'js/components/<API key>.js' ),
array( 'vc_grid-style-all' ), WPB_VC_VERSION, true );
}
public function enqueueScripts() {
parent::enqueueScripts();
wp_enqueue_script( 'vc_masonry' );
wp_enqueue_script( '<API key>' );
wp_enqueue_script( '<API key>' );
wp_enqueue_script( '<API key>' );
}
public function buildGridSettings() {
parent::buildGridSettings();
$this->grid_settings['style'] .= '-masonry';
}
protected function contentAllMasonry( $grid_style, $settings, $content ) {
return parent::contentAll( $grid_style, $settings, $content );
}
protected function contentLazyMasonry( $grid_style, $settings, $content ) {
return parent::contentLazy( $grid_style, $settings, $content );
}
protected function <API key>( $grid_style, $settings, $content ) {
return parent::contentLoadMore( $grid_style, $settings, $content );
}
} |
YUI.add('ez-locationviewview', function (Y) {
"use strict";
/**
* Provides the Location view View class
*
* @module ez-locationviewview
*/
Y.namespace('eZ');
var <API key> = '<API key>';
/**
* The location view view
*
* @namespace eZ
* @class LocationViewView
* @constructor
* @extends eZ.TemplateBasedView
*/
Y.eZ.LocationViewView = Y.Base.create('locationViewView', Y.eZ.TemplateBasedView, [Y.eZ.Tabs], {
initializer: function () {
this.on('*:<API key>', this.<API key>);
this.after('changeTab', this._syncSelectedTab);
this.after('selectedTabChange', this.<API key>);
this.after('activeChange', function () {
Y.Array.each(this.get('tabs'), function (t) {
t.set('active', this.get('active'));
}, this);
});
},
/**
* Event handler for the <API key> event
*
* @protected
* @method <API key>
*/
<API key>: function () {
this.get('container').toggleClass(<API key>);
},
/**
* Converts each location in the path to a plain object representation
*
* @method _pathToJSON
* @private
* @return Array
*/
_pathToJSON: function () {
return Y.Array.map(this.get('path'), function (location) {
return location.toJSON();
});
},
/**
* Renders the location view
*
* @method render
* @return {eZ.LocationViewView} the view itself
*/
render: function () {
var container = this.get('container'),
subitemList = this.get('subitemList');
container.setHTML(this.template({
location: this.get('location').toJSON(),
content: this.get('content').toJSON(),
contentType: this.get('contentType').toJSON(),
tabs: this._getTabsList(),
path: this._pathToJSON()
}));
container.one('.<API key>').append(
this.get('actionBar').render().get('container')
);
this._renderTabViews();
if ( subitemList ) {
container.one('.<API key>').append(
subitemList.render().get('container')
);
}
this._uiSetMinHeight();
return this;
},
/**
* Renders the tab views in their container.
*
* @method _renderTabViews
* @protected
*/
_renderTabViews: function () {
var container = this.get('container');
Y.Array.each(this.get('tabs'), function (tab) {
container.one('#ez-tabs-' + tab.get('identifier')).append(
tab.render().get('container')
);
});
},
/**
* Returns the tabs list suitable for the template. Each element in the
* returned array is an object containing the title, the identifier and
* whether the tab is selected.
*
* @method _getTabsList
* @protected
* @return {Array}
*/
_getTabsList: function () {
var tabs = [];
Y.Array.each(this.get('tabs'), function (tab) {
tabs.push({
title: tab.get('title'),
identifier: tab.get('identifier'),
selected: tab.get('identifier') === this.get('selectedTab'),
});
}, this);
return tabs;
},
/**
* `changeTab` event handler. It synchronizes the `selectedTab`
* attribute.
*
* @method _syncSelectedTab
* @protected
* @param {EventFacade} e the changeTab event facade
*/
_syncSelectedTab: function (e) {
this._set('selectedTab', e.tabLabelNode.getAttribute('data-tab-identifier'));
},
/**
* `selectedTabChange` event handler. It makes sure the the `selectedTab`
* attribute and the tab view's `selected` attribute are in sync.
*
* @method <API key>
* @protected
*/
<API key>: function () {
Y.Array.each(this.get('tabs'), function (tab) {
tab.set('selected', this.get('selectedTab') === tab.get('identifier'));
}, this);
},
/**
* Returns the title of the page when the location view is the active
* view.
*
* @method getTitle
* @return String
*/
getTitle: function () {
var title = this.get('content').get('name');
return Y.Array.reduce(this.get('path'), title, function (title, val) {
return title + ' / ' + val.get('contentInfo').get('name');
});
},
/**
* Sets the minimum height of the view
*
* @private
* @method _uiSetMinHeight
*/
_uiSetMinHeight: function () {
var container = this.get('container');
container.one('.<API key>').setStyle(
'minHeight', container.get('winHeight') + 'px'
);
},
/**
* Adds a tabView to the list of tabs.
*
* @method addTabView
* @param {eZ.LocationViewTabView} tabView
*/
addTabView: function (tabView) {
var tabs = this.get('tabs');
tabs.push(tabView);
tabView.addTarget(this);
tabs.sort(function (a, b) {
return b.get('priority') - a.get('priority');
});
},
/**
* Removes a tab from its identifier. When found, the location view is
* removed from the bubble targets list of the tabView.
*
* @method removeTabView
* @param {String} identifier
* @return {eZ.LocationViewTabView|Null} the removed tab view or null
*/
removeTabView: function (identifier) {
var removed = null;
this._set('tabs', Y.Array.reject(this.get('tabs'), function (tab) {
if ( tab.get('identifier') === identifier ) {
tab.removeTarget(this);
removed = tab;
return true;
}
}, this));
return removed;
},
destructor: function () {
var bar = this.get('actionBar'),
subitemList = this.get('subitemList');
bar.removeTarget(this);
bar.destroy();
Y.Array.each(this.get('tabs'), function (tab) {
tab.removeTarget(this);
tab.destroy();
});
if ( subitemList ) {
subitemList.removeTarget(this);
subitemList.destroy();
}
}
}, {
ATTRS: {
/**
* The location being rendered
*
* @attribute location
* @type Y.eZ.Location
* @writeOnce
*/
location: {
writeOnce: "initOnly",
},
/**
* The content associated the current location
*
* @attribute content
* @type Y.eZ.Content
* @writeOnce
*/
content: {
writeOnce: "initOnly",
},
/**
* The content type of the content at the current location
*
* @attribute contentType
* @type Y.eZ.ContentType
* @writeOnce
*/
contentType: {
writeOnce: "initOnly",
},
/**
* The path from the root location to the current location. Each
* entry of the path consists of the location.
*
* @attribute path
* @type Array
* @writeOnce
*/
path: {
writeOnce: "initOnly",
},
/**
* Language code of language currently active for the current location
*
* @attribute languageCode
* @type String
*/
languageCode: {},
/**
* The action bar instance, by default an instance {{#crossLink
* "eZ.ActionBarView"}}eZ.ActionBarView{{/crossLink}}
*
* @attribute actionBar
* @type eZ.BarView
*/
actionBar: {
valueFn: function () {
return new Y.eZ.ActionBarView({
location: this.get('location'),
content: this.get('content'),
contentType: this.get('contentType'),
bubbleTargets: this,
});
}
},
/**
* The list of the Location View tab Views.
* Do NOT change this attribute directly, use addTabView or
* removeTabView to handle the tabs list.
*
* @attribute tabs
* @type {Array} of {eZ.LocationViewTabView}
* @writeOnce
*/
tabs: {
valueFn: function () {
return [
new Y.eZ.<API key>({
content: this.get('content'),
location: this.get('location'),
contentType: this.get('contentType'),
config: this.get('config'),
languageCode: this.get('languageCode'),
priority: 1000,
selected: true,
bubbleTargets: this,
}),
new Y.eZ.<API key>({
content: this.get('content'),
location: this.get('location'),
config: this.get('config'),
priority: 2000,
selected: false,
bubbleTargets: this,
}),
new Y.eZ.<API key>({
content: this.get('content'),
location: this.get('location'),
config: this.get('config'),
priority: 3000,
selected: false,
bubbleTargets: this,
}),
new Y.eZ.<API key>({
content: this.get('content'),
contentType: this.get('contentType'),
config: this.get('config'),
priority: 4000,
selected: false,
bubbleTargets: this,
}),
];
},
writeOnce: 'initOnly',
},
/**
* The subitem list view or null if the content (type) is not
* configured to be a container.
*
* @attribute subitemList
* @type {eZ.SubitemListView|Null}
* @writeOnce
*/
subitemList: {
valueFn: function () {
var contentType = this.get('contentType');
if ( contentType && contentType.get('isContainer') ) {
return new Y.eZ.SubitemListView({
location: this.get('location'),
config: this.get('config'),
bubbleTargets: this,
});
}
return null;
},
writeOnce: 'initOnly',
},
/**
* Stores the identifier of the selected tab.
*
* @attribute selectedTab
* @type {String}
* @readOnly
*/
selectedTab: {
value: "view",
readOnly: true,
}
}
});
}); |
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/hwmon.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/spmi.h>
#include <linux/of_irq.h>
#include <linux/wakelock.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/hwmon-sysfs.h>
#include <linux/qpnp/qpnp-adc.h>
#include <linux/thermal.h>
#include <linux/platform_device.h>
#ifdef <API key>
#include "../../arch/arm/mach-msm/acer_hw_version.h"
#endif
/* QPNP VADC TM register definition */
#define QPNP_REVISION3 0x2
#define QPNP_PERPH_SUBTYPE 0x5
#define QPNP_PERPH_TYPE2 0x2
#define <API key> 2
#define QPNP_STATUS1 0x8
#define <API key> 4
#define <API key> BIT(2)
#define <API key> BIT(1)
#define QPNP_STATUS1_EOC BIT(0)
#define QPNP_STATUS2 0x9
#define <API key> 6
#define <API key> BIT(1)
#define <API key> BIT(0)
#define <API key> 2
#define QPNP_MODE_CTL 0x40
#define QPNP_OP_MODE_SHIFT 3
#define <API key> BIT(2)
#define QPNP_AMUX_TRIM_EN BIT(1)
#define QPNP_ADC_TRIM_EN BIT(0)
#define QPNP_EN_CTL1 0x46
#define QPNP_ADC_TM_EN BIT(7)
#define QPNP_ADC_CH_SEL_CTL 0x48
#define QPNP_ADC_DIG_PARAM 0x50
#define <API key> 3
#define <API key> 0x51
#define QPNP_CONV_REQ 0x52
#define QPNP_CONV_REQ_SET BIT(7)
#define QPNP_CONV_SEQ_CTL 0x54
#define <API key> 4
#define <API key> 0x55
#define <API key> 0x57
#define <API key> 0x3
#define <API key> 0x58
#define <API key> 0x4
#define <API key> 0xf0
#define <API key> 0xf
#define <API key> 0x59
#define <API key> BIT(7)
#define QPNP_FAST_AVG_CTL 0x5a
#define QPNP_FAST_AVG_EN 0x5b
#define QPNP_M0_LOW_THR_LSB 0x5c
#define QPNP_M0_LOW_THR_MSB 0x5d
#define <API key> 0x5e
#define <API key> 0x5f
#define <API key> 0x68
#define QPNP_M1_LOW_THR_LSB 0x69
#define QPNP_M1_LOW_THR_MSB 0x6a
#define <API key> 0x6b
#define <API key> 0x6c
#define <API key> 0x70
#define QPNP_M2_LOW_THR_LSB 0x71
#define QPNP_M2_LOW_THR_MSB 0x72
#define <API key> 0x73
#define <API key> 0x74
#define <API key> 0x78
#define QPNP_M3_LOW_THR_LSB 0x79
#define QPNP_M3_LOW_THR_MSB 0x7a
#define <API key> 0x7b
#define <API key> 0x7c
#define <API key> 0x80
#define QPNP_M4_LOW_THR_LSB 0x81
#define QPNP_M4_LOW_THR_MSB 0x82
#define <API key> 0x83
#define <API key> 0x84
#define <API key> 0x88
#define QPNP_M5_LOW_THR_LSB 0x89
#define QPNP_M5_LOW_THR_MSB 0x8a
#define <API key> 0x8b
#define <API key> 0x8c
#define <API key> 0x90
#define QPNP_M6_LOW_THR_LSB 0x91
#define QPNP_M6_LOW_THR_MSB 0x92
#define <API key> 0x93
#define <API key> 0x94
#define <API key> 0x98
#define QPNP_M7_LOW_THR_LSB 0x99
#define QPNP_M7_LOW_THR_MSB 0x9a
#define <API key> 0x9b
#define <API key> 0x9c
#define <API key> 0x41
#define <API key> BIT(0)
#define <API key> BIT(1)
#define <API key> BIT(2)
#define <API key> BIT(3)
#define <API key> BIT(4)
#define <API key> BIT(5)
#define <API key> BIT(6)
#define <API key> BIT(7)
#define <API key> 0x42
#define <API key> BIT(0)
#define <API key> BIT(1)
#define <API key> BIT(2)
#define <API key> BIT(3)
#define <API key> BIT(4)
#define <API key> BIT(5)
#define <API key> BIT(6)
#define <API key> BIT(7)
#define <API key> 0x43
#define <API key> BIT(0)
#define <API key> BIT(1)
#define <API key> BIT(2)
#define <API key> BIT(3)
#define <API key> BIT(4)
#define <API key> BIT(5)
#define <API key> BIT(6)
#define <API key> BIT(7)
#define <API key> 0x59
#define <API key> 0x6d
#define <API key> 0x75
#define <API key> 0x7d
#define <API key> 0x85
#define <API key> 0x8d
#define <API key> 0x95
#define <API key> 0x9d
#define QPNP_ADC_TM_STATUS1 0x8
#define <API key> 0xa
#define <API key> 0xb
#define <API key> 0x5d5c
#define <API key> 0x5f5e
#define <API key> 0x0
#define <API key>(val) (val & 0xff)
#define <API key>(val) ((val & 0xff00) >> 8)
#define QPNP_MIN_TIME 2000
#define QPNP_MAX_TIME 2100
struct qpnp_adc_tm_sensor {
struct thermal_zone_device *tz_dev;
enum thermal_device_mode mode;
uint32_t sensor_num;
enum <API key> timer_select;
uint32_t meas_interval;
uint32_t low_thr;
uint32_t high_thr;
uint32_t btm_channel_num;
uint32_t vadc_channel_num;
struct work_struct work;
struct <API key> *btm_param;
bool thermal_node;
bool low_thr_notify;
bool high_thr_notify;
uint32_t scale_type;
};
struct qpnp_adc_tm_drv {
struct qpnp_adc_drv *adc;
bool adc_tm_initialized;
int <API key>;
struct qpnp_adc_tm_sensor sensor[0];
};
struct qpnp_adc_tm_drv *qpnp_adc_tm;
struct <API key> {
uint16_t low_thr_lsb_addr;
uint16_t low_thr_msb_addr;
uint16_t high_thr_lsb_addr;
uint16_t high_thr_msb_addr;
u8 multi_meas_en;
u8 low_thr_int_chan_en;
u8 <API key>;
u8 meas_interval_ctl;
};
static struct <API key> adc_tm_data[] = {
[<API key>] = {QPNP_M0_LOW_THR_LSB,
QPNP_M0_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M1_LOW_THR_LSB,
QPNP_M1_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M2_LOW_THR_LSB,
QPNP_M2_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M3_LOW_THR_LSB,
QPNP_M3_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M4_LOW_THR_LSB,
QPNP_M4_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M5_LOW_THR_LSB,
QPNP_M5_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M6_LOW_THR_LSB,
QPNP_M6_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
[<API key>] = {QPNP_M7_LOW_THR_LSB,
QPNP_M7_LOW_THR_MSB, <API key>,
<API key>, <API key>,
<API key>, <API key>,
<API key>},
};
static struct <API key> adc_tm_rscale_fn[] = {
[SCALE_R_VBATT] = {<API key>},
[SCALE_RBATT_THERM] = {qpnp_adc_btm_scaler},
[SCALE_R_USB_ID] = {qpnp_adc_usb_scaler},
[SCALE_RPMIC_THERM] = {<API key>},
};
static int32_t <API key>(int16_t reg, u8 *data)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
int rc = 0;
rc = <API key>(adc_tm->adc->spmi->ctrl,
adc_tm->adc->slave, (adc_tm->adc->offset + reg), data, 1);
if (rc < 0)
pr_err("adc-tm read reg %d failed with %d\n", reg, rc);
return rc;
}
static int32_t <API key>(int16_t reg, u8 data)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
int rc = 0;
u8 *buf;
buf = &data;
rc = <API key>(adc_tm->adc->spmi->ctrl,
adc_tm->adc->slave, (adc_tm->adc->offset + reg), buf, 1);
if (rc < 0)
pr_err("adc-tm write reg %d failed with %d\n", reg, rc);
return rc;
}
static int32_t qpnp_adc_tm_enable(void)
{
int rc = 0;
u8 data = 0;
data = QPNP_ADC_TM_EN;
rc = <API key>(QPNP_EN_CTL1, data);
if (rc < 0)
pr_err("adc-tm enable failed\n");
return rc;
}
static int32_t qpnp_adc_tm_disable(void)
{
u8 data = 0;
int rc = 0;
rc = <API key>(QPNP_EN_CTL1, data);
if (rc < 0)
pr_err("adc-tm disable failed\n");
return rc;
}
static int32_t <API key>(void)
{
u8 adc_tm_meas_en = 0;
int rc = 0;
/* Check if a measurement request is still required */
rc = <API key>(<API key>,
&adc_tm_meas_en);
if (rc) {
pr_err("adc-tm-tm read status high failed with %d\n", rc);
return rc;
}
/* Enable only if there are pending measurement requests */
if (adc_tm_meas_en) {
qpnp_adc_tm_enable();
/* Request conversion */
rc = <API key>(QPNP_CONV_REQ, QPNP_CONV_REQ_SET);
if (rc < 0) {
pr_err("adc-tm request conversion failed\n");
return rc;
}
}
return rc;
}
static int32_t <API key>(void)
{
u8 status1;
int rc, count = 0;
/* The VADC_TM bank needs to be disabled for new conversion request */
rc = <API key>(QPNP_ADC_TM_STATUS1, &status1);
if (rc) {
pr_err("adc-tm read status1 failed\n");
return rc;
}
/* Disable the bank if a conversion is occuring */
while ((status1 & <API key>) && (count < 5)) {
rc = <API key>(QPNP_ADC_TM_STATUS1, &status1);
if (rc < 0)
pr_err("adc-tm disable failed\n");
/* Wait time is based on the optimum sampling rate
* and adding enough time buffer to account for ADC conversions
* occuring on different peripheral banks */
usleep_range(QPNP_MIN_TIME, QPNP_MAX_TIME);
count++;
}
return rc;
}
static int32_t <API key>(uint32_t btm_chan_num)
{
u8 rev, perph_subtype;
int rc = 0;
rc = <API key>(QPNP_REVISION3, &rev);
if (rc) {
pr_err("adc-tm revision read failed\n");
return rc;
}
rc = <API key>(QPNP_PERPH_SUBTYPE, &perph_subtype);
if (rc) {
pr_err("adc-tm perph_subtype read failed\n");
return rc;
}
if (perph_subtype == QPNP_PERPH_TYPE2) {
if ((rev < <API key>) &&
(btm_chan_num > <API key>)) {
pr_debug("Version does not support more than 5 channels\n");
return -EINVAL;
}
}
return rc;
}
static int32_t <API key>(u8 mode_ctl)
{
int rc;
mode_ctl |= (QPNP_ADC_TRIM_EN | QPNP_AMUX_TRIM_EN);
/* VADC_BTM current sets mode to recurring measurements */
rc = <API key>(QPNP_MODE_CTL, mode_ctl);
if (rc < 0)
pr_err("adc-tm write mode selection err\n");
return rc;
}
static int32_t <API key>(uint32_t btm_chan,
struct <API key> *chan_prop)
{
int rc;
u8 <API key> = 0;
/* Configure kernel clients to timer1 */
switch (chan_prop->timer_select) {
case <API key>:
rc = <API key>(<API key>,
chan_prop->meas_interval1);
if (rc < 0) {
pr_err("timer1 configure failed\n");
return rc;
}
break;
case <API key>:
/* Thermal channels uses timer2, default to 1 second */
rc = <API key>(<API key>,
&<API key>);
if (rc < 0) {
pr_err("timer2 configure read failed\n");
return rc;
}
<API key> |=
(chan_prop->meas_interval2 <<
<API key>);
rc = <API key>(<API key>,
<API key>);
if (rc < 0) {
pr_err("timer2 configure failed\n");
return rc;
}
break;
case <API key>:
rc = <API key>(<API key>,
&<API key>);
if (rc < 0) {
pr_err("timer3 read failed\n");
return rc;
}
chan_prop->meas_interval2 = <API key>;
<API key> |= chan_prop->meas_interval2;
rc = <API key>(<API key>,
<API key>);
if (rc < 0) {
pr_err("timer3 configure failed\n");
return rc;
}
break;
default:
pr_err("Invalid timer selection\n");
return -EINVAL;
}
/* Select the timer to use for the corresponding channel */
adc_tm_data[btm_chan].meas_interval_ctl = chan_prop->timer_select;
return rc;
}
static int32_t <API key>(uint16_t addr,
u8 mask, bool state)
{
u8 reg_value = 0;
int rc = 0;
rc = <API key>(addr, ®_value);
if (rc < 0) {
pr_err("read failed for addr:0x%x\n", addr);
return rc;
}
reg_value = reg_value & ~mask;
if (state)
reg_value |= mask;
pr_debug("state:%d, reg:0x%x with bits:0x%x and mask:0x%x\n",
state, addr, reg_value, ~mask);
rc = <API key>(addr, reg_value);
if (rc < 0) {
pr_err("write failed for addr:%x\n", addr);
return rc;
}
return rc;
}
static int32_t <API key>(uint32_t btm_chan,
struct <API key> *chan_prop)
{
int rc = 0;
rc = <API key>(
adc_tm_data[btm_chan].low_thr_lsb_addr,
<API key>(chan_prop->low_thr));
if (rc < 0) {
pr_err("low threshold lsb setting failed\n");
return rc;
}
rc = <API key>(
adc_tm_data[btm_chan].low_thr_msb_addr,
<API key>(chan_prop->low_thr));
if (rc < 0) {
pr_err("low threshold msb setting failed\n");
return rc;
}
rc = <API key>(
adc_tm_data[btm_chan].high_thr_lsb_addr,
<API key>(chan_prop->high_thr));
if (rc < 0) {
pr_err("high threshold lsb setting failed\n");
return rc;
}
rc = <API key>(
adc_tm_data[btm_chan].high_thr_msb_addr,
<API key>(chan_prop->high_thr));
if (rc < 0)
pr_err("high threshold msb setting failed\n");
pr_debug("client requested low:%d and high:%d\n",
chan_prop->low_thr, chan_prop->high_thr);
return rc;
}
static int32_t <API key>(uint32_t btm_chan,
struct <API key> *chan_prop,
uint32_t amux_channel)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
int rc = 0, i = 0, chan_idx = 0;
bool chan_found = false;
u8 sensor_mask = 0;
while (i < adc_tm-><API key>) {
if (adc_tm->sensor[i].btm_channel_num == btm_chan) {
chan_idx = i;
chan_found = true;
i++;
} else
i++;
}
if (!chan_found) {
pr_err("Channel not found\n");
return -EINVAL;
}
sensor_mask = 1 << chan_idx;
if (!adc_tm->sensor[chan_idx].thermal_node) {
/* Update low and high notification thresholds */
rc = <API key>(btm_chan,
chan_prop);
if (rc < 0) {
pr_err("setting chan:%d threshold failed\n", btm_chan);
return rc;
}
if ((chan_prop->state_request ==
<API key>) ||
(chan_prop->state_request ==
<API key>)) {
pr_debug("low sensor mask:%x with state:%d\n",
sensor_mask, chan_prop->state_request);
/* Enable low threshold's interrupt */
rc = <API key>(
<API key>, sensor_mask, true);
if (rc < 0) {
pr_err("low thr enable err:%d\n", btm_chan);
return rc;
}
}
if ((chan_prop->state_request ==
<API key>) ||
(chan_prop->state_request ==
<API key>)) {
/* Enable high threshold's interrupt */
pr_debug("high sensor mask:%x\n", sensor_mask);
rc = <API key>(
<API key>, sensor_mask, true);
if (rc < 0) {
pr_err("high thr enable err:%d\n", btm_chan);
return rc;
}
}
}
/* Enable corresponding BTM channel measurement */
rc = <API key>(
<API key>, sensor_mask, true);
if (rc < 0) {
pr_err("multi measurement en failed\n");
return rc;
}
return rc;
}
static int32_t <API key>(
struct <API key> *chan_prop)
{
u8 decimation = 0, op_cntrl = 0;
int rc = 0;
uint32_t btm_chan = 0;
/* Disable bank */
rc = qpnp_adc_tm_disable();
if (rc)
return rc;
/* Check if a conversion is in progress */
rc = <API key>();
if (rc < 0) {
pr_err("adc-tm req_sts check failed\n");
return rc;
}
/* Set measurement in recurring mode */
rc = <API key>(chan_prop->mode_sel);
if (rc < 0) {
pr_err("adc-tm mode select failed\n");
return rc;
}
/* Configure AMUX channel select for the corresponding BTM channel*/
btm_chan = chan_prop->chan_prop->tm_channel_select;
rc = <API key>(btm_chan, chan_prop->amux_channel);
if (rc < 0) {
pr_err("adc-tm channel selection err\n");
return rc;
}
/* Digital paramater setup */
decimation |= chan_prop->decimation <<
<API key>;
rc = <API key>(QPNP_ADC_DIG_PARAM, decimation);
if (rc < 0) {
pr_err("adc-tm digital parameter setup err\n");
return rc;
}
/* Hardware setting time */
rc = <API key>(<API key>,
chan_prop->hw_settle_time);
if (rc < 0) {
pr_err("adc-tm hw settling time setup err\n");
return rc;
}
/* Fast averaging setup */
rc = <API key>(QPNP_FAST_AVG_CTL,
chan_prop->fast_avg_setup);
if (rc < 0) {
pr_err("adc-tm fast-avg setup err\n");
return rc;
}
/* Measurement interval setup */
rc = <API key>(btm_chan,
chan_prop->chan_prop);
if (rc < 0) {
pr_err("adc-tm timer select failed\n");
return rc;
}
/* Channel configuration setup */
rc = <API key>(btm_chan, chan_prop->chan_prop,
chan_prop->amux_channel);
if (rc < 0) {
pr_err("adc-tm channel configure failed\n");
return rc;
}
/* Recurring interval measurement enable */
rc = <API key>(<API key>, &op_cntrl);
op_cntrl |= <API key>;
rc = <API key>(<API key>,
op_cntrl, true);
if (rc < 0) {
pr_err("adc-tm meas interval op configure failed\n");
return rc;
}
/* Enable bank */
rc = qpnp_adc_tm_enable();
if (rc)
return rc;
/* Request conversion */
rc = <API key>(QPNP_CONV_REQ, QPNP_CONV_REQ_SET);
if (rc < 0) {
pr_err("adc-tm request conversion failed\n");
return rc;
}
return 0;
}
static int <API key>(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
{
struct qpnp_adc_tm_sensor *adc_tm_sensor = thermal->devdata;
if (!adc_tm_sensor || <API key>(
adc_tm_sensor->btm_channel_num) || !mode)
return -EINVAL;
*mode = adc_tm_sensor->mode;
return 0;
}
static int <API key>(struct thermal_zone_device *thermal,
enum thermal_device_mode mode)
{
struct qpnp_adc_tm_sensor *adc_tm = thermal->devdata;
struct qpnp_adc_tm_drv *adc_drv = qpnp_adc_tm;
int rc = 0, channel;
u8 sensor_mask = 0;
if (!adc_tm || <API key>(adc_tm->btm_channel_num))
return -EINVAL;
if (mode == <API key>) {
adc_drv->adc->amux_prop->amux_channel =
adc_tm->vadc_channel_num;
channel = adc_tm->sensor_num;
adc_drv->adc->amux_prop->decimation =
adc_drv->adc->adc_channels[channel].adc_decimation;
adc_drv->adc->amux_prop->hw_settle_time =
adc_drv->adc->adc_channels[channel].hw_settle_time;
adc_drv->adc->amux_prop->fast_avg_setup =
adc_drv->adc->adc_channels[channel].fast_avg_setup;
adc_drv->adc->amux_prop->mode_sel =
<API key> << QPNP_OP_MODE_SHIFT;
adc_drv->adc->amux_prop->chan_prop->timer_select =
<API key>;
adc_drv->adc->amux_prop->chan_prop->meas_interval1 =
<API key>;
adc_drv->adc->amux_prop->chan_prop->low_thr = adc_tm->low_thr;
adc_drv->adc->amux_prop->chan_prop->high_thr = adc_tm->high_thr;
adc_drv->adc->amux_prop->chan_prop->tm_channel_select =
adc_tm->btm_channel_num;
rc = <API key>(adc_drv->adc->amux_prop);
if (rc) {
pr_err("adc-tm tm configure failed with %d\n", rc);
return -EINVAL;
}
} else if (mode == <API key>) {
sensor_mask = 1 << adc_tm->sensor_num;
/* Disable bank */
rc = qpnp_adc_tm_disable();
if (rc < 0) {
pr_err("adc-tm disable failed\n");
return rc;
}
/* Check if a conversion is in progress */
rc = <API key>();
if (rc < 0) {
pr_err("adc-tm req_sts check failed\n");
return rc;
}
rc = <API key>(<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("multi measurement update failed\n");
return rc;
}
rc = <API key>();
if (rc < 0) {
pr_err("re-enabling measurement failed\n");
return rc;
}
}
adc_tm->mode = mode;
return 0;
}
static int <API key>(struct thermal_zone_device *thermal,
int trip, enum thermal_trip_type *type)
{
struct qpnp_adc_tm_sensor *adc_tm = thermal->devdata;
if (!adc_tm || <API key>(adc_tm->btm_channel_num)
|| !type || type < 0)
return -EINVAL;
switch (trip) {
case <API key>:
*type = <API key>;
break;
case <API key>:
*type = <API key>;
break;
default:
return -EINVAL;
}
return 0;
}
static int <API key>(struct thermal_zone_device *thermal,
int trip, unsigned long *temp)
{
struct qpnp_adc_tm_sensor *adc_tm_sensor = thermal->devdata;
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
int64_t result = 0;
u8 trip_cool_thr0, trip_cool_thr1, trip_warm_thr0, trip_warm_thr1;
unsigned int reg, rc = 0, btm_channel_num;
uint16_t reg_low_thr_lsb, reg_low_thr_msb;
uint16_t reg_high_thr_lsb, reg_high_thr_msb;
if (!adc_tm || <API key>(
adc_tm_sensor->btm_channel_num))
return -EINVAL;
btm_channel_num = adc_tm_sensor->btm_channel_num;
reg_low_thr_lsb = adc_tm_data[btm_channel_num].low_thr_lsb_addr;
reg_low_thr_msb = adc_tm_data[btm_channel_num].low_thr_msb_addr;
reg_high_thr_lsb = adc_tm_data[btm_channel_num].high_thr_lsb_addr;
reg_high_thr_msb = adc_tm_data[btm_channel_num].high_thr_msb_addr;
switch (trip) {
case <API key>:
rc = <API key>(reg_low_thr_lsb, &trip_warm_thr0);
if (rc) {
pr_err("adc-tm low_thr_lsb err\n");
return rc;
}
rc = <API key>(reg_low_thr_msb, &trip_warm_thr1);
if (rc) {
pr_err("adc-tm low_thr_msb err\n");
return rc;
}
reg = (trip_warm_thr1 << 8) | trip_warm_thr0;
break;
case <API key>:
rc = <API key>(reg_high_thr_lsb, &trip_cool_thr0);
if (rc) {
pr_err("adc-tm_tm high_thr_lsb err\n");
return rc;
}
rc = <API key>(reg_high_thr_msb, &trip_cool_thr1);
if (rc) {
pr_err("adc-tm_tm high_thr_lsb err\n");
return rc;
}
reg = (trip_cool_thr1 << 8) | trip_cool_thr0;
break;
default:
return -EINVAL;
}
rc = <API key>(reg, &result);
if (rc < 0) {
pr_err("Failed to lookup the therm thresholds\n");
return rc;
}
*temp = result;
return 0;
}
static int <API key>(struct thermal_zone_device *thermal,
int trip, long temp)
{
struct qpnp_adc_tm_sensor *adc_tm_sensor = thermal->devdata;
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
struct qpnp_adc_tm_config tm_config;
u8 trip_cool_thr0, trip_cool_thr1, trip_warm_thr0, trip_warm_thr1;
uint16_t reg_low_thr_lsb, reg_low_thr_msb;
uint16_t reg_high_thr_lsb, reg_high_thr_msb;
int rc = 0, btm_channel_num;
if (!adc_tm || <API key>(
adc_tm_sensor->btm_channel_num))
return -EINVAL;
tm_config.channel = adc_tm_sensor->vadc_channel_num;
switch (trip) {
case <API key>:
tm_config.high_thr_temp = temp;
break;
case <API key>:
tm_config.low_thr_temp = temp;
break;
default:
return -EINVAL;
}
pr_debug("requested a high - %d and low - %d with trip - %d\n",
tm_config.high_thr_temp, tm_config.low_thr_temp, trip);
rc = <API key>(&tm_config);
if (rc < 0) {
pr_err("Failed to lookup the adc-tm thresholds\n");
return rc;
}
trip_warm_thr0 = ((tm_config.low_thr_voltage << 24) >> 24);
trip_warm_thr1 = ((tm_config.low_thr_voltage << 16) >> 24);
trip_cool_thr0 = ((tm_config.high_thr_voltage << 24) >> 24);
trip_cool_thr1 = ((tm_config.high_thr_voltage << 16) >> 24);
btm_channel_num = adc_tm_sensor->btm_channel_num;
reg_low_thr_lsb = adc_tm_data[btm_channel_num].low_thr_lsb_addr;
reg_low_thr_msb = adc_tm_data[btm_channel_num].low_thr_msb_addr;
reg_high_thr_lsb = adc_tm_data[btm_channel_num].high_thr_lsb_addr;
reg_high_thr_msb = adc_tm_data[btm_channel_num].high_thr_msb_addr;
switch (trip) {
case <API key>:
rc = <API key>(reg_low_thr_lsb, trip_cool_thr0);
if (rc) {
pr_err("adc-tm_tm read threshold err\n");
return rc;
}
rc = <API key>(reg_low_thr_msb, trip_cool_thr1);
if (rc) {
pr_err("adc-tm_tm read threshold err\n");
return rc;
}
adc_tm_sensor->low_thr = tm_config.high_thr_voltage;
break;
case <API key>:
rc = <API key>(reg_high_thr_lsb, trip_warm_thr0);
if (rc) {
pr_err("adc-tm_tm read threshold err\n");
return rc;
}
rc = <API key>(reg_high_thr_msb, trip_warm_thr1);
if (rc) {
pr_err("adc-tm_tm read threshold err\n");
return rc;
}
adc_tm_sensor->high_thr = tm_config.low_thr_voltage;
break;
default:
return -EINVAL;
}
return 0;
}
static void <API key>(struct qpnp_adc_tm_sensor *adc_tm)
{
/* Battery therm's warm temperature translates to low voltage */
if (adc_tm->low_thr_notify) {
/* HIGH_STATE = WARM_TEMP for battery client */
adc_tm->btm_param-><API key>(
ADC_TM_WARM_STATE, adc_tm->btm_param->btm_ctx);
adc_tm->low_thr_notify = false;
}
/* Battery therm's cool temperature translates to high voltage */
if (adc_tm->high_thr_notify) {
/* LOW_STATE = COOL_TEMP for battery client */
adc_tm->btm_param-><API key>(
ADC_TM_COOL_STATE, adc_tm->btm_param->btm_ctx);
adc_tm->high_thr_notify = false;
}
return;
}
static void notify_clients(struct qpnp_adc_tm_sensor *adc_tm)
{
/* For non batt therm clients */
if (adc_tm->low_thr_notify) {
pr_debug("notify kernel with low state\n");
adc_tm->btm_param-><API key>(
ADC_TM_LOW_STATE, adc_tm->btm_param->btm_ctx);
adc_tm->low_thr_notify = false;
}
if (adc_tm->high_thr_notify) {
pr_debug("notify kernel with high state\n");
adc_tm->btm_param-><API key>(
ADC_TM_HIGH_STATE, adc_tm->btm_param->btm_ctx);
adc_tm->high_thr_notify = false;
}
return;
}
static void notify_adc_tm_fn(struct work_struct *work)
{
struct qpnp_adc_tm_sensor *adc_tm = container_of(work,
struct qpnp_adc_tm_sensor, work);
if (adc_tm->thermal_node) {
sysfs_notify(&adc_tm->tz_dev->device.kobj,
NULL, "btm");
pr_debug("notifying uspace client\n");
} else {
if (adc_tm->btm_param-><API key> != NULL) {
if (adc_tm->scale_type == SCALE_RBATT_THERM)
<API key>(adc_tm);
else
notify_clients(adc_tm);
}
}
return;
}
static int <API key>(struct thermal_zone_device *thermal,
int trip, enum <API key> mode)
{
struct qpnp_adc_tm_sensor *adc_tm = thermal->devdata;
int rc = 0, sensor_mask = 0;
u8 thr_int_en = 0;
bool state = false;
if (!adc_tm || <API key>(adc_tm->btm_channel_num))
return -EINVAL;
if (mode == <API key>)
state = true;
sensor_mask = 1 << adc_tm->sensor_num;
pr_debug("Sensor number:%x with state:%d\n", adc_tm->sensor_num, state);
switch (trip) {
case <API key>:
/* low_thr (lower voltage) for higher temp */
thr_int_en = adc_tm_data[adc_tm->btm_channel_num].
low_thr_int_chan_en;
rc = <API key>(<API key>,
sensor_mask, state);
if (rc)
pr_err("channel:%x failed\n", adc_tm->btm_channel_num);
break;
case <API key>:
/* high_thr (higher voltage) for cooler temp */
thr_int_en = adc_tm_data[adc_tm->btm_channel_num].
<API key>;
rc = <API key>(<API key>,
sensor_mask, state);
if (rc)
pr_err("channel:%x failed\n", adc_tm->btm_channel_num);
break;
default:
return -EINVAL;
}
return rc;
}
static int <API key>(void)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
u8 status_low = 0, status_high = 0, qpnp_adc_tm_meas_en = 0;
u8 adc_tm_low_enable = 0, adc_tm_high_enable = 0;
u8 sensor_mask = 0;
int rc = 0, sensor_notify_num = 0, i = 0, sensor_num = 0, btm_chan_num;
if (!adc_tm || !adc_tm->adc_tm_initialized)
return -ENODEV;
mutex_lock(&adc_tm->adc->adc_lock);
rc = <API key>();
if (rc) {
pr_err("adc-tm-tm req sts check failed with %d\n", rc);
goto fail;
}
rc = <API key>(<API key>, &status_low);
if (rc) {
pr_err("adc-tm-tm read status low failed with %d\n", rc);
goto fail;
}
rc = <API key>(<API key>, &status_high);
if (rc) {
pr_err("adc-tm-tm read status high failed with %d\n", rc);
goto fail;
}
/* Check which interrupt threshold is lower and measure against the
* enabled channel */
rc = <API key>(<API key>,
&qpnp_adc_tm_meas_en);
if (rc) {
pr_err("adc-tm-tm read status high failed with %d\n", rc);
goto fail;
}
adc_tm_low_enable = qpnp_adc_tm_meas_en & status_low;
adc_tm_high_enable = qpnp_adc_tm_meas_en & status_high;
if (adc_tm_high_enable) {
sensor_notify_num = adc_tm_high_enable;
while (i < adc_tm-><API key>) {
if ((sensor_notify_num & 0x1) == 1)
sensor_num = i;
sensor_notify_num >>= 1;
i++;
}
btm_chan_num = adc_tm->sensor[sensor_num].btm_channel_num;
pr_info("high:sen:%d, hs:0x%x, ls:0x%x, meas_en:0x%x\n",
sensor_num, adc_tm_high_enable, adc_tm_low_enable,
qpnp_adc_tm_meas_en);
if (!adc_tm->sensor[sensor_num].thermal_node) {
/* For non thermal registered clients
such as usb_id, vbatt, pmic_therm */
sensor_mask = 1 << sensor_num;
pr_debug("non thermal node - mask:%x\n", sensor_mask);
rc = <API key>(
<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("high threshold int read failed\n");
goto fail;
}
adc_tm->sensor[sensor_num].high_thr_notify = true;
} else {
/* Uses the thermal sysfs registered device to disable
the corresponding high voltage threshold which
is triggered by low temp */
pr_debug("thermal node with mask:%x\n", sensor_mask);
rc = <API key>(
adc_tm->sensor[sensor_num].tz_dev,
<API key>,
<API key>);
if (rc < 0) {
pr_err("notify error:%d\n", sensor_num);
goto fail;
}
}
}
if (adc_tm_low_enable) {
sensor_notify_num = adc_tm_low_enable;
i = 0;
while (i < adc_tm-><API key>) {
if ((sensor_notify_num & 0x1) == 1)
sensor_num = i;
sensor_notify_num >>= 1;
i++;
}
btm_chan_num = adc_tm->sensor[sensor_num].btm_channel_num;
pr_info("low:sen:%d, hs:0x%x, ls:0x%x, meas_en:0x%x\n",
sensor_num, adc_tm_high_enable, adc_tm_low_enable,
qpnp_adc_tm_meas_en);
if (!adc_tm->sensor[sensor_num].thermal_node) {
/* For non thermal registered clients
such as usb_id, vbatt, pmic_therm */
pr_debug("non thermal node - mask:%x\n", sensor_mask);
sensor_mask = 1 << sensor_num;
rc = <API key>(
<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("low threshold int read failed\n");
goto fail;
}
adc_tm->sensor[sensor_num].low_thr_notify = true;
} else {
/* Uses the thermal sysfs registered device to disable
the corresponding low voltage threshold which
is triggered by high temp */
pr_debug("thermal node with mask:%x\n", sensor_mask);
rc = <API key>(
adc_tm->sensor[sensor_num].tz_dev,
<API key>,
<API key>);
if (rc < 0) {
pr_err("notify error:%d\n", sensor_num);
goto fail;
}
}
}
if (adc_tm_high_enable || adc_tm_low_enable) {
rc = <API key>(<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("multi meas disable for channel failed\n");
goto fail;
}
rc = <API key>();
if (rc < 0) {
pr_err("re-enabling measurement failed\n");
return rc;
}
} else
pr_debug("No threshold status enable %d for high/low??\n",
sensor_mask);
fail:
mutex_unlock(&adc_tm->adc->adc_lock);
if (adc_tm_high_enable || adc_tm_low_enable)
schedule_work(&adc_tm->sensor[sensor_num].work);
return rc;
}
static void <API key>(struct work_struct *work)
{
int rc;
rc = <API key>();
if (rc < 0)
pr_err("adc-tm high thr work failed\n");
return;
}
DECLARE_WORK(<API key>,
<API key>);
static irqreturn_t <API key>(int irq, void *data)
{
qpnp_adc_tm_disable();
schedule_work(&<API key>);
return IRQ_HANDLED;
}
static void <API key>(struct work_struct *work)
{
int rc;
rc = <API key>();
if (rc < 0)
pr_err("adc-tm low thr work failed\n");
return;
}
DECLARE_WORK(<API key>, <API key>);
static irqreturn_t <API key>(int irq, void *data)
{
qpnp_adc_tm_disable();
schedule_work(&<API key>);
return IRQ_HANDLED;
}
static irqreturn_t qpnp_adc_tm_isr(int irq, void *dev_id)
{
struct qpnp_adc_tm_drv *adc_tm = dev_id;
complete(&adc_tm->adc->adc_rslt_completion);
return IRQ_HANDLED;
}
static int qpnp_adc_read_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
struct qpnp_adc_tm_sensor *adc_tm_sensor = thermal->devdata;
struct qpnp_vadc_result result;
int rc = 0;
rc = qpnp_vadc_read(adc_tm_sensor->vadc_channel_num, &result);
if (rc)
return rc;
#ifdef <API key>
if (acer_board_id == HW_ID_DVT4) {
if (!strcmp(thermal->type, "pa_therm0") ||
!strcmp(thermal->type, "pa_therm1")) {
if (result.physical > 85)
result.physical = 40;
}
}
#endif
*temp = result.physical;
return rc;
}
static struct <API key> <API key> = {
.get_temp = qpnp_adc_read_temp,
.get_mode = <API key>,
.set_mode = <API key>,
.get_trip_type = <API key>,
.activate_trip_type = <API key>,
.get_trip_temp = <API key>,
.set_trip_temp = <API key>,
};
int32_t <API key>(struct <API key> *param)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
uint32_t channel, dt_index = 0, scale_type = 0;
int rc = 0, i = 0;
bool chan_found = false;
if (!adc_tm || !adc_tm->adc_tm_initialized)
return -ENODEV;
if (param-><API key> == NULL) {
pr_err("No notification for high/low temp??\n");
return -EINVAL;
}
mutex_lock(&adc_tm->adc->adc_lock);
channel = param->channel;
while (i < adc_tm-><API key>) {
if (adc_tm->adc->adc_channels[i].channel_num ==
channel) {
dt_index = i;
chan_found = true;
i++;
} else
i++;
}
if (!chan_found) {
pr_err("not a valid ADC_TM channel\n");
rc = -EINVAL;
goto fail_unlock;
}
rc = <API key>(
adc_tm->sensor[dt_index].btm_channel_num);
if (rc < 0)
goto fail_unlock;
scale_type = adc_tm->adc->adc_channels[dt_index].adc_scale_fn;
if (scale_type >= SCALE_RSCALE_NONE) {
rc = -EBADF;
goto fail_unlock;
}
pr_debug("channel:%d, scale_type:%d, dt_idx:%d",
channel, scale_type, dt_index);
adc_tm->adc->amux_prop->amux_channel = channel;
adc_tm->adc->amux_prop->decimation =
adc_tm->adc->adc_channels[dt_index].adc_decimation;
adc_tm->adc->amux_prop->hw_settle_time =
adc_tm->adc->adc_channels[dt_index].hw_settle_time;
adc_tm->adc->amux_prop->fast_avg_setup =
adc_tm->adc->adc_channels[dt_index].fast_avg_setup;
adc_tm->adc->amux_prop->mode_sel =
<API key> << QPNP_OP_MODE_SHIFT;
adc_tm->adc->amux_prop->chan_prop->meas_interval1 =
<API key>;
adc_tm_rscale_fn[scale_type].chan(param,
&adc_tm->adc->amux_prop->chan_prop->low_thr,
&adc_tm->adc->amux_prop->chan_prop->high_thr);
adc_tm->adc->amux_prop->chan_prop->tm_channel_select =
adc_tm->sensor[dt_index].btm_channel_num;
adc_tm->adc->amux_prop->chan_prop->timer_select =
<API key>;
adc_tm->adc->amux_prop->chan_prop->state_request =
param->state_request;
rc = <API key>(adc_tm->adc->amux_prop);
if (rc) {
pr_err("adc-tm configure failed with %d\n", rc);
goto fail_unlock;
}
adc_tm->sensor[dt_index].btm_param = param;
adc_tm->sensor[dt_index].scale_type = scale_type;
fail_unlock:
mutex_unlock(&adc_tm->adc->adc_lock);
return rc;
}
EXPORT_SYMBOL(<API key>);
int32_t <API key>(struct <API key> *param)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
uint32_t channel, dt_index = 0, btm_chan_num;
u8 sensor_mask = 0;
int rc = 0;
if (!adc_tm || !adc_tm->adc_tm_initialized)
return -ENODEV;
mutex_lock(&adc_tm->adc->adc_lock);
/* Disable bank */
rc = qpnp_adc_tm_disable();
if (rc < 0) {
pr_err("adc-tm disable failed\n");
goto fail;
}
/* Check if a conversion is in progress */
rc = <API key>();
if (rc < 0) {
pr_err("adc-tm req_sts check failed\n");
goto fail;
}
channel = param->channel;
while ((adc_tm->adc->adc_channels[dt_index].channel_num
!= channel) && (dt_index < adc_tm-><API key>))
dt_index++;
if (dt_index >= adc_tm-><API key>) {
pr_err("not a valid ADC_TMN channel\n");
rc = -EINVAL;
goto fail;
}
btm_chan_num = adc_tm->sensor[dt_index].btm_channel_num;
sensor_mask = 1 << adc_tm->sensor[dt_index].sensor_num;
rc = <API key>(<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("low threshold int write failed\n");
goto fail;
}
rc = <API key>(<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("high threshold int enable failed\n");
goto fail;
}
rc = <API key>(<API key>,
sensor_mask, false);
if (rc < 0) {
pr_err("multi measurement en failed\n");
goto fail;
}
rc = <API key>();
if (rc < 0)
pr_err("re-enabling measurement failed\n");
fail:
mutex_unlock(&adc_tm->adc->adc_lock);
return rc;
}
EXPORT_SYMBOL(<API key>);
int32_t <API key>(struct <API key> *param)
{
param->channel = <API key>;
return <API key>(param);
}
EXPORT_SYMBOL(<API key>);
int32_t <API key>(void)
{
struct <API key> param;
return <API key>(¶m);
}
EXPORT_SYMBOL(<API key>);
int32_t <API key>(void)
{
struct qpnp_adc_tm_drv *adc_tm = qpnp_adc_tm;
if (!adc_tm || !adc_tm->adc_tm_initialized)
return -EPROBE_DEFER;
else
return 0;
}
EXPORT_SYMBOL(<API key>);
static int __devinit qpnp_adc_tm_probe(struct spmi_device *spmi)
{
struct device_node *node = spmi->dev.of_node, *child;
struct qpnp_adc_tm_drv *adc_tm;
struct qpnp_adc_drv *adc_qpnp;
int32_t <API key> = 0, rc, sen_idx = 0;
u8 thr_init = 0;
if (!node)
return -EINVAL;
if (qpnp_adc_tm) {
pr_err("adc-tm already in use\n");
return -EBUSY;
}
<API key>(node, child)
<API key>++;
if (!<API key>) {
pr_err("No channel listing\n");
return -EINVAL;
}
adc_tm = devm_kzalloc(&spmi->dev, sizeof(struct qpnp_adc_tm_drv) +
(<API key> *
sizeof(struct qpnp_adc_tm_sensor)),
GFP_KERNEL);
if (!adc_tm) {
dev_err(&spmi->dev, "Unable to allocate memory\n");
return -ENOMEM;
}
qpnp_adc_tm = adc_tm;
adc_qpnp = devm_kzalloc(&spmi->dev, sizeof(struct qpnp_adc_drv),
GFP_KERNEL);
if (!adc_qpnp) {
dev_err(&spmi->dev, "Unable to allocate memory\n");
rc = -ENOMEM;
goto fail;
}
adc_tm->adc = adc_qpnp;
rc = <API key>(spmi, adc_tm->adc);
if (rc) {
dev_err(&spmi->dev, "failed to read device tree\n");
goto fail;
}
mutex_init(&adc_tm->adc->adc_lock);
/* Register the ADC peripheral interrupt */
adc_tm->adc->adc_high_thr_irq = spmi_get_irq_byname(spmi,
NULL, "high-thr-en-set");
if (adc_tm->adc->adc_high_thr_irq < 0) {
pr_err("Invalid irq\n");
rc = -ENXIO;
goto fail;
}
adc_tm->adc->adc_low_thr_irq = spmi_get_irq_byname(spmi,
NULL, "low-thr-en-set");
if (adc_tm->adc->adc_low_thr_irq < 0) {
pr_err("Invalid irq\n");
rc = -ENXIO;
goto fail;
}
rc = devm_request_irq(&spmi->dev, adc_tm->adc->adc_irq_eoc,
qpnp_adc_tm_isr, IRQF_TRIGGER_RISING,
"<API key>", adc_tm);
if (rc) {
dev_err(&spmi->dev,
"failed to request adc irq with error %d\n", rc);
goto fail;
} else {
enable_irq_wake(adc_tm->adc->adc_irq_eoc);
}
rc = devm_request_irq(&spmi->dev, adc_tm->adc->adc_high_thr_irq,
<API key>,
IRQF_TRIGGER_RISING, "<API key>", adc_tm);
if (rc) {
dev_err(&spmi->dev, "failed to request adc irq\n");
goto fail;
} else {
enable_irq_wake(adc_tm->adc->adc_high_thr_irq);
}
rc = devm_request_irq(&spmi->dev, adc_tm->adc->adc_low_thr_irq,
<API key>,
IRQF_TRIGGER_RISING, "<API key>", adc_tm);
if (rc) {
dev_err(&spmi->dev, "failed to request adc irq\n");
goto fail;
} else {
enable_irq_wake(adc_tm->adc->adc_low_thr_irq);
}
<API key>(node, child) {
char name[25];
int btm_channel_num;
bool thermal_node = false;
rc = <API key>(child,
"qcom,btm-channel-number", &btm_channel_num);
if (rc) {
pr_err("Invalid btm channel number\n");
goto fail;
}
adc_tm->sensor[sen_idx].btm_channel_num = btm_channel_num;
adc_tm->sensor[sen_idx].vadc_channel_num =
adc_tm->adc->adc_channels[sen_idx].channel_num;
adc_tm->sensor[sen_idx].sensor_num = sen_idx;
pr_debug("btm_chan:%x, vadc_chan:%x\n", btm_channel_num,
adc_tm->adc->adc_channels[sen_idx].channel_num);
thermal_node = <API key>(child,
"qcom,thermal-node");
if (thermal_node) {
/* Register with the thermal zone */
pr_debug("thermal node%x\n", btm_channel_num);
adc_tm->sensor[sen_idx].mode = <API key>;
adc_tm->sensor[sen_idx].thermal_node = true;
snprintf(name, sizeof(name),
adc_tm->adc->adc_channels[sen_idx].name);
adc_tm->sensor[sen_idx].meas_interval =
<API key>;
adc_tm->sensor[sen_idx].low_thr =
<API key>;
adc_tm->sensor[sen_idx].high_thr =
<API key>;
adc_tm->sensor[sen_idx].tz_dev =
<API key>(name,
ADC_TM_TRIP_NUM,
&adc_tm->sensor[sen_idx],
&<API key>, 0, 0, 0, 0);
if (IS_ERR(adc_tm->sensor[sen_idx].tz_dev))
pr_err("thermal device register failed.\n");
}
INIT_WORK(&adc_tm->sensor[sen_idx].work, notify_adc_tm_fn);
sen_idx++;
}
adc_tm-><API key> = <API key>;
dev_set_drvdata(&spmi->dev, adc_tm);
rc = <API key>(<API key>, thr_init);
if (rc < 0) {
pr_err("high thr init failed\n");
goto fail;
}
rc = <API key>(<API key>, thr_init);
if (rc < 0) {
pr_err("low thr init failed\n");
goto fail;
}
rc = <API key>(<API key>, thr_init);
if (rc < 0) {
pr_err("multi meas en failed\n");
goto fail;
}
adc_tm->adc_tm_initialized = true;
pr_debug("OK\n");
return 0;
fail:
qpnp_adc_tm = NULL;
return rc;
}
static int __devexit qpnp_adc_tm_remove(struct spmi_device *spmi)
{
struct qpnp_adc_tm_drv *adc_tm = dev_get_drvdata(&spmi->dev);
struct device_node *node = spmi->dev.of_node;
struct device_node *child;
int i = 0;
<API key>(node, child) {
<API key>(adc_tm->sensor[i].tz_dev);
i++;
}
adc_tm->adc_tm_initialized = false;
dev_set_drvdata(&spmi->dev, NULL);
return 0;
}
static const struct of_device_id <API key>[] = {
{ .compatible = "qcom,qpnp-adc-tm" },
{}
};
static struct spmi_driver qpnp_adc_tm_driver = {
.driver = {
.name = "qcom,qpnp-adc-tm",
.of_match_table = <API key>,
},
.probe = qpnp_adc_tm_probe,
.remove = qpnp_adc_tm_remove,
};
static int __init qpnp_adc_tm_init(void)
{
return <API key>(&qpnp_adc_tm_driver);
}
module_init(qpnp_adc_tm_init);
static void __exit qpnp_adc_tm_exit(void)
{
<API key>(&qpnp_adc_tm_driver);
}
module_exit(qpnp_adc_tm_exit);
MODULE_DESCRIPTION("QPNP PMIC ADC Threshold Monitoring driver");
MODULE_LICENSE("GPL v2"); |
<?php
class <API key> {
public static function setAvatarKey() {
global $wgAvatarKey;
$wgAvatarKey = wfGetDB( DB_SLAVE )->getDBname();
}
} |
<?php
/* PHP-NUKE: Advanced Content Management System */
/* Dato: 6. september 2002 */
/* Denne sprog-fil er blevet oversat til dansk fra engelsk af: */
/* Navn: Christian Botved Poulsen */
/* E-mail: Christian_B_P@Get2net.dk */
/* ICQ: 155265588 */
define("_SEND","Send");
define("_URL","Internetadresse");
define("_PRINTER","Printervenlig side");
define("_FRIEND","Send denne nyhed til en ven");
define("_YOURNAME","Dit navn");
define("_OK","Ok!");
define("_RELATED","Relaterede links");
define("_MOREABOUT","Mere om");
define("_NEWSBY","Artikler af");
define("_MOSTREAD","Mest læste artikel om");
define("_READMORE","Læs mere...");
define("_BYTESMORE","bytes mere");
define("_COMMENTSQ","kommentér?");
define("_COMMENT","kommentar");
define("_CONFIGURE","Indstillinger");
define("_LOGINCREATE","Log ind / Bliv bruger");
define("_THRESHOLD","Laveste score");
define("_NOCOMMENTS","Ingen kommentarer");
define("_NESTED","Indrykket");
define("_FLAT","I rækkefølge");
define("_THREAD","Trådet");
define("_OLDEST","Ældste først");
define("_NEWEST","Nyeste først");
define("_HIGHEST","Højeste score først");
define("_COMMENTSWARNING","Alle kommentarer tilhører indsenderen. Vi er ikke ansvarlige for indholdet og kan ikke tages som udtryk for vores synspunkter.");
define("_SCORE","Hits:");
define("_USERINFO","Brugerinfo");
define("_READREST","Læs resten af denne kommentar...");
define("_REPLY","Svar til denne");
define("_REPLYMAIN","Send kommentar");
define("_NOSUBJECT","Intet emne");
define("_NOANONCOMMENTS","Anonyme kan ikke skrive kommentarer. Vær venlig at <a href=\"modules.php?name=Your_Account&op=new_user\">oprette</a> dig som bruger.");
define("_PARENT","Forrige");
define("_ROOT","Rod");
define("_UCOMMENT","Kommentar");
define("_ALLOWEDHTML","Tilladte HTML-koder:");
define("_POSTANON","Anonymt indlæg");
define("_EXTRANS","Extrans (html-koder i teksten)");
define("_HTMLFORMATED","HTML-formateret");
define("_PLAINTEXT","Almindelig tekstformat");
define("_ONN",", som skriver...");
define("_SUBJECT","Emne");
define("_COMMENTREPLY","Send kommentar");
define("_COMREPLYPRE","Gennemse din kommentar");
define("_NOTRIGHT","Der er problemer med at analysere variablen i denne funktion. Denne besked er blot for at forhindre tingene i at blive forkludrede.");
define("_SENDAMSG","Send en besked");
define("_YOUSENDSTORY","Du ønsker at sende denne artikel");
define("_TOAFRIEND","til en ven:");
define("_FYOURNAME","Dit navn:");
define("_FYOUREMAIL","Din e-mailadresse:");
define("_FFRIENDNAME","Din vens navn:");
define("_FFRIENDEMAIL","Din vens e-mailadresse:");
define("_INTERESTING","En interssant artikel på");
define("_HELLO","Hej");
define("_YOURFRIEND","Din ven");
define("_CONSIDERED","fandt denne artikel interessant, og ønskede at sende den til dig.");
define("_FDATE","Dato:");
define("_FTOPIC","Emne:");
define("_YOUCANREAD","Du kan læse andre interessante artikler på");
define("_FSTORY","Artiklen");
define("_HASSENT","er blevet sendt til");
define("_THANKS","Tak!");
define("_RECOMMEND","Tip en ven om dette website.");
define("_PDATE","Dato:");
define("_PTOPIC","Emne:");
define("_COMESFROM","Denne artikel kommer fra");
define("_THEURL","Internetadressen til denne artikel er:");
define("_PREVIEW","Gennemse");
define("_NEWUSER","Ny bruger");
define("_OPTIONS","Valg");
define("_REFRESH","Genopfrisk");
define("_ADD","Opret");
define("_NOCOMMENTSACT","Desværre, det er ikke muligt at give kommentarer til denne artikel.");
define("_ARTICLEPOLL","Artiklens afstemning");
define("_RATEARTICLE","Artiklens stemmer");
define("_RATETHISARTICLE","Vær venlig lige at stemme på denne artikel:");
define("_CASTMYVOTE","Send min stemme!");
define("_AVERAGESCORE","Gennemsnitlig stemme");
define("_BAD","Dårlig");
define("_REGULAR","OK");
define("_GOOD","God");
define("_VERYGOOD","Meget God");
define("_EXCELLENT","Fremragende");
define("_ARTICLERATING","Artikel stemme");
define("_THANKSVOTEARTICLE","Tak for at stemme på denne artikel!");
define("<API key>","Desværre, de har allerede stemt på denne artikel!");
define("_BACKTOARTICLEPAGE","Tilbage til artiklens side");
define("_DIDNTRATE","De valgt ikke nogen karakter til denne artikel!");
define("_NOINFO4TOPIC","Desværre, der er ingen information om det valgte emne.");
define("_GOTONEWSINDEX","Gå til nyhedernes startside");
define("_SELECTNEWTOPIC","Vælg et nyt emne");
define("_GOTOHOME","Gå til Hjem");
define("_SEARCHONTOPIC","Søg i dette emne");
define("_SEARCHDIS","Søgnings diskution");
define("_READPDF","Read as PDF");
define("_READWITHCOMMENTS", "You can read the complete story with its comments from");
define("_TOFINISHRATING","To finish the rating process and to let the system count your vote, please complete the requested information:");
define("<API key>","<b>ERROR:</b> The security code you wrote is incorrect...<br>Please write it exactly as given bellow:");
define("_YOURATEDARTICLE","Your vote was");
define("_COMMENTSMODERATION","Comments Moderation System");
define("_MODERATE","Moderate");
define("_CLICKTOMODERATE","Please select your moderation values for each comment on this article, then click on <i>Moderate</i> button bellow to save your comments moderation preferences. Be fair on each value, this will contribute and benefict all users/readers. Thank you.");
define("_COMMENTSSYSTEM","Comments System");
define("_COMMENTPOSTERROR","<b>Error saving your comment...</b><br><br><b>ERROR:</b> The title or the main text of your comment are empty.<br>Please go back and correct the problem, then try again.");
?> |
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ShoestringPHP: Data Fields - Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="functions.html"><span>All</span></a></li>
<li class="current"><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_vars.html"><span>Variables</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="functions_func.html#index__"><span>_</span></a></li>
<li><a href="functions_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="functions_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="functions_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="functions_func_0x64.html#index_d"><span>d</span></a></li>
<li><a href="functions_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="functions_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="functions_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="functions_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="functions_func_0x69.html#index_i"><span>i</span></a></li>
<li><a href="functions_func_0x6a.html#index_j"><span>j</span></a></li>
<li><a href="functions_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="functions_func_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="functions_func_0x6e.html#index_n"><span>n</span></a></li>
<li><a href="functions_func_0x6f.html#index_o"><span>o</span></a></li>
<li><a href="functions_func_0x70.html#index_p"><span>p</span></a></li>
<li class="current"><a href="functions_func_0x71.html#index_q"><span>q</span></a></li>
<li><a href="functions_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="functions_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="functions_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="functions_func_0x75.html#index_u"><span>u</span></a></li>
<li><a href="functions_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="functions_func_0x78.html#index_x"><span>x</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h3><a class="anchor" id="index_q">- q -</a></h3><ul>
<li>queryDb()
: <a class="el" href="<API key>.html#<API key>">sMYSQLQuery</a>
, <a class="el" href="classs_query.html#<API key>">sQuery</a>
</li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Wed Sep 16 20:18:10 2009 for ShoestringPHP by
<a href="http:
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html> |
<?php
//plugin settings
if(!function_exists('<API key>')){
function <API key>(){
//global $wpdb;
if ( !function_exists( 'get_plugin_data' ) )
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$plugin_data = get_plugin_data(plugin_dir_path(__FILE__).'/cherry_plugin.php');
//@define('CHERRY_PLUGIN_DB', $wpdb->prefix.cherry_plugin);
define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
define('<API key>', $plugin_data['TextDomain']);
define('<API key>', $plugin_data['DomainPath']);
define('<API key>', $plugin_data['Version']);
define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
<API key>( <API key>, false, dirname( plugin_basename( __FILE__ ) ) . '/'.<API key>);
do_action( '<API key>' );
}
add_action('plugins_loaded', '<API key>', 0);
}
//init plugin
if(!function_exists('cherry_plugin_init')){
function cherry_plugin_init(){
//<API key>();
if(is_admin()){
include_once (CHERRY_PLUGIN_DIR . 'admin/admin.php');
}else{
include_once (CHERRY_PLUGIN_DIR . 'includes/web_site.php');
}
include_once (CHERRY_PLUGIN_DIR . 'cherry_plugin_init.php');
do_action( 'cherry_plugin_init' );
}
add_action('init', 'cherry_plugin_init', 0);
}
//activate plugin
if(!function_exists('<API key>')){
function <API key>(){
//echo "<API key>";
}
<API key>( __FILE__, '<API key>' );
};
//deactivate plugin
if(!function_exists('<API key>')){
function <API key>(){
//echo "<API key>";
}
<API key>( __FILE__, '<API key>' );
};
//delete plugin
if(!function_exists('<API key>')){
function <API key>(){
//echo "<API key>";
}
<API key>(__FILE__, '<API key>');
};
?> |
"""
Custom model managers.
"""
from django.db import models
import json
class DocumentQuerySet(models.QuerySet):
def _to_feature(self, obj):
return {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [obj.get('<API key>'),
obj.get('<API key>')]
},
"properties": {
"id": obj.get('<API key>'),
"label": obj.get('<API key>'),
"articles": [],
"uri": obj.get('<API key>'),
"class": 'location',
}
}
def geojson(self):
"""
Generate a GeoJSON representation.
"""
fields = [
'<API key>',
'<API key>',
'<API key>',
'<API key>',
'<API key>',
'id',
]
features = {}
for result in self.values(*fields):
if not result['<API key>']:
continue
location_id = result['<API key>']
if location_id not in features:
features[location_id] = self._to_feature(result)
features[location_id]['properties']['articles'].append(result['id'])
return json.dumps({
"type": "FeatureCollection",
"features": features.values(),
})
class DocumentManager(models.Manager):
def get_queryset(self):
return DocumentQuerySet(self.model, using=self._db) |
/**
* @file <API key>.cs
* @author Spiridon Alexandru
*
* @brief This represents the ImagePicker implementation for the NativeUI
* component on Windows Phone 7, language C#.
*
* @platform WP 7.1
**/
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Tasks;
using System.Windows.Media.Imaging;
using System.IO;
using System.Runtime.InteropServices;
namespace MoSync
{
public class ImagePickerModule : IIoctlModule
{
PhotoChooserTask mTask;
// variable used to check if the photo chooser is open. If it is, we shouldn't call the
// "Show()" method again
bool photoTaskStarted = false;
MoSync.Runtime runtimeReference;
// by default, the image picker will return a handle to the image
int eventType = MoSync.Constants.<API key>;
public void Init(Ioctls ioctls, Core core, Runtime runtime)
{
/**
* Displays an image picker to the user.
* It's display depends on the platform.
* Note: when a selection is made a #<API key> event is sent.
*/
ioctls.maImagePickerOpen = delegate()
{
// by default, the image picker will return a handle to the image
eventType = MoSync.Constants.<API key>;
// we need to keep a reference of the runtime in order to add image resources
// and send the ImagePicker event
runtimeReference = runtime;
return OpenImagePicker();
};
/**
* Sets the event type that the image picker will return after choosing an image.
* \param eventType One of the next constants:
* - #<API key>
* - #<API key>
*/
ioctls.<API key> = delegate(int eventType)
{
// we need to keep a reference of the runtime in order to add image resources
// and send the ImagePicker event
runtimeReference = runtime;
if (eventType == MoSync.Constants.<API key> ||
eventType == MoSync.Constants.<API key>)
{
this.eventType = eventType;
return OpenImagePicker();
}
return MoSync.Constants.MAW_RES_ERROR;
};
}
/**
* Opens the PhotoChooserTask and sets its completed event handler.
*/
private int OpenImagePicker()
{
mTask = new PhotoChooserTask();
// a small camera icon will appear in the page application bar - this enables
// the user to go to the camera and capture another image (which could be selected
// by using the image picker afterwards)
mTask.ShowCamera = true;
mTask.Completed += <API key>;
if (!photoTaskStarted)
{
mTask.Show();
}
photoTaskStarted = true;
return MoSync.Constants.MAW_RES_OK;
}
/*
* Occurs when a Chooser task is completed.
* @param sender The object that triggered the event.
* @param e The result containing the image selected by the user.
*/
private void <API key>(object sender, PhotoResult e)
{
photoTaskStarted = false;
Memory eventData = new Memory(16);
const int <API key> = 0;
const int <API key> = 4;
const int <API key> = 8;
const int <API key> = 12;
eventData.WriteInt32(<API key>, MoSync.Constants.<API key>);
if (e.TaskResult == TaskResult.OK)
{
// the user has selected an image -> the image picker state will be 1 - ok
eventData.WriteInt32(<API key>, 1);
// get a bitmap of the image selected by the user using the Image Picker
BitmapImage img = new BitmapImage();
img.SetSource(e.ChosenPhoto);
switch (eventType)
{
case MoSync.Constants.<API key>:
// We create a memory stream that will contain the bitmap image
// with jpeg encoding
MemoryStream memoryStream = new MemoryStream();
WriteableBitmap writableBitmap = new WriteableBitmap(img);
writableBitmap.SaveJpeg(memoryStream, img.PixelWidth, img.PixelHeight, 0, 100);
eventData.WriteInt32(<API key>, runtimeReference.AddResource(
new Resource(memoryStream, MoSync.Constants.RT_BINARY, true)));
break;
default:
// The AddResource returns an int - the image handle that's sent with the event data
eventData.WriteInt32(<API key>, runtimeReference.AddResource(
new Resource(img, MoSync.Constants.RT_IMAGE)));
break;
}
eventData.WriteInt32(<API key>, MoSync.Constants.<API key>);
}
else
{
// the user has canceled the image selection -> the image picker state will be 0 - cancel
eventData.WriteInt32(<API key>, 0);
}
runtimeReference.PostEvent(new Event(eventData));
}
}
} |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "common-internal.h"
#include "fdpoll-protected.h"
#include <errno.h>
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifndef INFTIM
# define INFTIM -1
#endif
/* select() */
/* #include <sys/select.h> */
/* int select(int n, fd_set *readfds, fd_set *writefds, */
/* fd_set *exceptfds, struct timeval *timeout); */
typedef struct {
struct cherokee_fdpoll poll;
int *fd_rw;
fd_set master_rfdset;
fd_set master_wfdset;
fd_set working_rfdset;
fd_set working_wfdset;
int *select_fds;
int *select_fdidx;
int *select_rfdidx;
int maxfd;
int maxfd_recompute;
} <API key>;
static ret_t
_free (<API key> *fdp)
{
if (fdp == NULL)
return ret_ok;
/* ANSI C required, so that free() can handle NULL pointers
*/
free (fdp->select_fds);
free (fdp->select_fdidx);
free (fdp->select_rfdidx);
free (fdp->fd_rw);
/* Caller has to set this pointer to NULL.
*/
free (fdp);
return ret_ok;
}
static ret_t
_add (<API key> *fdp, int fd, int rw)
{
cherokee_fdpoll_t *nfd = FDPOLL(fdp);
/* Check the fd limit
*/
if (<API key>(FDPOLL(fdp))) {
PRINT_ERROR_S("select_add: fdpoll is full !\n");
return ret_error;
}
fdp->select_fds[nfd->npollfds] = fd;
switch (rw) {
case FDPOLL_MODE_READ:
FD_SET (fd, &fdp->master_rfdset);
break;
case FDPOLL_MODE_WRITE:
FD_SET (fd, &fdp->master_wfdset);
break;
default:
break;
}
if (fd > fdp->maxfd) {
fdp->maxfd = fd;
}
fdp->select_fdidx[fd] = nfd->npollfds;
fdp->fd_rw[fd] = rw;
nfd->npollfds++;
return ret_ok;
}
static ret_t
_del (<API key> *fdp, int fd)
{
cherokee_fdpoll_t *nfd = FDPOLL(fdp);
int idx = fdp->select_fdidx[fd];
if ((idx < 0) || (idx >= FDPOLL(fdp)->nfiles)) {
PRINT_ERROR ("Bad idx (%d) in select_del_fd!\n", idx);
return ret_error;
}
nfd->npollfds
fdp->select_fds[idx] = fdp->select_fds[nfd->npollfds];
fdp->select_fdidx[fdp->select_fds[idx]] = idx;
fdp->select_fds[nfd->npollfds] = -1;
fdp->select_fdidx[fd] = -1;
fdp->fd_rw[fd] = -1;
FD_CLR (fd, &fdp->master_rfdset);
FD_CLR (fd, &fdp->master_wfdset);
if (fd >= fdp->maxfd) {
fdp->maxfd_recompute = 1;
}
return ret_ok;
}
static ret_t
_set_mode (<API key> *fdp, int fd, int rw)
{
ret_t ret;
ret = _del (fdp, fd);
if (unlikely(ret < ret_ok))
return ret;
return _add (fdp, fd, rw);
}
static int
_check (<API key> *fdp, int fd, int rw)
{
UNUSED(rw);
switch (fdp->fd_rw[fd]) {
case FDPOLL_MODE_READ:
return FD_ISSET (fd, &fdp->working_rfdset);
case FDPOLL_MODE_WRITE:
return FD_ISSET (fd, &fdp->working_wfdset);
}
return 0;
}
static int
select_get_maxfd (<API key> *fdp)
{
if (fdp->maxfd_recompute) {
int i;
fdp->maxfd = -1;
for (i = 0; i < FDPOLL(fdp)->npollfds; ++i) {
if (fdp->select_fds[i] > fdp->maxfd ) {
fdp->maxfd = fdp->select_fds[i];
}
}
fdp->maxfd_recompute = 0;
}
return fdp->maxfd;
}
static int
_watch (<API key> *fdp, int timeout_msecs)
{
int mfd;
int r, idx, ridx;
fdp->working_rfdset = fdp->master_rfdset;
fdp->working_wfdset = fdp->master_wfdset;
mfd = select_get_maxfd(fdp);
if (timeout_msecs == INFTIM) {
r = select (mfd + 1, &fdp->working_rfdset, &fdp->working_wfdset, NULL, NULL);
} else {
struct timeval timeout;
timeout.tv_sec = timeout_msecs / 1000L;
timeout.tv_usec = ( timeout_msecs % 1000L ) * 1000L;
r = select (mfd + 1, &fdp->working_rfdset, &fdp->working_wfdset, NULL, &timeout);
}
if (r <= 0) {
return r;
}
ridx = 0;
for (idx = 0; idx < FDPOLL(fdp)->npollfds; ++idx) {
if (_check (fdp, fdp->select_fds[idx], 0)) {
fdp->select_rfdidx[ridx++] = fdp->select_fds[idx];
if (ridx == r)
break;
}
}
return ridx; /* should be equal to r */
}
static ret_t
_reset (<API key> *fdp, int fd)
{
UNUSED(fdp);
UNUSED(fd);
return ret_ok;
}
ret_t
<API key> (cuint_t *system_fd_limit, cuint_t *fd_limit)
{
*system_fd_limit = FD_SETSIZE;
*fd_limit = 0;
return ret_ok;
}
ret_t
fdpoll_select_new (cherokee_fdpoll_t **fdp, int system_fd_limit, int fd_limit)
{
int i;
cherokee_fdpoll_t *nfd;
<API key> (1, n, fdpoll_select);
/* Verify that the max. number of system fds
* is below the max. acceptable limit.
*/
if (system_fd_limit > FD_SETSIZE) {
_free(n);
return ret_error;
}
nfd = FDPOLL(n);
/* Init base class properties
*/
nfd->type = <API key>;
nfd->nfiles = fd_limit;
nfd->system_nfiles = system_fd_limit;
nfd->npollfds = 0;
/* Init base class virtual methods
*/
nfd->free = (fdpoll_func_free_t) _free;
nfd->add = (fdpoll_func_add_t) _add;
nfd->del = (fdpoll_func_del_t) _del;
nfd->reset = (fdpoll_func_reset_t) _reset;
nfd->set_mode = (<API key>) _set_mode;
nfd->check = (fdpoll_func_check_t) _check;
nfd->watch = (fdpoll_func_watch_t) _watch;
/* Init properties
*/
FD_ZERO (&n->master_rfdset);
FD_ZERO (&n->master_wfdset);
n->select_fds = (int*) calloc(nfd->nfiles, sizeof(int));
n->select_rfdidx = (int*) calloc(nfd->nfiles, sizeof(int));
n->select_fdidx = (int*) calloc(nfd->system_nfiles, sizeof(int));
n->fd_rw = (int*) calloc(nfd->system_nfiles, sizeof(int));
n->maxfd = -1;
n->maxfd_recompute = 0;
if (n->select_fds == NULL ||
n->select_rfdidx == NULL ||
n->select_fdidx == NULL ||
n->fd_rw == NULL) {
_free (n);
return ret_nomem;
}
for (i = 0; i < nfd->nfiles; ++i) {
n->select_fds[i] = -1;
}
for (i = 0; i < nfd->system_nfiles; ++i) {
n->select_fdidx[i] = -1;
n->fd_rw[i] = -1;
}
*fdp = nfd;
return ret_ok;
} |
#ifndef SPACE_OB_MERC_H
#define SPACE_OB_MERC_H
#include "projection.h"
//! This is the object used for the Space Oblique Mercator projection.
class SpaceObMerc : public Projection
{
public:
SpaceObMerc();
SpaceObMerc(double gctpParams[], ProjUnit units, ProjDatum dat);
//! Set the satellite number
void setSatNum(long num) {m_satNum = num; setInit();}
//! Set the landsat path number
void setPath(long path) {m_path = path; setInit();}
//! Set the mode (0=A, 1=B)
void setMode(long mode) {m_mode = mode; setInit();}
//! Set the inclination of orbit at the ascending node, counter-clockwise from the equator.
void setAlf(double val);
//! Set the period of the satellite revolution, in minutes.
void setTime(double time) {m_time = time; setInit();}
//! Set the end of path flag, (0 = start, 1 = end).
void setStart(double start) {m_start = start; setInit();}
//! Get the landsat satellite number.
long satNum() {return m_satNum;}
//! Get the landsat path number.
long path() {return m_path;}
//! Get the mode of the projection, (0=A, 1=B).
long mode() {return m_mode;}
//! Set the inclination of orbit at the ascending node, counter-clockwise from the equator.
double alf() {return m_alf;}
//! Set the period of the satellite revolution, in minutes.
double time() {return m_time;}
//! Set the end of path flag, (0 = start, 1 = end).
double start() {return m_start;}
protected:
long m_satNum;
long m_path;
long m_mode;
double m_alf;
double m_time;
double m_a;
double m_b;
double m_a2;
double m_a4;
double m_c1;
double m_c3;
double m_q;
double m_t;
double m_u;
double m_w;
double m_xj;
double m_p21;
double m_sa;
double m_ca;
double m_es;
double m_s;
double m_start;
double m_centerLon;
//! Calculate a,b, and c coefficients to convert from transform lat/lon to SOM rectangular coordinates.
void som_series(double* fb, double* fa2, double* fa4, double* fc1, double* fc3, double* dlam);
//! See documentation for Projection.
void _init();
//! See documentation for Projection.
void _loadFromParams();
//! See documentation for Projection.
void _inverse(double x, double y);
//! See documentation for Projection.
void _forward(double lon, double lat);
};
#endif |
package com.pfa.og.from.xmind;
import java.io.PrintStream;
import com.pfa.og.pivot.Outline;
public class XmindToOutline {
public Outline convert(Sheet sh)
{
Outline o = new Outline(sh.getLabel());
convert(o,sh.getChildren());
return o;
}
private void convert(Outline o,Topic[] tp)
{
for (int i=0;i<tp.length;i++)
{
Outline oi = new Outline(tp[i].getLabel());
o.addChild(oi);
convert(oi,tp[i].getChildren());
}
}
} |
#include <stdio.h>
#include <stdlib.h>
#include "governor.h"
#include "tbb_main.h"
#include "scheduler.h"
#include "market.h"
#include "arena.h"
#include "tbb/task_scheduler_init.h"
#include "dynamic_link.h"
namespace tbb {
namespace internal {
// governor
#if <API key>
// Support for interoperability with Intel(R) Cilk(TM) Plus.
#if _WIN32
#define CILKLIB_NAME "cilkrts20.dll"
#else
#define CILKLIB_NAME "libcilkrts.so"
#endif
//! Handler for interoperation with cilkrts library.
static __cilk_tbb_retcode (*watch_stack_handler)(struct <API key>* u,
struct <API key> o);
//! Table describing how to link the handlers.
static const <API key> CilkLinkTable[] = {
{ "<API key>", (pointer_to_handler*)(void*)(&watch_stack_handler) }
};
static atomic<do_once_state> cilkrts_load_state;
bool <API key>() {
// Pinning can fail. This is a normal situation, and means that the current
// thread does not use cilkrts and consequently does not need interop.
return dynamic_link( CILKLIB_NAME, CilkLinkTable, 1, /*handle=*/0, DYNAMIC_LINK_GLOBAL );
}
#endif /* <API key> */
namespace rml {
tbb_server* make_private_server( tbb_client& client );
}
void governor::acquire_resources () {
#if USE_PTHREAD
int status = theTLS.create(auto_terminate);
#else
int status = theTLS.create();
#endif
if( status )
handle_perror(status, "TBB failed to initialize task scheduler TLS\n");
<API key> = cpu_has_speculation();
}
void governor::release_resources () {
theRMLServerFactory.close();
#if TBB_USE_ASSERT
if( __TBB_InitOnce::initialization_done() && theTLS.get() )
runtime_warning( "TBB is unloaded while tbb::task_scheduler_init object is alive?" );
#endif
int status = theTLS.destroy();
if( status )
runtime_warning("failed to destroy task scheduler TLS: %s", strerror(status));
dynamic_unlink_all();
}
rml::tbb_server* governor::create_rml_server ( rml::tbb_client& client ) {
rml::tbb_server* server = NULL;
if( !UsePrivateRML ) {
::rml::factory::status_type status = theRMLServerFactory.make_server( server, client );
if( status != ::rml::factory::st_success ) {
UsePrivateRML = true;
runtime_warning( "rml::tbb_factory::make_server failed with status %x, falling back on private rml", status );
}
}
if ( !server ) {
__TBB_ASSERT( UsePrivateRML, NULL );
server = rml::make_private_server( client );
}
__TBB_ASSERT( server, "Failed to create RML server" );
return server;
}
uintptr_t governor::tls_value_of( generic_scheduler* s ) {
__TBB_ASSERT( (uintptr_t(s)&1) == 0, "Bad pointer to the scheduler" );
// LSB marks the scheduler initialized with arena
return uintptr_t(s) | uintptr_t((s && (s->my_arena || s->is_worker()))? 1 : 0);
}
void governor::assume_scheduler( generic_scheduler* s ) {
theTLS.set( tls_value_of(s) );
}
bool governor::is_set( generic_scheduler* s ) {
return theTLS.get() == tls_value_of(s);
}
void governor::sign_on(generic_scheduler* s) {
__TBB_ASSERT( is_set(NULL) && s, NULL );
assume_scheduler( s );
#if <API key>
if( watch_stack_handler ) {
<API key> o;
o.routine = &stack_op_handler;
o.data = s;
if( (*watch_stack_handler)(&s-><API key>, o) ) {
// Failed to register with cilkrts, make sure we are clean
s-><API key>.routine = NULL;
}
#if TBB_USE_ASSERT
else
s->my_cilk_state = generic_scheduler::cs_running;
#endif /* TBB_USE_ASSERT */
}
#endif /* <API key> */
__TBB_ASSERT( is_set(s), NULL );
}
void governor::sign_off(generic_scheduler* s) {
<API key>(s);
__TBB_ASSERT( is_set(s), "attempt to unregister a wrong scheduler instance" );
assume_scheduler(NULL);
#if <API key>
<API key> &ut = s-><API key>;
if ( ut.routine )
(*ut.routine)(ut.data);
#endif /* <API key> */
}
void governor::<API key>(const task_scheduler_init *tsi) {
__TBB_ASSERT(!<API key>, "It's impossible to create task_scheduler_init while blocking termination is in progress.");
if (BlockingTSI)
throw_exception(<API key>);
BlockingTSI = tsi;
}
void governor::one_time_init() {
if( !__TBB_InitOnce::initialization_done() )
<API key>();
#if <API key>
atomic_do_once( &<API key>, cilkrts_load_state );
#endif /* <API key> */
}
generic_scheduler* governor::init_scheduler_weak() {
one_time_init();
__TBB_ASSERT( is_set(NULL), "TLS contains a scheduler?" );
generic_scheduler* s = generic_scheduler::create_master( NULL ); // without arena
s->my_auto_initialized = true;
return s;
}
generic_scheduler* governor::init_scheduler( int num_threads, stack_size_type stack_size, bool auto_init ) {
one_time_init();
uintptr_t v = theTLS.get();
generic_scheduler* s = tls_scheduler_of( v );
if( v&1 ) { // TLS holds scheduler instance with arena
__TBB_ASSERT( s->my_arena, "TLS is marked for scheduler with arena" );
s->my_ref_count += 1;
return s;
}
if( v ) { //TLS holds scheduler instance without arena
__TBB_ASSERT( !s->my_arena, "TLS is marked for scheduler without arena" );
__TBB_ASSERT( s->my_auto_initialized, "weakly initialized scheduler is supposed to be auto-initialized" );
s->attach_arena( market::create_arena( default_num_threads(), 0, true ), 0, /*is_master*/true );
__TBB_ASSERT( s->my_arena_index == 0, "Master thread must occupy the first slot in its arena" );
s->my_arena_slot->my_scheduler = s;
s->my_arena->my_default_ctx = s->default_context(); // it also transfers implied ownership
s->my_ref_count += 1;
assume_scheduler( s );
return s;
}
// Create new scheduler instance with arena
bool <API key> = num_threads == task_scheduler_init::automatic;
if( <API key> )
num_threads = default_num_threads();
arena *a = market::create_arena( num_threads, stack_size, <API key> );
s = generic_scheduler::create_master( a );
__TBB_ASSERT(s, "Somehow a local scheduler creation for a master thread failed");
__TBB_ASSERT( is_set(s), NULL );
s->my_auto_initialized = auto_init;
return s;
}
void governor::terminate_scheduler( generic_scheduler* s, const task_scheduler_init* tsi_ptr ) {
__TBB_ASSERT( is_set(s), "Attempt to terminate non-local scheduler instance" );
if (--(s->my_ref_count)) {
// can't throw exception, because this is on dtor's call chain
<API key>( !BlockingTSI || BlockingTSI!=tsi_ptr,
"Attempt to terminate nested scheduler in blocking mode" );
} else {
#if TBB_USE_ASSERT
if (BlockingTSI) {
__TBB_ASSERT( BlockingTSI == tsi_ptr, "For blocking termination last terminate_scheduler must be blocking." );
<API key> = true;
}
#endif
s->cleanup_master();
__TBB_ASSERT( is_set(NULL), "cleanup_master has not cleared its TLS slot" );
BlockingTSI = NULL;
#if TBB_USE_ASSERT
<API key> = false;
#endif
}
}
void governor::auto_terminate(void* arg){
generic_scheduler* s = tls_scheduler_of( uintptr_t(arg) ); // arg is equivalent to theTLS.get()
if( s && s->my_auto_initialized ) {
if( !--(s->my_ref_count) ) {
__TBB_ASSERT( !BlockingTSI, "Blocking auto-terminate is not supported." );
// If the TLS slot is already cleared by OS or underlying concurrency
// runtime, restore its value.
if( !is_set(s) )
assume_scheduler(s);
s->cleanup_master();
__TBB_ASSERT( is_set(NULL), "cleanup_master has not cleared its TLS slot" );
}
}
}
void governor::print_version_info () {
if ( UsePrivateRML )
<API key>( "RML", "private" );
else {
<API key>( "RML", "shared" );
theRMLServerFactory.<API key>( PrintRMLVersionInfo, (void*)"" );
}
#if <API key>
if( watch_stack_handler )
<API key>( "CILK", CILKLIB_NAME );
#endif /* <API key> */
}
void governor::<API key> () {
::rml::factory::status_type res = theRMLServerFactory.open();
UsePrivateRML = res != ::rml::factory::st_success;
}
#if <API key>
__cilk_tbb_retcode governor::stack_op_handler( __cilk_tbb_stack_op op, void* data ) {
__TBB_ASSERT(data,NULL);
generic_scheduler* s = static_cast<generic_scheduler*>(data);
#if TBB_USE_ASSERT
void* current = <API key>();
#if _WIN32||_WIN64
uintptr_t thread_id = GetCurrentThreadId();
#else
uintptr_t thread_id = uintptr_t(pthread_self());
#endif
#endif /* TBB_USE_ASSERT */
switch( op ) {
default:
__TBB_ASSERT( 0, "invalid op" );
case <API key>: {
__TBB_ASSERT( !current && s->my_cilk_state==generic_scheduler::cs_limbo ||
current==s && s->my_cilk_state==generic_scheduler::cs_running, "invalid adoption" );
#if TBB_USE_ASSERT
if( current==s )
runtime_warning( "redundant adoption of %p by thread %p\n", s, (void*)thread_id );
s->my_cilk_state = generic_scheduler::cs_running;
#endif /* TBB_USE_ASSERT */
assume_scheduler( s );
break;
}
case <API key>: {
__TBB_ASSERT( current==s && s->my_cilk_state==generic_scheduler::cs_running, "invalid orphaning" );
#if TBB_USE_ASSERT
s->my_cilk_state = generic_scheduler::cs_limbo;
#endif /* TBB_USE_ASSERT */
assume_scheduler(NULL);
break;
}
case <API key>: {
__TBB_ASSERT( !current && s->my_cilk_state==generic_scheduler::cs_limbo ||
current==s && s->my_cilk_state==generic_scheduler::cs_running, "invalid release" );
#if TBB_USE_ASSERT
s->my_cilk_state = generic_scheduler::cs_freed;
#endif /* TBB_USE_ASSERT */
s-><API key>.routine = NULL;
auto_terminate( s );
}
}
return 0;
}
#endif /* <API key> */
} // namespace internal
// task_scheduler_init
using namespace internal;
/** Left out-of-line for the sake of the backward binary compatibility **/
void task_scheduler_init::initialize( int number_of_threads ) {
initialize( number_of_threads, 0 );
}
void task_scheduler_init::initialize( int number_of_threads, stack_size_type thread_stack_size ) {
#if <API key> && TBB_USE_EXCEPTIONS
uintptr_t new_mode = thread_stack_size & <API key>;
#endif
thread_stack_size &= ~(stack_size_type)<API key>;
if( number_of_threads!=deferred ) {
bool blocking_terminate = false;
if (my_scheduler == (scheduler*)<API key>) {
blocking_terminate = true;
my_scheduler = NULL;
}
<API key>( !my_scheduler, "task_scheduler_init already initialized" );
<API key>( number_of_threads==automatic || number_of_threads > 0,
"number_of_threads for task_scheduler_init must be automatic or positive" );
if (blocking_terminate)
governor::<API key>(this);
internal::generic_scheduler *s = governor::init_scheduler( number_of_threads, thread_stack_size, /*auto_init=*/false );
#if <API key> && TBB_USE_EXCEPTIONS
if ( s-><API key>() ) {
uintptr_t &vt = s->default_context()-><API key>;
uintptr_t prev_mode = vt & task_group_context::exact_exception ? <API key> : 0;
vt = new_mode & <API key> ? vt | task_group_context::exact_exception
: new_mode & <API key> ? vt & ~task_group_context::exact_exception : vt;
// Use least significant bit of the scheduler pointer to store previous mode.
// This is necessary when components compiled with different compilers and/or
// TBB versions initialize the
my_scheduler = static_cast<scheduler*>((generic_scheduler*)((uintptr_t)s | prev_mode));
}
else
#endif /* <API key> && TBB_USE_EXCEPTIONS */
my_scheduler = s;
} else {
<API key>( !thread_stack_size, "deferred initialization ignores stack size setting" );
}
}
void task_scheduler_init::terminate() {
#if <API key> && TBB_USE_EXCEPTIONS
uintptr_t prev_mode = (uintptr_t)my_scheduler & <API key>;
my_scheduler = (scheduler*)((uintptr_t)my_scheduler & ~(uintptr_t)<API key>);
#endif /* <API key> && TBB_USE_EXCEPTIONS */
generic_scheduler* s = static_cast<generic_scheduler*>(my_scheduler);
my_scheduler = NULL;
<API key>( s, "task_scheduler_init::terminate without corresponding task_scheduler_init::initialize()");
#if <API key> && TBB_USE_EXCEPTIONS
if ( s-><API key>() ) {
uintptr_t &vt = s->default_context()-><API key>;
vt = prev_mode & <API key> ? vt | task_group_context::exact_exception
: vt & ~task_group_context::exact_exception;
}
#endif /* <API key> && TBB_USE_EXCEPTIONS */
governor::terminate_scheduler(s, this);
}
int task_scheduler_init::default_num_threads() {
return governor::default_num_threads();
}
} // namespace tbb |
/** @file
* IPRT - Multiprocessor, Solaris.
*/
#define LOG_GROUP RTLOGGROUP_DEFAULT
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <kstat.h>
#include <sys/processor.h>
#include <iprt/mp.h>
#include <iprt/cpuset.h>
#include <iprt/assert.h>
#include <iprt/string.h>
#include <iprt/alloc.h>
#include <iprt/log.h>
#include <iprt/once.h>
#include <iprt/critsect.h>
/** Initialization serializing (rtMpSolarisOnce). */
static RTONCE g_MpSolarisOnce = RTONCE_INITIALIZER;
/** Critical section serializing access to kstat. */
static RTCRITSECT g_MpSolarisCritSect;
/** The kstat handle. */
static kstat_ctl_t *g_pKsCtl;
/** Array pointing to the cpu_info instances. */
static kstat_t **g_papCpuInfo;
/** The number of entries in g_papCpuInfo */
static RTCPUID g_capCpuInfo;
/**
* Run once function that initializes the kstats we need here.
*
* @returns IPRT status code.
* @param pvUser Unused.
*/
static DECLCALLBACK(int) rtMpSolarisOnce(void *pvUser)
{
int rc = VINF_SUCCESS;
NOREF(pvUser);
/*
* Open kstat and find the cpu_info entries for each of the CPUs.
*/
g_pKsCtl = kstat_open();
if (g_pKsCtl)
{
g_capCpuInfo = RTMpGetCount();
g_papCpuInfo = (kstat_t **)RTMemAllocZ(g_capCpuInfo * sizeof(kstat_t *));
if (g_papCpuInfo)
{
rc = RTCritSectInit(&g_MpSolarisCritSect);
if (RT_SUCCESS(rc))
{
RTCPUID i = 0;
for (kstat_t *pKsp = g_pKsCtl->kc_chain; pKsp != NULL; pKsp = pKsp->ks_next)
{
if (!strcmp(pKsp->ks_module, "cpu_info"))
{
AssertBreak(i < g_capCpuInfo);
g_papCpuInfo[i++] = pKsp;
/** @todo ks_instance == cpu_id (/usr/src/uts/common/os/cpu.c)? Check this and fix it ASAP. */
}
}
return VINF_SUCCESS;
}
/* bail out, we failed. */
RTMemFree(g_papCpuInfo);
}
else
rc = VERR_NO_MEMORY;
kstat_close(g_pKsCtl);
g_pKsCtl = NULL;
}
else
{
rc = <API key>(errno);
if (RT_SUCCESS(rc))
rc = VERR_INTERNAL_ERROR;
Log(("kstat_open() -> %d (%Rrc)\n", errno, rc));
}
return rc;
}
/**
* Worker for RTMpGetCurFrequency and RTMpGetMaxFrequency.
*
* @returns The desired frequency on success, 0 on failure.
*
* @param idCpu The CPU ID.
* @param pszStatName The cpu_info stat name.
*/
static uint64_t <API key>(RTCPUID idCpu, char *pszStatName)
{
uint64_t u64 = 0;
int rc = RTOnce(&g_MpSolarisOnce, rtMpSolarisOnce, NULL);
if (RT_SUCCESS(rc))
{
if ( idCpu < g_capCpuInfo
&& g_papCpuInfo[idCpu])
{
rc = RTCritSectEnter(&g_MpSolarisCritSect);
AssertRC(rc);
if (RT_SUCCESS(rc))
{
if (kstat_read(g_pKsCtl, g_papCpuInfo[idCpu], 0) != -1)
{
kstat_named_t *pStat = (kstat_named_t *)kstat_data_lookup(g_papCpuInfo[idCpu], pszStatName);
if (pStat)
{
Assert(pStat->data_type == KSTAT_DATA_UINT64 || pStat->data_type == KSTAT_DATA_LONG);
switch (pStat->data_type)
{
case KSTAT_DATA_UINT64: u64 = pStat->value.ui64; break; /* current_clock_Hz */
case KSTAT_DATA_INT32: u64 = pStat->value.i32; break; /* clock_MHz */
/* just in case... */
case KSTAT_DATA_UINT32: u64 = pStat->value.ui32; break;
case KSTAT_DATA_INT64: u64 = pStat->value.i64; break;
default:
AssertMsgFailed(("%d\n", pStat->data_type));
break;
}
}
else
Log(("kstat_data_lookup(%s) -> %d\n", pszStatName, errno));
}
else
Log(("kstat_read() -> %d\n", errno));
RTCritSectLeave(&g_MpSolarisCritSect);
}
}
else
Log(("invalid idCpu: %d (g_capCpuInfo=%d)\n", (int)idCpu, (int)g_capCpuInfo));
}
return u64;
}
RTDECL(uint32_t) RTMpGetCurFrequency(RTCPUID idCpu)
{
return <API key>(idCpu, "current_clock_Hz") / 1000000;
}
RTDECL(uint32_t) RTMpGetMaxFrequency(RTCPUID idCpu)
{
return <API key>(idCpu, "clock_MHz");
}
#if defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
RTDECL(RTCPUID) RTMpCpuId(void)
{
/** @todo implement RTMpCpuId on solaris/r3! */
return NIL_RTCPUID;
}
#endif
RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
{
return idCpu < RTCPUSET_MAX_CPUS ? (int)idCpu : -1;
}
RTDECL(RTCPUID) <API key>(int iCpu)
{
return (unsigned)iCpu < RTCPUSET_MAX_CPUS ? iCpu : NIL_RTCPUID;
}
RTDECL(RTCPUID) RTMpGetMaxCpuId(void)
{
return RTMpGetCount() - 1;
}
RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
{
return idCpu != NIL_RTCPUID
&& idCpu < (RTCPUID)RTMpGetCount();
}
RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
{
int iStatus = p_online(idCpu, P_STATUS);
return iStatus == P_ONLINE
|| iStatus == P_NOINTR;
}
RTDECL(bool) RTMpIsCpuPresent(RTCPUID idCpu)
{
int iStatus = p_online(idCpu, P_STATUS);
return iStatus != -1;
}
RTDECL(RTCPUID) RTMpGetCount(void)
{
/*
* Solaris has sysconf.
*/
int cCpus = sysconf(_SC_NPROCESSORS_MAX);
if (cCpus < 0)
cCpus = sysconf(<API key>);
return cCpus;
}
RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet)
{
RTCpuSetEmpty(pSet);
int idCpu = RTMpGetCount();
while (idCpu
RTCpuSetAdd(pSet, idCpu);
return pSet;
}
RTDECL(RTCPUID) RTMpGetOnlineCount(void)
{
/*
* Solaris has sysconf.
*/
return sysconf(<API key>);
}
RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
{
RTCpuSetEmpty(pSet);
RTCPUID cCpus = RTMpGetCount();
for (RTCPUID idCpu = 0; idCpu < cCpus; idCpu++)
if (RTMpIsCpuOnline(idCpu))
RTCpuSetAdd(pSet, idCpu);
return pSet;
}
RTDECL(PRTCPUSET) RTMpGetPresentSet(PRTCPUSET pSet)
{
#ifdef RT_STRICT
long cCpusPresent = 0;
#endif
RTCpuSetEmpty(pSet);
RTCPUID cCpus = RTMpGetCount();
for (RTCPUID idCpu = 0; idCpu < cCpus; idCpu++)
if (RTMpIsCpuPresent(idCpu))
{
RTCpuSetAdd(pSet, idCpu);
#ifdef RT_STRICT
cCpusPresent++;
#endif
}
Assert(cCpusPresent == RTMpGetPresentCount());
return pSet;
}
RTDECL(RTCPUID) RTMpGetPresentCount(void)
{
/*
* Solaris has sysconf.
*/
return sysconf(<API key>);
} |
\begin{array}{l}
\begin{array}{l}
x \\
\end{array} \\
\end{array} |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ising_datastructure.h"
#include "ising.h"
#include "matrixmem.h"
//Computation of Boltzmann factors
void <API key> (struct ising *model)
{
double t = model->T;
double j = model->J;
double h = model->H;
for (int i = -12; i <= 12; i += 4)
{
model-> w[i + 12][0] = exp (-(i * j + 2 * h) / t);
model-> w[i + 12][2] = exp (-(i * j - 2 * h) / t);
}
}
int ising_init (struct ising *model, int lx, int ly, double jc, double h, double t)
{
model->J = jc; // ferromagnetic coupling
model->T = t; // temperature
model->H = h; // magnetic field
model->Lx = lx; // number of spins in x direction
model->Ly = ly; // number of spins in y direction
model->N = lx * ly; // number of spins
model->steps = 0; // steps so far
/* allocate random number generator */
gsl_rng *r = gsl_rng_alloc(gsl_rng_taus2);
model->r = r;
/* seed the random number generator */
unsigned long seed = 1UL;
gsl_rng_set(r, seed);
model->seed = seed;
model->cluster = NULL;
int **s = matrix_allocate_int (lx, ly);
if (s == NULL)
{
return -1;
}
//defining spins of each element
model->s = s;
for (int i = 0; i < lx; i++)
{
for (int j = 0; j < ly; j++)
{
//s[i][j] = (gsl_rng_uniform(r) < 0.5) ? 1 : -1; // hot start
s[i][j] = 1; // cold start
}
}
<API key> (model);
return 0;
}
//reinitialization of function
void ising_reinit (struct ising *model, double h, double t)
{
model->T = t; // temperature
model->H = h; // magnetic field
<API key> (model);
}
//memory freeing function
void ising_free (struct ising model)
{
if (model.cluster != NULL)
{
matrix_free (model.cluster);
}
matrix_free (model.s);
gsl_rng_free (model.r);
}
//calculating magnetization/spin
double <API key> (struct ising *model)
{
int sum = 0;
int **s = model->s;
int lx = model->Lx;
int ly = model->Ly;
for (int i = 0; i < lx; i++)
{
for (int j = 0; j < ly; j++)
{
sum += s[i][j];
}
}
return sum / ((double) model->N);
}
//calculating energy/spin
double energy_per_spin (struct ising *model)
{
int sum = 0, ssum = 0;
int **s = model->s;
int lx = model->Lx;
int ly = model->Ly;
for (int i = 0; i < lx; i++)
{
for (int j = 0; j < ly; j++)
{
sum += s[i][j];
int inext = (i == lx - 1) ? 0 : i + 1;
int jnext = (j == ly - 1) ? 0 : j + 1;
ssum += s[i][j] * (s[inext][j] + s[i][jnext] + s[inext][jnext]);
}
}
return -(model->J * ssum + model->H * sum) / model->N;
} |
$Date: 2012-2-9 17:36 $
#include "avl_dvbsx.h"
#include "ITuner.h"
#include "II2C.h"
AVL_DVBSx_ErrorCode <API key>(AVL_uint16 uiSymbolRate_10kHz, struct AVL_Tuner * pTuner)
{
AVL_uint32 lpf = uiSymbolRate_10kHz;
lpf *= 675; //roll off = 0.35
lpf /= 10000;
lpf += 30;
pTuner->m_uiLPF_100kHz = (AVL_uint16)lpf;
return(AVL_DVBSx_EC_OK);
} |
// ZoneMinder Image Class Interface, $Date$, $Revision$
// This program is free software; you can redistribute it and/or
// as published by the Free Software Foundation; either version 2
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifndef ZM_IMAGE_H
#define ZM_IMAGE_H
#include "zm.h"
extern "C" {
#include "zm_jpeg.h"
}
#include "zm_rgb.h"
#include "zm_coord.h"
#include "zm_box.h"
#include "zm_poly.h"
#include "zm_mem_utils.h"
#include "zm_utils.h"
class Image;
#include "zm_ffmpeg.h"
#include <errno.h>
#if HAVE_ZLIB_H
#include <zlib.h>
#endif // HAVE_ZLIB_H
#define ZM_BUFTYPE_DONTFREE 0
#define ZM_BUFTYPE_MALLOC 1
#define ZM_BUFTYPE_NEW 2
#define ZM_BUFTYPE_AVMALLOC 3
#define ZM_BUFTYPE_ZM 4
typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double);
typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long);
typedef void (*convert_fptr_t)(const uint8_t*, uint8_t*, unsigned long);
typedef void (*<API key>)(uint8_t*, uint8_t*, unsigned int, unsigned int, unsigned int);
typedef void* (*imgbufcpy_fptr_t)(void*, const void*, size_t);
extern imgbufcpy_fptr_t fptr_imgbufcpy;
/* Should be called from Image class functions */
inline static uint8_t* AllocBuffer(size_t p_bufsize) {
uint8_t* buffer = (uint8_t*)zm_mallocaligned(64, p_bufsize);
if ( buffer == nullptr )
Fatal("Memory allocation failed: %s", strerror(errno));
return buffer;
}
inline static void DumpBuffer(uint8_t* buffer, int buffertype) {
if ( buffer && buffertype != ZM_BUFTYPE_DONTFREE ) {
if ( buffertype == ZM_BUFTYPE_ZM ) {
zm_freealigned(buffer);
} else if ( buffertype == ZM_BUFTYPE_MALLOC ) {
free(buffer);
} else if ( buffertype == ZM_BUFTYPE_NEW ) {
delete buffer;
/*else if(buffertype == ZM_BUFTYPE_AVMALLOC)
av_free(buffer);
*/
} else {
Error("Unknown buffer type in DumpBuffer(%d)", buffertype);
}
}
}
// This is image class, and represents a frame captured from a
// camera in raw form.
class Image {
private:
delta_fptr_t delta8_rgb;
delta_fptr_t delta8_bgr;
delta_fptr_t delta8_rgba;
delta_fptr_t delta8_bgra;
delta_fptr_t delta8_argb;
delta_fptr_t delta8_abgr;
delta_fptr_t delta8_gray8;
// Per object function pointer that we can set once we know the image dimensions
blend_fptr_t blend;
void <API key>();
protected:
struct Edge {
int min_y;
int max_y;
double min_x;
double _1_m;
static int CompareYX( const void *p1, const void *p2 ) {
const Edge *e1 = reinterpret_cast<const Edge *>(p1), *e2 = reinterpret_cast<const Edge *>(p2);
if ( e1->min_y == e2->min_y )
return( int(e1->min_x - e2->min_x) );
else
return( int(e1->min_y - e2->min_y) );
}
static int CompareX( const void *p1, const void *p2 ) {
const Edge *e1 = reinterpret_cast<const Edge *>(p1), *e2 = reinterpret_cast<const Edge *>(p2);
return( int(e1->min_x - e2->min_x) );
}
};
inline void DumpImgBuffer() {
DumpBuffer(buffer, buffertype);
buffer = nullptr;
allocation = 0;
}
inline void AllocImgBuffer(size_t p_bufsize) {
if ( buffer )
DumpImgBuffer();
buffer = AllocBuffer(p_bufsize);
buffertype = ZM_BUFTYPE_ZM;
allocation = p_bufsize;
}
public:
enum { ZM_CHAR_HEIGHT=11, ZM_CHAR_WIDTH=6 };
enum { LINE_HEIGHT=ZM_CHAR_HEIGHT+0 };
protected:
static bool initialised;
static unsigned char *abs_table;
static unsigned char *y_r_table;
static unsigned char *y_g_table;
static unsigned char *y_b_table;
static <API key> *writejpg_ccinfo[101];
static <API key> *encodejpg_ccinfo[101];
static <API key> *readjpg_dcinfo;
static <API key> *decodejpg_dcinfo;
static struct zm_error_mgr jpg_err;
unsigned int width;
unsigned int linesize;
unsigned int height;
unsigned int pixels;
unsigned int colours;
unsigned int padding;
unsigned int size;
unsigned int subpixelorder;
unsigned long allocation;
uint8_t *buffer;
int buffertype; /* 0=not ours, no need to call free(), 1=malloc() buffer, 2=new buffer */
int holdbuffer; /* Hold the buffer instead of replacing it with new one */
char text[1024];
public:
Image();
explicit Image(const char *filename);
Image(int p_width, int p_height, int p_colours, int p_subpixelorder, uint8_t *p_buffer=0, unsigned int padding=0);
Image(int p_width, int p_linesize, int p_height, int p_colours, int p_subpixelorder, uint8_t *p_buffer=0, unsigned int padding=0);
explicit Image( const Image &p_image );
explicit Image( const AVFrame *frame );
~Image();
static void Initialise();
static void Deinitialise();
inline unsigned int Width() const { return width; }
inline unsigned int LineSize() const { return linesize; }
inline unsigned int Height() const { return height; }
inline unsigned int Pixels() const { return pixels; }
inline unsigned int Colours() const { return colours; }
inline unsigned int SubpixelOrder() const { return subpixelorder; }
inline unsigned int Size() const { return size; }
/* Internal buffer should not be modified from functions outside of this class */
inline const uint8_t* Buffer() const { return buffer; }
inline const uint8_t* Buffer( unsigned int x, unsigned int y= 0 ) const { return &buffer[(y*linesize)+x]; }
/* Request writeable buffer */
uint8_t* WriteBuffer(const unsigned int p_width, const unsigned int p_height, const unsigned int p_colours, const unsigned int p_subpixelorder);
inline int IsBufferHeld() const { return holdbuffer; }
inline void HoldBuffer(int tohold) { holdbuffer = tohold; }
inline void Empty() {
if ( !holdbuffer )
DumpImgBuffer();
width = linesize = height = colours = size = pixels = subpixelorder = 0;
}
void Assign(
unsigned int p_width,
unsigned int p_height,
unsigned int p_colours,
unsigned int p_subpixelorder,
const uint8_t* new_buffer,
const size_t buffer_size);
void Assign(const Image &image);
void AssignDirect(
const unsigned int p_width,
const unsigned int p_height,
const unsigned int p_colours,
const unsigned int p_subpixelorder,
uint8_t *new_buffer,
const size_t buffer_size,
const int p_buffertype);
inline void CopyBuffer(const Image &image) {
Assign(image);
}
inline Image &operator=(const Image &image) {
Assign(image);
return *this;
}
inline Image &operator=(const unsigned char *new_buffer) {
(*fptr_imgbufcpy)(buffer, new_buffer, size);
return *this;
}
bool ReadRaw( const char *filename );
bool WriteRaw( const char *filename ) const;
bool ReadJpeg( const char *filename, unsigned int p_colours, unsigned int p_subpixelorder);
bool WriteJpeg ( const char *filename) const;
bool WriteJpeg ( const char *filename, bool on_blocking_abort) const;
bool WriteJpeg ( const char *filename, int quality_override ) const;
bool WriteJpeg ( const char *filename, struct timeval timestamp ) const;
bool WriteJpeg ( const char *filename, int quality_override, struct timeval timestamp ) const;
bool WriteJpeg ( const char *filename, int quality_override, struct timeval timestamp, bool on_blocking_abort ) const;
bool DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, unsigned int p_colours, unsigned int p_subpixelorder);
bool EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_override=0 ) const;
#if HAVE_ZLIB_H
bool Unzip( const Bytef *inbuffer, unsigned long inbuffer_size );
bool Zip( Bytef *outbuffer, unsigned long *outbuffer_size, int compression_level=Z_BEST_SPEED ) const;
#endif // HAVE_ZLIB_H
bool Crop( unsigned int lo_x, unsigned int lo_y, unsigned int hi_x, unsigned int hi_y );
bool Crop( const Box &limits );
void Overlay( const Image &image );
void Overlay( const Image &image, unsigned int x, unsigned int y );
void Blend( const Image &image, int transparency=12 );
static Image *Merge( unsigned int n_images, Image *images[] );
static Image *Merge( unsigned int n_images, Image *images[], double weight );
static Image *Highlight( unsigned int n_images, Image *images[], const Rgb threshold=RGB_BLACK, const Rgb ref_colour=RGB_RED );
//Image *Delta( const Image &image ) const;
void Delta( const Image &image, Image* targetimage) const;
const Coord centreCoord( const char *text ) const;
void MaskPrivacy( const unsigned char *p_bitmask, const Rgb pixel_colour=0x00222222 );
void Annotate( const char *p_text, const Coord &coord, const unsigned int size=1, const Rgb fg_colour=RGB_WHITE, const Rgb bg_colour=RGB_BLACK );
Image *HighlightEdges( Rgb colour, unsigned int p_colours, unsigned int p_subpixelorder, const Box *limits=0 );
//Image *HighlightEdges( Rgb colour, const Polygon &polygon );
void Timestamp( const char *label, const time_t when, const Coord &coord, const int size );
void Colourise(const unsigned int p_reqcolours, const unsigned int p_reqsubpixelorder);
void DeColourise();
void Clear() { memset( buffer, 0, size ); }
void Fill( Rgb colour, const Box *limits=0 );
void Fill( Rgb colour, int density, const Box *limits=0 );
void Outline( Rgb colour, const Polygon &polygon );
void Fill( Rgb colour, const Polygon &polygon );
void Fill( Rgb colour, int density, const Polygon &polygon );
void Rotate( int angle );
void Flip( bool leftright );
void Scale( unsigned int factor );
void Deinterlace_Discard();
void Deinterlace_Linear();
void Deinterlace_Blend();
void <API key>(int divider);
void Deinterlace_4Field(const Image* next_image, unsigned int threshold);
};
#endif // ZM_IMAGE_H
/* Blend functions */
void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
void std_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
void std_blend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
/* Delta functions */
void std_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_rgb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_bgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void std_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_rgb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_bgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void fast_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void sse2_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void sse2_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void sse2_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void sse2_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void sse2_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void ssse3_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void ssse3_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void ssse3_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
void ssse3_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
/* Convert functions */
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void zm_convert_yuyv_rgb(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
void <API key>(const uint8_t* col1, uint8_t* result, unsigned long count);
/* Deinterlace_4Field functions */
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
void <API key>(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height); |
#ifndef <API key>
#define <API key>
#include <QtQml/QQmlParserStatus>
#include <GreenIsland/Server/Keymap>
class QWaylandCompositor;
namespace GreenIsland {
namespace Server {
class <API key>;
class <API key> CompositorSettings : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_DECLARE_PRIVATE(CompositorSettings)
Q_PROPERTY(QWaylandCompositor *compositor READ compositor WRITE setCompositor NOTIFY compositorChanged)
Q_PROPERTY(Qt::KeyboardModifier windowActionKey READ windowActionKey WRITE setWindowActionKey NOTIFY <API key>)
Q_PROPERTY(quint32 keyboardRepeatRate READ keyboardRepeatRate WRITE <API key> NOTIFY <API key>)
Q_PROPERTY(quint32 keyboardRepeatDelay READ keyboardRepeatDelay WRITE <API key> NOTIFY <API key>)
Q_PROPERTY(Keymap *keymap READ keymap WRITE setKeymap NOTIFY keymapChanged)
public:
CompositorSettings(QObject *parent = Q_NULLPTR);
QWaylandCompositor *compositor() const;
void setCompositor(QWaylandCompositor *compositor);
Qt::KeyboardModifier windowActionKey() const;
void setWindowActionKey(Qt::KeyboardModifier mod);
quint32 keyboardRepeatRate() const;
void <API key>(quint32 rate);
quint32 keyboardRepeatDelay() const;
void <API key>(quint32 delay);
Keymap *keymap() const;
void setKeymap(Keymap *keymap);
Q_SIGNALS:
void compositorChanged();
void <API key>();
void <API key>();
void <API key>();
void keymapChanged();
protected:
void classBegin() Q_DECL_OVERRIDE;
void componentComplete() Q_DECL_OVERRIDE;
private:
Q_PRIVATE_SLOT(d_func(), void _q_setupKeymap())
};
} // namespace Server
} // namespace GreenIsland
#endif // <API key> |
package com.oracle.graal.phases.common;
import java.util.concurrent.*;
import com.oracle.graal.api.code.*;
import com.oracle.graal.api.meta.*;
import com.oracle.graal.debug.*;
import com.oracle.graal.graph.*;
import com.oracle.graal.graph.Graph.NodeChangedListener;
import com.oracle.graal.nodes.*;
import com.oracle.graal.nodes.calc.*;
import com.oracle.graal.nodes.extended.*;
import com.oracle.graal.nodes.java.*;
import com.oracle.graal.nodes.spi.*;
import com.oracle.graal.nodes.util.*;
import com.oracle.graal.phases.*;
import com.oracle.graal.phases.tiers.*;
public class CanonicalizerPhase extends BasePhase<PhaseContext> {
private static final int <API key> = 10;
private static final DebugMetric <API key> = Debug.metric("CanonicalizedNodes");
private static final DebugMetric <API key> = Debug.metric("<API key>");
private static final DebugMetric <API key> = Debug.metric("InferStampCalled");
private static final DebugMetric <API key> = Debug.metric("StampChanged");
private static final DebugMetric <API key> = Debug.metric("<API key>");
public static final DebugMetric <API key> = Debug.metric("<API key>");
private final boolean canonicalizeReads;
public interface CustomCanonicalizer {
ValueNode canonicalize(ValueNode node);
}
public CanonicalizerPhase(boolean canonicalizeReads) {
this.canonicalizeReads = canonicalizeReads;
}
@Override
protected void run(StructuredGraph graph, PhaseContext context) {
new Instance(context.getRuntime(), context.getAssumptions(), canonicalizeReads).run(graph);
}
public static class Instance extends Phase {
private final int newNodesMark;
private final Assumptions assumptions;
private final MetaAccessProvider runtime;
private final CustomCanonicalizer customCanonicalizer;
private final Iterable<Node> initWorkingSet;
private final boolean canonicalizeReads;
private NodeWorkList workList;
private Tool tool;
public Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads) {
this(runtime, assumptions, canonicalizeReads, null, 0, null);
}
/**
* @param runtime
* @param assumptions
* @param workingSet the initial working set of nodes on which the canonicalizer works,
* should be an auto-grow node bitmap
* @param customCanonicalizer
* @param canonicalizeReads flag to indicate if
* {@link LoadFieldNode#canonical(CanonicalizerTool)} and
* {@link ReadNode#canonical(CanonicalizerTool)} should canonicalize reads of
* constant fields.
*/
public Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, Iterable<Node> workingSet, CustomCanonicalizer customCanonicalizer) {
this(runtime, assumptions, canonicalizeReads, workingSet, 0, customCanonicalizer);
}
/**
* @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by
* this mark are processed otherwise all nodes in the graph are processed
*/
public Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, int newNodesMark, CustomCanonicalizer customCanonicalizer) {
this(runtime, assumptions, canonicalizeReads, null, newNodesMark, customCanonicalizer);
}
public Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, Iterable<Node> workingSet, int newNodesMark, CustomCanonicalizer customCanonicalizer) {
super("Canonicalizer");
this.newNodesMark = newNodesMark;
this.assumptions = assumptions;
this.runtime = runtime;
this.canonicalizeReads = canonicalizeReads;
this.customCanonicalizer = customCanonicalizer;
this.initWorkingSet = workingSet;
}
@Override
protected void run(StructuredGraph graph) {
if (initWorkingSet == null) {
workList = graph.createNodeWorkList(newNodesMark == 0, <API key>);
} else {
workList = graph.createNodeWorkList(false, <API key>);
workList.addAll(initWorkingSet);
}
if (newNodesMark > 0) {
workList.addAll(graph.getNewNodes(newNodesMark));
}
tool = new Tool();
processWorkSet(graph);
}
private void processWorkSet(StructuredGraph graph) {
NodeChangedListener nodeChangedListener = new NodeChangedListener() {
@Override
public void nodeChanged(Node node) {
workList.addAgain(node);
}
};
graph.trackInputChange(nodeChangedListener);
graph.<API key>(nodeChangedListener);
for (Node n : workList) {
processNode(n);
}
graph.<API key>();
graph.<API key>();
}
private void processNode(Node node) {
if (node.isAlive()) {
<API key>.increment();
if (<API key>(node)) {
return;
}
StructuredGraph graph = (StructuredGraph) node.graph();
int mark = graph.getMark();
if (!tryKillUnused(node)) {
if (!tryCanonicalize(node)) {
if (node instanceof ValueNode) {
ValueNode valueNode = (ValueNode) node;
if (tryInferStamp(valueNode)) {
Constant constant = valueNode.stamp().asConstant();
if (constant != null) {
performReplacement(valueNode, ConstantNode.forConstant(constant, runtime, valueNode.graph()));
} else {
// the improved stamp may enable additional canonicalization
tryCanonicalize(valueNode);
}
}
}
}
}
for (Node newNode : graph.getNewNodes(mark)) {
workList.add(newNode);
}
}
}
private static boolean tryKillUnused(Node node) {
if (node.isAlive() && GraphUtil.isFloatingNode().apply(node) && node.usages().isEmpty()) {
GraphUtil.<API key>(node);
return true;
}
return false;
}
public static boolean <API key>(Node node) {
if (node.getNodeClass().valueNumberable()) {
Node newNode = node.graph().findDuplicate(node);
if (newNode != null) {
assert !(node instanceof FixedNode || newNode instanceof FixedNode);
node.replaceAtUsages(newNode);
node.safeDelete();
<API key>.increment();
Debug.log("GVN applied and new node is %1s", newNode);
return true;
}
}
return false;
}
public boolean tryCanonicalize(final Node node) {
boolean result = baseTryCanonicalize(node);
if (!result && customCanonicalizer != null && node instanceof ValueNode) {
ValueNode valueNode = (ValueNode) node;
ValueNode canonical = customCanonicalizer.canonicalize(valueNode);
result = performReplacement(node, canonical);
}
return result;
}
public boolean baseTryCanonicalize(final Node node) {
if (node instanceof Canonicalizable) {
assert !(node instanceof Simplifiable);
<API key>.increment();
return Debug.scope("CanonicalizeNode", node, new Callable<Boolean>() {
public Boolean call() {
ValueNode canonical = ((Canonicalizable) node).canonical(tool);
return performReplacement(node, canonical);
}
});
} else if (node instanceof Simplifiable) {
Debug.log("Canonicalizer: simplifying %s", node);
<API key>.increment();
Debug.scope("SimplifyNode", node, new Runnable() {
public void run() {
((Simplifiable) node).simplify(tool);
}
});
}
return node.isDeleted();
}
// @formatter:off
// cases: original node:
// |Floating|Fixed-unconnected|Fixed-connected|
// null| 1 | X | 3 |
// Floating| 2 | X | 4 |
// Fixed-unconnected| X | X | 5 |
// Fixed-connected| 2 | X | 6 |
// X: must not happen (checked with assertions)
// @formatter:on
private boolean performReplacement(final Node node, ValueNode canonical) {
if (canonical == node) {
Debug.log("Canonicalizer: work on %s", node);
return false;
} else {
Debug.log("Canonicalizer: replacing %s with %s", node, canonical);
<API key>.increment();
StructuredGraph graph = (StructuredGraph) node.graph();
if (node instanceof FloatingNode) {
if (canonical == null) {
// case 1
graph.removeFloating((FloatingNode) node);
} else {
// case 2
assert !(canonical instanceof FixedNode) || (canonical.predecessor() != null || canonical instanceof StartNode || canonical instanceof MergeNode) : node + " -> " + canonical +
" : replacement should be floating or fixed and connected";
graph.replaceFloating((FloatingNode) node, canonical);
}
} else {
assert node instanceof FixedWithNextNode && node.predecessor() != null : node + " -> " + canonical + " : node should be fixed & connected (" + node.predecessor() + ")";
FixedWithNextNode fixedWithNext = (FixedWithNextNode) node;
// When removing a fixed node, new canonicalization opportunities for its
// successor
// may arise
assert fixedWithNext.next() != null;
tool.addToWorkList(fixedWithNext.next());
if (canonical == null) {
// case 3
graph.removeFixed(fixedWithNext);
} else if (canonical instanceof FloatingNode) {
// case 4
graph.<API key>(fixedWithNext, (FloatingNode) canonical);
} else {
assert canonical instanceof FixedNode;
if (canonical.predecessor() == null) {
assert !canonical.cfgSuccessors().iterator().hasNext() : "replacement " + canonical + " shouldn't have successors";
// case 5
graph.<API key>(fixedWithNext, (FixedWithNextNode) canonical);
} else {
assert canonical.cfgSuccessors().iterator().hasNext() : "replacement " + canonical + " should have successors";
// case 6
node.replaceAtUsages(canonical);
graph.removeFixed(fixedWithNext);
}
}
}
return true;
}
}
/**
* Calls {@link ValueNode#inferStamp()} on the node and, if it returns true (which means
* that the stamp has changed), re-queues the node's usages. If the stamp has changed then
* this method also checks if the stamp now describes a constant integer value, in which
* case the node is replaced with a constant.
*/
private boolean tryInferStamp(ValueNode node) {
if (node.isAlive()) {
<API key>.increment();
if (node.inferStamp()) {
<API key>.increment();
for (Node usage : node.usages()) {
workList.addAgain(usage);
}
return true;
}
}
return false;
}
private final class Tool implements SimplifierTool {
@Override
public void deleteBranch(FixedNode branch) {
branch.predecessor().<API key>(branch, null);
GraphUtil.killCFG(branch);
}
/**
* @return an object that can be used for recording assumptions or {@code null} if
* assumptions are not allowed in the current context.
*/
@Override
public Assumptions assumptions() {
return assumptions;
}
@Override
public MetaAccessProvider runtime() {
return runtime;
}
@Override
public void addToWorkList(Node node) {
workList.addAgain(node);
}
@Override
public void removeIfUnused(Node node) {
tryKillUnused(node);
}
@Override
public boolean canonicalizeReads() {
return canonicalizeReads;
}
}
}
} |
<?php
namespace Eccube\Controller\Admin\Content;
use Eccube\Application;
use \Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class CssController
{
// TODO:
protected $cssDir = 'default/css/';
public function index(Application $app)
{
$builder = $app['form.factory']->createBuilder();
$builder->add('file_name', 'text');
$builder->add('content', 'textarea');
$builder->add('save', 'submit', array('label' => ''));
$form = $builder->getForm();
if ('POST' === $app['request']->getMethod()) {
$form->handleRequest($app['request']);
if ($form->isValid()) {
$data = $form->getData();
$fs = new Filesystem();
$fs->dumpFile($this->getCssDir($app) . $data['file_name'], $data['content']);
$app['session']->getFlashBag()->add('admin.content.css.complete', 'admin.register.complete');
return $app->redirect($app['url_generator']->generate('admin_content_css'));
}
}
$target = $app['request']->get('target');
if ($target) {
$finder = Finder::create();
$finder->in($this->getCssDir($app))->name($target);
if ($finder->count() === 1) {
$data = null;
foreach ($finder as $file) {
$data = array(
'file_name' => $file->getFileName(),
'content' => file_get_contents($file->getPathName()));
}
$form->setData($data);
}
}
return $app['view']->render('Admin/Content/css.twig', array(
'form' => $form->createView(),
'filenames' => $this->getFileNames($app),
));
}
public function delete(Application $app)
{
$target = $app['request']->get('target');
$finder = Finder::create();
$finder->in($this->getCssDir($app))->name($target);
if ($finder->count() == 1) {
foreach ($finder->files() as $file) {
$fs = new Filesystem();
$fs->remove($file->getPathName());
}
$app['session']->getFlashBag()->add('admin.content.css.complete', 'admin.register.complete');
}
return $app->redirect($app['url_generator']->generate('admin_content_css'));
}
protected function getFileNames($app)
{
$finder = Finder::create();
$finder
->in($this->getCssDir($app))
->files()
->sortByName()
->depth(0);
$fileNames = array();
foreach ($finder as $file) {
$fileNames[] = $file->getFileName();
}
return $fileNames;
}
protected function getCssDir($app)
{
return $app['config']['<API key>'] . $this->cssDir;
}
} |
test("emptyString", function() {
var map = parseQueryString("");
equal(map, null);
})
test("singleOption", function() {
var map = parseQueryString("?foo=bar");
deepEqual(map, {foo:"bar"}, "?foo=bar");
})
test("multiOption", function() {
var str = "?foo=bar&baz=quz";
var map = parseQueryString(str);
deepEqual(map, {foo:"bar",baz:"quz"}, str);
}) |
package com.sun.max.ins.gui;
/**
* Objects that are subject to textual search,
* for example by a {@link TableRowTextMatcher}.
*/
public interface TextSearchable {
/**
* @return a string suitable for use during text searching.
*/
String getSearchableText();
} |
#ifndef MDDIHOST_H
#define MDDIHOST_H
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/time.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include "linux/proc_fs.h"
#include <linux/types.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <mach/hardware.h>
#include <linux/io.h>
#include <asm/system.h>
#include <asm/mach-types.h>
#include <linux/types.h>
#include <linux/dma-mapping.h>
#include "msm_fb_panel.h"
#undef FEATURE_MDDI_MC4
#undef <API key>
#undef <API key>
#define FEATURE_MDDI_SHARP
#define <API key>
#undef FEATURE_MDDI_E751
#define FEATURE_MDDI_CORONA
#define FEATURE_MDDI_PRISM
#define T_MSM7500
typedef enum {
format_16bpp,
format_18bpp,
format_24bpp
} mddi_video_format;
typedef enum {
MDDI_LCD_NONE = 0,
MDDI_LCD_MC4,
MDDI_LCD_S6D0142,
MDDI_LCD_SHARP,
MDDI_LCD_E751,
MDDI_LCD_CORONA,
MDDI_LCD_HITACHI,
MDDI_LCD_TOSHIBA,
MDDI_LCD_PRISM,
MDDI_LCD_TP2,
/* LGE_CHANGES_S [minjong.gong] 2010-03-23 Google Mass 3G Hitahci MDDI I/F LCD driver */
<API key>,
/* LGE_CHANGES_E [minjong.gong] 2010-03-23 Google Mass 3G Hitahci MDDI I/F LCD driver */
/* LGE_CHANGES_S [dojip.kim@lge.com] 2010-04-23, [LS670] Novatek MDDI I/F LCD driver */
<API key>,
/* LGE_CHANGES_S [dojip.kim@lge.com] 2010-04-23, [LS670] Novatek MDDI I/F LCD driver */
MDDI_NUM_LCD_TYPES,
MDDI_LCD_DEFAULT = MDDI_LCD_TOSHIBA
} mddi_lcd_type;
typedef enum {
MDDI_HOST_PRIM = 0,
MDDI_HOST_EXT,
MDDI_NUM_HOST_CORES
} mddi_host_type;
typedef enum {
MDDI_DRIVER_RESET, /* host core registers have not been written. */
<API key>, /* registers written, interrupts disabled. */
MDDI_DRIVER_ENABLED /* registers written, interrupts enabled. */
} <API key>;
typedef enum {
MDDI_GPIO_INT_0 = 0,
MDDI_GPIO_INT_1,
MDDI_GPIO_INT_2,
MDDI_GPIO_INT_3,
MDDI_GPIO_INT_4,
MDDI_GPIO_INT_5,
MDDI_GPIO_INT_6,
MDDI_GPIO_INT_7,
MDDI_GPIO_INT_8,
MDDI_GPIO_INT_9,
MDDI_GPIO_INT_10,
MDDI_GPIO_INT_11,
MDDI_GPIO_INT_12,
MDDI_GPIO_INT_13,
MDDI_GPIO_INT_14,
MDDI_GPIO_INT_15,
MDDI_GPIO_NUM_INTS
} mddi_gpio_int_type;
enum <API key> {
<API key> = 4,
<API key> = 8,
<API key> = 12,
<API key> = 16,
<API key> = 24
};
typedef struct {
uint32 addr;
uint32 value;
} mddi_reg_write_type;
boolean <API key>(<API key> handler, void *arg);
typedef void (*<API key>) (void);
typedef void (*<API key>) (void *);
boolean <API key>(<API key> handler, uint16 pkt_type);
#define <API key> 0xC3
#define <API key> 0xC0
typedef int <API key>;
typedef int <API key>;
typedef struct {
void (*vsync_detected) (boolean);
} mddi_lcd_func_type;
extern mddi_lcd_func_type mddi_lcd;
extern int irq_enabled;
extern unsigned char <API key>;
extern struct mutex mddi_timer_lock;
void mddi_init(void);
void mddi_powerdown(void);
void <API key>(void);
void <API key>(void);
extern spinlock_t mddi_host_spin_lock;
#ifdef T_MSM7500
void mddi_reset(void);
#ifdef <API key>
void <API key>(boolean on);
#endif
#endif
void <API key>(void);
void <API key>
(void *buf_ptr,
boolean clear_area,
int16 src_width,
int16 src_starting_row,
int16 src_starting_column,
int16 num_of_rows,
int16 num_of_columns, int16 dst_starting_row, int16 dst_starting_column);
void mddi_queue_image
(void *buf_ptr,
uint8 stereo_video,
boolean clear_area,
int16 src_width,
int16 src_starting_row,
int16 src_starting_column,
int16 num_of_rows,
int16 num_of_columns, int16 dst_starting_row, int16 dst_starting_column);
int <API key>
(uint32 reg_addr,
uint32 *reg_value_ptr, boolean wait, mddi_host_type host_idx);
int <API key>
(uint32 reg_addr, uint32 reg_val,
enum <API key> packet_size,
boolean wait, <API key> done_cb, mddi_host_type host);
boolean <API key>
(uint32 reg_addr,
uint32 reg_val, <API key> done_cb, mddi_host_type host);
boolean <API key>
(uint32 reg_addr, uint32 *reg_value_ptr, mddi_host_type host_idx);
void <API key>
(uint32 reg_addr,
uint32 reg_val, boolean wait, <API key> done_cb);
void <API key>
(const mddi_reg_write_type *reg_write,
uint16 num_writes, <API key> done_cb);
#ifdef <API key>
int <API key>(uint32 reg_addr,
uint32 *value_list_ptr, uint32 value_count,
boolean wait, <API key> done_cb,
mddi_host_type host);
int <API key>(uint32 reg_addr,
uint32 *value_list_ptr, uint32 value_count,
boolean wait, mddi_host_type host);
#endif
#define <API key>(reg, val_ptr, wait, sig) \
<API key>(reg, val_ptr, wait, MDDI_HOST_PRIM)
#define <API key>(reg, val, wait, sig) \
<API key>(reg, val, <API key>,\
wait, NULL, MDDI_HOST_PRIM)
#define <API key>(reg, val, pkt_size, wait, sig) \
<API key>(reg, val, pkt_size, \
wait, NULL, MDDI_HOST_PRIM)
#define <API key>(reg, val) \
<API key>(reg, val, NULL, MDDI_HOST_PRIM)
#define <API key>(reg, val_ptr) \
<API key>(reg, val_ptr, MDDI_HOST_PRIM)
#define <API key>(reg_ptr, val, wait, sig) \
<API key>(reg_ptr, val, wait, sig, MDDI_HOST_PRIM)
void mddi_wait(uint16 time_ms);
void <API key>(uint16 image_cols,
uint16 image_rows,
uint16 bpp,
uint16 *max_cols, uint16 * max_rows);
#ifdef <API key>
uint16 <API key>(uint16 pkt_width, uint16 pkt_height, uint16 bpp);
#endif
void <API key>(boolean wait);
int mddi_client_power(unsigned int client_id);
void mddi_disable(int lock);
void mddi_window_adjust(struct msm_fb_data_type *mfd,
uint16 x1, uint16 x2, uint16 y1, uint16 y2);
#if 1 //defined(CONFIG_MACH_LGE)
void <API key>(unsigned reg_addr, unsigned count,
unsigned char reg_val[], boolean wait, <API key> done_cb,
mddi_host_type host);
void <API key>(unsigned reg_addr, unsigned count, unsigned int reg_val[], boolean wait, <API key> done_cb, mddi_host_type host);
#endif
void <API key>(mddi_host_type host_idx);
int pmdh_clk_func(int enable);
#endif /* MDDIHOST_H */ |
#ifndef <API key>
#define <API key>
#include "InternalFunction.h"
#include "<API key>.h"
namespace JSC {
class ErrorInstance;
class FunctionPrototype;
class <API key>;
class <API key> : public InternalFunction {
public:
typedef InternalFunction Base;
static <API key>* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
{
<API key>* constructor = new (NotNull, allocateCell<<API key>>(*exec->heap())) <API key>(globalObject, structure);
constructor->finishCreation(exec, globalObject, prototypeStructure, name);
return constructor;
}
static const ClassInfo s_info;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
}
Structure* errorStructure() { return m_errorStructure.get(); }
protected:
void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
{
Base::finishCreation(exec->vm(), name);
ASSERT(inherits(&s_info));
<API key>* prototype = <API key>::create(exec, globalObject, prototypeStructure, name, this);
putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
putDirect(exec->vm(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
m_errorStructure.set(exec->vm(), this, ErrorInstance::createStructure(exec->vm(), globalObject, prototype));
ASSERT(m_errorStructure);
ASSERT(m_errorStructure->isObject());
}
private:
<API key>(JSGlobalObject*, Structure*);
static const unsigned StructureFlags = <API key> | InternalFunction::StructureFlags;
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
static void visitChildren(JSCell*, SlotVisitor&);
WriteBarrier<Structure> m_errorStructure;
};
} // namespace JSC
#endif // <API key> |
# Rekall Memory Forensics
# This program is free software; you can redistribute it and/or modify
# your option) any later version.
# This program is distributed in the hope that it will be useful, but
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from builtins import object
import socket
from rekall import kb
from rekall import obj
from rekall.plugins.overlays import basic
from rekall.plugins.overlays.windows import pe_vtypes
from rekall_lib import utils
AF_INET = 2
AF_INET6 = 0x17
# String representations of INADDR_ANY and INADDR6_ANY
inaddr_any = utils.inet_ntop(socket.AF_INET, b'\0' * 4)
inaddr6_any = utils.inet_ntop(socket.AF_INET6, b'\0' * 16)
protos = {
0:"HOPOPT",
1:"ICMP",
2:"IGMP",
3:"GGP",
4:"IPv4",
5:"ST",
6:"TCP",
7:"CBT",
8:"EGP",
9:"IGP",
10:"BBN-RCC-MON",
11:"NVP-II",
12:"PUP",
13:"ARGUS",
14:"EMCON",
15:"XNET",
16:"CHAOS",
17:"UDP",
18:"MUX",
19:"DCN-MEAS",
20:"HMP",
21:"PRM",
22:"XNS-IDP",
23:"TRUNK-1",
24:"TRUNK-2",
25:"LEAF-1",
26:"LEAF-2",
27:"RDP",
28:"IRTP",
29:"ISO-TP4",
30:"NETBLT",
31:"MFE-NSP",
32:"MERIT-INP",
33:"DCCP",
34:"3PC",
35:"IDPR",
36:"XTP",
37:"DDP",
38:"IDPR-CMTP",
39:"TP++",
40:"IL",
41:"IPv6",
42:"SDRP",
43:"IPv6-Route",
44:"IPv6-Frag",
45:"IDRP",
46:"RSVP",
47:"GRE",
48:"DSR",
49:"BNA",
50:"ESP",
51:"AH",
52:"I-NLSP",
53:"SWIPE",
54:"NARP",
55:"MOBILE",
56:"TLSP",
57:"SKIP",
58:"IPv6-ICMP",
59:"IPv6-NoNxt",
60:"IPv6-Opts",
61:"Host-interal",
62:"CFTP",
63:"Local Network",
64:"SAT-EXPAK",
65:"KRYPTOLAN",
66:"RVD",
67:"IPPC",
68:"Dist-FS",
69:"SAT-MON",
70:"VISA",
71:"IPCV",
72:"CPNX",
73:"CPHB",
74:"WSN",
75:"PVP",
76:"BR-SAT-MON",
77:"SUN-ND",
78:"WB-MON",
79:"WB-EXPAK",
80:"ISO-IP",
81:"VMTP",
82:"SECURE-VMTP",
83:"VINES",
84:"TTP",
# 84:"IPTM",
85:"NSFNET-IGP",
86:"DGP",
87:"TCF",
88:"EIGRP",
89:"OSPFIGP",
90:"Sprite-RPC",
91:"LARP",
92:"MTP",
93:"AX.25",
94:"IPIP",
95:"MICP",
96:"SCC-SP",
97:"ETHERIP",
98:"ENCAP",
99:"Encryption",
100:"GMTP",
101:"IFMP",
102:"PNNI",
103:"PIM",
104:"ARIS",
105:"SCPS",
106:"QNX",
107:"A/N",
108:"IPComp",
109:"SNP",
110:"Compaq-Peer",
111:"IPX-in-IP",
112:"VRRP",
113:"PGM",
114:"0-hop",
115:"L2TP",
116:"DDX",
117:"IATP",
118:"STP",
119:"SRP",
120:"UTI",
121:"SMP",
122:"SM",
123:"PTP",
124:"ISIS over IPv4",
125:"FIRE",
126:"CRTP",
127:"CRUDP",
128:"SSCOPMCE",
129:"IPLT",
130:"SPS",
131:"PIPE",
132:"SCTP",
133:"FC",
134:"RSVP-E2E-IGNORE",
135:"Mobility Header",
136:"UDPLite",
137:"MPLS-in-IP",
138:"manet",
139:"HIP",
140:"Shim6",
141:"WESP",
142:"ROHC",
253:"Experimental",
254:"Experimental",
255:"Reserved",
}
# Structures used by connections, connscan, sockets, sockscan.
# Used by x86 XP (all service packs) and x86 2003 SP0.
tcpip_vtypes = {
'_ADDRESS_OBJECT' : [0x68, {
'Next' : [0x0, ['pointer', ['_ADDRESS_OBJECT']]],
'LocalIpAddress' : [0x2c, ['Ipv4Address']],
'LocalPort' : [0x30, ['unsigned be short']],
'Protocol' : [0x32, ['unsigned short']],
'Pid' : [0x148, ['unsigned long']],
'CreateTime' : [0x158, ['WinFileTime', {}]],
}],
'_TCPT_OBJECT' : [0x20, {
'Next' : [0x0, ['pointer', ['_TCPT_OBJECT']]],
'RemoteIpAddress' : [0xc, ['Ipv4Address']],
'LocalIpAddress' : [0x10, ['Ipv4Address']],
'RemotePort' : [0x14, ['unsigned be short']],
'LocalPort' : [0x16, ['unsigned be short']],
'Pid' : [0x18, ['unsigned long']],
}],
}
# Structures used by connections, connscan, sockets, sockscan.
# Used by x64 XP and x64 2003 (all service packs).
<API key> = {
'_ADDRESS_OBJECT' : [0x250, {
'Next' : [0x0, ['pointer', ['_ADDRESS_OBJECT']]],
'LocalIpAddress' : [0x58, ['Ipv4Address']],
'LocalPort' : [0x5c, ['unsigned be short']],
'Protocol' : [0x5e, ['unsigned short']],
'Pid' : [0x238, ['unsigned long']],
'CreateTime' : [0x248, ['WinFileTime', {}]],
}],
'_TCPT_OBJECT' : [0x28, {
'Next' : [0x0, ['pointer', ['_TCPT_OBJECT']]],
'RemoteIpAddress' : [0x14, ['Ipv4Address']],
'LocalIpAddress' : [0x18, ['Ipv4Address']],
'RemotePort' : [0x1c, ['unsigned be short']],
'LocalPort' : [0x1e, ['unsigned be short']],
'Pid' : [0x20, ['unsigned long']],
}],
}
# Structures used by sockets and sockscan.
# Used by x86 2003 SP1 and SP2 only.
<API key> = {
'_ADDRESS_OBJECT' : [0x68, {
'Next' : [0x0, ['pointer', ['_ADDRESS_OBJECT']]],
'LocalIpAddress' : [0x30, ['Ipv4Address']],
'LocalPort' : [0x34, ['unsigned be short']],
'Protocol' : [0x36, ['unsigned short']],
'Pid' : [0x14C, ['unsigned long']],
'CreateTime' : [0x158, ['WinFileTime', {}]],
}],
}
TCP_STATE_ENUM = {
0: 'CLOSED', 1: 'LISTENING', 2: 'SYN_SENT',
3: 'SYN_RCVD', 4: 'ESTABLISHED', 5: 'FIN_WAIT1',
6: 'FIN_WAIT2', 7: 'CLOSE_WAIT', 8: 'CLOSING',
9: 'LAST_ACK', 12: 'TIME_WAIT', 13: 'DELETE_TCB'
}
# Structures used by netscan for x86 Vista and 2008 (all service packs).
tcpip_vtypes_vista = {
'_IN_ADDR' : [None, {
'addr4' : [0x0, ['Ipv4Address']],
'addr6' : [0x0, ['Ipv6Address']],
}],
'_LOCAL_ADDRESS' : [None, {
'pData' : [0xC, ['pointer', ['pointer', ['_IN_ADDR']]]],
}],
'_TCP_LISTENER': [0xa8, { # TcpL
'Owner' : [0x18, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x20, ['WinFileTime', {}]],
'LocalAddr' : [0x34, ['pointer', ['_LOCAL_ADDRESS']]],
'InetAF' : [0x38, ['pointer', ['_INETAF']]],
"Endpoint": [0x50, ['Pointer', dict(
target="_TCP_ENDPOINT"
)]],
'Port' : [0x3E, ['unsigned be short']],
}],
'_TCP_ENDPOINT': [0x1f0, { # TcpE
'InetAF' : [0xC, ['pointer', ['_INETAF']]],
'AddrInfo' : [0x10, ['pointer', ['_ADDRINFO']]],
'ListEntry': [0x14, ['_LIST_ENTRY']],
'State' : [0x28, ['Enumeration', dict(
target='long',
choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x2C, ['unsigned be short']],
'RemotePort' : [0x2E, ['unsigned be short']],
'Owner' : [0x160, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_TCP_SYN_ENDPOINT': [None, {
'ListEntry': [8, ['_LIST_ENTRY']],
'InetAF' : [0x18, ['pointer', ['_INETAF']]],
'LocalPort' : [0x3c, ['unsigned be short']],
'RemotePort' : [0x3e, ['unsigned be short']],
'LocalAddr' : [0x1c, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x28, ['pointer', ['_IN_ADDR']]],
'Owner' : [0x20, ['pointer', ['_SYN_OWNER']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_SYN_OWNER': [None, {
'Process': [0x18, ['pointer', ['_EPROCESS']]],
}],
'<API key>': [None, {
'ListEntry': [0x14, ['_LIST_ENTRY']],
'InetAF' : [0xc, ['pointer', ['_INETAF']]],
'LocalPort' : [0x1c, ['unsigned be short']],
'RemotePort' : [0x1e, ['unsigned be short']],
'LocalAddr' : [0x20, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x24, ['pointer', ['_IN_ADDR']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_INETAF' : [None, {
'AddressFamily' : [0xC, ['unsigned short']],
}],
'_ADDRINFO' : [None, {
'Local' : [0x0, ['pointer', ['_LOCAL_ADDRESS']]],
'Remote' : [0x8, ['pointer', ['_IN_ADDR']]],
}],
'_UDP_ENDPOINT': [0xa8, { # UdpA
'Owner' : [0x18, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x30, ['WinFileTime', {}]],
'LocalAddr' : [0x38, ['pointer', ['_LOCAL_ADDRESS']]],
'InetAF' : [0x14, ['pointer', ['_INETAF']]],
'Port' : [0x48, ['unsigned be short']],
}],
# Reversed from tcpip.sys!<API key>
"PARTITION_TABLE": [None, {
"Partitions": [4, ["Array", dict(
target="Pointer",
count=lambda x: x.obj_profile.get_constant_object(
"PartitionCount", "unsigned int"),
target_args=dict(
target="Array",
target_args=dict(
count=4,
target="FIRST_LEVEL_DIR",
profile=lambda x: x.session.profile,
)
)
)]],
}],
# ntoskrnl.exe!RtlCreateHashTable
"FIRST_LEVEL_DIR": [0x24, {
"SizeOfSecondLevel": [0x8, ["unsigned int"]],
"Mask": [0x10, ["unsigned int"]],
# Reversed from ntoskrnl.exe!<API key>
"SecondLevel": [0x20, ["Pointer", dict(
target="Array",
target_args=dict(
count=lambda x: x.SizeOfSecondLevel,
target="_LIST_ENTRY"
)
)]],
}],
}
# Structures for netscan on x86 Windows 7 (all service packs).
tcpip_vtypes_7 = {
'_TCP_ENDPOINT': [0x210, { # TcpE
'InetAF' : [0xC, ['pointer', ['_INETAF']]],
'AddrInfo' : [0x10, ['pointer', ['_ADDRINFO']]],
'ListEntry': [0x14, ['_LIST_ENTRY']],
'State' : [0x34, ['Enumeration', dict(
target='long', choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x38, ['unsigned be short']],
'RemotePort' : [0x3A, ['unsigned be short']],
'Owner' : [0x174, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_TCP_SYN_ENDPOINT': [None, {
'ListEntry': [8, ['_LIST_ENTRY']],
'InetAF' : [0x24, ['pointer', ['_INETAF']]],
'LocalPort' : [0x48, ['unsigned be short']],
'RemotePort' : [0x4a, ['unsigned be short']],
'LocalAddr' : [0x28, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x34, ['pointer', ['_IN_ADDR']]],
'Owner' : [0x2c, ['pointer', ['_SYN_OWNER']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'<API key>': [None, {
'ListEntry': [0, ['_LIST_ENTRY']],
'InetAF' : [0x18, ['pointer', ['_INETAF']]],
'LocalPort' : [0x28, ['unsigned be short']],
'RemotePort' : [0x2a, ['unsigned be short']],
'LocalAddr' : [0x2c, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x30, ['pointer', ['_IN_ADDR']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
"_LIST_ENTRY": basic.common_overlay["LIST_ENTRY32"],
}
# Structures for netscan on x64 Vista SP0 and 2008 SP0
<API key> = {
'_IN_ADDR' : [None, {
'addr4' : [0x0, ['Ipv4Address']],
'addr6' : [0x0, ['Ipv6Address']],
}],
'_TCP_LISTENER': [0x120, { # TcpL
'Owner' : [0x28, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x20, ['WinFileTime', {}]],
'LocalAddr' : [0x58, ['pointer', ['_LOCAL_ADDRESS']]],
'InetAF' : [0x60, ['pointer', ['_INETAF']]],
'Port' : [0x6a, ['unsigned be short']],
}],
'_INETAF' : [None, {
'AddressFamily' : [0x14, ['unsigned short']],
}],
'_LOCAL_ADDRESS' : [None, {
'pData' : [0x10, ['pointer', ['pointer', ['_IN_ADDR']]]],
}],
'_ADDRINFO' : [None, {
'Local' : [0x0, ['pointer', ['_LOCAL_ADDRESS']]],
'Remote' : [0x10, ['pointer', ['_IN_ADDR']]],
}],
'_TCP_ENDPOINT': [0x210, { # TcpE
'InetAF' : [0x18, ['pointer', ['_INETAF']]],
'AddrInfo' : [0x20, ['pointer', ['_ADDRINFO']]],
'ListEntry': [0x28, ['_LIST_ENTRY']],
'State' : [0x50, ['Enumeration', dict(
target='long',
choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x54, ['unsigned be short']],
'RemotePort' : [0x56, ['unsigned be short']],
'Owner' : [0x208, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_TCP_SYN_ENDPOINT': [None, {
'ListEntry': [0x10, ['_LIST_ENTRY']],
'InetAF' : [0x30, ['pointer', ['_INETAF']]],
'LocalPort' : [0x64, ['unsigned be short']],
'RemotePort' : [0x66, ['unsigned be short']],
'LocalAddr' : [0x38, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x50, ['pointer', ['_IN_ADDR']]],
'Owner' : [0x40, ['pointer', ['_SYN_OWNER']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_SYN_OWNER': [None, {
'Process': [0x28, ['pointer', ['_EPROCESS']]],
}],
'<API key>': [None, {
'ListEntry': [0, ['_LIST_ENTRY']],
'InetAF' : [0x18, ['pointer', ['_INETAF']]],
'LocalPort' : [0x30, ['unsigned be short']],
'RemotePort' : [0x32, ['unsigned be short']],
'LocalAddr' : [0x38, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x40, ['pointer', ['_IN_ADDR']]],
'CreateTime' : [0, ['WinFileTime', {}]],
}],
'_UDP_ENDPOINT': [0x82, { # UdpA
'Owner' : [0x28, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x58, ['WinFileTime', {}]],
'LocalAddr' : [0x60, ['pointer', ['_LOCAL_ADDRESS']]],
'InetAF' : [0x20, ['pointer', ['_INETAF']]],
'Port' : [0x80, ['unsigned be short']],
}],
# Reversed from tcpip.sys!<API key>
"PARTITION_TABLE": [None, {
"Partitions": [8, ["Array", dict(
target="Pointer",
count=lambda x: x.obj_profile.get_constant_object(
"PartitionCount", "unsigned int"),
target_args=dict(
target="Array",
target_args=dict(
count=4,
target="FIRST_LEVEL_DIR",
),
),
)]],
}],
# ntoskrnl.exe!RtlCreateHashTable (PoolTag:HTab)
"FIRST_LEVEL_DIR": [0x24, {
"SizeOfSecondLevel": [0x8, ["unsigned int"]],
"Mask": [0x10, ["unsigned int"]],
# Reversed from ntoskrnl.exe!<API key>
"SecondLevel": [0x20, ["Pointer", dict(
target="Array",
# Actual hash table (PoolTag:HTab)
target_args=dict(
count=lambda x: x.SizeOfSecondLevel,
target="_LIST_ENTRY"
)
)]],
}],
"_LIST_ENTRY": basic.common_overlay["LIST_ENTRY64"],
}
<API key> = {
'_TCP_ENDPOINT': [0x320, {
'State' : [0x68, ['Enumeration', dict(target='long',
choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x6c, ['unsigned be short']],
'RemotePort' : [0x6e, ['unsigned be short']],
'Owner' : [0x238, ['pointer', ['_EPROCESS']]],
}],
'_TCP_SYN_ENDPOINT': [None, {
'InetAF' : [0x48, ['pointer', ['_INETAF']]],
'LocalPort' : [0x7c, ['unsigned be short']],
'RemotePort' : [0x7e, ['unsigned be short']],
'LocalAddr' : [0x50, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x68, ['pointer', ['_IN_ADDR']]],
'Owner' : [0x58, ['pointer', ['_SYN_OWNER']]],
}],
'<API key>': [None, {
'InetAF' : [0x30, ['pointer', ['_INETAF']]],
'LocalPort' : [0x48, ['unsigned be short']],
'RemotePort' : [0x4a, ['unsigned be short']],
'LocalAddr' : [0x50, ['pointer', ['_LOCAL_ADDRESS']]],
'RemoteAddress' : [0x58, ['pointer', ['_IN_ADDR']]],
}],
}
overlays = {
"_ADDRESS_OBJECT": [None, {
"Protocol": [None, ["Enumeration", dict(
choices=protos,
target="unsigned int")]],
}]
}
# This is not used just yet but soon!
<API key> = {
"_TCP_LISTENER": dict(
# The Owner process.
Owner=[
# Attempt 1
["Disassembler", dict(
start="tcpip.sys!_TcpCreateListener@8",
length=300,
rules=[
"CALL *<API key>",
"MOV [EBX+$out], EAX",
],
target="Pointer",
target_args=dict(
target="_EPROCESS"
),
)],
# Attempt 2
["Disassembler", dict(
start="tcpip.sys!<API key>@20",
rules=[
"MOV EAX, [ESI+$out]",
"TEST EAX, EAX",
"PUSH EAX",
"CALL DWORD *PsGetProcessId",
],
target="Pointer",
target_args=dict(
target="_EPROCESS"
),
)]
],
# Socket creation time.
CreateTime=[
["Disassembler", dict(
start="tcpip.sys!_TcpCreateListener@8",
length=300,
rules=[
"LEA EAX, [EBX+$out]",
"PUSH EAX",
"CALL DWORD *KeQuerySystemTime",
],
target="WinFileTime",
)],
],
),
}
# Structures for netscan on x32 Win10
<API key> = {
'_ADDRINFO' : [None, {
'Local' : [0x0, ['pointer', ['_LOCAL_ADDRESS']]],
'Remote' : [0xC, ['pointer', ['_IN_ADDR']]],
}],
'_TCP_ENDPOINT': [None, { # TcpE
'InetAF' : [0x8, ['pointer', ['_INETAF']]],
'AddrInfo' : [0xC, ['pointer', ['_ADDRINFO']]],
'State' : [0x38, ['Enumeration', dict(
target='long',
choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x3C, ['unsigned be short']],
'RemotePort' : [0x3E, ['unsigned be short']],
'Owner' : [0x1B0, ['pointer', ['_EPROCESS']]],
}],
}
# Structures for netscan on x64 Win10
<API key> = {
'_IN_ADDR' : [None, {
'addr4' : [0x0, ['Ipv4Address']],
'addr6' : [0x0, ['Ipv6Address']],
}],
'_TCP_LISTENER': [0x74, { # TcpL
'Owner' : [0x30, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x40, ['WinFileTime', {}]],
'LocalAddr' : [0x60, ['pointer', ['_LOCAL_ADDRESS']]],
'InetAF' : [0x28, ['pointer', ['_INETAF']]],
'Port' : [0x72, ['unsigned be short']],
}],
'_INETAF' : [None, {
'AddressFamily' : [0x18, ['unsigned short']],
}],
'<API key>' : [None, {
'pData' : [0x0, ['pointer', ['_IN_ADDR']]],
}],
'_LOCAL_ADDRESS' : [None, {
'pData' : [0x10, ['pointer', ['pointer', ['_IN_ADDR']]]],
}],
'_ADDRINFO' : [None, {
'Local' : [0x0, ['pointer', ['_LOCAL_ADDRESS']]],
'Remote' : [0x10, ['pointer', ['_IN_ADDR']]],
}],
'_TCP_ENDPOINT': [0x270, { # TcpE
'InetAF' : [0x10, ['pointer', ['_INETAF']]],
'AddrInfo' : [0x18, ['pointer', ['_ADDRINFO']]],
'State' : [0x6c, ['Enumeration', dict(
target='long',
choices=TCP_STATE_ENUM)]],
'LocalPort' : [0x70, ['unsigned be short']],
'RemotePort' : [0x72, ['unsigned be short']],
'Owner' : [0x258, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x268, ['WinFileTime', {}]],
}],
'_UDP_ENDPOINT': [0x80, { # UdpA
'Owner' : [0x28, ['pointer', ['_EPROCESS']]],
'CreateTime' : [0x58, ['WinFileTime', {}]],
'LocalAddr' : [0x80, ['pointer', ['<API key>']]],
'InetAF' : [0x20, ['pointer', ['_INETAF']]],
'Port' : [0x78, ['unsigned be short']],
}],
}
class _TCP_LISTENER(obj.Struct):
"""Class for objects found in TcpL pools"""
def dual_stack_sockets(self, vm=None):
"""Handle Windows dual-stack sockets"""
# If this pointer is valid, the socket is bound to
# a specific IP address. Otherwise, the socket is
# listening on all IP addresses of the address family.
local_addr = self.LocalAddr.dereference(vm=vm)
# Switch to the correct address space.
af_inet = self.InetAF.dereference(vm=vm)
# Note the remote address is always INADDR_ANY or
# INADDR6_ANY for sockets. The moment a client
# connects to the listener, a TCP_ENDPOINT is created
# and that structure contains the remote address.
if local_addr:
inaddr = local_addr.pData.dereference().dereference()
if af_inet.AddressFamily == AF_INET:
yield "v4", inaddr.addr4, inaddr_any
else:
yield "v6", inaddr.addr6, inaddr6_any
else:
yield "v4", inaddr_any, inaddr_any
if af_inet.AddressFamily.v() == AF_INET6:
yield "v6", inaddr6_any, inaddr6_any
class _TCP_ENDPOINT(_TCP_LISTENER):
"""Class for objects found in TcpE pools"""
def _ipv4_or_ipv6(self, in_addr, vm=None):
af_inet = self.InetAF.dereference(vm=vm)
if af_inet.AddressFamily == AF_INET:
return in_addr.addr4
else:
return in_addr.addr6
def LocalAddress(self, vm=None):
inaddr = self.AddrInfo.dereference(vm=vm).Local.\
pData.dereference().dereference()
return self._ipv4_or_ipv6(inaddr, vm=vm)
def RemoteAddress(self, vm=None):
inaddr = self.AddrInfo.dereference(vm=vm).\
Remote.dereference()
return self._ipv4_or_ipv6(inaddr, vm=vm)
class _UDP_ENDPOINT(_TCP_LISTENER):
"""Class for objects found in UdpA pools"""
class <API key>(_UDP_ENDPOINT):
"""Class for objects found in UdpA pools"""
def dual_stack_sockets(self, vm=None):
"""Handle Windows dual-stack sockets"""
# If this pointer is valid, the socket is bound to
# a specific IP address. Otherwise, the socket is
# listening on all IP addresses of the address family.
local_addr = self.LocalAddr.dereference(vm=vm)
# Switch to the correct address space.
af_inet = self.InetAF.dereference(vm=vm)
# Note the remote address is always INADDR_ANY or
# INADDR6_ANY for sockets. The moment a client
# connects to the listener, a TCP_ENDPOINT is created
# and that structure contains the remote address.
if local_addr:
inaddr = local_addr.pData.dereference()
if af_inet.AddressFamily == AF_INET:
yield "v4", inaddr.addr4, inaddr_any
else:
yield "v6", inaddr.addr6, inaddr6_any
else:
yield "v4", inaddr_any, inaddr_any
if af_inet.AddressFamily.v() == AF_INET6:
yield "v6", inaddr6_any, inaddr6_any
class TcpipPluginMixin(object):
"""A mixin for plugins that want to use tcpip.sys profiles."""
@classmethod
def args(cls, parser):
super(TcpipPluginMixin, cls).args(parser)
parser.add_argument("--tcpip_guid", default=None,
help="Force this profile to be used for tcpip.")
def __init__(self, tcpip_guid=None, **kwargs):
super(TcpipPluginMixin, self).__init__(**kwargs)
# For the address resolver to load this GUID.
if tcpip_guid:
self.session.SetCache("tcpip_guid", tcpip_guid)
tcpip_module = self.session.address_resolver.GetModuleByName("tcpip")
self.tcpip_profile = tcpip_module.profile
if not self.tcpip_profile:
raise RuntimeError("Unable to load the profile for tcpip.sys")
class Tcpip(pe_vtypes.BasicPEProfile):
"""A profile for the TCPIP driver."""
@classmethod
def Initialize(cls, profile):
super(Tcpip, cls).Initialize(profile)
version = profile.session.profile.metadata("version")
# Network Object Classess for Vista, 2008, 7, and 10 x86 and x64
profile.add_classes(dict(_TCP_LISTENER=_TCP_LISTENER,
_TCP_ENDPOINT=_TCP_ENDPOINT))
if version >= 10.0:
profile.add_classes(dict(_UDP_ENDPOINT=<API key>))
else:
profile.add_classes(dict(_UDP_ENDPOINT=_UDP_ENDPOINT))
# Switch on the kernel version. FIXME: This should be done using the
# generate_types module.
if profile.metadata("arch") == "AMD64":
# Windows 10
if version >= 10.0:
profile.add_overlay(<API key>)
# Vista SP1.
elif version == 6.0:
profile.add_overlay(<API key>)
profile.add_overlay({
'_TCP_ENDPOINT': [None, {
'Owner' : [0x210, ['pointer', ['_EPROCESS']]],
}],
})
# Windows 7
elif version >= 6.1:
profile.add_overlay(<API key>)
profile.add_overlay(<API key>)
# Win2k3
elif version == 5.2:
profile.add_overlay(<API key>)
elif profile.metadata("arch") == "I386":
profile.add_overlay(tcpip_vtypes)
# Win2k3
if version == 5.2:
profile.add_overlay(<API key>)
# Vista
elif version == 6.0:
profile.add_overlay(tcpip_vtypes_vista)
# Windows 7
elif version >= 6.1:
profile.add_overlay(tcpip_vtypes_vista)
profile.add_overlay(tcpip_vtypes_7)
# Windows 10
elif version >= 10.0:
profile.add_overlay(tcpip_vtypes_vista)
profile.add_overlay(<API key>)
# Pool tags
profile.add_constants(dict(<API key>=b"UdpA",
<API key>=b"TcpL",
<API key>=b"TcpE"))
profile.add_overlay(overlays)
return profile
class TcpipHook(kb.ParameterHook):
name = "tcpip_profile"
def calculate(self):
index = self.session.LoadProfile("tcpip/index")
image_base = self.session.address_resolver.get_address_by_name("tcpip")
for guess, _ in index.LookupIndex(image_base):
return guess |
use utf8;
package Koha::Schema::Result::Course;
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::Course
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<courses>
=cut
__PACKAGE__->table("courses");
=head1 ACCESSORS
=head2 course_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 department
data_type: 'varchar'
is_nullable: 1
size: 80
=head2 course_number
data_type: 'varchar'
is_nullable: 1
size: 255
=head2 section
data_type: 'varchar'
is_nullable: 1
size: 255
=head2 course_name
data_type: 'varchar'
is_nullable: 1
size: 255
=head2 term
data_type: 'varchar'
is_nullable: 1
size: 80
=head2 staff_note
data_type: 'longtext'
is_nullable: 1
=head2 public_note
data_type: 'longtext'
is_nullable: 1
=head2 students_count
data_type: 'varchar'
is_nullable: 1
size: 20
=head2 enabled
data_type: 'enum'
default_value: 'yes'
extra: {list => ["yes","no"]}
is_nullable: 0
=head2 timestamp
data_type: 'timestamp'
<API key>: 1
default_value: current_timestamp
is_nullable: 0
=cut
__PACKAGE__->add_columns(
"course_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"department",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"course_number",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"section",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"course_name",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"term",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"staff_note",
{ data_type => "longtext", is_nullable => 1 },
"public_note",
{ data_type => "longtext", is_nullable => 1 },
"students_count",
{ data_type => "varchar", is_nullable => 1, size => 20 },
"enabled",
{
data_type => "enum",
default_value => "yes",
extra => { list => ["yes", "no"] },
is_nullable => 0,
},
"timestamp",
{
data_type => "timestamp",
<API key> => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</course_id>
=back
=cut
__PACKAGE__->set_primary_key("course_id");
=head1 RELATIONS
=head2 course_instructors
Type: has_many
Related object: L<Koha::Schema::Result::CourseInstructor>
=cut
__PACKAGE__->has_many(
"course_instructors",
"Koha::Schema::Result::CourseInstructor",
{ "foreign.course_id" => "self.course_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 course_reserves
Type: has_many
Related object: L<Koha::Schema::Result::CourseReserve>
=cut
__PACKAGE__->has_many(
"course_reserves",
"Koha::Schema::Result::CourseReserve",
{ "foreign.course_id" => "self.course_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 borrowernumbers
Type: many_to_many
Composing rels: L</course_instructors> -> borrowernumber
=cut
__PACKAGE__->many_to_many("borrowernumbers", "course_instructors", "borrowernumber");
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:o0EBOuJCHxH5IG/PgsJfxg
# You can replace this text with custom content, and it will be preserved on regeneration
1; |
<?php
defined('_JEXEC') or die( 'No Direct Access' );
if (!defined("JEV_COM_COMPONENT")){
define("JEV_COM_COMPONENT","com_jevents");
define("JEV_COMPONENT",str_replace("com_","",JEV_COM_COMPONENT));
}
if (!defined("JEV_LIBS")){
define("JEV_ADMINPATH",JPATH_ADMINISTRATOR."/components/".JEV_COM_COMPONENT."/");
define("JEV_PATH",JPATH_SITE."/components/".JEV_COM_COMPONENT."/");
define("JEV_VIEWS",JEV_PATH."views");
define("JEV_LIBS",JEV_PATH."libraries");
define("<API key>",JEV_VIEWS."/abstract/tmpl/");
define("JEV_ADMINLIBS",JEV_ADMINPATH."libraries/");
}
JLoader::register('JSite' , JPATH_SITE.'/includes/application.php');
JLoader::register('JevRegistry',JEV_PATH."/libraries/registry.php");
JLoader::register('JEVConfig',JEV_ADMINPATH."/libraries/config.php");
JLoader::register('JEVHelper',JEV_PATH."/libraries/helper.php");
JLoader::register('JevModuleHelper',JEV_PATH."/libraries/jevmodulehelper.php"); // RSH Required registration for class!
// TODO replace with JDate
JLoader::register('JEventDate',JEV_PATH."/libraries/jeventdate.php");
JLoader::register('JevDate',JEV_PATH."/libraries/jevdate.php");
JLoader::register('JEventsHTML',JEV_PATH."/libraries/jeventshtml.php");
JLoader::register('JEventsVersion',JEV_ADMINPATH."/libraries/version.php");
JLoader::register('JevJoomlaVersion',JPATH_ADMINISTRATOR."/components/com_jevents/libraries/version.php");
JLoader::register('catLegend',JEV_PATH."/libraries/catLegend.php");
JLoader::register('JEventsDBModel',JEV_PATH."/libraries/dbmodel.php");
JLoader::register('JEventsDataModel',JEV_PATH."/libraries/datamodel.php");
JLoader::register('jEventCal',JEV_PATH."/libraries/jeventcal.php");
JLoader::register('jIcal',JEV_PATH."/libraries/jical.php");
JLoader::register('jIcalEventDB',JEV_PATH."/libraries/jicaleventdb.php");
JLoader::register('jIcalEventRepeat',JEV_PATH."/libraries/jicaleventrepeat.php");
JLoader::register('JEventsAbstractView',JEV_ADMINPATH."/views/abstract/abstract.php");
JLoader::register('jevFilterProcessing',JEV_PATH."/libraries/filters.php");
// TODO retire this sometime?
JLoader::register('JEV_CommonFunctions',JEV_PATH."/libraries/commonfunctions.php"); |
//App specific JavaScript//App specific JavaScript
//custom jquery to trigger dat picker, info pop-over and print category text
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip({delay: {show: 500, hide: 100}});
$('.datepicker').datepicker();
$('body').on('click', '.btn-del', function(e) {
e.preventDefault();
var msg = e.currentTarget.title;
if (msg == undefined || msg.length == 0) {
msg = "Are you sure you want to delete?";
}
var response = confirm(msg);
if (response == true) {
window.location = $(this).attr('href');
}
});
});
$('input[type="file"]').each(function() {
var $file = $(this), $form = $file.closest('.upload-form');
$file.ajaxSubmitInput({
url: '/incident/add/', //URL where you want to post the form
beforeSubmit: function($input) {
//manipulate the form before posting
},
onComplete: function($input, iframeContent, options) {
if (iframeContent) {
$input.closest('form')[0].reset();
if (!iframeContent) {
return;
}
var iframeJSON;
try {
iframeJSON = $.parseJSON(iframeContent);
//use the response data
} catch(err) {
console.log(err)
}
}
}
});
});
/*
* Adds Django's messages to the template
*/
function addMessage(text, extra_tags) {
var message = $('<div class="alert alert-' + extra_tags + '">' +
'<a href="#" class="close" data-dismiss="alert">×</a>' +
text + '</div>').hide();
$("#alerts").append(message);
message.fadeIn(50);
/*
setTimeout(function() {
message.fadeOut(500, function() {
message.remove();
});
}, 10000);
*/
}
$(document).ready(function() {
/*
* Handle change in the province drop-down; updates the distirct drop-down accordingly.
*/
// A global ajaxComplete method that shows you any messages that are set in Django's view
$( document )
.ajaxComplete(function(e, xhr, settings) {
var contentType = xhr.getResponseHeader("Content-Type");
if (contentType == "application/javascript" || contentType == "application/json") {
var json = $.parseJSON(xhr.responseText);
$.each(json.django_messages, function (i, item) {
addMessage(item.message, item.extra_tags);
});
}
})
.ajaxError(function(e, xhr, settings, thrownError) {
//addMessage("There was an error processing your request, please try again.", "error");
addMessage("Error " + xhr.status + ": " + thrownError, "danger");
});
var $loading = $('#loading');
$( document )
.ajaxStart( function() {
$loading.show();
})
.ajaxStop( function() {
$loading.hide();
});
$("select#id_province").change(function() {
var selected_province = $(this).val();
if (selected_province == undefined || selected_province == -1 || selected_province == '') {
$("select#id_district").html("<option>--Province--</option>");
} else {
var url = "/activitydb/province/" + selected_province + "/province_json/";
$.getJSON(url, function(district) {
var options = '<option value="0">--District--</option>';
for (var i = 0; i < district.length; i++) {
options += '<option value="' + district[i].pk + '">' + district[i].fields['name'] + '</option>';
}
$("select#id_district").html(options);
$("select#id_district option:first").attr('selected', 'selected');
});
}
// <API key> call if a page has implemented the '<API key>' function
if(typeof <API key> != 'undefined') <API key>(selected_country);
});
/*
* Handle change in office drop-down
*/
$("select#id_district").change(function(vent) {
var selected_distirct = $(this).val();
if (selected_distirct == -1) {
return;
}
// <API key> call if a page has implemented the '<API key>' function
if(typeof <API key> != 'undefined') <API key>(district_office);
});
});
/*
* Get a cookie by name.
*/
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
/*
* Set the csrf header before sending the actual ajax request
* while protecting csrf token from being sent to other domains
*/
$.ajaxSetup({
crossDomain: false, // obviates need for sameOrigin test
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type)) {
//console.log("csrftoken: " + getCookie('csrftoken'));
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});
/*
* Create and show a Bootstrap alert.
*/
function createAlert (type, message, fade, whereToAppend) {
if (whereToAppend == undefined ){
whereToAppend = "#alerts";
}
$(whereToAppend).append(
$(
"<div class='alert alert-" + type + " dynamic-alert alert-dismissable'>" +
"<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>" +
"<p>" + message + "</p>" +
"</div>"
)
);
if (fade == true) {
// Remove the alert after 5 seconds if the user does not close it.
$(".dynamic-alert").delay(5000).fadeOut("slow", function () { $(this).remove(); });
}
}
function buildHtmlTable(myList, selector) {
var tableHeaders = "";
var json = {"data": []};
// Get column header
$.each(myList[0], function(k,v) {
tableHeaders += "<th>" + k + "</th>";
});
$(selector).empty();
$(selector).append('<table id="failed_pas_tbl" class="display table datatable table-bordered" cellspacing="0" width="100%"><thead><tr>' + tableHeaders + '</tr></thead></table>');
for (var i=0; i<myList.length; i++){
json["data"].push([]);
$.each(myList[i], function(k,v) {
json["data"][i].push(v);
});
}
$("#failed_pas_tbl").dataTable(json);
}
var tableObject = function (json, id) {
var headerCount = new Object();
var createTHEAD = function () {
var thead = document.createElement('thead');
return thead;
}
var createTBODY = function () {
var tbody = document.createElement('tbody');
return tbody;
}
var createTR = function (id) {
var tr = document.createElement("tr");
tr.ID = id;
return tr;
};
var createTH = function (html) {
var th = document.createElement("th");
th.innerHTML = html;
return th;
};
var createTD = function (html) {
var td = document.createElement("td");
td.innerHTML = html;
return td;
};
var getName = function (id) {
for (var name in headerCount) {
if (eval("headerCount." + name) == id) {
return name;
}
}
};
var data = json.slice();
//data.forEach(function(v){ delete v.drilldown });
var pTable;
if (data.length > 0) {
var index = 0;
pTable = document.createElement("table");
var thead = createTHEAD();
var head = createTR();
for (var i = 0; i < data.length; i++) {
for (var item in data[i]) {
if (item == 'drilldown' || item == 'y') { continue };
if (!headerCount.hasOwnProperty(item)) {
head.appendChild(createTH(item));
eval('headerCount.' + item + "=" + index);
index++;
}
}
}
thead.appendChild(head);
pTable.appendChild(thead);
var tbody = createTBODY();
for (var i = 0; i < data.length; i++) {
var row = new createTR(i);
for (var j = 0; j < index; j++) {
var name = getName(j);
if (eval("data[" + i + "].hasOwnProperty('" + name + "')")) {
var cell_value = eval('data[' + i + '].' + name);
if (name == 'gait_id') {
cell_value = "<a href='https://gait.mercycorps.org/editgrant.vm?GrantID=" + cell_value + "' target='_blank'>" + cell_value + "</a>";
}
row.appendChild(createTD(cell_value));
}
}
tbody.appendChild(row);
}
pTable.appendChild(tbody);
pTable.setAttribute("id", id);
pTable.setAttribute("class", "table table-striped table-bordered table-hover table-condensed");
}
return pTable;
}; |
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lt-ie9"><![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
{% include base.html %}
<head>
{% include prod-head.html %}
</head>
<body>
{% include components/nav-help.html %}
<div class="usajobs-help-center">
{% include components/<API key>.html %}
{% include components/breadcrumbs.html %}
<section class="usajobs-shell <API key>">
<section class="usajobs-canvas">
{% include components/glossary-panel.html %}
<div class="<API key> <API key>">
<main class="<API key>" id="main-content" role="main">
<h1>{{ page.title }}</h1>
<div class="usajobs-grid usajobs-grid-full">
<div class="usa-width-one-sixth">
<img src="{{ page.imageurl }}" alt="{{ page.imageurl }} testimonial image" />
</div>
<div class="<API key>">
{{ content }}
</div>
</div>
</main>
</div>
</section>
</section>
</div>
{% include components/footer.html %}
{% include scripts.html %}
</body>
</html> |
<?php
$lang['encoding'] = 'utf-8';
$lang['direction'] = 'От ляво надясно';
$lang['menu'] = 'Модерирана дискусия';
$lang['discussion'] = 'Дискусия';
$lang['comment'] = 'Коментар';
$lang['comments'] = 'Коментари';
$lang['nocomments'] = 'Коментари';
$lang['threads'] = 'Дискусии';
$lang['url'] = 'Уеб сайт';
$lang['address'] = 'Адрес';
$lang['date'] = 'Дата';
$lang['entercomment'] = 'Въведете вашия комента';
$lang['wikisyntax'] = 'Може да ползвате Wiki синтаксис';
$lang['older'] = 'По-стари';
$lang['newer'] = 'По-нови';
$lang['btn_reply'] = 'Отговор';
$lang['btn_hide'] = 'Скрий';
$lang['btn_show'] = 'Покажи';
$lang['btn_change'] = 'Промени';
$lang['statuschanged'] = 'Променено състояние а дискусия';
$lang['wordblock'] = 'Коментарът ви е класифициран като SPAM и е блокиран.';
$lang['moderation'] = 'Коментарът ви е добавен към списъка за одобрение от модератор.';
$lang['mail_newcomment'] = 'Нов коментар';
$lang['subscribe'] = 'Абониране за коментарите';
$lang['noguests'] = 'Можете да коментирате само ако се впишете.';
$lang['status'] = 'Състояение';
$lang['off'] = 'изключено';
$lang['open'] = 'отворена';
$lang['closed'] = 'затворена';
$lang['reply'] = 'Отговор';
$lang['replies'] = 'Отговори';
$lang['newthread'] = 'Нова дискусионна страница';
$lang['toggle_display'] = 'Скрий/Покажи'; |
<?php
/**
* @file
* Contains \Drupal\entity_reference/<API key>.
*/
namespace Drupal\entity_reference;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\<API key>;
/**
* Defines route controller for entity reference.
*/
class <API key> extends ControllerBase {
/**
* The autocomplete helper for entity references.
*
* @var \Drupal\entity_reference\<API key>
*/
protected $<API key>;
/**
* Constructs a <API key> object.
*
* @param \Drupal\entity_reference\<API key> $<API key>
* The autocompletion helper for entity references.
*/
public function __construct(<API key> $<API key>) {
$this-><API key> = $<API key>;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity_reference.autocomplete'),
$container->get('entity.manager')
);
}
/**
* Autocomplete the label of an entity.
*
* @param Request $request
* The request object that contains the typed tags.
* @param string $type
* The widget type (i.e. 'single' or 'tags').
* @param string $field_name
* The name of the entity reference field.
* @param string $entity_type
* The entity type.
* @param string $bundle_name
* The bundle name.
* @param string $entity_id
* (optional) The entity ID the entity reference field is attached to.
* Defaults to ''.
*
* @throws \Symfony\Component\HttpKernel\Exception\<API key>
* Throws access denied when either the field or field instance does not
* exists or the user does not have access to edit the field.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
* The matched labels as json.
*/
public function handleAutocomplete(Request $request, $type, $field_name, $entity_type, $bundle_name, $entity_id) {
if (!$instance = field_info_instance($entity_type, $field_name, $bundle_name)) {
throw new <API key>();
}
$access_controller = $this->entityManager()->getAccessController($entity_type);
if ($instance->getType() != 'entity_reference' || !$access_controller->fieldAccess('edit', $instance)) {
throw new <API key>();
}
// Get the typed string, if exists from the URL.
$items_typed = $request->query->get('q');
$items_typed = drupal_explode_tags($items_typed);
$last_item = drupal_strtolower(array_pop($items_typed));
$prefix = '';
// The user entered a comma-separated list of entity labels, so we generate
// a prefix.
if ($type == 'tags' && !empty($last_item)) {
$prefix = count($items_typed) ? drupal_implode_tags($items_typed) . ', ' : '';
}
$matches = $this-><API key>->getMatches($instance->getField(), $instance, $entity_type, $entity_id, $prefix, $last_item);
return new JsonResponse($matches);
}
} |
#undef <API key>
#include "amctest.h"
#include "../translators/amcimporter.h"
#include "../collection.h"
#include <QTest>
QTEST_GUILESS_MAIN( AmcTest )
// this is a real basic test right now, AMC doesn't run real well under wine
void AmcTest::testImport() {
QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.amc"));
Tellico::Import::AMCImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
QVERIFY(coll);
QCOMPARE(coll->entryCount(), 2);
Tellico::Data::EntryPtr entry = coll->entryById(2);
QCOMPARE(entry->title(), QStringLiteral("Title2"));
} |
<?php
$socialPage = new QodeAdminPage("11", "Social Share");
$qodeFramework->qodeOptions->addAdminPage("socialPage",$socialPage);
//Social Share
$panel1 = new QodePanel("Social Sharing","<API key>");
$socialPage->addChild("panel1",$panel1);
$enable_social_share = new QodeField("yesno","enable_social_share","no","Enable Social Share","Enabling this option will allow social share on networks of your choice", array(),
array("dependence" => true,
"<API key>" => "",
"<API key>" => "#<API key>,#qodef_<TwitterConsumerkey>,#<API key>,#<API key>,#<API key>,#<API key>,#<API key>,#<API key>"));
$panel1->addChild("enable_social_share",$enable_social_share);
//Show Social Share
$panel9 = new QodePanel("Show Social Share","<API key>","enable_social_share","no");
$socialPage->addChild("panel9",$panel9);
$<API key> = new QodeField("flagpost","<API key>","","Posts","Show Social Share on Blog Posts");
$panel9->addChild("<API key>",$<API key>);
$<API key> = new QodeField("flagpage","<API key>","","Pages","Show Social Share on Pages");
$panel9->addChild("<API key>",$<API key>);
$<API key> = new QodeField("flagmedia","<API key>","","Media","Show Social Share for Images and Videos");
$panel9->addChild("<API key>",$<API key>);
$<API key> = new QodeField("flagportfolio","<API key>","","Portfolio Item","Show Social Share for Portfolio Items");
$panel9->addChild("<API key>",$<API key>);
if(<API key>()){
$<API key> = new QodeField("flagproduct","<API key>","","Product","Show Social Share for Product Items");
$panel9->addChild("<API key>",$<API key>);
}
//Facebook
$panel2 = new QodePanel("Facebook Share Options","<API key>","enable_social_share","no");
$socialPage->addChild("panel2",$panel2);
$<API key> = new QodeField("yesno","<API key>","no","Enable Share","Enabling this option will allow sharing via Facebook", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel2->addChild("<API key>",$<API key>);
$<API key> = new QodeContainer("<API key>","<API key>","no");
$panel2->addChild("<API key>",$<API key>);
$facebook_icon = new QodeField("image","facebook_icon","","Upload Icon","");
$<API key>->addChild("facebook_icon",$facebook_icon);
//Twitter
$panel3 = new QodePanel("Twitter Share Options","<TwitterConsumerkey>","enable_social_share","no");
$socialPage->addChild("panel3",$panel3);
$<API key> = new QodeField("yesno","<API key>","no","Enable Share","Enabling this option will allow sharing via Twitter", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#qodef_enable_<TwitterConsumerkey>"));
$panel3->addChild("<API key>",$<API key>);
$enable_<TwitterConsumerkey> = new QodeContainer("enable_<TwitterConsumerkey>","<API key>","no");
$panel3->addChild("enable_<TwitterConsumerkey>",$enable_<TwitterConsumerkey>);
$twitter_icon = new QodeField("image","twitter_icon","","Upload Icon","");
$enable_<TwitterConsumerkey>>addChild("twitter_icon",$twitter_icon);
$twitter_via = new QodeField("text","twitter_via","","Via","");
$enable_<TwitterConsumerkey>>addChild("twitter_via",$twitter_via);
//Google Plus
$panel4 = new QodePanel("Google Plus Share Options","google_share_panel","enable_social_share","no");
$socialPage->addChild("panel4",$panel4);
$enable_google_plus = new QodeField("yesno","enable_google_plus","no","Enable Share","Enabling this option will allow sharing via Google Plus", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel4->addChild("enable_google_plus",$enable_google_plus);
$<API key> = new QodeContainer("<API key>","enable_google_plus","no");
$panel4->addChild("<API key>",$<API key>);
$google_plus_icon = new QodeField("image","google_plus_icon","","Upload Icon","");
$<API key>->addChild("google_plus_icon",$google_plus_icon);
//LinkedIn
$panel5 = new QodePanel("LinkedIn Share Options","linked_share_panel","enable_social_share","no");
$socialPage->addChild("panel5",$panel5);
$enable_linkedin = new QodeField("yesno","enable_linkedin","no","Enable Share","Enabling this option will allow sharing via LinkedIn", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel5->addChild("enable_linkedin",$enable_linkedin);
$<API key> = new QodeContainer("<API key>","enable_linkedin","no");
$panel5->addChild("<API key>",$<API key>);
$linkedin_icon = new QodeField("image","linkedin_icon","","Upload Icon","");
$<API key>->addChild("linkedin_icon",$linkedin_icon);
//Tumblr
$panel6 = new QodePanel("Tumblr Share Options","tumblr_share_panel","enable_social_share","no");
$socialPage->addChild("panel6",$panel6);
$enable_tumblr = new QodeField("yesno","enable_tumblr","no","Enable Share","Enabling this option will allow sharing via Tumblr", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel6->addChild("enable_tumblr",$enable_tumblr);
$<API key> = new QodeContainer("<API key>","enable_tumblr","no");
$panel6->addChild("<API key>",$<API key>);
$tumblr_icon = new QodeField("image","tumblr_icon","","Upload Icon","");
$<API key>->addChild("tumblr_icon",$tumblr_icon);
// Pinterest
$panel7 = new QodePanel("Pinterest Share Options","<API key>","enable_social_share","no");
$socialPage->addChild("panel7",$panel7);
$enable_pinterest = new QodeField("yesno","enable_pinterest","no","Enable Share","Enabling this option will allow sharing via Tumblr", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel7->addChild("enable_pinterest",$enable_pinterest);
$<API key> = new QodeContainer("<API key>","enable_pinterest","no");
$panel7->addChild("<API key>",$<API key>);
$pinterest_icon = new QodeField("image","pinterest_icon","","Upload Icon","");
$<API key>->addChild("pinterest_icon",$pinterest_icon);
$panel8 = new QodePanel("VK Share Options","vk_share_panel","enable_social_share","no");
$socialPage->addChild("panel8",$panel8);
$enable_vk = new QodeField("yesno","enable_vk","no","Enable Share","Enabling this option will allow sharing via VK", array(), array("dependence" => true, "<API key>" => "", "<API key>" => "#<API key>"));
$panel8->addChild("enable_vk",$enable_vk);
$enable_vk_container = new QodeContainer("enable_vk_container","enable_vk","no");
$panel8->addChild("enable_vk_container",$enable_vk_container);
$vk_icon = new QodeField("image","vk_icon","","Upload Icon","");
$enable_vk_container->addChild("vk_icon",$vk_icon); |
<?php
// {{{ requires
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
require_once CLASS_EX_REALDIR . 'helper_extends/<API key>.php';
/**
* .
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: <API key>.php 21402 2012-01-17 07:15:39Z Seasoft $
*/
class <API key> extends LC_Page_Admin_Ex {
// {{{ functions
/**
* Page .
*
* @return void
*/
function init() {
parent::init();
$this->tpl_mainpage = 'design/main_edit.tpl';
$this->text_row = 13;
$this->tpl_subno = "main_edit";
$this->tpl_mainno = 'design';
$this->tpl_maintitle = '';
$this->tpl_subtitle = '';
$masterData = new SC_DB_MasterData_Ex();
$this->arrDeviceType = $masterData->getMasterData('mtb_device_type');
}
/**
* Page .
*
* @return void
*/
function process() {
$this->action();
$this->sendResponse();
}
/**
* Page .
*
* @return void
*/
function action() {
$objLayout = new <API key>();
$objFormParam = new SC_FormParam_Ex();
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_REQUEST);
$objFormParam->convParam();
$this->arrErr = $objFormParam->checkError();
$is_error = (!SC_Utils_Ex::isBlank($this->arrErr));
$this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
$this->page_id = $objFormParam->getValue('page_id');
switch ($this->getMode()) {
case 'delete':
if (!$is_error) {
if ($objLayout->isEditablePage($this->device_type_id, $this->page_id)) {
$objLayout->lfDelPageData($this->page_id, $this->device_type_id);
SC_Response_Ex::reload(array("device_type_id" => $this->device_type_id,
"msg" => "on"), true);
exit;
}
}
break;
case 'confirm':
if (!$is_error) {
$this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr);
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$result = $this->doRegister($objFormParam, $objLayout);
if ($result !== false) {
SC_Response_Ex::reload(array("device_type_id" => $this->device_type_id,
"page_id" => $result,
"msg" => "on"), true);
exit;
}
}
}
break;
default:
if (isset($_GET['msg']) && $_GET['msg'] == 'on'){
$this->tpl_onload = "alert('');";
}
}
if (!$is_error) {
$this->arrPageList = $objLayout->getPageProperties($this->device_type_id, null);
// page_id
if (!SC_Utils_Ex::isBlank($this->page_id)) {
$arrPageData = $this->getTplMainpage($this->device_type_id, $this->page_id, $objLayout);
$objFormParam->setParam($arrPageData);
}
} else {
GC_Utils_Ex::gfPrintLog('Error: ' . print_r($this->arrErr, true));
}
$this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '' . $this->tpl_subtitle;
$this->arrForm = $objFormParam->getFormParamList();
}
/**
* .
*
* @return void
*/
function destroy() {
parent::destroy();
}
/**
*
*
* XXX URL , filename
*
* @param object $objFormParam SC_FormParam
* @return void
*/
function lfInitParam(&$objFormParam) {
$objFormParam->addParam("ID", "page_id", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("ID", "device_type_id", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("", "page_name", STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("URL", "filename", STEXT_LEN, 'a', array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("", "header_chk", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("", "footer_chk", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("", "edit_flg", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("TPL", "tpl_data");
}
/**
* .
*
* @param integer $device_type_id ID
* @param integer $page_id ID
* @param <API key> $objLayout <API key>
* @return array
*/
function getTplMainpage($device_type_id, $page_id, &$objLayout){
$arrPageData = $objLayout->getPageProperties($device_type_id, $page_id);
$templatePath = $objLayout->getTemplatePath($device_type_id);
$filename = $templatePath . $arrPageData[0]['filename'] . ".tpl";
if (file_exists($filename)) {
$arrPageData[0]['tpl_data'] = file_get_contents($filename);
}
$arrPageData[0]['filename'] = preg_replace('|^' . preg_quote(USER_DIR) . '|', '', $arrPageData[0]['filename']);
return $arrPageData[0];
}
/**
* .
*
* , ,
* .
*
* @param SC_FormParam $objFormParam SC_FormParam
* @param <API key> $objLayout <API key>
* @return integer|boolean , ID;
* false
*/
function doRegister(&$objFormParam, &$objLayout) {
$filename = $objFormParam->getValue('filename');
$arrParams['device_type_id'] = $objFormParam->getValue('device_type_id');
$arrParams['page_id'] = $objFormParam->getValue('page_id');
$arrParams['header_chk'] = intval($objFormParam->getValue('header_chk')) === 1 ? 1 : 2;
$arrParams['footer_chk'] = intval($objFormParam->getValue('footer_chk')) === 1 ? 1 : 2;
$arrParams['tpl_data'] = $objFormParam->getValue('tpl_data');
$arrParams['page_name'] = $objFormParam->getValue('page_name');
$arrParams['url'] = USER_DIR . $filename . '.php';
$arrParams['filename'] = USER_DIR . $filename;
$objQuery =& SC_Query_Ex::<API key>();
$objQuery->begin();
$page_id = $this->registerPage($arrParams, $objLayout);
/*
*
* or , PHP ,
* PHP .
*/
if (SC_Utils_Ex::isBlank($arrParams['page_id'])
|| $objLayout->isEditablePage($arrParams['device_type_id'], $arrParams['page_id'])) {
if (!$this->createPHPFile($filename)) {
$this->arrErr['err'] = '※ PHP<br />';
$objQuery->rollback();
return false;
}
// $page_id
$arrParams['page_id'] = $page_id;
}
if ($objLayout->isEditablePage($arrParams['device_type_id'], $page_id)) {
$tpl_path = $objLayout->getTemplatePath($arrParams['device_type_id']) . $arrParams['filename'] . '.tpl';
} else {
$tpl_path = $objLayout->getTemplatePath($arrParams['device_type_id']) . $filename . '.tpl';
}
if (!<API key>::sfWriteFile($tpl_path, $arrParams['tpl_data'])) {
$this->arrErr['err'] = '※ TPL<br />';
$objQuery->rollback();
return false;
}
$objQuery->commit();
return $arrParams['page_id'];
}
/**
* .
*
* @param array $arrParams
* @param <API key> $objLayout <API key>
* @return integer ID
*/
function registerPage($arrParams, &$objLayout) {
$objQuery =& SC_Query_Ex::<API key>();
$is_new = SC_Utils_Ex::isBlank($arrParams['page_id']);
if (!$is_new) {
$arrExists = $objLayout->getPageProperties($arrParams['device_type_id'], $arrParams['page_id']);
}
$table = 'dtb_pagelayout';
$arrValues = $objQuery->extractOnlyColsOf($table, $arrParams);
$arrValues['update_url'] = $_SERVER['HTTP_REFERER'];
$arrValues['update_date'] = 'CURRENT_TIMESTAMP';
if ($is_new || SC_Utils_Ex::isBlank($arrExists)) {
$objQuery->setOrder('');
$arrValues['page_id'] = 1 + $objQuery->max('page_id', $table, 'device_type_id = ?',
array($arrValues['device_type_id']));
$arrValues['create_date'] = 'CURRENT_TIMESTAMP';
$objQuery->insert($table, $arrValues);
}
else {
if (!$objLayout->isEditablePage($arrValues['device_type_id'], $arrValues['page_id'])) {
unset($arrValues['page_name']);
unset($arrValues['filename']);
unset($arrValues['url']);
}
$objQuery->update($table, $arrValues, 'page_id = ? AND device_type_id = ?',
array($arrValues['page_id'], $arrValues['device_type_id']));
}
return $arrValues['page_id'];
}
/**
* .
*
* @param SC_FormParam $objFormParam SC_FormParam
* @return array
*/
function lfCheckError(&$objFormParam, &$arrErr) {
$arrParams = $objFormParam->getHashArray();
$objErr = new SC_CheckError_Ex($arrParams);
$objErr->arrErr =& $arrErr;
$objErr->doFunc(array("", "page_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array('URL', 'filename', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
/*
* URL
* , SC_CheckError::URL_CHECK()
*
*/
$valid_url = true;
foreach (explode('/', $arrParams['filename']) as $val) {
if (!preg_match('/^[a-zA-Z0-9:_~\.\-]+$/', $val)) {
$valid_url = false;
}
if ($val == '.' || $val == '..') {
$valid_url = false;
}
}
if (!$valid_url) {
$objErr->arrErr['filename'] = "※ URL<br />";
}
// URL
$where = 'page_id <> 0 AND device_type_id = ? AND filename = ?';
$arrValues = array($arrParams['device_type_id'], USER_DIR . $arrParams['filename']);
// URL
if (!SC_Utils_Ex::isBlank($arrParams['page_id'])) {
$where .= ' AND page_id <> ?';
$arrValues[] = $arrParams['page_id'];
}
$objQuery =& SC_Query_Ex::<API key>();
$count = $objQuery->count('dtb_pagelayout', $where, $arrValues);
if ($count > 0) {
$objErr->arrErr['filename'] = '※ URLURL<br />';
}
return $objErr->arrErr;
}
/**
* PHP .
*
* PHP true .(#831)
*
* @param string $filename filename
* @return boolean true
*/
function createPHPFile($filename) {
$path = USER_REALDIR . $filename . '.php';
if (file_exists($path)) {
return true;
}
if (file_exists(<API key>)) {
$php_contents = file_get_contents(<API key>);
} else {
return false;
}
// require.php PATH
$defaultStrings = "exit; // Don't rewrite. This line is rewritten by EC-CUBE.";
$replaceStrings = "require_once '" . str_repeat('../', substr_count($filename, '/')) . "../require.php';";
$php_contents = str_replace($defaultStrings, $replaceStrings, $php_contents);
return <API key>::sfWriteFile($path, $php_contents);
}
}
?> |
<?php
namespace Drupal\ui_patterns\Form;
use Drupal\Component\Utility\SortArray;
use Drupal\ui_patterns\Plugin\PatternSourceBase;
/**
* Trait <API key>.
*
* @property \Drupal\ui_patterns\UiPatternsManager $patternsManager
* @property \Drupal\ui_patterns\<API key> $sourceManager
* @method \Drupal\Core\StringTranslation\TranslatableMarkup t($string, array $args = [], array $options = [])
*
* @package Drupal\ui_patterns\Form
*/
trait <API key> {
/**
* Build pattern display form.
*
* @param array $form
* Form array.
* @param string $tag
* Source field tag.
* @param array $context
* Plugin context.
* @param array $configuration
* Default configuration coming form the host form.
*/
public function <API key>(array &$form, $tag, array $context, array $configuration) {
$form['pattern'] = [
'#type' => 'select',
'#empty_value' => '_none',
'#title' => $this->t('Pattern'),
'#options' => $this->patternsManager->getPatternsOptions(),
'#default_value' => isset($configuration['pattern']) ? $configuration['pattern'] : NULL,
'#required' => TRUE,
'#attributes' => ['id' => 'patterns-select'],
];
foreach ($this->patternsManager->getDefinitions() as $pattern_id => $definition) {
$form['pattern_mapping'][$pattern_id] = [
'#type' => 'container',
'#states' => [
'visible' => [
'select[id="patterns-select"]' => ['value' => $pattern_id],
],
],
];
$form['pattern_mapping'][$pattern_id]['settings'] = $this->getMappingForm($pattern_id, $tag, $context, $configuration);
}
}
/**
* Get mapping form.
*
* @param string $pattern_id
* Pattern ID for which to print the mapping form for.
* @param string $tag
* Source field plugin tag.
* @param array $context
* Plugin context.
* @param array $configuration
* Default configuration coming form the host form.
*
* @return array
* Mapping form.
*/
public function getMappingForm($pattern_id, $tag, array $context, array $configuration) {
/** @var \Drupal\ui_patterns\Definition\PatternDefinition $pattern */
$pattern = $this->patternsManager->getDefinition($pattern_id);
$elements = [
'#type' => 'table',
'#header' => [
$this->t('Source'),
$this->t('Plugin'),
$this->t('Destination'),
$this->t('Weight'),
],
];
$elements['#tabledrag'][] = [
'action' => 'order',
'relationship' => 'sibling',
'group' => 'field-weight',
];
$destinations = ['_hidden' => $this->t('- Hidden -')] + $pattern->getFieldsAsOptions();
$fields = [];
foreach ($this->sourceManager->getFieldsByTag($tag, $context) as $field_name => $field) {
$weight = (int) $this->getDefaultValue($configuration, $field_name, 'weight');
$fields[$field_name] = [
'info' => [
'#plain_text' => $field->getFieldLabel(),
],
'plugin' => [
'#plain_text' => $field->getPluginLabel(),
],
'destination' => [
'#type' => 'select',
'#title' => $this->t('Destination for @field', ['@field' => $field->getFieldLabel()]),
'#title_display' => 'invisible',
'#default_value' => $this->getDefaultValue($configuration, $field_name, 'destination'),
'#options' => $destinations,
],
'weight' => [
'#type' => 'weight',
'#default_value' => $weight,
'#delta' => 20,
'#title' => $this->t('Weight for @field field', ['@field' => $field->getFieldLabel()]),
'#title_display' => 'invisible',
'#attributes' => [
'class' => ['field-weight'],
],
],
'#attributes' => [
'class' => ['draggable'],
],
'#weight' => $weight,
];
}
uasort($fields, [SortArray::class, '<API key>']);
return array_merge($elements, $fields);
}
/**
* Normalize settings coming from a form submission.
*
* @param array $settings
* Pattern display form values array.
*/
static public function <API key>(array &$settings) {
// Normalize only when necessary.
if (isset($settings['pattern_mapping'][$settings['pattern']]['settings'])) {
$settings['pattern_mapping'] = $settings['pattern_mapping'][$settings['pattern']]['settings'];
// Process fields and filter out the hidden ones.
foreach ($settings['pattern_mapping'] as $key => $setting) {
if ($setting['destination'] == '_hidden') {
unset($settings['pattern_mapping'][$key]);
}
else {
list($plugin, $source) = explode(PatternSourceBase::<API key>, $key);
$settings['pattern_mapping'][$key]['plugin'] = $plugin;
$settings['pattern_mapping'][$key]['source'] = $source;
}
}
// Normalize weights.
$weight = 0;
uasort($settings['pattern_mapping'], [SortArray::class, 'sortByWeightElement']);
foreach ($settings['pattern_mapping'] as $key => $setting) {
$settings['pattern_mapping'][$key]['weight'] = $weight++;
}
}
}
/**
* Helper function: return mapping destination given plugin id and field name.
*
* @param string $plugin
* Current plugin ID.
* @param string $source
* Source field name.
* @param array $settings
* Setting array.
*
* @return string|null
* Destination field or NULL if none found.
*/
public function <API key>($plugin, $source, array $settings) {
$mapping_id = $plugin . PatternSourceBase::<API key> . $source;
if (isset($settings['pattern_mapping'][$mapping_id])) {
return $settings['pattern_mapping'][$mapping_id]['destination'];
}
return NULL;
}
/**
* Helper function: check if given source field has mapping destination.
*
* @param string $plugin
* Current plugin ID.
* @param string $source
* Source field name.
* @param array $settings
* Setting array.
*
* @return bool
* TRUE if source has destination field, FALSE otherwise.
*/
public function <API key>($plugin, $source, array $settings) {
return $this-><API key>($plugin, $source, $settings) !== NULL;
}
/**
* Helper function: get default value.
*
* @param array $configuration
* Configuration.
* @param string $field_name
* Field name.
* @param string $value
* Value name.
*
* @return string
* Field property value.
*/
protected function getDefaultValue(array $configuration, $field_name, $value) {
if (isset($configuration['pattern_mapping'][$field_name][$value])) {
return $configuration['pattern_mapping'][$field_name][$value];
}
return NULL;
}
} |
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "dumpfile.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
#include "domwalk.h"
#include "cfgloop.h"
#include "tree-cfgcleanup.h"
/* This file implements a generic value propagation engine based on
the same propagation used by the SSA-CCP algorithm [1].
Propagation is performed by simulating the execution of every
statement that produces the value being propagated. Simulation
proceeds as follows:
1- Initially, all edges of the CFG are marked not executable and
the CFG worklist is seeded with all the statements in the entry
basic block (block 0).
2- Every statement S is simulated with a call to the call-back
function SSA_PROP_VISIT_STMT. This evaluation may produce 3
results:
<API key>: Statement S produces nothing of
interest and does not affect any of the work lists.
SSA_PROP_VARYING: The value produced by S cannot be determined
at compile time. Further simulation of S is not required.
If S is a conditional jump, all the outgoing edges for the
block are considered executable and added to the work
list.
<API key>: S produces a value that can be computed
at compile time. Its result can be propagated into the
statements that feed from S. Furthermore, if S is a
conditional jump, only the edge known to be taken is added
to the work list. Edges that are known not to execute are
never simulated.
3- PHI nodes are simulated with a call to SSA_PROP_VISIT_PHI. The
return value from SSA_PROP_VISIT_PHI has the same semantics as
described in #2.
4- Three work lists are kept. Statements are only added to these
lists if they produce one of <API key> or
SSA_PROP_VARYING.
CFG_BLOCKS contains the list of blocks to be simulated.
Blocks are added to this list if their incoming edges are
found executable.
VARYING_SSA_EDGES contains the list of statements that feed
from statements that produce an SSA_PROP_VARYING result.
These are simulated first to speed up processing.
<API key> contains the list of statements that
feed from statements that produce an <API key>
result.
5- Simulation terminates when all three work lists are drained.
Before calling ssa_propagate, it is important to clear
<API key> for all the statements in the program that
should be simulated. This initialization allows an implementation
to specify which statements should never be simulated.
It is also important to compute def-use information before calling
ssa_propagate.
References:
[1] Constant propagation with conditional branches,
Wegman and Zadeck, ACM TOPLAS 13(2):181-210.
[2] Building an Optimizing Compiler,
Robert Morgan, <API key>, 1998, Section 8.9.
[3] Advanced Compiler Design and Implementation,
Steven Muchnick, Morgan Kaufmann, 1997, Section 12.6 */
/* Function pointers used to parameterize the propagation engine. */
static <API key> ssa_prop_visit_stmt;
static <API key> ssa_prop_visit_phi;
/* Keep track of statements that have been added to one of the SSA
edges worklists. This flag is used to avoid visiting statements
unnecessarily when draining an SSA edge worklist. If while
simulating a basic block, we find a statement with
<API key> set, we clear it to prevent SSA edge
processing from visiting it again.
NOTE: users of the propagation engine are not allowed to use
the GF_PLF_1 flag. */
#define <API key> GF_PLF_1
/* A bitmap to keep track of executable blocks in the CFG. */
static sbitmap executable_blocks;
/* Array of control flow edges on the worklist. */
static vec<basic_block> cfg_blocks;
static unsigned int cfg_blocks_num = 0;
static int cfg_blocks_tail;
static int cfg_blocks_head;
static sbitmap bb_in_list;
/* Worklist of SSA edges which will need reexamination as their
definition has changed. SSA edges are def-use edges in the SSA
web. For each D-U edge, we store the target statement or PHI node
U. */
static vec<gimple *> <API key>;
/* Identical to <API key>. For performance reasons, the
list of SSA edges is split into two. One contains all SSA edges
who need to be reexamined because their lattice value changed to
varying (this worklist), and the other contains all other SSA edges
to be reexamined (<API key>).
Since most values in the program are VARYING, the ideal situation
is to move them to that lattice value as quickly as possible.
Thus, it doesn't make sense to process any other type of lattice
value until all VARYING values are propagated fully, which is one
thing using the VARYING worklist achieves. In addition, if we
don't use a separate worklist for VARYING edges, we end up with
situations where lattice values move from
UNDEFINED->INTERESTING->VARYING instead of UNDEFINED->VARYING. */
static vec<gimple *> varying_ssa_edges;
/* Return true if the block worklist empty. */
static inline bool
cfg_blocks_empty_p (void)
{
return (cfg_blocks_num == 0);
}
/* Add a basic block to the worklist. The block must not be already
in the worklist, and it must not be the ENTRY or EXIT block. */
static void
cfg_blocks_add (basic_block bb)
{
bool head = false;
gcc_assert (bb != <API key> (cfun)
&& bb != <API key> (cfun));
gcc_assert (!bitmap_bit_p (bb_in_list, bb->index));
if (cfg_blocks_empty_p ())
{
cfg_blocks_tail = cfg_blocks_head = 0;
cfg_blocks_num = 1;
}
else
{
cfg_blocks_num++;
if (cfg_blocks_num > cfg_blocks.length ())
{
/* We have to grow the array now. Adjust to queue to occupy
the full space of the original array. We do not need to
initialize the newly allocated portion of the array
because we keep track of CFG_BLOCKS_HEAD and
CFG_BLOCKS_HEAD. */
cfg_blocks_tail = cfg_blocks.length ();
cfg_blocks_head = 0;
cfg_blocks.safe_grow (2 * cfg_blocks_tail);
}
/* Minor optimization: we prefer to see blocks with more
predecessors later, because there is more of a chance that
the incoming edges will be executable. */
else if (EDGE_COUNT (bb->preds)
>= EDGE_COUNT (cfg_blocks[cfg_blocks_head]->preds))
cfg_blocks_tail = ((cfg_blocks_tail + 1) % cfg_blocks.length ());
else
{
if (cfg_blocks_head == 0)
cfg_blocks_head = cfg_blocks.length ();
--cfg_blocks_head;
head = true;
}
}
cfg_blocks[head ? cfg_blocks_head : cfg_blocks_tail] = bb;
bitmap_set_bit (bb_in_list, bb->index);
}
/* Remove a block from the worklist. */
static basic_block
cfg_blocks_get (void)
{
basic_block bb;
bb = cfg_blocks[cfg_blocks_head];
gcc_assert (!cfg_blocks_empty_p ());
gcc_assert (bb);
cfg_blocks_head = ((cfg_blocks_head + 1) % cfg_blocks.length ());
--cfg_blocks_num;
bitmap_clear_bit (bb_in_list, bb->index);
return bb;
}
/* We have just defined a new value for VAR. If IS_VARYING is true,
add all immediate uses of VAR to VARYING_SSA_EDGES, otherwise add
them to <API key>. */
static void
add_ssa_edge (tree var, bool is_varying)
{
imm_use_iterator iter;
use_operand_p use_p;
<API key> (use_p, iter, var)
{
gimple *use_stmt = USE_STMT (use_p);
if (<API key> (use_stmt)
&& !gimple_plf (use_stmt, <API key>))
{
gimple_set_plf (use_stmt, <API key>, true);
if (is_varying)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "varying_ssa_edges: adding SSA use in ");
print_gimple_stmt (dump_file, use_stmt, 0, TDF_SLIM);
}
varying_ssa_edges.safe_push (use_stmt);
}
else
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "<API key>: adding SSA use in ");
print_gimple_stmt (dump_file, use_stmt, 0, TDF_SLIM);
}
<API key>.safe_push (use_stmt);
}
}
}
}
/* Add edge E to the control flow worklist. */
static void
add_control_edge (edge e)
{
basic_block bb = e->dest;
if (bb == <API key> (cfun))
return;
/* If the edge had already been executed, skip it. */
if (e->flags & EDGE_EXECUTABLE)
return;
e->flags |= EDGE_EXECUTABLE;
/* If the block is already in the list, we're done. */
if (bitmap_bit_p (bb_in_list, bb->index))
return;
cfg_blocks_add (bb);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Adding destination of edge (%d -> %d) to worklist\n",
e->src->index, e->dest->index);
}
/* Simulate the execution of STMT and update the work lists accordingly. */
static void
simulate_stmt (gimple *stmt)
{
enum ssa_prop_result val = <API key>;
edge taken_edge = NULL;
tree output_name = NULL_TREE;
/* Don't bother visiting statements that are already
considered varying by the propagator. */
if (!<API key> (stmt))
return;
if (gimple_code (stmt) == GIMPLE_PHI)
{
val = ssa_prop_visit_phi (as_a <gphi *> (stmt));
output_name = gimple_phi_result (stmt);
}
else
val = ssa_prop_visit_stmt (stmt, &taken_edge, &output_name);
if (val == SSA_PROP_VARYING)
{
<API key> (stmt, false);
/* If the statement produced a new varying value, add the SSA
edges coming out of OUTPUT_NAME. */
if (output_name)
add_ssa_edge (output_name, true);
/* If STMT transfers control out of its basic block, add
all outgoing edges to the work list. */
if (stmt_ends_bb_p (stmt))
{
edge e;
edge_iterator ei;
basic_block bb = gimple_bb (stmt);
FOR_EACH_EDGE (e, ei, bb->succs)
add_control_edge (e);
}
return;
}
else if (val == <API key>)
{
/* If the statement produced new value, add the SSA edges coming
out of OUTPUT_NAME. */
if (output_name)
add_ssa_edge (output_name, false);
/* If we know which edge is going to be taken out of this block,
add it to the CFG work list. */
if (taken_edge)
add_control_edge (taken_edge);
}
/* If there are no SSA uses on the stmt whose defs are simulated
again then this stmt will be never visited again. */
bool <API key> = false;
use_operand_p use_p;
ssa_op_iter iter;
if (gimple_code (stmt) == GIMPLE_PHI)
{
edge_iterator ei;
edge e;
tree arg;
FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->preds)
if (!(e->flags & EDGE_EXECUTABLE)
|| ((arg = <API key> (stmt, e))
&& TREE_CODE (arg) == SSA_NAME
&& !<API key> (arg)
&& <API key> (SSA_NAME_DEF_STMT (arg))))
{
<API key> = true;
break;
}
}
else
<API key> (use_p, stmt, iter, SSA_OP_USE)
{
gimple *def_stmt = SSA_NAME_DEF_STMT (USE_FROM_PTR (use_p));
if (!gimple_nop_p (def_stmt)
&& <API key> (def_stmt))
{
<API key> = true;
break;
}
}
if (!<API key>)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "marking stmt to be not simulated again\n");
<API key> (stmt, false);
}
}
/* Process an SSA edge worklist. WORKLIST is the SSA edge worklist to
drain. This pops statements off the given WORKLIST and processes
them until one statement was simulated or there are no more statements
on WORKLIST. We take a pointer to WORKLIST because it may be reallocated
when an SSA edge is added to it in simulate_stmt. Return true if a stmt
was simulated. */
static bool
<API key> (vec<gimple *> *worklist, const char *edge_list_name)
{
/* Process the next entry from the worklist. */
while (worklist->length () > 0)
{
basic_block bb;
/* Pull the statement to simulate off the worklist. */
gimple *stmt = worklist->pop ();
/* If this statement was already visited by simulate_block, then
we don't need to visit it again here. */
if (!gimple_plf (stmt, <API key>))
continue;
/* STMT is no longer in a worklist. */
gimple_set_plf (stmt, <API key>, false);
bb = gimple_bb (stmt);
/* Visit the statement only if its block is marked executable.
If it is not executable then it will be visited when we simulate
all statements in the block as soon as an incoming edge gets
marked executable. */
if (!bitmap_bit_p (executable_blocks, bb->index))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nDropping statement from SSA worklist: ");
print_gimple_stmt (dump_file, stmt, 0, dump_flags);
}
continue;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nSimulating statement (from %s): ",
edge_list_name);
print_gimple_stmt (dump_file, stmt, 0, dump_flags);
}
simulate_stmt (stmt);
return true;
}
return false;
}
/* Simulate the execution of BLOCK. Evaluate the statement associated
with each variable reference inside the block. */
static void
simulate_block (basic_block block)
{
<API key> gsi;
/* There is nothing to do for the exit block. */
if (block == <API key> (cfun))
return;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nSimulating block %d\n", block->index);
/* Always simulate PHI nodes, even if we have simulated this block
before. */
for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
simulate_stmt (gsi_stmt (gsi));
/* If this is the first time we've simulated this block, then we
must simulate each of its statements. */
if (!bitmap_bit_p (executable_blocks, block->index))
{
<API key> j;
unsigned int normal_edge_count;
edge e, normal_edge;
edge_iterator ei;
/* Note that we have simulated this block. */
bitmap_set_bit (executable_blocks, block->index);
for (j = gsi_start_bb (block); !gsi_end_p (j); gsi_next (&j))
{
gimple *stmt = gsi_stmt (j);
/* If this statement is already in the worklist then
"cancel" it. The reevaluation implied by the worklist
entry will produce the same value we generate here and
thus reevaluating it again from the worklist is
pointless. */
if (gimple_plf (stmt, <API key>))
gimple_set_plf (stmt, <API key>, false);
simulate_stmt (stmt);
}
/* We can not predict when abnormal and EH edges will be executed, so
once a block is considered executable, we consider any
outgoing abnormal edges as executable.
TODO: This is not exactly true. Simplifying statement might
prove it non-throwing and also computed goto can be handled
when destination is known.
At the same time, if this block has only one successor that is
reached by non-abnormal edges, then add that successor to the
worklist. */
normal_edge_count = 0;
normal_edge = NULL;
FOR_EACH_EDGE (e, ei, block->succs)
{
if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
add_control_edge (e);
else
{
normal_edge_count++;
normal_edge = e;
}
}
if (normal_edge_count == 1)
add_control_edge (normal_edge);
}
}
/* Initialize local data structures and work lists. */
static void
ssa_prop_init (void)
{
edge e;
edge_iterator ei;
basic_block bb;
/* Worklists of SSA edges. */
<API key>.create (20);
varying_ssa_edges.create (20);
executable_blocks = sbitmap_alloc (<API key> (cfun));
bitmap_clear (executable_blocks);
bb_in_list = sbitmap_alloc (<API key> (cfun));
bitmap_clear (bb_in_list);
if (dump_file && (dump_flags & TDF_DETAILS))
dump_immediate_uses (dump_file);
cfg_blocks.create (20);
cfg_blocks.safe_grow_cleared (20);
/* Initially assume that every edge in the CFG is not executable.
(including the edges coming out of the entry block). */
FOR_ALL_BB_FN (bb, cfun)
{
<API key> si;
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
gimple_set_plf (gsi_stmt (si), <API key>, false);
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
gimple_set_plf (gsi_stmt (si), <API key>, false);
FOR_EACH_EDGE (e, ei, bb->succs)
e->flags &= ~EDGE_EXECUTABLE;
}
/* Seed the algorithm by adding the successors of the entry block to the
edge worklist. */
FOR_EACH_EDGE (e, ei, <API key> (cfun)->succs)
add_control_edge (e);
}
/* Free allocated storage. */
static void
ssa_prop_fini (void)
{
<API key>.release ();
varying_ssa_edges.release ();
cfg_blocks.release ();
sbitmap_free (bb_in_list);
sbitmap_free (executable_blocks);
}
/* Return true if EXPR is an acceptable right-hand-side for a
GIMPLE assignment. We validate the entire tree, not just
the root node, thus catching expressions that embed complex
operands that are not permitted in GIMPLE. This function
is needed because the folding routines in fold-const.c
may return such expressions in some cases, e.g., an array
access with an embedded index addition. It may make more
sense to have folding routines that are sensitive to the
constraints on GIMPLE operands, rather than abandoning any
any attempt to fold if the usual folding turns out to be too
aggressive. */
bool
valid_gimple_rhs_p (tree expr)
{
enum tree_code code = TREE_CODE (expr);
switch (TREE_CODE_CLASS (code))
{
case tcc_declaration:
if (!is_gimple_variable (expr))
return false;
break;
case tcc_constant:
/* All constants are ok. */
break;
case tcc_comparison:
/* GENERIC allows comparisons with non-boolean types, reject
those for GIMPLE. Let vector-typed comparisons pass - rules
for GENERIC and GIMPLE are the same here. */
if (!(INTEGRAL_TYPE_P (TREE_TYPE (expr))
&& (TREE_CODE (TREE_TYPE (expr)) == BOOLEAN_TYPE
|| TYPE_PRECISION (TREE_TYPE (expr)) == 1))
&& ! VECTOR_TYPE_P (TREE_TYPE (expr)))
return false;
/* Fallthru. */
case tcc_binary:
if (!is_gimple_val (TREE_OPERAND (expr, 0))
|| !is_gimple_val (TREE_OPERAND (expr, 1)))
return false;
break;
case tcc_unary:
if (!is_gimple_val (TREE_OPERAND (expr, 0)))
return false;
break;
case tcc_expression:
switch (code)
{
case ADDR_EXPR:
{
tree t;
if (<API key> (expr))
return true;
t = TREE_OPERAND (expr, 0);
while (handled_component_p (t))
{
/* ??? More checks needed, see the GIMPLE verifier. */
if ((TREE_CODE (t) == ARRAY_REF
|| TREE_CODE (t) == ARRAY_RANGE_REF)
&& !is_gimple_val (TREE_OPERAND (t, 1)))
return false;
t = TREE_OPERAND (t, 0);
}
if (!is_gimple_id (t))
return false;
}
break;
default:
if (<API key> (code) == GIMPLE_TERNARY_RHS)
{
if (((code == VEC_COND_EXPR || code == COND_EXPR)
? !is_gimple_condexpr (TREE_OPERAND (expr, 0))
: !is_gimple_val (TREE_OPERAND (expr, 0)))
|| !is_gimple_val (TREE_OPERAND (expr, 1))
|| !is_gimple_val (TREE_OPERAND (expr, 2)))
return false;
break;
}
return false;
}
break;
case tcc_vl_exp:
return false;
case tcc_exceptional:
if (code == CONSTRUCTOR)
{
unsigned i;
tree elt;
<API key> (CONSTRUCTOR_ELTS (expr), i, elt)
if (!is_gimple_val (elt))
return false;
return true;
}
if (code != SSA_NAME)
return false;
break;
case tcc_reference:
if (code == BIT_FIELD_REF)
return is_gimple_val (TREE_OPERAND (expr, 0));
return false;
default:
return false;
}
return true;
}
/* Return true if EXPR is a CALL_EXPR suitable for representation
as a single GIMPLE_CALL statement. If the arguments require
further gimplification, return false. */
static bool
valid_gimple_call_p (tree expr)
{
unsigned i, nargs;
if (TREE_CODE (expr) != CALL_EXPR)
return false;
nargs = call_expr_nargs (expr);
for (i = 0; i < nargs; i++)
{
tree arg = CALL_EXPR_ARG (expr, i);
if (is_gimple_reg_type (TREE_TYPE (arg)))
{
if (!is_gimple_val (arg))
return false;
}
else
if (!is_gimple_lvalue (arg))
return false;
}
return true;
}
/* Make SSA names defined by OLD_STMT point to NEW_STMT
as their defining statement. */
void
<API key> (gimple *new_stmt, gimple *old_stmt)
{
tree var;
ssa_op_iter iter;
if (gimple_in_ssa_p (cfun))
{
/* Make defined SSA_NAMEs point to the new
statement as their definition. */
<API key> (var, old_stmt, iter, SSA_OP_ALL_DEFS)
{
if (TREE_CODE (var) == SSA_NAME)
SSA_NAME_DEF_STMT (var) = new_stmt;
}
}
}
/* Helper function for update_gimple_call and <API key>.
A GIMPLE_CALL STMT is being replaced with GIMPLE_CALL NEW_STMT. */
static void
<API key> (<API key> *si_p, gimple *new_stmt,
gimple *stmt)
{
gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
<API key> (new_stmt, stmt);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
gimple_set_vdef (new_stmt, gimple_vdef (stmt));
gimple_set_location (new_stmt, gimple_location (stmt));
if (gimple_block (new_stmt) == NULL_TREE)
gimple_set_block (new_stmt, gimple_block (stmt));
gsi_replace (si_p, new_stmt, false);
}
/* Update a GIMPLE_CALL statement at iterator *SI_P to call to FN
with number of arguments NARGS, where the arguments in GIMPLE form
follow NARGS argument. */
bool
update_gimple_call (<API key> *si_p, tree fn, int nargs, ...)
{
va_list ap;
gcall *new_stmt, *stmt = as_a <gcall *> (gsi_stmt (*si_p));
gcc_assert (is_gimple_call (stmt));
va_start (ap, nargs);
new_stmt = <API key> (fn, nargs, ap);
<API key> (si_p, new_stmt, stmt);
va_end (ap);
return true;
}
/* Update a GIMPLE_CALL statement at iterator *SI_P to reflect the
value of EXPR, which is expected to be the result of folding the
call. This can only be done if EXPR is a CALL_EXPR with valid
GIMPLE operands as arguments, or if it is a suitable RHS expression
for a GIMPLE_ASSIGN. More complex expressions will require
gimplification, which will introduce additional statements. In this
event, no update is performed, and the function returns false.
Note that we cannot mutate a GIMPLE_CALL in-place, so we always
replace the statement at *SI_P with an entirely new statement.
The new statement need not be a call, e.g., if the original call
folded to a constant. */
bool
<API key> (<API key> *si_p, tree expr)
{
gimple *stmt = gsi_stmt (*si_p);
if (valid_gimple_call_p (expr))
{
/* The call has simplified to another call. */
tree fn = CALL_EXPR_FN (expr);
unsigned i;
unsigned nargs = call_expr_nargs (expr);
vec<tree> args = vNULL;
gcall *new_stmt;
if (nargs > 0)
{
args.create (nargs);
args.safe_grow_cleared (nargs);
for (i = 0; i < nargs; i++)
args[i] = CALL_EXPR_ARG (expr, i);
}
new_stmt = <API key> (fn, args);
<API key> (si_p, new_stmt, stmt);
args.release ();
return true;
}
else if (valid_gimple_rhs_p (expr))
{
tree lhs = gimple_call_lhs (stmt);
gimple *new_stmt;
/* The call has simplified to an expression
that cannot be represented as a GIMPLE_CALL. */
if (lhs)
{
/* A value is expected.
Introduce a new GIMPLE_ASSIGN statement. */
<API key> (expr);
new_stmt = gimple_build_assign (lhs, expr);
<API key> (new_stmt, stmt);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
gimple_set_vdef (new_stmt, gimple_vdef (stmt));
}
else if (!TREE_SIDE_EFFECTS (expr))
{
/* No value is expected, and EXPR has no effect.
Replace it with an empty statement. */
new_stmt = gimple_build_nop ();
if (gimple_in_ssa_p (cfun))
{
unlink_stmt_vdef (stmt);
release_defs (stmt);
}
}
else
{
/* No value is expected, but EXPR has an effect,
e.g., it could be a reference to a volatile
variable. Create an assignment statement
with a dummy (unused) lhs variable. */
<API key> (expr);
if (gimple_in_ssa_p (cfun))
lhs = make_ssa_name (TREE_TYPE (expr));
else
lhs = create_tmp_var (TREE_TYPE (expr));
new_stmt = gimple_build_assign (lhs, expr);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
gimple_set_vdef (new_stmt, gimple_vdef (stmt));
<API key> (new_stmt, stmt);
}
gimple_set_location (new_stmt, gimple_location (stmt));
gsi_replace (si_p, new_stmt, false);
return true;
}
else
/* The call simplified to an expression that is
not a valid GIMPLE RHS. */
return false;
}
/* Entry point to the propagation engine.
VISIT_STMT is called for every statement visited.
VISIT_PHI is called for every PHI node visited. */
void
ssa_propagate (<API key> visit_stmt,
<API key> visit_phi)
{
ssa_prop_visit_stmt = visit_stmt;
ssa_prop_visit_phi = visit_phi;
ssa_prop_init ();
/* Iterate until the worklists are empty. */
while (!cfg_blocks_empty_p ()
|| <API key>.length () > 0
|| varying_ssa_edges.length () > 0)
{
if (!cfg_blocks_empty_p ())
{
/* Pull the next block to simulate off the worklist. */
basic_block dest_block = cfg_blocks_get ();
simulate_block (dest_block);
continue;
}
/* In order to move things to varying as quickly as
possible,process the VARYING_SSA_EDGES worklist first. */
if (<API key> (&varying_ssa_edges, "varying_ssa_edges"))
continue;
/* Now process the <API key> worklist. */
<API key> (&<API key>,
"<API key>");
}
ssa_prop_fini ();
}
/* Return true if STMT is of the form 'mem_ref = RHS', where 'mem_ref'
is a non-volatile pointer dereference, a structure reference or a
reference to a single _DECL. Ignore volatile memory references
because they are not interesting for the optimizers. */
bool
<API key> (gimple *stmt)
{
tree lhs;
if (gimple_code (stmt) != GIMPLE_ASSIGN
&& gimple_code (stmt) != GIMPLE_CALL)
return false;
if (!gimple_vdef (stmt))
return false;
lhs = gimple_get_lhs (stmt);
/* A call statement may have a null LHS. */
if (!lhs)
return false;
return (!TREE_THIS_VOLATILE (lhs)
&& (DECL_P (lhs)
|| REFERENCE_CLASS_P (lhs)));
}
/* Propagation statistics. */
struct prop_stats_d
{
long num_const_prop;
long num_copy_prop;
long num_stmts_folded;
long num_dce;
};
static struct prop_stats_d prop_stats;
/* Replace USE references in statement STMT with the values stored in
PROP_VALUE. Return true if at least one reference was replaced. */
static bool
replace_uses_in (gimple *stmt, <API key> get_value)
{
bool replaced = false;
use_operand_p use;
ssa_op_iter iter;
<API key> (use, stmt, iter, SSA_OP_USE)
{
tree tuse = USE_FROM_PTR (use);
tree val = (*get_value) (tuse);
if (val == tuse || val == NULL_TREE)
continue;
if (gimple_code (stmt) == GIMPLE_ASM
&& !<API key> (tuse))
continue;
if (!may_propagate_copy (tuse, val))
continue;
if (TREE_CODE (val) != SSA_NAME)
prop_stats.num_const_prop++;
else
prop_stats.num_copy_prop++;
propagate_value (use, val);
replaced = true;
}
return replaced;
}
/* Replace propagated values into all the arguments for PHI using the
values from PROP_VALUE. */
static bool
replace_phi_args_in (gphi *phi, <API key> get_value)
{
size_t i;
bool replaced = false;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Folding PHI node: ");
print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
}
basic_block bb = gimple_bb (phi);
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = gimple_phi_arg_def (phi, i);
if (TREE_CODE (arg) == SSA_NAME)
{
tree val = (*get_value) (arg);
if (val && val != arg && may_propagate_copy (arg, val))
{
edge e = gimple_phi_arg_edge (phi, i);
/* Avoid propagating constants into loop latch edge
PHI arguments as this makes coalescing the copy
across this edge impossible. If the argument is
defined by an assert - otherwise the stmt will
get removed without replacing its uses. */
if (TREE_CODE (val) != SSA_NAME
&& bb->loop_father->header == bb
&& dominated_by_p (CDI_DOMINATORS, e->src, bb)
&& is_gimple_assign (SSA_NAME_DEF_STMT (arg))
&& (<API key> (SSA_NAME_DEF_STMT (arg))
== ASSERT_EXPR))
continue;
if (TREE_CODE (val) != SSA_NAME)
prop_stats.num_const_prop++;
else
prop_stats.num_copy_prop++;
propagate_value (PHI_ARG_DEF_PTR (phi, i), val);
replaced = true;
/* If we propagated a copy and this argument flows
through an abnormal edge, update the replacement
accordingly. */
if (TREE_CODE (val) == SSA_NAME
&& e->flags & EDGE_ABNORMAL
&& !<API key> (val))
{
/* This can only occur for virtual operands, since
for the real ones <API key> (val))
would prevent replacement. */
gcc_checking_assert (virtual_operand_p (val));
<API key> (val) = 1;
}
}
}
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (!replaced)
fprintf (dump_file, "No folding possible\n");
else
{
fprintf (dump_file, "Folded into: ");
print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
}
return replaced;
}
class <API key> : public dom_walker
{
public:
<API key> (cdi_direction direction,
<API key> get_value_fn_,
<API key> fold_fn_,
bool do_dce_)
: dom_walker (direction), get_value_fn (get_value_fn_),
fold_fn (fold_fn_), do_dce (do_dce_), something_changed (false)
{
stmts_to_remove.create (0);
stmts_to_fixup.create (0);
need_eh_cleanup = BITMAP_ALLOC (NULL);
}
~<API key> ()
{
stmts_to_remove.release ();
stmts_to_fixup.release ();
BITMAP_FREE (need_eh_cleanup);
}
virtual edge before_dom_children (basic_block);
virtual void after_dom_children (basic_block) {}
<API key> get_value_fn;
<API key> fold_fn;
bool do_dce;
bool something_changed;
vec<gimple *> stmts_to_remove;
vec<gimple *> stmts_to_fixup;
bitmap need_eh_cleanup;
};
edge
<API key>::before_dom_children (basic_block bb)
{
/* Propagate known values into PHI nodes. */
for (gphi_iterator i = gsi_start_phis (bb);
!gsi_end_p (i);
gsi_next (&i))
{
gphi *phi = i.phi ();
tree res = gimple_phi_result (phi);
if (virtual_operand_p (res))
continue;
if (do_dce
&& res && TREE_CODE (res) == SSA_NAME)
{
tree sprime = get_value_fn (res);
if (sprime
&& sprime != res
&& may_propagate_copy (res, sprime))
{
stmts_to_remove.safe_push (phi);
continue;
}
}
something_changed |= replace_phi_args_in (phi, get_value_fn);
}
/* Propagate known values into stmts. In some case it exposes
more trivially deletable stmts to walk backward. */
for (<API key> i = gsi_start_bb (bb);
!gsi_end_p (i);
gsi_next (&i))
{
bool did_replace;
gimple *stmt = gsi_stmt (i);
enum gimple_code code = gimple_code (stmt);
/* Ignore ASSERT_EXPRs. They are used by VRP to generate
range information for names and they are discarded
afterwards. */
if (code == GIMPLE_ASSIGN
&& TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR)
continue;
/* No point propagating into a stmt we have a value for we
can propagate into all uses. Mark it for removal instead. */
tree lhs = gimple_get_lhs (stmt);
if (do_dce
&& lhs && TREE_CODE (lhs) == SSA_NAME)
{
tree sprime = get_value_fn (lhs);
if (sprime
&& sprime != lhs
&& may_propagate_copy (lhs, sprime)
&& !stmt_could_throw_p (stmt)
&& !<API key> (stmt))
{
stmts_to_remove.safe_push (stmt);
continue;
}
}
/* Replace the statement with its folded version and mark it
folded. */
did_replace = false;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Folding statement: ");
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
gimple *old_stmt = stmt;
bool was_noreturn = (is_gimple_call (stmt)
&& <API key> (stmt));
/* Some statements may be simplified using propagator
specific information. Do this before propagating
into the stmt to not disturb pass specific information. */
if (fold_fn
&& (*fold_fn)(&i))
{
did_replace = true;
prop_stats.num_stmts_folded++;
stmt = gsi_stmt (i);
update_stmt (stmt);
}
/* Replace real uses in the statement. */
did_replace |= replace_uses_in (stmt, get_value_fn);
/* If we made a replacement, fold the statement. */
if (did_replace)
{
fold_stmt (&i, <API key>);
stmt = gsi_stmt (i);
}
/* If this is a control statement the propagator left edges
unexecuted on force the condition in a way consistent with
that. See PR66945 for cases where the propagator can end
up with a different idea of a taken edge than folding
(once undefined behavior is involved). */
if (gimple_code (stmt) == GIMPLE_COND)
{
if ((EDGE_SUCC (bb, 0)->flags & EDGE_EXECUTABLE)
^ (EDGE_SUCC (bb, 1)->flags & EDGE_EXECUTABLE))
{
if (((EDGE_SUCC (bb, 0)->flags & EDGE_TRUE_VALUE) != 0)
== ((EDGE_SUCC (bb, 0)->flags & EDGE_EXECUTABLE) != 0))
<API key> (as_a <gcond *> (stmt));
else
<API key> (as_a <gcond *> (stmt));
did_replace = true;
}
}
/* Now cleanup. */
if (did_replace)
{
/* If we cleaned up EH information from the statement,
remove EH edges. */
if (<API key> (old_stmt, stmt))
bitmap_set_bit (need_eh_cleanup, bb->index);
/* If we turned a not noreturn call into a noreturn one
schedule it for fixup. */
if (!was_noreturn
&& is_gimple_call (stmt)
&& <API key> (stmt))
stmts_to_fixup.safe_push (stmt);
if (<API key> (stmt))
{
tree rhs = gimple_assign_rhs1 (stmt);
if (TREE_CODE (rhs) == ADDR_EXPR)
<API key> (rhs);
}
/* Determine what needs to be done to update the SSA form. */
update_stmt (stmt);
if (!is_gimple_debug (stmt))
something_changed = true;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (did_replace)
{
fprintf (dump_file, "Folded into: ");
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
else
fprintf (dump_file, "Not folded\n");
}
}
return NULL;
}
/* Perform final substitution and folding of propagated values.
PROP_VALUE[I] contains the single value that should be substituted
at every use of SSA name N_I. If PROP_VALUE is NULL, no values are
substituted.
If FOLD_FN is non-NULL the function will be invoked on all statements
before propagating values for pass specific simplification.
DO_DCE is true if trivially dead stmts can be removed.
If DO_DCE is true, the statements within a BB are walked from
last to first element. Otherwise we scan from first to last element.
Return TRUE when something changed. */
bool
substitute_and_fold (<API key> get_value_fn,
<API key> fold_fn,
bool do_dce)
{
gcc_assert (get_value_fn);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nSubstituting values and folding statements\n\n");
memset (&prop_stats, 0, sizeof (prop_stats));
<API key> (CDI_DOMINATORS);
<API key> walker(CDI_DOMINATORS,
get_value_fn, fold_fn, do_dce);
walker.walk (<API key> (cfun));
/* We cannot remove stmts during the BB walk, especially not release
SSA names there as that destroys the lattice of our callers.
Remove stmts in reverse order to make debug stmt creation possible. */
while (!walker.stmts_to_remove.is_empty ())
{
gimple *stmt = walker.stmts_to_remove.pop ();
if (dump_file && dump_flags & TDF_DETAILS)
{
fprintf (dump_file, "Removing dead stmt ");
print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\n");
}
prop_stats.num_dce++;
<API key> gsi = gsi_for_stmt (stmt);
if (gimple_code (stmt) == GIMPLE_PHI)
remove_phi_node (&gsi, true);
else
{
unlink_stmt_vdef (stmt);
gsi_remove (&gsi, true);
release_defs (stmt);
}
}
if (!bitmap_empty_p (walker.need_eh_cleanup))
<API key> (walker.need_eh_cleanup);
/* Fixup stmts that became noreturn calls. This may require splitting
blocks and thus isn't possible during the dominator walk. Do this
in reverse order so we don't inadvertedly remove a stmt we want to
fixup by visiting a dominating now noreturn call first. */
while (!walker.stmts_to_fixup.is_empty ())
{
gimple *stmt = walker.stmts_to_fixup.pop ();
if (dump_file && dump_flags & TDF_DETAILS)
{
fprintf (dump_file, "Fixing up noreturn call ");
print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\n");
}
fixup_noreturn_call (stmt);
}
<API key> (cfun, "Constants propagated",
prop_stats.num_const_prop);
<API key> (cfun, "Copies propagated",
prop_stats.num_copy_prop);
<API key> (cfun, "Statements folded",
prop_stats.num_stmts_folded);
<API key> (cfun, "Statements deleted",
prop_stats.num_dce);
return walker.something_changed;
}
/* Return true if we may propagate ORIG into DEST, false otherwise. */
bool
may_propagate_copy (tree dest, tree orig)
{
tree type_d = TREE_TYPE (dest);
tree type_o = TREE_TYPE (orig);
/* If ORIG is a default definition which flows in from an abnormal edge
then the copy can be propagated. It is important that we do so to avoid
uninitialized copies. */
if (TREE_CODE (orig) == SSA_NAME
&& <API key> (orig)
&& <API key> (orig)
&& (SSA_NAME_VAR (orig) == NULL_TREE
|| TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL))
;
/* Otherwise if ORIG just flows in from an abnormal edge then the copy cannot
be propagated. */
else if (TREE_CODE (orig) == SSA_NAME
&& <API key> (orig))
return false;
/* Similarly if DEST flows in from an abnormal edge then the copy cannot be
propagated. */
else if (TREE_CODE (dest) == SSA_NAME
&& <API key> (dest))
return false;
/* Do not copy between types for which we *do* need a conversion. */
if (!<API key> (type_d, type_o))
return false;
/* Generally propagating virtual operands is not ok as that may
create overlapping life-ranges. */
if (TREE_CODE (dest) == SSA_NAME && virtual_operand_p (dest))
return false;
/* Anything else is OK. */
return true;
}
/* Like may_propagate_copy, but use as the destination expression
the principal expression (typically, the RHS) contained in
statement DEST. This is more efficient when working with the
gimple tuples representation. */
bool
<API key> (gimple *dest, tree orig)
{
tree type_d;
tree type_o;
/* If the statement is a switch or a single-rhs assignment,
then the expression to be replaced by the propagation may
be an SSA_NAME. Fortunately, there is an explicit tree
for the expression, so we delegate to may_propagate_copy. */
if (<API key> (dest))
return may_propagate_copy (gimple_assign_rhs1 (dest), orig);
else if (gswitch *dest_swtch = dyn_cast <gswitch *> (dest))
return may_propagate_copy (gimple_switch_index (dest_swtch), orig);
/* In other cases, the expression is not materialized, so there
is no destination to pass to may_propagate_copy. On the other
hand, the expression cannot be an SSA_NAME, so the analysis
is much simpler. */
if (TREE_CODE (orig) == SSA_NAME
&& <API key> (orig))
return false;
if (is_gimple_assign (dest))
type_d = TREE_TYPE (gimple_assign_lhs (dest));
else if (gimple_code (dest) == GIMPLE_COND)
type_d = boolean_type_node;
else if (is_gimple_call (dest)
&& gimple_call_lhs (dest) != NULL_TREE)
type_d = TREE_TYPE (gimple_call_lhs (dest));
else
gcc_unreachable ();
type_o = TREE_TYPE (orig);
if (!<API key> (type_d, type_o))
return false;
return true;
}
/* Similarly, but we know that we're propagating into an ASM_EXPR. */
bool
<API key> (tree dest ATTRIBUTE_UNUSED)
{
return true;
}
/* Common code for propagate_value and replace_exp.
Replace use operand OP_P with VAL. FOR_PROPAGATION indicates if the
replacement is done to propagate a value or not. */
static void
replace_exp_1 (use_operand_p op_p, tree val,
bool for_propagation ATTRIBUTE_UNUSED)
{
if (flag_checking)
{
tree op = USE_FROM_PTR (op_p);
gcc_assert (!(for_propagation
&& TREE_CODE (op) == SSA_NAME
&& TREE_CODE (val) == SSA_NAME
&& !may_propagate_copy (op, val)));
}
if (TREE_CODE (val) == SSA_NAME)
SET_USE (op_p, val);
else
SET_USE (op_p, unshare_expr (val));
}
/* Propagate the value VAL (assumed to be a constant or another SSA_NAME)
into the operand pointed to by OP_P.
Use this version for const/copy propagation as it will perform additional
checks to ensure validity of the const/copy propagation. */
void
propagate_value (use_operand_p op_p, tree val)
{
replace_exp_1 (op_p, val, true);
}
/* Replace *OP_P with value VAL (assumed to be a constant or another SSA_NAME).
Use this version when not const/copy propagating values. For example,
PRE uses this version when building expressions as they would appear
in specific blocks taking into account actions of PHI nodes.
The statement in which an expression has been replaced should be
folded using fold_stmt_inplace. */
void
replace_exp (use_operand_p op_p, tree val)
{
replace_exp_1 (op_p, val, false);
}
/* Propagate the value VAL (assumed to be a constant or another SSA_NAME)
into the tree pointed to by OP_P.
Use this version for const/copy propagation when SSA operands are not
available. It will perform the additional checks to ensure validity of
the const/copy propagation, but will not update any operand information.
Be sure to mark the stmt as modified. */
void
<API key> (tree *op_p, tree val)
{
if (TREE_CODE (val) == SSA_NAME)
*op_p = val;
else
*op_p = unshare_expr (val);
}
/* Like <API key>, but use as the operand to replace
the principal expression (typically, the RHS) contained in the
statement referenced by iterator GSI. Note that it is not
always possible to update the statement in-place, so a new
statement may be created to replace the original. */
void
<API key> (<API key> *gsi, tree val)
{
gimple *stmt = gsi_stmt (*gsi);
if (is_gimple_assign (stmt))
{
tree expr = NULL_TREE;
if (<API key> (stmt))
expr = gimple_assign_rhs1 (stmt);
<API key> (&expr, val);
<API key> (gsi, expr);
}
else if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))
{
tree lhs = NULL_TREE;
tree rhs = build_zero_cst (TREE_TYPE (val));
<API key> (&lhs, val);
<API key> (cond_stmt, NE_EXPR);
gimple_cond_set_lhs (cond_stmt, lhs);
gimple_cond_set_rhs (cond_stmt, rhs);
}
else if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE)
{
tree expr = NULL_TREE;
bool res;
<API key> (&expr, val);
res = <API key> (gsi, expr);
gcc_assert (res);
}
else if (gswitch *swtch_stmt = dyn_cast <gswitch *> (stmt))
<API key> (<API key> (swtch_stmt), val);
else
gcc_unreachable ();
} |
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/sound.h>
#include <linux/soundcard.h>
#include <linux/slab.h>
#include <linux/kdev_t.h>
#include <asm/uaccess.h>
#include <asm/io.h>
/* mmio access */
#define btwrite(dat,adr) writel((dat), (bta->mmio+(adr)))
#define btread(adr) readl(bta->mmio+(adr))
#define btand(dat,adr) btwrite((dat) & btread(adr), adr)
#define btor(dat,adr) btwrite((dat) | btread(adr), adr)
#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)
/* registers (shifted because bta->mmio is long) */
#define REG_INT_STAT (0x100 >> 2)
#define REG_INT_MASK (0x104 >> 2)
#define REG_GPIO_DMA_CTL (0x10c >> 2)
#define REG_PACKET_LEN (0x110 >> 2)
#define REG_RISC_STRT_ADD (0x114 >> 2)
#define REG_RISC_COUNT (0x120 >> 2)
/* IRQ bits - REG_INT_(STAT|MASK) */
#define IRQ_SCERR (1 << 19)
#define IRQ_OCERR (1 << 18)
#define IRQ_PABORT (1 << 17)
#define IRQ_RIPERR (1 << 16)
#define IRQ_PPERR (1 << 15)
#define IRQ_FDSR (1 << 14)
#define IRQ_FTRGT (1 << 13)
#define IRQ_FBUS (1 << 12)
#define IRQ_RISCI (1 << 11)
#define IRQ_OFLOW (1 << 3)
#define IRQ_BTAUDIO (IRQ_SCERR | IRQ_OCERR | IRQ_PABORT | IRQ_RIPERR |\
IRQ_PPERR | IRQ_FDSR | IRQ_FTRGT | IRQ_FBUS |\
IRQ_RISCI)
/* REG_GPIO_DMA_CTL bits */
#define DMA_CTL_A_PWRDN (1 << 26)
#define DMA_CTL_DA_SBR (1 << 14)
#define DMA_CTL_DA_ES2 (1 << 13)
#define DMA_CTL_ACAP_EN (1 << 4)
#define DMA_CTL_RISC_EN (1 << 1)
#define DMA_CTL_FIFO_EN (1 << 0)
/* RISC instructions */
#define RISC_WRITE (0x01 << 28)
#define RISC_JUMP (0x07 << 28)
#define RISC_SYNC (0x08 << 28)
/* RISC bits */
#define RISC_WR_SOL (1 << 27)
#define RISC_WR_EOL (1 << 26)
#define RISC_IRQ (1 << 24)
#define RISC_SYNC_RESYNC (1 << 15)
#define RISC_SYNC_FM1 0x06
#define RISC_SYNC_VRO 0x0c
#define HWBASE_AD (448000)
struct btaudio {
/* linked list */
struct btaudio *next;
/* device info */
int dsp_digital;
int dsp_analog;
int mixer_dev;
struct pci_dev *pci;
unsigned int irq;
unsigned long mem;
unsigned long __iomem *mmio;
/* locking */
int users;
struct semaphore lock;
/* risc instructions */
unsigned int risc_size;
unsigned long *risc_cpu;
dma_addr_t risc_dma;
/* audio data */
unsigned int buf_size;
unsigned char *buf_cpu;
dma_addr_t buf_dma;
/* buffer setup */
int line_bytes;
int line_count;
int block_bytes;
int block_count;
/* read fifo management */
int recording;
int dma_block;
int read_offset;
int read_count;
wait_queue_head_t readq;
/* settings */
int gain[3];
int source;
int bits;
int decimation;
int mixcount;
int sampleshift;
int channels;
int analog;
int rate;
};
struct cardinfo {
char *name;
int rate;
};
static struct btaudio *btaudios;
static unsigned int debug;
static unsigned int irq_debug;
#define BUF_DEFAULT 128*1024
#define BUF_MIN 8192
static int alloc_buffer(struct btaudio *bta)
{
if (NULL == bta->buf_cpu) {
for (bta->buf_size = BUF_DEFAULT; bta->buf_size >= BUF_MIN;
bta->buf_size = bta->buf_size >> 1) {
bta->buf_cpu = <API key>
(bta->pci, bta->buf_size, &bta->buf_dma);
if (NULL != bta->buf_cpu)
break;
}
if (NULL == bta->buf_cpu)
return -ENOMEM;
memset(bta->buf_cpu,0,bta->buf_size);
}
if (NULL == bta->risc_cpu) {
bta->risc_size = PAGE_SIZE;
bta->risc_cpu = <API key>
(bta->pci, bta->risc_size, &bta->risc_dma);
if (NULL == bta->risc_cpu) {
pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->buf_dma);
bta->buf_cpu = NULL;
return -ENOMEM;
}
}
return 0;
}
static void free_buffer(struct btaudio *bta)
{
if (NULL != bta->buf_cpu) {
pci_free_consistent(bta->pci, bta->buf_size,
bta->buf_cpu, bta->buf_dma);
bta->buf_cpu = NULL;
}
if (NULL != bta->risc_cpu) {
pci_free_consistent(bta->pci, bta->risc_size,
bta->risc_cpu, bta->risc_dma);
bta->risc_cpu = NULL;
}
}
static int make_risc(struct btaudio *bta)
{
int rp, bp, line, block;
unsigned long risc;
bta->block_bytes = bta->buf_size >> 4;
bta->block_count = 1 << 4;
bta->line_bytes = bta->block_bytes;
bta->line_count = bta->block_count;
while (bta->line_bytes > 4095) {
bta->line_bytes >>= 1;
bta->line_count <<= 1;
}
if (bta->line_count > 255)
return -EINVAL;
if (debug)
printk(KERN_DEBUG
"btaudio: bufsize=%d - bs=%d bc=%d - ls=%d, lc=%d\n",
bta->buf_size,bta->block_bytes,bta->block_count,
bta->line_bytes,bta->line_count);
rp = 0; bp = 0;
block = 0;
bta->risc_cpu[rp++] = cpu_to_le32(RISC_SYNC|RISC_SYNC_FM1);
bta->risc_cpu[rp++] = cpu_to_le32(0);
for (line = 0; line < bta->line_count; line++) {
risc = RISC_WRITE | RISC_WR_SOL | RISC_WR_EOL;
risc |= bta->line_bytes;
if (0 == (bp & (bta->block_bytes-1))) {
risc |= RISC_IRQ;
risc |= (block & 0x0f) << 16;
risc |= (~block & 0x0f) << 20;
block++;
}
bta->risc_cpu[rp++] = cpu_to_le32(risc);
bta->risc_cpu[rp++] = cpu_to_le32(bta->buf_dma + bp);
bp += bta->line_bytes;
}
bta->risc_cpu[rp++] = cpu_to_le32(RISC_SYNC|RISC_SYNC_VRO);
bta->risc_cpu[rp++] = cpu_to_le32(0);
bta->risc_cpu[rp++] = cpu_to_le32(RISC_JUMP);
bta->risc_cpu[rp++] = cpu_to_le32(bta->risc_dma);
return 0;
}
static int start_recording(struct btaudio *bta)
{
int ret;
if (0 != (ret = alloc_buffer(bta)))
return ret;
if (0 != (ret = make_risc(bta)))
return ret;
btwrite(bta->risc_dma, REG_RISC_STRT_ADD);
btwrite((bta->line_count << 16) | bta->line_bytes,
REG_PACKET_LEN);
btwrite(IRQ_BTAUDIO, REG_INT_MASK);
if (bta->analog) {
btwrite(DMA_CTL_ACAP_EN |
DMA_CTL_RISC_EN |
DMA_CTL_FIFO_EN |
DMA_CTL_DA_ES2 |
((bta->bits == 8) ? DMA_CTL_DA_SBR : 0) |
(bta->gain[bta->source] << 28) |
(bta->source << 24) |
(bta->decimation << 8),
REG_GPIO_DMA_CTL);
} else {
btwrite(DMA_CTL_ACAP_EN |
DMA_CTL_RISC_EN |
DMA_CTL_FIFO_EN |
DMA_CTL_DA_ES2 |
DMA_CTL_A_PWRDN |
(1 << 6) |
((bta->bits == 8) ? DMA_CTL_DA_SBR : 0) |
(bta->gain[bta->source] << 28) |
(bta->source << 24) |
(bta->decimation << 8),
REG_GPIO_DMA_CTL);
}
bta->dma_block = 0;
bta->read_offset = 0;
bta->read_count = 0;
bta->recording = 1;
if (debug)
printk(KERN_DEBUG "btaudio: recording started\n");
return 0;
}
static void stop_recording(struct btaudio *bta)
{
btand(~15, REG_GPIO_DMA_CTL);
bta->recording = 0;
if (debug)
printk(KERN_DEBUG "btaudio: recording stopped\n");
}
static int btaudio_mixer_open(struct inode *inode, struct file *file)
{
int minor = iminor(inode);
struct btaudio *bta;
for (bta = btaudios; bta != NULL; bta = bta->next)
if (bta->mixer_dev == minor)
break;
if (NULL == bta)
return -ENODEV;
if (debug)
printk("btaudio: open mixer [%d]\n",minor);
file->private_data = bta;
return 0;
}
static int <API key>(struct inode *inode, struct file *file)
{
return 0;
}
static int btaudio_mixer_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct btaudio *bta = file->private_data;
int ret,val=0,i=0;
void __user *argp = (void __user *)arg;
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
memset(&info,0,sizeof(info));
strlcpy(info.id,"bt878",sizeof(info.id));
strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name));
info.modify_counter = bta->mixcount;
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
if (cmd == <API key>) {
_old_mixer_info info;
memset(&info,0,sizeof(info));
strlcpy(info.id,"bt878",sizeof(info.id)-1);
strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name));
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, (int __user *)argp);
/* read */
if (_SIOC_DIR(cmd) & _SIOC_WRITE)
if (get_user(val, (int __user *)argp))
return -EFAULT;
switch (cmd) {
case MIXER_READ(SOUND_MIXER_CAPS):
ret = <API key>;
break;
case MIXER_READ(<API key>):
ret = 0;
break;
case MIXER_READ(SOUND_MIXER_RECMASK):
case MIXER_READ(SOUND_MIXER_DEVMASK):
ret = SOUND_MASK_LINE1|SOUND_MASK_LINE2|SOUND_MASK_LINE3;
break;
case MIXER_WRITE(SOUND_MIXER_RECSRC):
if (val & SOUND_MASK_LINE1 && bta->source != 0)
bta->source = 0;
else if (val & SOUND_MASK_LINE2 && bta->source != 1)
bta->source = 1;
else if (val & SOUND_MASK_LINE3 && bta->source != 2)
bta->source = 2;
btaor((bta->gain[bta->source] << 28) |
(bta->source << 24),
0x0cffffff, REG_GPIO_DMA_CTL);
case MIXER_READ(SOUND_MIXER_RECSRC):
switch (bta->source) {
case 0: ret = SOUND_MASK_LINE1; break;
case 1: ret = SOUND_MASK_LINE2; break;
case 2: ret = SOUND_MASK_LINE3; break;
default: ret = 0;
}
break;
case MIXER_WRITE(SOUND_MIXER_LINE1):
case MIXER_WRITE(SOUND_MIXER_LINE2):
case MIXER_WRITE(SOUND_MIXER_LINE3):
if (MIXER_WRITE(SOUND_MIXER_LINE1) == cmd)
i = 0;
if (MIXER_WRITE(SOUND_MIXER_LINE2) == cmd)
i = 1;
if (MIXER_WRITE(SOUND_MIXER_LINE3) == cmd)
i = 2;
bta->gain[i] = (val & 0xff) * 15 / 100;
if (bta->gain[i] > 15) bta->gain[i] = 15;
if (bta->gain[i] < 0) bta->gain[i] = 0;
if (i == bta->source)
btaor((bta->gain[bta->source]<<28),
0x0fffffff, REG_GPIO_DMA_CTL);
ret = bta->gain[i] * 100 / 15;
ret |= ret << 8;
break;
case MIXER_READ(SOUND_MIXER_LINE1):
case MIXER_READ(SOUND_MIXER_LINE2):
case MIXER_READ(SOUND_MIXER_LINE3):
if (MIXER_READ(SOUND_MIXER_LINE1) == cmd)
i = 0;
if (MIXER_READ(SOUND_MIXER_LINE2) == cmd)
i = 1;
if (MIXER_READ(SOUND_MIXER_LINE3) == cmd)
i = 2;
ret = bta->gain[i] * 100 / 15;
ret |= ret << 8;
break;
default:
return -EINVAL;
}
if (put_user(ret, (int __user *)argp))
return -EFAULT;
return 0;
}
static struct file_operations btaudio_mixer_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.open = btaudio_mixer_open,
.release = <API key>,
.ioctl = btaudio_mixer_ioctl,
};
static int btaudio_dsp_open(struct inode *inode, struct file *file,
struct btaudio *bta, int analog)
{
down(&bta->lock);
if (bta->users)
goto busy;
bta->users++;
file->private_data = bta;
bta->analog = analog;
bta->dma_block = 0;
bta->read_offset = 0;
bta->read_count = 0;
bta->sampleshift = 0;
up(&bta->lock);
return 0;
busy:
up(&bta->lock);
return -EBUSY;
}
static int <API key>(struct inode *inode, struct file *file)
{
int minor = iminor(inode);
struct btaudio *bta;
for (bta = btaudios; bta != NULL; bta = bta->next)
if (bta->dsp_digital == minor)
break;
if (NULL == bta)
return -ENODEV;
if (debug)
printk("btaudio: open digital dsp [%d]\n",minor);
return btaudio_dsp_open(inode,file,bta,0);
}
static int <API key>(struct inode *inode, struct file *file)
{
int minor = iminor(inode);
struct btaudio *bta;
for (bta = btaudios; bta != NULL; bta = bta->next)
if (bta->dsp_analog == minor)
break;
if (NULL == bta)
return -ENODEV;
if (debug)
printk("btaudio: open analog dsp [%d]\n",minor);
return btaudio_dsp_open(inode,file,bta,1);
}
static int btaudio_dsp_release(struct inode *inode, struct file *file)
{
struct btaudio *bta = file->private_data;
down(&bta->lock);
if (bta->recording)
stop_recording(bta);
bta->users
up(&bta->lock);
return 0;
}
static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer,
size_t swcount, loff_t *ppos)
{
struct btaudio *bta = file->private_data;
int hwcount = swcount << bta->sampleshift;
int nsrc, ndst, err, ret = 0;
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&bta->readq, &wait);
down(&bta->lock);
while (swcount > 0) {
if (0 == bta->read_count) {
if (!bta->recording) {
if (0 != (err = start_recording(bta))) {
if (0 == ret)
ret = err;
break;
}
}
if (file->f_flags & O_NONBLOCK) {
if (0 == ret)
ret = -EAGAIN;
break;
}
up(&bta->lock);
current->state = TASK_INTERRUPTIBLE;
schedule();
down(&bta->lock);
if(signal_pending(current)) {
if (0 == ret)
ret = -EINTR;
break;
}
}
nsrc = (bta->read_count < hwcount) ? bta->read_count : hwcount;
if (nsrc > bta->buf_size - bta->read_offset)
nsrc = bta->buf_size - bta->read_offset;
ndst = nsrc >> bta->sampleshift;
if ((bta->analog && 0 == bta->sampleshift) ||
(!bta->analog && 2 == bta->channels)) {
/* just copy */
if (copy_to_user(buffer + ret, bta->buf_cpu + bta->read_offset, nsrc)) {
if (0 == ret)
ret = -EFAULT;
break;
}
} else if (!bta->analog) {
/* stereo => mono (digital audio) */
__s16 *src = (__s16*)(bta->buf_cpu + bta->read_offset);
__s16 __user *dst = (__s16 __user *)(buffer + ret);
__s16 avg;
int n = ndst>>1;
if (!access_ok(VERIFY_WRITE, dst, ndst)) {
if (0 == ret)
ret = -EFAULT;
break;
}
for (; n; n--, dst++) {
avg = (__s16)le16_to_cpu(*src) / 2; src++;
avg += (__s16)le16_to_cpu(*src) / 2; src++;
__put_user(cpu_to_le16(avg),dst);
}
} else if (8 == bta->bits) {
/* copy + byte downsampling (audio A/D) */
__u8 *src = bta->buf_cpu + bta->read_offset;
__u8 __user *dst = buffer + ret;
int n = ndst;
if (!access_ok(VERIFY_WRITE, dst, ndst)) {
if (0 == ret)
ret = -EFAULT;
break;
}
for (; n; n--, src += (1 << bta->sampleshift), dst++)
__put_user(*src, dst);
} else {
/* copy + word downsampling (audio A/D) */
__u16 *src = (__u16*)(bta->buf_cpu + bta->read_offset);
__u16 __user *dst = (__u16 __user *)(buffer + ret);
int n = ndst>>1;
if (!access_ok(VERIFY_WRITE,dst,ndst)) {
if (0 == ret)
ret = -EFAULT;
break;
}
for (; n; n--, src += (1 << bta->sampleshift), dst++)
__put_user(*src, dst);
}
ret += ndst;
swcount -= ndst;
hwcount -= nsrc;
bta->read_count -= nsrc;
bta->read_offset += nsrc;
if (bta->read_offset == bta->buf_size)
bta->read_offset = 0;
}
up(&bta->lock);
remove_wait_queue(&bta->readq, &wait);
current->state = TASK_RUNNING;
return ret;
}
static ssize_t btaudio_dsp_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
return -EINVAL;
}
static int btaudio_dsp_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct btaudio *bta = file->private_data;
int s, i, ret, val = 0;
void __user *argp = (void __user *)arg;
int __user *p = argp;
switch (cmd) {
case OSS_GETVERSION:
return put_user(SOUND_VERSION, p);
case SNDCTL_DSP_GETCAPS:
return 0;
case SNDCTL_DSP_SPEED:
if (get_user(val, p))
return -EFAULT;
if (bta->analog) {
for (s = 0; s < 16; s++)
if (val << s >= HWBASE_AD*4/15)
break;
for (i = 15; i >= 5; i
if (val << s <= HWBASE_AD*4/i)
break;
bta->sampleshift = s;
bta->decimation = i;
if (debug)
printk(KERN_DEBUG "btaudio: rate: req=%d "
"dec=%d shift=%d hwrate=%d swrate=%d\n",
val,i,s,(HWBASE_AD*4/i),(HWBASE_AD*4/i)>>s);
} else {
bta->sampleshift = (bta->channels == 2) ? 0 : 1;
bta->decimation = 0;
}
if (bta->recording) {
down(&bta->lock);
stop_recording(bta);
start_recording(bta);
up(&bta->lock);
}
/* fall through */
case SOUND_PCM_READ_RATE:
if (bta->analog) {
return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, p);
} else {
return put_user(bta->rate, p);
}
case SNDCTL_DSP_STEREO:
if (!bta->analog) {
if (get_user(val, p))
return -EFAULT;
bta->channels = (val > 0) ? 2 : 1;
bta->sampleshift = (bta->channels == 2) ? 0 : 1;
if (debug)
printk(KERN_INFO
"btaudio: stereo=%d channels=%d\n",
val,bta->channels);
} else {
if (val == 1)
return -EFAULT;
else {
bta->channels = 1;
if (debug)
printk(KERN_INFO
"btaudio: stereo=0 channels=1\n");
}
}
return put_user((bta->channels)-1, p);
case SNDCTL_DSP_CHANNELS:
if (!bta->analog) {
if (get_user(val, p))
return -EFAULT;
bta->channels = (val > 1) ? 2 : 1;
bta->sampleshift = (bta->channels == 2) ? 0 : 1;
if (debug)
printk(KERN_DEBUG
"btaudio: val=%d channels=%d\n",
val,bta->channels);
}
/* fall through */
case <API key>:
return put_user(bta->channels, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */
if (bta->analog)
return put_user(AFMT_S16_LE|AFMT_S8, p);
else
return put_user(AFMT_S16_LE, p);
case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
if (get_user(val, p))
return -EFAULT;
if (val != AFMT_QUERY) {
if (bta->analog)
bta->bits = (val == AFMT_S8) ? 8 : 16;
else
bta->bits = 16;
if (bta->recording) {
down(&bta->lock);
stop_recording(bta);
start_recording(bta);
up(&bta->lock);
}
}
if (debug)
printk(KERN_DEBUG "btaudio: fmt: bits=%d\n",bta->bits);
return put_user((bta->bits==16) ? AFMT_S16_LE : AFMT_S8,
p);
break;
case SOUND_PCM_READ_BITS:
return put_user(bta->bits, p);
case SNDCTL_DSP_NONBLOCK:
file->f_flags |= O_NONBLOCK;
return 0;
case SNDCTL_DSP_RESET:
if (bta->recording) {
down(&bta->lock);
stop_recording(bta);
up(&bta->lock);
}
return 0;
case <API key>:
if (!bta->recording) {
if (0 != (ret = alloc_buffer(bta)))
return ret;
if (0 != (ret = make_risc(bta)))
return ret;
}
return put_user(bta->block_bytes>>bta->sampleshift,p);
case SNDCTL_DSP_SYNC:
/* NOP */
return 0;
case <API key>:
{
audio_buf_info info;
if (!bta->recording)
return -EINVAL;
info.fragsize = bta->block_bytes>>bta->sampleshift;
info.fragstotal = bta->block_count;
info.bytes = bta->read_count;
info.fragments = info.bytes / info.fragsize;
if (debug)
printk(KERN_DEBUG "btaudio: <API key> "
"returns %d/%d/%d/%d\n",
info.fragsize, info.fragstotal,
info.bytes, info.fragments);
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
#if 0 /* TODO */
case <API key>:
case <API key>:
case <API key>:
#endif
default:
return -EINVAL;
}
}
static unsigned int btaudio_dsp_poll(struct file *file, struct poll_table_struct *wait)
{
struct btaudio *bta = file->private_data;
unsigned int mask = 0;
poll_wait(file, &bta->readq, wait);
if (0 != bta->read_count)
mask |= (POLLIN | POLLRDNORM);
return mask;
}
static struct file_operations <API key> = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.open = <API key>,
.release = btaudio_dsp_release,
.read = btaudio_dsp_read,
.write = btaudio_dsp_write,
.ioctl = btaudio_dsp_ioctl,
.poll = btaudio_dsp_poll,
};
static struct file_operations <API key> = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.open = <API key>,
.release = btaudio_dsp_release,
.read = btaudio_dsp_read,
.write = btaudio_dsp_write,
.ioctl = btaudio_dsp_ioctl,
.poll = btaudio_dsp_poll,
};
static char *irq_name[] = { "", "", "", "OFLOW", "", "", "", "", "", "", "",
"RISCI", "FBUS", "FTRGT", "FDSR", "PPERR",
"RIPERR", "PABORT", "OCERR", "SCERR" };
static irqreturn_t btaudio_irq(int irq, void *dev_id, struct pt_regs * regs)
{
int count = 0;
u32 stat,astat;
struct btaudio *bta = dev_id;
int handled = 0;
for (;;) {
count++;
stat = btread(REG_INT_STAT);
astat = stat & btread(REG_INT_MASK);
if (!astat)
return IRQ_RETVAL(handled);
handled = 1;
btwrite(astat,REG_INT_STAT);
if (irq_debug) {
int i;
printk(KERN_DEBUG "btaudio: irq loop=%d risc=%x, bits:",
count, stat>>28);
for (i = 0; i < (sizeof(irq_name)/sizeof(char*)); i++) {
if (stat & (1 << i))
printk(" %s",irq_name[i]);
if (astat & (1 << i))
printk("*");
}
printk("\n");
}
if (stat & IRQ_RISCI) {
int blocks;
blocks = (stat >> 28) - bta->dma_block;
if (blocks < 0)
blocks += bta->block_count;
bta->dma_block = stat >> 28;
if (bta->read_count + 2*bta->block_bytes > bta->buf_size) {
stop_recording(bta);
printk(KERN_INFO "btaudio: buffer overrun\n");
}
if (blocks > 0) {
bta->read_count += blocks * bta->block_bytes;
<API key>(&bta->readq);
}
}
if (count > 10) {
printk(KERN_WARNING
"btaudio: Oops - irq mask cleared\n");
btwrite(0, REG_INT_MASK);
}
}
return IRQ_NONE;
}
static unsigned int dsp1 = -1;
static unsigned int dsp2 = -1;
static unsigned int mixer = -1;
static int latency = -1;
static int digital = 1;
static int analog = 1;
static int rate;
#define BTA_OSPREY200 1
static struct cardinfo cards[] = {
[0] = {
.name = "default",
.rate = 32000,
},
[BTA_OSPREY200] = {
.name = "Osprey 200",
.rate = 44100,
},
};
static int __devinit btaudio_probe(struct pci_dev *pci_dev,
const struct pci_device_id *pci_id)
{
struct btaudio *bta;
struct cardinfo *card = &cards[pci_id->driver_data];
unsigned char revision,lat;
int rc = -EBUSY;
if (pci_enable_device(pci_dev))
return -EIO;
if (!request_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0),
"btaudio")) {
return -EBUSY;
}
bta = kmalloc(sizeof(*bta),GFP_ATOMIC);
if (!bta) {
rc = -ENOMEM;
goto fail0;
}
memset(bta,0,sizeof(*bta));
bta->pci = pci_dev;
bta->irq = pci_dev->irq;
bta->mem = pci_resource_start(pci_dev,0);
bta->mmio = ioremap(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
bta->source = 1;
bta->bits = 8;
bta->channels = 1;
if (bta->analog) {
bta->decimation = 15;
} else {
bta->decimation = 0;
bta->sampleshift = 1;
}
/* sample rate */
bta->rate = card->rate;
if (rate)
bta->rate = rate;
init_MUTEX(&bta->lock);
init_waitqueue_head(&bta->readq);
if (-1 != latency) {
printk(KERN_INFO "btaudio: setting pci latency timer to %d\n",
latency);
<API key>(pci_dev, PCI_LATENCY_TIMER, latency);
}
<API key>(pci_dev, PCI_CLASS_REVISION, &revision);
<API key>(pci_dev, PCI_LATENCY_TIMER, &lat);
printk(KERN_INFO "btaudio: Bt%x (rev %d) at %02x:%02x.%x, ",
pci_dev->device,revision,pci_dev->bus->number,
PCI_SLOT(pci_dev->devfn),PCI_FUNC(pci_dev->devfn));
printk("irq: %d, latency: %d, mmio: 0x%lx\n",
bta->irq, lat, bta->mem);
printk("btaudio: using card config \"%s\"\n", card->name);
/* init hw */
btwrite(0, REG_GPIO_DMA_CTL);
btwrite(0, REG_INT_MASK);
btwrite(~0U, REG_INT_STAT);
pci_set_master(pci_dev);
if ((rc = request_irq(bta->irq, btaudio_irq, SA_SHIRQ|SA_INTERRUPT,
"btaudio",(void *)bta)) < 0) {
printk(KERN_WARNING
"btaudio: can't request irq (rc=%d)\n",rc);
goto fail1;
}
/* register devices */
if (digital) {
rc = bta->dsp_digital =
register_sound_dsp(&<API key>,dsp1);
if (rc < 0) {
printk(KERN_WARNING
"btaudio: can't register digital dsp (rc=%d)\n",rc);
goto fail2;
}
printk(KERN_INFO "btaudio: registered device dsp%d [digital]\n",
bta->dsp_digital >> 4);
}
if (analog) {
rc = bta->dsp_analog =
register_sound_dsp(&<API key>,dsp2);
if (rc < 0) {
printk(KERN_WARNING
"btaudio: can't register analog dsp (rc=%d)\n",rc);
goto fail3;
}
printk(KERN_INFO "btaudio: registered device dsp%d [analog]\n",
bta->dsp_analog >> 4);
rc = bta->mixer_dev = <API key>(&btaudio_mixer_fops,mixer);
if (rc < 0) {
printk(KERN_WARNING
"btaudio: can't register mixer (rc=%d)\n",rc);
goto fail4;
}
printk(KERN_INFO "btaudio: registered device mixer%d\n",
bta->mixer_dev >> 4);
}
/* hook into linked list */
bta->next = btaudios;
btaudios = bta;
pci_set_drvdata(pci_dev,bta);
return 0;
fail4:
<API key>(bta->dsp_analog);
fail3:
if (digital)
<API key>(bta->dsp_digital);
fail2:
free_irq(bta->irq,bta);
fail1:
kfree(bta);
fail0:
release_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
return rc;
}
static void __devexit btaudio_remove(struct pci_dev *pci_dev)
{
struct btaudio *bta = pci_get_drvdata(pci_dev);
struct btaudio *walk;
/* turn off all DMA / IRQs */
btand(~15, REG_GPIO_DMA_CTL);
btwrite(0, REG_INT_MASK);
btwrite(~0U, REG_INT_STAT);
/* unregister devices */
if (digital) {
<API key>(bta->dsp_digital);
}
if (analog) {
<API key>(bta->dsp_analog);
<API key>(bta->mixer_dev);
}
/* free resources */
free_buffer(bta);
free_irq(bta->irq,bta);
release_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
/* remove from linked list */
if (bta == btaudios) {
btaudios = NULL;
} else {
for (walk = btaudios; walk->next != bta; walk = walk->next)
; /* if (NULL == walk->next) BUG(); */
walk->next = bta->next;
}
pci_set_drvdata(pci_dev, NULL);
kfree(bta);
return;
}
static struct pci_device_id btaudio_pci_tbl[] = {
{
.vendor = <API key>,
.device = 0x0878,
.subvendor = 0x0070,
.subdevice = 0xff01,
.driver_data = BTA_OSPREY200,
},{
.vendor = <API key>,
.device = 0x0878,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{
.vendor = <API key>,
.device = 0x0878,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{
}
};
static struct pci_driver btaudio_pci_driver = {
.name = "btaudio",
.id_table = btaudio_pci_tbl,
.probe = btaudio_probe,
.remove = __devexit_p(btaudio_remove),
};
static int btaudio_init_module(void)
{
printk(KERN_INFO "btaudio: driver version 0.7 loaded [%s%s%s]\n",
digital ? "digital" : "",
analog && digital ? "+" : "",
analog ? "analog" : "");
return pci_register_driver(&btaudio_pci_driver);
}
static void <API key>(void)
{
<API key>(&btaudio_pci_driver);
return;
}
module_init(btaudio_init_module);
module_exit(<API key>);
module_param(dsp1, int, S_IRUGO);
module_param(dsp2, int, S_IRUGO);
module_param(mixer, int, S_IRUGO);
module_param(debug, int, S_IRUGO | S_IWUSR);
module_param(irq_debug, int, S_IRUGO | S_IWUSR);
module_param(digital, int, S_IRUGO);
module_param(analog, int, S_IRUGO);
module_param(rate, int, S_IRUGO);
module_param(latency, int, S_IRUGO);
MODULE_PARM_DESC(latency,"pci latency timer");
MODULE_DEVICE_TABLE(pci, btaudio_pci_tbl);
MODULE_DESCRIPTION("bt878 audio dma driver");
MODULE_AUTHOR("Gerd Knorr");
MODULE_LICENSE("GPL");
/*
* Local variables:
* c-basic-offset: 8
* End:
*/ |
#include <asm/page.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/highmem.h>
#include <linux/ion.h>
#include <linux/mm.h>
#include <linux/scatterlist.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "ion_priv.h"
static unsigned int <API key> = (GFP_HIGHUSER | __GFP_ZERO |
__GFP_NOWARN | __GFP_NORETRY |
__GFP_NO_KSWAPD) & ~__GFP_WAIT;
static unsigned int low_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO |
__GFP_NOWARN);
static const unsigned int orders[] = {9, 8, 4, 0};
static const int num_orders = ARRAY_SIZE(orders);
static int order_to_index(unsigned int order)
{
int i;
for (i = 0; i < num_orders; i++)
if (order == orders[i])
return i;
BUG();
return -1;
}
static unsigned int order_to_size(int order)
{
return PAGE_SIZE << order;
}
struct ion_system_heap {
struct ion_heap heap;
struct ion_page_pool **pools;
};
struct page_info {
struct page *page;
unsigned int order;
struct list_head list;
};
static struct page *alloc_buffer_page(struct ion_system_heap *heap,
struct ion_buffer *buffer,
unsigned long order)
{
bool cached = ion_buffer_cached(buffer);
struct ion_page_pool *pool = heap->pools[order_to_index(order)];
struct page *page;
if (!cached) {
page = ion_page_pool_alloc(pool);
} else {
gfp_t gfp_flags = low_order_gfp_flags;
if (order > 4)
gfp_flags = <API key>;
page = <API key>(buffer, gfp_flags, order);
if (!page)
return 0;
<API key>(page, 0, PAGE_SIZE << order,
DMA_BIDIRECTIONAL);
}
if (!page)
return 0;
return page;
}
static void free_buffer_page(struct ion_system_heap *heap,
struct ion_buffer *buffer, struct page *page,
unsigned int order)
{
bool cached = ion_buffer_cached(buffer);
bool split_pages = <API key>(buffer);
int i;
if (!cached) {
struct ion_page_pool *pool = heap->pools[order_to_index(order)];
ion_page_pool_free(pool, page);
} else if (split_pages) {
for (i = 0; i < (1 << order); i++)
__free_page(page + i);
} else {
__free_pages(page, order);
}
}
static struct page_info *<API key>(struct ion_system_heap *heap,
struct ion_buffer *buffer,
unsigned long size,
unsigned int max_order)
{
struct page *page;
struct page_info *info;
int i;
for (i = 0; i < num_orders; i++) {
if (size < order_to_size(orders[i]))
continue;
if (max_order < orders[i])
continue;
page = alloc_buffer_page(heap, buffer, orders[i]);
if (!page)
continue;
info = kmalloc(sizeof(struct page_info), GFP_KERNEL);
info->page = page;
info->order = orders[i];
return info;
}
return NULL;
}
static int <API key>(struct ion_heap *heap,
struct ion_buffer *buffer,
unsigned long size, unsigned long align,
unsigned long flags)
{
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
struct sg_table *table;
struct scatterlist *sg;
int ret;
struct list_head pages;
struct page_info *info, *tmp_info;
int i = 0;
long size_remaining = PAGE_ALIGN(size);
unsigned int max_order = orders[0];
INIT_LIST_HEAD(&pages);
while (size_remaining > 0) {
info = <API key>(sys_heap, buffer, size_remaining, max_order);
if (!info)
goto err;
list_add_tail(&info->list, &pages);
size_remaining -= (1 << info->order) * PAGE_SIZE;
max_order = info->order;
i++;
}
table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
if (!table)
goto err;
ret = sg_alloc_table(table, i, GFP_KERNEL);
if (ret)
goto err1;
sg = table->sgl;
<API key>(info, tmp_info, &pages, list) {
struct page *page = info->page;
sg_set_page(sg, page, (1 << info->order) * PAGE_SIZE, 0);
sg = sg_next(sg);
list_del(&info->list);
kfree(info);
}
buffer->priv_virt = table;
return 0;
err1:
kfree(table);
err:
list_for_each_entry(info, &pages, list) {
free_buffer_page(sys_heap, buffer, info->page, info->order);
kfree(info);
}
return -ENOMEM;
}
void <API key>(struct ion_buffer *buffer)
{
struct ion_heap *heap = buffer->heap;
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
struct sg_table *table = buffer->sg_table;
bool cached = ion_buffer_cached(buffer);
struct scatterlist *sg;
LIST_HEAD(pages);
int i;
/* uncached pages come from the page pools, zero them before returning
for security purposes (other allocations are zerod at alloc time */
if (!cached)
<API key>(buffer);
for_each_sg(table->sgl, sg, table->nents, i)
free_buffer_page(sys_heap, buffer, sg_page(sg),
get_order(sg_dma_len(sg)));
sg_free_table(table);
kfree(table);
}
struct sg_table *<API key>(struct ion_heap *heap,
struct ion_buffer *buffer)
{
return buffer->priv_virt;
}
void <API key>(struct ion_heap *heap,
struct ion_buffer *buffer)
{
return;
}
static struct ion_heap_ops system_heap_ops = {
.allocate = <API key>,
.free = <API key>,
.map_dma = <API key>,
.unmap_dma = <API key>,
.map_kernel = ion_heap_map_kernel,
.unmap_kernel = <API key>,
.map_user = ion_heap_map_user,
};
static int <API key>(struct shrinker *shrinker,
struct shrink_control *sc) {
struct ion_heap *heap = container_of(shrinker, struct ion_heap,
shrinker);
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
int nr_total = 0;
int nr_freed = 0;
int i;
if (sc->nr_to_scan == 0)
goto end;
/* shrink the free list first, no point in zeroing the memory if
we're just going to reclaim it */
nr_freed += <API key>(heap, sc->nr_to_scan * PAGE_SIZE) /
PAGE_SIZE;
if (nr_freed >= sc->nr_to_scan)
goto end;
for (i = 0; i < num_orders; i++) {
struct ion_page_pool *pool = sys_heap->pools[i];
nr_freed += <API key>(pool, sc->gfp_mask,
sc->nr_to_scan);
if (nr_freed >= sc->nr_to_scan)
break;
}
end:
/* total number of items is whatever the page pools are holding
plus whatever's in the freelist */
for (i = 0; i < num_orders; i++) {
struct ion_page_pool *pool = sys_heap->pools[i];
nr_total += <API key>(pool, sc->gfp_mask, 0);
}
nr_total += <API key>(heap) / PAGE_SIZE;
return nr_total;
}
static int <API key>(struct ion_heap *heap, struct seq_file *s,
void *unused)
{
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
int i;
for (i = 0; i < num_orders; i++) {
struct ion_page_pool *pool = sys_heap->pools[i];
seq_printf(s, "%d order %u highmem pages in pool = %lu total\n",
pool->high_count, pool->order,
(1 << pool->order) * PAGE_SIZE * pool->high_count);
seq_printf(s, "%d order %u lowmem pages in pool = %lu total\n",
pool->low_count, pool->order,
(1 << pool->order) * PAGE_SIZE * pool->low_count);
}
return 0;
}
struct ion_heap *<API key>(struct ion_platform_heap *unused)
{
struct ion_system_heap *heap;
int i;
heap = kzalloc(sizeof(struct ion_system_heap), GFP_KERNEL);
if (!heap)
return ERR_PTR(-ENOMEM);
heap->heap.ops = &system_heap_ops;
heap->heap.type = <API key>;
heap->heap.flags = <API key>;
heap->pools = kzalloc(sizeof(struct ion_page_pool *) * num_orders,
GFP_KERNEL);
if (!heap->pools)
goto err_alloc_pools;
for (i = 0; i < num_orders; i++) {
struct ion_page_pool *pool;
gfp_t gfp_flags = low_order_gfp_flags;
if (orders[i] > 4)
gfp_flags = <API key>;
pool = <API key>(gfp_flags, orders[i]);
if (!pool)
goto err_create_pool;
heap->pools[i] = pool;
}
heap->heap.shrinker.shrink = <API key>;
heap->heap.shrinker.seeks = DEFAULT_SEEKS;
heap->heap.shrinker.batch = 0;
register_shrinker(&heap->heap.shrinker);
heap->heap.debug_show = <API key>;
return &heap->heap;
err_create_pool:
for (i = 0; i < num_orders; i++)
if (heap->pools[i])
<API key>(heap->pools[i]);
kfree(heap->pools);
err_alloc_pools:
kfree(heap);
return ERR_PTR(-ENOMEM);
}
void <API key>(struct ion_heap *heap)
{
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
int i;
for (i = 0; i < num_orders; i++)
<API key>(sys_heap->pools[i]);
kfree(sys_heap->pools);
kfree(sys_heap);
}
static int <API key>(struct ion_heap *heap,
struct ion_buffer *buffer,
unsigned long len,
unsigned long align,
unsigned long flags)
{
buffer->priv_virt = kzalloc(len, GFP_KERNEL);
if (!buffer->priv_virt)
return -ENOMEM;
return 0;
}
void <API key>(struct ion_buffer *buffer)
{
kfree(buffer->priv_virt);
}
static int <API key>(struct ion_heap *heap,
struct ion_buffer *buffer,
ion_phys_addr_t *addr, size_t *len)
{
*addr = virt_to_phys(buffer->priv_virt);
*len = buffer->size;
return 0;
}
struct sg_table *<API key>(struct ion_heap *heap,
struct ion_buffer *buffer)
{
struct sg_table *table;
int ret;
table = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
if (!table)
return ERR_PTR(-ENOMEM);
ret = sg_alloc_table(table, 1, GFP_KERNEL);
if (ret) {
kfree(table);
return ERR_PTR(ret);
}
sg_set_page(table->sgl, virt_to_page(buffer->priv_virt), buffer->size,
0);
return table;
}
void <API key>(struct ion_heap *heap,
struct ion_buffer *buffer)
{
sg_free_table(buffer->sg_table);
kfree(buffer->sg_table);
}
int <API key>(struct ion_heap *heap,
struct ion_buffer *buffer,
struct vm_area_struct *vma)
{
unsigned long pfn = __phys_to_pfn(virt_to_phys(buffer->priv_virt));
return remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
}
static struct ion_heap_ops kmalloc_ops = {
.allocate = <API key>,
.free = <API key>,
.phys = <API key>,
.map_dma = <API key>,
.unmap_dma = <API key>,
.map_kernel = ion_heap_map_kernel,
.unmap_kernel = <API key>,
.map_user = <API key>,
};
struct ion_heap *<API key>(struct ion_platform_heap *unused)
{
struct ion_heap *heap;
heap = kzalloc(sizeof(struct ion_heap), GFP_KERNEL);
if (!heap)
return ERR_PTR(-ENOMEM);
heap->ops = &kmalloc_ops;
heap->type = <API key>;
return heap;
}
void <API key>(struct ion_heap *heap)
{
kfree(heap);
} |
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/reboot.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
#include <linux/mfd/pmic8058.h>
#include <linux/mfd/pmic8901.h>
#include <linux/mfd/pm8xxx/misc.h>
#include <asm/mach-types.h>
#include <mach/msm_iomap.h>
#include <mach/restart.h>
#include <mach/socinfo.h>
#include <mach/irqs.h>
#include <mach/scm.h>
#include "msm_watchdog.h"
#include "timer.h"
#define <API key> 0x6f656d00
#define <API key> 0x6f656d11
#define <API key> 0x6f656d22
#define RESTART_REASON_DFU 0x6f656d33
#define <API key> 0x6f656d44
#define <API key> 0x6f656d55
#define <API key> 0x6f656d66
#define WDT0_RST 0x38
#define WDT0_EN 0x40
#define WDT0_BARK_TIME 0x4C
#define WDT0_BITE_TIME 0x5C
#define PSHOLD_CTL_SU (MSM_TLMM_BASE + 0x820)
#define RESTART_REASON_ADDR 0x65C
#define DLOAD_MODE_ADDR 0x0
#define <API key> 1
static int restart_mode;
void *restart_reason;
int pmic_reset_irq;
static void __iomem *msm_tmr0_base;
#ifdef <API key>
static int in_panic;
static void *dload_mode_addr;
/* Download mode master kill-switch */
static int dload_set(const char *val, struct kernel_param *kp);
static int download_mode = 1;
module_param_call(download_mode, dload_set, param_get_int,
&download_mode, 0644);
static int panic_prep_restart(struct notifier_block *this,
unsigned long event, void *ptr)
{
in_panic = 1;
return NOTIFY_DONE;
}
static struct notifier_block panic_blk = {
.notifier_call = panic_prep_restart,
};
static void set_dload_mode(int on)
{
if (dload_mode_addr) {
__raw_writel(on ? 0xE47B337D : 0, dload_mode_addr);
__raw_writel(on ? 0xCE14091A : 0,
dload_mode_addr + sizeof(unsigned int));
mb();
}
}
static int dload_set(const char *val, struct kernel_param *kp)
{
int ret;
int old_val = download_mode;
ret = param_set_int(val, kp);
if (ret)
return ret;
/* If download_mode is not zero or one, ignore. */
if (download_mode >> 1) {
download_mode = old_val;
return -EINVAL;
}
set_dload_mode(download_mode);
return 0;
}
#else
#define set_dload_mode(x) do {} while (0)
#endif
void <API key>(int mode)
{
restart_mode = mode;
}
EXPORT_SYMBOL(<API key>);
static void __msm_power_off(int lower_pshold)
{
printk(KERN_CRIT "Powering off the SoC\n");
#ifdef <API key>
set_dload_mode(0);
#endif
<API key>(0);
if (lower_pshold) {
__raw_writel(0, PSHOLD_CTL_SU);
mdelay(10000);
printk(KERN_ERR "Powering off has failed\n");
}
return;
}
static void msm_power_off(void)
{
/* MSM initiated power off, lower ps_hold */
__msm_power_off(1);
}
static void cpu_power_off(void *data)
{
int rc;
pr_err("PMIC Initiated shutdown %s cpu=%d\n", __func__,
smp_processor_id());
if (smp_processor_id() == 0) {
/*
* PMIC initiated power off, do not lower ps_hold, pmic will
* shut msm down
*/
__msm_power_off(0);
pet_watchdog();
pr_err("Calling scm to disable arbiter\n");
/* call secure manager to disable arbiter and never return */
rc = scm_call_atomic1(SCM_SVC_PWR,
<API key>, 1);
pr_err("SCM returned even when asked to busy loop rc=%d\n", rc);
pr_err("waiting on pmic to shut msm down\n");
}
preempt_disable();
while (1)
;
}
static irqreturn_t resout_irq_handler(int irq, void *dev_id)
{
pr_warn("%s PMIC Initiated shutdown\n", __func__);
oops_in_progress = 1;
<API key>(cpu_online_mask, cpu_power_off, NULL, 0);
if (smp_processor_id() == 0)
cpu_power_off(NULL);
preempt_disable();
while (1)
;
return IRQ_HANDLED;
}
void arch_reset(char mode, const char *cmd)
{
#ifdef <API key>
/* This looks like a normal reboot at this point. */
set_dload_mode(0);
/* Write download mode flags if we're panic'ing */
set_dload_mode(in_panic);
/* Write download mode flags if restart_mode says so */
if (restart_mode == RESTART_DLOAD)
set_dload_mode(1);
/* Kill download mode if master-kill switch is set */
if (!download_mode)
set_dload_mode(0);
#endif
printk(KERN_NOTICE "Going down for restart now\n");
<API key>(1);
if (cmd != NULL) {
if (!strncmp(cmd, "bootloader", 10)) {
__raw_writel(0x77665500, restart_reason);
} else if (!strncmp(cmd, "recovery", 8)) {
__raw_writel(0x77665502, restart_reason);
} else if (!strncmp(cmd, "oem-", 4)) {
unsigned long code;
code = simple_strtoul(cmd + 4, NULL, 16) & 0xff;
__raw_writel(0x6f656d00 | code, restart_reason);
// Palm specific start
} else if (!strcmp(cmd, "shutdown")) {
__raw_writel(<API key>, restart_reason);
} else if (!strcmp(cmd, "recover")) {
__raw_writel(<API key>, restart_reason);
} else if (!strcmp(cmd, "panic")) {
__raw_writel(<API key>, restart_reason);
} else if (!strcmp(cmd, "dfu")) {
__raw_writel(RESTART_REASON_DFU, restart_reason);
} else if (!strcmp(cmd, "reboot")) {
__raw_writel(<API key>, restart_reason);
} else if (!strcmp(cmd, "update")) {
__raw_writel(<API key>, restart_reason);
// Palm specific end
} else {
__raw_writel(0x77665501, restart_reason);
}
}
__raw_writel(0, msm_tmr0_base + WDT0_EN);
if (!(<API key>() || <API key>())) {
mb();
__raw_writel(0, PSHOLD_CTL_SU); /* Actually reset the chip */
mdelay(5000);
pr_notice("PS_HOLD didn't work, falling back to watchdog\n");
}
__raw_writel(1, msm_tmr0_base + WDT0_RST);
__raw_writel(5*0x31F3, msm_tmr0_base + WDT0_BARK_TIME);
__raw_writel(0x31F3, msm_tmr0_base + WDT0_BITE_TIME);
__raw_writel(1, msm_tmr0_base + WDT0_EN);
mdelay(10000);
printk(KERN_ERR "Restarting has failed\n");
}
static int __init msm_restart_init(void)
{
int rc;
#ifdef <API key>
<API key>(&panic_notifier_list, &panic_blk);
dload_mode_addr = MSM_IMEM_BASE + DLOAD_MODE_ADDR;
/* Reset detection is switched on below.*/
set_dload_mode(1);
#endif
msm_tmr0_base = <API key>();
restart_reason = MSM_IMEM_BASE + RESTART_REASON_ADDR;
pm_power_off = msm_power_off;
if (pmic_reset_irq != 0) {
rc = <API key>(pmic_reset_irq,
resout_irq_handler, IRQF_TRIGGER_HIGH,
"restart_from_pmic", NULL);
if (rc < 0)
pr_err("pmic restart irq fail rc = %d\n", rc);
} else {
pr_warn("no pmic restart interrupt specified\n");
}
return 0;
}
late_initcall(msm_restart_init); |
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
</head>
<body>
<h1>Chronicles of Grunt</h1>
This is a sample page for Chronicles of Grunt.
</body> |
<?php
reason_include_once('classes/<API key>.php');
/* $<API key> = array(
'image' => array(
'append' => array(
'entity_delegates/image.php',
'entity_delegates/<API key>.php',
),
),
'site' => array(
'append' => array(
'entity_delegates/site.php',
),
),
'publication_type' => array(
'append' => array(
'entity_delegates/publication.php',
),
),
); */
$<API key> = array(
'image' => array(
'append' => array(
'entity_delegates/image.php',
),
),
'asset' => array(
'append' => array(
'entity_delegates/asset.php',
),
),
'event_type' => array(
'append' => array(
'entity_delegates/event.php',
),
),
'publication_type' => array(
'append' => array(
'entity_delegates/publication.php',
),
),
'feature_type' => array(
'append' => array(
'entity_delegates/feature.php',
),
),
'field' => array(
'append' => array(
'entity_delegates/field.php',
),
),
'social_account_type' => array(
'append' => array(
'entity_delegates/social_account.php',
),
),
'av' => array(
'append' => array(
'entity_delegates/media_work.php',
),
),
);
$config = <API key>();
$config->process($<API key>);
if(reason_file_exists('config/entity_delegates/config_local.php'))
reason_include_once('config/entity_delegates/config_local.php');
$config-><API key>(); |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Thu Oct 02 16:37:52 BST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Interface com.hp.hpl.jena.graph.GraphListener (Apache Jena)</title>
<meta name="date" content="2014-10-02">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.hp.hpl.jena.graph.GraphListener (Apache Jena)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/hp/hpl/jena/graph/class-use/GraphListener.html" target="_top">Frames</a></li>
<li><a href="GraphListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<h2 title="Uses of Interface com.hp.hpl.jena.graph.GraphListener" class="title">Uses of Interface<br>com.hp.hpl.jena.graph.GraphListener</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.hp.hpl.jena.graph">com.hp.hpl.jena.graph</a></td>
<td class="colLast">
<div class="block">This package defines the Graph and Node family of classes, which
form the underlying datatypes of the Jena system.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.hp.hpl.jena.graph">
</a>
<h3>Uses of <a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a> in <a href="../../../../../../com/hp/hpl/jena/graph/package-summary.html">com.hp.hpl.jena.graph</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a> in <a href="../../../../../../com/hp/hpl/jena/graph/package-summary.html">com.hp.hpl.jena.graph</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Interface and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/graph/GraphEventManager.html" title="interface in com.hp.hpl.jena.graph">GraphEventManager</a></strong></code>
<div class="block">The component of a graph responsible for managing events and listeners.</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../com/hp/hpl/jena/graph/package-summary.html">com.hp.hpl.jena.graph</a> with parameters of type <a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/hp/hpl/jena/graph/GraphEventManager.html" title="interface in com.hp.hpl.jena.graph">GraphEventManager</a></code></td>
<td class="colLast"><span class="strong">GraphEventManager.</span><code><strong><a href="../../../../../../com/hp/hpl/jena/graph/GraphEventManager.html#register(com.hp.hpl.jena.graph.GraphListener)">register</a></strong>(<a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a> listener)</code>
<div class="block">Attached <code>listener</code> to this manager; notification events
sent to the manager are sent to all registered listeners.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/hp/hpl/jena/graph/GraphEventManager.html" title="interface in com.hp.hpl.jena.graph">GraphEventManager</a></code></td>
<td class="colLast"><span class="strong">GraphEventManager.</span><code><strong><a href="../../../../../../com/hp/hpl/jena/graph/GraphEventManager.html#unregister(com.hp.hpl.jena.graph.GraphListener)">unregister</a></strong>(<a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">GraphListener</a> listener)</code>
<div class="block">If <code>listener</code> is attached to this manager, detach it, otherwise
do nothing.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/hp/hpl/jena/graph/GraphListener.html" title="interface in com.hp.hpl.jena.graph">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/hp/hpl/jena/graph/class-use/GraphListener.html" target="_top">Frames</a></li>
<li><a href="GraphListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small>Licenced under the Apache License, Version 2.0</small></p>
</body>
</html> |
<?php
// URI: design:node/view/full.tpl
// Filename: extension/ezdemo/design/ezdemo/override/templates/full/landing_page.tpl
// Timestamp: 1389968167 (Fri Jan 17 15:16:07 CET 2014)
$<API key> = isset( $setArray ) ? $setArray : array();
$setArray = array();
$tpl->Level++;
if ( $tpl->Level > 40 )
{
$text = $tpl->MaxLevelWarning;$tpl->Level
return;
}
$<API key> = 1074699607;
if ( !defined( '<API key>' ) )
include_once( 'var/ezdemo_site/cache/template/compiled/common.php' );
$text .= '<div class="content-view-full">
<div class="class-landing-page">
<div class="attribute-page">
';
$textElements = array();
$tpl->processFunction( 'attribute_view_gui', $textElements,
false,
array (
'attribute' =>
array (
0 =>
array (
0 => 4,
1 =>
array (
0 => '',
1 => 2,
2 => 'node',
),
2 => false,
),
1 =>
array (
0 => 5,
1 =>
array (
0 =>
array (
0 => 3,
1 => 'object',
2 => false,
),
),
2 => false,
),
2 =>
array (
0 => 5,
1 =>
array (
0 =>
array (
0 => 3,
1 => 'data_map',
2 => false,
),
),
2 => false,
),
3 =>
array (
0 => 5,
1 =>
array (
0 =>
array (
0 => 3,
1 => 'page',
2 => false,
),
),
2 => false,
),
),
),
array (
0 =>
array (
0 => 5,
1 => 4,
2 => 108,
),
1 =>
array (
0 => 5,
1 => 59,
2 => 163,
),
2 => 'extension/ezdemo/design/ezdemo/override/templates/full/landing_page.tpl',
),
$rootNamespace, $currentNamespace );
$text .= implode( '', $textElements );
$text .= ' </div>
</div>
</div>
';
$setArray = $<API key>;
$tpl->Level
?> |
var public_suffix = {"ac":1,
"com.ac":1,
"edu.ac":1,
"gov.ac":1,
"net.ac":1,
"mil.ac":1,
"org.ac":1,
"ad":1,
"nom.ad":1,
"ae":1,
"co.ae":1,
"net.ae":1,
"org.ae":1,
"sch.ae":1,
"ac.ae":1,
"gov.ae":1,
"mil.ae":1,
"aero":1,
"<API key>.aero":1,
"accident-prevention.aero":1,
"aerobatic.aero":1,
"aeroclub.aero":1,
"aerodrome.aero":1,
"agents.aero":1,
"aircraft.aero":1,
"airline.aero":1,
"airport.aero":1,
"air-surveillance.aero":1,
"airtraffic.aero":1,
"air-traffic-control.aero":1,
"ambulance.aero":1,
"amusement.aero":1,
"association.aero":1,
"author.aero":1,
"ballooning.aero":1,
"broker.aero":1,
"caa.aero":1,
"cargo.aero":1,
"catering.aero":1,
"certification.aero":1,
"championship.aero":1,
"charter.aero":1,
"civilaviation.aero":1,
"club.aero":1,
"conference.aero":1,
"consultant.aero":1,
"consulting.aero":1,
"control.aero":1,
"council.aero":1,
"crew.aero":1,
"design.aero":1,
"dgca.aero":1,
"educator.aero":1,
"emergency.aero":1,
"engine.aero":1,
"engineer.aero":1,
"entertainment.aero":1,
"equipment.aero":1,
"exchange.aero":1,
"express.aero":1,
"federation.aero":1,
"flight.aero":1,
"freight.aero":1,
"fuel.aero":1,
"gliding.aero":1,
"government.aero":1,
"groundhandling.aero":1,
"group.aero":1,
"hanggliding.aero":1,
"homebuilt.aero":1,
"insurance.aero":1,
"journal.aero":1,
"journalist.aero":1,
"leasing.aero":1,
"logistics.aero":1,
"magazine.aero":1,
"maintenance.aero":1,
"marketplace.aero":1,
"media.aero":1,
"microlight.aero":1,
"modelling.aero":1,
"navigation.aero":1,
"parachuting.aero":1,
"paragliding.aero":1,
"<API key>.aero":1,
"pilot.aero":1,
"press.aero":1,
"production.aero":1,
"recreation.aero":1,
"repbody.aero":1,
"res.aero":1,
"research.aero":1,
"rotorcraft.aero":1,
"safety.aero":1,
"scientist.aero":1,
"services.aero":1,
"show.aero":1,
"skydiving.aero":1,
"software.aero":1,
"student.aero":1,
"taxi.aero":1,
"trader.aero":1,
"trading.aero":1,
"trainer.aero":1,
"union.aero":1,
"workinggroup.aero":1,
"works.aero":1,
"af":1,
"gov.af":1,
"com.af":1,
"org.af":1,
"net.af":1,
"edu.af":1,
"ag":1,
"com.ag":1,
"org.ag":1,
"net.ag":1,
"co.ag":1,
"nom.ag":1,
"ai":1,
"off.ai":1,
"com.ai":1,
"net.ai":1,
"org.ai":1,
"al":1,
"com.al":1,
"edu.al":1,
"gov.al":1,
"mil.al":1,
"net.al":1,
"org.al":1,
"am":1,
"an":1,
"com.an":1,
"net.an":1,
"org.an":1,
"edu.an":1,
"ao":1,
"ed.ao":1,
"gv.ao":1,
"og.ao":1,
"co.ao":1,
"pb.ao":1,
"it.ao":1,
"aq":1,
"ar":1,
"com.ar":1,
"edu.ar":1,
"gob.ar":1,
"gov.ar":1,
"int.ar":1,
"mil.ar":1,
"net.ar":1,
"org.ar":1,
"tur.ar":1,
"arpa":1,
"in-addr.arpa":1,
"iris.arpa":1,
"uri.arpa":1,
"urn.arpa":1,
"as":1,
"gov.as":1,
"asia":1,
"at":1,
"ac.at":1,
"co.at":1,
"gv.at":1,
"or.at":1,
"au":1,
"com.au":1,
"net.au":1,
"org.au":1,
"edu.au":1,
"gov.au":1,
"asn.au":1,
"id.au":1,
"info.au":1,
"conf.au":1,
"oz.au":1,
"act.au":1,
"nsw.au":1,
"nt.au":1,
"qld.au":1,
"sa.au":1,
"tas.au":1,
"vic.au":1,
"wa.au":1,
"act.edu.au":1,
"nsw.edu.au":1,
"nt.edu.au":1,
"qld.edu.au":1,
"sa.edu.au":1,
"tas.edu.au":1,
"vic.edu.au":1,
"wa.edu.au":1,
"qld.gov.au":1,
"sa.gov.au":1,
"tas.gov.au":1,
"vic.gov.au":1,
"wa.gov.au":1,
"aw":1,
"com.aw":1,
"ax":1,
"az":1,
"com.az":1,
"net.az":1,
"int.az":1,
"gov.az":1,
"org.az":1,
"edu.az":1,
"info.az":1,
"pp.az":1,
"mil.az":1,
"name.az":1,
"pro.az":1,
"biz.az":1,
"ba":1,
"org.ba":1,
"net.ba":1,
"edu.ba":1,
"gov.ba":1,
"mil.ba":1,
"unsa.ba":1,
"unbi.ba":1,
"co.ba":1,
"com.ba":1,
"rs.ba":1,
"bb":1,
"biz.bb":1,
"co.bb":1,
"com.bb":1,
"edu.bb":1,
"gov.bb":1,
"info.bb":1,
"net.bb":1,
"org.bb":1,
"store.bb":1,
"tv.bb":1,
"be":1,
"ac.be":1,
"bf":1,
"gov.bf":1,
"bg":1,
"a.bg":1,
"b.bg":1,
"c.bg":1,
"d.bg":1,
"e.bg":1,
"f.bg":1,
"g.bg":1,
"h.bg":1,
"i.bg":1,
"j.bg":1,
"k.bg":1,
"l.bg":1,
"m.bg":1,
"n.bg":1,
"o.bg":1,
"p.bg":1,
"q.bg":1,
"r.bg":1,
"s.bg":1,
"t.bg":1,
"u.bg":1,
"v.bg":1,
"w.bg":1,
"x.bg":1,
"y.bg":1,
"z.bg":1,
"bh":1,
"com.bh":1,
"edu.bh":1,
"net.bh":1,
"org.bh":1,
"gov.bh":1,
"bi":1,
"co.bi":1,
"com.bi":1,
"edu.bi":1,
"or.bi":1,
"org.bi":1,
"biz":1,
"bj":1,
"asso.bj":1,
"barreau.bj":1,
"gouv.bj":1,
"bm":1,
"com.bm":1,
"edu.bm":1,
"gov.bm":1,
"net.bm":1,
"org.bm":1,
"bo":1,
"com.bo":1,
"edu.bo":1,
"gov.bo":1,
"gob.bo":1,
"int.bo":1,
"org.bo":1,
"net.bo":1,
"mil.bo":1,
"tv.bo":1,
"br":1,
"adm.br":1,
"adv.br":1,
"agr.br":1,
"am.br":1,
"arq.br":1,
"art.br":1,
"ato.br":1,
"b.br":1,
"bio.br":1,
"blog.br":1,
"bmd.br":1,
"cim.br":1,
"cng.br":1,
"cnt.br":1,
"com.br":1,
"coop.br":1,
"ecn.br":1,
"eco.br":1,
"edu.br":1,
"emp.br":1,
"eng.br":1,
"esp.br":1,
"etc.br":1,
"eti.br":1,
"far.br":1,
"flog.br":1,
"fm.br":1,
"fnd.br":1,
"fot.br":1,
"fst.br":1,
"ggf.br":1,
"gov.br":1,
"imb.br":1,
"ind.br":1,
"inf.br":1,
"jor.br":1,
"jus.br":1,
"leg.br":1,
"lel.br":1,
"mat.br":1,
"med.br":1,
"mil.br":1,
"mp.br":1,
"mus.br":1,
"net.br":1,
"not.br":1,
"ntr.br":1,
"odo.br":1,
"org.br":1,
"ppg.br":1,
"pro.br":1,
"psc.br":1,
"psi.br":1,
"qsl.br":1,
"radio.br":1,
"rec.br":1,
"slg.br":1,
"srv.br":1,
"taxi.br":1,
"teo.br":1,
"tmp.br":1,
"trd.br":1,
"tur.br":1,
"tv.br":1,
"vet.br":1,
"vlog.br":1,
"wiki.br":1,
"zlg.br":1,
"bs":1,
"com.bs":1,
"net.bs":1,
"org.bs":1,
"edu.bs":1,
"gov.bs":1,
"bt":1,
"com.bt":1,
"edu.bt":1,
"gov.bt":1,
"net.bt":1,
"org.bt":1,
"bv":1,
"bw":1,
"co.bw":1,
"org.bw":1,
"by":1,
"gov.by":1,
"mil.by":1,
"com.by":1,
"of.by":1,
"bz":1,
"com.bz":1,
"net.bz":1,
"org.bz":1,
"edu.bz":1,
"gov.bz":1,
"ca":1,
"ab.ca":1,
"bc.ca":1,
"mb.ca":1,
"nb.ca":1,
"nf.ca":1,
"nl.ca":1,
"ns.ca":1,
"nt.ca":1,
"nu.ca":1,
"on.ca":1,
"pe.ca":1,
"qc.ca":1,
"sk.ca":1,
"yk.ca":1,
"gc.ca":1,
"cat":1,
"cc":1,
"cd":1,
"gov.cd":1,
"cf":1,
"cg":1,
"ch":1,
"ci":1,
"org.ci":1,
"or.ci":1,
"com.ci":1,
"co.ci":1,
"edu.ci":1,
"ed.ci":1,
"ac.ci":1,
"net.ci":1,
"go.ci":1,
"asso.ci":1,
"aéroport.ci":1,
"int.ci":1,
"presse.ci":1,
"md.ci":1,
"gouv.ci":1,
"cl":1,
"gov.cl":1,
"gob.cl":1,
"co.cl":1,
"mil.cl":1,
"cm":1,
"co.cm":1,
"com.cm":1,
"gov.cm":1,
"net.cm":1,
"cn":1,
"ac.cn":1,
"com.cn":1,
"edu.cn":1,
"gov.cn":1,
"net.cn":1,
"org.cn":1,
"mil.cn":1,
"ah.cn":1,
"bj.cn":1,
"cq.cn":1,
"fj.cn":1,
"gd.cn":1,
"gs.cn":1,
"gz.cn":1,
"gx.cn":1,
"ha.cn":1,
"hb.cn":1,
"he.cn":1,
"hi.cn":1,
"hl.cn":1,
"hn.cn":1,
"jl.cn":1,
"js.cn":1,
"jx.cn":1,
"ln.cn":1,
"nm.cn":1,
"nx.cn":1,
"qh.cn":1,
"sc.cn":1,
"sd.cn":1,
"sh.cn":1,
"sn.cn":1,
"sx.cn":1,
"tj.cn":1,
"xj.cn":1,
"xz.cn":1,
"yn.cn":1,
"zj.cn":1,
"hk.cn":1,
"mo.cn":1,
"tw.cn":1,
"co":1,
"arts.co":1,
"com.co":1,
"edu.co":1,
"firm.co":1,
"gov.co":1,
"info.co":1,
"int.co":1,
"mil.co":1,
"net.co":1,
"nom.co":1,
"org.co":1,
"rec.co":1,
"web.co":1,
"com":1,
"coop":1,
"cr":1,
"ac.cr":1,
"co.cr":1,
"ed.cr":1,
"fi.cr":1,
"go.cr":1,
"or.cr":1,
"sa.cr":1,
"cu":1,
"com.cu":1,
"edu.cu":1,
"org.cu":1,
"net.cu":1,
"gov.cu":1,
"inf.cu":1,
"cv":1,
"cw":1,
"com.cw":1,
"edu.cw":1,
"net.cw":1,
"org.cw":1,
"cx":1,
"gov.cx":1,
"cz":1,
"de":1,
"dj":1,
"dk":1,
"dm":1,
"com.dm":1,
"net.dm":1,
"org.dm":1,
"edu.dm":1,
"gov.dm":1,
"do":1,
"art.do":1,
"com.do":1,
"edu.do":1,
"gob.do":1,
"gov.do":1,
"mil.do":1,
"net.do":1,
"org.do":1,
"sld.do":1,
"web.do":1,
"dz":1,
"com.dz":1,
"org.dz":1,
"net.dz":1,
"gov.dz":1,
"edu.dz":1,
"asso.dz":1,
"pol.dz":1,
"art.dz":1,
"ec":1,
"com.ec":1,
"info.ec":1,
"net.ec":1,
"fin.ec":1,
"med.ec":1,
"pro.ec":1,
"org.ec":1,
"edu.ec":1,
"gov.ec":1,
"gob.ec":1,
"mil.ec":1,
"edu":1,
"ee":1,
"edu.ee":1,
"gov.ee":1,
"riik.ee":1,
"lib.ee":1,
"med.ee":1,
"com.ee":1,
"pri.ee":1,
"aip.ee":1,
"org.ee":1,
"fie.ee":1,
"eg":1,
"com.eg":1,
"edu.eg":1,
"eun.eg":1,
"gov.eg":1,
"mil.eg":1,
"name.eg":1,
"net.eg":1,
"org.eg":1,
"sci.eg":1,
"es":1,
"com.es":1,
"nom.es":1,
"org.es":1,
"gob.es":1,
"edu.es":1,
"et":1,
"com.et":1,
"gov.et":1,
"org.et":1,
"edu.et":1,
"biz.et":1,
"name.et":1,
"info.et":1,
"eu":1,
"fi":1,
"aland.fi":1,
"fm":1,
"fo":1,
"fr":1,
"com.fr":1,
"asso.fr":1,
"nom.fr":1,
"prd.fr":1,
"presse.fr":1,
"tm.fr":1,
"aeroport.fr":1,
"assedic.fr":1,
"avocat.fr":1,
"avoues.fr":1,
"cci.fr":1,
"chambagri.fr":1,
"<API key>.fr":1,
"experts-comptables.fr":1,
"geometre-expert.fr":1,
"gouv.fr":1,
"greta.fr":1,
"huissier-justice.fr":1,
"medecin.fr":1,
"notaires.fr":1,
"pharmacien.fr":1,
"port.fr":1,
"veterinaire.fr":1,
"ga":1,
"gb":1,
"gd":1,
"ge":1,
"com.ge":1,
"edu.ge":1,
"gov.ge":1,
"org.ge":1,
"mil.ge":1,
"net.ge":1,
"pvt.ge":1,
"gf":1,
"gg":1,
"co.gg":1,
"net.gg":1,
"org.gg":1,
"gh":1,
"com.gh":1,
"edu.gh":1,
"gov.gh":1,
"org.gh":1,
"mil.gh":1,
"gi":1,
"com.gi":1,
"ltd.gi":1,
"gov.gi":1,
"mod.gi":1,
"edu.gi":1,
"org.gi":1,
"gl":1,
"gm":1,
"gn":1,
"ac.gn":1,
"com.gn":1,
"edu.gn":1,
"gov.gn":1,
"org.gn":1,
"net.gn":1,
"gov":1,
"gp":1,
"com.gp":1,
"net.gp":1,
"mobi.gp":1,
"edu.gp":1,
"org.gp":1,
"asso.gp":1,
"gq":1,
"gr":1,
"com.gr":1,
"edu.gr":1,
"net.gr":1,
"org.gr":1,
"gov.gr":1,
"gs":1,
"gt":1,
"com.gt":1,
"edu.gt":1,
"gob.gt":1,
"ind.gt":1,
"mil.gt":1,
"net.gt":1,
"org.gt":1,
"gw":1,
"gy":1,
"co.gy":1,
"com.gy":1,
"net.gy":1,
"hk":1,
"com.hk":1,
"edu.hk":1,
"gov.hk":1,
"idv.hk":1,
"net.hk":1,
"org.hk":1,
"hm":1,
"hn":1,
"com.hn":1,
"edu.hn":1,
"org.hn":1,
"net.hn":1,
"mil.hn":1,
"gob.hn":1,
"hr":1,
"iz.hr":1,
"from.hr":1,
"name.hr":1,
"com.hr":1,
"ht":1,
"com.ht":1,
"shop.ht":1,
"firm.ht":1,
"info.ht":1,
"adult.ht":1,
"net.ht":1,
"pro.ht":1,
"org.ht":1,
"med.ht":1,
"art.ht":1,
"coop.ht":1,
"pol.ht":1,
"asso.ht":1,
"edu.ht":1,
"rel.ht":1,
"gouv.ht":1,
"perso.ht":1,
"hu":1,
"co.hu":1,
"info.hu":1,
"org.hu":1,
"priv.hu":1,
"sport.hu":1,
"tm.hu":1,
"agrar.hu":1,
"bolt.hu":1,
"casino.hu":1,
"city.hu":1,
"erotica.hu":1,
"erotika.hu":1,
"film.hu":1,
"forum.hu":1,
"games.hu":1,
"hotel.hu":1,
"ingatlan.hu":1,
"jogasz.hu":1,
"konyvelo.hu":1,
"lakas.hu":1,
"media.hu":1,
"news.hu":1,
"reklam.hu":1,
"sex.hu":1,
"shop.hu":1,
"suli.hu":1,
"szex.hu":1,
"tozsde.hu":1,
"utazas.hu":1,
"video.hu":1,
"id":1,
"ac.id":1,
"biz.id":1,
"co.id":1,
"desa.id":1,
"go.id":1,
"mil.id":1,
"my.id":1,
"net.id":1,
"or.id":1,
"sch.id":1,
"web.id":1,
"ie":1,
"gov.ie":1,
"im":1,
"ac.im":1,
"co.im":1,
"com.im":1,
"ltd.co.im":1,
"net.im":1,
"org.im":1,
"plc.co.im":1,
"tt.im":1,
"tv.im":1,
"in":1,
"co.in":1,
"firm.in":1,
"net.in":1,
"org.in":1,
"gen.in":1,
"ind.in":1,
"nic.in":1,
"ac.in":1,
"edu.in":1,
"res.in":1,
"gov.in":1,
"mil.in":1,
"info":1,
"int":1,
"eu.int":1,
"io":1,
"com.io":1,
"iq":1,
"gov.iq":1,
"edu.iq":1,
"mil.iq":1,
"com.iq":1,
"org.iq":1,
"net.iq":1,
"ir":1,
"ac.ir":1,
"co.ir":1,
"gov.ir":1,
"id.ir":1,
"net.ir":1,
"org.ir":1,
"sch.ir":1,
"is":1,
"net.is":1,
"com.is":1,
"edu.is":1,
"gov.is":1,
"org.is":1,
"int.is":1,
"it":1,
"gov.it":1,
"edu.it":1,
"abr.it":1,
"abruzzo.it":1,
"aosta-valley.it":1,
"aostavalley.it":1,
"bas.it":1,
"basilicata.it":1,
"cal.it":1,
"calabria.it":1,
"cam.it":1,
"campania.it":1,
"emilia-romagna.it":1,
"emiliaromagna.it":1,
"emr.it":1,
"friuli-v-giulia.it":1,
"friuli-ve-giulia.it":1,
"friuli-vegiulia.it":1,
"<API key>.it":1,
"<API key>.it":1,
"friuli-vgiulia.it":1,
"friuliv-giulia.it":1,
"friulive-giulia.it":1,
"friulivegiulia.it":1,
"<API key>.it":1,
"friuliveneziagiulia.it":1,
"friulivgiulia.it":1,
"fvg.it":1,
"laz.it":1,
"lazio.it":1,
"lig.it":1,
"liguria.it":1,
"lom.it":1,
"lombardia.it":1,
"lombardy.it":1,
"lucania.it":1,
"mar.it":1,
"marche.it":1,
"mol.it":1,
"molise.it":1,
"piedmont.it":1,
"piemonte.it":1,
"pmn.it":1,
"pug.it":1,
"puglia.it":1,
"sar.it":1,
"sardegna.it":1,
"sardinia.it":1,
"sic.it":1,
"sicilia.it":1,
"sicily.it":1,
"taa.it":1,
"tos.it":1,
"toscana.it":1,
"trentino-a-adige.it":1,
"trentino-aadige.it":1,
"trentino-alto-adige.it":1,
"trentino-altoadige.it":1,
"trentino-s-tirol.it":1,
"trentino-stirol.it":1,
"trentino-sud-tirol.it":1,
"trentino-sudtirol.it":1,
"trentino-sued-tirol.it":1,
"trentino-suedtirol.it":1,
"trentinoa-adige.it":1,
"trentinoaadige.it":1,
"trentinoalto-adige.it":1,
"trentinoaltoadige.it":1,
"trentinos-tirol.it":1,
"trentinostirol.it":1,
"trentinosud-tirol.it":1,
"trentinosudtirol.it":1,
"trentinosued-tirol.it":1,
"trentinosuedtirol.it":1,
"tuscany.it":1,
"umb.it":1,
"umbria.it":1,
"val-d-aosta.it":1,
"val-daosta.it":1,
"vald-aosta.it":1,
"valdaosta.it":1,
"valle-aosta.it":1,
"valle-d-aosta.it":1,
"valle-daosta.it":1,
"valleaosta.it":1,
"valled-aosta.it":1,
"valledaosta.it":1,
"vallee-aoste.it":1,
"valleeaoste.it":1,
"vao.it":1,
"vda.it":1,
"ven.it":1,
"veneto.it":1,
"ag.it":1,
"agrigento.it":1,
"al.it":1,
"alessandria.it":1,
"alto-adige.it":1,
"altoadige.it":1,
"an.it":1,
"ancona.it":1,
"<API key>.it":1,
"<API key>.it":1,
"andriabarlettatrani.it":1,
"andriatranibarletta.it":1,
"ao.it":1,
"aosta.it":1,
"aoste.it":1,
"ap.it":1,
"aq.it":1,
"aquila.it":1,
"ar.it":1,
"arezzo.it":1,
"ascoli-piceno.it":1,
"ascolipiceno.it":1,
"asti.it":1,
"at.it":1,
"av.it":1,
"avellino.it":1,
"ba.it":1,
"balsan.it":1,
"bari.it":1,
"<API key>.it":1,
"barlettatraniandria.it":1,
"belluno.it":1,
"benevento.it":1,
"bergamo.it":1,
"bg.it":1,
"bi.it":1,
"biella.it":1,
"bl.it":1,
"bn.it":1,
"bo.it":1,
"bologna.it":1,
"bolzano.it":1,
"bozen.it":1,
"br.it":1,
"brescia.it":1,
"brindisi.it":1,
"bs.it":1,
"bt.it":1,
"bz.it":1,
"ca.it":1,
"cagliari.it":1,
"caltanissetta.it":1,
"campidano-medio.it":1,
"campidanomedio.it":1,
"campobasso.it":1,
"carbonia-iglesias.it":1,
"carboniaiglesias.it":1,
"carrara-massa.it":1,
"carraramassa.it":1,
"caserta.it":1,
"catania.it":1,
"catanzaro.it":1,
"cb.it":1,
"ce.it":1,
"cesena-forli.it":1,
"cesenaforli.it":1,
"ch.it":1,
"chieti.it":1,
"ci.it":1,
"cl.it":1,
"cn.it":1,
"co.it":1,
"como.it":1,
"cosenza.it":1,
"cr.it":1,
"cremona.it":1,
"crotone.it":1,
"cs.it":1,
"ct.it":1,
"cuneo.it":1,
"cz.it":1,
"dell-ogliastra.it":1,
"dellogliastra.it":1,
"en.it":1,
"enna.it":1,
"fc.it":1,
"fe.it":1,
"fermo.it":1,
"ferrara.it":1,
"fg.it":1,
"fi.it":1,
"firenze.it":1,
"florence.it":1,
"fm.it":1,
"foggia.it":1,
"forli-cesena.it":1,
"forlicesena.it":1,
"fr.it":1,
"frosinone.it":1,
"ge.it":1,
"genoa.it":1,
"genova.it":1,
"go.it":1,
"gorizia.it":1,
"gr.it":1,
"grosseto.it":1,
"iglesias-carbonia.it":1,
"iglesiascarbonia.it":1,
"im.it":1,
"imperia.it":1,
"is.it":1,
"isernia.it":1,
"kr.it":1,
"la-spezia.it":1,
"laquila.it":1,
"laspezia.it":1,
"latina.it":1,
"lc.it":1,
"le.it":1,
"lecce.it":1,
"lecco.it":1,
"li.it":1,
"livorno.it":1,
"lo.it":1,
"lodi.it":1,
"lt.it":1,
"lu.it":1,
"lucca.it":1,
"macerata.it":1,
"mantova.it":1,
"massa-carrara.it":1,
"massacarrara.it":1,
"matera.it":1,
"mb.it":1,
"mc.it":1,
"me.it":1,
"medio-campidano.it":1,
"mediocampidano.it":1,
"messina.it":1,
"mi.it":1,
"milan.it":1,
"milano.it":1,
"mn.it":1,
"mo.it":1,
"modena.it":1,
"monza-brianza.it":1,
"<API key>.it":1,
"monza.it":1,
"monzabrianza.it":1,
"monzaebrianza.it":1,
"monzaedellabrianza.it":1,
"ms.it":1,
"mt.it":1,
"na.it":1,
"naples.it":1,
"napoli.it":1,
"no.it":1,
"novara.it":1,
"nu.it":1,
"nuoro.it":1,
"og.it":1,
"ogliastra.it":1,
"olbia-tempio.it":1,
"olbiatempio.it":1,
"or.it":1,
"oristano.it":1,
"ot.it":1,
"pa.it":1,
"padova.it":1,
"padua.it":1,
"palermo.it":1,
"parma.it":1,
"pavia.it":1,
"pc.it":1,
"pd.it":1,
"pe.it":1,
"perugia.it":1,
"pesaro-urbino.it":1,
"pesarourbino.it":1,
"pescara.it":1,
"pg.it":1,
"pi.it":1,
"piacenza.it":1,
"pisa.it":1,
"pistoia.it":1,
"pn.it":1,
"po.it":1,
"pordenone.it":1,
"potenza.it":1,
"pr.it":1,
"prato.it":1,
"pt.it":1,
"pu.it":1,
"pv.it":1,
"pz.it":1,
"ra.it":1,
"ragusa.it":1,
"ravenna.it":1,
"rc.it":1,
"re.it":1,
"reggio-calabria.it":1,
"reggio-emilia.it":1,
"reggiocalabria.it":1,
"reggioemilia.it":1,
"rg.it":1,
"ri.it":1,
"rieti.it":1,
"rimini.it":1,
"rm.it":1,
"rn.it":1,
"ro.it":1,
"roma.it":1,
"rome.it":1,
"rovigo.it":1,
"sa.it":1,
"salerno.it":1,
"sassari.it":1,
"savona.it":1,
"si.it":1,
"siena.it":1,
"siracusa.it":1,
"so.it":1,
"sondrio.it":1,
"sp.it":1,
"sr.it":1,
"ss.it":1,
"suedtirol.it":1,
"sv.it":1,
"ta.it":1,
"taranto.it":1,
"te.it":1,
"tempio-olbia.it":1,
"tempioolbia.it":1,
"teramo.it":1,
"terni.it":1,
"tn.it":1,
"to.it":1,
"torino.it":1,
"tp.it":1,
"tr.it":1,
"<API key>.it":1,
"<API key>.it":1,
"traniandriabarletta.it":1,
"tranibarlettaandria.it":1,
"trapani.it":1,
"trentino.it":1,
"trento.it":1,
"treviso.it":1,
"trieste.it":1,
"ts.it":1,
"turin.it":1,
"tv.it":1,
"ud.it":1,
"udine.it":1,
"urbino-pesaro.it":1,
"urbinopesaro.it":1,
"va.it":1,
"varese.it":1,
"vb.it":1,
"vc.it":1,
"ve.it":1,
"venezia.it":1,
"venice.it":1,
"verbania.it":1,
"vercelli.it":1,
"verona.it":1,
"vi.it":1,
"vibo-valentia.it":1,
"vibovalentia.it":1,
"vicenza.it":1,
"viterbo.it":1,
"vr.it":1,
"vs.it":1,
"vt.it":1,
"vv.it":1,
"je":1,
"co.je":1,
"net.je":1,
"org.je":1,
"jo":1,
"com.jo":1,
"org.jo":1,
"net.jo":1,
"edu.jo":1,
"sch.jo":1,
"gov.jo":1,
"mil.jo":1,
"name.jo":1,
"jobs":1,
"jp":1,
"ac.jp":1,
"ad.jp":1,
"co.jp":1,
"ed.jp":1,
"go.jp":1,
"gr.jp":1,
"lg.jp":1,
"ne.jp":1,
"or.jp":1,
"aichi.jp":1,
"akita.jp":1,
"aomori.jp":1,
"chiba.jp":1,
"ehime.jp":1,
"fukui.jp":1,
"fukuoka.jp":1,
"fukushima.jp":1,
"gifu.jp":1,
"gunma.jp":1,
"hiroshima.jp":1,
"hokkaido.jp":1,
"hyogo.jp":1,
"ibaraki.jp":1,
"ishikawa.jp":1,
"iwate.jp":1,
"kagawa.jp":1,
"kagoshima.jp":1,
"kanagawa.jp":1,
"kochi.jp":1,
"kumamoto.jp":1,
"kyoto.jp":1,
"mie.jp":1,
"miyagi.jp":1,
"miyazaki.jp":1,
"nagano.jp":1,
"nagasaki.jp":1,
"nara.jp":1,
"niigata.jp":1,
"oita.jp":1,
"okayama.jp":1,
"okinawa.jp":1,
"osaka.jp":1,
"saga.jp":1,
"saitama.jp":1,
"shiga.jp":1,
"shimane.jp":1,
"shizuoka.jp":1,
"tochigi.jp":1,
"tokushima.jp":1,
"tokyo.jp":1,
"tottori.jp":1,
"toyama.jp":1,
"wakayama.jp":1,
"yamagata.jp":1,
"yamaguchi.jp":1,
"yamanashi.jp":1,
"aisai.aichi.jp":1,
"ama.aichi.jp":1,
"anjo.aichi.jp":1,
"asuke.aichi.jp":1,
"chiryu.aichi.jp":1,
"chita.aichi.jp":1,
"fuso.aichi.jp":1,
"gamagori.aichi.jp":1,
"handa.aichi.jp":1,
"hazu.aichi.jp":1,
"hekinan.aichi.jp":1,
"higashiura.aichi.jp":1,
"ichinomiya.aichi.jp":1,
"inazawa.aichi.jp":1,
"inuyama.aichi.jp":1,
"isshiki.aichi.jp":1,
"iwakura.aichi.jp":1,
"kanie.aichi.jp":1,
"kariya.aichi.jp":1,
"kasugai.aichi.jp":1,
"kira.aichi.jp":1,
"kiyosu.aichi.jp":1,
"komaki.aichi.jp":1,
"konan.aichi.jp":1,
"kota.aichi.jp":1,
"mihama.aichi.jp":1,
"miyoshi.aichi.jp":1,
"nishio.aichi.jp":1,
"nisshin.aichi.jp":1,
"obu.aichi.jp":1,
"oguchi.aichi.jp":1,
"oharu.aichi.jp":1,
"okazaki.aichi.jp":1,
"owariasahi.aichi.jp":1,
"seto.aichi.jp":1,
"shikatsu.aichi.jp":1,
"shinshiro.aichi.jp":1,
"shitara.aichi.jp":1,
"tahara.aichi.jp":1,
"takahama.aichi.jp":1,
"tobishima.aichi.jp":1,
"toei.aichi.jp":1,
"togo.aichi.jp":1,
"tokai.aichi.jp":1,
"tokoname.aichi.jp":1,
"toyoake.aichi.jp":1,
"toyohashi.aichi.jp":1,
"toyokawa.aichi.jp":1,
"toyone.aichi.jp":1,
"toyota.aichi.jp":1,
"tsushima.aichi.jp":1,
"yatomi.aichi.jp":1,
"akita.akita.jp":1,
"daisen.akita.jp":1,
"fujisato.akita.jp":1,
"gojome.akita.jp":1,
"hachirogata.akita.jp":1,
"happou.akita.jp":1,
"higashinaruse.akita.jp":1,
"honjo.akita.jp":1,
"honjyo.akita.jp":1,
"ikawa.akita.jp":1,
"kamikoani.akita.jp":1,
"kamioka.akita.jp":1,
"katagami.akita.jp":1,
"kazuno.akita.jp":1,
"kitaakita.akita.jp":1,
"kosaka.akita.jp":1,
"kyowa.akita.jp":1,
"misato.akita.jp":1,
"mitane.akita.jp":1,
"moriyoshi.akita.jp":1,
"nikaho.akita.jp":1,
"noshiro.akita.jp":1,
"odate.akita.jp":1,
"oga.akita.jp":1,
"ogata.akita.jp":1,
"semboku.akita.jp":1,
"yokote.akita.jp":1,
"yurihonjo.akita.jp":1,
"aomori.aomori.jp":1,
"gonohe.aomori.jp":1,
"hachinohe.aomori.jp":1,
"hashikami.aomori.jp":1,
"hiranai.aomori.jp":1,
"hirosaki.aomori.jp":1,
"itayanagi.aomori.jp":1,
"kuroishi.aomori.jp":1,
"misawa.aomori.jp":1,
"mutsu.aomori.jp":1,
"nakadomari.aomori.jp":1,
"noheji.aomori.jp":1,
"oirase.aomori.jp":1,
"owani.aomori.jp":1,
"rokunohe.aomori.jp":1,
"sannohe.aomori.jp":1,
"shichinohe.aomori.jp":1,
"shingo.aomori.jp":1,
"takko.aomori.jp":1,
"towada.aomori.jp":1,
"tsugaru.aomori.jp":1,
"tsuruta.aomori.jp":1,
"abiko.chiba.jp":1,
"asahi.chiba.jp":1,
"chonan.chiba.jp":1,
"chosei.chiba.jp":1,
"choshi.chiba.jp":1,
"chuo.chiba.jp":1,
"funabashi.chiba.jp":1,
"futtsu.chiba.jp":1,
"hanamigawa.chiba.jp":1,
"ichihara.chiba.jp":1,
"ichikawa.chiba.jp":1,
"ichinomiya.chiba.jp":1,
"inzai.chiba.jp":1,
"isumi.chiba.jp":1,
"kamagaya.chiba.jp":1,
"kamogawa.chiba.jp":1,
"kashiwa.chiba.jp":1,
"katori.chiba.jp":1,
"katsuura.chiba.jp":1,
"kimitsu.chiba.jp":1,
"kisarazu.chiba.jp":1,
"kozaki.chiba.jp":1,
"kujukuri.chiba.jp":1,
"kyonan.chiba.jp":1,
"matsudo.chiba.jp":1,
"midori.chiba.jp":1,
"mihama.chiba.jp":1,
"minamiboso.chiba.jp":1,
"mobara.chiba.jp":1,
"mutsuzawa.chiba.jp":1,
"nagara.chiba.jp":1,
"nagareyama.chiba.jp":1,
"narashino.chiba.jp":1,
"narita.chiba.jp":1,
"noda.chiba.jp":1,
"oamishirasato.chiba.jp":1,
"omigawa.chiba.jp":1,
"onjuku.chiba.jp":1,
"otaki.chiba.jp":1,
"sakae.chiba.jp":1,
"sakura.chiba.jp":1,
"shimofusa.chiba.jp":1,
"shirako.chiba.jp":1,
"shiroi.chiba.jp":1,
"shisui.chiba.jp":1,
"sodegaura.chiba.jp":1,
"sosa.chiba.jp":1,
"tako.chiba.jp":1,
"tateyama.chiba.jp":1,
"togane.chiba.jp":1,
"tohnosho.chiba.jp":1,
"tomisato.chiba.jp":1,
"urayasu.chiba.jp":1,
"yachimata.chiba.jp":1,
"yachiyo.chiba.jp":1,
"yokaichiba.chiba.jp":1,
"yokoshibahikari.chiba.jp":1,
"yotsukaido.chiba.jp":1,
"ainan.ehime.jp":1,
"honai.ehime.jp":1,
"ikata.ehime.jp":1,
"imabari.ehime.jp":1,
"iyo.ehime.jp":1,
"kamijima.ehime.jp":1,
"kihoku.ehime.jp":1,
"kumakogen.ehime.jp":1,
"masaki.ehime.jp":1,
"matsuno.ehime.jp":1,
"matsuyama.ehime.jp":1,
"namikata.ehime.jp":1,
"niihama.ehime.jp":1,
"ozu.ehime.jp":1,
"saijo.ehime.jp":1,
"seiyo.ehime.jp":1,
"shikokuchuo.ehime.jp":1,
"tobe.ehime.jp":1,
"toon.ehime.jp":1,
"uchiko.ehime.jp":1,
"uwajima.ehime.jp":1,
"yawatahama.ehime.jp":1,
"echizen.fukui.jp":1,
"eiheiji.fukui.jp":1,
"fukui.fukui.jp":1,
"ikeda.fukui.jp":1,
"katsuyama.fukui.jp":1,
"mihama.fukui.jp":1,
"minamiechizen.fukui.jp":1,
"obama.fukui.jp":1,
"ohi.fukui.jp":1,
"ono.fukui.jp":1,
"sabae.fukui.jp":1,
"sakai.fukui.jp":1,
"takahama.fukui.jp":1,
"tsuruga.fukui.jp":1,
"wakasa.fukui.jp":1,
"ashiya.fukuoka.jp":1,
"buzen.fukuoka.jp":1,
"chikugo.fukuoka.jp":1,
"chikuho.fukuoka.jp":1,
"chikujo.fukuoka.jp":1,
"chikushino.fukuoka.jp":1,
"chikuzen.fukuoka.jp":1,
"chuo.fukuoka.jp":1,
"dazaifu.fukuoka.jp":1,
"fukuchi.fukuoka.jp":1,
"hakata.fukuoka.jp":1,
"higashi.fukuoka.jp":1,
"hirokawa.fukuoka.jp":1,
"hisayama.fukuoka.jp":1,
"iizuka.fukuoka.jp":1,
"inatsuki.fukuoka.jp":1,
"kaho.fukuoka.jp":1,
"kasuga.fukuoka.jp":1,
"kasuya.fukuoka.jp":1,
"kawara.fukuoka.jp":1,
"keisen.fukuoka.jp":1,
"koga.fukuoka.jp":1,
"kurate.fukuoka.jp":1,
"kurogi.fukuoka.jp":1,
"kurume.fukuoka.jp":1,
"minami.fukuoka.jp":1,
"miyako.fukuoka.jp":1,
"miyama.fukuoka.jp":1,
"miyawaka.fukuoka.jp":1,
"mizumaki.fukuoka.jp":1,
"munakata.fukuoka.jp":1,
"nakagawa.fukuoka.jp":1,
"nakama.fukuoka.jp":1,
"nishi.fukuoka.jp":1,
"nogata.fukuoka.jp":1,
"ogori.fukuoka.jp":1,
"okagaki.fukuoka.jp":1,
"okawa.fukuoka.jp":1,
"oki.fukuoka.jp":1,
"omuta.fukuoka.jp":1,
"onga.fukuoka.jp":1,
"onojo.fukuoka.jp":1,
"oto.fukuoka.jp":1,
"saigawa.fukuoka.jp":1,
"sasaguri.fukuoka.jp":1,
"shingu.fukuoka.jp":1,
"shinyoshitomi.fukuoka.jp":1,
"shonai.fukuoka.jp":1,
"soeda.fukuoka.jp":1,
"sue.fukuoka.jp":1,
"tachiarai.fukuoka.jp":1,
"tagawa.fukuoka.jp":1,
"takata.fukuoka.jp":1,
"toho.fukuoka.jp":1,
"toyotsu.fukuoka.jp":1,
"tsuiki.fukuoka.jp":1,
"ukiha.fukuoka.jp":1,
"umi.fukuoka.jp":1,
"usui.fukuoka.jp":1,
"yamada.fukuoka.jp":1,
"yame.fukuoka.jp":1,
"yanagawa.fukuoka.jp":1,
"yukuhashi.fukuoka.jp":1,
"aizubange.fukushima.jp":1,
"aizumisato.fukushima.jp":1,
"aizuwakamatsu.fukushima.jp":1,
"asakawa.fukushima.jp":1,
"bandai.fukushima.jp":1,
"date.fukushima.jp":1,
"fukushima.fukushima.jp":1,
"furudono.fukushima.jp":1,
"futaba.fukushima.jp":1,
"hanawa.fukushima.jp":1,
"higashi.fukushima.jp":1,
"hirata.fukushima.jp":1,
"hirono.fukushima.jp":1,
"iitate.fukushima.jp":1,
"inawashiro.fukushima.jp":1,
"ishikawa.fukushima.jp":1,
"iwaki.fukushima.jp":1,
"izumizaki.fukushima.jp":1,
"kagamiishi.fukushima.jp":1,
"kaneyama.fukushima.jp":1,
"kawamata.fukushima.jp":1,
"kitakata.fukushima.jp":1,
"kitashiobara.fukushima.jp":1,
"koori.fukushima.jp":1,
"koriyama.fukushima.jp":1,
"kunimi.fukushima.jp":1,
"miharu.fukushima.jp":1,
"mishima.fukushima.jp":1,
"namie.fukushima.jp":1,
"nango.fukushima.jp":1,
"nishiaizu.fukushima.jp":1,
"nishigo.fukushima.jp":1,
"okuma.fukushima.jp":1,
"omotego.fukushima.jp":1,
"ono.fukushima.jp":1,
"otama.fukushima.jp":1,
"samegawa.fukushima.jp":1,
"shimogo.fukushima.jp":1,
"shirakawa.fukushima.jp":1,
"showa.fukushima.jp":1,
"soma.fukushima.jp":1,
"sukagawa.fukushima.jp":1,
"taishin.fukushima.jp":1,
"tamakawa.fukushima.jp":1,
"tanagura.fukushima.jp":1,
"tenei.fukushima.jp":1,
"yabuki.fukushima.jp":1,
"yamato.fukushima.jp":1,
"yamatsuri.fukushima.jp":1,
"yanaizu.fukushima.jp":1,
"yugawa.fukushima.jp":1,
"anpachi.gifu.jp":1,
"ena.gifu.jp":1,
"gifu.gifu.jp":1,
"ginan.gifu.jp":1,
"godo.gifu.jp":1,
"gujo.gifu.jp":1,
"hashima.gifu.jp":1,
"hichiso.gifu.jp":1,
"hida.gifu.jp":1,
"higashishirakawa.gifu.jp":1,
"ibigawa.gifu.jp":1,
"ikeda.gifu.jp":1,
"kakamigahara.gifu.jp":1,
"kani.gifu.jp":1,
"kasahara.gifu.jp":1,
"kasamatsu.gifu.jp":1,
"kawaue.gifu.jp":1,
"kitagata.gifu.jp":1,
"mino.gifu.jp":1,
"minokamo.gifu.jp":1,
"mitake.gifu.jp":1,
"mizunami.gifu.jp":1,
"motosu.gifu.jp":1,
"nakatsugawa.gifu.jp":1,
"ogaki.gifu.jp":1,
"sakahogi.gifu.jp":1,
"seki.gifu.jp":1,
"sekigahara.gifu.jp":1,
"shirakawa.gifu.jp":1,
"tajimi.gifu.jp":1,
"takayama.gifu.jp":1,
"tarui.gifu.jp":1,
"toki.gifu.jp":1,
"tomika.gifu.jp":1,
"wanouchi.gifu.jp":1,
"yamagata.gifu.jp":1,
"yaotsu.gifu.jp":1,
"yoro.gifu.jp":1,
"annaka.gunma.jp":1,
"chiyoda.gunma.jp":1,
"fujioka.gunma.jp":1,
"higashiagatsuma.gunma.jp":1,
"isesaki.gunma.jp":1,
"itakura.gunma.jp":1,
"kanna.gunma.jp":1,
"kanra.gunma.jp":1,
"katashina.gunma.jp":1,
"kawaba.gunma.jp":1,
"kiryu.gunma.jp":1,
"kusatsu.gunma.jp":1,
"maebashi.gunma.jp":1,
"meiwa.gunma.jp":1,
"midori.gunma.jp":1,
"minakami.gunma.jp":1,
"naganohara.gunma.jp":1,
"nakanojo.gunma.jp":1,
"nanmoku.gunma.jp":1,
"numata.gunma.jp":1,
"oizumi.gunma.jp":1,
"ora.gunma.jp":1,
"ota.gunma.jp":1,
"shibukawa.gunma.jp":1,
"shimonita.gunma.jp":1,
"shinto.gunma.jp":1,
"showa.gunma.jp":1,
"takasaki.gunma.jp":1,
"takayama.gunma.jp":1,
"tamamura.gunma.jp":1,
"tatebayashi.gunma.jp":1,
"tomioka.gunma.jp":1,
"tsukiyono.gunma.jp":1,
"tsumagoi.gunma.jp":1,
"ueno.gunma.jp":1,
"yoshioka.gunma.jp":1,
"asaminami.hiroshima.jp":1,
"daiwa.hiroshima.jp":1,
"etajima.hiroshima.jp":1,
"fuchu.hiroshima.jp":1,
"fukuyama.hiroshima.jp":1,
"hatsukaichi.hiroshima.jp":1,
"higashihiroshima.hiroshima.jp":1,
"hongo.hiroshima.jp":1,
"jinsekikogen.hiroshima.jp":1,
"kaita.hiroshima.jp":1,
"kui.hiroshima.jp":1,
"kumano.hiroshima.jp":1,
"kure.hiroshima.jp":1,
"mihara.hiroshima.jp":1,
"miyoshi.hiroshima.jp":1,
"naka.hiroshima.jp":1,
"onomichi.hiroshima.jp":1,
"osakikamijima.hiroshima.jp":1,
"otake.hiroshima.jp":1,
"saka.hiroshima.jp":1,
"sera.hiroshima.jp":1,
"seranishi.hiroshima.jp":1,
"shinichi.hiroshima.jp":1,
"shobara.hiroshima.jp":1,
"takehara.hiroshima.jp":1,
"abashiri.hokkaido.jp":1,
"abira.hokkaido.jp":1,
"aibetsu.hokkaido.jp":1,
"akabira.hokkaido.jp":1,
"akkeshi.hokkaido.jp":1,
"asahikawa.hokkaido.jp":1,
"ashibetsu.hokkaido.jp":1,
"ashoro.hokkaido.jp":1,
"assabu.hokkaido.jp":1,
"atsuma.hokkaido.jp":1,
"bibai.hokkaido.jp":1,
"biei.hokkaido.jp":1,
"bifuka.hokkaido.jp":1,
"bihoro.hokkaido.jp":1,
"biratori.hokkaido.jp":1,
"chippubetsu.hokkaido.jp":1,
"chitose.hokkaido.jp":1,
"date.hokkaido.jp":1,
"ebetsu.hokkaido.jp":1,
"embetsu.hokkaido.jp":1,
"eniwa.hokkaido.jp":1,
"erimo.hokkaido.jp":1,
"esan.hokkaido.jp":1,
"esashi.hokkaido.jp":1,
"fukagawa.hokkaido.jp":1,
"fukushima.hokkaido.jp":1,
"furano.hokkaido.jp":1,
"furubira.hokkaido.jp":1,
"haboro.hokkaido.jp":1,
"hakodate.hokkaido.jp":1,
"hamatonbetsu.hokkaido.jp":1,
"hidaka.hokkaido.jp":1,
"higashikagura.hokkaido.jp":1,
"higashikawa.hokkaido.jp":1,
"hiroo.hokkaido.jp":1,
"hokuryu.hokkaido.jp":1,
"hokuto.hokkaido.jp":1,
"honbetsu.hokkaido.jp":1,
"horokanai.hokkaido.jp":1,
"horonobe.hokkaido.jp":1,
"ikeda.hokkaido.jp":1,
"imakane.hokkaido.jp":1,
"ishikari.hokkaido.jp":1,
"iwamizawa.hokkaido.jp":1,
"iwanai.hokkaido.jp":1,
"kamifurano.hokkaido.jp":1,
"kamikawa.hokkaido.jp":1,
"kamishihoro.hokkaido.jp":1,
"kamisunagawa.hokkaido.jp":1,
"kamoenai.hokkaido.jp":1,
"kayabe.hokkaido.jp":1,
"kembuchi.hokkaido.jp":1,
"kikonai.hokkaido.jp":1,
"kimobetsu.hokkaido.jp":1,
"kitahiroshima.hokkaido.jp":1,
"kitami.hokkaido.jp":1,
"kiyosato.hokkaido.jp":1,
"koshimizu.hokkaido.jp":1,
"kunneppu.hokkaido.jp":1,
"kuriyama.hokkaido.jp":1,
"kuromatsunai.hokkaido.jp":1,
"kushiro.hokkaido.jp":1,
"kutchan.hokkaido.jp":1,
"kyowa.hokkaido.jp":1,
"mashike.hokkaido.jp":1,
"matsumae.hokkaido.jp":1,
"mikasa.hokkaido.jp":1,
"minamifurano.hokkaido.jp":1,
"mombetsu.hokkaido.jp":1,
"moseushi.hokkaido.jp":1,
"mukawa.hokkaido.jp":1,
"muroran.hokkaido.jp":1,
"naie.hokkaido.jp":1,
"nakagawa.hokkaido.jp":1,
"nakasatsunai.hokkaido.jp":1,
"nakatombetsu.hokkaido.jp":1,
"nanae.hokkaido.jp":1,
"nanporo.hokkaido.jp":1,
"nayoro.hokkaido.jp":1,
"nemuro.hokkaido.jp":1,
"niikappu.hokkaido.jp":1,
"niki.hokkaido.jp":1,
"nishiokoppe.hokkaido.jp":1,
"noboribetsu.hokkaido.jp":1,
"numata.hokkaido.jp":1,
"obihiro.hokkaido.jp":1,
"obira.hokkaido.jp":1,
"oketo.hokkaido.jp":1,
"okoppe.hokkaido.jp":1,
"otaru.hokkaido.jp":1,
"otobe.hokkaido.jp":1,
"otofuke.hokkaido.jp":1,
"otoineppu.hokkaido.jp":1,
"oumu.hokkaido.jp":1,
"ozora.hokkaido.jp":1,
"pippu.hokkaido.jp":1,
"rankoshi.hokkaido.jp":1,
"rebun.hokkaido.jp":1,
"rikubetsu.hokkaido.jp":1,
"rishiri.hokkaido.jp":1,
"rishirifuji.hokkaido.jp":1,
"saroma.hokkaido.jp":1,
"sarufutsu.hokkaido.jp":1,
"shakotan.hokkaido.jp":1,
"shari.hokkaido.jp":1,
"shibecha.hokkaido.jp":1,
"shibetsu.hokkaido.jp":1,
"shikabe.hokkaido.jp":1,
"shikaoi.hokkaido.jp":1,
"shimamaki.hokkaido.jp":1,
"shimizu.hokkaido.jp":1,
"shimokawa.hokkaido.jp":1,
"shinshinotsu.hokkaido.jp":1,
"shintoku.hokkaido.jp":1,
"shiranuka.hokkaido.jp":1,
"shiraoi.hokkaido.jp":1,
"shiriuchi.hokkaido.jp":1,
"sobetsu.hokkaido.jp":1,
"sunagawa.hokkaido.jp":1,
"taiki.hokkaido.jp":1,
"takasu.hokkaido.jp":1,
"takikawa.hokkaido.jp":1,
"takinoue.hokkaido.jp":1,
"teshikaga.hokkaido.jp":1,
"tobetsu.hokkaido.jp":1,
"tohma.hokkaido.jp":1,
"tomakomai.hokkaido.jp":1,
"tomari.hokkaido.jp":1,
"toya.hokkaido.jp":1,
"toyako.hokkaido.jp":1,
"toyotomi.hokkaido.jp":1,
"toyoura.hokkaido.jp":1,
"tsubetsu.hokkaido.jp":1,
"tsukigata.hokkaido.jp":1,
"urakawa.hokkaido.jp":1,
"urausu.hokkaido.jp":1,
"uryu.hokkaido.jp":1,
"utashinai.hokkaido.jp":1,
"wakkanai.hokkaido.jp":1,
"wassamu.hokkaido.jp":1,
"yakumo.hokkaido.jp":1,
"yoichi.hokkaido.jp":1,
"aioi.hyogo.jp":1,
"akashi.hyogo.jp":1,
"ako.hyogo.jp":1,
"amagasaki.hyogo.jp":1,
"aogaki.hyogo.jp":1,
"asago.hyogo.jp":1,
"ashiya.hyogo.jp":1,
"awaji.hyogo.jp":1,
"fukusaki.hyogo.jp":1,
"goshiki.hyogo.jp":1,
"harima.hyogo.jp":1,
"himeji.hyogo.jp":1,
"ichikawa.hyogo.jp":1,
"inagawa.hyogo.jp":1,
"itami.hyogo.jp":1,
"kakogawa.hyogo.jp":1,
"kamigori.hyogo.jp":1,
"kamikawa.hyogo.jp":1,
"kasai.hyogo.jp":1,
"kasuga.hyogo.jp":1,
"kawanishi.hyogo.jp":1,
"miki.hyogo.jp":1,
"minamiawaji.hyogo.jp":1,
"nishinomiya.hyogo.jp":1,
"nishiwaki.hyogo.jp":1,
"ono.hyogo.jp":1,
"sanda.hyogo.jp":1,
"sannan.hyogo.jp":1,
"sasayama.hyogo.jp":1,
"sayo.hyogo.jp":1,
"shingu.hyogo.jp":1,
"shinonsen.hyogo.jp":1,
"shiso.hyogo.jp":1,
"sumoto.hyogo.jp":1,
"taishi.hyogo.jp":1,
"taka.hyogo.jp":1,
"takarazuka.hyogo.jp":1,
"takasago.hyogo.jp":1,
"takino.hyogo.jp":1,
"tamba.hyogo.jp":1,
"tatsuno.hyogo.jp":1,
"toyooka.hyogo.jp":1,
"yabu.hyogo.jp":1,
"yashiro.hyogo.jp":1,
"yoka.hyogo.jp":1,
"yokawa.hyogo.jp":1,
"ami.ibaraki.jp":1,
"asahi.ibaraki.jp":1,
"bando.ibaraki.jp":1,
"chikusei.ibaraki.jp":1,
"daigo.ibaraki.jp":1,
"fujishiro.ibaraki.jp":1,
"hitachi.ibaraki.jp":1,
"hitachinaka.ibaraki.jp":1,
"hitachiomiya.ibaraki.jp":1,
"hitachiota.ibaraki.jp":1,
"ibaraki.ibaraki.jp":1,
"ina.ibaraki.jp":1,
"inashiki.ibaraki.jp":1,
"itako.ibaraki.jp":1,
"iwama.ibaraki.jp":1,
"joso.ibaraki.jp":1,
"kamisu.ibaraki.jp":1,
"kasama.ibaraki.jp":1,
"kashima.ibaraki.jp":1,
"kasumigaura.ibaraki.jp":1,
"koga.ibaraki.jp":1,
"miho.ibaraki.jp":1,
"mito.ibaraki.jp":1,
"moriya.ibaraki.jp":1,
"naka.ibaraki.jp":1,
"namegata.ibaraki.jp":1,
"oarai.ibaraki.jp":1,
"ogawa.ibaraki.jp":1,
"omitama.ibaraki.jp":1,
"ryugasaki.ibaraki.jp":1,
"sakai.ibaraki.jp":1,
"sakuragawa.ibaraki.jp":1,
"shimodate.ibaraki.jp":1,
"shimotsuma.ibaraki.jp":1,
"shirosato.ibaraki.jp":1,
"sowa.ibaraki.jp":1,
"suifu.ibaraki.jp":1,
"takahagi.ibaraki.jp":1,
"tamatsukuri.ibaraki.jp":1,
"tokai.ibaraki.jp":1,
"tomobe.ibaraki.jp":1,
"tone.ibaraki.jp":1,
"toride.ibaraki.jp":1,
"tsuchiura.ibaraki.jp":1,
"tsukuba.ibaraki.jp":1,
"uchihara.ibaraki.jp":1,
"ushiku.ibaraki.jp":1,
"yachiyo.ibaraki.jp":1,
"yamagata.ibaraki.jp":1,
"yawara.ibaraki.jp":1,
"yuki.ibaraki.jp":1,
"anamizu.ishikawa.jp":1,
"hakui.ishikawa.jp":1,
"hakusan.ishikawa.jp":1,
"kaga.ishikawa.jp":1,
"kahoku.ishikawa.jp":1,
"kanazawa.ishikawa.jp":1,
"kawakita.ishikawa.jp":1,
"komatsu.ishikawa.jp":1,
"nakanoto.ishikawa.jp":1,
"nanao.ishikawa.jp":1,
"nomi.ishikawa.jp":1,
"nonoichi.ishikawa.jp":1,
"noto.ishikawa.jp":1,
"shika.ishikawa.jp":1,
"suzu.ishikawa.jp":1,
"tsubata.ishikawa.jp":1,
"tsurugi.ishikawa.jp":1,
"uchinada.ishikawa.jp":1,
"wajima.ishikawa.jp":1,
"fudai.iwate.jp":1,
"fujisawa.iwate.jp":1,
"hanamaki.iwate.jp":1,
"hiraizumi.iwate.jp":1,
"hirono.iwate.jp":1,
"ichinohe.iwate.jp":1,
"ichinoseki.iwate.jp":1,
"iwaizumi.iwate.jp":1,
"iwate.iwate.jp":1,
"joboji.iwate.jp":1,
"kamaishi.iwate.jp":1,
"kanegasaki.iwate.jp":1,
"karumai.iwate.jp":1,
"kawai.iwate.jp":1,
"kitakami.iwate.jp":1,
"kuji.iwate.jp":1,
"kunohe.iwate.jp":1,
"kuzumaki.iwate.jp":1,
"miyako.iwate.jp":1,
"mizusawa.iwate.jp":1,
"morioka.iwate.jp":1,
"ninohe.iwate.jp":1,
"noda.iwate.jp":1,
"ofunato.iwate.jp":1,
"oshu.iwate.jp":1,
"otsuchi.iwate.jp":1,
"rikuzentakata.iwate.jp":1,
"shiwa.iwate.jp":1,
"shizukuishi.iwate.jp":1,
"sumita.iwate.jp":1,
"tanohata.iwate.jp":1,
"tono.iwate.jp":1,
"yahaba.iwate.jp":1,
"yamada.iwate.jp":1,
"ayagawa.kagawa.jp":1,
"higashikagawa.kagawa.jp":1,
"kanonji.kagawa.jp":1,
"kotohira.kagawa.jp":1,
"manno.kagawa.jp":1,
"marugame.kagawa.jp":1,
"mitoyo.kagawa.jp":1,
"naoshima.kagawa.jp":1,
"sanuki.kagawa.jp":1,
"tadotsu.kagawa.jp":1,
"takamatsu.kagawa.jp":1,
"tonosho.kagawa.jp":1,
"uchinomi.kagawa.jp":1,
"utazu.kagawa.jp":1,
"zentsuji.kagawa.jp":1,
"akune.kagoshima.jp":1,
"amami.kagoshima.jp":1,
"hioki.kagoshima.jp":1,
"isa.kagoshima.jp":1,
"isen.kagoshima.jp":1,
"izumi.kagoshima.jp":1,
"kagoshima.kagoshima.jp":1,
"kanoya.kagoshima.jp":1,
"kawanabe.kagoshima.jp":1,
"kinko.kagoshima.jp":1,
"kouyama.kagoshima.jp":1,
"makurazaki.kagoshima.jp":1,
"matsumoto.kagoshima.jp":1,
"minamitane.kagoshima.jp":1,
"nakatane.kagoshima.jp":1,
"nishinoomote.kagoshima.jp":1,
"satsumasendai.kagoshima.jp":1,
"soo.kagoshima.jp":1,
"tarumizu.kagoshima.jp":1,
"yusui.kagoshima.jp":1,
"aikawa.kanagawa.jp":1,
"atsugi.kanagawa.jp":1,
"ayase.kanagawa.jp":1,
"chigasaki.kanagawa.jp":1,
"ebina.kanagawa.jp":1,
"fujisawa.kanagawa.jp":1,
"hadano.kanagawa.jp":1,
"hakone.kanagawa.jp":1,
"hiratsuka.kanagawa.jp":1,
"isehara.kanagawa.jp":1,
"kaisei.kanagawa.jp":1,
"kamakura.kanagawa.jp":1,
"kiyokawa.kanagawa.jp":1,
"matsuda.kanagawa.jp":1,
"minamiashigara.kanagawa.jp":1,
"miura.kanagawa.jp":1,
"nakai.kanagawa.jp":1,
"ninomiya.kanagawa.jp":1,
"odawara.kanagawa.jp":1,
"oi.kanagawa.jp":1,
"oiso.kanagawa.jp":1,
"sagamihara.kanagawa.jp":1,
"samukawa.kanagawa.jp":1,
"tsukui.kanagawa.jp":1,
"yamakita.kanagawa.jp":1,
"yamato.kanagawa.jp":1,
"yokosuka.kanagawa.jp":1,
"yugawara.kanagawa.jp":1,
"zama.kanagawa.jp":1,
"zushi.kanagawa.jp":1,
"aki.kochi.jp":1,
"geisei.kochi.jp":1,
"hidaka.kochi.jp":1,
"higashitsuno.kochi.jp":1,
"ino.kochi.jp":1,
"kagami.kochi.jp":1,
"kami.kochi.jp":1,
"kitagawa.kochi.jp":1,
"kochi.kochi.jp":1,
"mihara.kochi.jp":1,
"motoyama.kochi.jp":1,
"muroto.kochi.jp":1,
"nahari.kochi.jp":1,
"nakamura.kochi.jp":1,
"nankoku.kochi.jp":1,
"nishitosa.kochi.jp":1,
"niyodogawa.kochi.jp":1,
"ochi.kochi.jp":1,
"okawa.kochi.jp":1,
"otoyo.kochi.jp":1,
"otsuki.kochi.jp":1,
"sakawa.kochi.jp":1,
"sukumo.kochi.jp":1,
"susaki.kochi.jp":1,
"tosa.kochi.jp":1,
"tosashimizu.kochi.jp":1,
"toyo.kochi.jp":1,
"tsuno.kochi.jp":1,
"umaji.kochi.jp":1,
"yasuda.kochi.jp":1,
"yusuhara.kochi.jp":1,
"amakusa.kumamoto.jp":1,
"arao.kumamoto.jp":1,
"aso.kumamoto.jp":1,
"choyo.kumamoto.jp":1,
"gyokuto.kumamoto.jp":1,
"hitoyoshi.kumamoto.jp":1,
"kamiamakusa.kumamoto.jp":1,
"kashima.kumamoto.jp":1,
"kikuchi.kumamoto.jp":1,
"kosa.kumamoto.jp":1,
"kumamoto.kumamoto.jp":1,
"mashiki.kumamoto.jp":1,
"mifune.kumamoto.jp":1,
"minamata.kumamoto.jp":1,
"minamioguni.kumamoto.jp":1,
"nagasu.kumamoto.jp":1,
"nishihara.kumamoto.jp":1,
"oguni.kumamoto.jp":1,
"ozu.kumamoto.jp":1,
"sumoto.kumamoto.jp":1,
"takamori.kumamoto.jp":1,
"uki.kumamoto.jp":1,
"uto.kumamoto.jp":1,
"yamaga.kumamoto.jp":1,
"yamato.kumamoto.jp":1,
"yatsushiro.kumamoto.jp":1,
"ayabe.kyoto.jp":1,
"fukuchiyama.kyoto.jp":1,
"higashiyama.kyoto.jp":1,
"ide.kyoto.jp":1,
"ine.kyoto.jp":1,
"joyo.kyoto.jp":1,
"kameoka.kyoto.jp":1,
"kamo.kyoto.jp":1,
"kita.kyoto.jp":1,
"kizu.kyoto.jp":1,
"kumiyama.kyoto.jp":1,
"kyotamba.kyoto.jp":1,
"kyotanabe.kyoto.jp":1,
"kyotango.kyoto.jp":1,
"maizuru.kyoto.jp":1,
"minami.kyoto.jp":1,
"minamiyamashiro.kyoto.jp":1,
"miyazu.kyoto.jp":1,
"muko.kyoto.jp":1,
"nagaokakyo.kyoto.jp":1,
"nakagyo.kyoto.jp":1,
"nantan.kyoto.jp":1,
"oyamazaki.kyoto.jp":1,
"sakyo.kyoto.jp":1,
"seika.kyoto.jp":1,
"tanabe.kyoto.jp":1,
"uji.kyoto.jp":1,
"ujitawara.kyoto.jp":1,
"wazuka.kyoto.jp":1,
"yamashina.kyoto.jp":1,
"yawata.kyoto.jp":1,
"asahi.mie.jp":1,
"inabe.mie.jp":1,
"ise.mie.jp":1,
"kameyama.mie.jp":1,
"kawagoe.mie.jp":1,
"kiho.mie.jp":1,
"kisosaki.mie.jp":1,
"kiwa.mie.jp":1,
"komono.mie.jp":1,
"kumano.mie.jp":1,
"kuwana.mie.jp":1,
"matsusaka.mie.jp":1,
"meiwa.mie.jp":1,
"mihama.mie.jp":1,
"minamiise.mie.jp":1,
"misugi.mie.jp":1,
"miyama.mie.jp":1,
"nabari.mie.jp":1,
"shima.mie.jp":1,
"suzuka.mie.jp":1,
"tado.mie.jp":1,
"taiki.mie.jp":1,
"taki.mie.jp":1,
"tamaki.mie.jp":1,
"toba.mie.jp":1,
"tsu.mie.jp":1,
"udono.mie.jp":1,
"ureshino.mie.jp":1,
"watarai.mie.jp":1,
"yokkaichi.mie.jp":1,
"furukawa.miyagi.jp":1,
"higashimatsushima.miyagi.jp":1,
"ishinomaki.miyagi.jp":1,
"iwanuma.miyagi.jp":1,
"kakuda.miyagi.jp":1,
"kami.miyagi.jp":1,
"kawasaki.miyagi.jp":1,
"kesennuma.miyagi.jp":1,
"marumori.miyagi.jp":1,
"matsushima.miyagi.jp":1,
"minamisanriku.miyagi.jp":1,
"misato.miyagi.jp":1,
"murata.miyagi.jp":1,
"natori.miyagi.jp":1,
"ogawara.miyagi.jp":1,
"ohira.miyagi.jp":1,
"onagawa.miyagi.jp":1,
"osaki.miyagi.jp":1,
"rifu.miyagi.jp":1,
"semine.miyagi.jp":1,
"shibata.miyagi.jp":1,
"shichikashuku.miyagi.jp":1,
"shikama.miyagi.jp":1,
"shiogama.miyagi.jp":1,
"shiroishi.miyagi.jp":1,
"tagajo.miyagi.jp":1,
"taiwa.miyagi.jp":1,
"tome.miyagi.jp":1,
"tomiya.miyagi.jp":1,
"wakuya.miyagi.jp":1,
"watari.miyagi.jp":1,
"yamamoto.miyagi.jp":1,
"zao.miyagi.jp":1,
"aya.miyazaki.jp":1,
"ebino.miyazaki.jp":1,
"gokase.miyazaki.jp":1,
"hyuga.miyazaki.jp":1,
"kadogawa.miyazaki.jp":1,
"kawaminami.miyazaki.jp":1,
"kijo.miyazaki.jp":1,
"kitagawa.miyazaki.jp":1,
"kitakata.miyazaki.jp":1,
"kitaura.miyazaki.jp":1,
"kobayashi.miyazaki.jp":1,
"kunitomi.miyazaki.jp":1,
"kushima.miyazaki.jp":1,
"mimata.miyazaki.jp":1,
"miyakonojo.miyazaki.jp":1,
"miyazaki.miyazaki.jp":1,
"morotsuka.miyazaki.jp":1,
"nichinan.miyazaki.jp":1,
"nishimera.miyazaki.jp":1,
"nobeoka.miyazaki.jp":1,
"saito.miyazaki.jp":1,
"shiiba.miyazaki.jp":1,
"shintomi.miyazaki.jp":1,
"takaharu.miyazaki.jp":1,
"takanabe.miyazaki.jp":1,
"takazaki.miyazaki.jp":1,
"tsuno.miyazaki.jp":1,
"achi.nagano.jp":1,
"agematsu.nagano.jp":1,
"anan.nagano.jp":1,
"aoki.nagano.jp":1,
"asahi.nagano.jp":1,
"azumino.nagano.jp":1,
"chikuhoku.nagano.jp":1,
"chikuma.nagano.jp":1,
"chino.nagano.jp":1,
"fujimi.nagano.jp":1,
"hakuba.nagano.jp":1,
"hara.nagano.jp":1,
"hiraya.nagano.jp":1,
"iida.nagano.jp":1,
"iijima.nagano.jp":1,
"iiyama.nagano.jp":1,
"iizuna.nagano.jp":1,
"ikeda.nagano.jp":1,
"ikusaka.nagano.jp":1,
"ina.nagano.jp":1,
"karuizawa.nagano.jp":1,
"kawakami.nagano.jp":1,
"kiso.nagano.jp":1,
"kisofukushima.nagano.jp":1,
"kitaaiki.nagano.jp":1,
"komagane.nagano.jp":1,
"komoro.nagano.jp":1,
"matsukawa.nagano.jp":1,
"matsumoto.nagano.jp":1,
"miasa.nagano.jp":1,
"minamiaiki.nagano.jp":1,
"minamimaki.nagano.jp":1,
"minamiminowa.nagano.jp":1,
"minowa.nagano.jp":1,
"miyada.nagano.jp":1,
"miyota.nagano.jp":1,
"mochizuki.nagano.jp":1,
"nagano.nagano.jp":1,
"nagawa.nagano.jp":1,
"nagiso.nagano.jp":1,
"nakagawa.nagano.jp":1,
"nakano.nagano.jp":1,
"nozawaonsen.nagano.jp":1,
"obuse.nagano.jp":1,
"ogawa.nagano.jp":1,
"okaya.nagano.jp":1,
"omachi.nagano.jp":1,
"omi.nagano.jp":1,
"ookuwa.nagano.jp":1,
"ooshika.nagano.jp":1,
"otaki.nagano.jp":1,
"otari.nagano.jp":1,
"sakae.nagano.jp":1,
"sakaki.nagano.jp":1,
"saku.nagano.jp":1,
"sakuho.nagano.jp":1,
"shimosuwa.nagano.jp":1,
"shinanomachi.nagano.jp":1,
"shiojiri.nagano.jp":1,
"suwa.nagano.jp":1,
"suzaka.nagano.jp":1,
"takagi.nagano.jp":1,
"takamori.nagano.jp":1,
"takayama.nagano.jp":1,
"tateshina.nagano.jp":1,
"tatsuno.nagano.jp":1,
"togakushi.nagano.jp":1,
"togura.nagano.jp":1,
"tomi.nagano.jp":1,
"ueda.nagano.jp":1,
"wada.nagano.jp":1,
"yamagata.nagano.jp":1,
"yamanouchi.nagano.jp":1,
"yasaka.nagano.jp":1,
"yasuoka.nagano.jp":1,
"chijiwa.nagasaki.jp":1,
"futsu.nagasaki.jp":1,
"goto.nagasaki.jp":1,
"hasami.nagasaki.jp":1,
"hirado.nagasaki.jp":1,
"iki.nagasaki.jp":1,
"isahaya.nagasaki.jp":1,
"kawatana.nagasaki.jp":1,
"kuchinotsu.nagasaki.jp":1,
"matsuura.nagasaki.jp":1,
"nagasaki.nagasaki.jp":1,
"obama.nagasaki.jp":1,
"omura.nagasaki.jp":1,
"oseto.nagasaki.jp":1,
"saikai.nagasaki.jp":1,
"sasebo.nagasaki.jp":1,
"seihi.nagasaki.jp":1,
"shimabara.nagasaki.jp":1,
"shinkamigoto.nagasaki.jp":1,
"togitsu.nagasaki.jp":1,
"tsushima.nagasaki.jp":1,
"unzen.nagasaki.jp":1,
"ando.nara.jp":1,
"gose.nara.jp":1,
"heguri.nara.jp":1,
"higashiyoshino.nara.jp":1,
"ikaruga.nara.jp":1,
"ikoma.nara.jp":1,
"kamikitayama.nara.jp":1,
"kanmaki.nara.jp":1,
"kashiba.nara.jp":1,
"kashihara.nara.jp":1,
"katsuragi.nara.jp":1,
"kawai.nara.jp":1,
"kawakami.nara.jp":1,
"kawanishi.nara.jp":1,
"koryo.nara.jp":1,
"kurotaki.nara.jp":1,
"mitsue.nara.jp":1,
"miyake.nara.jp":1,
"nara.nara.jp":1,
"nosegawa.nara.jp":1,
"oji.nara.jp":1,
"ouda.nara.jp":1,
"oyodo.nara.jp":1,
"sakurai.nara.jp":1,
"sango.nara.jp":1,
"shimoichi.nara.jp":1,
"shimokitayama.nara.jp":1,
"shinjo.nara.jp":1,
"soni.nara.jp":1,
"takatori.nara.jp":1,
"tawaramoto.nara.jp":1,
"tenkawa.nara.jp":1,
"tenri.nara.jp":1,
"uda.nara.jp":1,
"yamatokoriyama.nara.jp":1,
"yamatotakada.nara.jp":1,
"yamazoe.nara.jp":1,
"yoshino.nara.jp":1,
"aga.niigata.jp":1,
"agano.niigata.jp":1,
"gosen.niigata.jp":1,
"itoigawa.niigata.jp":1,
"izumozaki.niigata.jp":1,
"joetsu.niigata.jp":1,
"kamo.niigata.jp":1,
"kariwa.niigata.jp":1,
"kashiwazaki.niigata.jp":1,
"minamiuonuma.niigata.jp":1,
"mitsuke.niigata.jp":1,
"muika.niigata.jp":1,
"murakami.niigata.jp":1,
"myoko.niigata.jp":1,
"nagaoka.niigata.jp":1,
"niigata.niigata.jp":1,
"ojiya.niigata.jp":1,
"omi.niigata.jp":1,
"sado.niigata.jp":1,
"sanjo.niigata.jp":1,
"seiro.niigata.jp":1,
"seirou.niigata.jp":1,
"sekikawa.niigata.jp":1,
"shibata.niigata.jp":1,
"tagami.niigata.jp":1,
"tainai.niigata.jp":1,
"tochio.niigata.jp":1,
"tokamachi.niigata.jp":1,
"tsubame.niigata.jp":1,
"tsunan.niigata.jp":1,
"uonuma.niigata.jp":1,
"yahiko.niigata.jp":1,
"yoita.niigata.jp":1,
"yuzawa.niigata.jp":1,
"beppu.oita.jp":1,
"bungoono.oita.jp":1,
"bungotakada.oita.jp":1,
"hasama.oita.jp":1,
"hiji.oita.jp":1,
"himeshima.oita.jp":1,
"hita.oita.jp":1,
"kamitsue.oita.jp":1,
"kokonoe.oita.jp":1,
"kuju.oita.jp":1,
"kunisaki.oita.jp":1,
"kusu.oita.jp":1,
"oita.oita.jp":1,
"saiki.oita.jp":1,
"taketa.oita.jp":1,
"tsukumi.oita.jp":1,
"usa.oita.jp":1,
"usuki.oita.jp":1,
"yufu.oita.jp":1,
"akaiwa.okayama.jp":1,
"asakuchi.okayama.jp":1,
"bizen.okayama.jp":1,
"hayashima.okayama.jp":1,
"ibara.okayama.jp":1,
"kagamino.okayama.jp":1,
"kasaoka.okayama.jp":1,
"kibichuo.okayama.jp":1,
"kumenan.okayama.jp":1,
"kurashiki.okayama.jp":1,
"maniwa.okayama.jp":1,
"misaki.okayama.jp":1,
"nagi.okayama.jp":1,
"niimi.okayama.jp":1,
"nishiawakura.okayama.jp":1,
"okayama.okayama.jp":1,
"satosho.okayama.jp":1,
"setouchi.okayama.jp":1,
"shinjo.okayama.jp":1,
"shoo.okayama.jp":1,
"soja.okayama.jp":1,
"takahashi.okayama.jp":1,
"tamano.okayama.jp":1,
"tsuyama.okayama.jp":1,
"wake.okayama.jp":1,
"yakage.okayama.jp":1,
"aguni.okinawa.jp":1,
"ginowan.okinawa.jp":1,
"ginoza.okinawa.jp":1,
"gushikami.okinawa.jp":1,
"haebaru.okinawa.jp":1,
"higashi.okinawa.jp":1,
"hirara.okinawa.jp":1,
"iheya.okinawa.jp":1,
"ishigaki.okinawa.jp":1,
"ishikawa.okinawa.jp":1,
"itoman.okinawa.jp":1,
"izena.okinawa.jp":1,
"kadena.okinawa.jp":1,
"kin.okinawa.jp":1,
"kitadaito.okinawa.jp":1,
"kitanakagusuku.okinawa.jp":1,
"kumejima.okinawa.jp":1,
"kunigami.okinawa.jp":1,
"minamidaito.okinawa.jp":1,
"motobu.okinawa.jp":1,
"nago.okinawa.jp":1,
"naha.okinawa.jp":1,
"nakagusuku.okinawa.jp":1,
"nakijin.okinawa.jp":1,
"nanjo.okinawa.jp":1,
"nishihara.okinawa.jp":1,
"ogimi.okinawa.jp":1,
"okinawa.okinawa.jp":1,
"onna.okinawa.jp":1,
"shimoji.okinawa.jp":1,
"taketomi.okinawa.jp":1,
"tarama.okinawa.jp":1,
"tokashiki.okinawa.jp":1,
"tomigusuku.okinawa.jp":1,
"tonaki.okinawa.jp":1,
"urasoe.okinawa.jp":1,
"uruma.okinawa.jp":1,
"yaese.okinawa.jp":1,
"yomitan.okinawa.jp":1,
"yonabaru.okinawa.jp":1,
"yonaguni.okinawa.jp":1,
"zamami.okinawa.jp":1,
"abeno.osaka.jp":1,
"chihayaakasaka.osaka.jp":1,
"chuo.osaka.jp":1,
"daito.osaka.jp":1,
"fujiidera.osaka.jp":1,
"habikino.osaka.jp":1,
"hannan.osaka.jp":1,
"higashiosaka.osaka.jp":1,
"higashisumiyoshi.osaka.jp":1,
"higashiyodogawa.osaka.jp":1,
"hirakata.osaka.jp":1,
"ibaraki.osaka.jp":1,
"ikeda.osaka.jp":1,
"izumi.osaka.jp":1,
"izumiotsu.osaka.jp":1,
"izumisano.osaka.jp":1,
"kadoma.osaka.jp":1,
"kaizuka.osaka.jp":1,
"kanan.osaka.jp":1,
"kashiwara.osaka.jp":1,
"katano.osaka.jp":1,
"kawachinagano.osaka.jp":1,
"kishiwada.osaka.jp":1,
"kita.osaka.jp":1,
"kumatori.osaka.jp":1,
"matsubara.osaka.jp":1,
"minato.osaka.jp":1,
"minoh.osaka.jp":1,
"misaki.osaka.jp":1,
"moriguchi.osaka.jp":1,
"neyagawa.osaka.jp":1,
"nishi.osaka.jp":1,
"nose.osaka.jp":1,
"osakasayama.osaka.jp":1,
"sakai.osaka.jp":1,
"sayama.osaka.jp":1,
"sennan.osaka.jp":1,
"settsu.osaka.jp":1,
"shijonawate.osaka.jp":1,
"shimamoto.osaka.jp":1,
"suita.osaka.jp":1,
"tadaoka.osaka.jp":1,
"taishi.osaka.jp":1,
"tajiri.osaka.jp":1,
"takaishi.osaka.jp":1,
"takatsuki.osaka.jp":1,
"tondabayashi.osaka.jp":1,
"toyonaka.osaka.jp":1,
"toyono.osaka.jp":1,
"yao.osaka.jp":1,
"ariake.saga.jp":1,
"arita.saga.jp":1,
"fukudomi.saga.jp":1,
"genkai.saga.jp":1,
"hamatama.saga.jp":1,
"hizen.saga.jp":1,
"imari.saga.jp":1,
"kamimine.saga.jp":1,
"kanzaki.saga.jp":1,
"karatsu.saga.jp":1,
"kashima.saga.jp":1,
"kitagata.saga.jp":1,
"kitahata.saga.jp":1,
"kiyama.saga.jp":1,
"kouhoku.saga.jp":1,
"kyuragi.saga.jp":1,
"nishiarita.saga.jp":1,
"ogi.saga.jp":1,
"omachi.saga.jp":1,
"ouchi.saga.jp":1,
"saga.saga.jp":1,
"shiroishi.saga.jp":1,
"taku.saga.jp":1,
"tara.saga.jp":1,
"tosu.saga.jp":1,
"yoshinogari.saga.jp":1,
"arakawa.saitama.jp":1,
"asaka.saitama.jp":1,
"chichibu.saitama.jp":1,
"fujimi.saitama.jp":1,
"fujimino.saitama.jp":1,
"fukaya.saitama.jp":1,
"hanno.saitama.jp":1,
"hanyu.saitama.jp":1,
"hasuda.saitama.jp":1,
"hatogaya.saitama.jp":1,
"hatoyama.saitama.jp":1,
"hidaka.saitama.jp":1,
"higashichichibu.saitama.jp":1,
"higashimatsuyama.saitama.jp":1,
"honjo.saitama.jp":1,
"ina.saitama.jp":1,
"iruma.saitama.jp":1,
"iwatsuki.saitama.jp":1,
"kamiizumi.saitama.jp":1,
"kamikawa.saitama.jp":1,
"kamisato.saitama.jp":1,
"kasukabe.saitama.jp":1,
"kawagoe.saitama.jp":1,
"kawaguchi.saitama.jp":1,
"kawajima.saitama.jp":1,
"kazo.saitama.jp":1,
"kitamoto.saitama.jp":1,
"koshigaya.saitama.jp":1,
"kounosu.saitama.jp":1,
"kuki.saitama.jp":1,
"kumagaya.saitama.jp":1,
"matsubushi.saitama.jp":1,
"minano.saitama.jp":1,
"misato.saitama.jp":1,
"miyashiro.saitama.jp":1,
"miyoshi.saitama.jp":1,
"moroyama.saitama.jp":1,
"nagatoro.saitama.jp":1,
"namegawa.saitama.jp":1,
"niiza.saitama.jp":1,
"ogano.saitama.jp":1,
"ogawa.saitama.jp":1,
"ogose.saitama.jp":1,
"okegawa.saitama.jp":1,
"omiya.saitama.jp":1,
"otaki.saitama.jp":1,
"ranzan.saitama.jp":1,
"ryokami.saitama.jp":1,
"saitama.saitama.jp":1,
"sakado.saitama.jp":1,
"satte.saitama.jp":1,
"sayama.saitama.jp":1,
"shiki.saitama.jp":1,
"shiraoka.saitama.jp":1,
"soka.saitama.jp":1,
"sugito.saitama.jp":1,
"toda.saitama.jp":1,
"tokigawa.saitama.jp":1,
"tokorozawa.saitama.jp":1,
"tsurugashima.saitama.jp":1,
"urawa.saitama.jp":1,
"warabi.saitama.jp":1,
"yashio.saitama.jp":1,
"yokoze.saitama.jp":1,
"yono.saitama.jp":1,
"yorii.saitama.jp":1,
"yoshida.saitama.jp":1,
"yoshikawa.saitama.jp":1,
"yoshimi.saitama.jp":1,
"aisho.shiga.jp":1,
"gamo.shiga.jp":1,
"higashiomi.shiga.jp":1,
"hikone.shiga.jp":1,
"koka.shiga.jp":1,
"konan.shiga.jp":1,
"kosei.shiga.jp":1,
"koto.shiga.jp":1,
"kusatsu.shiga.jp":1,
"maibara.shiga.jp":1,
"moriyama.shiga.jp":1,
"nagahama.shiga.jp":1,
"nishiazai.shiga.jp":1,
"notogawa.shiga.jp":1,
"omihachiman.shiga.jp":1,
"otsu.shiga.jp":1,
"ritto.shiga.jp":1,
"ryuoh.shiga.jp":1,
"takashima.shiga.jp":1,
"takatsuki.shiga.jp":1,
"torahime.shiga.jp":1,
"toyosato.shiga.jp":1,
"yasu.shiga.jp":1,
"akagi.shimane.jp":1,
"ama.shimane.jp":1,
"gotsu.shimane.jp":1,
"hamada.shimane.jp":1,
"higashiizumo.shimane.jp":1,
"hikawa.shimane.jp":1,
"hikimi.shimane.jp":1,
"izumo.shimane.jp":1,
"kakinoki.shimane.jp":1,
"masuda.shimane.jp":1,
"matsue.shimane.jp":1,
"misato.shimane.jp":1,
"nishinoshima.shimane.jp":1,
"ohda.shimane.jp":1,
"okinoshima.shimane.jp":1,
"okuizumo.shimane.jp":1,
"shimane.shimane.jp":1,
"tamayu.shimane.jp":1,
"tsuwano.shimane.jp":1,
"unnan.shimane.jp":1,
"yakumo.shimane.jp":1,
"yasugi.shimane.jp":1,
"yatsuka.shimane.jp":1,
"arai.shizuoka.jp":1,
"atami.shizuoka.jp":1,
"fuji.shizuoka.jp":1,
"fujieda.shizuoka.jp":1,
"fujikawa.shizuoka.jp":1,
"fujinomiya.shizuoka.jp":1,
"fukuroi.shizuoka.jp":1,
"gotemba.shizuoka.jp":1,
"haibara.shizuoka.jp":1,
"hamamatsu.shizuoka.jp":1,
"higashiizu.shizuoka.jp":1,
"ito.shizuoka.jp":1,
"iwata.shizuoka.jp":1,
"izu.shizuoka.jp":1,
"izunokuni.shizuoka.jp":1,
"kakegawa.shizuoka.jp":1,
"kannami.shizuoka.jp":1,
"kawanehon.shizuoka.jp":1,
"kawazu.shizuoka.jp":1,
"kikugawa.shizuoka.jp":1,
"kosai.shizuoka.jp":1,
"makinohara.shizuoka.jp":1,
"matsuzaki.shizuoka.jp":1,
"minamiizu.shizuoka.jp":1,
"mishima.shizuoka.jp":1,
"morimachi.shizuoka.jp":1,
"nishiizu.shizuoka.jp":1,
"numazu.shizuoka.jp":1,
"omaezaki.shizuoka.jp":1,
"shimada.shizuoka.jp":1,
"shimizu.shizuoka.jp":1,
"shimoda.shizuoka.jp":1,
"shizuoka.shizuoka.jp":1,
"susono.shizuoka.jp":1,
"yaizu.shizuoka.jp":1,
"yoshida.shizuoka.jp":1,
"ashikaga.tochigi.jp":1,
"bato.tochigi.jp":1,
"haga.tochigi.jp":1,
"ichikai.tochigi.jp":1,
"iwafune.tochigi.jp":1,
"kaminokawa.tochigi.jp":1,
"kanuma.tochigi.jp":1,
"karasuyama.tochigi.jp":1,
"kuroiso.tochigi.jp":1,
"mashiko.tochigi.jp":1,
"mibu.tochigi.jp":1,
"moka.tochigi.jp":1,
"motegi.tochigi.jp":1,
"nasu.tochigi.jp":1,
"nasushiobara.tochigi.jp":1,
"nikko.tochigi.jp":1,
"nishikata.tochigi.jp":1,
"nogi.tochigi.jp":1,
"ohira.tochigi.jp":1,
"ohtawara.tochigi.jp":1,
"oyama.tochigi.jp":1,
"sakura.tochigi.jp":1,
"sano.tochigi.jp":1,
"shimotsuke.tochigi.jp":1,
"shioya.tochigi.jp":1,
"takanezawa.tochigi.jp":1,
"tochigi.tochigi.jp":1,
"tsuga.tochigi.jp":1,
"ujiie.tochigi.jp":1,
"utsunomiya.tochigi.jp":1,
"yaita.tochigi.jp":1,
"aizumi.tokushima.jp":1,
"anan.tokushima.jp":1,
"ichiba.tokushima.jp":1,
"itano.tokushima.jp":1,
"kainan.tokushima.jp":1,
"komatsushima.tokushima.jp":1,
"matsushige.tokushima.jp":1,
"mima.tokushima.jp":1,
"minami.tokushima.jp":1,
"miyoshi.tokushima.jp":1,
"mugi.tokushima.jp":1,
"nakagawa.tokushima.jp":1,
"naruto.tokushima.jp":1,
"sanagochi.tokushima.jp":1,
"shishikui.tokushima.jp":1,
"tokushima.tokushima.jp":1,
"wajiki.tokushima.jp":1,
"adachi.tokyo.jp":1,
"akiruno.tokyo.jp":1,
"akishima.tokyo.jp":1,
"aogashima.tokyo.jp":1,
"arakawa.tokyo.jp":1,
"bunkyo.tokyo.jp":1,
"chiyoda.tokyo.jp":1,
"chofu.tokyo.jp":1,
"chuo.tokyo.jp":1,
"edogawa.tokyo.jp":1,
"fuchu.tokyo.jp":1,
"fussa.tokyo.jp":1,
"hachijo.tokyo.jp":1,
"hachioji.tokyo.jp":1,
"hamura.tokyo.jp":1,
"higashikurume.tokyo.jp":1,
"higashimurayama.tokyo.jp":1,
"higashiyamato.tokyo.jp":1,
"hino.tokyo.jp":1,
"hinode.tokyo.jp":1,
"hinohara.tokyo.jp":1,
"inagi.tokyo.jp":1,
"itabashi.tokyo.jp":1,
"katsushika.tokyo.jp":1,
"kita.tokyo.jp":1,
"kiyose.tokyo.jp":1,
"kodaira.tokyo.jp":1,
"koganei.tokyo.jp":1,
"kokubunji.tokyo.jp":1,
"komae.tokyo.jp":1,
"koto.tokyo.jp":1,
"kouzushima.tokyo.jp":1,
"kunitachi.tokyo.jp":1,
"machida.tokyo.jp":1,
"meguro.tokyo.jp":1,
"minato.tokyo.jp":1,
"mitaka.tokyo.jp":1,
"mizuho.tokyo.jp":1,
"musashimurayama.tokyo.jp":1,
"musashino.tokyo.jp":1,
"nakano.tokyo.jp":1,
"nerima.tokyo.jp":1,
"ogasawara.tokyo.jp":1,
"okutama.tokyo.jp":1,
"ome.tokyo.jp":1,
"oshima.tokyo.jp":1,
"ota.tokyo.jp":1,
"setagaya.tokyo.jp":1,
"shibuya.tokyo.jp":1,
"shinagawa.tokyo.jp":1,
"shinjuku.tokyo.jp":1,
"suginami.tokyo.jp":1,
"sumida.tokyo.jp":1,
"tachikawa.tokyo.jp":1,
"taito.tokyo.jp":1,
"tama.tokyo.jp":1,
"toshima.tokyo.jp":1,
"chizu.tottori.jp":1,
"hino.tottori.jp":1,
"kawahara.tottori.jp":1,
"koge.tottori.jp":1,
"kotoura.tottori.jp":1,
"misasa.tottori.jp":1,
"nanbu.tottori.jp":1,
"nichinan.tottori.jp":1,
"sakaiminato.tottori.jp":1,
"tottori.tottori.jp":1,
"wakasa.tottori.jp":1,
"yazu.tottori.jp":1,
"yonago.tottori.jp":1,
"asahi.toyama.jp":1,
"fuchu.toyama.jp":1,
"fukumitsu.toyama.jp":1,
"funahashi.toyama.jp":1,
"himi.toyama.jp":1,
"imizu.toyama.jp":1,
"inami.toyama.jp":1,
"johana.toyama.jp":1,
"kamiichi.toyama.jp":1,
"kurobe.toyama.jp":1,
"nakaniikawa.toyama.jp":1,
"namerikawa.toyama.jp":1,
"nanto.toyama.jp":1,
"nyuzen.toyama.jp":1,
"oyabe.toyama.jp":1,
"taira.toyama.jp":1,
"takaoka.toyama.jp":1,
"tateyama.toyama.jp":1,
"toga.toyama.jp":1,
"tonami.toyama.jp":1,
"toyama.toyama.jp":1,
"unazuki.toyama.jp":1,
"uozu.toyama.jp":1,
"yamada.toyama.jp":1,
"arida.wakayama.jp":1,
"aridagawa.wakayama.jp":1,
"gobo.wakayama.jp":1,
"hashimoto.wakayama.jp":1,
"hidaka.wakayama.jp":1,
"hirogawa.wakayama.jp":1,
"inami.wakayama.jp":1,
"iwade.wakayama.jp":1,
"kainan.wakayama.jp":1,
"kamitonda.wakayama.jp":1,
"katsuragi.wakayama.jp":1,
"kimino.wakayama.jp":1,
"kinokawa.wakayama.jp":1,
"kitayama.wakayama.jp":1,
"koya.wakayama.jp":1,
"koza.wakayama.jp":1,
"kozagawa.wakayama.jp":1,
"kudoyama.wakayama.jp":1,
"kushimoto.wakayama.jp":1,
"mihama.wakayama.jp":1,
"misato.wakayama.jp":1,
"nachikatsuura.wakayama.jp":1,
"shingu.wakayama.jp":1,
"shirahama.wakayama.jp":1,
"taiji.wakayama.jp":1,
"tanabe.wakayama.jp":1,
"wakayama.wakayama.jp":1,
"yuasa.wakayama.jp":1,
"yura.wakayama.jp":1,
"asahi.yamagata.jp":1,
"funagata.yamagata.jp":1,
"higashine.yamagata.jp":1,
"iide.yamagata.jp":1,
"kahoku.yamagata.jp":1,
"kaminoyama.yamagata.jp":1,
"kaneyama.yamagata.jp":1,
"kawanishi.yamagata.jp":1,
"mamurogawa.yamagata.jp":1,
"mikawa.yamagata.jp":1,
"murayama.yamagata.jp":1,
"nagai.yamagata.jp":1,
"nakayama.yamagata.jp":1,
"nanyo.yamagata.jp":1,
"nishikawa.yamagata.jp":1,
"obanazawa.yamagata.jp":1,
"oe.yamagata.jp":1,
"oguni.yamagata.jp":1,
"ohkura.yamagata.jp":1,
"oishida.yamagata.jp":1,
"sagae.yamagata.jp":1,
"sakata.yamagata.jp":1,
"sakegawa.yamagata.jp":1,
"shinjo.yamagata.jp":1,
"shirataka.yamagata.jp":1,
"shonai.yamagata.jp":1,
"takahata.yamagata.jp":1,
"tendo.yamagata.jp":1,
"tozawa.yamagata.jp":1,
"tsuruoka.yamagata.jp":1,
"yamagata.yamagata.jp":1,
"yamanobe.yamagata.jp":1,
"yonezawa.yamagata.jp":1,
"yuza.yamagata.jp":1,
"abu.yamaguchi.jp":1,
"hagi.yamaguchi.jp":1,
"hikari.yamaguchi.jp":1,
"hofu.yamaguchi.jp":1,
"iwakuni.yamaguchi.jp":1,
"kudamatsu.yamaguchi.jp":1,
"mitou.yamaguchi.jp":1,
"nagato.yamaguchi.jp":1,
"oshima.yamaguchi.jp":1,
"shimonoseki.yamaguchi.jp":1,
"shunan.yamaguchi.jp":1,
"tabuse.yamaguchi.jp":1,
"tokuyama.yamaguchi.jp":1,
"toyota.yamaguchi.jp":1,
"ube.yamaguchi.jp":1,
"yuu.yamaguchi.jp":1,
"chuo.yamanashi.jp":1,
"doshi.yamanashi.jp":1,
"fuefuki.yamanashi.jp":1,
"fujikawa.yamanashi.jp":1,
"fujikawaguchiko.yamanashi.jp":1,
"fujiyoshida.yamanashi.jp":1,
"hayakawa.yamanashi.jp":1,
"hokuto.yamanashi.jp":1,
"ichikawamisato.yamanashi.jp":1,
"kai.yamanashi.jp":1,
"kofu.yamanashi.jp":1,
"koshu.yamanashi.jp":1,
"kosuge.yamanashi.jp":1,
"minami-alps.yamanashi.jp":1,
"minobu.yamanashi.jp":1,
"nakamichi.yamanashi.jp":1,
"nanbu.yamanashi.jp":1,
"narusawa.yamanashi.jp":1,
"nirasaki.yamanashi.jp":1,
"nishikatsura.yamanashi.jp":1,
"oshino.yamanashi.jp":1,
"otsuki.yamanashi.jp":1,
"showa.yamanashi.jp":1,
"tabayama.yamanashi.jp":1,
"tsuru.yamanashi.jp":1,
"uenohara.yamanashi.jp":1,
"yamanakako.yamanashi.jp":1,
"yamanashi.yamanashi.jp":1,
"kg":1,
"org.kg":1,
"net.kg":1,
"com.kg":1,
"edu.kg":1,
"gov.kg":1,
"mil.kg":1,
"ki":1,
"edu.ki":1,
"biz.ki":1,
"net.ki":1,
"org.ki":1,
"gov.ki":1,
"info.ki":1,
"com.ki":1,
"km":1,
"org.km":1,
"nom.km":1,
"gov.km":1,
"prd.km":1,
"tm.km":1,
"edu.km":1,
"mil.km":1,
"ass.km":1,
"com.km":1,
"coop.km":1,
"asso.km":1,
"presse.km":1,
"medecin.km":1,
"notaires.km":1,
"pharmaciens.km":1,
"veterinaire.km":1,
"gouv.km":1,
"kn":1,
"net.kn":1,
"org.kn":1,
"edu.kn":1,
"gov.kn":1,
"kp":1,
"com.kp":1,
"edu.kp":1,
"gov.kp":1,
"org.kp":1,
"rep.kp":1,
"tra.kp":1,
"kr":1,
"ac.kr":1,
"co.kr":1,
"es.kr":1,
"go.kr":1,
"hs.kr":1,
"kg.kr":1,
"mil.kr":1,
"ms.kr":1,
"ne.kr":1,
"or.kr":1,
"pe.kr":1,
"re.kr":1,
"sc.kr":1,
"busan.kr":1,
"chungbuk.kr":1,
"chungnam.kr":1,
"daegu.kr":1,
"daejeon.kr":1,
"gangwon.kr":1,
"gwangju.kr":1,
"gyeongbuk.kr":1,
"gyeonggi.kr":1,
"gyeongnam.kr":1,
"incheon.kr":1,
"jeju.kr":1,
"jeonbuk.kr":1,
"jeonnam.kr":1,
"seoul.kr":1,
"ulsan.kr":1,
"ky":1,
"edu.ky":1,
"gov.ky":1,
"com.ky":1,
"org.ky":1,
"net.ky":1,
"kz":1,
"org.kz":1,
"edu.kz":1,
"net.kz":1,
"gov.kz":1,
"mil.kz":1,
"com.kz":1,
"la":1,
"int.la":1,
"net.la":1,
"info.la":1,
"edu.la":1,
"gov.la":1,
"per.la":1,
"com.la":1,
"org.la":1,
"lb":1,
"com.lb":1,
"edu.lb":1,
"gov.lb":1,
"net.lb":1,
"org.lb":1,
"lc":1,
"com.lc":1,
"net.lc":1,
"co.lc":1,
"org.lc":1,
"edu.lc":1,
"gov.lc":1,
"li":1,
"lk":1,
"gov.lk":1,
"sch.lk":1,
"net.lk":1,
"int.lk":1,
"com.lk":1,
"org.lk":1,
"edu.lk":1,
"ngo.lk":1,
"soc.lk":1,
"web.lk":1,
"ltd.lk":1,
"assn.lk":1,
"grp.lk":1,
"hotel.lk":1,
"lr":1,
"com.lr":1,
"edu.lr":1,
"gov.lr":1,
"org.lr":1,
"net.lr":1,
"ls":1,
"co.ls":1,
"org.ls":1,
"lt":1,
"gov.lt":1,
"lu":1,
"lv":1,
"com.lv":1,
"edu.lv":1,
"gov.lv":1,
"org.lv":1,
"mil.lv":1,
"id.lv":1,
"net.lv":1,
"asn.lv":1,
"conf.lv":1,
"ly":1,
"com.ly":1,
"net.ly":1,
"gov.ly":1,
"plc.ly":1,
"edu.ly":1,
"sch.ly":1,
"med.ly":1,
"org.ly":1,
"id.ly":1,
"ma":1,
"co.ma":1,
"net.ma":1,
"gov.ma":1,
"org.ma":1,
"ac.ma":1,
"press.ma":1,
"mc":1,
"tm.mc":1,
"asso.mc":1,
"md":1,
"me":1,
"co.me":1,
"net.me":1,
"org.me":1,
"edu.me":1,
"ac.me":1,
"gov.me":1,
"its.me":1,
"priv.me":1,
"mg":1,
"org.mg":1,
"nom.mg":1,
"gov.mg":1,
"prd.mg":1,
"tm.mg":1,
"edu.mg":1,
"mil.mg":1,
"com.mg":1,
"mh":1,
"mil":1,
"mk":1,
"com.mk":1,
"org.mk":1,
"net.mk":1,
"edu.mk":1,
"gov.mk":1,
"inf.mk":1,
"name.mk":1,
"ml":1,
"com.ml":1,
"edu.ml":1,
"gouv.ml":1,
"gov.ml":1,
"net.ml":1,
"org.ml":1,
"presse.ml":1,
"mn":1,
"gov.mn":1,
"edu.mn":1,
"org.mn":1,
"mo":1,
"com.mo":1,
"net.mo":1,
"org.mo":1,
"edu.mo":1,
"gov.mo":1,
"mobi":1,
"mp":1,
"mq":1,
"mr":1,
"gov.mr":1,
"ms":1,
"com.ms":1,
"edu.ms":1,
"gov.ms":1,
"net.ms":1,
"org.ms":1,
"mt":1,
"com.mt":1,
"edu.mt":1,
"net.mt":1,
"org.mt":1,
"mu":1,
"com.mu":1,
"net.mu":1,
"org.mu":1,
"gov.mu":1,
"ac.mu":1,
"co.mu":1,
"or.mu":1,
"museum":1,
"academy.museum":1,
"agriculture.museum":1,
"air.museum":1,
"airguard.museum":1,
"alabama.museum":1,
"alaska.museum":1,
"amber.museum":1,
"ambulance.museum":1,
"american.museum":1,
"americana.museum":1,
"americanantiques.museum":1,
"americanart.museum":1,
"amsterdam.museum":1,
"and.museum":1,
"annefrank.museum":1,
"anthro.museum":1,
"anthropology.museum":1,
"antiques.museum":1,
"aquarium.museum":1,
"arboretum.museum":1,
"archaeological.museum":1,
"archaeology.museum":1,
"architecture.museum":1,
"art.museum":1,
"artanddesign.museum":1,
"artcenter.museum":1,
"artdeco.museum":1,
"arteducation.museum":1,
"artgallery.museum":1,
"arts.museum":1,
"artsandcrafts.museum":1,
"asmatart.museum":1,
"assassination.museum":1,
"assisi.museum":1,
"association.museum":1,
"astronomy.museum":1,
"atlanta.museum":1,
"austin.museum":1,
"australia.museum":1,
"automotive.museum":1,
"aviation.museum":1,
"axis.museum":1,
"badajoz.museum":1,
"baghdad.museum":1,
"bahn.museum":1,
"bale.museum":1,
"baltimore.museum":1,
"barcelona.museum":1,
"baseball.museum":1,
"basel.museum":1,
"baths.museum":1,
"bauern.museum":1,
"beauxarts.museum":1,
"beeldengeluid.museum":1,
"bellevue.museum":1,
"bergbau.museum":1,
"berkeley.museum":1,
"berlin.museum":1,
"bern.museum":1,
"bible.museum":1,
"bilbao.museum":1,
"bill.museum":1,
"birdart.museum":1,
"birthplace.museum":1,
"bonn.museum":1,
"boston.museum":1,
"botanical.museum":1,
"botanicalgarden.museum":1,
"botanicgarden.museum":1,
"botany.museum":1,
"brandywinevalley.museum":1,
"brasil.museum":1,
"bristol.museum":1,
"british.museum":1,
"britishcolumbia.museum":1,
"broadcast.museum":1,
"brunel.museum":1,
"brussel.museum":1,
"brussels.museum":1,
"bruxelles.museum":1,
"building.museum":1,
"burghof.museum":1,
"bus.museum":1,
"bushey.museum":1,
"cadaques.museum":1,
"california.museum":1,
"cambridge.museum":1,
"can.museum":1,
"canada.museum":1,
"capebreton.museum":1,
"carrier.museum":1,
"cartoonart.museum":1,
"casadelamoneda.museum":1,
"castle.museum":1,
"castres.museum":1,
"celtic.museum":1,
"center.museum":1,
"chattanooga.museum":1,
"cheltenham.museum":1,
"chesapeakebay.museum":1,
"chicago.museum":1,
"children.museum":1,
"childrens.museum":1,
"childrensgarden.museum":1,
"chiropractic.museum":1,
"chocolate.museum":1,
"christiansburg.museum":1,
"cincinnati.museum":1,
"cinema.museum":1,
"circus.museum":1,
"civilisation.museum":1,
"civilization.museum":1,
"civilwar.museum":1,
"clinton.museum":1,
"clock.museum":1,
"coal.museum":1,
"coastaldefence.museum":1,
"cody.museum":1,
"coldwar.museum":1,
"collection.museum":1,
"<API key>.museum":1,
"coloradoplateau.museum":1,
"columbia.museum":1,
"columbus.museum":1,
"communication.museum":1,
"communications.museum":1,
"community.museum":1,
"computer.museum":1,
"computerhistory.museum":1,
"comunicações.museum":1,
"contemporary.museum":1,
"contemporaryart.museum":1,
"convent.museum":1,
"copenhagen.museum":1,
"corporation.museum":1,
"correios-e-telecomunicações.museum":1,
"corvette.museum":1,
"costume.museum":1,
"countryestate.museum":1,
"county.museum":1,
"crafts.museum":1,
"cranbrook.museum":1,
"creation.museum":1,
"cultural.museum":1,
"culturalcenter.museum":1,
"culture.museum":1,
"cyber.museum":1,
"cymru.museum":1,
"dali.museum":1,
"dallas.museum":1,
"database.museum":1,
"ddr.museum":1,
"decorativearts.museum":1,
"delaware.museum":1,
"delmenhorst.museum":1,
"denmark.museum":1,
"depot.museum":1,
"design.museum":1,
"detroit.museum":1,
"dinosaur.museum":1,
"discovery.museum":1,
"dolls.museum":1,
"donostia.museum":1,
"durham.museum":1,
"eastafrica.museum":1,
"eastcoast.museum":1,
"education.museum":1,
"educational.museum":1,
"egyptian.museum":1,
"eisenbahn.museum":1,
"elburg.museum":1,
"elvendrell.museum":1,
"embroidery.museum":1,
"encyclopedic.museum":1,
"england.museum":1,
"entomology.museum":1,
"environment.museum":1,
"<API key>.museum":1,
"epilepsy.museum":1,
"essex.museum":1,
"estate.museum":1,
"ethnology.museum":1,
"exeter.museum":1,
"exhibition.museum":1,
"family.museum":1,
"farm.museum":1,
"farmequipment.museum":1,
"farmers.museum":1,
"farmstead.museum":1,
"field.museum":1,
"figueres.museum":1,
"filatelia.museum":1,
"film.museum":1,
"fineart.museum":1,
"finearts.museum":1,
"finland.museum":1,
"flanders.museum":1,
"florida.museum":1,
"force.museum":1,
"fortmissoula.museum":1,
"fortworth.museum":1,
"foundation.museum":1,
"francaise.museum":1,
"frankfurt.museum":1,
"franziskaner.museum":1,
"freemasonry.museum":1,
"freiburg.museum":1,
"fribourg.museum":1,
"frog.museum":1,
"fundacio.museum":1,
"furniture.museum":1,
"gallery.museum":1,
"garden.museum":1,
"gateway.museum":1,
"geelvinck.museum":1,
"gemological.museum":1,
"geology.museum":1,
"georgia.museum":1,
"giessen.museum":1,
"glas.museum":1,
"glass.museum":1,
"gorge.museum":1,
"grandrapids.museum":1,
"graz.museum":1,
"guernsey.museum":1,
"halloffame.museum":1,
"hamburg.museum":1,
"handson.museum":1,
"harvestcelebration.museum":1,
"hawaii.museum":1,
"health.museum":1,
"heimatunduhren.museum":1,
"hellas.museum":1,
"helsinki.museum":1,
"hembygdsforbund.museum":1,
"heritage.museum":1,
"histoire.museum":1,
"historical.museum":1,
"historicalsociety.museum":1,
"historichouses.museum":1,
"historisch.museum":1,
"historisches.museum":1,
"history.museum":1,
"historyofscience.museum":1,
"horology.museum":1,
"house.museum":1,
"humanities.museum":1,
"illustration.museum":1,
"imageandsound.museum":1,
"indian.museum":1,
"indiana.museum":1,
"indianapolis.museum":1,
"indianmarket.museum":1,
"intelligence.museum":1,
"interactive.museum":1,
"iraq.museum":1,
"iron.museum":1,
"isleofman.museum":1,
"jamison.museum":1,
"jefferson.museum":1,
"jerusalem.museum":1,
"jewelry.museum":1,
"jewish.museum":1,
"jewishart.museum":1,
"jfk.museum":1,
"journalism.museum":1,
"judaica.museum":1,
"judygarland.museum":1,
"juedisches.museum":1,
"juif.museum":1,
"karate.museum":1,
"karikatur.museum":1,
"kids.museum":1,
"koebenhavn.museum":1,
"koeln.museum":1,
"kunst.museum":1,
"kunstsammlung.museum":1,
"kunstunddesign.museum":1,
"labor.museum":1,
"labour.museum":1,
"lajolla.museum":1,
"lancashire.museum":1,
"landes.museum":1,
"lans.museum":1,
"läns.museum":1,
"larsson.museum":1,
"lewismiller.museum":1,
"lincoln.museum":1,
"linz.museum":1,
"living.museum":1,
"livinghistory.museum":1,
"localhistory.museum":1,
"london.museum":1,
"losangeles.museum":1,
"louvre.museum":1,
"loyalist.museum":1,
"lucerne.museum":1,
"luxembourg.museum":1,
"luzern.museum":1,
"mad.museum":1,
"madrid.museum":1,
"mallorca.museum":1,
"manchester.museum":1,
"mansion.museum":1,
"mansions.museum":1,
"manx.museum":1,
"marburg.museum":1,
"maritime.museum":1,
"maritimo.museum":1,
"maryland.museum":1,
"marylhurst.museum":1,
"media.museum":1,
"medical.museum":1,
"medizinhistorisches.museum":1,
"meeres.museum":1,
"memorial.museum":1,
"mesaverde.museum":1,
"michigan.museum":1,
"midatlantic.museum":1,
"military.museum":1,
"mill.museum":1,
"miners.museum":1,
"mining.museum":1,
"minnesota.museum":1,
"missile.museum":1,
"missoula.museum":1,
"modern.museum":1,
"moma.museum":1,
"money.museum":1,
"monmouth.museum":1,
"monticello.museum":1,
"montreal.museum":1,
"moscow.museum":1,
"motorcycle.museum":1,
"muenchen.museum":1,
"muenster.museum":1,
"mulhouse.museum":1,
"muncie.museum":1,
"museet.museum":1,
"museumcenter.museum":1,
"museumvereniging.museum":1,
"music.museum":1,
"national.museum":1,
"nationalfirearms.museum":1,
"nationalheritage.museum":1,
"nativeamerican.museum":1,
"naturalhistory.museum":1,
"<API key>.museum":1,
"naturalsciences.museum":1,
"nature.museum":1,
"naturhistorisches.museum":1,
"natuurwetenschappen.museum":1,
"naumburg.museum":1,
"naval.museum":1,
"nebraska.museum":1,
"neues.museum":1,
"newhampshire.museum":1,
"newjersey.museum":1,
"newmexico.museum":1,
"newport.museum":1,
"newspaper.museum":1,
"newyork.museum":1,
"niepce.museum":1,
"norfolk.museum":1,
"north.museum":1,
"nrw.museum":1,
"nuernberg.museum":1,
"nuremberg.museum":1,
"nyc.museum":1,
"nyny.museum":1,
"oceanographic.museum":1,
"oceanographique.museum":1,
"omaha.museum":1,
"online.museum":1,
"ontario.museum":1,
"openair.museum":1,
"oregon.museum":1,
"oregontrail.museum":1,
"otago.museum":1,
"oxford.museum":1,
"pacific.museum":1,
"paderborn.museum":1,
"palace.museum":1,
"paleo.museum":1,
"palmsprings.museum":1,
"panama.museum":1,
"paris.museum":1,
"pasadena.museum":1,
"pharmacy.museum":1,
"philadelphia.museum":1,
"philadelphiaarea.museum":1,
"philately.museum":1,
"phoenix.museum":1,
"photography.museum":1,
"pilots.museum":1,
"pittsburgh.museum":1,
"planetarium.museum":1,
"plantation.museum":1,
"plants.museum":1,
"plaza.museum":1,
"portal.museum":1,
"portland.museum":1,
"portlligat.museum":1,
"<API key>.museum":1,
"preservation.museum":1,
"presidio.museum":1,
"press.museum":1,
"project.museum":1,
"public.museum":1,
"pubol.museum":1,
"quebec.museum":1,
"railroad.museum":1,
"railway.museum":1,
"research.museum":1,
"resistance.museum":1,
"riodejaneiro.museum":1,
"rochester.museum":1,
"rockart.museum":1,
"roma.museum":1,
"russia.museum":1,
"saintlouis.museum":1,
"salem.museum":1,
"salvadordali.museum":1,
"salzburg.museum":1,
"sandiego.museum":1,
"sanfrancisco.museum":1,
"santabarbara.museum":1,
"santacruz.museum":1,
"santafe.museum":1,
"saskatchewan.museum":1,
"satx.museum":1,
"savannahga.museum":1,
"schlesisches.museum":1,
"schoenbrunn.museum":1,
"schokoladen.museum":1,
"school.museum":1,
"schweiz.museum":1,
"science.museum":1,
"scienceandhistory.museum":1,
"scienceandindustry.museum":1,
"sciencecenter.museum":1,
"sciencecenters.museum":1,
"science-fiction.museum":1,
"sciencehistory.museum":1,
"sciences.museum":1,
"sciencesnaturelles.museum":1,
"scotland.museum":1,
"seaport.museum":1,
"settlement.museum":1,
"settlers.museum":1,
"shell.museum":1,
"sherbrooke.museum":1,
"sibenik.museum":1,
"silk.museum":1,
"ski.museum":1,
"skole.museum":1,
"society.museum":1,
"sologne.museum":1,
"soundandvision.museum":1,
"southcarolina.museum":1,
"southwest.museum":1,
"space.museum":1,
"spy.museum":1,
"square.museum":1,
"stadt.museum":1,
"stalbans.museum":1,
"starnberg.museum":1,
"state.museum":1,
"stateofdelaware.museum":1,
"station.museum":1,
"steam.museum":1,
"steiermark.museum":1,
"stjohn.museum":1,
"stockholm.museum":1,
"stpetersburg.museum":1,
"stuttgart.museum":1,
"suisse.museum":1,
"surgeonshall.museum":1,
"surrey.museum":1,
"svizzera.museum":1,
"sweden.museum":1,
"sydney.museum":1,
"tank.museum":1,
"tcm.museum":1,
"technology.museum":1,
"telekommunikation.museum":1,
"television.museum":1,
"texas.museum":1,
"textile.museum":1,
"theater.museum":1,
"time.museum":1,
"timekeeping.museum":1,
"topology.museum":1,
"torino.museum":1,
"touch.museum":1,
"town.museum":1,
"transport.museum":1,
"tree.museum":1,
"trolley.museum":1,
"trust.museum":1,
"trustee.museum":1,
"uhren.museum":1,
"ulm.museum":1,
"undersea.museum":1,
"university.museum":1,
"usa.museum":1,
"usantiques.museum":1,
"usarts.museum":1,
"uscountryestate.museum":1,
"usculture.museum":1,
"usdecorativearts.museum":1,
"usgarden.museum":1,
"ushistory.museum":1,
"ushuaia.museum":1,
"uslivinghistory.museum":1,
"utah.museum":1,
"uvic.museum":1,
"valley.museum":1,
"vantaa.museum":1,
"versailles.museum":1,
"viking.museum":1,
"village.museum":1,
"virginia.museum":1,
"virtual.museum":1,
"virtuel.museum":1,
"vlaanderen.museum":1,
"volkenkunde.museum":1,
"wales.museum":1,
"wallonie.museum":1,
"war.museum":1,
"washingtondc.museum":1,
"watchandclock.museum":1,
"watch-and-clock.museum":1,
"western.museum":1,
"westfalen.museum":1,
"whaling.museum":1,
"wildlife.museum":1,
"williamsburg.museum":1,
"windmill.museum":1,
"workshop.museum":1,
"york.museum":1,
"yorkshire.museum":1,
"yosemite.museum":1,
"youth.museum":1,
"zoological.museum":1,
"zoology.museum":1,
"mv":1,
"aero.mv":1,
"biz.mv":1,
"com.mv":1,
"coop.mv":1,
"edu.mv":1,
"gov.mv":1,
"info.mv":1,
"int.mv":1,
"mil.mv":1,
"museum.mv":1,
"name.mv":1,
"net.mv":1,
"org.mv":1,
"pro.mv":1,
"mw":1,
"ac.mw":1,
"biz.mw":1,
"co.mw":1,
"com.mw":1,
"coop.mw":1,
"edu.mw":1,
"gov.mw":1,
"int.mw":1,
"museum.mw":1,
"net.mw":1,
"org.mw":1,
"mx":1,
"com.mx":1,
"org.mx":1,
"gob.mx":1,
"edu.mx":1,
"net.mx":1,
"my":1,
"com.my":1,
"net.my":1,
"org.my":1,
"gov.my":1,
"edu.my":1,
"mil.my":1,
"name.my":1,
"na":1,
"info.na":1,
"pro.na":1,
"name.na":1,
"school.na":1,
"or.na":1,
"dr.na":1,
"us.na":1,
"mx.na":1,
"ca.na":1,
"in.na":1,
"cc.na":1,
"tv.na":1,
"ws.na":1,
"mobi.na":1,
"co.na":1,
"com.na":1,
"org.na":1,
"name":1,
"nc":1,
"asso.nc":1,
"ne":1,
"net":1,
"nf":1,
"com.nf":1,
"net.nf":1,
"per.nf":1,
"rec.nf":1,
"web.nf":1,
"arts.nf":1,
"firm.nf":1,
"info.nf":1,
"other.nf":1,
"store.nf":1,
"ng":1,
"com.ng":1,
"edu.ng":1,
"name.ng":1,
"net.ng":1,
"org.ng":1,
"sch.ng":1,
"gov.ng":1,
"mil.ng":1,
"mobi.ng":1,
"nl":1,
"bv.nl":1,
"no":1,
"fhs.no":1,
"vgs.no":1,
"fylkesbibl.no":1,
"folkebibl.no":1,
"museum.no":1,
"idrett.no":1,
"priv.no":1,
"mil.no":1,
"stat.no":1,
"dep.no":1,
"kommune.no":1,
"herad.no":1,
"aa.no":1,
"ah.no":1,
"bu.no":1,
"fm.no":1,
"hl.no":1,
"hm.no":1,
"jan-mayen.no":1,
"mr.no":1,
"nl.no":1,
"nt.no":1,
"of.no":1,
"ol.no":1,
"oslo.no":1,
"rl.no":1,
"sf.no":1,
"st.no":1,
"svalbard.no":1,
"tm.no":1,
"tr.no":1,
"va.no":1,
"vf.no":1,
"gs.aa.no":1,
"gs.ah.no":1,
"gs.bu.no":1,
"gs.fm.no":1,
"gs.hl.no":1,
"gs.hm.no":1,
"gs.jan-mayen.no":1,
"gs.mr.no":1,
"gs.nl.no":1,
"gs.nt.no":1,
"gs.of.no":1,
"gs.ol.no":1,
"gs.oslo.no":1,
"gs.rl.no":1,
"gs.sf.no":1,
"gs.st.no":1,
"gs.svalbard.no":1,
"gs.tm.no":1,
"gs.tr.no":1,
"gs.va.no":1,
"gs.vf.no":1,
"akrehamn.no":1,
"åkrehamn.no":1,
"algard.no":1,
"ålgård.no":1,
"arna.no":1,
"brumunddal.no":1,
"bryne.no":1,
"bronnoysund.no":1,
"brønnøysund.no":1,
"drobak.no":1,
"drøbak.no":1,
"egersund.no":1,
"fetsund.no":1,
"floro.no":1,
"florø.no":1,
"fredrikstad.no":1,
"hokksund.no":1,
"honefoss.no":1,
"hønefoss.no":1,
"jessheim.no":1,
"jorpeland.no":1,
"jørpeland.no":1,
"kirkenes.no":1,
"kopervik.no":1,
"krokstadelva.no":1,
"langevag.no":1,
"langevåg.no":1,
"leirvik.no":1,
"mjondalen.no":1,
"mjøndalen.no":1,
"mo-i-rana.no":1,
"mosjoen.no":1,
"mosjøen.no":1,
"nesoddtangen.no":1,
"orkanger.no":1,
"osoyro.no":1,
"osøyro.no":1,
"raholt.no":1,
"råholt.no":1,
"sandnessjoen.no":1,
"sandnessjøen.no":1,
"skedsmokorset.no":1,
"slattum.no":1,
"spjelkavik.no":1,
"stathelle.no":1,
"stavern.no":1,
"stjordalshalsen.no":1,
"stjørdalshalsen.no":1,
"tananger.no":1,
"tranby.no":1,
"vossevangen.no":1,
"afjord.no":1,
"åfjord.no":1,
"agdenes.no":1,
"al.no":1,
"ål.no":1,
"alesund.no":1,
"ålesund.no":1,
"alstahaug.no":1,
"alta.no":1,
"áltá.no":1,
"alaheadju.no":1,
"álaheadju.no":1,
"alvdal.no":1,
"amli.no":1,
"åmli.no":1,
"amot.no":1,
"åmot.no":1,
"andebu.no":1,
"andoy.no":1,
"andøy.no":1,
"andasuolo.no":1,
"ardal.no":1,
"årdal.no":1,
"aremark.no":1,
"arendal.no":1,
"ås.no":1,
"aseral.no":1,
"åseral.no":1,
"asker.no":1,
"askim.no":1,
"askvoll.no":1,
"askoy.no":1,
"askøy.no":1,
"asnes.no":1,
"åsnes.no":1,
"audnedaln.no":1,
"aukra.no":1,
"aure.no":1,
"aurland.no":1,
"aurskog-holand.no":1,
"aurskog-høland.no":1,
"austevoll.no":1,
"austrheim.no":1,
"averoy.no":1,
"averøy.no":1,
"balestrand.no":1,
"ballangen.no":1,
"balat.no":1,
"bálát.no":1,
"balsfjord.no":1,
"bahccavuotna.no":1,
"báhccavuotna.no":1,
"bamble.no":1,
"bardu.no":1,
"beardu.no":1,
"beiarn.no":1,
"bajddar.no":1,
"bájddar.no":1,
"baidar.no":1,
"báidár.no":1,
"berg.no":1,
"bergen.no":1,
"berlevag.no":1,
"berlevåg.no":1,
"bearalvahki.no":1,
"bearalváhki.no":1,
"bindal.no":1,
"birkenes.no":1,
"bjarkoy.no":1,
"bjarkøy.no":1,
"bjerkreim.no":1,
"bjugn.no":1,
"bodo.no":1,
"bodø.no":1,
"badaddja.no":1,
"bådåddjå.no":1,
"budejju.no":1,
"bokn.no":1,
"bremanger.no":1,
"bronnoy.no":1,
"brønnøy.no":1,
"bygland.no":1,
"bykle.no":1,
"barum.no":1,
"bærum.no":1,
"bo.telemark.no":1,
"bø.telemark.no":1,
"bo.nordland.no":1,
"bø.nordland.no":1,
"bievat.no":1,
"bievát.no":1,
"bomlo.no":1,
"bømlo.no":1,
"batsfjord.no":1,
"båtsfjord.no":1,
"bahcavuotna.no":1,
"báhcavuotna.no":1,
"dovre.no":1,
"drammen.no":1,
"drangedal.no":1,
"dyroy.no":1,
"dyrøy.no":1,
"donna.no":1,
"dønna.no":1,
"eid.no":1,
"eidfjord.no":1,
"eidsberg.no":1,
"eidskog.no":1,
"eidsvoll.no":1,
"eigersund.no":1,
"elverum.no":1,
"enebakk.no":1,
"engerdal.no":1,
"etne.no":1,
"etnedal.no":1,
"evenes.no":1,
"evenassi.no":1,
"evenášši.no":1,
"evje-og-hornnes.no":1,
"farsund.no":1,
"fauske.no":1,
"fuossko.no":1,
"fuoisku.no":1,
"fedje.no":1,
"fet.no":1,
"finnoy.no":1,
"finnøy.no":1,
"fitjar.no":1,
"fjaler.no":1,
"fjell.no":1,
"flakstad.no":1,
"flatanger.no":1,
"flekkefjord.no":1,
"flesberg.no":1,
"flora.no":1,
"fla.no":1,
"flå.no":1,
"folldal.no":1,
"forsand.no":1,
"fosnes.no":1,
"frei.no":1,
"frogn.no":1,
"froland.no":1,
"frosta.no":1,
"frana.no":1,
"fræna.no":1,
"froya.no":1,
"frøya.no":1,
"fusa.no":1,
"fyresdal.no":1,
"forde.no":1,
"førde.no":1,
"gamvik.no":1,
"gangaviika.no":1,
"gáŋgaviika.no":1,
"gaular.no":1,
"gausdal.no":1,
"gildeskal.no":1,
"gildeskål.no":1,
"giske.no":1,
"gjemnes.no":1,
"gjerdrum.no":1,
"gjerstad.no":1,
"gjesdal.no":1,
"gjovik.no":1,
"gjøvik.no":1,
"gloppen.no":1,
"gol.no":1,
"gran.no":1,
"grane.no":1,
"granvin.no":1,
"gratangen.no":1,
"grimstad.no":1,
"grong.no":1,
"kraanghke.no":1,
"kråanghke.no":1,
"grue.no":1,
"gulen.no":1,
"hadsel.no":1,
"halden.no":1,
"halsa.no":1,
"hamar.no":1,
"hamaroy.no":1,
"habmer.no":1,
"hábmer.no":1,
"hapmir.no":1,
"hápmir.no":1,
"hammerfest.no":1,
"hammarfeasta.no":1,
"hámmárfeasta.no":1,
"haram.no":1,
"hareid.no":1,
"harstad.no":1,
"hasvik.no":1,
"aknoluokta.no":1,
"ákŋoluokta.no":1,
"hattfjelldal.no":1,
"aarborte.no":1,
"haugesund.no":1,
"hemne.no":1,
"hemnes.no":1,
"hemsedal.no":1,
"heroy.more-og-romsdal.no":1,
"herøy.møre-og-romsdal.no":1,
"heroy.nordland.no":1,
"herøy.nordland.no":1,
"hitra.no":1,
"hjartdal.no":1,
"hjelmeland.no":1,
"hobol.no":1,
"hobøl.no":1,
"hof.no":1,
"hol.no":1,
"hole.no":1,
"holmestrand.no":1,
"holtalen.no":1,
"holtålen.no":1,
"hornindal.no":1,
"horten.no":1,
"hurdal.no":1,
"hurum.no":1,
"hvaler.no":1,
"hyllestad.no":1,
"hagebostad.no":1,
"hægebostad.no":1,
"hoyanger.no":1,
"høyanger.no":1,
"hoylandet.no":1,
"høylandet.no":1,
"ha.no":1,
"hå.no":1,
"ibestad.no":1,
"inderoy.no":1,
"inderøy.no":1,
"iveland.no":1,
"jevnaker.no":1,
"jondal.no":1,
"jolster.no":1,
"jølster.no":1,
"karasjok.no":1,
"karasjohka.no":1,
"kárášjohka.no":1,
"karlsoy.no":1,
"galsa.no":1,
"gálsá.no":1,
"karmoy.no":1,
"karmøy.no":1,
"kautokeino.no":1,
"guovdageaidnu.no":1,
"klepp.no":1,
"klabu.no":1,
"klæbu.no":1,
"kongsberg.no":1,
"kongsvinger.no":1,
"kragero.no":1,
"kragerø.no":1,
"kristiansand.no":1,
"kristiansund.no":1,
"krodsherad.no":1,
"krødsherad.no":1,
"kvalsund.no":1,
"rahkkeravju.no":1,
"ráhkkerávju.no":1,
"kvam.no":1,
"kvinesdal.no":1,
"kvinnherad.no":1,
"kviteseid.no":1,
"kvitsoy.no":1,
"kvitsøy.no":1,
"kvafjord.no":1,
"kvæfjord.no":1,
"giehtavuoatna.no":1,
"kvanangen.no":1,
"kvænangen.no":1,
"navuotna.no":1,
"návuotna.no":1,
"kafjord.no":1,
"kåfjord.no":1,
"gaivuotna.no":1,
"gáivuotna.no":1,
"larvik.no":1,
"lavangen.no":1,
"lavagis.no":1,
"loabat.no":1,
"loabát.no":1,
"lebesby.no":1,
"davvesiida.no":1,
"leikanger.no":1,
"leirfjord.no":1,
"leka.no":1,
"leksvik.no":1,
"lenvik.no":1,
"leangaviika.no":1,
"leaŋgaviika.no":1,
"lesja.no":1,
"levanger.no":1,
"lier.no":1,
"lierne.no":1,
"lillehammer.no":1,
"lillesand.no":1,
"lindesnes.no":1,
"lindas.no":1,
"lindås.no":1,
"lom.no":1,
"loppa.no":1,
"lahppi.no":1,
"láhppi.no":1,
"lund.no":1,
"lunner.no":1,
"luroy.no":1,
"lurøy.no":1,
"luster.no":1,
"lyngdal.no":1,
"lyngen.no":1,
"ivgu.no":1,
"lardal.no":1,
"lerdal.no":1,
"lærdal.no":1,
"lodingen.no":1,
"lødingen.no":1,
"lorenskog.no":1,
"lørenskog.no":1,
"loten.no":1,
"løten.no":1,
"malvik.no":1,
"masoy.no":1,
"måsøy.no":1,
"muosat.no":1,
"muosát.no":1,
"mandal.no":1,
"marker.no":1,
"marnardal.no":1,
"masfjorden.no":1,
"meland.no":1,
"meldal.no":1,
"melhus.no":1,
"meloy.no":1,
"meløy.no":1,
"meraker.no":1,
"meråker.no":1,
"moareke.no":1,
"moåreke.no":1,
"midsund.no":1,
"midtre-gauldal.no":1,
"modalen.no":1,
"modum.no":1,
"molde.no":1,
"moskenes.no":1,
"moss.no":1,
"mosvik.no":1,
"malselv.no":1,
"målselv.no":1,
"malatvuopmi.no":1,
"málatvuopmi.no":1,
"namdalseid.no":1,
"aejrie.no":1,
"namsos.no":1,
"namsskogan.no":1,
"naamesjevuemie.no":1,
"nååmesjevuemie.no":1,
"laakesvuemie.no":1,
"nannestad.no":1,
"narvik.no":1,
"narviika.no":1,
"naustdal.no":1,
"nedre-eiker.no":1,
"nes.akershus.no":1,
"nes.buskerud.no":1,
"nesna.no":1,
"nesodden.no":1,
"nesseby.no":1,
"unjarga.no":1,
"unjárga.no":1,
"nesset.no":1,
"nissedal.no":1,
"nittedal.no":1,
"nord-aurdal.no":1,
"nord-fron.no":1,
"nord-odal.no":1,
"norddal.no":1,
"nordkapp.no":1,
"davvenjarga.no":1,
"davvenjárga.no":1,
"nordre-land.no":1,
"nordreisa.no":1,
"raisa.no":1,
"ráisa.no":1,
"nore-og-uvdal.no":1,
"notodden.no":1,
"naroy.no":1,
"nærøy.no":1,
"notteroy.no":1,
"nøtterøy.no":1,
"odda.no":1,
"oksnes.no":1,
"øksnes.no":1,
"oppdal.no":1,
"oppegard.no":1,
"oppegård.no":1,
"orkdal.no":1,
"orland.no":1,
"ørland.no":1,
"orskog.no":1,
"ørskog.no":1,
"orsta.no":1,
"ørsta.no":1,
"os.hedmark.no":1,
"os.hordaland.no":1,
"osen.no":1,
"osteroy.no":1,
"osterøy.no":1,
"ostre-toten.no":1,
"østre-toten.no":1,
"overhalla.no":1,
"ovre-eiker.no":1,
"øvre-eiker.no":1,
"oyer.no":1,
"øyer.no":1,
"oygarden.no":1,
"øygarden.no":1,
"oystre-slidre.no":1,
"øystre-slidre.no":1,
"porsanger.no":1,
"porsangu.no":1,
"porsáŋgu.no":1,
"porsgrunn.no":1,
"radoy.no":1,
"radøy.no":1,
"rakkestad.no":1,
"rana.no":1,
"ruovat.no":1,
"randaberg.no":1,
"rauma.no":1,
"rendalen.no":1,
"rennebu.no":1,
"rennesoy.no":1,
"rennesøy.no":1,
"rindal.no":1,
"ringebu.no":1,
"ringerike.no":1,
"ringsaker.no":1,
"rissa.no":1,
"risor.no":1,
"risør.no":1,
"roan.no":1,
"rollag.no":1,
"rygge.no":1,
"ralingen.no":1,
"rælingen.no":1,
"rodoy.no":1,
"rødøy.no":1,
"romskog.no":1,
"rømskog.no":1,
"roros.no":1,
"røros.no":1,
"rost.no":1,
"røst.no":1,
"royken.no":1,
"røyken.no":1,
"royrvik.no":1,
"røyrvik.no":1,
"rade.no":1,
"råde.no":1,
"salangen.no":1,
"siellak.no":1,
"saltdal.no":1,
"salat.no":1,
"sálát.no":1,
"sálat.no":1,
"samnanger.no":1,
"sande.more-og-romsdal.no":1,
"sande.møre-og-romsdal.no":1,
"sande.vestfold.no":1,
"sandefjord.no":1,
"sandnes.no":1,
"sandoy.no":1,
"sandøy.no":1,
"sarpsborg.no":1,
"sauda.no":1,
"sauherad.no":1,
"sel.no":1,
"selbu.no":1,
"selje.no":1,
"seljord.no":1,
"sigdal.no":1,
"siljan.no":1,
"sirdal.no":1,
"skaun.no":1,
"skedsmo.no":1,
"ski.no":1,
"skien.no":1,
"skiptvet.no":1,
"skjervoy.no":1,
"skjervøy.no":1,
"skierva.no":1,
"skiervá.no":1,
"skjak.no":1,
"skjåk.no":1,
"skodje.no":1,
"skanland.no":1,
"skånland.no":1,
"skanit.no":1,
"skánit.no":1,
"smola.no":1,
"smøla.no":1,
"snillfjord.no":1,
"snasa.no":1,
"snåsa.no":1,
"snoasa.no":1,
"snaase.no":1,
"snåase.no":1,
"sogndal.no":1,
"sokndal.no":1,
"sola.no":1,
"solund.no":1,
"songdalen.no":1,
"sortland.no":1,
"spydeberg.no":1,
"stange.no":1,
"stavanger.no":1,
"steigen.no":1,
"steinkjer.no":1,
"stjordal.no":1,
"stjørdal.no":1,
"stokke.no":1,
"stor-elvdal.no":1,
"stord.no":1,
"stordal.no":1,
"storfjord.no":1,
"omasvuotna.no":1,
"strand.no":1,
"stranda.no":1,
"stryn.no":1,
"sula.no":1,
"suldal.no":1,
"sund.no":1,
"sunndal.no":1,
"surnadal.no":1,
"sveio.no":1,
"svelvik.no":1,
"sykkylven.no":1,
"sogne.no":1,
"søgne.no":1,
"somna.no":1,
"sømna.no":1,
"sondre-land.no":1,
"søndre-land.no":1,
"sor-aurdal.no":1,
"sør-aurdal.no":1,
"sor-fron.no":1,
"sør-fron.no":1,
"sor-odal.no":1,
"sør-odal.no":1,
"sor-varanger.no":1,
"sør-varanger.no":1,
"matta-varjjat.no":1,
"mátta-várjjat.no":1,
"sorfold.no":1,
"sørfold.no":1,
"sorreisa.no":1,
"sørreisa.no":1,
"sorum.no":1,
"sørum.no":1,
"tana.no":1,
"deatnu.no":1,
"time.no":1,
"tingvoll.no":1,
"tinn.no":1,
"tjeldsund.no":1,
"dielddanuorri.no":1,
"tjome.no":1,
"tjøme.no":1,
"tokke.no":1,
"tolga.no":1,
"torsken.no":1,
"tranoy.no":1,
"tranøy.no":1,
"tromso.no":1,
"tromsø.no":1,
"tromsa.no":1,
"romsa.no":1,
"trondheim.no":1,
"troandin.no":1,
"trysil.no":1,
"trana.no":1,
"træna.no":1,
"trogstad.no":1,
"trøgstad.no":1,
"tvedestrand.no":1,
"tydal.no":1,
"tynset.no":1,
"tysfjord.no":1,
"divtasvuodna.no":1,
"divttasvuotna.no":1,
"tysnes.no":1,
"tysvar.no":1,
"tysvær.no":1,
"tonsberg.no":1,
"tønsberg.no":1,
"ullensaker.no":1,
"ullensvang.no":1,
"ulvik.no":1,
"utsira.no":1,
"vadso.no":1,
"vadsø.no":1,
"cahcesuolo.no":1,
"čáhcesuolo.no":1,
"vaksdal.no":1,
"valle.no":1,
"vang.no":1,
"vanylven.no":1,
"vardo.no":1,
"vardø.no":1,
"varggat.no":1,
"várggát.no":1,
"vefsn.no":1,
"vaapste.no":1,
"vega.no":1,
"vegarshei.no":1,
"vegårshei.no":1,
"vennesla.no":1,
"verdal.no":1,
"verran.no":1,
"vestby.no":1,
"vestnes.no":1,
"vestre-slidre.no":1,
"vestre-toten.no":1,
"vestvagoy.no":1,
"vestvågøy.no":1,
"vevelstad.no":1,
"vik.no":1,
"vikna.no":1,
"vindafjord.no":1,
"volda.no":1,
"voss.no":1,
"varoy.no":1,
"værøy.no":1,
"vagan.no":1,
"vågan.no":1,
"voagat.no":1,
"vagsoy.no":1,
"vågsøy.no":1,
"vaga.no":1,
"vågå.no":1,
"valer.ostfold.no":1,
"våler.østfold.no":1,
"valer.hedmark.no":1,
"våler.hedmark.no":1,
"nr":1,
"biz.nr":1,
"info.nr":1,
"gov.nr":1,
"edu.nr":1,
"org.nr":1,
"net.nr":1,
"com.nr":1,
"nu":1,
"nz":1,
"ac.nz":1,
"co.nz":1,
"cri.nz":1,
"geek.nz":1,
"gen.nz":1,
"govt.nz":1,
"health.nz":1,
"iwi.nz":1,
"kiwi.nz":1,
"maori.nz":1,
"mil.nz":1,
"māori.nz":1,
"net.nz":1,
"org.nz":1,
"parliament.nz":1,
"school.nz":1,
"om":1,
"co.om":1,
"com.om":1,
"edu.om":1,
"gov.om":1,
"med.om":1,
"museum.om":1,
"net.om":1,
"org.om":1,
"pro.om":1,
"org":1,
"pa":1,
"ac.pa":1,
"gob.pa":1,
"com.pa":1,
"org.pa":1,
"sld.pa":1,
"edu.pa":1,
"net.pa":1,
"ing.pa":1,
"abo.pa":1,
"med.pa":1,
"nom.pa":1,
"pe":1,
"edu.pe":1,
"gob.pe":1,
"nom.pe":1,
"mil.pe":1,
"org.pe":1,
"com.pe":1,
"net.pe":1,
"pf":1,
"com.pf":1,
"org.pf":1,
"edu.pf":1,
"ph":1,
"com.ph":1,
"net.ph":1,
"org.ph":1,
"gov.ph":1,
"edu.ph":1,
"ngo.ph":1,
"mil.ph":1,
"i.ph":1,
"pk":1,
"com.pk":1,
"net.pk":1,
"edu.pk":1,
"org.pk":1,
"fam.pk":1,
"biz.pk":1,
"web.pk":1,
"gov.pk":1,
"gob.pk":1,
"gok.pk":1,
"gon.pk":1,
"gop.pk":1,
"gos.pk":1,
"info.pk":1,
"pl":1,
"com.pl":1,
"net.pl":1,
"org.pl":1,
"info.pl":1,
"waw.pl":1,
"gov.pl":1,
"aid.pl":1,
"agro.pl":1,
"atm.pl":1,
"auto.pl":1,
"biz.pl":1,
"edu.pl":1,
"gmina.pl":1,
"gsm.pl":1,
"mail.pl":1,
"miasta.pl":1,
"media.pl":1,
"mil.pl":1,
"nieruchomosci.pl":1,
"nom.pl":1,
"pc.pl":1,
"powiat.pl":1,
"priv.pl":1,
"realestate.pl":1,
"rel.pl":1,
"sex.pl":1,
"shop.pl":1,
"sklep.pl":1,
"sos.pl":1,
"szkola.pl":1,
"targi.pl":1,
"tm.pl":1,
"tourism.pl":1,
"travel.pl":1,
"turystyka.pl":1,
"uw.gov.pl":1,
"um.gov.pl":1,
"ug.gov.pl":1,
"upow.gov.pl":1,
"starostwo.gov.pl":1,
"so.gov.pl":1,
"sr.gov.pl":1,
"po.gov.pl":1,
"pa.gov.pl":1,
"augustow.pl":1,
"babia-gora.pl":1,
"bedzin.pl":1,
"beskidy.pl":1,
"bialowieza.pl":1,
"bialystok.pl":1,
"bielawa.pl":1,
"bieszczady.pl":1,
"boleslawiec.pl":1,
"bydgoszcz.pl":1,
"bytom.pl":1,
"cieszyn.pl":1,
"czeladz.pl":1,
"czest.pl":1,
"dlugoleka.pl":1,
"elblag.pl":1,
"elk.pl":1,
"glogow.pl":1,
"gniezno.pl":1,
"gorlice.pl":1,
"grajewo.pl":1,
"ilawa.pl":1,
"jaworzno.pl":1,
"jelenia-gora.pl":1,
"jgora.pl":1,
"kalisz.pl":1,
"kazimierz-dolny.pl":1,
"karpacz.pl":1,
"kartuzy.pl":1,
"kaszuby.pl":1,
"katowice.pl":1,
"kepno.pl":1,
"ketrzyn.pl":1,
"klodzko.pl":1,
"kobierzyce.pl":1,
"kolobrzeg.pl":1,
"konin.pl":1,
"konskowola.pl":1,
"kutno.pl":1,
"lapy.pl":1,
"lebork.pl":1,
"legnica.pl":1,
"lezajsk.pl":1,
"limanowa.pl":1,
"lomza.pl":1,
"lowicz.pl":1,
"lubin.pl":1,
"lukow.pl":1,
"malbork.pl":1,
"malopolska.pl":1,
"mazowsze.pl":1,
"mazury.pl":1,
"mielec.pl":1,
"mielno.pl":1,
"mragowo.pl":1,
"naklo.pl":1,
"nowaruda.pl":1,
"nysa.pl":1,
"olawa.pl":1,
"olecko.pl":1,
"olkusz.pl":1,
"olsztyn.pl":1,
"opoczno.pl":1,
"opole.pl":1,
"ostroda.pl":1,
"ostroleka.pl":1,
"ostrowiec.pl":1,
"ostrowwlkp.pl":1,
"pila.pl":1,
"pisz.pl":1,
"podhale.pl":1,
"podlasie.pl":1,
"polkowice.pl":1,
"pomorze.pl":1,
"pomorskie.pl":1,
"prochowice.pl":1,
"pruszkow.pl":1,
"przeworsk.pl":1,
"pulawy.pl":1,
"radom.pl":1,
"rawa-maz.pl":1,
"rybnik.pl":1,
"rzeszow.pl":1,
"sanok.pl":1,
"sejny.pl":1,
"slask.pl":1,
"slupsk.pl":1,
"sosnowiec.pl":1,
"stalowa-wola.pl":1,
"skoczow.pl":1,
"starachowice.pl":1,
"stargard.pl":1,
"suwalki.pl":1,
"swidnica.pl":1,
"swiebodzin.pl":1,
"swinoujscie.pl":1,
"szczecin.pl":1,
"szczytno.pl":1,
"tarnobrzeg.pl":1,
"tgory.pl":1,
"turek.pl":1,
"tychy.pl":1,
"ustka.pl":1,
"walbrzych.pl":1,
"warmia.pl":1,
"warszawa.pl":1,
"wegrow.pl":1,
"wielun.pl":1,
"wlocl.pl":1,
"wloclawek.pl":1,
"wodzislaw.pl":1,
"wolomin.pl":1,
"wroclaw.pl":1,
"zachpomor.pl":1,
"zagan.pl":1,
"zarow.pl":1,
"zgora.pl":1,
"zgorzelec.pl":1,
"pm":1,
"pn":1,
"gov.pn":1,
"co.pn":1,
"org.pn":1,
"edu.pn":1,
"net.pn":1,
"post":1,
"pr":1,
"com.pr":1,
"net.pr":1,
"org.pr":1,
"gov.pr":1,
"edu.pr":1,
"isla.pr":1,
"pro.pr":1,
"biz.pr":1,
"info.pr":1,
"name.pr":1,
"est.pr":1,
"prof.pr":1,
"ac.pr":1,
"pro":1,
"aca.pro":1,
"bar.pro":1,
"cpa.pro":1,
"jur.pro":1,
"law.pro":1,
"med.pro":1,
"eng.pro":1,
"ps":1,
"edu.ps":1,
"gov.ps":1,
"sec.ps":1,
"plo.ps":1,
"com.ps":1,
"org.ps":1,
"net.ps":1,
"pt":1,
"net.pt":1,
"gov.pt":1,
"org.pt":1,
"edu.pt":1,
"int.pt":1,
"publ.pt":1,
"com.pt":1,
"nome.pt":1,
"pw":1,
"co.pw":1,
"ne.pw":1,
"or.pw":1,
"ed.pw":1,
"go.pw":1,
"belau.pw":1,
"py":1,
"com.py":1,
"coop.py":1,
"edu.py":1,
"gov.py":1,
"mil.py":1,
"net.py":1,
"org.py":1,
"qa":1,
"com.qa":1,
"edu.qa":1,
"gov.qa":1,
"mil.qa":1,
"name.qa":1,
"net.qa":1,
"org.qa":1,
"sch.qa":1,
"re":1,
"com.re":1,
"asso.re":1,
"nom.re":1,
"ro":1,
"com.ro":1,
"org.ro":1,
"tm.ro":1,
"nt.ro":1,
"nom.ro":1,
"info.ro":1,
"rec.ro":1,
"arts.ro":1,
"firm.ro":1,
"store.ro":1,
"www.ro":1,
"rs":1,
"co.rs":1,
"org.rs":1,
"edu.rs":1,
"ac.rs":1,
"gov.rs":1,
"in.rs":1,
"ru":1,
"ac.ru":1,
"com.ru":1,
"edu.ru":1,
"int.ru":1,
"net.ru":1,
"org.ru":1,
"pp.ru":1,
"adygeya.ru":1,
"altai.ru":1,
"amur.ru":1,
"arkhangelsk.ru":1,
"astrakhan.ru":1,
"bashkiria.ru":1,
"belgorod.ru":1,
"bir.ru":1,
"bryansk.ru":1,
"buryatia.ru":1,
"cbg.ru":1,
"chel.ru":1,
"chelyabinsk.ru":1,
"chita.ru":1,
"chukotka.ru":1,
"chuvashia.ru":1,
"dagestan.ru":1,
"dudinka.ru":1,
"e-burg.ru":1,
"grozny.ru":1,
"irkutsk.ru":1,
"ivanovo.ru":1,
"izhevsk.ru":1,
"jar.ru":1,
"joshkar-ola.ru":1,
"kalmykia.ru":1,
"kaluga.ru":1,
"kamchatka.ru":1,
"karelia.ru":1,
"kazan.ru":1,
"kchr.ru":1,
"kemerovo.ru":1,
"khabarovsk.ru":1,
"khakassia.ru":1,
"khv.ru":1,
"kirov.ru":1,
"koenig.ru":1,
"komi.ru":1,
"kostroma.ru":1,
"krasnoyarsk.ru":1,
"kuban.ru":1,
"kurgan.ru":1,
"kursk.ru":1,
"lipetsk.ru":1,
"magadan.ru":1,
"mari.ru":1,
"mari-el.ru":1,
"marine.ru":1,
"mordovia.ru":1,
"msk.ru":1,
"murmansk.ru":1,
"nalchik.ru":1,
"nnov.ru":1,
"nov.ru":1,
"novosibirsk.ru":1,
"nsk.ru":1,
"omsk.ru":1,
"orenburg.ru":1,
"oryol.ru":1,
"palana.ru":1,
"penza.ru":1,
"perm.ru":1,
"ptz.ru":1,
"rnd.ru":1,
"ryazan.ru":1,
"sakhalin.ru":1,
"samara.ru":1,
"saratov.ru":1,
"simbirsk.ru":1,
"smolensk.ru":1,
"spb.ru":1,
"stavropol.ru":1,
"stv.ru":1,
"surgut.ru":1,
"tambov.ru":1,
"tatarstan.ru":1,
"tom.ru":1,
"tomsk.ru":1,
"tsaritsyn.ru":1,
"tsk.ru":1,
"tula.ru":1,
"tuva.ru":1,
"tver.ru":1,
"tyumen.ru":1,
"udm.ru":1,
"udmurtia.ru":1,
"ulan-ude.ru":1,
"vladikavkaz.ru":1,
"vladimir.ru":1,
"vladivostok.ru":1,
"volgograd.ru":1,
"vologda.ru":1,
"voronezh.ru":1,
"vrn.ru":1,
"vyatka.ru":1,
"yakutia.ru":1,
"yamal.ru":1,
"yaroslavl.ru":1,
"yekaterinburg.ru":1,
"yuzhno-sakhalinsk.ru":1,
"amursk.ru":1,
"baikal.ru":1,
"cmw.ru":1,
"fareast.ru":1,
"jamal.ru":1,
"kms.ru":1,
"k-uralsk.ru":1,
"kustanai.ru":1,
"kuzbass.ru":1,
"magnitka.ru":1,
"mytis.ru":1,
"nakhodka.ru":1,
"nkz.ru":1,
"norilsk.ru":1,
"oskol.ru":1,
"pyatigorsk.ru":1,
"rubtsovsk.ru":1,
"snz.ru":1,
"syzran.ru":1,
"vdonsk.ru":1,
"zgrad.ru":1,
"gov.ru":1,
"mil.ru":1,
"test.ru":1,
"rw":1,
"gov.rw":1,
"net.rw":1,
"edu.rw":1,
"ac.rw":1,
"com.rw":1,
"co.rw":1,
"int.rw":1,
"mil.rw":1,
"gouv.rw":1,
"sa":1,
"com.sa":1,
"net.sa":1,
"org.sa":1,
"gov.sa":1,
"med.sa":1,
"pub.sa":1,
"edu.sa":1,
"sch.sa":1,
"sb":1,
"com.sb":1,
"edu.sb":1,
"gov.sb":1,
"net.sb":1,
"org.sb":1,
"sc":1,
"com.sc":1,
"gov.sc":1,
"net.sc":1,
"org.sc":1,
"edu.sc":1,
"sd":1,
"com.sd":1,
"net.sd":1,
"org.sd":1,
"edu.sd":1,
"med.sd":1,
"tv.sd":1,
"gov.sd":1,
"info.sd":1,
"se":1,
"a.se":1,
"ac.se":1,
"b.se":1,
"bd.se":1,
"brand.se":1,
"c.se":1,
"d.se":1,
"e.se":1,
"f.se":1,
"fh.se":1,
"fhsk.se":1,
"fhv.se":1,
"g.se":1,
"h.se":1,
"i.se":1,
"k.se":1,
"komforb.se":1,
"kommunalforbund.se":1,
"komvux.se":1,
"l.se":1,
"lanbib.se":1,
"m.se":1,
"n.se":1,
"naturbruksgymn.se":1,
"o.se":1,
"org.se":1,
"p.se":1,
"parti.se":1,
"pp.se":1,
"press.se":1,
"r.se":1,
"s.se":1,
"t.se":1,
"tm.se":1,
"u.se":1,
"w.se":1,
"x.se":1,
"y.se":1,
"z.se":1,
"sg":1,
"com.sg":1,
"net.sg":1,
"org.sg":1,
"gov.sg":1,
"edu.sg":1,
"per.sg":1,
"sh":1,
"com.sh":1,
"net.sh":1,
"gov.sh":1,
"org.sh":1,
"mil.sh":1,
"si":1,
"sj":1,
"sk":1,
"sl":1,
"com.sl":1,
"net.sl":1,
"edu.sl":1,
"gov.sl":1,
"org.sl":1,
"sm":1,
"sn":1,
"art.sn":1,
"com.sn":1,
"edu.sn":1,
"gouv.sn":1,
"org.sn":1,
"perso.sn":1,
"univ.sn":1,
"so":1,
"com.so":1,
"net.so":1,
"org.so":1,
"sr":1,
"st":1,
"co.st":1,
"com.st":1,
"consulado.st":1,
"edu.st":1,
"embaixada.st":1,
"gov.st":1,
"mil.st":1,
"net.st":1,
"org.st":1,
"principe.st":1,
"saotome.st":1,
"store.st":1,
"su":1,
"sv":1,
"com.sv":1,
"edu.sv":1,
"gob.sv":1,
"org.sv":1,
"red.sv":1,
"sx":1,
"gov.sx":1,
"sy":1,
"edu.sy":1,
"gov.sy":1,
"net.sy":1,
"mil.sy":1,
"com.sy":1,
"org.sy":1,
"sz":1,
"co.sz":1,
"ac.sz":1,
"org.sz":1,
"tc":1,
"td":1,
"tel":1,
"tf":1,
"tg":1,
"th":1,
"ac.th":1,
"co.th":1,
"go.th":1,
"in.th":1,
"mi.th":1,
"net.th":1,
"or.th":1,
"tj":1,
"ac.tj":1,
"biz.tj":1,
"co.tj":1,
"com.tj":1,
"edu.tj":1,
"go.tj":1,
"gov.tj":1,
"int.tj":1,
"mil.tj":1,
"name.tj":1,
"net.tj":1,
"nic.tj":1,
"org.tj":1,
"test.tj":1,
"web.tj":1,
"tk":1,
"tl":1,
"gov.tl":1,
"tm":1,
"com.tm":1,
"co.tm":1,
"org.tm":1,
"net.tm":1,
"nom.tm":1,
"gov.tm":1,
"mil.tm":1,
"edu.tm":1,
"tn":1,
"com.tn":1,
"ens.tn":1,
"fin.tn":1,
"gov.tn":1,
"ind.tn":1,
"intl.tn":1,
"nat.tn":1,
"net.tn":1,
"org.tn":1,
"info.tn":1,
"perso.tn":1,
"tourism.tn":1,
"edunet.tn":1,
"rnrt.tn":1,
"rns.tn":1,
"rnu.tn":1,
"mincom.tn":1,
"agrinet.tn":1,
"defense.tn":1,
"turen.tn":1,
"to":1,
"com.to":1,
"gov.to":1,
"net.to":1,
"org.to":1,
"edu.to":1,
"mil.to":1,
"tp":1,
"tr":1,
"com.tr":1,
"info.tr":1,
"biz.tr":1,
"net.tr":1,
"org.tr":1,
"web.tr":1,
"gen.tr":1,
"tv.tr":1,
"av.tr":1,
"dr.tr":1,
"bbs.tr":1,
"name.tr":1,
"tel.tr":1,
"gov.tr":1,
"bel.tr":1,
"pol.tr":1,
"mil.tr":1,
"edu.tr":1,
"kep.tr":1,
"nc.tr":1,
"gov.nc.tr":1,
"travel":1,
"tt":1,
"co.tt":1,
"com.tt":1,
"org.tt":1,
"net.tt":1,
"biz.tt":1,
"info.tt":1,
"pro.tt":1,
"int.tt":1,
"coop.tt":1,
"jobs.tt":1,
"mobi.tt":1,
"travel.tt":1,
"museum.tt":1,
"aero.tt":1,
"name.tt":1,
"gov.tt":1,
"edu.tt":1,
"tv":1,
"tw":1,
"edu.tw":1,
"gov.tw":1,
"mil.tw":1,
"com.tw":1,
"net.tw":1,
"org.tw":1,
"idv.tw":1,
"game.tw":1,
"ebiz.tw":1,
"club.tw":1,
"tz":1,
"ac.tz":1,
"co.tz":1,
"go.tz":1,
"hotel.tz":1,
"info.tz":1,
"me.tz":1,
"mil.tz":1,
"mobi.tz":1,
"ne.tz":1,
"or.tz":1,
"sc.tz":1,
"tv.tz":1,
"ua":1,
"com.ua":1,
"edu.ua":1,
"gov.ua":1,
"in.ua":1,
"net.ua":1,
"org.ua":1,
"cherkassy.ua":1,
"cherkasy.ua":1,
"chernigov.ua":1,
"chernihiv.ua":1,
"chernivtsi.ua":1,
"chernovtsy.ua":1,
"ck.ua":1,
"cn.ua":1,
"cr.ua":1,
"crimea.ua":1,
"cv.ua":1,
"dn.ua":1,
"dnepropetrovsk.ua":1,
"dnipropetrovsk.ua":1,
"dominic.ua":1,
"donetsk.ua":1,
"dp.ua":1,
"if.ua":1,
"ivano-frankivsk.ua":1,
"kh.ua":1,
"kharkiv.ua":1,
"kharkov.ua":1,
"kherson.ua":1,
"khmelnitskiy.ua":1,
"khmelnytskyi.ua":1,
"kiev.ua":1,
"kirovograd.ua":1,
"km.ua":1,
"kr.ua":1,
"krym.ua":1,
"ks.ua":1,
"kv.ua":1,
"kyiv.ua":1,
"lg.ua":1,
"lt.ua":1,
"lugansk.ua":1,
"lutsk.ua":1,
"lv.ua":1,
"lviv.ua":1,
"mk.ua":1,
"mykolaiv.ua":1,
"nikolaev.ua":1,
"od.ua":1,
"odesa.ua":1,
"odessa.ua":1,
"pl.ua":1,
"poltava.ua":1,
"rivne.ua":1,
"rovno.ua":1,
"rv.ua":1,
"sb.ua":1,
"sebastopol.ua":1,
"sevastopol.ua":1,
"sm.ua":1,
"sumy.ua":1,
"te.ua":1,
"ternopil.ua":1,
"uz.ua":1,
"uzhgorod.ua":1,
"vinnica.ua":1,
"vinnytsia.ua":1,
"vn.ua":1,
"volyn.ua":1,
"yalta.ua":1,
"zaporizhzhe.ua":1,
"zaporizhzhia.ua":1,
"zhitomir.ua":1,
"zhytomyr.ua":1,
"zp.ua":1,
"zt.ua":1,
"co.ua":1,
"pp.ua":1,
"ug":1,
"co.ug":1,
"or.ug":1,
"ac.ug":1,
"sc.ug":1,
"go.ug":1,
"ne.ug":1,
"com.ug":1,
"org.ug":1,
"uk":1,
"ac.uk":1,
"co.uk":1,
"gov.uk":1,
"ltd.uk":1,
"me.uk":1,
"net.uk":1,
"nhs.uk":1,
"org.uk":1,
"plc.uk":1,
"police.uk":1,
"us":1,
"dni.us":1,
"fed.us":1,
"isa.us":1,
"kids.us":1,
"nsn.us":1,
"ak.us":1,
"al.us":1,
"ar.us":1,
"as.us":1,
"az.us":1,
"ca.us":1,
"co.us":1,
"ct.us":1,
"dc.us":1,
"de.us":1,
"fl.us":1,
"ga.us":1,
"gu.us":1,
"hi.us":1,
"ia.us":1,
"id.us":1,
"il.us":1,
"in.us":1,
"ks.us":1,
"ky.us":1,
"la.us":1,
"ma.us":1,
"md.us":1,
"me.us":1,
"mi.us":1,
"mn.us":1,
"mo.us":1,
"ms.us":1,
"mt.us":1,
"nc.us":1,
"nd.us":1,
"ne.us":1,
"nh.us":1,
"nj.us":1,
"nm.us":1,
"nv.us":1,
"ny.us":1,
"oh.us":1,
"ok.us":1,
"or.us":1,
"pa.us":1,
"pr.us":1,
"ri.us":1,
"sc.us":1,
"sd.us":1,
"tn.us":1,
"tx.us":1,
"ut.us":1,
"vi.us":1,
"vt.us":1,
"va.us":1,
"wa.us":1,
"wi.us":1,
"wv.us":1,
"wy.us":1,
"cc.ak.us":1,
"cc.al.us":1,
"cc.ar.us":1,
"cc.as.us":1,
"cc.az.us":1,
"cc.ca.us":1,
"cc.co.us":1,
"cc.ct.us":1,
"cc.dc.us":1,
"cc.de.us":1,
"cc.fl.us":1,
"cc.ga.us":1,
"cc.gu.us":1,
"cc.hi.us":1,
"cc.ia.us":1,
"cc.id.us":1,
"cc.il.us":1,
"cc.in.us":1,
"cc.ks.us":1,
"cc.ky.us":1,
"cc.la.us":1,
"cc.ma.us":1,
"cc.md.us":1,
"cc.me.us":1,
"cc.mi.us":1,
"cc.mn.us":1,
"cc.mo.us":1,
"cc.ms.us":1,
"cc.mt.us":1,
"cc.nc.us":1,
"cc.nd.us":1,
"cc.ne.us":1,
"cc.nh.us":1,
"cc.nj.us":1,
"cc.nm.us":1,
"cc.nv.us":1,
"cc.ny.us":1,
"cc.oh.us":1,
"cc.ok.us":1,
"cc.or.us":1,
"cc.pa.us":1,
"cc.pr.us":1,
"cc.ri.us":1,
"cc.sc.us":1,
"cc.sd.us":1,
"cc.tn.us":1,
"cc.tx.us":1,
"cc.ut.us":1,
"cc.vi.us":1,
"cc.vt.us":1,
"cc.va.us":1,
"cc.wa.us":1,
"cc.wi.us":1,
"cc.wv.us":1,
"cc.wy.us":1,
"lib.ak.us":1,
"lib.al.us":1,
"lib.ar.us":1,
"lib.as.us":1,
"lib.az.us":1,
"lib.ca.us":1,
"lib.co.us":1,
"lib.ct.us":1,
"lib.dc.us":1,
"lib.de.us":1,
"lib.fl.us":1,
"lib.ga.us":1,
"lib.gu.us":1,
"lib.hi.us":1,
"lib.ia.us":1,
"lib.id.us":1,
"lib.il.us":1,
"lib.in.us":1,
"lib.ks.us":1,
"lib.ky.us":1,
"lib.la.us":1,
"lib.ma.us":1,
"lib.md.us":1,
"lib.me.us":1,
"lib.mi.us":1,
"lib.mn.us":1,
"lib.mo.us":1,
"lib.ms.us":1,
"lib.mt.us":1,
"lib.nc.us":1,
"lib.nd.us":1,
"lib.ne.us":1,
"lib.nh.us":1,
"lib.nj.us":1,
"lib.nm.us":1,
"lib.nv.us":1,
"lib.ny.us":1,
"lib.oh.us":1,
"lib.ok.us":1,
"lib.or.us":1,
"lib.pa.us":1,
"lib.pr.us":1,
"lib.ri.us":1,
"lib.sc.us":1,
"lib.sd.us":1,
"lib.tn.us":1,
"lib.tx.us":1,
"lib.ut.us":1,
"lib.vi.us":1,
"lib.vt.us":1,
"lib.va.us":1,
"lib.wa.us":1,
"lib.wi.us":1,
"lib.wy.us":1,
"uy":1,
"com.uy":1,
"edu.uy":1,
"gub.uy":1,
"mil.uy":1,
"net.uy":1,
"org.uy":1,
"uz":1,
"co.uz":1,
"com.uz":1,
"net.uz":1,
"org.uz":1,
"va":1,
"vc":1,
"com.vc":1,
"net.vc":1,
"org.vc":1,
"gov.vc":1,
"mil.vc":1,
"edu.vc":1,
"ve":1,
"arts.ve":1,
"co.ve":1,
"com.ve":1,
"edu.ve":1,
"firm.ve":1,
"gob.ve":1,
"gov.ve":1,
"info.ve":1,
"int.ve":1,
"mil.ve":1,
"net.ve":1,
"org.ve":1,
"rec.ve":1,
"store.ve":1,
"tec.ve":1,
"web.ve":1,
"vg":1,
"vi":1,
"co.vi":1,
"com.vi":1,
"net.vi":1,
"org.vi":1,
"vn":1,
"com.vn":1,
"net.vn":1,
"org.vn":1,
"edu.vn":1,
"gov.vn":1,
"int.vn":1,
"ac.vn":1,
"biz.vn":1,
"info.vn":1,
"name.vn":1,
"pro.vn":1,
"health.vn":1,
"vu":1,
"com.vu":1,
"edu.vu":1,
"net.vu":1,
"org.vu":1,
"wf":1,
"ws":1,
"com.ws":1,
"net.ws":1,
"org.ws":1,
"gov.ws":1,
"edu.ws":1,
"yt":1,
"xxx":1,
"abbott":1,
"abogado":1,
"academy":1,
"accenture":1,
"accountants":1,
"active":1,
"actor":1,
"afl":1,
"africa":1,
"agency":1,
"airforce":1,
"allfinanz":1,
"alsace":1,
"amsterdam":1,
"android":1,
"aquarelle":1,
"archi":1,
"army":1,
"associates":1,
"attorney":1,
"auction":1,
"audio":1,
"autos":1,
"axa":1,
"band":1,
"bank":1,
"bar":1,
"barcelona":1,
"bargains":1,
"bauhaus":1,
"bayern":1,
"bbva":1,
"bcn":1,
"beer":1,
"berlin":1,
"best":1,
"bharti":1,
"bible":1,
"bid":1,
"bike":1,
"bio":1,
"black":1,
"blackfriday":1,
"bloomberg":1,
"blue":1,
"bmw":1,
"bnl":1,
"bnpparibas":1,
"bond":1,
"boo":1,
"boutique":1,
"brussels":1,
"budapest":1,
"build":1,
"builders":1,
"business":1,
"buzz":1,
"bzh":1,
"cab":1,
"cal":1,
"camera":1,
"camp":1,
"cancerresearch":1,
"canon":1,
"capetown":1,
"capital":1,
"caravan":1,
"cards":1,
"care":1,
"career":1,
"careers":1,
"cartier":1,
"casa":1,
"cash":1,
"catering":1,
"cba":1,
"cbn":1,
"center":1,
"ceo":1,
"cern":1,
"cfa":1,
"channel":1,
"cheap":1,
"christmas":1,
"chrome":1,
"church":1,
"citic":1,
"city":1,
"claims":1,
"cleaning":1,
"click":1,
"clinic":1,
"clothing":1,
"club":1,
"codes":1,
"coffee":1,
"college":1,
"cologne":1,
"commbank":1,
"community":1,
"company":1,
"computer":1,
"condos":1,
"construction":1,
"consulting":1,
"contractors":1,
"cooking":1,
"cool":1,
"corsica":1,
"country":1,
"credit":1,
"creditcard":1,
"crs":1,
"cruises":1,
"csc":1,
"cuisinella":1,
"cymru":1,
"dabur":1,
"dad":1,
"dance":1,
"dating":1,
"datsun":1,
"day":1,
"deals":1,
"degree":1,
"delivery":1,
"democrat":1,
"dental":1,
"dentist":1,
"desi":1,
"diamonds":1,
"diet":1,
"digital":1,
"direct":1,
"directory":1,
"discount":1,
"dnp":1,
"doha":1,
"domains":1,
"doosan":1,
"durban":1,
"dvag":1,
"eat":1,
"education":1,
"email":1,
"emerck":1,
"energy":1,
"engineer":1,
"engineering":1,
"enterprises":1,
"equipment":1,
"erni":1,
"esq":1,
"estate":1,
"eurovision":1,
"eus":1,
"events":1,
"everbank":1,
"exchange":1,
"expert":1,
"exposed":1,
"fail":1,
"fan":1,
"farm":1,
"fashion":1,
"feedback":1,
"finance":1,
"financial":1,
"firmdale":1,
"fish":1,
"fishing":1,
"fitness":1,
"flights":1,
"florist":1,
"flsmidth":1,
"fly":1,
"foo":1,
"forsale":1,
"foundation":1,
"frl":1,
"frogans":1,
"fund":1,
"furniture":1,
"futbol":1,
"gal":1,
"gallery":1,
"garden":1,
"gbiz":1,
"gdn":1,
"gent":1,
"ggee":1,
"gift":1,
"gifts":1,
"gives":1,
"glass":1,
"gle":1,
"global":1,
"globo":1,
"gmail":1,
"gmo":1,
"gmx":1,
"google":1,
"gop":1,
"graphics":1,
"gratis":1,
"green":1,
"gripe":1,
"group":1,
"guge":1,
"guide":1,
"guitars":1,
"guru":1,
"hamburg":1,
"haus":1,
"healthcare":1,
"help":1,
"here":1,
"hermes":1,
"hiphop":1,
"hiv":1,
"holdings":1,
"holiday":1,
"homes":1,
"horse":1,
"host":1,
"hosting":1,
"house":1,
"how":1,
"ibm":1,
"ifm":1,
"iinet":1,
"immo":1,
"immobilien":1,
"industries":1,
"infiniti":1,
"ing":1,
"ink":1,
"institute":1,
"insure":1,
"international":1,
"investments":1,
"ipiranga":1,
"irish":1,
"ist":1,
"istanbul":1,
"itau":1,
"iwc":1,
"java":1,
"jetzt":1,
"joburg":1,
"jprs":1,
"juegos":1,
"kaufen":1,
"kddi":1,
"kim":1,
"kitchen":1,
"kiwi":1,
"koeln":1,
"krd":1,
"kred":1,
"lacaixa":1,
"land":1,
"latrobe":1,
"lawyer":1,
"lds":1,
"lease":1,
"leclerc":1,
"lgbt":1,
"liaison":1,
"lidl":1,
"life":1,
"lighting":1,
"limited":1,
"limo":1,
"link":1,
"loans":1,
"london":1,
"lotto":1,
"ltd":1,
"ltda":1,
"luxe":1,
"luxury":1,
"madrid":1,
"maif":1,
"maison":1,
"management":1,
"mango":1,
"market":1,
"marketing":1,
"media":1,
"meet":1,
"melbourne":1,
"meme":1,
"menu":1,
"miami":1,
"mini":1,
"moda":1,
"moe":1,
"monash":1,
"montblanc":1,
"mormon":1,
"mortgage":1,
"moscow":1,
"motorcycles":1,
"mov":1,
"nagoya":1,
"navy":1,
"netbank":1,
"network":1,
"neustar":1,
"new":1,
"nexus":1,
"ngo":1,
"nhk":1,
"ninja":1,
"nissan":1,
"nowruz":1,
"nra":1,
"nrw":1,
"nyc":1,
"obi":1,
"okinawa":1,
"ong":1,
"onl":1,
"ooo":1,
"oracle":1,
"organic":1,
"osaka":1,
"otsuka":1,
"ovh":1,
"paris":1,
"pars":1,
"partners":1,
"parts":1,
"party":1,
"pharmacy":1,
"photo":1,
"photography":1,
"photos":1,
"physio":1,
"pics":1,
"pictet":1,
"pictures":1,
"pink":1,
"pizza":1,
"place":1,
"plumbing":1,
"pohl":1,
"poker":1,
"praxi":1,
"press":1,
"prod":1,
"productions":1,
"prof":1,
"properties":1,
"property":1,
"pub":1,
"qpon":1,
"quebec":1,
"realtor":1,
"recipes":1,
"red":1,
"rehab":1,
"reise":1,
"reisen":1,
"reit":1,
"ren":1,
"rentals":1,
"repair":1,
"report":1,
"republican":1,
"rest":1,
"restaurant":1,
"reviews":1,
"rich":1,
"rio":1,
"rip":1,
"rocks":1,
"rodeo":1,
"rsvp":1,
"ruhr":1,
"ryukyu":1,
"saarland":1,
"samsung":1,
"sap":1,
"sarl":1,
"sca":1,
"scb":1,
"schmidt":1,
"scholarships":1,
"schule":1,
"schwarz":1,
"science":1,
"scot":1,
"seat":1,
"services":1,
"sew":1,
"sexy":1,
"sharp":1,
"shia":1,
"shiksha":1,
"shoes":1,
"shriram":1,
"singles":1,
"sky":1,
"social":1,
"software":1,
"sohu":1,
"solar":1,
"solutions":1,
"soy":1,
"space":1,
"spiegel":1,
"supplies":1,
"supply":1,
"support":1,
"surf":1,
"surgery":1,
"suzuki":1,
"sydney":1,
"systems":1,
"taipei":1,
"tatar":1,
"tattoo":1,
"tax":1,
"tci":1,
"technology":1,
"temasek":1,
"tienda":1,
"tips":1,
"tirol":1,
"today":1,
"tokyo":1,
"tools":1,
"top":1,
"toshiba":1,
"town":1,
"toys":1,
"trade":1,
"training":1,
"tui":1,
"university":1,
"uno":1,
"uol":1,
"vacations":1,
"vegas":1,
"ventures":1,
"versicherung":1,
"vet":1,
"viajes":1,
"villas":1,
"virgin":1,
"vision":1,
"vista":1,
"vistaprint":1,
"vlaanderen":1,
"vodka":1,
"vote":1,
"voting":1,
"voto":1,
"voyage":1,
"wales":1,
"wang":1,
"watch":1,
"webcam":1,
"website":1,
"wed":1,
"wedding":1,
"whoswho":1,
"wien":1,
"wiki":1,
"williamhill":1,
"wme":1,
"work":1,
"works":1,
"world":1,
"wtc":1,
"wtf":1,
"vermögensberater":1,
"vermögensberatung":1,
"xyz":1,
"yachts":1,
"yandex":1,
"yoga":1,
"yokohama":1,
"youtube":1,
"zip":1,
"zone":1,
"cloudfront.net":1,
"compute.amazonaws.cn":1,
"compute.amazonaws.com":1,
"elasticbeanstalk.com":1,
"elb.amazonaws.com":1,
"betainabox.com":1,
"ae.org":1,
"ar.com":1,
"br.com":1,
"cn.com":1,
"com.de":1,
"com.se":1,
"de.com":1,
"eu.com":1,
"gb.com":1,
"gb.net":1,
"hu.com":1,
"hu.net":1,
"jp.net":1,
"jpn.com":1,
"kr.com":1,
"mex.com":1,
"no.com":1,
"qc.com":1,
"ru.com":1,
"sa.com":1,
"se.com":1,
"se.net":1,
"uk.com":1,
"uk.net":1,
"us.com":1,
"uy.com":1,
"za.bz":1,
"za.com":1,
"africa.com":1,
"gr.com":1,
"in.net":1,
"us.org":1,
"co.com":1,
"c.la":1,
"cloudcontrolled.com":1,
"cloudcontrolapp.com":1,
"co.ca":1,
"co.nl":1,
"co.no":1,
"cupcake.is":1,
"dreamhosters.com":1,
"dyndns-at-home.com":1,
"dyndns-at-work.com":1,
"dyndns-blog.com":1,
"dyndns-free.com":1,
"dyndns-home.com":1,
"dyndns-ip.com":1,
"dyndns-mail.com":1,
"dyndns-office.com":1,
"dyndns-pics.com":1,
"dyndns-remote.com":1,
"dyndns-server.com":1,
"dyndns-web.com":1,
"dyndns-wiki.com":1,
"dyndns-work.com":1,
"dyndns.biz":1,
"dyndns.info":1,
"dyndns.org":1,
"dyndns.tv":1,
"at-band-camp.net":1,
"ath.cx":1,
"barrel-of-knowledge.info":1,
"<API key>.info":1,
"better-than.tv":1,
"blogdns.com":1,
"blogdns.net":1,
"blogdns.org":1,
"blogsite.org":1,
"boldlygoingnowhere.org":1,
"broke-it.net":1,
"buyshouses.net":1,
"cechire.com":1,
"dnsalias.com":1,
"dnsalias.net":1,
"dnsalias.org":1,
"dnsdojo.com":1,
"dnsdojo.net":1,
"dnsdojo.org":1,
"does-it.net":1,
"doesntexist.com":1,
"doesntexist.org":1,
"dontexist.com":1,
"dontexist.net":1,
"dontexist.org":1,
"doomdns.com":1,
"doomdns.org":1,
"dvrdns.org":1,
"dyn-o-saur.com":1,
"dynalias.com":1,
"dynalias.net":1,
"dynalias.org":1,
"dynathome.net":1,
"dyndns.ws":1,
"endofinternet.net":1,
"endofinternet.org":1,
"endoftheinternet.org":1,
"est-a-la-maison.com":1,
"est-a-la-masion.com":1,
"est-le-patron.com":1,
"est-mon-blogueur.com":1,
"for-better.biz":1,
"for-more.biz":1,
"for-our.info":1,
"for-some.biz":1,
"for-the.biz":1,
"forgot.her.name":1,
"forgot.his.name":1,
"from-ak.com":1,
"from-al.com":1,
"from-ar.com":1,
"from-az.net":1,
"from-ca.com":1,
"from-co.net":1,
"from-ct.com":1,
"from-dc.com":1,
"from-de.com":1,
"from-fl.com":1,
"from-ga.com":1,
"from-hi.com":1,
"from-ia.com":1,
"from-id.com":1,
"from-il.com":1,
"from-in.com":1,
"from-ks.com":1,
"from-ky.com":1,
"from-la.net":1,
"from-ma.com":1,
"from-md.com":1,
"from-me.org":1,
"from-mi.com":1,
"from-mn.com":1,
"from-mo.com":1,
"from-ms.com":1,
"from-mt.com":1,
"from-nc.com":1,
"from-nd.com":1,
"from-ne.com":1,
"from-nh.com":1,
"from-nj.com":1,
"from-nm.com":1,
"from-nv.com":1,
"from-ny.net":1,
"from-oh.com":1,
"from-ok.com":1,
"from-or.com":1,
"from-pa.com":1,
"from-pr.com":1,
"from-ri.com":1,
"from-sc.com":1,
"from-sd.com":1,
"from-tn.com":1,
"from-tx.com":1,
"from-ut.com":1,
"from-va.com":1,
"from-vt.com":1,
"from-wa.com":1,
"from-wi.com":1,
"from-wv.com":1,
"from-wy.com":1,
"ftpaccess.cc":1,
"fuettertdasnetz.de":1,
"game-host.org":1,
"game-server.cc":1,
"getmyip.com":1,
"gets-it.net":1,
"go.dyndns.org":1,
"gotdns.com":1,
"gotdns.org":1,
"groks-the.info":1,
"groks-this.info":1,
"ham-radio-op.net":1,
"here-for-more.info":1,
"hobby-site.com":1,
"hobby-site.org":1,
"home.dyndns.org":1,
"homedns.org":1,
"homeftp.net":1,
"homeftp.org":1,
"homeip.net":1,
"homelinux.com":1,
"homelinux.net":1,
"homelinux.org":1,
"homeunix.com":1,
"homeunix.net":1,
"homeunix.org":1,
"iamallama.com":1,
"in-the-band.net":1,
"is-a-anarchist.com":1,
"is-a-blogger.com":1,
"is-a-bookkeeper.com":1,
"is-a-bruinsfan.org":1,
"is-a-bulls-fan.com":1,
"is-a-candidate.org":1,
"is-a-caterer.com":1,
"is-a-celticsfan.org":1,
"is-a-chef.com":1,
"is-a-chef.net":1,
"is-a-chef.org":1,
"is-a-conservative.com":1,
"is-a-cpa.com":1,
"is-a-cubicle-slave.com":1,
"is-a-democrat.com":1,
"is-a-designer.com":1,
"is-a-doctor.com":1,
"<API key>.com":1,
"is-a-geek.com":1,
"is-a-geek.net":1,
"is-a-geek.org":1,
"is-a-green.com":1,
"is-a-guru.com":1,
"is-a-hard-worker.com":1,
"is-a-hunter.com":1,
"is-a-knight.org":1,
"is-a-landscaper.com":1,
"is-a-lawyer.com":1,
"is-a-liberal.com":1,
"is-a-libertarian.com":1,
"is-a-linux-user.org":1,
"is-a-llama.com":1,
"is-a-musician.com":1,
"is-a-nascarfan.com":1,
"is-a-nurse.com":1,
"is-a-painter.com":1,
"is-a-patsfan.org":1,
"<API key>.com":1,
"is-a-photographer.com":1,
"is-a-player.com":1,
"is-a-republican.com":1,
"is-a-rockstar.com":1,
"is-a-socialist.com":1,
"is-a-soxfan.org":1,
"is-a-student.com":1,
"is-a-teacher.com":1,
"is-a-techie.com":1,
"is-a-therapist.com":1,
"is-an-accountant.com":1,
"is-an-actor.com":1,
"is-an-actress.com":1,
"is-an-anarchist.com":1,
"is-an-artist.com":1,
"is-an-engineer.com":1,
"is-an-entertainer.com":1,
"is-by.us":1,
"is-certified.com":1,
"is-found.org":1,
"is-gone.com":1,
"is-into-anime.com":1,
"is-into-cars.com":1,
"is-into-cartoons.com":1,
"is-into-games.com":1,
"is-leet.com":1,
"is-lost.org":1,
"is-not-certified.com":1,
"is-saved.org":1,
"is-slick.com":1,
"is-uberleet.com":1,
"is-very-bad.org":1,
"is-very-evil.org":1,
"is-very-good.org":1,
"is-very-nice.org":1,
"is-very-sweet.org":1,
"is-with-theband.com":1,
"isa-geek.com":1,
"isa-geek.net":1,
"isa-geek.org":1,
"isa-hockeynut.com":1,
"issmarterthanyou.com":1,
"isteingeek.de":1,
"istmein.de":1,
"kicks-ass.net":1,
"kicks-ass.org":1,
"knowsitall.info":1,
"lebtimnetz.de":1,
"leitungsen.de":1,
"likes-pie.com":1,
"likescandy.com":1,
"merseine.nu":1,
"mine.nu":1,
"misconfused.org":1,
"mypets.ws":1,
"myphotos.cc":1,
"neat-url.com":1,
"office-on-the.net":1,
"on-the-web.tv":1,
"podzone.net":1,
"podzone.org":1,
"readmyblog.org":1,
"saves-the-whales.com":1,
"scrapper-site.net":1,
"scrapping.cc":1,
"selfip.biz":1,
"selfip.com":1,
"selfip.info":1,
"selfip.net":1,
"selfip.org":1,
"sells-for-less.com":1,
"sells-for-u.com":1,
"sells-it.net":1,
"sellsyourhome.org":1,
"servebbs.com":1,
"servebbs.net":1,
"servebbs.org":1,
"serveftp.net":1,
"serveftp.org":1,
"servegame.org":1,
"shacknet.nu":1,
"simple-url.com":1,
"space-to-rent.com":1,
"teaches-yoga.com":1,
"thruhere.net":1,
"traeumtgerade.de":1,
"webhop.biz":1,
"webhop.info":1,
"webhop.net":1,
"webhop.org":1,
"worse-than.tv":1,
"writesthisblog.com":1,
"a.ssl.fastly.net":1,
"b.ssl.fastly.net":1,
"global.ssl.fastly.net":1,
"a.prod.fastly.net":1,
"global.prod.fastly.net":1,
"firebaseapp.com":1,
"flynnhub.com":1,
"github.io":1,
"githubusercontent.com":1,
"ro.com":1,
"appspot.com":1,
"blogspot.ae":1,
"blogspot.be":1,
"blogspot.bj":1,
"blogspot.ca":1,
"blogspot.cf":1,
"blogspot.ch":1,
"blogspot.co.at":1,
"blogspot.co.il":1,
"blogspot.co.nz":1,
"blogspot.co.uk":1,
"blogspot.com":1,
"blogspot.com.ar":1,
"blogspot.com.au":1,
"blogspot.com.br":1,
"blogspot.com.es":1,
"blogspot.com.tr":1,
"blogspot.cv":1,
"blogspot.cz":1,
"blogspot.de":1,
"blogspot.dk":1,
"blogspot.fi":1,
"blogspot.fr":1,
"blogspot.gr":1,
"blogspot.hk":1,
"blogspot.hu":1,
"blogspot.ie":1,
"blogspot.in":1,
"blogspot.it":1,
"blogspot.jp":1,
"blogspot.kr":1,
"blogspot.mr":1,
"blogspot.mx":1,
"blogspot.nl":1,
"blogspot.no":1,
"blogspot.pt":1,
"blogspot.re":1,
"blogspot.ro":1,
"blogspot.ru":1,
"blogspot.se":1,
"blogspot.sg":1,
"blogspot.sk":1,
"blogspot.td":1,
"blogspot.tw":1,
"codespot.com":1,
"googleapis.com":1,
"googlecode.com":1,
"withgoogle.com":1,
"herokuapp.com":1,
"herokussl.com":1,
"iki.fi":1,
"biz.at":1,
"info.at":1,
"co.pl":1,
"azurewebsites.net":1,
"azure-mobile.net":1,
"cloudapp.net":1,
"nfshost.com":1,
"nyc.mn":1,
"nid.io":1,
"operaunite.com":1,
"outsystemscloud.com":1,
"art.pl":1,
"gliwice.pl":1,
"krakow.pl":1,
"poznan.pl":1,
"wroc.pl":1,
"zakopane.pl":1,
"rhcloud.com":1,
"service.gov.uk":1,
"priv.at":1,
"gda.pl":1,
"gdansk.pl":1,
"gdynia.pl":1,
"med.pl":1,
"sopot.pl":1,
"yolasite.com":1,
"za.net":1,
"za.org":1}; |
<?php
class <API key> extends MediaWikiTestCase {
public static function provideISBNs() {
return array(
array( '978-0-300-14424-6', true ),
array( '0-14-020652-3', true ),
array( '020652-3', false ),
array( '9781234567897', true ),
array( '1-4133-0454-0', true ),
array( '978-1413304541', true ),
array( '0136091814', true ),
array( '0136091812', false ),
array( '9780136091813', true ),
array( '9780136091817', false ),
array( '123456789X', true ),
// Bug 67021
array( '1413304541', false ),
array( '141330454X', false ),
array( '1413304540', true ),
array( '14133X4540', false ),
array( '97814133X4541', false ),
array( '978035642615X', false ),
array( '9781413304541', true ),
array( '9780356426150', true ),
);
}
/**
* @covers SpecialBooksources::isValidISBN
* @dataProvider provideISBNs
*/
public function testIsValidISBN( $isbn, $isValid ) {
$this->assertSame( $isValid, SpecialBooksources::isValidISBN( $isbn ) );
}
} |
<?php
class WP_Piwik_Settings {
private static $logger, $defaultSettings;
private $globalSettings = array(
'revision' => 90921,
'plugin_display_name' => 'WP-Piwik',
'add_tracking_code' => false,
'<API key>' => 0,
'piwik_token' => '',
'piwik_url' => '',
'piwik_path' => '',
'piwik_mode' => 'http',
'piwik_useragent' => 'php',
'<API key>' => 'WP-Piwik',
'connection_timeout' => 5,
'dashboard_widget' => false,
'dashboard_chart' => false,
'dashboard_seo' => false,
'stats_seo' => false,
'capability_stealth' => array(),
'<API key>' => array('administrator' => true),
'piwik_shortcut' => false,
'default_date' => 'yesterday',
'auto_site_config' => true,
'track_404' => false,
'track_search' => false,
'track_mode' => 0,
'track_post' => false,
'track_proxy' => false,
'track_admin' => false,
'track_feed' => false,
'track_feed_goal' => '',
'track_feed_revenue' => '',
'track_feed_campaign' => 'feed',
'<API key>' => 'false',
'track_cdnurlssl' => '',
'track_noscript' => false,
'track_nojavascript' => false,
'track_codeposition' => 'footer',
'track_datacfasync' => false,
'track_across' => false,
'track_across_alias' => false,
'limit_cookies' => false,
'<API key>' => 1209600,
'<API key>' => 0,
'<API key>' => false,
'add_customvars_box' => true,
'disable_timelimit' => false,
'disable_ssl_verify' => false,
'disable_cookies' => false,
'toolbar' => false,
'shortcodes' => false,
'cache' => true,
'perpost_stats' => false
),
$settings = array(
'name' => '',
'tracking_code' => '',
'site_id' => NULL,
'<API key>' => 0,
'dashboard_revision' => 0,
'noscript_code' => ''
),
$settingsChanged = false;
public function __construct($objLogger) {
self::$logger = $objLogger;
self::$logger->log('Store default settings');
self::$defaultSettings = array('globalSettings' => $this->globalSettings, 'settings' => $this->settings);
self::$logger->log('Load settings');
$this->globalSettings = ($this-><API key>()?
get_site_option('<API key>', $this->globalSettings):
get_option('<API key>', $this->globalSettings)
);
$this->settings = get_option('wp-piwik_settings',$this->settings);
}
public function save() {
if (!$this->settingsChanged) {
self::$logger->log('No settings changed yet');
return;
}
self::$logger->log('Save settings');
if (<API key>('wp-piwik/wp-piwik.php'))
update_site_option('<API key>', $this->globalSettings);
else
update_option('<API key>', $this->globalSettings);
update_option('wp-piwik_settings', $this->settings);
global $wp_roles;
if (!is_object($wp_roles))
$wp_roles = new WP_Roles();
if (!is_object($wp_roles)) die("STILL NO OBJECT");
foreach($wp_roles->role_names as $strKey => $strName) {
$objRole = get_role($strKey);
foreach (array('stealth', 'read_stats') as $strCap) {
$aryCaps = $this->getGlobalOption('capability_'.$strCap);
if (isset($aryCaps[$strKey]) && $aryCaps[$strKey])
$objRole->add_cap('wp-piwik_'.$strCap);
else $objRole->remove_cap('wp-piwik_'.$strCap);
}
}
$this->settingsChanges = false;
}
public function getGlobalOption($key) {
return isset($this->globalSettings[$key])?$this->globalSettings[$key]:self::$defaultSettings['globalSettings'][$key];
}
public function getOption($key) {
return isset($this->settings[$key])?$this->settings[$key]:self::$defaultSettings['settings'][$key];
}
public function setGlobalOption($key, $value) {
$this->settingsChanged = true;
self::$logger->log('Changed global option '.$key.': '.(is_array($value)?serialize($value):$value));
$this->globalSettings[$key] = $value;
}
public function setOption($key, $value) {
$this->settingsChanged = true;
self::$logger->log('Changed option '.$key.': '.$value);
$this->settings[$key] = $value;
}
public function resetSettings($bolFull = false) {
self::$logger->log('Reset WP-Piwik settings');
global $wpdb;
$keepSettings = array(
'piwik_token' => $this->getGlobalOption('piwik_token'),
'piwik_url' => $this->getGlobalOption('piwik_url'),
'piwik_path' => $this->getGlobalOption('piwik_path'),
'piwik_mode' => $this->getGlobalOption('piwik_mode')
);
if (<API key>('wp-piwik/wp-piwik.php')) {
delete_site_option('<API key>');
$aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
foreach ($aryBlogs as $aryBlog)
delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings');
if (!$bolFull) update_site_option('<API key>', $keepSettings);
} else {
delete_option('<API key>');
delete_option('wp-piwik_settings');
}
$this->globalSettings = self::$defaultSettings['globalSettings'];
$this->settings = self::$defaultSettings['settings'];
if (!$bolFull) {
self::$logger->log('Restore connection settings');
foreach ($keepSettings as $key => $value)
$this->setGlobalOption($key, $value);
}
$this->save();
}
public function <API key>() {
if (!function_exists("<API key>")) {
require_once(ABSPATH.'wp-admin/includes/plugin.php');
}
return <API key>('wp-piwik/wp-piwik.php');
}
} |
#define pr_fmt(fmt) "MSM-CPP %s:%d " fmt, __func__, __LINE__
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/module.h>
#include <linux/ion.h>
#include <linux/proc_fs.h>
#include <linux/msm_ion.h>
#include <linux/iommu.h>
#include <linux/timer.h>
#include <linux/kernel.h>
#include <linux/workqueue.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/msmb_camera.h>
#include <media/<API key>.h>
#include <media/msmb_pproc.h>
#include "msm_cpp.h"
#include "msm_isp_util.h"
#include "msm_camera_io_util.h"
#include <linux/debugfs.h>
#include "cam_smmu_api.h"
#define MSM_CPP_DRV_NAME "msm_cpp"
#define <API key> 16
#define CONFIG_MSM_CPP_DBG 0
#define ENABLE_CPP_LOW 0
#define CPP_CMD_TIMEOUT_MS 300
#define <API key> 0x00000000
#define <API key> 266670000
#define MSM_CPP_TURBO_CLOCK 320000000
#define <API key> 0x10020000
#define <API key> 0x10040000
#define <API key> 0x10060000
#define <API key> 0x10080000
#define <API key> 0x10100000
/* dump the frame command before writing to the hardware */
#define <API key> 0
#define CPP_CLK_INFO_MAX 16
#define <API key> 0x7c8
#define <API key> 0xFFFFFFFE
#define <API key> 0xFFFFFFFD
#define <API key> 0x2
#define <API key> 0x1
#define PAYLOAD_NUM_PLANES 3
#define TNR_MASK 0x4
#define UBWC_MASK 0x20
#define CDS_MASK 0x40
#define MMU_PF_MASK 0x80
#define POP_FRONT 1
#define POP_BACK 0
#define BATCH_DUP_MASK 0x100
#define <API key>(new_frame) \
(((new_frame->batch_info.batch_mode == BATCH_MODE_PREVIEW) && \
new_frame->duplicate_output) ? 1 : 0)
#define <API key>(new_frame, iden, swap_iden) { \
if (<API key>(new_frame)) \
iden = swap_iden; \
}
#define <API key>(new_frame, buff_mgr_info, \
cur_index, swap_index) { \
if (<API key>(new_frame)) \
buff_mgr_info.index = swap_index; \
else \
buff_mgr_info.index = cur_index; \
}
/*
* Default value for get buf to be used - 0xFFFFFFFF
* 0 is a valid index
* no valid index from userspace, use last buffer from queue.
*/
#define <API key> 0xFFFFFFFF
#define <API key>(index) \
((index == <API key>) ? 1 : 0)
static struct msm_cpp_vbif_data cpp_vbif;
static int msm_cpp_buffer_ops(struct cpp_device *cpp_dev,
uint32_t buff_mgr_ops, uint32_t ids, void *arg);
static int <API key>(struct cpp_device *cpp_dev,
struct msm_queue_cmd *frame_qcmd);
static int <API key>(struct cpp_device *cpp_dev,
uint32_t *cmd_msg, uint32_t payload_size);
static int <API key>(struct cpp_device *cpp_dev,
bool status);
static int <API key>(struct cpp_device *cpp_dev,
uint32_t buff_mgr_ops, uint32_t id, void *arg);
#if CONFIG_MSM_CPP_DBG
#define CPP_DBG(fmt, args...) pr_err(fmt, ##args)
#else
#define CPP_DBG(fmt, args...) pr_debug(fmt, ##args)
#endif
#define CPP_LOW(fmt, args...) do { \
if (ENABLE_CPP_LOW) \
pr_info(fmt, ##args); \
} while (0)
#define ERR_USER_COPY(to) pr_err("copy %s user\n", \
((to) ? "to" : "from"))
#define ERR_COPY_FROM_USER() ERR_USER_COPY(0)
#define msm_dequeue(queue, member, pop_dir) ({ \
unsigned long flags; \
struct msm_device_queue *__q = (queue); \
struct msm_queue_cmd *qcmd = 0; \
spin_lock_irqsave(&__q->lock, flags); \
if (!list_empty(&__q->list)) { \
__q->len
qcmd = pop_dir ? list_first_entry(&__q->list, \
struct msm_queue_cmd, member) : \
list_last_entry(&__q->list, \
struct msm_queue_cmd, member); \
list_del_init(&qcmd->member); \
} \
<API key>(&__q->lock, flags); \
qcmd; \
})
#define <API key> 1
struct <API key> {
struct cpp_device *cpp_dev;
struct <API key> *processed_frame[<API key>];
spinlock_t <API key>;
};
struct msm_cpp_timer_t {
atomic_t used;
struct <API key> data;
struct timer_list cpp_timer;
};
struct msm_cpp_timer_t cpp_timer;
static void <API key>(struct cpp_device *cpp_dev);
void <API key>(void *dev,
enum cpp_vbif_client client,
int (*<API key>)(void *, uint32_t))
{
if (dev == NULL || client >= VBIF_CLIENT_MAX) {
pr_err("%s: Fail to register handler! dev = %pK,client %d\n",
__func__, dev, client);
return;
}
if (<API key> != NULL) {
cpp_vbif.dev[client] = dev;
cpp_vbif.err_handler[client] = <API key>;
} else {
/* if handler = NULL, is unregister case */
cpp_vbif.dev[client] = NULL;
cpp_vbif.err_handler[client] = NULL;
}
}
static int <API key>(struct cpp_device *cpp_dev)
{
int rc = 0;
rc = <API key>(cpp_dev->pdev, CAM_BUS_CLIENT_CPP);
if (rc < 0) {
pr_err("Fail to register bus client\n");
return -ENOENT;
}
rc = <API key>(CAM_BUS_CLIENT_CPP, 0, 0);
if (rc < 0) {
<API key>(CAM_BUS_CLIENT_CPP);
pr_err("Fail bus scale update %d\n", rc);
return -EINVAL;
}
return 0;
}
static int <API key>(struct cpp_device *cpp_dev,
uint64_t ab, uint64_t ib)
{
int rc;
rc = <API key>(CAM_BUS_CLIENT_CPP, ab, ib);
if (rc < 0) {
pr_err("Fail bus scale update %d\n", rc);
return -EINVAL;
}
return 0;
}
void <API key>(struct cpp_device *cpp_dev)
{
int rc = 0;
rc = <API key>(CAM_BUS_CLIENT_CPP);
if (rc < 0) {
pr_err("Failed to unregister %d\n", rc);
return;
}
}
static int <API key>(struct cpp_device *cpp_dev,
uint64_t ab, uint64_t ib) {
int rc;
if (cpp_dev->bus_master_flag)
rc = <API key>(cpp_dev, ab, ib);
else
rc = <API key>(ISP_CPP, ab, ib);
return rc;
}
static void msm_queue_init(struct msm_device_queue *queue, const char *name)
{
CPP_DBG("E\n");
spin_lock_init(&queue->lock);
queue->len = 0;
queue->max = 0;
queue->name = name;
INIT_LIST_HEAD(&queue->list);
init_waitqueue_head(&queue->wait);
}
static void msm_enqueue(struct msm_device_queue *queue,
struct list_head *entry)
{
unsigned long flags;
spin_lock_irqsave(&queue->lock, flags);
queue->len++;
if (queue->len > queue->max) {
queue->max = queue->len;
pr_debug("queue %s new max is %d\n", queue->name, queue->max);
}
list_add_tail(entry, &queue->list);
wake_up(&queue->wait);
CPP_DBG("woke up %s\n", queue->name);
<API key>(&queue->lock, flags);
}
#define msm_cpp_empty_list(queue, member) { \
unsigned long flags; \
struct msm_queue_cmd *qcmd = NULL; \
if (queue) { \
spin_lock_irqsave(&queue->lock, flags); \
while (!list_empty(&queue->list)) { \
queue->len
qcmd = list_first_entry(&queue->list, \
struct msm_queue_cmd, member); \
list_del_init(&qcmd->member); \
kfree(qcmd); \
} \
<API key>(&queue->lock, flags); \
} \
}
static int <API key>(struct cpp_device *cpp_dev,
uint8_t put_buf);
static int32_t cpp_load_fw(struct cpp_device *cpp_dev, char *fw_name_bin);
static void cpp_timer_callback(unsigned long data);
uint8_t induce_error;
static int <API key>(struct cpp_device *cpp_dev);
static void msm_cpp_write(u32 data, void __iomem *cpp_base)
{
msm_camera_io_w((data), cpp_base + <API key>);
}
static void msm_cpp_clear_timer(struct cpp_device *cpp_dev)
{
uint32_t i = 0;
if (atomic_read(&cpp_timer.used)) {
atomic_set(&cpp_timer.used, 0);
del_timer(&cpp_timer.cpp_timer);
for (i = 0; i < <API key>; i++)
cpp_timer.data.processed_frame[i] = NULL;
cpp_dev->timeout_trial_cnt = 0;
}
}
static void <API key>(struct cpp_device *cpp_dev)
{
uint32_t i;
unsigned long flags;
CPP_DBG("Frame done qlen %d\n", cpp_dev->processing_q.len);
if (cpp_dev->processing_q.len <= 1) {
msm_cpp_clear_timer(cpp_dev);
} else {
spin_lock_irqsave(&cpp_timer.data.<API key>, flags);
for (i = 0; i < cpp_dev->processing_q.len - 1; i++)
cpp_timer.data.processed_frame[i] =
cpp_timer.data.processed_frame[i + 1];
cpp_timer.data.processed_frame[i] = NULL;
cpp_dev->timeout_trial_cnt = 0;
<API key>(&cpp_timer.data.<API key>,
flags);
mod_timer(&cpp_timer.cpp_timer,
jiffies + msecs_to_jiffies(CPP_CMD_TIMEOUT_MS));
}
}
static uint32_t msm_cpp_read(void __iomem *cpp_base)
{
uint32_t tmp, retry = 0;
do {
tmp = msm_camera_io_r(cpp_base + <API key>);
} while (((tmp & 0x2) == 0x0) && (retry++ < 10));
if (retry < 10) {
tmp = msm_camera_io_r(cpp_base + <API key>);
CPP_DBG("Read data: 0%x\n", tmp);
} else {
CPP_DBG("Read failed\n");
tmp = 0xDEADBEEF;
}
return tmp;
}
static struct <API key> *<API key>(
struct cpp_device *cpp_dev, uint32_t session_id, uint32_t stream_id)
{
uint32_t i = 0;
struct <API key> *buff_queue_info = NULL;
for (i = 0; i < cpp_dev->num_buffq; i++) {
if ((cpp_dev->buff_queue[i].used == 1) &&
(cpp_dev->buff_queue[i].session_id == session_id) &&
(cpp_dev->buff_queue[i].stream_id == stream_id)) {
buff_queue_info = &cpp_dev->buff_queue[i];
break;
}
}
if (buff_queue_info == NULL) {
CPP_DBG("buffer queue entry for sess:%d strm:%d not found\n",
session_id, stream_id);
}
return buff_queue_info;
}
static unsigned long <API key>(struct cpp_device *cpp_dev,
struct <API key> *buff_queue_info, uint32_t buff_index,
uint8_t native_buff, int32_t *fd)
{
unsigned long phy_add = 0;
struct list_head *buff_head;
struct <API key> *buff, *save;
if (native_buff)
buff_head = &buff_queue_info->native_buff_head;
else
buff_head = &buff_queue_info->vb2_buff_head;
<API key>(buff, save, buff_head, entry) {
if (buff->map_info.buff_info.index == buff_index) {
phy_add = buff->map_info.phy_addr;
*fd = buff->map_info.buff_info.fd;
break;
}
}
return phy_add;
}
static unsigned long <API key>(struct cpp_device *cpp_dev,
struct <API key> *buff_queue,
struct <API key> *buffer_info)
{
struct list_head *buff_head;
struct <API key> *buff, *save;
int rc = 0;
if (buffer_info->native_buff)
buff_head = &buff_queue->native_buff_head;
else
buff_head = &buff_queue->vb2_buff_head;
<API key>(buff, save, buff_head, entry) {
if (buff->map_info.buff_info.index == buffer_info->index) {
pr_err("error buffer index already queued\n");
goto error;
}
}
buff = kzalloc(
sizeof(struct <API key>), GFP_KERNEL);
if (!buff) {
pr_err("error allocating memory\n");
goto error;
}
buff->map_info.buff_info = *buffer_info;
buff->map_info.buf_fd = buffer_info->fd;
rc = <API key>(cpp_dev->iommu_hdl, buffer_info->fd,
CAM_SMMU_MAP_RW, &buff->map_info.phy_addr,
(size_t *)&buff->map_info.len);
if (rc < 0) {
pr_err("ION mmap failed\n");
kzfree(buff);
goto error;
}
INIT_LIST_HEAD(&buff->entry);
list_add_tail(&buff->entry, buff_head);
return buff->map_info.phy_addr;
error:
return 0;
}
static void <API key>(struct cpp_device *cpp_dev,
struct <API key> *buff)
{
int ret = -1;
ret = <API key>(cpp_dev->iommu_hdl, buff->map_info.buf_fd);
if (ret < 0)
pr_err("Error: cannot put the iommu handle back to ion fd\n");
list_del_init(&buff->entry);
kzfree(buff);
return;
}
static unsigned long <API key>(struct cpp_device *cpp_dev,
struct <API key> *buffer_info, uint32_t session_id,
uint32_t stream_id, int32_t *fd)
{
unsigned long phy_addr = 0;
struct <API key> *buff_queue_info;
uint8_t native_buff = buffer_info->native_buff;
buff_queue_info = <API key>(cpp_dev, session_id,
stream_id);
if (buff_queue_info == NULL) {
pr_err("error finding buffer queue entry for sessid:%d strmid:%d\n",
session_id, stream_id);
return phy_addr;
}
phy_addr = <API key>(cpp_dev, buff_queue_info,
buffer_info->index, native_buff, fd);
if ((phy_addr == 0) && (native_buff)) {
phy_addr = <API key>(cpp_dev, buff_queue_info,
buffer_info);
*fd = buffer_info->fd;
}
return phy_addr;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
struct <API key> *buff_queue_info)
{
struct <API key> *buff, *save;
struct list_head *buff_head;
buff_head = &buff_queue_info->native_buff_head;
<API key>(buff, save, buff_head, entry) {
<API key>(cpp_dev, buff);
}
buff_head = &buff_queue_info->vb2_buff_head;
<API key>(buff, save, buff_head, entry) {
<API key>(cpp_dev, buff);
}
return 0;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
struct <API key> *buff_queue_info, uint32_t buff_index,
uint8_t native_buff)
{
struct <API key> *buff, *save;
struct list_head *buff_head;
if (native_buff)
buff_head = &buff_queue_info->native_buff_head;
else
buff_head = &buff_queue_info->vb2_buff_head;
<API key>(buff, save, buff_head, entry) {
if (buff->map_info.buff_info.index == buff_index) {
<API key>(cpp_dev, buff);
break;
}
}
return 0;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
uint16_t session_id, uint16_t stream_id)
{
uint32_t i;
struct <API key> *buff_queue_info;
for (i = 0; i < cpp_dev->num_buffq; i++) {
if (cpp_dev->buff_queue[i].used == 0) {
buff_queue_info = &cpp_dev->buff_queue[i];
buff_queue_info->used = 1;
buff_queue_info->session_id = session_id;
buff_queue_info->stream_id = stream_id;
INIT_LIST_HEAD(&buff_queue_info->vb2_buff_head);
INIT_LIST_HEAD(&buff_queue_info->native_buff_head);
return 0;
}
}
pr_err("buffer queue full. error for sessionid: %d streamid: %d\n",
session_id, stream_id);
return -EINVAL;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
uint32_t session_id, uint32_t stream_id)
{
struct <API key> *buff_queue_info;
buff_queue_info = <API key>(cpp_dev, session_id,
stream_id);
if (buff_queue_info == NULL) {
pr_err("error finding buffer queue entry for sessid:%d strmid:%d\n",
session_id, stream_id);
return -EINVAL;
}
buff_queue_info->used = 0;
buff_queue_info->session_id = 0;
buff_queue_info->stream_id = 0;
INIT_LIST_HEAD(&buff_queue_info->vb2_buff_head);
INIT_LIST_HEAD(&buff_queue_info->native_buff_head);
return 0;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
uint32_t num_buffq)
{
struct <API key> *buff_queue;
buff_queue = kzalloc(
sizeof(struct <API key>) * num_buffq,
GFP_KERNEL);
if (!buff_queue) {
pr_err("Buff queue allocation failure\n");
return -ENOMEM;
}
if (cpp_dev->buff_queue) {
pr_err("Buff queue not empty\n");
kzfree(buff_queue);
return -EINVAL;
} else {
cpp_dev->buff_queue = buff_queue;
cpp_dev->num_buffq = num_buffq;
}
return 0;
}
static void <API key>(struct cpp_device *cpp_dev)
{
uint32_t i;
for (i = 0; i < cpp_dev->num_buffq; i++) {
if (cpp_dev->buff_queue[i].used == 1) {
pr_warn("Queue not free sessionid: %d, streamid: %d\n",
cpp_dev->buff_queue[i].session_id,
cpp_dev->buff_queue[i].stream_id);
<API key>
(cpp_dev, &cpp_dev->buff_queue[i]);
<API key>(cpp_dev,
cpp_dev->buff_queue[i].session_id,
cpp_dev->buff_queue[i].stream_id);
}
}
kzfree(cpp_dev->buff_queue);
cpp_dev->buff_queue = NULL;
cpp_dev->num_buffq = 0;
return;
}
static int32_t msm_cpp_poll(void __iomem *cpp_base, u32 val)
{
uint32_t tmp, retry = 0;
int32_t rc = 0;
do {
tmp = msm_cpp_read(cpp_base);
if (tmp != 0xDEADBEEF)
CPP_LOW("poll: 0%x\n", tmp);
usleep_range(200, 250);
} while ((tmp != val) && (retry++ < <API key>));
if (retry < <API key>) {
CPP_LOW("Poll finished\n");
} else {
pr_err("Poll failed: expect: 0x%x\n", val);
rc = -EINVAL;
}
return rc;
}
static int32_t <API key>(void __iomem *cpp_base)
{
uint32_t tmp, retry = 0;
int32_t rc = 0;
tmp = msm_camera_io_r(cpp_base + <API key>);
while (((tmp & 0x2) != 0x0) && (retry++ < <API key>)) {
/*
* Below usleep values are chosen based on experiments
* and this was the smallest number which works. This
* sleep is needed to leave enough time for Microcontroller
* to read rx fifo.
*/
usleep_range(200, 300);
tmp = msm_camera_io_r(cpp_base + <API key>);
}
if (retry < <API key>) {
CPP_LOW("Poll rx empty\n");
} else {
pr_err("Poll rx empty failed\n");
rc = -EINVAL;
}
return rc;
}
static int cpp_init_mem(struct cpp_device *cpp_dev)
{
int rc = 0;
int iommu_hdl;
if (cpp_dev->hw_info.cpp_hw_version == <API key> ||
cpp_dev->hw_info.cpp_hw_version == <API key>)
rc = cam_smmu_get_handle("cpp_0", &iommu_hdl);
else
rc = cam_smmu_get_handle("cpp", &iommu_hdl);
if (rc < 0)
return -ENODEV;
cpp_dev->iommu_hdl = iommu_hdl;
return 0;
}
static irqreturn_t msm_cpp_irq(int irq_num, void *data)
{
unsigned long flags;
uint32_t tx_level;
uint32_t irq_status;
uint32_t i;
uint32_t tx_fifo[<API key>];
struct cpp_device *cpp_dev = data;
struct <API key> *queue_cmd;
irq_status = msm_camera_io_r(cpp_dev->base + <API key>);
if (irq_status & 0x8) {
tx_level = msm_camera_io_r(cpp_dev->base +
<API key>) >> 2;
for (i = 0; i < tx_level; i++) {
tx_fifo[i] = msm_camera_io_r(cpp_dev->base +
<API key>);
}
spin_lock_irqsave(&cpp_dev->tasklet_lock, flags);
queue_cmd = &cpp_dev->tasklet_queue_cmd[cpp_dev->taskletq_idx];
if (queue_cmd->cmd_used) {
pr_err("%s:%d] cpp tasklet queue overflow tx %d rc %x",
__func__, __LINE__, tx_level, irq_status);
list_del(&queue_cmd->list);
} else {
atomic_add(1, &cpp_dev->irq_cnt);
}
queue_cmd->irq_status = irq_status;
queue_cmd->tx_level = tx_level;
memset(&queue_cmd->tx_fifo[0], 0, sizeof(queue_cmd->tx_fifo));
for (i = 0; i < tx_level; i++)
queue_cmd->tx_fifo[i] = tx_fifo[i];
queue_cmd->cmd_used = 1;
cpp_dev->taskletq_idx =
(cpp_dev->taskletq_idx + 1) % <API key>;
list_add_tail(&queue_cmd->list, &cpp_dev->tasklet_q);
<API key>(&cpp_dev->tasklet_lock, flags);
tasklet_schedule(&cpp_dev->cpp_tasklet);
} else if (irq_status & 0x7C0) {
pr_debug("irq_status: 0x%x\n", irq_status);
pr_debug("DEBUG_SP: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x40));
pr_debug("DEBUG_T: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x44));
pr_debug("DEBUG_N: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x48));
pr_debug("DEBUG_R: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x4C));
pr_debug("DEBUG_OPPC: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x50));
pr_debug("DEBUG_MO: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x54));
pr_debug("DEBUG_TIMER0: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x60));
pr_debug("DEBUG_TIMER1: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x64));
pr_debug("DEBUG_GPI: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x70));
pr_debug("DEBUG_GPO: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x74));
pr_debug("DEBUG_T0: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x80));
pr_debug("DEBUG_R0: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x84));
pr_debug("DEBUG_T1: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x88));
pr_debug("DEBUG_R1: 0x%x\n",
msm_camera_io_r(cpp_dev->base + 0x8C));
}
msm_camera_io_w(irq_status, cpp_dev->base + <API key>);
return IRQ_HANDLED;
}
void msm_cpp_do_tasklet(unsigned long data)
{
unsigned long flags;
uint32_t irq_status;
uint32_t tx_level;
uint32_t msg_id, cmd_len;
uint32_t i;
uint32_t tx_fifo[<API key>];
struct cpp_device *cpp_dev = (struct cpp_device *) data;
struct <API key> *queue_cmd;
while (atomic_read(&cpp_dev->irq_cnt)) {
spin_lock_irqsave(&cpp_dev->tasklet_lock, flags);
queue_cmd = list_first_entry(&cpp_dev->tasklet_q,
struct <API key>, list);
if (!queue_cmd) {
atomic_set(&cpp_dev->irq_cnt, 0);
<API key>(&cpp_dev->tasklet_lock, flags);
return;
}
atomic_sub(1, &cpp_dev->irq_cnt);
list_del(&queue_cmd->list);
queue_cmd->cmd_used = 0;
irq_status = queue_cmd->irq_status;
tx_level = queue_cmd->tx_level;
for (i = 0; i < tx_level; i++)
tx_fifo[i] = queue_cmd->tx_fifo[i];
<API key>(&cpp_dev->tasklet_lock, flags);
for (i = 0; i < tx_level; i++) {
if (tx_fifo[i] == MSM_CPP_MSG_ID_CMD) {
cmd_len = tx_fifo[i+1];
msg_id = tx_fifo[i+2];
if (msg_id == <API key>) {
CPP_DBG("Frame done!!\n");
/* delete CPP timer */
CPP_DBG("delete timer.\n");
<API key>(cpp_dev);
<API key>(cpp_dev, 0);
} else if (msg_id ==
<API key>) {
pr_err("NACK error from hw!!\n");
CPP_DBG("delete timer.\n");
<API key>(cpp_dev);
<API key>(cpp_dev, 0);
}
i += cmd_len + 2;
}
}
}
}
static int cpp_init_hardware(struct cpp_device *cpp_dev)
{
int rc = 0;
uint32_t vbif_version;
rc = cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
CAM_AHB_SVS_VOTE);
if (rc < 0) {
pr_err("%s: failed to vote for AHB\n", __func__);
goto ahb_vote_fail;
}
rc = <API key>(cpp_dev->cpp_vdd,
cpp_dev->num_reg, true);
if (rc < 0) {
pr_err("%s: failed to enable regulators\n", __func__);
goto reg_enable_failed;
}
rc = <API key>(cpp_dev);
if (rc < 0) {
pr_err("%s: set micro clk failed\n", __func__);
goto clk_failed;
}
rc = <API key>(&cpp_dev->pdev->dev, cpp_dev->clk_info,
cpp_dev->cpp_clk, cpp_dev->num_clks, true);
if (rc < 0) {
pr_err("%s: clk enable failed\n", __func__);
goto clk_failed;
}
if (cpp_dev->state != CPP_STATE_BOOT) {
rc = <API key>(cpp_dev->pdev, cpp_dev->irq,
msm_cpp_irq, IRQF_TRIGGER_RISING, "cpp", cpp_dev);
if (rc < 0) {
pr_err("%s: irq request fail\n", __func__);
goto req_irq_fail;
}
rc = <API key>(&cpp_dev->buf_mgr_ops);
if (rc < 0) {
pr_err("buf mngr req ops failed\n");
<API key>(cpp_dev->pdev,
cpp_dev->irq, cpp_dev);
goto req_irq_fail;
}
}
cpp_dev->hw_info.cpp_hw_version =
msm_camera_io_r(cpp_dev->cpp_hw_base);
if (cpp_dev->hw_info.cpp_hw_version == <API key>) {
vbif_version = msm_camera_io_r(cpp_dev->vbif_base);
if (vbif_version == VBIF_VERSION_2_3_0)
cpp_dev->hw_info.cpp_hw_version = <API key>;
}
pr_info("CPP HW Version: 0x%x\n", cpp_dev->hw_info.cpp_hw_version);
cpp_dev->hw_info.cpp_hw_caps =
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x4);
rc = msm_update_freq_tbl(cpp_dev);
if (rc < 0)
goto pwr_collapse_reset;
pr_debug("CPP HW Caps: 0x%x\n", cpp_dev->hw_info.cpp_hw_caps);
msm_camera_io_w(0x1, cpp_dev->vbif_base + 0x4);
cpp_dev->taskletq_idx = 0;
atomic_set(&cpp_dev->irq_cnt, 0);
rc = <API key>(cpp_dev, <API key>);
if (rc < 0) {
pr_err("%s: create buff queue failed with err %d\n",
__func__, rc);
goto pwr_collapse_reset;
}
pr_err("stream_cnt:%d\n", cpp_dev->stream_cnt);
cpp_dev->stream_cnt = 0;
if (cpp_dev->fw_name_bin) {
<API key>(cpp_dev->irq, false);
rc = cpp_load_fw(cpp_dev, cpp_dev->fw_name_bin);
<API key>(cpp_dev->irq, true);
if (rc < 0) {
pr_err("%s: load firmware failure %d\n", __func__, rc);
goto pwr_collapse_reset;
}
msm_camera_io_w_mb(0x7C8, cpp_dev->base +
<API key>);
msm_camera_io_w_mb(0xFFFF, cpp_dev->base +
<API key>);
}
<API key>(cpp_dev);
return rc;
pwr_collapse_reset:
<API key>(cpp_dev, false);
req_irq_fail:
<API key>(&cpp_dev->pdev->dev, cpp_dev->clk_info,
cpp_dev->cpp_clk, cpp_dev->num_clks, false);
clk_failed:
<API key>(cpp_dev->cpp_vdd,
cpp_dev->num_reg, false);
reg_enable_failed:
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
<API key>) < 0)
pr_err("%s: failed to remove vote for AHB\n", __func__);
ahb_vote_fail:
return rc;
}
static void <API key>(struct cpp_device *cpp_dev)
{
int32_t rc;
if (cpp_dev->state != CPP_STATE_BOOT) {
<API key>(cpp_dev->pdev, cpp_dev->irq, cpp_dev);
tasklet_kill(&cpp_dev->cpp_tasklet);
atomic_set(&cpp_dev->irq_cnt, 0);
}
<API key>(cpp_dev);
<API key>(cpp_dev, false);
<API key>(&cpp_dev->pdev->dev, cpp_dev->clk_info,
cpp_dev->cpp_clk, cpp_dev->num_clks, false);
<API key>(cpp_dev->cpp_vdd, cpp_dev->num_reg, false);
if (cpp_dev->stream_cnt > 0) {
pr_warn("stream count active\n");
rc = <API key>(cpp_dev, 0, 0);
}
cpp_dev->stream_cnt = 0;
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
<API key>) < 0)
pr_err("%s: failed to remove vote for AHB\n", __func__);
}
static int32_t cpp_load_fw(struct cpp_device *cpp_dev, char *fw_name_bin)
{
uint32_t i;
uint32_t *ptr_bin = NULL;
int32_t rc = 0;
if (!fw_name_bin) {
pr_err("%s:%d] invalid fw name", __func__, __LINE__);
rc = -EINVAL;
goto end;
}
pr_debug("%s:%d] FW file: %s\n", __func__, __LINE__, fw_name_bin);
if (NULL == cpp_dev->fw) {
pr_err("%s:%d] fw NULL", __func__, __LINE__);
rc = -EINVAL;
goto end;
}
ptr_bin = (uint32_t *)cpp_dev->fw->data;
if (!ptr_bin) {
pr_err("%s:%d] Fw bin NULL", __func__, __LINE__);
rc = -EINVAL;
goto end;
}
msm_camera_io_w(0x1, cpp_dev->base + <API key>);
msm_camera_io_w(0x1, cpp_dev->base +
<API key>);
rc = msm_cpp_poll(cpp_dev->base, MSM_CPP_MSG_ID_CMD);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
MSM_CPP_MSG_ID_CMD, rc);
goto end;
}
msm_camera_io_w(0xFFFFFFFF, cpp_dev->base +
<API key>);
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
/*Start firmware loading*/
msm_cpp_write(MSM_CPP_CMD_FW_LOAD, cpp_dev->base);
msm_cpp_write(cpp_dev->fw->size, cpp_dev->base);
msm_cpp_write(<API key>, cpp_dev->base);
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
for (i = 0; i < cpp_dev->fw->size/4; i++) {
msm_cpp_write(*ptr_bin, cpp_dev->base);
if (i % <API key> == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
}
ptr_bin++;
}
msm_camera_io_w_mb(0x00, cpp_dev->cpp_hw_base + 0xC);
rc = <API key>(cpp_dev, true);
if (rc < 0)
pr_err("update cpp gdscr status failed\n");
rc = msm_cpp_poll(cpp_dev->base, MSM_CPP_MSG_ID_OK);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
MSM_CPP_MSG_ID_OK, rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, MSM_CPP_MSG_ID_CMD);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
MSM_CPP_MSG_ID_CMD, rc);
goto end;
}
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
/*Trigger MC to jump to start address*/
msm_cpp_write(<API key>, cpp_dev->base);
msm_cpp_write(<API key>, cpp_dev->base);
rc = msm_cpp_poll(cpp_dev->base, MSM_CPP_MSG_ID_CMD);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
MSM_CPP_MSG_ID_CMD, rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, 0x1);
if (rc) {
pr_err("%s:%d] poll command 0x1 failed %d", __func__, __LINE__,
rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, <API key>);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
<API key>, rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, <API key>);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
<API key>, rc);
}
end:
return rc;
}
int <API key>(void *dev, uint32_t vbif_error)
{
struct cpp_device *cpp_dev = NULL;
if (dev == NULL || vbif_error >= CPP_VBIF_ERROR_MAX) {
pr_err("failed: dev %pK,vbif error %d\n", dev, vbif_error);
return -EINVAL;
}
cpp_dev = (struct cpp_device *) dev;
/* <API key> = 0x10 */
pr_err("%s: before reset halt... read <API key> = 0x%x",
__func__, msm_camera_io_r(cpp_dev->cpp_hw_base + 0x10));
pr_err("%s: start reset bus bridge on FD + CPP!\n", __func__);
/* <API key> = 0x8, firmware reset = 0x3DF77 */
msm_camera_io_w(0x3DF77, cpp_dev->cpp_hw_base + 0x8);
/* <API key> = 0x10 */
pr_err("%s: after reset halt... read <API key> = 0x%x",
__func__, msm_camera_io_r(cpp_dev->cpp_hw_base + 0x10));
return 0;
}
static int cpp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
int rc;
uint32_t i;
struct cpp_device *cpp_dev = NULL;
CPP_DBG("E\n");
if (!sd || !fh) {
pr_err("Wrong input parameters sd %pK fh %pK!",
sd, fh);
return -EINVAL;
}
cpp_dev = v4l2_get_subdevdata(sd);
if (!cpp_dev) {
pr_err("failed: cpp_dev %pK\n", cpp_dev);
return -EINVAL;
}
mutex_lock(&cpp_dev->mutex);
if (cpp_dev->cpp_open_cnt == <API key>) {
pr_err("No free CPP instance\n");
mutex_unlock(&cpp_dev->mutex);
return -ENODEV;
}
for (i = 0; i < <API key>; i++) {
if (cpp_dev->cpp_subscribe_list[i].active == 0) {
cpp_dev->cpp_subscribe_list[i].active = 1;
cpp_dev->cpp_subscribe_list[i].vfh = &fh->vfh;
break;
}
}
if (i == <API key>) {
pr_err("No free instance\n");
mutex_unlock(&cpp_dev->mutex);
return -ENODEV;
}
CPP_DBG("open %d %pK\n", i, &fh->vfh);
cpp_dev->cpp_open_cnt++;
if (cpp_dev->cpp_open_cnt == 1) {
rc = cpp_init_hardware(cpp_dev);
if (rc < 0) {
cpp_dev->cpp_open_cnt
cpp_dev->cpp_subscribe_list[i].active = 0;
cpp_dev->cpp_subscribe_list[i].vfh = NULL;
mutex_unlock(&cpp_dev->mutex);
return rc;
}
rc = cpp_init_mem(cpp_dev);
if (rc < 0) {
pr_err("Error: init memory fail\n");
cpp_dev->cpp_open_cnt
cpp_dev->cpp_subscribe_list[i].active = 0;
cpp_dev->cpp_subscribe_list[i].vfh = NULL;
mutex_unlock(&cpp_dev->mutex);
return rc;
}
cpp_dev->state = CPP_STATE_IDLE;
}
<API key>(cpp_dev,
VBIF_CLIENT_CPP, <API key>);
mutex_unlock(&cpp_dev->mutex);
return 0;
}
static int cpp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
uint32_t i;
int rc = -1;
struct cpp_device *cpp_dev = NULL;
struct msm_device_queue *processing_q = NULL;
struct msm_device_queue *eventData_q = NULL;
if (!sd) {
pr_err("Wrong input sd parameter");
return -EINVAL;
}
cpp_dev = v4l2_get_subdevdata(sd);
if (!cpp_dev) {
pr_err("failed: cpp_dev %pK\n", cpp_dev);
return -EINVAL;
}
mutex_lock(&cpp_dev->mutex);
processing_q = &cpp_dev->processing_q;
eventData_q = &cpp_dev->eventData_q;
if (cpp_dev->cpp_open_cnt == 0) {
mutex_unlock(&cpp_dev->mutex);
return 0;
}
for (i = 0; i < <API key>; i++) {
if (cpp_dev->cpp_subscribe_list[i].active == 1) {
cpp_dev->cpp_subscribe_list[i].active = 0;
cpp_dev->cpp_subscribe_list[i].vfh = NULL;
break;
}
}
if (i == <API key>) {
pr_err("Invalid close\n");
mutex_unlock(&cpp_dev->mutex);
return -ENODEV;
}
cpp_dev->cpp_open_cnt
if (cpp_dev->cpp_open_cnt == 0) {
pr_debug("irq_status: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x4));
pr_debug("DEBUG_SP: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x40));
pr_debug("DEBUG_T: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x44));
pr_debug("DEBUG_N: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x48));
pr_debug("DEBUG_R: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x4C));
pr_debug("DEBUG_OPPC: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x50));
pr_debug("DEBUG_MO: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x54));
pr_debug("DEBUG_TIMER0: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x60));
pr_debug("DEBUG_TIMER1: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x64));
pr_debug("DEBUG_GPI: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x70));
pr_debug("DEBUG_GPO: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x74));
pr_debug("DEBUG_T0: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x80));
pr_debug("DEBUG_R0: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x84));
pr_debug("DEBUG_T1: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x88));
pr_debug("DEBUG_R1: 0x%x\n",
msm_camera_io_r(cpp_dev->cpp_hw_base + 0x8C));
msm_camera_io_w(0x0, cpp_dev->base + <API key>);
msm_cpp_clear_timer(cpp_dev);
<API key>(cpp_dev);
if (cpp_dev->iommu_state == <API key>) {
cpp_dev->iommu_state = <API key>;
rc = cam_smmu_ops(cpp_dev->iommu_hdl, CAM_SMMU_DETACH);
if (rc < 0)
pr_err("Error: Detach fail in release\n");
}
<API key>(cpp_dev->iommu_hdl);
msm_cpp_empty_list(processing_q, list_frame);
msm_cpp_empty_list(eventData_q, list_eventdata);
cpp_dev->state = CPP_STATE_OFF;
}
/* unregister vbif error handler */
<API key>(cpp_dev,
VBIF_CLIENT_CPP, NULL);
mutex_unlock(&cpp_dev->mutex);
return 0;
}
static const struct <API key> <API key> = {
.open = cpp_open_node,
.close = cpp_close_node,
};
static int msm_cpp_buffer_ops(struct cpp_device *cpp_dev,
uint32_t buff_mgr_ops, uint32_t ids,
void *arg)
{
int rc = -EINVAL;
switch (buff_mgr_ops) {
case <API key>: {
rc = <API key>(cpp_dev, buff_mgr_ops,
ids, arg);
break;
}
case <API key>:
case <API key>:
case <API key>:
default: {
struct msm_buf_mngr_info *buff_mgr_info =
(struct msm_buf_mngr_info *)arg;
rc = cpp_dev->buf_mgr_ops.msm_cam_buf_mgr_ops(buff_mgr_ops,
buff_mgr_info);
break;
}
}
if (rc < 0)
pr_debug("%s: line %d rc = %d\n", __func__, __LINE__, rc);
return rc;
}
static int <API key>(struct cpp_device *cpp_dev,
uint8_t put_buf)
{
struct v4l2_event v4l2_evt;
struct msm_queue_cmd *frame_qcmd = NULL;
struct msm_queue_cmd *event_qcmd = NULL;
struct <API key> *processed_frame = NULL;
struct msm_device_queue *queue = &cpp_dev->processing_q;
struct msm_buf_mngr_info buff_mgr_info;
int rc = 0;
frame_qcmd = msm_dequeue(queue, list_frame, POP_FRONT);
if (frame_qcmd) {
processed_frame = frame_qcmd->command;
do_gettimeofday(&(processed_frame->out_time));
kfree(frame_qcmd);
event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_ATOMIC);
if (!event_qcmd) {
pr_err("Insufficient memory\n");
return -ENOMEM;
}
atomic_set(&event_qcmd->on_heap, 1);
event_qcmd->command = processed_frame;
CPP_DBG("fid %d\n", processed_frame->frame_id);
msm_enqueue(&cpp_dev->eventData_q, &event_qcmd->list_eventdata);
if ((processed_frame-><API key> != 0) &&
(processed_frame->last_payload == 0))
goto NOTIFY_FRAME_DONE;
if (!processed_frame->output_buffer_info[0].processed_divert &&
!processed_frame->output_buffer_info[0].native_buff &&
!processed_frame->we_disable) {
int32_t iden = processed_frame->identity;
<API key>(processed_frame,
iden, processed_frame->duplicate_identity);
memset(&buff_mgr_info, 0 ,
sizeof(struct msm_buf_mngr_info));
buff_mgr_info.session_id = ((iden >> 16) & 0xFFFF);
buff_mgr_info.stream_id = (iden & 0xFFFF);
buff_mgr_info.frame_id = processed_frame->frame_id;
buff_mgr_info.timestamp = processed_frame->timestamp;
if (processed_frame->batch_info.batch_mode ==
BATCH_MODE_VIDEO ||
(<API key>(
processed_frame))) {
buff_mgr_info.index =
processed_frame->batch_info.cont_idx;
} else {
buff_mgr_info.index = processed_frame->
output_buffer_info[0].index;
}
if (put_buf) {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &buff_mgr_info);
if (rc < 0) {
pr_err("error putting buffer\n");
rc = -EINVAL;
}
} else {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &buff_mgr_info);
if (rc < 0) {
pr_err("error putting buffer\n");
rc = -EINVAL;
}
}
}
if (processed_frame->duplicate_output &&
!processed_frame->
<API key>.processed_divert &&
!processed_frame->we_disable) {
int32_t iden = processed_frame->duplicate_identity;
<API key>(processed_frame,
iden, processed_frame->identity);
memset(&buff_mgr_info, 0 ,
sizeof(struct msm_buf_mngr_info));
buff_mgr_info.session_id = ((iden >> 16) & 0xFFFF);
buff_mgr_info.stream_id = (iden & 0xFFFF);
buff_mgr_info.frame_id = processed_frame->frame_id;
buff_mgr_info.timestamp = processed_frame->timestamp;
buff_mgr_info.index =
processed_frame-><API key>.index;
if (put_buf) {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &buff_mgr_info);
if (rc < 0) {
pr_err("error putting buffer\n");
rc = -EINVAL;
}
} else {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &buff_mgr_info);
if (rc < 0) {
pr_err("error putting buffer\n");
rc = -EINVAL;
}
}
}
NOTIFY_FRAME_DONE:
v4l2_evt.id = processed_frame->inst_id;
v4l2_evt.type = <API key>;
v4l2_event_queue(cpp_dev->msm_sd.sd.devnode, &v4l2_evt);
}
return rc;
}
#if <API key>
static int <API key>(struct <API key> *frame_info)
{
int i, i1, i2;
struct cpp_device *cpp_dev = cpp_timer.data.cpp_dev;
CPP_DBG("-- start: cpp frame cmd for identity=0x%x, frame_id=%d --\n",
frame_info->identity, frame_info->frame_id);
CPP_DBG("msg[%03d] = 0x%08x\n", 0, 0x6);
/* send top level and plane level */
for (i = 0; i < cpp_dev->payload_params.stripe_base; i++)
CPP_DBG("msg[%03d] = 0x%08x\n", i,
frame_info->cpp_cmd_msg[i]);
/* send stripes */
i1 = cpp_dev->payload_params.stripe_base +
cpp_dev->payload_params.stripe_size *
frame_info->first_stripe_index;
i2 = cpp_dev->payload_params.stripe_size *
(frame_info->last_stripe_index -
frame_info->first_stripe_index + 1);
for (i = 0; i < i2; i++)
CPP_DBG("msg[%03d] = 0x%08x\n", i+i1,
frame_info->cpp_cmd_msg[i+i1]);
/* send trailer */
CPP_DBG("msg[%03d] = 0x%08x\n", i+i1, <API key>);
CPP_DBG("-- end: cpp frame cmd for identity=0x%x, frame_id=%d --\n",
frame_info->identity, frame_info->frame_id);
return 0;
}
#else
static int <API key>(struct <API key> *frame_info)
{
return 0;
}
#endif
static void <API key>(struct cpp_device *cpp_dev,
int queue_len) {
uint32_t i;
while (queue_len) {
<API key>(cpp_dev, 1);
queue_len
}
atomic_set(&cpp_timer.used, 0);
for (i = 0; i < <API key>; i++)
cpp_timer.data.processed_frame[i] = NULL;
}
static void <API key>(struct cpp_device *cpp_dev,
uint8_t enable, uint32_t irq_mask)
{
msm_camera_io_w_mb(irq_mask, cpp_dev->base +
<API key>);
msm_camera_io_w_mb(0xFFFF, cpp_dev->base +
<API key>);
if (enable)
enable_irq(cpp_dev->irq->start);
}
static void <API key>(struct work_struct *work)
{
uint32_t j = 0, i = 0, i1 = 0, i2 = 0;
int32_t queue_len = 0, rc = 0, fifo_counter = 0;
struct msm_device_queue *queue = NULL;
struct <API key> *processed_frame[<API key>];
struct cpp_device *cpp_dev = cpp_timer.data.cpp_dev;
pr_warn("cpp_timer_callback called. (jiffies=%lu)\n",
jiffies);
mutex_lock(&cpp_dev->mutex);
if (!work || (cpp_timer.data.cpp_dev->state != CPP_STATE_ACTIVE)) {
pr_err("Invalid work:%pK or state:%d\n", work,
cpp_timer.data.cpp_dev->state);
/* Do not flush queue here as it is not a fatal error */
goto end;
}
if (!atomic_read(&cpp_timer.used)) {
pr_warn("Delayed trigger, IRQ serviced\n");
/* Do not flush queue here as it is not a fatal error */
goto end;
}
<API key>(cpp_timer.data.cpp_dev->irq, false);
/* make sure all the pending queued entries are scheduled */
tasklet_kill(&cpp_dev->cpp_tasklet);
queue = &cpp_timer.data.cpp_dev->processing_q;
queue_len = queue->len;
if (!queue_len) {
pr_err("%s:%d: irq serviced after timeout.Ignore timeout\n",
__func__, __LINE__);
<API key>(cpp_dev, 1, 0x8);
goto end;
}
pr_err("%s: handle vbif hang...\n", __func__);
for (i = 0; i < VBIF_CLIENT_MAX; i++) {
if (cpp_dev->vbif_data->err_handler[i] == NULL)
continue;
cpp_dev->vbif_data->err_handler[i](
cpp_dev->vbif_data->dev[i], CPP_VBIF_ERROR_HANG);
}
pr_debug("Reloading firmware %d\n", queue_len);
rc = cpp_load_fw(cpp_timer.data.cpp_dev,
cpp_timer.data.cpp_dev->fw_name_bin);
if (rc) {
pr_warn("Firmware loading failed\n");
goto error;
} else {
pr_debug("Firmware loading done\n");
}
if (!atomic_read(&cpp_timer.used)) {
pr_warn("Delayed trigger, IRQ serviced\n");
/* Do not flush queue here as it is not a fatal error */
<API key>(cpp_dev, 1, 0x8);
cpp_dev->timeout_trial_cnt = 0;
goto end;
}
if (cpp_dev->timeout_trial_cnt >=
cpp_dev-><API key>) {
pr_warn("Max trial reached\n");
<API key>(cpp_dev, queue_len);
<API key>(cpp_dev, 1, 0x8);
goto end;
}
atomic_set(&cpp_timer.used, 1);
pr_warn("Starting timer to fire in %d ms. (jiffies=%lu)\n",
CPP_CMD_TIMEOUT_MS, jiffies);
mod_timer(&cpp_timer.cpp_timer,
jiffies + msecs_to_jiffies(CPP_CMD_TIMEOUT_MS));
<API key>(cpp_dev, 1, 0x8);
for (i = 0; i < <API key>; i++)
processed_frame[i] = cpp_timer.data.processed_frame[i];
for (i = 0; i < queue_len; i++) {
pr_warn("Rescheduling for identity=0x%x, frame_id=%03d\n",
processed_frame[i]->identity,
processed_frame[i]->frame_id);
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d: Reschedule payload failed %d\n",
__func__, __LINE__, rc);
goto error;
}
msm_cpp_write(0x6, cpp_dev->base);
fifo_counter++;
/* send top level and plane level */
for (j = 0; j < cpp_dev->payload_params.stripe_base; j++,
fifo_counter++) {
if (fifo_counter % <API key> == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll failed %d rc %d",
__func__, __LINE__, j, rc);
goto error;
}
fifo_counter = 0;
}
msm_cpp_write(processed_frame[i]->cpp_cmd_msg[j],
cpp_dev->base);
}
if (rc) {
pr_err("%s:%d: Rescheduling plane info failed %d\n",
__func__, __LINE__, rc);
goto error;
}
/* send stripes */
i1 = cpp_dev->payload_params.stripe_base +
cpp_dev->payload_params.stripe_size *
processed_frame[i]->first_stripe_index;
i2 = cpp_dev->payload_params.stripe_size *
(processed_frame[i]->last_stripe_index -
processed_frame[i]->first_stripe_index + 1);
for (j = 0; j < i2; j++, fifo_counter++) {
if (fifo_counter % <API key> == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll failed %d rc %d",
__func__, __LINE__, j, rc);
break;
}
fifo_counter = 0;
}
msm_cpp_write(processed_frame[i]->cpp_cmd_msg[j+i1],
cpp_dev->base);
}
if (rc) {
pr_err("%s:%d] Rescheduling stripe info failed %d\n",
__func__, __LINE__, rc);
goto error;
}
/* send trailer */
if (fifo_counter % <API key> == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] Reschedule trailer failed %d\n",
__func__, __LINE__, rc);
goto error;
}
fifo_counter = 0;
}
msm_cpp_write(0xabcdefaa, cpp_dev->base);
pr_debug("After frame:%d write\n", i+1);
}
cpp_timer.data.cpp_dev->timeout_trial_cnt++;
end:
mutex_unlock(&cpp_dev->mutex);
pr_debug("%s:%d] exit\n", __func__, __LINE__);
return;
error:
cpp_dev->state = CPP_STATE_OFF;
/* flush the queue */
<API key>(cpp_dev,
queue_len);
<API key>(cpp_dev, 0, 0x0);
cpp_dev->timeout_trial_cnt = 0;
mutex_unlock(&cpp_dev->mutex);
pr_debug("%s:%d] exit\n", __func__, __LINE__);
return;
}
void cpp_timer_callback(unsigned long data)
{
struct msm_cpp_work_t *work =
cpp_timer.data.cpp_dev->work;
queue_work(cpp_timer.data.cpp_dev->timer_wq,
(struct work_struct *)work);
}
static int <API key>(struct cpp_device *cpp_dev,
struct msm_queue_cmd *frame_qcmd)
{
unsigned long flags;
uint32_t i, i1, i2;
int32_t rc = -EAGAIN;
struct <API key> *process_frame;
struct msm_queue_cmd *qcmd = NULL;
uint32_t queue_len = 0, fifo_counter = 0;
if (cpp_dev->processing_q.len < <API key>) {
process_frame = frame_qcmd->command;
<API key>(process_frame);
spin_lock_irqsave(&cpp_timer.data.<API key>, flags);
msm_enqueue(&cpp_dev->processing_q,
&frame_qcmd->list_frame);
cpp_timer.data.processed_frame[cpp_dev->processing_q.len - 1] =
process_frame;
queue_len = cpp_dev->processing_q.len;
<API key>(&cpp_timer.data.<API key>,
flags);
atomic_set(&cpp_timer.used, 1);
CPP_DBG("Starting timer to fire in %d ms. (jiffies=%lu)\n",
CPP_CMD_TIMEOUT_MS, jiffies);
if (mod_timer(&cpp_timer.cpp_timer,
(jiffies + msecs_to_jiffies(CPP_CMD_TIMEOUT_MS))) != 0)
CPP_DBG("Timer has not expired yet\n");
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d: Scheduling payload failed %d",
__func__, __LINE__, rc);
goto dequeue_frame;
}
msm_cpp_write(0x6, cpp_dev->base);
fifo_counter++;
/* send top level and plane level */
for (i = 0; i < cpp_dev->payload_params.stripe_base; i++,
fifo_counter++) {
if ((fifo_counter % <API key>) == 0) {
rc = <API key>(cpp_dev->base);
if (rc)
break;
fifo_counter = 0;
}
msm_cpp_write(process_frame->cpp_cmd_msg[i],
cpp_dev->base);
}
if (rc) {
pr_err("%s:%d: Scheduling plane info failed %d\n",
__func__, __LINE__, rc);
goto dequeue_frame;
}
/* send stripes */
i1 = cpp_dev->payload_params.stripe_base +
cpp_dev->payload_params.stripe_size *
process_frame->first_stripe_index;
i2 = cpp_dev->payload_params.stripe_size *
(process_frame->last_stripe_index -
process_frame->first_stripe_index + 1);
for (i = 0; i < i2; i++, fifo_counter++) {
if ((fifo_counter % <API key>) == 0) {
rc = <API key>(cpp_dev->base);
if (rc)
break;
fifo_counter = 0;
}
msm_cpp_write(process_frame->cpp_cmd_msg[i+i1],
cpp_dev->base);
}
if (rc) {
pr_err("%s:%d: Scheduling stripe info failed %d\n",
__func__, __LINE__, rc);
goto dequeue_frame;
}
/* send trailer */
if ((fifo_counter % <API key>) == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s: Scheduling trailer failed %d\n",
__func__, rc);
goto dequeue_frame;
}
fifo_counter = 0;
}
msm_cpp_write(<API key>, cpp_dev->base);
do_gettimeofday(&(process_frame->in_time));
rc = 0;
} else {
pr_err("process queue full. drop frame\n");
goto end;
}
dequeue_frame:
if (rc < 0) {
qcmd = msm_dequeue(&cpp_dev->processing_q, list_frame,
POP_BACK);
if (!qcmd)
pr_warn("%s:%d: no queue cmd\n", __func__, __LINE__);
spin_lock_irqsave(&cpp_timer.data.<API key>,
flags);
queue_len = cpp_dev->processing_q.len;
<API key>(
&cpp_timer.data.<API key>, flags);
if (queue_len == 0) {
atomic_set(&cpp_timer.used, 0);
del_timer(&cpp_timer.cpp_timer);
}
}
end:
return rc;
}
static int <API key>(struct cpp_device *cpp_dev,
uint32_t *cmd_msg, uint32_t payload_size)
{
uint32_t i;
int rc = 0;
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
for (i = 0; i < payload_size; i++) {
msm_cpp_write(cmd_msg[i], cpp_dev->base);
if (i % <API key> == 0) {
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
}
}
end:
return rc;
}
static int <API key>(struct cpp_device *cpp_dev)
{
return 0;
}
static struct <API key> *msm_cpp_get_frame(
struct <API key> *ioctl_ptr)
{
uint32_t *cpp_frame_msg;
struct <API key> *new_frame = NULL;
int32_t rc = 0;
new_frame = kzalloc(sizeof(struct <API key>), GFP_KERNEL);
if (!new_frame) {
pr_err("Insufficient memory\n");
rc = -ENOMEM;
goto no_mem_err;
}
rc = (copy_from_user(new_frame, (void __user *)ioctl_ptr->ioctl_ptr,
sizeof(struct <API key>)) ? -EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
goto frame_err;
}
if ((new_frame->msg_len == 0) ||
(new_frame->msg_len > <API key>)) {
pr_err("%s:%d: Invalid frame len:%d\n", __func__,
__LINE__, new_frame->msg_len);
goto frame_err;
}
cpp_frame_msg = kzalloc(sizeof(uint32_t) * new_frame->msg_len,
GFP_KERNEL);
if (!cpp_frame_msg) {
pr_err("Insufficient memory\n");
goto frame_err;
}
rc = (copy_from_user(cpp_frame_msg,
(void __user *)new_frame->cpp_cmd_msg,
sizeof(uint32_t) * new_frame->msg_len) ? -EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
goto frame_msg_err;
}
new_frame->cpp_cmd_msg = cpp_frame_msg;
return new_frame;
frame_msg_err:
kfree(cpp_frame_msg);
frame_err:
kfree(new_frame);
no_mem_err:
return NULL;
}
static int <API key>(struct msm_buf_mngr_info *buff_mgr_info,
struct <API key> *new_frame)
{
int32_t num_output_bufs = 0;
uint32_t i = 0;
if (buff_mgr_info->type == <API key>) {
new_frame->batch_info.cont_idx =
buff_mgr_info->index;
num_output_bufs = buff_mgr_info->user_buf.buf_cnt;
if (buff_mgr_info->user_buf.buf_cnt <
new_frame->batch_info.batch_size) {
/* Less bufs than Input buffer */
num_output_bufs = buff_mgr_info->user_buf.buf_cnt;
} else {
/* More or equal bufs as Input buffer */
num_output_bufs = new_frame->batch_info.batch_size;
}
for (i = 0; i < num_output_bufs; i++) {
new_frame->output_buffer_info[i].index =
buff_mgr_info->user_buf.buf_idx[i];
}
} else {
/* For non-group case use first buf slot */
new_frame->output_buffer_info[0].index = buff_mgr_info->index;
num_output_bufs = 1;
}
return num_output_bufs;
}
static void <API key>(struct cpp_device *cpp_dev,
struct <API key> *new_frame, unsigned long in_phyaddr,
unsigned long out_phyaddr0, unsigned long out_phyaddr1,
unsigned long tnr_scratch_buffer0, unsigned long tnr_scratch_buffer1)
{
int32_t stripe_base, plane_base;
uint32_t rd_pntr_off, wr_0_pntr_off, wr_1_pntr_off,
wr_2_pntr_off, wr_3_pntr_off;
uint32_t <API key>, <API key>,
<API key>, <API key>;
uint32_t rd_ref_pntr_off, wr_ref_pntr_off;
uint32_t stripe_size, plane_size;
uint32_t fe_mmu_pf_ptr_off, <API key>, we_mmu_pf_ptr_off,
<API key>, <API key>;
uint8_t tnr_enabled, ubwc_enabled, mmu_pf_en, cds_en;
int32_t i = 0;
uint32_t *cpp_frame_msg;
cpp_frame_msg = new_frame->cpp_cmd_msg;
/* Update stripe/plane size and base offsets */
stripe_base = cpp_dev->payload_params.stripe_base;
stripe_size = cpp_dev->payload_params.stripe_size;
plane_base = cpp_dev->payload_params.plane_base;
plane_size = cpp_dev->payload_params.plane_size;
/* Fetch engine Offset */
rd_pntr_off = cpp_dev->payload_params.rd_pntr_off;
/* Write engine offsets */
wr_0_pntr_off = cpp_dev->payload_params.wr_0_pntr_off;
wr_1_pntr_off = wr_0_pntr_off + 1;
wr_2_pntr_off = wr_1_pntr_off + 1;
wr_3_pntr_off = wr_2_pntr_off + 1;
/* Reference engine offsets */
rd_ref_pntr_off = cpp_dev->payload_params.rd_ref_pntr_off;
wr_ref_pntr_off = cpp_dev->payload_params.wr_ref_pntr_off;
/* Meta data offsets */
<API key> =
cpp_dev->payload_params.<API key>;
<API key> = (<API key> + 1);
<API key> = (<API key> + 1);
<API key> = (<API key> + 1);
/* MMU PF offsets */
fe_mmu_pf_ptr_off = cpp_dev->payload_params.fe_mmu_pf_ptr_off;
<API key> = cpp_dev->payload_params.<API key>;
we_mmu_pf_ptr_off = cpp_dev->payload_params.we_mmu_pf_ptr_off;
<API key> = cpp_dev->payload_params.<API key>;
<API key> = cpp_dev->payload_params.<API key>;
pr_debug("%s: feature_mask 0x%x\n", __func__, new_frame->feature_mask);
/* Update individual module status from feature mask */
tnr_enabled = ((new_frame->feature_mask & TNR_MASK) >> 2);
ubwc_enabled = ((new_frame->feature_mask & UBWC_MASK) >> 5);
cds_en = ((new_frame->feature_mask & CDS_MASK) >> 6);
mmu_pf_en = ((new_frame->feature_mask & MMU_PF_MASK) >> 7);
/*
* Update the stripe based addresses for fetch/write/reference engines.
* Update meta data offset for ubwc.
* Update ref engine address for cds / tnr.
*/
for (i = 0; i < new_frame->num_strips; i++) {
cpp_frame_msg[stripe_base + rd_pntr_off + i * stripe_size] +=
(uint32_t) in_phyaddr;
cpp_frame_msg[stripe_base + wr_0_pntr_off + i * stripe_size] +=
(uint32_t) out_phyaddr0;
cpp_frame_msg[stripe_base + wr_1_pntr_off + i * stripe_size] +=
(uint32_t) out_phyaddr1;
cpp_frame_msg[stripe_base + wr_2_pntr_off + i * stripe_size] +=
(uint32_t) out_phyaddr0;
cpp_frame_msg[stripe_base + wr_3_pntr_off + i * stripe_size] +=
(uint32_t) out_phyaddr1;
if (tnr_enabled) {
cpp_frame_msg[stripe_base + rd_ref_pntr_off +
i * stripe_size] +=
(uint32_t)tnr_scratch_buffer0;
cpp_frame_msg[stripe_base + wr_ref_pntr_off +
i * stripe_size] +=
(uint32_t)tnr_scratch_buffer1;
} else if (cds_en) {
cpp_frame_msg[stripe_base + rd_ref_pntr_off +
i * stripe_size] +=
(uint32_t)in_phyaddr;
}
if (ubwc_enabled) {
cpp_frame_msg[stripe_base + <API key> +
i * stripe_size] += (uint32_t) out_phyaddr0;
cpp_frame_msg[stripe_base + <API key> +
i * stripe_size] += (uint32_t) out_phyaddr1;
cpp_frame_msg[stripe_base + <API key> +
i * stripe_size] += (uint32_t) out_phyaddr0;
cpp_frame_msg[stripe_base + <API key> +
i * stripe_size] += (uint32_t) out_phyaddr1;
}
}
if (!mmu_pf_en)
goto exit;
/* Update mmu prefetch related plane specific address */
for (i = 0; i < PAYLOAD_NUM_PLANES; i++) {
cpp_frame_msg[plane_base + fe_mmu_pf_ptr_off +
i * plane_size] += (uint32_t)in_phyaddr;
cpp_frame_msg[plane_base + fe_mmu_pf_ptr_off +
i * plane_size + 1] += (uint32_t)in_phyaddr;
cpp_frame_msg[plane_base + <API key> +
i * plane_size] += (uint32_t)tnr_scratch_buffer0;
cpp_frame_msg[plane_base + <API key> +
i * plane_size + 1] += (uint32_t)tnr_scratch_buffer0;
cpp_frame_msg[plane_base + we_mmu_pf_ptr_off +
i * plane_size] += (uint32_t)out_phyaddr0;
cpp_frame_msg[plane_base + we_mmu_pf_ptr_off +
i * plane_size + 1] += (uint32_t)out_phyaddr0;
cpp_frame_msg[plane_base + <API key> +
i * plane_size] += (uint32_t)out_phyaddr1;
cpp_frame_msg[plane_base + <API key> +
i * plane_size + 1] += (uint32_t)out_phyaddr1;
cpp_frame_msg[plane_base + <API key> +
i * plane_size] += (uint32_t)tnr_scratch_buffer1;
cpp_frame_msg[plane_base + <API key> +
i * plane_size + 1] += (uint32_t)tnr_scratch_buffer1;
}
exit:
return;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
struct <API key> *new_frame, unsigned long out_phyaddr,
uint32_t num_output_bufs)
{
uint32_t *<API key> = NULL;
uint32_t *ptr;
unsigned long out_phyaddr0, out_phyaddr1, distance;
int32_t rc = 0;
uint32_t <API key>, <API key>,
dup_frame_off, ubwc_enabled, j, i = 0;
do {
int iden = new_frame->identity;
<API key> =
cpp_dev->payload_params.<API key>;
if (!<API key>) {
pr_err("%s: invalid set group buffer cmd len %d\n",
__func__, <API key>);
rc = -EINVAL;
break;
}
/*
* Length of <API key> command +
* 4 byte for header + 4 byte for the length field +
* 4 byte for the trailer + 4 byte for
* <API key> prefix before the payload
*/
<API key> += 4;
<API key> = <API key> *
sizeof(uint32_t);
<API key> =
kzalloc(<API key>, GFP_KERNEL);
if (!<API key>) {
pr_err("%s: set group buffer data alloc failed\n",
__func__);
rc = -ENOMEM;
break;
}
memset(<API key>, 0x0,
<API key>);
dup_frame_off =
cpp_dev->payload_params.<API key>;
/* Add a factor of 1 as command is prefixed to the payload. */
dup_frame_off += 1;
ubwc_enabled = ((new_frame->feature_mask & UBWC_MASK) >> 5);
ptr = <API key>;
/*create and send Set Group Buffer with Duplicate command*/
*ptr++ = <API key>;
*ptr++ = MSM_CPP_MSG_ID_CMD;
/*
* This field is the value read from dt and stands for length of
* actual data in payload
*/
*ptr++ = cpp_dev->payload_params.<API key>;
*ptr++ = <API key>;
*ptr++ = 0;
out_phyaddr0 = out_phyaddr;
<API key>(new_frame,
iden, new_frame->duplicate_identity);
for (i = 1; i < num_output_bufs; i++) {
out_phyaddr1 = <API key>(cpp_dev,
&new_frame->output_buffer_info[i],
((iden >> 16) & 0xFFFF),
(iden & 0xFFFF),
&new_frame->output_buffer_info[i].fd);
if (!out_phyaddr1) {
pr_err("%s: error getting o/p phy addr\n",
__func__);
rc = -EINVAL;
break;
}
distance = out_phyaddr1 - out_phyaddr0;
out_phyaddr0 = out_phyaddr1;
for (j = 0; j < PAYLOAD_NUM_PLANES; j++)
*ptr++ = distance;
for (j = 0; j < PAYLOAD_NUM_PLANES; j++)
*ptr++ = ubwc_enabled ? distance : 0;
}
if (rc)
break;
if (new_frame->duplicate_output)
<API key>[dup_frame_off] =
1 << new_frame->batch_info.pick_preview_idx;
else
<API key>[dup_frame_off] = 0;
/*
* Index for cpp message id trailer is length of payload for
* set group buffer minus 1
*/
<API key>[<API key> - 1] =
<API key>;
rc = <API key>(cpp_dev,
<API key>, <API key>);
if (rc < 0) {
pr_err("%s: Send Command Error rc %d\n", __func__, rc);
break;
}
} while (0);
kfree(<API key>);
return rc;
}
static int32_t <API key>(struct cpp_device *cpp_dev,
struct <API key> *new_frame, unsigned long out_phyaddr,
uint32_t num_output_bufs)
{
uint32_t <API key>;
uint32_t *set_group_buffer = NULL;
uint32_t *ptr;
unsigned long out_phyaddr0, out_phyaddr1, distance;
int32_t rc = 0;
uint32_t <API key>, i = 0;
bool batching_valid = false;
if ((<API key>(new_frame)) ||
new_frame->batch_info.batch_mode == BATCH_MODE_VIDEO)
batching_valid = true;
if (!batching_valid) {
pr_debug("%s: batch mode %d, batching valid %d\n",
__func__, new_frame->batch_info.batch_mode,
batching_valid);
return rc;
}
if (new_frame->batch_info.batch_size <= 1) {
pr_debug("%s: batch size is invalid %d\n", __func__,
new_frame->batch_info.batch_size);
return rc;
}
if ((new_frame->feature_mask & BATCH_DUP_MASK) >> 8) {
return <API key>(cpp_dev, new_frame,
out_phyaddr, num_output_bufs);
}
if (new_frame->duplicate_output) {
pr_err("cannot support duplication enable\n");
rc = -EINVAL;
goto exit;
}
<API key> =
2 + 3 * (num_output_bufs - 1);
/*
* Length of <API key> command +
* 4 byte for header + 4 byte for the length field +
* 4 byte for the trailer + 4 byte for
* <API key> prefix before the payload
*/
<API key> += 4;
<API key> = <API key> *
sizeof(uint32_t);
set_group_buffer =
kzalloc(<API key>, GFP_KERNEL);
if (!set_group_buffer) {
pr_err("%s: set group buffer data alloc failed\n",
__func__);
rc = -ENOMEM;
goto exit;
}
memset(set_group_buffer, 0x0,
<API key>);
ptr = set_group_buffer;
/*Create and send Set Group Buffer*/
*ptr++ = <API key>;
*ptr++ = MSM_CPP_MSG_ID_CMD;
/*
* This field is the value read from dt and stands
* for length of actual data in payload
*/
*ptr++ = <API key> - 4;
*ptr++ = <API key>;
*ptr++ = 0;
out_phyaddr0 = out_phyaddr;
for (i = 1; i < num_output_bufs; i++) {
out_phyaddr1 =
<API key>(cpp_dev,
&new_frame->output_buffer_info[i],
((new_frame->identity >> 16) & 0xFFFF),
(new_frame->identity & 0xFFFF),
&new_frame->output_buffer_info[i].fd);
if (!out_phyaddr1) {
pr_err("%s: error getting o/p phy addr\n",
__func__);
rc = -EINVAL;
goto free_and_exit;
}
distance = out_phyaddr1 - out_phyaddr0;
out_phyaddr0 = out_phyaddr1;
*ptr++ = distance;
*ptr++ = distance;
*ptr++ = distance;
}
if (rc)
goto free_and_exit;
/*
* Index for cpp message id trailer is length of
* payload for set group buffer minus 1
*/
set_group_buffer[<API key> - 1] =
<API key>;
rc = <API key>(cpp_dev,
set_group_buffer, <API key>);
if (rc < 0)
pr_err("Send Command Error rc %d\n", rc);
free_and_exit:
kfree(set_group_buffer);
exit:
return rc;
}
static int msm_cpp_cfg_frame(struct cpp_device *cpp_dev,
struct <API key> *new_frame)
{
int32_t rc = 0;
struct msm_queue_cmd *frame_qcmd = NULL;
uint32_t *cpp_frame_msg;
unsigned long in_phyaddr, out_phyaddr0 = (unsigned long)NULL;
unsigned long out_phyaddr1;
unsigned long tnr_scratch_buffer0, tnr_scratch_buffer1;
uint16_t num_stripes = 0;
struct msm_buf_mngr_info buff_mgr_info, dup_buff_mgr_info;
int32_t in_fd;
int32_t num_output_bufs = 1;
int32_t stripe_base = 0;
uint32_t stripe_size;
uint8_t tnr_enabled;
enum <API key> buf_type =
<API key>;
uint32_t ioctl_cmd, idx;
uint32_t op_index, dup_index;
stripe_base = cpp_dev->payload_params.stripe_base;
stripe_size = cpp_dev->payload_params.stripe_size;
if (!new_frame) {
pr_err("%s: Frame is Null\n", __func__);
return -EINVAL;
}
if (cpp_dev->state == CPP_STATE_OFF) {
pr_err("%s: cpp state is off, return fatal error\n", __func__);
return -EINVAL;
}
cpp_frame_msg = new_frame->cpp_cmd_msg;
if (cpp_frame_msg == NULL ||
(new_frame->msg_len < <API key>)) {
pr_err("Length is not correct or frame message is missing\n");
return -EINVAL;
}
if (!new_frame-><API key>) {
if (cpp_frame_msg[new_frame->msg_len - 1] !=
<API key>) {
pr_err("Invalid frame message\n");
return -EINVAL;
}
if ((stripe_base + new_frame->num_strips * stripe_size + 1) !=
new_frame->msg_len) {
pr_err("Invalid frame message,len=%d,expected=%d\n",
new_frame->msg_len,
(stripe_base +
new_frame->num_strips * stripe_size + 1));
return -EINVAL;
}
}
if (cpp_dev->iommu_state != <API key>) {
pr_err("IOMMU is not attached\n");
return -EAGAIN;
}
in_phyaddr = <API key>(cpp_dev,
&new_frame->input_buffer_info,
((new_frame->input_buffer_info.identity >> 16) & 0xFFFF),
(new_frame->input_buffer_info.identity & 0xFFFF), &in_fd);
if (!in_phyaddr) {
pr_err("%s: error gettting input physical address\n", __func__);
rc = -EINVAL;
goto frame_msg_err;
}
op_index = new_frame->output_buffer_info[0].index;
dup_index = new_frame-><API key>.index;
if (new_frame->we_disable == 0) {
int32_t iden = new_frame->identity;
if ((new_frame->output_buffer_info[0].native_buff == 0) &&
(new_frame->first_payload)) {
memset(&buff_mgr_info, 0,
sizeof(struct msm_buf_mngr_info));
if ((new_frame->batch_info.batch_mode ==
BATCH_MODE_VIDEO) ||
(<API key>(new_frame)))
buf_type = <API key>;
<API key>(new_frame,
iden, new_frame->duplicate_identity);
/*
* Swap the input buffer index for batch mode with
* buffer on preview
*/
<API key>(new_frame,
buff_mgr_info, op_index, dup_index);
buff_mgr_info.session_id = ((iden >> 16) & 0xFFFF);
buff_mgr_info.stream_id = (iden & 0xFFFF);
buff_mgr_info.type = buf_type;
if (<API key>(buff_mgr_info.index)) {
ioctl_cmd = <API key>;
idx = 0x0;
} else {
ioctl_cmd = <API key>;
idx =
<API key>;
}
rc = msm_cpp_buffer_ops(cpp_dev,
ioctl_cmd, idx, &buff_mgr_info);
if (rc < 0) {
rc = -EAGAIN;
pr_debug("%s:get_buf err rc:%d, index %d\n",
__func__, rc,
new_frame->output_buffer_info[0].index);
goto frame_msg_err;
}
num_output_bufs =
<API key>(&buff_mgr_info,
new_frame);
if (!num_output_bufs) {
pr_err("%s: error getting buffer %d\n",
__func__, num_output_bufs);
rc = -EINVAL;
goto phyaddr_err;
}
}
out_phyaddr0 = <API key>(cpp_dev,
&new_frame->output_buffer_info[0],
((iden >> 16) & 0xFFFF),
(iden & 0xFFFF),
&new_frame->output_buffer_info[0].fd);
if (!out_phyaddr0) {
pr_err("%s: error gettting output physical address\n",
__func__);
rc = -EINVAL;
goto phyaddr_err;
}
}
out_phyaddr1 = out_phyaddr0;
/* get buffer for duplicate output */
if (new_frame->duplicate_output) {
int32_t iden = new_frame->duplicate_identity;
CPP_DBG("duplication enabled, dup_id=0x%x",
new_frame->duplicate_identity);
<API key>(new_frame,
iden, new_frame->identity);
memset(&dup_buff_mgr_info, 0, sizeof(struct msm_buf_mngr_info));
/*
* Swap the input buffer index for batch mode with
* buffer on preview
*/
<API key>(new_frame,
dup_buff_mgr_info, dup_index, op_index);
dup_buff_mgr_info.session_id = ((iden >> 16) & 0xFFFF);
dup_buff_mgr_info.stream_id = (iden & 0xFFFF);
dup_buff_mgr_info.type =
<API key>;
if (<API key>(dup_buff_mgr_info.index)) {
ioctl_cmd = <API key>;
idx = 0x0;
} else {
ioctl_cmd = <API key>;
idx = <API key>;
}
rc = msm_cpp_buffer_ops(cpp_dev, ioctl_cmd, idx,
&dup_buff_mgr_info);
if (rc < 0) {
rc = -EAGAIN;
pr_debug("%s: get_buf err rc:%d, index %d\n",
__func__, rc,
new_frame-><API key>.index);
goto phyaddr_err;
}
new_frame-><API key>.index =
dup_buff_mgr_info.index;
out_phyaddr1 = <API key>(cpp_dev,
&new_frame-><API key>,
((iden >> 16) & 0xFFFF),
(iden & 0xFFFF),
&new_frame-><API key>.fd);
if (!out_phyaddr1) {
pr_err("error gettting output physical address\n");
rc = -EINVAL;
msm_cpp_buffer_ops(cpp_dev, <API key>,
0x0, &dup_buff_mgr_info);
goto phyaddr_err;
}
/* set duplicate enable bit */
cpp_frame_msg[5] |= 0x1;
CPP_DBG("out_phyaddr1= %08x\n", (uint32_t)out_phyaddr1);
}
tnr_enabled = ((new_frame->feature_mask & TNR_MASK) >> 2);
if (tnr_enabled) {
tnr_scratch_buffer0 = <API key>(cpp_dev,
&new_frame-><API key>[0],
((new_frame->identity >> 16) & 0xFFFF),
(new_frame->identity & 0xFFFF),
&new_frame-><API key>[0].fd);
if (!tnr_scratch_buffer0) {
pr_err("error getting scratch buffer physical address\n");
rc = -EINVAL;
goto phyaddr_err;
}
tnr_scratch_buffer1 = <API key>(cpp_dev,
&new_frame-><API key>[1],
((new_frame->identity >> 16) & 0xFFFF),
(new_frame->identity & 0xFFFF),
&new_frame-><API key>[1].fd);
if (!tnr_scratch_buffer1) {
pr_err("error getting scratch buffer physical address\n");
rc = -EINVAL;
goto phyaddr_err;
}
} else {
tnr_scratch_buffer0 = 0;
tnr_scratch_buffer1 = 0;
}
<API key>(cpp_dev, new_frame,
in_phyaddr, out_phyaddr0, out_phyaddr1,
tnr_scratch_buffer0, tnr_scratch_buffer1);
if (tnr_enabled) {
cpp_frame_msg[10] = tnr_scratch_buffer1 -
tnr_scratch_buffer0;
}
rc = <API key>(cpp_dev, new_frame, out_phyaddr0,
num_output_bufs);
if (rc) {
pr_err("%s: set group buffer failure %d\n", __func__, rc);
goto phyaddr_err;
}
num_stripes = new_frame->last_stripe_index -
new_frame->first_stripe_index + 1;
cpp_frame_msg[1] = stripe_base - 2 + num_stripes * stripe_size;
frame_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
if (!frame_qcmd) {
pr_err("%s: Insufficient memory\n", __func__);
rc = -ENOMEM;
goto qcmd_err;
}
atomic_set(&frame_qcmd->on_heap, 1);
frame_qcmd->command = new_frame;
rc = <API key>(cpp_dev, frame_qcmd);
if (rc < 0) {
pr_err("%s: error cannot send frame to hardware\n", __func__);
rc = -EINVAL;
goto qcmd_err;
}
return rc;
qcmd_err:
kfree(frame_qcmd);
phyaddr_err:
if (new_frame->output_buffer_info[0].native_buff == 0)
msm_cpp_buffer_ops(cpp_dev, <API key>,
0x0, &buff_mgr_info);
frame_msg_err:
kfree(cpp_frame_msg);
kfree(new_frame);
return rc;
}
static int msm_cpp_cfg(struct cpp_device *cpp_dev,
struct <API key> *ioctl_ptr)
{
struct <API key> *frame = NULL;
struct <API key> k_frame_info;
int32_t rc = 0;
int32_t i = 0;
int32_t num_buff = sizeof(k_frame_info.output_buffer_info)/
sizeof(struct <API key>);
if (copy_from_user(&k_frame_info,
(void __user *)ioctl_ptr->ioctl_ptr,
sizeof(k_frame_info)))
return -EFAULT;
frame = msm_cpp_get_frame(ioctl_ptr);
if (!frame) {
pr_err("%s: Error allocating frame\n", __func__);
rc = -EINVAL;
} else {
rc = msm_cpp_cfg_frame(cpp_dev, frame);
if (rc >= 0) {
for (i = 0; i < num_buff; i++) {
k_frame_info.output_buffer_info[i] =
frame->output_buffer_info[i];
}
}
}
ioctl_ptr->trans_code = rc;
if (copy_to_user((void __user *)k_frame_info.status, &rc,
sizeof(int32_t)))
pr_err("error cannot copy error\n");
if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
&k_frame_info, sizeof(k_frame_info))) {
pr_err("Error: cannot copy k_frame_info");
return -EFAULT;
}
return rc;
}
void msm_cpp_clean_queue(struct cpp_device *cpp_dev)
{
struct msm_queue_cmd *frame_qcmd = NULL;
struct <API key> *processed_frame = NULL;
struct msm_device_queue *queue = NULL;
while (cpp_dev->processing_q.len) {
pr_debug("queue len:%d\n", cpp_dev->processing_q.len);
queue = &cpp_dev->processing_q;
frame_qcmd = msm_dequeue(queue, list_frame, POP_FRONT);
if (frame_qcmd) {
processed_frame = frame_qcmd->command;
kfree(frame_qcmd);
if (processed_frame)
kfree(processed_frame->cpp_cmd_msg);
kfree(processed_frame);
}
}
}
#ifdef CONFIG_COMPAT
static int <API key>(void *dst_ptr,
struct <API key> *ioctl_ptr)
{
int ret;
if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) {
pr_err("%s: Wrong ioctl_ptr %pK / len %zu\n", __func__,
ioctl_ptr, ioctl_ptr->len);
return -EINVAL;
}
/* For compat task, source ptr is in kernel space */
if (is_compat_task()) {
memcpy(dst_ptr, ioctl_ptr->ioctl_ptr, ioctl_ptr->len);
ret = 0;
} else {
ret = copy_from_user(dst_ptr,
(void __user *)ioctl_ptr->ioctl_ptr, ioctl_ptr->len);
if (ret)
pr_err("Copy from user fail %d\n", ret);
}
return ret ? -EFAULT : 0;
}
#else
static int <API key>(void *dst_ptr,
struct <API key> *ioctl_ptr)
{
int ret;
if ((ioctl_ptr->ioctl_ptr == NULL) || (ioctl_ptr->len == 0)) {
pr_err("%s: Wrong ioctl_ptr %pK / len %zu\n", __func__,
ioctl_ptr, ioctl_ptr->len);
return -EINVAL;
}
ret = copy_from_user(dst_ptr,
(void __user *)ioctl_ptr->ioctl_ptr, ioctl_ptr->len);
if (ret)
pr_err("Copy from user fail %d\n", ret);
return ret ? -EFAULT : 0;
}
#endif
static int32_t msm_cpp_fw_version(struct cpp_device *cpp_dev)
{
int32_t rc = 0;
rc = <API key>(cpp_dev->base);
if (rc) {
pr_err("%s:%d] poll rx empty failed %d",
__func__, __LINE__, rc);
goto end;
}
/*Get Firmware Version*/
msm_cpp_write(<API key>, cpp_dev->base);
msm_cpp_write(MSM_CPP_MSG_ID_CMD, cpp_dev->base);
msm_cpp_write(0x1, cpp_dev->base);
msm_cpp_write(<API key>, cpp_dev->base);
msm_cpp_write(<API key>, cpp_dev->base);
rc = msm_cpp_poll(cpp_dev->base, MSM_CPP_MSG_ID_CMD);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
MSM_CPP_MSG_ID_CMD, rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, 0x2);
if (rc) {
pr_err("%s:%d] poll command 0x2 failed %d", __func__, __LINE__,
rc);
goto end;
}
rc = msm_cpp_poll(cpp_dev->base, <API key>);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
<API key>, rc);
goto end;
}
cpp_dev->fw_version = msm_cpp_read(cpp_dev->base);
pr_debug("CPP FW Version: 0x%08x\n", cpp_dev->fw_version);
rc = msm_cpp_poll(cpp_dev->base, <API key>);
if (rc) {
pr_err("%s:%d] poll command %x failed %d", __func__, __LINE__,
<API key>, rc);
}
end:
return rc;
}
static int <API key>(unsigned int cmd, void *arg,
struct <API key> **ioctl_ptr)
{
switch (cmd) {
case MSM_SD_SHUTDOWN:
case <API key>:
case <API key>:
break;
default: {
if (ioctl_ptr == NULL) {
pr_err("Wrong ioctl_ptr %pK\n", ioctl_ptr);
return -EINVAL;
}
*ioctl_ptr = arg;
if ((*ioctl_ptr == NULL) ||
((*ioctl_ptr)->ioctl_ptr == NULL)) {
pr_err("Wrong arg %pK\n", arg);
return -EINVAL;
}
break;
}
}
return 0;
}
long <API key>(struct v4l2_subdev *sd,
unsigned int cmd, void *arg)
{
struct cpp_device *cpp_dev = NULL;
struct <API key> *ioctl_ptr = NULL;
int rc = 0;
if (sd == NULL) {
pr_err("sd %pK\n", sd);
return -EINVAL;
}
cpp_dev = v4l2_get_subdevdata(sd);
if (cpp_dev == NULL) {
pr_err("cpp_dev is null\n");
return -EINVAL;
}
rc = <API key>(cmd, arg, &ioctl_ptr);
if (rc != 0) {
pr_err("input validation failed\n");
return rc;
}
mutex_lock(&cpp_dev->mutex);
CPP_DBG("E cmd: 0x%x\n", cmd);
switch (cmd) {
case <API key>: {
CPP_DBG("<API key>\n");
if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
&cpp_dev->hw_info,
sizeof(struct cpp_hw_info))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
break;
}
case <API key>: {
CPP_DBG("<API key>\n");
if (cpp_dev->is_firmware_loaded == 0) {
if (cpp_dev->fw_name_bin != NULL) {
kfree(cpp_dev->fw_name_bin);
cpp_dev->fw_name_bin = NULL;
}
if (cpp_dev->fw) {
release_firmware(cpp_dev->fw);
cpp_dev->fw = NULL;
}
if ((ioctl_ptr->len == 0) ||
(ioctl_ptr->len > <API key>)) {
pr_err("ioctl_ptr->len is 0\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
cpp_dev->fw_name_bin = kzalloc(ioctl_ptr->len+1,
GFP_KERNEL);
if (!cpp_dev->fw_name_bin) {
pr_err("%s:%d: malloc error\n", __func__,
__LINE__);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (ioctl_ptr->ioctl_ptr == NULL) {
pr_err("ioctl_ptr->ioctl_ptr=NULL\n");
kfree(cpp_dev->fw_name_bin);
cpp_dev->fw_name_bin = NULL;
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = (copy_from_user(cpp_dev->fw_name_bin,
(void __user *)ioctl_ptr->ioctl_ptr,
ioctl_ptr->len) ? -EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
kfree(cpp_dev->fw_name_bin);
cpp_dev->fw_name_bin = NULL;
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
*(cpp_dev->fw_name_bin+ioctl_ptr->len) = '\0';
rc = request_firmware(&cpp_dev->fw,
cpp_dev->fw_name_bin,
&cpp_dev->pdev->dev);
if (rc) {
dev_err(&cpp_dev->pdev->dev,
"Fail to loc blob %s dev %pK, rc:%d\n",
cpp_dev->fw_name_bin,
&cpp_dev->pdev->dev, rc);
kfree(cpp_dev->fw_name_bin);
cpp_dev->fw_name_bin = NULL;
cpp_dev->fw = NULL;
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
<API key>(cpp_dev->irq, false);
rc = cpp_load_fw(cpp_dev, cpp_dev->fw_name_bin);
if (rc < 0) {
pr_err("%s: load firmware failure %d\n",
__func__, rc);
enable_irq(cpp_dev->irq->start);
mutex_unlock(&cpp_dev->mutex);
return rc;
}
rc = msm_cpp_fw_version(cpp_dev);
if (rc < 0) {
pr_err("%s: get firmware failure %d\n",
__func__, rc);
enable_irq(cpp_dev->irq->start);
mutex_unlock(&cpp_dev->mutex);
return rc;
}
<API key>(cpp_dev->irq, true);
cpp_dev->is_firmware_loaded = 1;
}
break;
}
case VIDIOC_MSM_CPP_CFG:
CPP_DBG("VIDIOC_MSM_CPP_CFG\n");
rc = msm_cpp_cfg(cpp_dev, ioctl_ptr);
break;
case <API key>:
CPP_DBG("<API key>\n");
rc = <API key>(cpp_dev);
break;
case <API key>:
case <API key>:
case <API key>: {
uint32_t j;
struct <API key> *u_stream_buff_info = NULL;
struct <API key> k_stream_buff_info;
struct <API key> *buff_queue_info = NULL;
memset(&k_stream_buff_info, 0, sizeof(k_stream_buff_info));
CPP_DBG("<API key>\n");
if (sizeof(struct <API key>) !=
ioctl_ptr->len) {
pr_err("%s:%d: invalid length\n", __func__, __LINE__);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
u_stream_buff_info = kzalloc(ioctl_ptr->len, GFP_KERNEL);
if (!u_stream_buff_info) {
pr_err("%s:%d: malloc error\n", __func__, __LINE__);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = <API key>(u_stream_buff_info,
ioctl_ptr);
if (rc) {
ERR_COPY_FROM_USER();
kfree(u_stream_buff_info);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
k_stream_buff_info.num_buffs = u_stream_buff_info->num_buffs;
k_stream_buff_info.identity = u_stream_buff_info->identity;
if (k_stream_buff_info.num_buffs > <API key>) {
pr_err("%s:%d: unexpected large num buff requested\n",
__func__, __LINE__);
kfree(u_stream_buff_info);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (u_stream_buff_info->num_buffs != 0) {
k_stream_buff_info.buffer_info =
kzalloc(k_stream_buff_info.num_buffs *
sizeof(struct <API key>),
GFP_KERNEL);
if (ZERO_OR_NULL_PTR(k_stream_buff_info.buffer_info)) {
pr_err("%s:%d: malloc error\n",
__func__, __LINE__);
kfree(u_stream_buff_info);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = (copy_from_user(k_stream_buff_info.buffer_info,
(void __user *)u_stream_buff_info->buffer_info,
k_stream_buff_info.num_buffs *
sizeof(struct <API key>)) ?
-EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
kfree(k_stream_buff_info.buffer_info);
kfree(u_stream_buff_info);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
}
buff_queue_info = <API key>(cpp_dev,
(k_stream_buff_info.identity >> 16) & 0xFFFF,
k_stream_buff_info.identity & 0xFFFF);
if (buff_queue_info == NULL) {
if (cmd == <API key>)
goto STREAM_BUFF_END;
rc = <API key>(cpp_dev,
((k_stream_buff_info.identity >> 16) & 0xFFFF),
(k_stream_buff_info.identity & 0xFFFF));
if (rc)
goto STREAM_BUFF_END;
if (cpp_dev->stream_cnt == 0) {
cpp_dev->state = CPP_STATE_ACTIVE;
msm_cpp_clear_timer(cpp_dev);
msm_cpp_clean_queue(cpp_dev);
}
cpp_dev->stream_cnt++;
CPP_DBG("stream_cnt:%d\n", cpp_dev->stream_cnt);
}
buff_queue_info = <API key>(cpp_dev,
((k_stream_buff_info.identity >> 16) & 0xFFFF),
(k_stream_buff_info.identity & 0xFFFF));
if (buff_queue_info == NULL) {
pr_err("error finding buffer queue entry identity:%d\n",
k_stream_buff_info.identity);
kfree(k_stream_buff_info.buffer_info);
kfree(u_stream_buff_info);
cpp_dev->stream_cnt
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (<API key> == cmd) {
for (j = 0; j < k_stream_buff_info.num_buffs; j++) {
<API key>(cpp_dev, buff_queue_info,
k_stream_buff_info.buffer_info[j].index,
k_stream_buff_info.buffer_info[j].native_buff);
}
} else {
for (j = 0; j < k_stream_buff_info.num_buffs; j++) {
<API key>(cpp_dev,
buff_queue_info,
&k_stream_buff_info.buffer_info[j]);
}
}
STREAM_BUFF_END:
kfree(k_stream_buff_info.buffer_info);
kfree(u_stream_buff_info);
break;
}
case <API key>: {
uint32_t identity;
struct <API key> *buff_queue_info;
CPP_DBG("<API key>\n");
if ((ioctl_ptr->len == 0) ||
(ioctl_ptr->len > sizeof(uint32_t))) {
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = <API key>(&identity, ioctl_ptr);
if (rc) {
ERR_COPY_FROM_USER();
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
buff_queue_info = <API key>(cpp_dev,
((identity >> 16) & 0xFFFF), (identity & 0xFFFF));
if (buff_queue_info == NULL) {
pr_err("error finding buffer queue entry for identity:%d\n",
identity);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
<API key>(cpp_dev, buff_queue_info);
rc = <API key>(cpp_dev,
buff_queue_info->session_id,
buff_queue_info->stream_id);
if (cpp_dev->stream_cnt > 0) {
cpp_dev->stream_cnt
pr_debug("stream_cnt:%d\n", cpp_dev->stream_cnt);
if (cpp_dev->stream_cnt == 0) {
rc = <API key>(cpp_dev,
0, 0);
if (rc < 0)
pr_err("Bandwidth Reset Failed!\n");
cpp_dev->state = CPP_STATE_IDLE;
msm_cpp_clear_timer(cpp_dev);
msm_cpp_clean_queue(cpp_dev);
}
} else {
pr_err("error: stream count underflow %d\n",
cpp_dev->stream_cnt);
}
break;
}
case <API key>: {
struct msm_device_queue *queue = &cpp_dev->eventData_q;
struct msm_queue_cmd *event_qcmd;
struct <API key> *process_frame;
CPP_DBG("<API key>\n");
event_qcmd = msm_dequeue(queue, list_eventdata, POP_FRONT);
if (!event_qcmd) {
pr_err("no queue cmd available");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
process_frame = event_qcmd->command;
CPP_DBG("fid %d\n", process_frame->frame_id);
if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
process_frame,
sizeof(struct <API key>))) {
mutex_unlock(&cpp_dev->mutex);
kfree(process_frame->cpp_cmd_msg);
kfree(process_frame);
kfree(event_qcmd);
return -EFAULT;
}
kfree(process_frame->cpp_cmd_msg);
kfree(process_frame);
kfree(event_qcmd);
break;
}
case <API key>: {
uint32_t <API key>;
struct <API key> clock_settings;
unsigned long clock_rate = 0;
CPP_DBG("<API key>\n");
if (ioctl_ptr->len == 0) {
pr_err("ioctl_ptr->len is 0\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (ioctl_ptr->ioctl_ptr == NULL) {
pr_err("ioctl_ptr->ioctl_ptr is NULL\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (ioctl_ptr->len != sizeof(struct <API key>)) {
pr_err("Not valid ioctl_ptr->len\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = <API key>(&clock_settings, ioctl_ptr);
if (rc) {
ERR_COPY_FROM_USER();
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (clock_settings.clock_rate > 0) {
<API key> = <API key>(cpp_dev,
"cpp_core_clk");
if (<API key> < 0) {
pr_err(" Fail to get clock index\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = <API key>(cpp_dev,
clock_settings.avg,
clock_settings.inst);
if (rc < 0) {
pr_err("Bandwidth Set Failed!\n");
rc = <API key>(cpp_dev,
0, 0);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
clock_rate = <API key>(cpp_dev,
clock_settings.clock_rate,
<API key>);
if (rc < 0) {
pr_err("Fail to set core clk\n");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
if (clock_rate != clock_settings.clock_rate)
pr_err("clock rate differ from settings\n");
<API key>(clock_settings.clock_rate);
}
break;
}
case <API key>:
break;
case <API key>:
break;
case MSM_SD_SHUTDOWN:
CPP_DBG("MSM_SD_SHUTDOWN\n");
mutex_unlock(&cpp_dev->mutex);
pr_warn("shutdown cpp node. open cnt:%d\n",
cpp_dev->cpp_open_cnt);
if (atomic_read(&cpp_timer.used))
pr_debug("Timer state not cleared\n");
while (cpp_dev->cpp_open_cnt != 0)
cpp_close_node(sd, NULL);
mutex_lock(&cpp_dev->mutex);
rc = 0;
break;
case <API key>: {
struct <API key> queue_buf_info;
CPP_DBG("<API key>\n");
if (ioctl_ptr->len != sizeof(struct <API key>)) {
pr_err("%s: Not valid ioctl_ptr->len\n", __func__);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
rc = <API key>(&queue_buf_info, ioctl_ptr);
if (rc) {
ERR_COPY_FROM_USER();
break;
}
if (queue_buf_info.is_buf_dirty) {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &queue_buf_info.buff_mgr_info);
} else {
rc = msm_cpp_buffer_ops(cpp_dev,
<API key>,
0x0, &queue_buf_info.buff_mgr_info);
}
if (rc < 0) {
pr_err("error in buf done\n");
rc = -EINVAL;
}
break;
}
case <API key>: {
struct msm_buf_mngr_info buff_mgr_info;
struct <API key> frame_info;
uint32_t ioctl_cmd, idx;
if (ioctl_ptr->ioctl_ptr == NULL ||
(ioctl_ptr->len !=
sizeof(struct <API key>))) {
rc = -EINVAL;
break;
}
rc = <API key>(&frame_info, ioctl_ptr);
if (rc) {
ERR_COPY_FROM_USER();
break;
}
memset(&buff_mgr_info, 0, sizeof(struct msm_buf_mngr_info));
buff_mgr_info.session_id =
((frame_info.identity >> 16) & 0xFFFF);
buff_mgr_info.stream_id = (frame_info.identity & 0xFFFF);
buff_mgr_info.type =
<API key>;
if (<API key>(
frame_info.output_buffer_info[0].index)) {
ioctl_cmd = <API key>;
idx = 0x0;
} else {
ioctl_cmd = <API key>;
idx = <API key>;
}
rc = msm_cpp_buffer_ops(cpp_dev, ioctl_cmd, idx,
&buff_mgr_info);
if (rc < 0) {
rc = -EAGAIN;
pr_err_ratelimited("POP: get_buf err rc:%d, index %d\n",
rc, frame_info.output_buffer_info[0].index);
break;
}
buff_mgr_info.frame_id = frame_info.frame_id;
rc = msm_cpp_buffer_ops(cpp_dev, <API key>,
0x0, &buff_mgr_info);
if (rc < 0) {
pr_err("error in buf done\n");
rc = -EAGAIN;
}
break;
}
default:
pr_err_ratelimited("invalid value: cmd=0x%x\n", cmd);
break;
case <API key>: {
if (cpp_dev->iommu_state == <API key>) {
rc = cam_smmu_ops(cpp_dev->iommu_hdl, CAM_SMMU_ATTACH);
if (rc < 0) {
pr_err("%s:%dError iommu_attach_device failed\n",
__func__, __LINE__);
rc = -EINVAL;
break;
}
cpp_dev->iommu_state = <API key>;
} else {
pr_err("%s:%d IOMMMU attach triggered in invalid state\n",
__func__, __LINE__);
rc = -EINVAL;
}
break;
}
case <API key>: {
if ((cpp_dev->iommu_state == <API key>) &&
(cpp_dev->stream_cnt == 0)) {
rc = cam_smmu_ops(cpp_dev->iommu_hdl, CAM_SMMU_DETACH);
if (rc < 0) {
pr_err("%s:%dError iommu atach failed\n",
__func__, __LINE__);
rc = -EINVAL;
break;
}
cpp_dev->iommu_state = <API key>;
} else {
pr_err("%s:%d IOMMMU attach triggered in invalid state\n",
__func__, __LINE__);
}
break;
}
}
mutex_unlock(&cpp_dev->mutex);
CPP_DBG("X\n");
return rc;
}
int <API key>(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct <API key> *sub)
{
CPP_DBG("Called\n");
return <API key>(fh, sub, MAX_CPP_V4l2_EVENTS, NULL);
}
int <API key>(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct <API key> *sub)
{
CPP_DBG("Called\n");
return <API key>(fh, sub);
}
static struct <API key> <API key> = {
.ioctl = <API key>,
.subscribe_event = <API key>,
.unsubscribe_event = <API key>,
};
static const struct v4l2_subdev_ops msm_cpp_subdev_ops = {
.core = &<API key>,
};
static long <API key>(
struct file *file, unsigned int cmd, void *arg)
{
struct video_device *vdev;
struct v4l2_subdev *sd;
struct v4l2_fh *vfh = NULL;
if ((arg == NULL) || (file == NULL)) {
pr_err("Invalid input parameters arg %pK, file %pK\n",
arg, file);
return -EINVAL;
}
vdev = video_devdata(file);
sd = vdev_to_v4l2_subdev(vdev);
if (sd == NULL) {
pr_err("Invalid input parameter sd %pK\n", sd);
return -EINVAL;
}
vfh = file->private_data;
switch (cmd) {
case VIDIOC_DQEVENT:
if (!(sd->flags & <API key>))
return -ENOIOCTLCMD;
return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK);
case <API key>:
return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg);
case <API key>:
return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg);
case <API key>: {
uint32_t i;
struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
struct <API key> *ioctl_ptr = arg;
struct <API key> inst_info;
memset(&inst_info, 0, sizeof(struct <API key>));
for (i = 0; i < <API key>; i++) {
if (cpp_dev->cpp_subscribe_list[i].vfh == vfh) {
inst_info.inst_id = i;
break;
}
}
if (copy_to_user(
(void __user *)ioctl_ptr->ioctl_ptr, &inst_info,
sizeof(struct <API key>))) {
return -EFAULT;
}
}
break;
default:
return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
}
return 0;
}
static long <API key>(struct file *file, unsigned int cmd,
unsigned long arg)
{
return video_usercopy(file, cmd, arg, <API key>);
}
#ifdef CONFIG_COMPAT
static struct <API key> *<API key>(
struct <API key> *kp_ioctl)
{
struct <API key> *new_frame32 = NULL;
struct <API key> *new_frame = NULL;
uint32_t *cpp_frame_msg;
void *cpp_cmd_msg_64bit;
int32_t rc, i;
new_frame32 = kzalloc(sizeof(struct <API key>),
GFP_KERNEL);
if (!new_frame32) {
pr_err("Insufficient memory\n");
goto no_mem32;
}
new_frame = kzalloc(sizeof(struct <API key>), GFP_KERNEL);
if (!new_frame) {
pr_err("Insufficient memory\n");
goto no_mem;
}
rc = (copy_from_user(new_frame32, (void __user *)kp_ioctl->ioctl_ptr,
sizeof(struct <API key>)) ? -EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
goto frame_err;
}
new_frame->frame_id = new_frame32->frame_id;
new_frame->inst_id = new_frame32->inst_id;
new_frame->client_id = new_frame32->client_id;
new_frame->frame_type = new_frame32->frame_type;
new_frame->num_strips = new_frame32->num_strips;
new_frame->src_fd = new_frame32->src_fd;
new_frame->dst_fd = new_frame32->dst_fd;
new_frame->timestamp.tv_sec =
(unsigned long)new_frame32->timestamp.tv_sec;
new_frame->timestamp.tv_usec =
(unsigned long)new_frame32->timestamp.tv_usec;
new_frame->in_time.tv_sec =
(unsigned long)new_frame32->in_time.tv_sec;
new_frame->in_time.tv_usec =
(unsigned long)new_frame32->in_time.tv_usec;
new_frame->out_time.tv_sec =
(unsigned long)new_frame32->out_time.tv_sec;
new_frame->out_time.tv_usec =
(unsigned long)new_frame32->out_time.tv_usec;
new_frame->msg_len = new_frame32->msg_len;
new_frame->identity = new_frame32->identity;
new_frame->input_buffer_info = new_frame32->input_buffer_info;
new_frame->output_buffer_info[0] =
new_frame32->output_buffer_info[0];
new_frame->output_buffer_info[1] =
new_frame32->output_buffer_info[1];
new_frame->output_buffer_info[2] =
new_frame32->output_buffer_info[2];
new_frame->output_buffer_info[3] =
new_frame32->output_buffer_info[3];
new_frame->output_buffer_info[4] =
new_frame32->output_buffer_info[4];
new_frame->output_buffer_info[5] =
new_frame32->output_buffer_info[5];
new_frame->output_buffer_info[6] =
new_frame32->output_buffer_info[6];
new_frame->output_buffer_info[7] =
new_frame32->output_buffer_info[7];
new_frame-><API key> =
new_frame32-><API key>;
new_frame-><API key>[0] =
new_frame32-><API key>[0];
new_frame-><API key>[1] =
new_frame32-><API key>[1];
new_frame->duplicate_output = new_frame32->duplicate_output;
new_frame->we_disable = new_frame32->we_disable;
new_frame->duplicate_identity = new_frame32->duplicate_identity;
new_frame->feature_mask = new_frame32->feature_mask;
new_frame-><API key> =
new_frame32-><API key>;
new_frame->first_payload = new_frame32->first_payload;
new_frame->last_payload = new_frame32->last_payload;
new_frame->first_stripe_index = new_frame32->first_stripe_index;
new_frame->last_stripe_index = new_frame32->last_stripe_index;
new_frame->stripe_info_offset =
new_frame32->stripe_info_offset;
new_frame->stripe_info = new_frame32->stripe_info;
new_frame->batch_info.batch_mode =
new_frame32->batch_info.batch_mode;
new_frame->batch_info.batch_size =
new_frame32->batch_info.batch_size;
new_frame->batch_info.cont_idx =
new_frame32->batch_info.cont_idx;
for (i = 0; i < MAX_PLANES; i++)
new_frame->batch_info.intra_plane_offset[i] =
new_frame32->batch_info.intra_plane_offset[i];
new_frame->batch_info.pick_preview_idx =
new_frame32->batch_info.pick_preview_idx;
/* Convert the 32 bit pointer to 64 bit pointer */
new_frame->cookie = compat_ptr(new_frame32->cookie);
cpp_cmd_msg_64bit = compat_ptr(new_frame32->cpp_cmd_msg);
if ((new_frame->msg_len == 0) ||
(new_frame->msg_len > <API key>)) {
pr_err("%s:%d: Invalid frame len:%d\n", __func__,
__LINE__, new_frame->msg_len);
goto frame_err;
}
cpp_frame_msg = kzalloc(sizeof(uint32_t)*new_frame->msg_len,
GFP_KERNEL);
if (!cpp_frame_msg) {
pr_err("Insufficient memory\n");
goto frame_err;
}
rc = (copy_from_user(cpp_frame_msg,
(void __user *)cpp_cmd_msg_64bit,
sizeof(uint32_t)*new_frame->msg_len) ? -EFAULT : 0);
if (rc) {
ERR_COPY_FROM_USER();
goto frame_msg_err;
}
new_frame->cpp_cmd_msg = cpp_frame_msg;
kfree(new_frame32);
return new_frame;
frame_msg_err:
kfree(cpp_frame_msg);
frame_err:
kfree(new_frame);
no_mem:
kfree(new_frame32);
no_mem32:
return NULL;
}
static void <API key>(struct <API key> *frame,
struct <API key> *k32_frame)
{
int32_t i;
k32_frame->frame_id = frame->frame_id;
k32_frame->inst_id = frame->inst_id;
k32_frame->client_id = frame->client_id;
k32_frame->frame_type = frame->frame_type;
k32_frame->num_strips = frame->num_strips;
k32_frame->src_fd = frame->src_fd;
k32_frame->dst_fd = frame->dst_fd;
k32_frame->timestamp.tv_sec = (uint32_t)frame->timestamp.tv_sec;
k32_frame->timestamp.tv_usec = (uint32_t)frame->timestamp.tv_usec;
k32_frame->in_time.tv_sec = (uint32_t)frame->in_time.tv_sec;
k32_frame->in_time.tv_usec = (uint32_t)frame->in_time.tv_usec;
k32_frame->out_time.tv_sec = (uint32_t)frame->out_time.tv_sec;
k32_frame->out_time.tv_usec = (uint32_t)frame->out_time.tv_usec;
k32_frame->msg_len = frame->msg_len;
k32_frame->identity = frame->identity;
k32_frame->input_buffer_info = frame->input_buffer_info;
k32_frame->output_buffer_info[0] = frame->output_buffer_info[0];
k32_frame->output_buffer_info[1] = frame->output_buffer_info[1];
k32_frame->output_buffer_info[2] = frame->output_buffer_info[2];
k32_frame->output_buffer_info[3] = frame->output_buffer_info[3];
k32_frame->output_buffer_info[4] = frame->output_buffer_info[4];
k32_frame->output_buffer_info[5] = frame->output_buffer_info[5];
k32_frame->output_buffer_info[6] = frame->output_buffer_info[6];
k32_frame->output_buffer_info[7] = frame->output_buffer_info[7];
k32_frame-><API key> = frame-><API key>;
k32_frame->duplicate_output = frame->duplicate_output;
k32_frame->we_disable = frame->we_disable;
k32_frame->duplicate_identity = frame->duplicate_identity;
k32_frame->feature_mask = frame->feature_mask;
k32_frame->cookie = ptr_to_compat(frame->cookie);
k32_frame-><API key> = frame-><API key>;
k32_frame->first_payload = frame->first_payload;
k32_frame->last_payload = frame->last_payload;
k32_frame->first_stripe_index = frame->first_stripe_index;
k32_frame->last_stripe_index = frame->last_stripe_index;
k32_frame->stripe_info_offset = frame->stripe_info_offset;
k32_frame->stripe_info = frame->stripe_info;
k32_frame->batch_info.batch_mode = frame->batch_info.batch_mode;
k32_frame->batch_info.batch_size = frame->batch_info.batch_size;
k32_frame->batch_info.cont_idx = frame->batch_info.cont_idx;
for (i = 0; i < MAX_PLANES; i++)
k32_frame->batch_info.intra_plane_offset[i] =
frame->batch_info.intra_plane_offset[i];
k32_frame->batch_info.pick_preview_idx =
frame->batch_info.pick_preview_idx;
}
static long <API key>(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
struct cpp_device *cpp_dev = NULL;
int32_t rc = 0;
struct <API key> kp_ioctl;
struct <API key> up32_ioctl;
struct <API key> clock_settings;
struct <API key> k_queue_buf;
struct <API key> k_cpp_buff_info;
struct <API key> k32_frame_info;
struct <API key> k64_frame_info;
uint32_t identity_k = 0;
void __user *up = (void __user *)arg;
if (sd == NULL) {
pr_err("%s: Subdevice is NULL\n", __func__);
return -EINVAL;
}
cpp_dev = v4l2_get_subdevdata(sd);
if (!vdev || !cpp_dev) {
pr_err("Invalid vdev %pK or cpp_dev %pK structures!",
vdev, cpp_dev);
return -EINVAL;
}
mutex_lock(&cpp_dev->mutex);
/*
* copy the user space 32 bit pointer to kernel space 32 bit compat
* pointer
*/
if (copy_from_user(&up32_ioctl, (void __user *)up,
sizeof(up32_ioctl))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
/* copy the data from 32 bit compat to kernel space 64 bit pointer */
kp_ioctl.id = up32_ioctl.id;
kp_ioctl.len = up32_ioctl.len;
kp_ioctl.trans_code = up32_ioctl.trans_code;
/* Convert the 32 bit pointer to 64 bit pointer */
kp_ioctl.ioctl_ptr = compat_ptr(up32_ioctl.ioctl_ptr);
if (!kp_ioctl.ioctl_ptr) {
pr_err("%s: Invalid ioctl pointer\n", __func__);
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
/*
* Convert 32 bit IOCTL ID's to 64 bit IOCTL ID's
* except <API key>, which needs special
* processing
*/
switch (cmd) {
case <API key>:
{
struct <API key> k32_frame_info;
struct <API key> *cpp_frame = NULL;
int32_t *status;
if (copy_from_user(&k32_frame_info,
(void __user *)kp_ioctl.ioctl_ptr,
sizeof(k32_frame_info))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
/* Get the cpp frame pointer */
cpp_frame = <API key>(&kp_ioctl);
/* Configure the cpp frame */
if (cpp_frame) {
rc = msm_cpp_cfg_frame(cpp_dev, cpp_frame);
/* Cpp_frame can be free'd by cfg_frame in error */
if (rc >= 0) {
k32_frame_info.output_buffer_info[0] =
cpp_frame->output_buffer_info[0];
k32_frame_info.output_buffer_info[1] =
cpp_frame->output_buffer_info[1];
}
} else {
pr_err("%s: Error getting frame\n", __func__);
mutex_unlock(&cpp_dev->mutex);
rc = -EINVAL;
}
kp_ioctl.trans_code = rc;
/* Convert the 32 bit pointer to 64 bit pointer */
status = compat_ptr(k32_frame_info.status);
if (copy_to_user((void __user *)status, &rc,
sizeof(int32_t)))
pr_err("error cannot copy error\n");
if (copy_to_user((void __user *)kp_ioctl.ioctl_ptr,
&k32_frame_info,
sizeof(k32_frame_info))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
cmd = VIDIOC_MSM_CPP_CFG;
break;
}
case <API key>:
{
struct cpp_hw_info_32_t u32_cpp_hw_info;
uint32_t i;
u32_cpp_hw_info.cpp_hw_version =
cpp_dev->hw_info.cpp_hw_version;
u32_cpp_hw_info.cpp_hw_caps = cpp_dev->hw_info.cpp_hw_caps;
memset(&u32_cpp_hw_info.freq_tbl, 0x00,
sizeof(u32_cpp_hw_info.freq_tbl));
for (i = 0; i < cpp_dev->hw_info.freq_tbl_count; i++)
u32_cpp_hw_info.freq_tbl[i] =
cpp_dev->hw_info.freq_tbl[i];
u32_cpp_hw_info.freq_tbl_count =
cpp_dev->hw_info.freq_tbl_count;
if (copy_to_user((void __user *)kp_ioctl.ioctl_ptr,
&u32_cpp_hw_info, sizeof(struct cpp_hw_info_32_t))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
cmd = <API key>;
break;
}
case <API key>:
cmd = <API key>;
break;
case <API key>:
{
struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
struct <API key> inst_info;
struct v4l2_fh *vfh = NULL;
uint32_t i;
vfh = file->private_data;
memset(&inst_info, 0, sizeof(struct <API key>));
for (i = 0; i < <API key>; i++) {
if (cpp_dev->cpp_subscribe_list[i].vfh == vfh) {
inst_info.inst_id = i;
break;
}
}
if (copy_to_user(
(void __user *)kp_ioctl.ioctl_ptr, &inst_info,
sizeof(struct <API key>))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
cmd = <API key>;
break;
}
case <API key>:
cmd = <API key>;
break;
case <API key>:
case <API key>:
case <API key>:
{
compat_uptr_t p;
struct <API key> *u32_cpp_buff_info =
(struct <API key> *)kp_ioctl.ioctl_ptr;
get_user(k_cpp_buff_info.identity,
&u32_cpp_buff_info->identity);
get_user(k_cpp_buff_info.num_buffs,
&u32_cpp_buff_info->num_buffs);
get_user(p, &u32_cpp_buff_info->buffer_info);
k_cpp_buff_info.buffer_info = compat_ptr(p);
kp_ioctl.ioctl_ptr = (void *)&k_cpp_buff_info;
if (is_compat_task()) {
if (kp_ioctl.len != sizeof(
struct <API key>)) {
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
} else {
kp_ioctl.len =
sizeof(struct <API key>);
}
}
if (cmd == <API key>)
cmd = <API key>;
else if (cmd == <API key>)
cmd = <API key>;
else
cmd = <API key>;
break;
}
case <API key>: {
uint32_t *identity_u = (uint32_t *)kp_ioctl.ioctl_ptr;
get_user(identity_k, identity_u);
kp_ioctl.ioctl_ptr = (void *)&identity_k;
kp_ioctl.len = sizeof(uint32_t);
cmd = <API key>;
break;
}
case <API key>:
{
struct msm_device_queue *queue = &cpp_dev->eventData_q;
struct msm_queue_cmd *event_qcmd;
struct <API key> *process_frame;
struct <API key> k32_process_frame;
CPP_DBG("<API key>\n");
event_qcmd = msm_dequeue(queue, list_eventdata, POP_FRONT);
if (!event_qcmd) {
pr_err("no queue cmd available");
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
}
process_frame = event_qcmd->command;
memset(&k32_process_frame, 0, sizeof(k32_process_frame));
<API key>(process_frame, &k32_process_frame);
CPP_DBG("fid %d\n", process_frame->frame_id);
if (copy_to_user((void __user *)kp_ioctl.ioctl_ptr,
&k32_process_frame,
sizeof(struct <API key>))) {
kfree(process_frame->cpp_cmd_msg);
kfree(process_frame);
kfree(event_qcmd);
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
kfree(process_frame->cpp_cmd_msg);
kfree(process_frame);
kfree(event_qcmd);
cmd = <API key>;
break;
}
case <API key>:
{
struct <API key> *clock_settings32 =
(struct <API key> *)kp_ioctl.ioctl_ptr;
get_user(clock_settings.clock_rate,
&clock_settings32->clock_rate);
get_user(clock_settings.avg, &clock_settings32->avg);
get_user(clock_settings.inst, &clock_settings32->inst);
kp_ioctl.ioctl_ptr = (void *)&clock_settings;
if (is_compat_task()) {
if (kp_ioctl.len != sizeof(
struct <API key>)) {
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
} else {
kp_ioctl.len =
sizeof(struct <API key>);
}
}
cmd = <API key>;
break;
}
case <API key>:
{
struct <API key> *u32_queue_buf =
(struct <API key> *)kp_ioctl.ioctl_ptr;
get_user(k_queue_buf.is_buf_dirty,
&u32_queue_buf->is_buf_dirty);
get_user(k_queue_buf.buff_mgr_info.session_id,
&u32_queue_buf->buff_mgr_info.session_id);
get_user(k_queue_buf.buff_mgr_info.stream_id,
&u32_queue_buf->buff_mgr_info.stream_id);
get_user(k_queue_buf.buff_mgr_info.frame_id,
&u32_queue_buf->buff_mgr_info.frame_id);
get_user(k_queue_buf.buff_mgr_info.index,
&u32_queue_buf->buff_mgr_info.index);
get_user(k_queue_buf.buff_mgr_info.timestamp.tv_sec,
&u32_queue_buf->buff_mgr_info.timestamp.tv_sec);
get_user(k_queue_buf.buff_mgr_info.timestamp.tv_usec,
&u32_queue_buf->buff_mgr_info.timestamp.tv_usec);
kp_ioctl.ioctl_ptr = (void *)&k_queue_buf;
kp_ioctl.len = sizeof(struct <API key>);
cmd = <API key>;
break;
}
case <API key>:
{
if (kp_ioctl.len != sizeof(struct <API key>)) {
mutex_unlock(&cpp_dev->mutex);
return -EINVAL;
} else {
kp_ioctl.len = sizeof(struct <API key>);
}
if (copy_from_user(&k32_frame_info,
(void __user *)kp_ioctl.ioctl_ptr,
sizeof(k32_frame_info))) {
mutex_unlock(&cpp_dev->mutex);
return -EFAULT;
}
memset(&k64_frame_info, 0, sizeof(k64_frame_info));
k64_frame_info.identity = k32_frame_info.identity;
k64_frame_info.frame_id = k32_frame_info.frame_id;
kp_ioctl.ioctl_ptr = (void *)&k64_frame_info;
cmd = <API key>;
break;
}
case <API key>:
cmd = <API key>;
break;
case <API key>:
cmd = <API key>;
break;
case <API key>:
break;
case <API key>:
break;
case MSM_SD_SHUTDOWN:
cmd = MSM_SD_SHUTDOWN;
break;
default:
pr_err_ratelimited("%s: unsupported compat type :%x LOAD %lu\n",
__func__, cmd, <API key>);
break;
}
mutex_unlock(&cpp_dev->mutex);
switch (cmd) {
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case MSM_SD_SHUTDOWN:
rc = v4l2_subdev_call(sd, core, ioctl, cmd, &kp_ioctl);
break;
case <API key>:
case VIDIOC_MSM_CPP_CFG:
case <API key>:
case <API key>:
break;
case <API key>:
break;
case <API key>:
break;
default:
pr_err_ratelimited("%s: unsupported compat type :%d\n",
__func__, cmd);
break;
}
up32_ioctl.id = kp_ioctl.id;
up32_ioctl.len = kp_ioctl.len;
up32_ioctl.trans_code = kp_ioctl.trans_code;
up32_ioctl.ioctl_ptr = ptr_to_compat(kp_ioctl.ioctl_ptr);
if (copy_to_user((void __user *)up, &up32_ioctl, sizeof(up32_ioctl)))
return -EFAULT;
return rc;
}
#endif
struct <API key> <API key> = {
.unlocked_ioctl = <API key>,
#ifdef CONFIG_COMPAT
.compat_ioctl32 = <API key>,
#endif
};
static int <API key>(struct cpp_device *cpp_dev,
bool status)
{
int rc = 0;
int value = 0;
if (!cpp_dev) {
pr_err("%s: cpp device invalid\n", __func__);
rc = -EINVAL;
goto end;
}
if (cpp_dev->camss_cpp_base) {
value = msm_camera_io_r(cpp_dev->camss_cpp_base);
pr_debug("value from camss cpp %x, status %d\n", value, status);
if (status) {
value &= <API key>;
value |= <API key>;
} else {
value |= <API key>;
value &= <API key>;
}
pr_debug("value %x after camss cpp mask\n", value);
msm_camera_io_w(value, cpp_dev->camss_cpp_base);
}
end:
return rc;
}
static void <API key>(struct cpp_device *cpp_dev)
{
int i, reg, val;
const u32 *vbif_qos_arr = NULL;
int vbif_qos_len = 0;
struct platform_device *pdev;
pr_debug("%s\n", __func__);
if (cpp_dev != NULL) {
pdev = cpp_dev->pdev;
vbif_qos_arr = of_get_property(pdev->dev.of_node,
"qcom,vbif-qos-setting",
&vbif_qos_len);
if (!vbif_qos_arr || (vbif_qos_len & 1)) {
pr_debug("%s: vbif qos setting not found\n",
__func__);
vbif_qos_len = 0;
}
vbif_qos_len /= sizeof(u32);
pr_debug("%s: vbif_qos_len %d\n", __func__, vbif_qos_len);
if (cpp_dev->vbif_base) {
for (i = 0; i < vbif_qos_len; i = i+2) {
reg = be32_to_cpu(vbif_qos_arr[i]);
val = be32_to_cpu(vbif_qos_arr[i+1]);
pr_debug("%s: DT: offset %x, val %x\n",
__func__, reg, val);
pr_debug("%s: before write to register 0x%x\n",
__func__, msm_camera_io_r(
cpp_dev->vbif_base + reg));
msm_camera_io_w(val, cpp_dev->vbif_base + reg);
pr_debug("%s: after write to register 0x%x\n",
__func__, msm_camera_io_r(
cpp_dev->vbif_base + reg));
}
}
}
}
static int <API key>(struct cpp_device *cpp_dev,
uint32_t buff_mgr_ops, uint32_t id, void *arg) {
int32_t rc = 0;
switch (id) {
case <API key>: {
struct <API key> ioctl_arg;
struct msm_buf_mngr_info *buff_mgr_info =
(struct msm_buf_mngr_info *)arg;
ioctl_arg.id = <API key>;
ioctl_arg.size = sizeof(struct msm_buf_mngr_info);
ioctl_arg.result = 0;
ioctl_arg.reserved = 0x0;
ioctl_arg.ioctl_ptr = 0x0;
<API key>(&ioctl_arg.ioctl_ptr, &buff_mgr_info,
sizeof(void *));
rc = cpp_dev->buf_mgr_ops.msm_cam_buf_mgr_ops(buff_mgr_ops,
&ioctl_arg);
/* Use <API key> if getbuf with indx fails */
if (rc < 0) {
pr_err_ratelimited("get_buf_by_idx for %d err %d,use get_buf\n",
buff_mgr_info->index, rc);
rc = cpp_dev->buf_mgr_ops.msm_cam_buf_mgr_ops(
<API key>, buff_mgr_info);
}
break;
}
default: {
pr_err("unsupported buffer manager ioctl\n");
break;
}
}
return rc;
}
static int cpp_probe(struct platform_device *pdev)
{
struct cpp_device *cpp_dev;
int rc = 0;
CPP_DBG("E");
cpp_dev = kzalloc(sizeof(struct cpp_device), GFP_KERNEL);
if (!cpp_dev) {
pr_err("no enough memory\n");
return -ENOMEM;
}
v4l2_subdev_init(&cpp_dev->msm_sd.sd, &msm_cpp_subdev_ops);
cpp_dev->msm_sd.sd.internal_ops = &<API key>;
snprintf(cpp_dev->msm_sd.sd.name, ARRAY_SIZE(cpp_dev->msm_sd.sd.name),
"cpp");
cpp_dev->msm_sd.sd.flags |= <API key>;
cpp_dev->msm_sd.sd.flags |= <API key>;
v4l2_set_subdevdata(&cpp_dev->msm_sd.sd, cpp_dev);
<API key>(pdev, &cpp_dev->msm_sd.sd);
mutex_init(&cpp_dev->mutex);
spin_lock_init(&cpp_dev->tasklet_lock);
spin_lock_init(&cpp_timer.data.<API key>);
cpp_dev->pdev = pdev;
memset(&cpp_vbif, 0, sizeof(struct msm_cpp_vbif_data));
cpp_dev->vbif_data = &cpp_vbif;
cpp_dev->camss_cpp_base =
<API key>(pdev, "camss_cpp", true);
if (!cpp_dev->camss_cpp_base) {
rc = -ENOMEM;
pr_err("failed to get camss_cpp_base\n");
goto <API key>;
}
cpp_dev->base =
<API key>(pdev, "cpp", true);
if (!cpp_dev->base) {
rc = -ENOMEM;
pr_err("failed to get cpp_base\n");
goto cpp_base_failed;
}
cpp_dev->vbif_base =
<API key>(pdev, "cpp_vbif", false);
if (!cpp_dev->vbif_base) {
rc = -ENOMEM;
pr_err("failed to get vbif_base\n");
goto vbif_base_failed;
}
cpp_dev->cpp_hw_base =
<API key>(pdev, "cpp_hw", true);
if (!cpp_dev->cpp_hw_base) {
rc = -ENOMEM;
pr_err("failed to get cpp_hw_base\n");
goto cpp_hw_base_failed;
}
cpp_dev->irq = msm_camera_get_irq(pdev, "cpp");
if (!cpp_dev->irq) {
pr_err("%s: no irq resource?\n", __func__);
rc = -ENODEV;
goto mem_err;
}
rc = <API key>(pdev, &cpp_dev->clk_info,
&cpp_dev->cpp_clk, &cpp_dev->num_clks);
if (rc < 0) {
pr_err("%s: failed to get the clocks\n", __func__);
goto mem_err;
}
rc = <API key>(pdev, &cpp_dev->cpp_vdd,
&cpp_dev->num_reg);
if (rc < 0) {
pr_err("%s: failed to get the regulators\n", __func__);
goto get_reg_err;
}
<API key>(cpp_dev);
rc = <API key>(cpp_dev);
if (rc)
goto <API key>;
if (cpp_dev->bus_master_flag)
rc = <API key>(cpp_dev);
else
rc = <API key>(NULL, ISP_CPP);
if (rc < 0) {
pr_err("%s: Bandwidth registration Failed!\n", __func__);
goto <API key>;
}
cpp_dev->state = CPP_STATE_BOOT;
rc = cpp_init_hardware(cpp_dev);
if (rc < 0)
goto <API key>;
media_entity_init(&cpp_dev->msm_sd.sd.entity, 0, NULL, 0);
cpp_dev->msm_sd.sd.entity.type = <API key>;
cpp_dev->msm_sd.sd.entity.group_id = <API key>;
cpp_dev->msm_sd.sd.entity.name = pdev->name;
cpp_dev->msm_sd.close_seq = <API key>;
msm_sd_register(&cpp_dev->msm_sd);
<API key>(&<API key>);
<API key>.unlocked_ioctl = <API key>;
#ifdef CONFIG_COMPAT
<API key>.compat_ioctl32 =
<API key>;
#endif
cpp_dev->msm_sd.sd.devnode->fops = &<API key>;
cpp_dev->msm_sd.sd.entity.revision = cpp_dev->msm_sd.sd.devnode->num;
msm_camera_io_w(0x0, cpp_dev->base +
<API key>);
msm_camera_io_w(0xFFFF, cpp_dev->base +
<API key>);
msm_camera_io_w(0x80000000, cpp_dev->base + 0xF0);
<API key>(cpp_dev);
cpp_dev->state = CPP_STATE_OFF;
<API key>(cpp_dev);
msm_queue_init(&cpp_dev->eventData_q, "eventdata");
msm_queue_init(&cpp_dev->processing_q, "frame");
INIT_LIST_HEAD(&cpp_dev->tasklet_q);
tasklet_init(&cpp_dev->cpp_tasklet, msm_cpp_do_tasklet,
(unsigned long)cpp_dev);
cpp_dev->timer_wq = create_workqueue("msm_cpp_workqueue");
cpp_dev->work = kmalloc(sizeof(struct msm_cpp_work_t),
GFP_KERNEL);
if (!cpp_dev->work) {
pr_err("no enough memory\n");
rc = -ENOMEM;
goto <API key>;
}
INIT_WORK((struct work_struct *)cpp_dev->work, <API key>);
cpp_dev->cpp_open_cnt = 0;
cpp_dev->is_firmware_loaded = 0;
cpp_dev->iommu_state = <API key>;
cpp_timer.data.cpp_dev = cpp_dev;
atomic_set(&cpp_timer.used, 0);
/* install timer for cpp timeout */
CPP_DBG("Installing cpp_timer\n");
setup_timer(&cpp_timer.cpp_timer,
cpp_timer_callback, (unsigned long)&cpp_timer);
cpp_dev->fw_name_bin = NULL;
cpp_dev-><API key> = <API key>;
if (rc == 0)
CPP_DBG("SUCCESS.");
else
CPP_DBG("FAILED.");
return rc;
<API key>:
<API key>(&cpp_dev->msm_sd.sd.entity);
msm_sd_unregister(&cpp_dev->msm_sd);
get_reg_err:
<API key>(pdev, &cpp_dev->clk_info, &cpp_dev->cpp_clk,
cpp_dev->num_clks);
mem_err:
<API key>(pdev, cpp_dev->cpp_hw_base, "cpp_hw", true);
cpp_hw_base_failed:
<API key>(pdev, cpp_dev->vbif_base, "cpp_vbif", false);
vbif_base_failed:
<API key>(pdev, cpp_dev->base, "cpp", true);
cpp_base_failed:
<API key>(pdev, cpp_dev->camss_cpp_base,
"camss_cpp", true);
<API key>:
kfree(cpp_dev);
return rc;
}
static const struct of_device_id msm_cpp_dt_match[] = {
{.compatible = "qcom,cpp"},
{}
};
static int cpp_device_remove(struct platform_device *dev)
{
struct v4l2_subdev *sd = <API key>(dev);
struct cpp_device *cpp_dev;
if (!sd) {
pr_err("%s: Subdevice is NULL\n", __func__);
return 0;
}
cpp_dev = (struct cpp_device *)v4l2_get_subdevdata(sd);
if (!cpp_dev) {
pr_err("%s: cpp device is NULL\n", __func__);
return 0;
}
if (cpp_dev->fw) {
release_firmware(cpp_dev->fw);
cpp_dev->fw = NULL;
}
if (cpp_dev->bus_master_flag)
<API key>(cpp_dev);
else
<API key>(ISP_CPP);
msm_sd_unregister(&cpp_dev->msm_sd);
<API key>(dev, cpp_dev->camss_cpp_base,
"camss_cpp", true);
<API key>(dev, cpp_dev->base, "cpp", true);
<API key>(dev, cpp_dev->vbif_base, "cpp_vbif", false);
<API key>(dev, cpp_dev->cpp_hw_base, "cpp_hw", true);
<API key>(dev, &cpp_dev->cpp_vdd,
cpp_dev->num_reg);
<API key>(dev, &cpp_dev->clk_info,
&cpp_dev->cpp_clk, cpp_dev->num_clks);
<API key>(CAM_BUS_CLIENT_CPP);
mutex_destroy(&cpp_dev->mutex);
kfree(cpp_dev->work);
destroy_workqueue(cpp_dev->timer_wq);
kfree(cpp_dev->cpp_clk);
kfree(cpp_dev);
return 0;
}
static struct platform_driver cpp_driver = {
.probe = cpp_probe,
.remove = cpp_device_remove,
.driver = {
.name = MSM_CPP_DRV_NAME,
.owner = THIS_MODULE,
.of_match_table = msm_cpp_dt_match,
},
};
static int __init msm_cpp_init_module(void)
{
return <API key>(&cpp_driver);
}
static void __exit msm_cpp_exit_module(void)
{
<API key>(&cpp_driver);
}
static int <API key>(void *data, u64 val)
{
pr_err("setting error inducement");
induce_error = val;
return 0;
}
<API key>(cpp_debugfs_error, NULL,
<API key>, "%llu\n");
static int <API key>(struct cpp_device *cpp_dev)
{
struct dentry *debugfs_base;
debugfs_base = debugfs_create_dir("msm_cpp", NULL);
if (!debugfs_base)
return -ENOMEM;
if (!debugfs_create_file("error", S_IRUGO | S_IWUSR, debugfs_base,
(void *)cpp_dev, &cpp_debugfs_error))
return -ENOMEM;
return 0;
}
module_init(msm_cpp_init_module);
module_exit(msm_cpp_exit_module);
MODULE_DESCRIPTION("MSM CPP driver");
MODULE_LICENSE("GPL v2"); |
#ifndef WTFThreadData_h
#define WTFThreadData_h
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/StackBounds.h>
#include <wtf/StackStats.h>
#include <wtf/text/StringHash.h>
#include <wtf/ThreadSpecific.h>
#include <wtf/Threading.h>
// FIXME: This is a temporary layering violation until we move more of the string code from JavaScriptCore to WTF.
namespace JSC {
class IdentifierTable {
<API key>;
public:
WTF_EXPORT_PRIVATE ~IdentifierTable();
WTF_EXPORT_PRIVATE HashSet<StringImpl*>::AddResult add(StringImpl*);
template<typename U, typename V> HashSet<StringImpl*>::AddResult add(U);
bool remove(StringImpl* identifier) { return m_table.remove(identifier); }
private:
HashSet<StringImpl*> m_table;
};
}
namespace WTF {
class AtomicStringTable;
typedef void (*<API key>)(AtomicStringTable*);
class WTFThreadData {
<API key>(WTFThreadData);
public:
WTF_EXPORT_PRIVATE WTFThreadData();
WTF_EXPORT_PRIVATE ~WTFThreadData();
AtomicStringTable* atomicStringTable()
{
return m_atomicStringTable;
}
JSC::IdentifierTable* <API key>()
{
return <API key>;
}
JSC::IdentifierTable* <API key>(JSC::IdentifierTable* identifierTable)
{
JSC::IdentifierTable* oldIdentifierTable = <API key>;
<API key> = identifierTable;
return oldIdentifierTable;
}
void <API key>()
{
<API key> = <API key>;
}
const StackBounds& stack()
{
// We need to always get a fresh StackBounds from the OS due to how fibers work.
#if OS(WINDOWS)
m_stackBounds = StackBounds::<API key>();
#endif
return m_stackBounds;
}
#if ENABLE(STACK_STATS)
StackStats::PerThreadStats& stackStats()
{
return m_stackStats;
}
#endif
void* <API key>()
{
return <API key>;
}
void <API key>(void* <API key>)
{
<API key> = <API key>;
}
void* savedLastStackTop()
{
return m_savedLastStackTop;
}
void <API key>(void* lastStackTop)
{
m_savedLastStackTop = lastStackTop;
}
void* m_apiData;
private:
AtomicStringTable* m_atomicStringTable;
<API key> <API key>;
JSC::IdentifierTable* <API key>;
JSC::IdentifierTable* <API key>;
StackBounds m_stackBounds;
#if ENABLE(STACK_STATS)
StackStats::PerThreadStats m_stackStats;
#endif
void* <API key>;
void* m_savedLastStackTop;
static WTF_EXPORTDATA ThreadSpecific<WTFThreadData>* staticData;
friend WTFThreadData& wtfThreadData();
friend class AtomicStringTable;
};
inline WTFThreadData& wtfThreadData()
{
// WRT WebCore:
// WTFThreadData is used on main thread before it could possibly be used
// on secondary ones, so there is no need for synchronization here.
// WRT JavaScriptCore:
// wtfThreadData() is initially called from initializeThreading(), ensuring
// this is initially called in a pthread_once locked context.
if (!WTFThreadData::staticData)
WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
return **WTFThreadData::staticData;
}
} // namespace WTF
using WTF::WTFThreadData;
using WTF::wtfThreadData;
#endif // WTFThreadData_h |
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Register AJAX handlers for BP Default theme functionality.
*
* This function is registered to the after_setup_theme hook with priority 20 as
* this file is included in a function hooked to after_setup_theme at priority 10.
*
* @since BuddyPress (1.6)
*/
function <API key>() {
$actions = array(
// Directory filters
'blogs_filter' => '<API key>',
'forums_filter' => '<API key>',
'groups_filter' => '<API key>',
'members_filter' => '<API key>',
'messages_filter' => '<API key>',
// Friends
'accept_friendship' => '<API key>',
'addremove_friend' => '<API key>',
'reject_friendship' => '<API key>',
// Activity
'<API key>' => '<API key>',
'activity_mark_fav' => '<API key>',
'activity_mark_unfav' => '<API key>',
'<API key>' => '<API key>',
'delete_activity' => '<API key>',
'<API key>' => '<API key>',
'<API key>' => '<API key>',
'<API key>' => '<API key>',
'post_update' => '<API key>',
'bp_spam_activity' => '<API key>',
'<API key>' => '<API key>',
// Groups
'groups_invite_user' => '<API key>',
'joinleave_group' => '<API key>',
// Messages
'<API key>' => '<API key>',
'<API key>' => '<API key>',
'messages_delete' => '<API key>',
'messages_markread' => '<API key>',
'messages_markunread' => '<API key>',
'messages_send_reply' => '<API key>',
);
/**
* Register all of these AJAX handlers
*
* The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
* executes for users that aren't logged in. This is for backpat with BP <1.6.
*/
foreach( $actions as $name => $function ) {
add_action( 'wp_ajax_' . $name, $function );
add_action( 'wp_ajax_nopriv_' . $name, $function );
}
}
add_action( 'after_setup_theme', '<API key>', 20 );
/**
* This function looks scarier than it actually is. :)
* Each object loop (activity/members/groups/blogs/forums) contains default parameters to
* show specific information based on the page we are currently looking at.
* The following function will take into account any cookies set in the JS and allow us
* to override the parameters sent. That way we can change the results returned without reloading the page.
* By using cookies we can also make sure that user settings are retained across page loads.
*
* @return string Query string for the activity/members/groups/blogs/forums loops
* @since BuddyPress (1.2)
*/
function <API key>( $query_string, $object ) {
if ( empty( $object ) )
return '';
// Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts
if ( ! empty( $_POST['cookie'] ) )
$_BP_COOKIE = wp_parse_args( str_replace( '; ', '&', urldecode( $_POST['cookie'] ) ) );
else
$_BP_COOKIE = &$_COOKIE;
$qs = array();
/**
* Check if any cookie values are set. If there are then override the default params passed to the
* template loop
*/
// Activity stream filtering on action
if ( ! empty( $_BP_COOKIE['bp-' . $object . '-filter'] ) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter'] ) {
$qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter'];
$qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
}
if ( ! empty( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) {
if ( 'personal' == $_BP_COOKIE['bp-' . $object . '-scope'] ) {
$user_id = ( <API key>() ) ? <API key>() : bp_loggedin_user_id();
$qs[] = 'user_id=' . $user_id;
}
// Activity stream scope only on activity directory.
if ( 'all' != $_BP_COOKIE['bp-' . $object . '-scope'] && ! <API key>() && ! bp_is_single_item() )
$qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope'];
}
// If page and search_terms have been passed via the AJAX post request, use those.
if ( ! empty( $_POST['page'] ) && '-1' != $_POST['page'] )
$qs[] = 'page=' . $_POST['page'];
$object_search_text = <API key>( $object );
if ( ! empty( $_POST['search_terms'] ) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] )
$qs[] = 'search_terms=' . $_POST['search_terms'];
// Now pass the querystring to override default values.
$query_string = empty( $qs ) ? '' : join( '&', (array) $qs );
$object_filter = '';
if ( isset( $_BP_COOKIE['bp-' . $object . '-filter'] ) )
$object_filter = $_BP_COOKIE['bp-' . $object . '-filter'];
$object_scope = '';
if ( isset( $_BP_COOKIE['bp-' . $object . '-scope'] ) )
$object_scope = $_BP_COOKIE['bp-' . $object . '-scope'];
$object_page = '';
if ( isset( $_BP_COOKIE['bp-' . $object . '-page'] ) )
$object_page = $_BP_COOKIE['bp-' . $object . '-page'];
$object_search_terms = '';
if ( isset( $_BP_COOKIE['bp-' . $object . '-search-terms'] ) )
$object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms'];
$object_extras = '';
if ( isset( $_BP_COOKIE['bp-' . $object . '-extras'] ) )
$object_extras = $_BP_COOKIE['bp-' . $object . '-extras'];
return apply_filters( '<API key>', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras );
}
add_filter( 'bp_ajax_querystring', '<API key>', 10, 2 );
/**
* Load the template loop for the current object.
*
* @return string Prints template loop for the specified object
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
/**
* AJAX requests happen too early to be seen by <API key>()
* so we do it manually here to ensure templates load with the correct
* context. Without this check, templates will load the 'single' version
* of themselves rather than the directory version.
*/
if ( ! bp_current_action() )
<API key>( true, <API key>() );
// Sanitize the post object
$object = esc_attr( $_POST['object'] );
// Locate the object template
locate_template( array( "$object/$object-loop.php" ), true );
exit;
}
/**
* Load messages template loop when searched on the private message page
*
* @return string Prints template loop for the Messages component
* @since BuddyPress (1.6)
*/
function <API key>(){
locate_template( array( 'members/single/messages/messages-loop.php' ), true );
exit;
}
/**
* Load the activity loop template when activity is requested via AJAX,
*
* @return string JSON object containing 'contents' (output of the template loop for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
$scope = '';
if ( ! empty( $_POST['scope'] ) )
$scope = $_POST['scope'];
// We need to calculate and return the feed URL for each scope
switch ( $scope ) {
case 'friends':
$feed_url = <API key>() . <API key>() . '/friends/feed/';
break;
case 'groups':
$feed_url = <API key>() . <API key>() . '/groups/feed/';
break;
case 'favorites':
$feed_url = <API key>() . <API key>() . '/favorites/feed/';
break;
case 'mentions':
$feed_url = <API key>() . <API key>() . '/mentions/feed/';
<API key>( bp_loggedin_user_id() );
break;
default:
$feed_url = home_url( <API key>() . '/feed/' );
break;
}
// Buffer the loop in the template to a var for JS to spit out.
ob_start();
locate_template( array( 'activity/activity-loop.php' ), true );
$result['contents'] = ob_get_contents();
$result['feed_url'] = apply_filters( '<API key>', $feed_url, $scope );
ob_end_clean();
exit( json_encode( $result ) );
}
/**
* Processes Activity updates received via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check the nonce
check_admin_referer( 'post_update', '<API key>' );
if ( ! is_user_logged_in() )
exit( '-1' );
if ( empty( $_POST['content'] ) )
exit( '-1<div id="message" class="error"><p>' . __( 'Please enter some content to post.', 'dp' ) . '</p></div>' );
$activity_id = 0;
if ( empty( $_POST['object'] ) && bp_is_active( 'activity' ) ) {
$activity_id = <API key>( array( 'content' => $_POST['content'] ) );
} elseif ( $_POST['object'] == 'groups' ) {
if ( ! empty( $_POST['item_id'] ) && bp_is_active( 'groups' ) )
$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) );
} else {
$activity_id = apply_filters( '<API key>', $_POST['object'], $_POST['item_id'], $_POST['content'] );
}
if ( empty( $activity_id ) )
exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem posting your update, please try again.', 'dp' ) . '</p></div>' );
if ( bp_has_activities ( 'include=' . $activity_id ) ) {
while ( bp_activities() ) {
bp_the_activity();
locate_template( array( 'activity/entry.php' ), true );
}
}
exit;
}
/**
* Posts new Activity comments received via a POST request.
*
* @global <API key> $activities_template
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
global $activities_template;
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check the nonce
check_admin_referer( '<API key>', '<API key>' );
if ( ! is_user_logged_in() )
exit( '-1' );
if ( empty( $_POST['content'] ) )
exit( '-1<div id="message" class="error"><p>' . __( 'Please do not leave the comment area blank.', 'dp' ) . '</p></div>' );
if ( empty( $_POST['form_id'] ) || empty( $_POST['comment_id'] ) || ! is_numeric( $_POST['form_id'] ) || ! is_numeric( $_POST['comment_id'] ) )
exit( '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'dp' ) . '</p></div>' );
$comment_id = <API key>( array(
'activity_id' => $_POST['form_id'],
'content' => $_POST['content'],
'parent_id' => $_POST['comment_id'],
) );
if ( ! $comment_id )
exit( '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'dp' ) . '</p></div>' );
// Load the new activity item into the $activities_template global
bp_has_activities( 'display_comments=stream&hide_spam=false&include=' . $comment_id );
// Swap the current comment with the activity item we just loaded
$activities_template->activity->id = $activities_template->activities[0]->item_id;
$activities_template->activity->current_comment = $activities_template->activities[0];
$template = locate_template( 'activity/comment.php', false, false );
/**
* Backward compatibility. In older versions of BP, the markup was
* generated in the PHP instead of a template. This ensures that
* older themes (which are not children of bp-default and won't
* have the new template) will still work.
*/
if ( empty( $template ) )
$template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php';
load_template( $template, false );
unset( $activities_template );
exit;
}
/**
* Deletes an Activity item received via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check the nonce
check_admin_referer( '<API key>' );
if ( ! is_user_logged_in() )
exit( '-1' );
if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) )
exit( '-1' );
$activity = new <API key>( (int) $_POST['id'] );
// Check access
if ( empty( $activity->user_id ) || ! <API key>( $activity ) )
exit( '-1' );
// Call the action before the delete so plugins can still fetch information about it
do_action( '<API key>', $activity->id, $activity->user_id );
if ( ! bp_activity_delete( array( 'id' => $activity->id, 'user_id' => $activity->user_id ) ) )
exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'dp' ) . '</p></div>' );
do_action( '<API key>', $activity->id, $activity->user_id );
exit;
}
/**
* Deletes an Activity comment received via a POST request
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check the nonce
check_admin_referer( '<API key>' );
if ( ! is_user_logged_in() )
exit( '-1' );
$comment = new <API key>( $_POST['id'] );
// Check access
if ( ! bp_current_user_can( 'bp_moderate' ) && $comment->user_id != bp_loggedin_user_id() )
exit( '-1' );
if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) )
exit( '-1' );
// Call the action before the delete so plugins can still fetch information about it
do_action( '<API key>', $_POST['id'], $comment->user_id );
if ( ! <API key>( $comment->item_id, $comment->id ) )
exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'dp' ) . '</p></div>' );
do_action( '<API key>', $_POST['id'], $comment->user_id );
exit;
}
/**
* AJAX spam an activity item or comment
*
* @global BuddyPress $bp The one true BuddyPress instance
* @return mixed String on error, void on success
* @since BuddyPress (1.6)
*/
function <API key>() {
global $bp;
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check that user is logged in, Activity Streams are enabled, and Akismet is present.
if ( ! is_user_logged_in() || ! bp_is_active( 'activity' ) || empty( $bp->activity->akismet ) )
exit( '-1' );
// Check an item ID was passed
if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) )
exit( '-1' );
// Is the current user allowed to spam items?
if ( ! <API key>() )
exit( '-1' );
// Load up the activity item
$activity = new <API key>( (int) $_POST['id'] );
if ( empty( $activity->component ) )
exit( '-1' );
// Check nonce
check_admin_referer( '<API key>' . $activity->id );
// Call an action before the spamming so plugins can modify things if they want to
do_action( '<API key>', $activity->id, $activity );
// Mark as spam
<API key>( $activity );
$activity->save();
do_action( '<API key>', $activity->id, $activity->user_id );
exit;
}
/**
* Mark an activity as a favourite via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( <API key>( $_POST['id'] ) )
_e( 'Remove Favorite', 'dp' );
else
_e( 'Favorite', 'dp' );
exit;
}
/**
* Un-favourite an activity via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( <API key>( $_POST['id'] ) )
_e( 'Favorite', 'dp' );
else
_e( 'Remove Favorite', 'dp' );
exit;
}
/**
* Fetches full an activity's full, non-excerpted content via a POST request.
* Used for the 'Read More' link on long activity items.
*
* @return string HTML
* @since BuddyPress (1.5)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
$activity_array = <API key>( array(
'activity_ids' => $_POST['activity_id'],
'display_comments' => 'stream'
) );
$activity = ! empty( $activity_array['activities'][0] ) ? $activity_array['activities'][0] : false;
if ( empty( $activity ) )
exit; // @todo: error?
do_action_ref_array( '<API key>', array( &$activity ) );
// Activity content retrieved through AJAX should run through normal filters, but not be truncated
remove_filter( '<API key>', '<API key>', 5 );
$content = apply_filters( '<API key>', $activity->content );
exit( $content );
}
/**
* Invites a friend to join a group via a POST request.
*
* @return unknown
* @since BuddyPress (1.2)
* @todo Audit return types
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
check_ajax_referer( '<API key>' );
if ( ! $_POST['friend_id'] || ! $_POST['friend_action'] || ! $_POST['group_id'] )
return;
if ( ! <API key>( $_POST['group_id'] ) )
return;
if ( ! <API key>( bp_loggedin_user_id(), $_POST['friend_id'] ) )
return;
if ( 'invite' == $_POST['friend_action'] ) {
if ( ! groups_invite_user( array( 'user_id' => $_POST['friend_id'], 'group_id' => $_POST['group_id'] ) ) )
return;
$user = new BP_Core_User( $_POST['friend_id'] );
echo '<li id="uid-' . $user->id . '">';
echo $user->avatar_thumb;
echo '<h4>' . $user->user_link . '</h4>';
echo '<span class="activity">' . esc_attr( $user->last_active ) . '</span>';
echo '<div class="action">
<a class="button remove" href="' . wp_nonce_url( <API key>() . bp_get_groups_slug() . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, '<API key>' ) . '" id="uid-' . esc_attr( $user->id ) . '">' . __( 'Remove Invite', 'dp' ) . '</a>
</div>';
echo '</li>';
exit;
} elseif ( 'uninvite' == $_POST['friend_action'] ) {
if ( ! <API key>( $_POST['friend_id'], $_POST['group_id'] ) )
return;
exit;
} else {
return;
}
}
/**
* Friend/un-friend a user via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( 'is_friend' == <API key>::check_is_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
check_ajax_referer( '<API key>' );
if ( ! <API key>( bp_loggedin_user_id(), $_POST['fid'] ) )
echo __( 'Friendship could not be canceled.', 'dp' );
else
echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'dp' ) . '" href="' . wp_nonce_url( <API key>() . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend' ) . '">' . __( 'Add Friend', 'dp' ) . '</a>';
} elseif ( 'not_friends' == <API key>::check_is_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
check_ajax_referer( 'friends_add_friend' );
if ( ! friends_add_friend( bp_loggedin_user_id(), $_POST['fid'] ) )
echo __(' Friendship could not be requested.', 'dp' );
else
echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Cancel Friendship Request', 'dp' ) . '" href="' . wp_nonce_url( <API key>() . bp_get_friends_slug() . '/requests/cancel/' . (int) $_POST['fid'] . '/', '<API key>' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'dp' ) . '</a>';
} elseif ( 'pending' == <API key>::check_is_friend( bp_loggedin_user_id(), (int) $_POST['fid'] ) ) {
check_ajax_referer( '<API key>' );
if ( <API key>( bp_loggedin_user_id(), (int) $_POST['fid'] ) )
echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'dp' ) . '" href="' . wp_nonce_url( <API key>() . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend' ) . '">' . __( 'Add Friend', 'dp' ) . '</a>';
else
echo __("Friendship request could not be cancelled.", 'dp');
} else {
echo __( 'Request Pending', 'dp' );
}
exit;
}
/**
* Accept a user friendship request via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
check_admin_referer( '<API key>' );
if ( ! <API key>( $_POST['id'] ) )
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem accepting that request. Please try again.', 'dp' ) . '</p></div>';
exit;
}
/**
* Reject a user friendship request via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
check_admin_referer( '<API key>' );
if ( ! <API key>( $_POST['id'] ) )
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem rejecting that request. Please try again.', 'dp' ) . '</p></div>';
exit;
}
/**
* Join or leave a group when clicking the "join/leave" button via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( <API key>( bp_loggedin_user_id(), $_POST['gid'] ) )
return;
if ( ! $group = groups_get_group( array( 'group_id' => $_POST['gid'] ) ) )
return;
if ( ! <API key>( bp_loggedin_user_id(), $group->id ) ) {
if ( 'public' == $group->status ) {
check_ajax_referer( 'groups_join_group' );
if ( ! groups_join_group( $group->id ) )
_e( 'Error joining group', 'dp' );
else
echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'dp' ) . '" href="' . wp_nonce_url( <API key>( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'dp' ) . '</a>';
} elseif ( 'private' == $group->status ) {
check_ajax_referer( '<API key>' );
if ( ! <API key>( bp_loggedin_user_id(), $group->id ) )
_e( 'Error requesting membership', 'dp' );
else
echo '<a id="group-' . esc_attr( $group->id ) . '" class="<API key>" rel="<API key>" title="' . __( 'Membership Requested', 'dp' ) . '" href="' . <API key>( $group ) . '">' . __( 'Membership Requested', 'dp' ) . '</a>';
}
} else {
check_ajax_referer( 'groups_leave_group' );
if ( ! groups_leave_group( $group->id ) )
_e( 'Error leaving group', 'dp' );
elseif ( 'public' == $group->status )
echo '<a id="group-' . esc_attr( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'dp' ) . '" href="' . wp_nonce_url( <API key>( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'dp' ) . '</a>';
elseif ( 'private' == $group->status )
echo '<a id="group-' . esc_attr( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'dp' ) . '" href="' . wp_nonce_url( <API key>( $group ) . 'request-membership', '<API key>' ) . '">' . __( 'Request Membership', 'dp' ) . '</a>';
}
exit;
}
/**
* Close and keep closed site wide notices from an admin in the sidebar, via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( ! isset( $_POST['notice_id'] ) ) {
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem closing the notice.', 'dp' ) . '</p></div>';
} else {
$user_id = get_current_user_id();
$notice_ids = bp_get_user_meta( $user_id, 'closed_notices', true );
$notice_ids[] = (int) $_POST['notice_id'];
bp_update_user_meta( $user_id, 'closed_notices', $notice_ids );
}
exit;
}
/**
* Send a private message reply to a thread via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
check_ajax_referer( '<API key>' );
$result = <API key>( array( 'thread_id' => $_REQUEST['thread_id'], 'content' => $_REQUEST['content'] ) );
if ( $result ) { ?>
<div class="message-box new-message">
<div class="message-metadata">
<?php do_action( '<API key>' ); ?>
<?php echo <API key>( 'type=thumb&width=30&height=30' ); ?>
<strong><a href="<?php echo <API key>(); ?>"><?php <API key>(); ?></a> <span class="activity"><?php printf( __( 'Sent %s', 'dp' ), bp_core_time_since( <API key>() ) ); ?></span></strong>
<?php do_action( '<API key>' ); ?>
</div>
<?php do_action( '<API key>' ); ?>
<div class="message-content">
<?php echo stripslashes( apply_filters( '<API key>', $_REQUEST['content'] ) ); ?>
</div>
<?php do_action( '<API key>' ); ?>
<div class="clear"></div>
</div>
<?php
} else {
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem sending that reply. Please try again.', 'dp' ) . '</p></div>';
}
exit;
}
/**
* Mark a private message as unread in your inbox via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( ! isset($_POST['thread_ids']) ) {
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem marking messages as unread.', 'dp' ) . '</p></div>';
} else {
$thread_ids = explode( ',', $_POST['thread_ids'] );
for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
BP_Messages_Thread::mark_as_unread($thread_ids[$i]);
}
}
exit;
}
/**
* Mark a private message as read in your inbox via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( ! isset($_POST['thread_ids']) ) {
echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as read.', 'dp' ) . '</p></div>';
} else {
$thread_ids = explode( ',', $_POST['thread_ids'] );
for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
BP_Messages_Thread::mark_as_read($thread_ids[$i]);
}
}
exit;
}
/**
* Delete a private message(s) in your inbox via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
if ( ! isset($_POST['thread_ids']) ) {
echo "-1<div id='message' class='error'><p>" . __( 'There was a problem deleting messages.', 'dp' ) . '</p></div>';
} else {
$thread_ids = explode( ',', $_POST['thread_ids'] );
for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i )
BP_Messages_Thread::delete($thread_ids[$i]);
_e( 'Messages deleted.', 'dp' );
}
exit;
}
/**
* AJAX handler for autocomplete. Displays friends only, unless <API key> is defined.
*
* @global BuddyPress $bp The one true BuddyPress instance
* @return string HTML
* @since BuddyPress (1.2)
*/
function <API key>() {
global $bp;
// Include everyone in the autocomplete, or just friends?
if ( <API key>( <API key>() ) )
$autocomplete_all = $bp->messages->autocomplete_all;
$pag_page = 1;
$limit = $_GET['limit'] ? $_GET['limit'] : apply_filters( '<API key>', 10 );
// Get the user ids based on the search terms
if ( ! empty( $autocomplete_all ) ) {
$users = BP_Core_User::search_users( $_GET['q'], $limit, $pag_page );
if ( ! empty( $users['users'] ) ) {
// Build an array with the correct format
$user_ids = array();
foreach( $users['users'] as $user ) {
if ( $user->id != bp_loggedin_user_id() )
$user_ids[] = $user->id;
}
$user_ids = apply_filters( '<API key>', $user_ids, $_GET['q'], $limit );
}
} else {
if ( bp_is_active( 'friends' ) ) {
$users = <API key>( $_GET['q'], bp_loggedin_user_id(), $limit, 1 );
// Keeping the <API key> filter for backward compatibility
$users = apply_filters( '<API key>', $users, $_GET['q'], $limit );
if ( ! empty( $users['friends'] ) )
$user_ids = apply_filters( '<API key>', $users['friends'], $_GET['q'], $limit );
}
}
if ( ! empty( $user_ids ) ) {
foreach ( $user_ids as $user_id ) {
$ud = get_userdata( $user_id );
if ( ! $ud )
continue;
if ( <API key>() )
$username = $ud->user_login;
else
$username = $ud->user_nicename;
// Note that the final line break acts as a delimiter for the
// autocomplete javascript and thus should not be removed
echo '<span id="link-' . $username . '" href="' . <API key>( $user_id ) . '"></span>' . <API key>( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15, 'alt' => $ud->display_name ) ) . ' ' . <API key>( $user_id ) . ' (' . $username . ')' . "\n";
}
}
exit;
}
?> |
using UnityEngine;
using System.Collections;
public class LogicSimpleRopes : MonoBehaviour
{
void OnGUI()
{
LogicGlobal.GlobalGUI();
GUILayout.Label("Simple persistent rope test (procedural rope and linkedobjects rope)");
GUILayout.Label("Move the mouse while holding down the left button to move the camera");
GUILayout.Label("Use the spacebar to shoot balls and aim for the ropes to test the physics");
}
} |
# Python class library loaded when the interpreter
# is installed by PythonEmbed
# API for accessing GC data
# basic activity data
def __GCactivity(join="repeat", activity=None):
rd={}
for x in range(0,GC.seriesLast()):
if (GC.seriesPresent(x, activity)):
rd[GC.seriesName(x)] = GC.series(x, activity)
for name in GC.xdataNames("", activity):
for serie in GC.xdataNames(name, activity):
xd = GC.xdata(name, serie, join, activity)
rd[str(xd)] = xd
return rd
# xdata
def __GCactivityXdata(name="", activity=None):
if not name:
return GC.xdataNames("")
rd={}
for serie in GC.xdataNames(name, activity):
xd = GC.xdataSeries(name, serie, activity)
rd[str(xd)] = xd
return rd
# setting up the chart
def __GCsetChart(title="",type=1,animate=False,legpos=2,stack=False,orientation=2):
GC.configChart(title,type,animate,legpos,stack,orientation)
# add a curve
def __GCsetCurve(name="",x=list(),y=list(),f=list(),xaxis="x",yaxis="y", labels=list(), colors=list(),line=1,symbol=1,size=15,color="cyan",opacity=0,opengl=True,legend=True,datalabels=False,fill=False):
if (name == ""):
raise ValueError("curve 'name' must be set and unique.")
GC.setCurve(name,list(x),list(y),list(f),xaxis,yaxis,list(labels),list(colors),line,symbol,size,color,opacity,opengl,legend,datalabels,fill)
# setting the axis
def __GCconfigAxis(name,visible=True,align=-1,min=-1,max=-1,type=-1,labelcolor="",color="",log=False,categories=list()):
if (name == ""):
raise ValueError("axis 'name' must be passed.")
GC.configAxis(name, visible, align, min, max, type, labelcolor, color, log, categories)
# adding annotations
def __GCannotate(type="label", series="", label="", value=0):
GC.addAnnotation(type,series,label,value)
# add to main GC entrypoint
GC.activity=__GCactivity
GC.activityXdata=__GCactivityXdata
GC.setChart=__GCsetChart
GC.addCurve=__GCsetCurve
GC.setAxis=__GCconfigAxis
GC.annotate=__GCannotate
# orientation
GC_HORIZONTAL=1
GC_VERTICAL=2
# line style
GC_LINE_NONE=0
GC_LINE_SOLID=1
GC_LINE_DASH=2
GC_LINE_DOT=3
GC_LINE_DASHDOT=4
# constants
GC_ALIGN_BOTTOM=0
GC_ALIGN_LEFT=1
GC_ALIGN_TOP=2
GC_ALIGN_RIGHT=3
# 0 reserved for uninitialised
GC.CHART_LINE=1
GC.CHART_SCATTER=2
GC.CHART_BAR=3
GC.CHART_PIE=4
GC.CHART_STACK=5
GC.CHART_PERCENT=6
# Axis type
GC.AXIS_CONTINUOUS=0
GC.AXIS_DATE=1
GC.AXIS_TIME=2
GC.AXIS_CATEGORY=3
GC.SERIES_SECS = 0
GC.SERIES_CAD = 1
GC.SERIES_CADD = 2
GC.SERIES_HR = 3
GC.SERIES_HRD = 4
GC.SERIES_KM = 5
GC.SERIES_KPH = 6
GC.SERIES_KPHD = 7
GC.SERIES_NM = 8
GC.SERIES_NMD = 9
GC.SERIES_WATTS = 10
GC.SERIES_WATTSD = 11
GC.SERIES_ALT = 12
GC.SERIES_LON = 13
GC.SERIES_LAT = 14
GC.SERIES_HEADWIND = 15
GC.SERIES_SLOPE = 16
GC.SERIES_TEMP = 17
GC.SERIES_INTERVAL = 18
GC.SERIES_NP = 19
GC.SERIES_XPOWER = 20
GC.SERIES_VAM = 21
GC.SERIES_WATTSKG = 22
GC.SERIES_LRBALANCE = 23
GC.SERIES_LTE = 24
GC.SERIES_RTE = 25
GC.SERIES_LPS = 26
GC.SERIES_RPS = 27
GC.SERIES_APOWER = 28
GC.SERIES_WPRIME = 29
GC.SERIES_ATISS = 30
GC.SERIES_ANTISS = 31
GC.SERIES_SMO2 = 32
GC.SERIES_THB = 33
GC.SERIES_RVERT = 34
GC.SERIES_RCAD = 35
GC.SERIES_RCONTACT = 36
GC.SERIES_GEAR = 37
GC.SERIES_O2HB = 38
GC.SERIES_HHB = 39
GC.SERIES_LPCO = 40
GC.SERIES_RPCO = 41
GC.SERIES_LPPB = 42
GC.SERIES_RPPB = 43
GC.SERIES_LPPE = 44
GC.SERIES_RPPE = 45
GC.SERIES_LPPPB = 46
GC.SERIES_RPPPB = 47
GC.SERIES_LPPPE = 48
GC.SERIES_RPPPE = 49
GC.SERIES_WBAL = 50
GC.SERIES_TCORE = 51
GC.SERIES_CLENGTH = 52
GC.SERIES_APOWERKG = 53
GC.SERIES_INDEX = 54 |
<?php
namespace Drupal\<API key>\Plugin\Purge\Queuer;
use Drupal\purge\Plugin\Purge\Queuer\QueuerBase;
use Drupal\purge\Plugin\Purge\Queuer\QueuerInterface;
/**
* Queues every tag that Drupal invalidates internally.
*
* @PurgeQueuer(
* id = "coretags",
* label = @Translation("Core tags queuer"),
* description = @Translation("Queues every tag that Drupal invalidates internally."),
* enable_by_default = true,
* configform = "\Drupal\<API key>\Form\ConfigurationForm",
* )
*/
class CoreTagsQueuer extends QueuerBase implements QueuerInterface {
} |
<?php
$config['plugin_more_load'] = '/test_app/plugins/test_plugin/config/more.load.php'; |
<?php
defined('_JEXEC') or die('Restricted access');
?><?php
class listsType{
function listsType(){
$listClass = acymailing_get('class.list');
$this->data = $listClass->getLists('listid');
$this->values = array();
$this->values[] = JHTML::_('select.option', '0', JText::_('ALL_LISTS') );
foreach($this->data as $onelist){
$this->values[] = JHTML::_('select.option', $onelist->listid, $onelist->name );
}
}
function display($map,$value,$js = true){
$onchange = $js ? 'onchange="document.adminForm.limitstart.value=0;document.adminForm.submit( );"' : '';
return JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox" style="max-width:200px" size="1" '.$onchange, 'value', 'text', (int) $value,str_replace(array('[',']'),array('_',''),$map) );
}
function getData(){
return $this->data;
}
} |
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "flags.h"
#include "ggc.h"
#include "output.h"
#include "libfuncs.h" /* For <API key>. */
#include "tree-iterator.h"
#include "gimple.h"
#include "ada.h"
#include "adadecode.h"
#include "types.h"
#include "atree.h"
#include "elists.h"
#include "namet.h"
#include "nlists.h"
#include "snames.h"
#include "stringt.h"
#include "uintp.h"
#include "urealp.h"
#include "fe.h"
#include "sinfo.h"
#include "einfo.h"
#include "gadaint.h"
#include "ada-tree.h"
#include "gigi.h"
/* We should avoid allocating more than ALLOCA_THRESHOLD bytes via alloca,
for fear of running out of stack space. If we need more, we use xmalloc
instead. */
#define ALLOCA_THRESHOLD 1000
/* Let code below know whether we are targetting VMS without need of
intrusive preprocessor directives. */
#ifndef TARGET_ABI_OPEN_VMS
#define TARGET_ABI_OPEN_VMS 0
#endif
/* In configurations where blocks have no end_locus attached, just
sink assignments into a dummy global. */
#ifndef <API key>
static location_t <API key>;
#define <API key>(BLOCK) <API key>
#endif
/* For efficient float-to-int rounding, it is necessary to know whether
floating-point arithmetic may use wider intermediate results. When
FP_ARITH_MAY_WIDEN is not defined, be conservative and only assume
that arithmetic does not widen if double precision is emulated. */
#ifndef FP_ARITH_MAY_WIDEN
#if defined(HAVE_extendsfdf2)
#define FP_ARITH_MAY_WIDEN HAVE_extendsfdf2
#else
#define FP_ARITH_MAY_WIDEN 0
#endif
#endif
/* Pointers to front-end tables accessed through macros. */
struct Node *Nodes_Ptr;
Node_Id *Next_Node_Ptr;
Node_Id *Prev_Node_Ptr;
struct Elist_Header *Elists_Ptr;
struct Elmt_Item *Elmts_Ptr;
struct String_Entry *Strings_Ptr;
Char_Code *String_Chars_Ptr;
struct List_Header *List_Headers_Ptr;
/* Highest number in the front-end node table. */
int max_gnat_nodes;
/* Current node being treated, in case abort called. */
Node_Id error_gnat_node;
/* True when gigi is being called on an analyzed but unexpanded
tree, and the only purpose of the call is to properly annotate
types with representation information. */
bool type_annotate_only;
/* Current filename without path. */
const char *ref_filename;
/* When not optimizing, we cache the 'First, 'Last and 'Length attributes
of unconstrained array IN parameters to avoid emitting a great deal of
redundant instructions to recompute them each time. */
struct GTY (()) parm_attr_d {
int id; /* GTY doesn't like Entity_Id. */
int dim;
tree first;
tree last;
tree length;
};
typedef struct parm_attr_d *parm_attr;
DEF_VEC_P(parm_attr);
DEF_VEC_ALLOC_P(parm_attr,gc);
struct GTY(()) language_function {
VEC(parm_attr,gc) *parm_attr_cache;
};
#define f_parm_attr_cache \
<API key> (<API key>)->language->parm_attr_cache
/* A structure used to gather together information about a statement group.
We use this to gather related statements, for example the "then" part
of a IF. In the case where it represents a lexical scope, we may also
have a BLOCK node corresponding to it and/or cleanups. */
struct GTY((chain_next ("%h.previous"))) stmt_group {
struct stmt_group *previous; /* Previous code group. */
tree stmt_list; /* List of statements for this code group. */
tree block; /* BLOCK for this code group, if any. */
tree cleanups; /* Cleanups for this code group, if any. */
};
static GTY(()) struct stmt_group *current_stmt_group;
/* List of unused struct stmt_group nodes. */
static GTY((deletable)) struct stmt_group *<API key>;
/* A structure used to record information on elaboration procedures
we've made and need to process.
??? gnat_node should be Node_Id, but gengtype gets confused. */
struct GTY((chain_next ("%h.next"))) elab_info {
struct elab_info *next; /* Pointer to next in chain. */
tree elab_proc; /* Elaboration procedure. */
int gnat_node; /* The N_Compilation_Unit. */
};
static GTY(()) struct elab_info *elab_info_list;
/* Stack of exception pointer variables. Each entry is the VAR_DECL
that stores the address of the raised exception. Nonzero means we
are in an exception handler. Not used in the zero-cost case. */
static GTY(()) VEC(tree,gc) *<API key>;
/* Stack for storing the current elaboration procedure decl. */
static GTY(()) VEC(tree,gc) *gnu_elab_proc_stack;
/* Stack of labels to be used as a goto target instead of a return in
some functions. See processing for N_Subprogram_Body. */
static GTY(()) VEC(tree,gc) *<API key>;
/* Stack of variable for the return value of a function with copy-in/copy-out
parameters. See processing for N_Subprogram_Body. */
static GTY(()) VEC(tree,gc) *<API key>;
/* Stack of LOOP_STMT nodes. */
static GTY(()) VEC(tree,gc) *<API key>;
/* The stacks for N_{Push,Pop}_*_Label. */
static GTY(()) VEC(tree,gc) *<API key>;
static GTY(()) VEC(tree,gc) *<API key>;
static GTY(()) VEC(tree,gc) *<API key>;
/* Map GNAT tree codes to GCC tree codes for simple expressions. */
static enum tree_code gnu_codes[Number_Node_Kinds];
static void init_code_table (void);
static void <API key> (Node_Id);
static void <API key> (Node_Id);
static void insert_code_for (Node_Id);
static void add_cleanup (tree, Node_Id);
static void add_stmt_list (List_Id);
static void <API key> (VEC(tree,gc) **, Entity_Id);
static tree build_stmt_group (List_Id, bool);
static enum gimplify_status gnat_gimplify_stmt (tree *);
static void <API key> (Node_Id);
static void <API key> (Node_Id);
static void process_decls (List_Id, List_Id, Node_Id, bool, bool);
static tree emit_range_check (tree, Node_Id, Node_Id);
static tree emit_index_check (tree, tree, tree, tree, Node_Id);
static tree emit_check (tree, tree, int, Node_Id);
static tree <API key> (enum tree_code, tree, tree, Node_Id);
static tree <API key> (enum tree_code, tree, tree, tree, Node_Id);
static tree convert_with_check (Entity_Id, tree, bool, bool, bool, Node_Id);
static bool smaller_form_type_p (tree, tree);
static bool addressable_p (tree, tree);
static tree <API key> (Entity_Id, Node_Id, tree);
static tree extract_values (tree, tree);
static tree pos_to_constructor (Node_Id, tree, Entity_Id);
static tree <API key> (tree);
static void <API key> (tree, Node_Id);
static bool <API key> (tree, Node_Id);
static void <API key> (tree, Node_Id);
static int lvalue_required_p (Node_Id, tree, bool, bool, bool);
static tree build_raise_check (int, tree, enum exception_info_kind);
/* Hooks for debug info back-ends, only supported and used in a restricted set
of configurations. */
static const char *extract_encoding (const char *) ATTRIBUTE_UNUSED;
static const char *decode_name (const char *) ATTRIBUTE_UNUSED;
/* This is the main program of the back-end. It sets up all the table
structures and then generates code. */
void
gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
struct Node *nodes_ptr, Node_Id *next_node_ptr, Node_Id *prev_node_ptr,
struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr,
struct String_Entry *strings_ptr, Char_Code *string_chars_ptr,
struct List_Header *list_headers_ptr, Nat number_file,
struct File_Info_Type *file_info_ptr,
Entity_Id standard_boolean, Entity_Id standard_integer,
Entity_Id standard_character, Entity_Id <API key>,
Entity_Id <API key>, Int gigi_operating_mode)
{
Entity_Id gnat_literal;
tree <API key>, exception_type, t;
tree int64_type = gnat_type_for_size (64, 0);
struct elab_info *info;
int i;
max_gnat_nodes = max_gnat_node;
Nodes_Ptr = nodes_ptr;
Next_Node_Ptr = next_node_ptr;
Prev_Node_Ptr = prev_node_ptr;
Elists_Ptr = elists_ptr;
Elmts_Ptr = elmts_ptr;
Strings_Ptr = strings_ptr;
String_Chars_Ptr = string_chars_ptr;
List_Headers_Ptr = list_headers_ptr;
type_annotate_only = (gigi_operating_mode == 1);
gcc_assert (Nkind (gnat_root) == N_Compilation_Unit);
/* Declare the name of the compilation unit as the first global
name in order to make the middle-end fully deterministic. */
t = create_concat_name (Defining_Entity (Unit (gnat_root)), NULL);
<API key> = ggc_strdup (IDENTIFIER_POINTER (t));
for (i = 0; i < number_file; i++)
{
/* Use the identifier table to make a permanent copy of the filename as
the name table gets reallocated after Gigi returns but before all the
debugging information is output. The <API key>
call translates filenames from pragmas Source_Reference that contain
host style syntax not understood by gdb. */
const char *filename
= IDENTIFIER_POINTER
(get_identifier
(<API key>
(Get_Name_String (file_info_ptr[i].File_Name))));
/* We rely on the order isomorphism between files and line maps. */
gcc_assert ((int) line_table->used == i);
/* We create the line map for a source file at once, with a fixed number
of columns chosen to avoid jumping over the next power of 2. */
linemap_add (line_table, LC_ENTER, 0, filename, 1);
linemap_line_start (line_table, file_info_ptr[i].Num_Source_Lines, 252);
<API key> (line_table, 252 - 1);
linemap_add (line_table, LC_LEAVE, 0, NULL, 0);
}
/* Initialize ourselves. */
init_code_table ();
init_gnat_to_gnu ();
init_dummy_type ();
/* If we are just annotating types, give VOID_TYPE zero sizes to avoid
errors. */
if (type_annotate_only)
{
TYPE_SIZE (void_type_node) = bitsize_zero_node;
TYPE_SIZE_UNIT (void_type_node) = size_zero_node;
}
/* Enable GNAT stack checking method if needed */
if (!<API key>)
<API key> ("_gnat_stack_check");
/* Retrieve alignment settings. */
<API key> = <API key> ();
<API key> = <API key> ();
/* Record the builtin types. Define `integer' and `character' first so that
dbx will output them first. */
record_builtin_type ("integer", integer_type_node);
record_builtin_type ("character", <API key>);
record_builtin_type ("boolean", boolean_type_node);
record_builtin_type ("void", void_type_node);
/* Save the type we made for integer as the type for Standard.Integer. */
save_gnu_tree (Base_Type (standard_integer),
TYPE_NAME (integer_type_node),
false);
/* Likewise for character as the type for Standard.Character. */
save_gnu_tree (Base_Type (standard_character),
TYPE_NAME (<API key>),
false);
/* Likewise for boolean as the type for Standard.Boolean. */
save_gnu_tree (Base_Type (standard_boolean),
TYPE_NAME (boolean_type_node),
false);
gnat_literal = First_Literal (Base_Type (standard_boolean));
t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
gcc_assert (t == boolean_false_node);
t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
boolean_type_node, t, true, false, false, false,
NULL, gnat_literal);
DECL_IGNORED_P (t) = 1;
save_gnu_tree (gnat_literal, t, false);
gnat_literal = Next_Literal (gnat_literal);
t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
gcc_assert (t == boolean_true_node);
t = create_var_decl (get_entity_name (gnat_literal), NULL_TREE,
boolean_type_node, t, true, false, false, false,
NULL, gnat_literal);
DECL_IGNORED_P (t) = 1;
save_gnu_tree (gnat_literal, t, false);
void_ftype = build_function_type (void_type_node, NULL_TREE);
ptr_void_ftype = build_pointer_type (void_ftype);
/* Now declare run-time functions. */
t = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
/* malloc is a function declaration tree for a function to allocate
memory. */
malloc_decl
= create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE,
build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE,
sizetype, t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc_decl) = 1;
/* malloc32 is a function declaration tree for a function to allocate
32-bit memory on a 64-bit system. Needed only on 64-bit VMS. */
malloc32_decl
= create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE,
build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE,
sizetype, t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc32_decl) = 1;
/* free is a function declaration tree for a function to free memory. */
free_decl
= create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
NULL_TREE, false, true, true, NULL, Empty);
/* This is used for 64-bit multiplication with overflow checking. */
mulv64_decl
= create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE,
<API key> (int64_type, int64_type,
int64_type, NULL_TREE),
NULL_TREE, false, true, true, NULL, Empty);
/* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent));
/* Name of the Exception_Data type defined in System.Standard_Library. */
<API key>
= get_identifier ("<API key>");
/* Make the types and functions used for exception processing. */
jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0),
build_index_type (size_int (5)));
record_builtin_type ("JMPBUF_T", jmpbuf_type);
jmpbuf_ptr_type = build_pointer_type (jmpbuf_type);
/* Functions to get and set the jumpbuf pointer for the current thread. */
get_jmpbuf_decl
= create_subprog_decl
(get_identifier ("<API key>"),
NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IGNORED_P (get_jmpbuf_decl) = 1;
set_jmpbuf_decl
= create_subprog_decl
(get_identifier ("<API key>"),
NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IGNORED_P (set_jmpbuf_decl) = 1;
/* setjmp returns an integer and has one operand, which is a pointer to
a jmpbuf. */
setjmp_decl
= create_subprog_decl
(get_identifier ("__builtin_setjmp"), NULL_TREE,
build_function_type (integer_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
/* update_setjmp_buf updates a setjmp buffer from the current stack pointer
address. */
<API key>
= create_subprog_decl
(get_identifier ("<API key>"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (<API key>) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (<API key>) = <API key>;
/* Hooks to call when entering/leaving an exception handler. */
begin_handler_decl
= create_subprog_decl (get_identifier ("<API key>"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IGNORED_P (begin_handler_decl) = 1;
end_handler_decl
= create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
ptr_void_type_node,
t)),
NULL_TREE, false, true, true, NULL, Empty);
DECL_IGNORED_P (end_handler_decl) = 1;
/* If in no exception handlers mode, all raise statements are redirected to
<API key>. No need to redefine raise_nodefer_decl since
this procedure will never be called in this mode. */
if (<API key> ())
{
tree decl
= create_subprog_decl
(get_identifier ("<API key>"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type
(<API key>),
tree_cons (NULL_TREE,
integer_type_node,
t))),
NULL_TREE, false, true, true, NULL, Empty);
TREE_THIS_VOLATILE (decl) = 1;
TREE_SIDE_EFFECTS (decl) = 1;
TREE_TYPE (decl)
= <API key> (TREE_TYPE (decl), TYPE_QUAL_VOLATILE);
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++)
gnat_raise_decls[i] = decl;
}
else
{
/* Otherwise, make one decl for each exception reason. */
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++)
gnat_raise_decls[i] = build_raise_check (i, t, exception_simple);
for (i = 0; i < (int) ARRAY_SIZE (<API key>); i++)
<API key>[i]
= build_raise_check (i, t,
i == <API key>
|| i == <API key>
|| i == CE_Invalid_Data
? exception_range : exception_column);
}
/* Set the types that GCC and Gigi use from the front end. */
exception_type
= gnat_to_gnu_entity (Base_Type (<API key>), NULL_TREE, 0);
except_type_node = TREE_TYPE (exception_type);
/* Make other functions used for exception processing. */
get_excptr_decl
= create_subprog_decl
(get_identifier ("<API key>"),
NULL_TREE,
build_function_type (build_pointer_type (except_type_node), NULL_TREE),
NULL_TREE, false, true, true, NULL, Empty);
raise_nodefer_decl
= create_subprog_decl
(get_identifier ("<API key>"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type (except_type_node),
t)),
NULL_TREE, false, true, true, NULL, Empty);
/* Indicate that these never return. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
TREE_SIDE_EFFECTS (raise_nodefer_decl) = 1;
TREE_TYPE (raise_nodefer_decl)
= <API key> (TREE_TYPE (raise_nodefer_decl),
TYPE_QUAL_VOLATILE);
/* Build the special descriptor type and its null node if needed. */
if (<API key>)
{
tree null_node = fold_convert (ptr_void_ftype, null_pointer_node);
tree field_list = NULL_TREE;
int j;
VEC(constructor_elt,gc) *null_vec = NULL;
constructor_elt *elt;
fdesc_type_node = make_node (RECORD_TYPE);
VEC_safe_grow (constructor_elt, gc, null_vec,
<API key>);
elt = (VEC_address (constructor_elt,null_vec)
+ <API key> - 1);
for (j = 0; j < <API key>; j++)
{
tree field
= create_field_decl (NULL_TREE, ptr_void_ftype, fdesc_type_node,
NULL_TREE, NULL_TREE, 0, 1);
TREE_CHAIN (field) = field_list;
field_list = field;
elt->index = field;
elt->value = null_node;
elt
}
finish_record_type (fdesc_type_node, nreverse (field_list), 0, false);
record_builtin_type ("descriptor", fdesc_type_node);
null_fdesc_node = <API key> (fdesc_type_node, null_vec);
}
<API key>
= gnat_to_gnu_entity (Base_Type (<API key>), NULL_TREE, 0);
if (TREE_CODE (TREE_TYPE (<API key>)) == INTEGER_TYPE)
{
/* In this case, the builtin floating point types are VAX float,
so make up a type for use. */
<API key> = make_node (REAL_TYPE);
TYPE_PRECISION (<API key>) = <API key>;
layout_type (<API key>);
record_builtin_type ("longest float type", <API key>);
}
else
<API key> = TREE_TYPE (<API key>);
/* Dummy objects to materialize "others" and "all others" in the exception
tables. These are exported by a-exexpr.adb, so see this unit for the
types to use. */
others_decl
= create_var_decl (get_identifier ("OTHERS"),
get_identifier ("__gnat_others_value"),
integer_type_node, NULL_TREE, true, false, true, false,
NULL, Empty);
all_others_decl
= create_var_decl (get_identifier ("ALL_OTHERS"),
get_identifier ("<API key>"),
integer_type_node, NULL_TREE, true, false, true, false,
NULL, Empty);
<API key> = get_identifier ("main");
/* Install the builtins we might need, either internally or as
user available facilities for Intrinsic imports. */
<API key> ();
VEC_safe_push (tree, gc, <API key>, NULL_TREE);
VEC_safe_push (tree, gc, <API key>, NULL_TREE);
VEC_safe_push (tree, gc, <API key>, NULL_TREE);
VEC_safe_push (tree, gc, <API key>, NULL_TREE);
/* Process any Pragma Ident for the main unit. */
#ifdef ASM_OUTPUT_IDENT
if (Present (Ident_String (Main_Unit)))
ASM_OUTPUT_IDENT
(asm_out_file,
TREE_STRING_POINTER (gnat_to_gnu (Ident_String (Main_Unit))));
#endif
/* If we are using the GCC exception mechanism, let GCC know. */
if (Exception_Mechanism == Back_End_Exceptions)
gnat_init_gcc_eh ();
/* Now translate the compilation unit proper. */
<API key> (gnat_root);
/* Finally see if we have any elaboration procedures to deal with. */
for (info = elab_info_list; info; info = info->next)
{
tree gnu_body = DECL_SAVED_TREE (info->elab_proc), gnu_stmts;
/* We should have a BIND_EXPR but it may not have any statements in it.
If it doesn't have any, we have nothing to do except for setting the
flag on the GNAT node. Otherwise, process the function as others. */
gnu_stmts = gnu_body;
if (TREE_CODE (gnu_stmts) == BIND_EXPR)
gnu_stmts = BIND_EXPR_BODY (gnu_stmts);
if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts))
<API key> (info->gnat_node, 1);
else
{
begin_subprog_body (info->elab_proc);
end_subprog_body (gnu_body);
}
}
/* We cannot track the location of errors past this point. */
error_gnat_node = Empty;
}
/* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given
CHECK (if EXTENDED is false), or <API key> (if EXTENDED is
true). */
static tree
build_raise_check (int check, tree void_tree, enum exception_info_kind kind)
{
char name[21];
tree result;
if (kind != exception_simple)
{
sprintf (name, "__gnat_rcheck_%.2d_ext", check);
result
= create_subprog_decl
(get_identifier (name), NULL_TREE,
build_function_type
(void_type_node,
tree_cons
(NULL_TREE, build_pointer_type (<API key>),
tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE, integer_type_node,
kind == exception_column
? void_tree
: tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE,
integer_type_node,
void_tree)))))),
NULL_TREE, false, true, true, NULL, Empty);
}
else
{
sprintf (name, "__gnat_rcheck_%.2d", check);
result
= create_subprog_decl
(get_identifier (name), NULL_TREE,
build_function_type
(void_type_node,
tree_cons
(NULL_TREE, build_pointer_type (<API key>),
tree_cons (NULL_TREE, integer_type_node, void_tree))),
NULL_TREE, false, true, true, NULL, Empty);
}
TREE_THIS_VOLATILE (result) = 1;
TREE_SIDE_EFFECTS (result) = 1;
TREE_TYPE (result)
= <API key> (TREE_TYPE (result), TYPE_QUAL_VOLATILE);
return result;
}
/* Return a positive value if an lvalue is required for GNAT_NODE, which is
an <API key>. */
static int
<API key> (Node_Id gnat_node)
{
switch (Get_Attribute_Id (Attribute_Name (gnat_node)))
{
case Attr_Pos:
case Attr_Val:
case Attr_Pred:
case Attr_Succ:
case Attr_First:
case Attr_Last:
case Attr_Range_Length:
case Attr_Length:
case Attr_Object_Size:
case Attr_Value_Size:
case Attr_Component_Size:
case <API key>:
case Attr_Min:
case Attr_Max:
case Attr_Null_Parameter:
case <API key>:
case Attr_Mechanism_Code:
return 0;
case Attr_Address:
case Attr_Access:
case <API key>:
case <API key>:
case Attr_Code_Address:
case Attr_Pool_Address:
case Attr_Size:
case Attr_Alignment:
case Attr_Bit_Position:
case Attr_Position:
case Attr_First_Bit:
case Attr_Last_Bit:
case Attr_Bit:
default:
return 1;
}
}
/* Return a positive value if an lvalue is required for GNAT_NODE. GNU_TYPE
is the type that will be used for GNAT_NODE in the translated GNU tree.
CONSTANT indicates whether the underlying object represented by GNAT_NODE
is constant in the Ada sense. If it is, ADDRESS_OF_CONSTANT indicates
whether its value is the address of a constant and ALIASED whether it is
aliased. If it isn't, ADDRESS_OF_CONSTANT and ALIASED are ignored.
The function climbs up the GNAT tree starting from the node and returns 1
upon encountering a node that effectively requires an lvalue downstream.
It returns int instead of bool to facilitate usage in non-purely binary
logic contexts. */
static int
lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
bool address_of_constant, bool aliased)
{
Node_Id gnat_parent = Parent (gnat_node), gnat_temp;
switch (Nkind (gnat_parent))
{
case N_Reference:
return 1;
case <API key>:
return <API key> (gnat_parent);
case <API key>:
case N_Function_Call:
case <API key>:
/* If the parameter is by reference, an lvalue is required. */
return (!constant
|| must_pass_by_ref (gnu_type)
|| default_pass_by_ref (gnu_type));
case N_Indexed_Component:
/* Only the array expression can require an lvalue. */
if (Prefix (gnat_parent) != gnat_node)
return 0;
/* ??? Consider that referencing an indexed component with a
non-constant index forces the whole aggregate to memory.
Note that N_Integer_Literal is conservative, any static
expression in the RM sense could probably be accepted. */
for (gnat_temp = First (Expressions (gnat_parent));
Present (gnat_temp);
gnat_temp = Next (gnat_temp))
if (Nkind (gnat_temp) != N_Integer_Literal)
return 1;
/* ... fall through ... */
case N_Slice:
/* Only the array expression can require an lvalue. */
if (Prefix (gnat_parent) != gnat_node)
return 0;
aliased |= <API key> (Etype (gnat_node));
return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased);
case <API key>:
aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent)));
return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased);
case <API key>:
/* We need to make a real renaming only if the constant object is
aliased or if we may use a renaming pointer; otherwise we can
optimize and return the rvalue. We make an exception if the object
is an identifier since in this case the rvalue can be propagated
attached to the CONST_DECL. */
return (!constant
|| aliased
/* This should match the constant case of the renaming code. */
|| Is_Composite_Type
(Underlying_Type (Etype (Name (gnat_parent))))
|| Nkind (Name (gnat_parent)) == N_Identifier);
case <API key>:
/* We cannot use a constructor if this is an atomic object because
the actual assignment might end up being done component-wise. */
return (!constant
||(Is_Composite_Type (Underlying_Type (Etype (gnat_node)))
&& Is_Atomic (Defining_Entity (gnat_parent)))
/* We don't use a constructor if this is a class-wide object
because the effective type of the object is the equivalent
type of the class-wide subtype and it smashes most of the
data into an array of bytes to which we cannot convert. */
|| Ekind ((Etype (Defining_Entity (gnat_parent))))
== <API key>);
case <API key>:
/* We cannot use a constructor if the LHS is an atomic object because
the actual assignment might end up being done component-wise. */
return (!constant
|| Name (gnat_parent) == gnat_node
|| (Is_Composite_Type (Underlying_Type (Etype (gnat_node)))
&& Is_Atomic (Entity (Name (gnat_parent)))));
case <API key>:
if (!constant)
return 1;
/* ... fall through ... */
case N_Type_Conversion:
case <API key>:
/* We must look through all conversions because we may need to bypass
an intermediate conversion that is meant to be purely formal. */
return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)),
constant, address_of_constant, aliased);
case N_Allocator:
/* We should only reach here through the <API key> case.
Force an lvalue for composite types since a block-copy to the newly
allocated area of memory is made. */
return Is_Composite_Type (Underlying_Type (Etype (gnat_node)));
case <API key>:
/* We look through dereferences for address of constant because we need
to handle the special cases listed above. */
if (constant && address_of_constant)
return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)),
true, false, true);
/* ... fall through ... */
default:
return 0;
}
gcc_unreachable ();
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Identifier,
to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer
to where we should place the result type. */
static tree
Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
{
Node_Id gnat_temp, gnat_temp_type;
tree gnu_result, gnu_result_type;
/* Whether we should require an lvalue for GNAT_NODE. Needed in
specific circumstances only, so evaluated lazily. < 0 means
unknown, > 0 means known true, 0 means known false. */
int require_lvalue = -1;
/* If GNAT_NODE is a constant, whether we should use the initialization
value instead of the constant entity, typically for scalars with an
address clause when the parent doesn't require an lvalue. */
bool <API key> = false;
gnat_temp = (Nkind (gnat_node) == <API key>
? gnat_node : Entity (gnat_node));
gnat_temp_type = Etype (gnat_temp);
gcc_assert (Etype (gnat_node) == gnat_temp_type
|| (Is_Packed (gnat_temp_type)
&& Etype (gnat_node) == Packed_Array_Type (gnat_temp_type))
|| (Is_Class_Wide_Type (Etype (gnat_node)))
|| (IN (Ekind (gnat_temp_type), Private_Kind)
&& Present (Full_View (gnat_temp_type))
&& ((Etype (gnat_node) == Full_View (gnat_temp_type))
|| (Is_Packed (Full_View (gnat_temp_type))
&& (Etype (gnat_node)
== Packed_Array_Type (Full_View
(gnat_temp_type))))))
|| (Is_Itype (Etype (gnat_node)) && Is_Itype (gnat_temp_type))
|| !(Ekind (gnat_temp) == E_Variable
|| Ekind (gnat_temp) == E_Component
|| Ekind (gnat_temp) == E_Constant
|| Ekind (gnat_temp) == E_Loop_Parameter
|| IN (Ekind (gnat_temp), Formal_Kind)));
/* If this is a reference to a deferred constant whose partial view is an
unconstrained private type, the proper type is on the full view of the
constant, not on the full view of the type, which may be unconstrained.
This may be a reference to a type, for example in the prefix of the
attribute Position, generated for dispatching code (see Make_DT in
exp_disp,adb). In that case we need the type itself, not is parent,
in particular if it is a derived type */
if (Is_Private_Type (gnat_temp_type)
&& <API key> (gnat_temp_type)
&& Ekind (gnat_temp) == E_Constant
&& Present (Full_View (gnat_temp)))
{
gnat_temp = Full_View (gnat_temp);
gnat_temp_type = Etype (gnat_temp);
}
else
{
/* We want to use the Actual_Subtype if it has already been elaborated,
otherwise the Etype. Avoid using Actual_Subtype for packed arrays to
simplify things. */
if ((Ekind (gnat_temp) == E_Constant
|| Ekind (gnat_temp) == E_Variable || Is_Formal (gnat_temp))
&& !(Is_Array_Type (Etype (gnat_temp))
&& Present (Packed_Array_Type (Etype (gnat_temp))))
&& Present (Actual_Subtype (gnat_temp))
&& present_gnu_tree (Actual_Subtype (gnat_temp)))
gnat_temp_type = Actual_Subtype (gnat_temp);
else
gnat_temp_type = Etype (gnat_node);
}
/* Expand the type of this identifier first, in case it is an enumeral
literal, which only get made when the type is expanded. There is no
<API key> issue here. */
gnu_result_type = get_unpadded_type (gnat_temp_type);
/* If this is a non-imported scalar constant with an address clause,
retrieve the value instead of a pointer to be dereferenced unless
an lvalue is required. This is generally more efficient and actually
required if this is a static expression because it might be used
in a context where a dereference is inappropriate, such as a case
statement alternative or a record discriminant. There is no possible
volatile-ness short-circuit here since Volatile constants must be
imported per C.6. */
if (Ekind (gnat_temp) == E_Constant
&& Is_Scalar_Type (gnat_temp_type)
&& !Is_Imported (gnat_temp)
&& Present (Address_Clause (gnat_temp)))
{
require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true,
false, Is_Aliased (gnat_temp));
<API key> = !require_lvalue;
}
if (<API key>)
{
/* If this is a deferred constant, the initializer is attached to
the full view. */
if (Present (Full_View (gnat_temp)))
gnat_temp = Full_View (gnat_temp);
gnu_result = gnat_to_gnu (Expression (Declaration_Node (gnat_temp)));
}
else
gnu_result = gnat_to_gnu_entity (gnat_temp, NULL_TREE, 0);
/* Some objects (such as parameters passed by reference, globals of
variable size, and renamed objects) actually represent the address
of the object. In that case, we must do the dereference. Likewise,
deal with parameters to foreign convention subprograms. */
if (DECL_P (gnu_result)
&& (DECL_BY_REF_P (gnu_result)
|| (TREE_CODE (gnu_result) == PARM_DECL
&& <API key> (gnu_result))))
{
const bool read_only = <API key> (gnu_result);
tree renamed_obj;
if (TREE_CODE (gnu_result) == PARM_DECL
&& <API key> (gnu_result))
{
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
if (TREE_CODE (gnu_result) == INDIRECT_REF)
TREE_THIS_NOTRAP (gnu_result) = 1;
}
if (TREE_CODE (gnu_result) == PARM_DECL
&& <API key> (gnu_result))
{
gnu_result
= build_unary_op (INDIRECT_REF, NULL_TREE,
convert (build_pointer_type (gnu_result_type),
gnu_result));
if (TREE_CODE (gnu_result) == INDIRECT_REF)
TREE_THIS_NOTRAP (gnu_result) = 1;
}
/* If it's a renaming pointer and we are at the right binding level,
we can reference the renamed object directly, since the renamed
expression has been protected against multiple evaluations. */
else if (TREE_CODE (gnu_result) == VAR_DECL
&& (renamed_obj = DECL_RENAMED_OBJECT (gnu_result))
&& (!<API key> (gnu_result)
|| global_bindings_p ()))
gnu_result = renamed_obj;
/* Return the underlying CST for a CONST_DECL like a few lines below,
after dereferencing in this case. */
else if (TREE_CODE (gnu_result) == CONST_DECL)
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE,
DECL_INITIAL (gnu_result));
else
{
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
if (TREE_CODE (gnu_result) == INDIRECT_REF
&& No (Address_Clause (gnat_temp)))
TREE_THIS_NOTRAP (gnu_result) = 1;
}
if (read_only)
TREE_READONLY (gnu_result) = 1;
}
/* The GNAT tree has the type of a function as the type of its result. Also
use the type of the result if the Etype is a subtype which is nominally
unconstrained. But remove any padding from the resulting type. */
if (TREE_CODE (TREE_TYPE (gnu_result)) == FUNCTION_TYPE
|| <API key> (gnat_temp_type))
{
gnu_result_type = TREE_TYPE (gnu_result);
if (TYPE_IS_PADDING_P (gnu_result_type))
gnu_result_type = TREE_TYPE (TYPE_FIELDS (gnu_result_type));
}
/* If we have a constant declaration and its initializer, try to return the
latter to avoid the need to call fold in lots of places and the need for
elaboration code if this identifier is used as an initializer itself. */
if (TREE_CONSTANT (gnu_result)
&& DECL_P (gnu_result)
&& DECL_INITIAL (gnu_result))
{
bool constant_only = (TREE_CODE (gnu_result) == CONST_DECL
&& !<API key> (gnu_result));
bool address_of_constant = (TREE_CODE (gnu_result) == CONST_DECL
&& <API key> (gnu_result));
/* If there is a (corresponding) variable or this is the address of a
constant, we only want to return the initializer if an lvalue isn't
required. Evaluate this now if we have not already done so. */
if ((!constant_only || address_of_constant) && require_lvalue < 0)
require_lvalue
= lvalue_required_p (gnat_node, gnu_result_type, true,
address_of_constant, Is_Aliased (gnat_temp));
/* ??? We need to unshare the initializer if the object is external
as such objects are not marked for unsharing if we are not at the
global level. This should be fixed in add_decl_expr. */
if ((constant_only && !address_of_constant) || !require_lvalue)
gnu_result = unshare_expr (DECL_INITIAL (gnu_result));
}
*gnu_result_type_p = gnu_result_type;
return gnu_result;
}
/* Subroutine of gnat_to_gnu to process gnat_node, an N_Pragma. Return
any statements we generate. */
static tree
Pragma_to_gnu (Node_Id gnat_node)
{
Node_Id gnat_temp;
tree gnu_result = alloc_stmt_list ();
/* Check for (and ignore) unrecognized pragma and do nothing if we are just
annotating types. */
if (type_annotate_only
|| !Is_Pragma_Name (Chars (Pragma_Identifier (gnat_node))))
return gnu_result;
switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_node))))
{
case <API key>:
/* Do nothing at top level: all such variables are already viewable. */
if (global_bindings_p ())
break;
for (gnat_temp = First (<API key> (gnat_node));
Present (gnat_temp);
gnat_temp = Next (gnat_temp))
{
Node_Id gnat_expr = Expression (gnat_temp);
tree gnu_expr = gnat_to_gnu (gnat_expr);
int use_address;
enum machine_mode mode;
tree asm_constraint = NULL_TREE;
#ifdef ASM_COMMENT_START
char *comment;
#endif
if (TREE_CODE (gnu_expr) == <API key>)
gnu_expr = TREE_OPERAND (gnu_expr, 0);
/* Use the value only if it fits into a normal register,
otherwise use the address. */
mode = TYPE_MODE (TREE_TYPE (gnu_expr));
use_address = ((GET_MODE_CLASS (mode) != MODE_INT
&& GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
|| GET_MODE_SIZE (mode) > UNITS_PER_WORD);
if (use_address)
gnu_expr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr);
#ifdef ASM_COMMENT_START
comment = concat (ASM_COMMENT_START,
" inspection point: ",
Get_Name_String (Chars (gnat_expr)),
use_address ? " address" : "",
" is in %0",
NULL);
asm_constraint = build_string (strlen (comment), comment);
free (comment);
#endif
gnu_expr = build5 (ASM_EXPR, void_type_node,
asm_constraint,
NULL_TREE,
tree_cons
(build_tree_list (NULL_TREE,
build_string (1, "g")),
gnu_expr, NULL_TREE),
NULL_TREE, NULL_TREE);
ASM_VOLATILE_P (gnu_expr) = 1;
<API key> (gnu_expr, gnat_node);
<API key> (gnu_expr, &gnu_result);
}
break;
case Pragma_Optimize:
switch (Chars (Expression
(First (<API key> (gnat_node)))))
{
case Name_Time: case Name_Space:
if (!optimize)
post_error ("insufficient -O value?", gnat_node);
break;
case Name_Off:
if (optimize)
post_error ("must specify -O0?", gnat_node);
break;
default:
gcc_unreachable ();
}
break;
case Pragma_Reviewable:
if (write_symbols == NO_DEBUG)
post_error ("must specify -g?", gnat_node);
break;
}
return gnu_result;
}
/* Subroutine of gnat_to_gnu to translate GNAT_NODE, an N_Attribute node,
to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to
where we should place the result type. ATTRIBUTE is the attribute ID. */
static tree
Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
{
tree gnu_prefix = gnat_to_gnu (Prefix (gnat_node));
tree gnu_type = TREE_TYPE (gnu_prefix);
tree gnu_expr, gnu_result_type, gnu_result = error_mark_node;
bool prefix_unused = false;
/* If the input is a NULL_EXPR, make a new one. */
if (TREE_CODE (gnu_prefix) == NULL_EXPR)
{
gnu_result_type = get_unpadded_type (Etype (gnat_node));
*gnu_result_type_p = gnu_result_type;
return build1 (NULL_EXPR, gnu_result_type, TREE_OPERAND (gnu_prefix, 0));
}
switch (attribute)
{
case Attr_Pos:
case Attr_Val:
/* These are just conversions since representation clauses for
enumeration types are handled in the front-end. */
{
bool checkp = Do_Range_Check (First (Expressions (gnat_node)));
gnu_result = gnat_to_gnu (First (Expressions (gnat_node)));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = convert_with_check (Etype (gnat_node), gnu_result,
checkp, checkp, true, gnat_node);
}
break;
case Attr_Pred:
case Attr_Succ:
/* These just add or subtract the constant 1 since representation
clauses for enumeration types are handled in the front-end. */
gnu_expr = gnat_to_gnu (First (Expressions (gnat_node)));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (Do_Range_Check (First (Expressions (gnat_node))))
{
gnu_expr = gnat_protect_expr (gnu_expr);
gnu_expr
= emit_check
(build_binary_op (EQ_EXPR, boolean_type_node,
gnu_expr,
attribute == Attr_Pred
? TYPE_MIN_VALUE (gnu_result_type)
: TYPE_MAX_VALUE (gnu_result_type)),
gnu_expr, <API key>, gnat_node);
}
gnu_result
= build_binary_op (attribute == Attr_Pred ? MINUS_EXPR : PLUS_EXPR,
gnu_result_type, gnu_expr,
convert (gnu_result_type, integer_one_node));
break;
case Attr_Address:
case <API key>:
/* Conversions don't change addresses but can cause us to miss the
COMPONENT_REF case below, so strip them off. */
gnu_prefix = remove_conversions (gnu_prefix,
!<API key> (gnat_node));
/* If we are taking 'Address of an unconstrained object, this is the
pointer to the underlying array. */
if (attribute == Attr_Address)
gnu_prefix = <API key> (gnu_prefix);
/* If we are building a static dispatch table, we have to honor
<API key> if we want to be compatible
with the C++ ABI. We do it in the non-static case as well,
see gnat_to_gnu_entity, case <API key>. */
else if (<API key>
&& <API key> (Etype (gnat_node)))
{
tree gnu_field, t;
/* Descriptors can only be built here for top-level functions. */
bool build_descriptor = (global_bindings_p () != 0);
int i;
VEC(constructor_elt,gc) *gnu_vec = NULL;
constructor_elt *elt;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If we're not going to build the descriptor, we have to retrieve
the one which will be built by the linker (or by the compiler
later if a static chain is requested). */
if (!build_descriptor)
{
gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_prefix);
gnu_result = fold_convert (build_pointer_type (gnu_result_type),
gnu_result);
gnu_result = build1 (INDIRECT_REF, gnu_result_type, gnu_result);
}
VEC_safe_grow (constructor_elt, gc, gnu_vec,
<API key>);
elt = (VEC_address (constructor_elt, gnu_vec)
+ <API key> - 1);
for (gnu_field = TYPE_FIELDS (gnu_result_type), i = 0;
i < <API key>;
gnu_field = TREE_CHAIN (gnu_field), i++)
{
if (build_descriptor)
{
t = build2 (FDESC_EXPR, TREE_TYPE (gnu_field), gnu_prefix,
build_int_cst (NULL_TREE, i));
TREE_CONSTANT (t) = 1;
}
else
t = build3 (COMPONENT_REF, ptr_void_ftype, gnu_result,
gnu_field, NULL_TREE);
elt->index = gnu_field;
elt->value = t;
elt
}
gnu_result = <API key> (gnu_result_type, gnu_vec);
break;
}
/* ... fall through ... */
case Attr_Access:
case <API key>:
case Attr_Code_Address:
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result
= build_unary_op (((attribute == Attr_Address
|| attribute == <API key>)
&& !<API key> (gnat_node))
? ATTR_ADDR_EXPR : ADDR_EXPR,
gnu_result_type, gnu_prefix);
/* For 'Code_Address, find an inner ADDR_EXPR and mark it so that we
don't try to build a trampoline. */
if (attribute == Attr_Code_Address)
{
for (gnu_expr = gnu_result;
CONVERT_EXPR_P (gnu_expr);
gnu_expr = TREE_OPERAND (gnu_expr, 0))
TREE_CONSTANT (gnu_expr) = 1;
if (TREE_CODE (gnu_expr) == ADDR_EXPR)
TREE_NO_TRAMPOLINE (gnu_expr) = TREE_CONSTANT (gnu_expr) = 1;
}
/* For other address attributes applied to a nested function,
find an inner ADDR_EXPR and annotate it so that we can issue
a useful warning with -Wtrampolines. */
else if (TREE_CODE (TREE_TYPE (gnu_prefix)) == FUNCTION_TYPE)
{
for (gnu_expr = gnu_result;
CONVERT_EXPR_P (gnu_expr);
gnu_expr = TREE_OPERAND (gnu_expr, 0))
;
if (TREE_CODE (gnu_expr) == ADDR_EXPR
&& <API key> (TREE_OPERAND (gnu_expr, 0)))
{
<API key> (gnu_expr, gnat_node);
/* Check that we're not violating the <API key>
restriction. Be conservative if we don't know anything
about the trampoline strategy for the target. */
<API key> (gnat_node);
}
}
break;
case Attr_Pool_Address:
{
tree gnu_obj_type;
tree gnu_ptr = gnu_prefix;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If this is an unconstrained array, we know the object has been
allocated with the template in front of the object. So compute
the template address. */
if (<API key> (TREE_TYPE (gnu_ptr)))
gnu_ptr
= convert (build_pointer_type
(<API key>
(<API key> (TREE_TYPE (gnu_ptr)))),
gnu_ptr);
gnu_obj_type = TREE_TYPE (TREE_TYPE (gnu_ptr));
if (TREE_CODE (gnu_obj_type) == RECORD_TYPE
&& <API key> (gnu_obj_type))
{
tree gnu_char_ptr_type
= build_pointer_type (<API key>);
tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type,
gnu_ptr, gnu_pos);
}
gnu_result = convert (gnu_result_type, gnu_ptr);
}
break;
case Attr_Size:
case Attr_Object_Size:
case Attr_Value_Size:
case <API key>:
gnu_expr = gnu_prefix;
/* Remove NOPs and conversions between original and packable version
from GNU_EXPR, and conversions from GNU_PREFIX. We use GNU_EXPR
to see if a COMPONENT_REF was involved. */
while (TREE_CODE (gnu_expr) == NOP_EXPR
|| (TREE_CODE (gnu_expr) == VIEW_CONVERT_EXPR
&& TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))
== RECORD_TYPE
&& TYPE_NAME (TREE_TYPE (gnu_expr))
== TYPE_NAME (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))))
gnu_expr = TREE_OPERAND (gnu_expr, 0);
gnu_prefix = remove_conversions (gnu_prefix, true);
prefix_unused = true;
gnu_type = TREE_TYPE (gnu_prefix);
/* Replace an unconstrained array type with the type of the underlying
array. We can't do this with a call to <API key>
since we may have a TYPE_DECL. For '<API key>,
use the record type that will be used to allocate the object and its
template. */
if (TREE_CODE (gnu_type) == <API key>)
{
gnu_type = <API key> (gnu_type);
if (attribute != <API key>)
gnu_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_type)));
}
/* If we're looking for the size of a field, return the field size.
Otherwise, if the prefix is an object, or if we're looking for
'Object_Size or '<API key>, the result is the
GCC size of the type. Otherwise, it is the RM size of the type. */
if (TREE_CODE (gnu_prefix) == COMPONENT_REF)
gnu_result = DECL_SIZE (TREE_OPERAND (gnu_prefix, 1));
else if (TREE_CODE (gnu_prefix) != TYPE_DECL
|| attribute == Attr_Object_Size
|| attribute == <API key>)
{
/* If the prefix is an object of a padded type, the GCC size isn't
relevant to the programmer. Normally what we want is the RM size,
which was set from the specified size, but if it was not set, we
want the size of the field. Using the MAX of those two produces
the right result in all cases. Don't use the size of the field
if it's self-referential, since that's never what's wanted. */
if (TREE_CODE (gnu_prefix) != TYPE_DECL
&& TYPE_IS_PADDING_P (gnu_type)
&& TREE_CODE (gnu_expr) == COMPONENT_REF)
{
gnu_result = rm_size (gnu_type);
if (!<API key>
(DECL_SIZE (TREE_OPERAND (gnu_expr, 1))))
gnu_result
= size_binop (MAX_EXPR, gnu_result,
DECL_SIZE (TREE_OPERAND (gnu_expr, 1)));
}
else if (Nkind (Prefix (gnat_node)) == <API key>)
{
Node_Id gnat_deref = Prefix (gnat_node);
Node_Id gnat_actual_subtype
= <API key> (gnat_deref);
tree gnu_ptr_type
= TREE_TYPE (gnat_to_gnu (Prefix (gnat_deref)));
if (<API key> (gnu_ptr_type)
&& Present (gnat_actual_subtype))
{
tree gnu_actual_obj_type
= gnat_to_gnu_type (gnat_actual_subtype);
gnu_type
= <API key> (gnu_ptr_type,
gnu_actual_obj_type,
get_identifier ("SIZE"),
false);
}
gnu_result = TYPE_SIZE (gnu_type);
}
else
gnu_result = TYPE_SIZE (gnu_type);
}
else
gnu_result = rm_size (gnu_type);
/* Deal with a self-referential size by returning the maximum size for
a type and by qualifying the size with the object otherwise. */
if (<API key> (gnu_result))
{
if (TREE_CODE (gnu_prefix) == TYPE_DECL)
gnu_result = max_size (gnu_result, true);
else
gnu_result = <API key> (gnu_result, gnu_expr);
}
/* If the type contains a template, subtract its size. */
if (TREE_CODE (gnu_type) == RECORD_TYPE
&& <API key> (gnu_type))
gnu_result = size_binop (MINUS_EXPR, gnu_result,
DECL_SIZE (TYPE_FIELDS (gnu_type)));
/* For '<API key>, adjust the unit. */
if (attribute == <API key>)
gnu_result = size_binop (CEIL_DIV_EXPR, gnu_result, bitsize_unit_node);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case Attr_Alignment:
{
unsigned int align;
if (TREE_CODE (gnu_prefix) == COMPONENT_REF
&& TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_prefix, 0))))
gnu_prefix = TREE_OPERAND (gnu_prefix, 0);
gnu_type = TREE_TYPE (gnu_prefix);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
prefix_unused = true;
if (TREE_CODE (gnu_prefix) == COMPONENT_REF)
align = DECL_ALIGN (TREE_OPERAND (gnu_prefix, 1)) / BITS_PER_UNIT;
else
{
Node_Id gnat_prefix = Prefix (gnat_node);
Entity_Id gnat_type = Etype (gnat_prefix);
unsigned int double_align;
bool is_capped_double, align_clause;
/* If the default alignment of "double" or larger scalar types is
specifically capped and there is an alignment clause neither
on the type nor on the prefix itself, return the cap. */
if ((double_align = <API key>) > 0)
is_capped_double
= <API key> (gnat_type, &align_clause);
else if ((double_align = <API key>) > 0)
is_capped_double
= <API key> (gnat_type, &align_clause);
else
is_capped_double = align_clause = false;
if (is_capped_double
&& Nkind (gnat_prefix) == N_Identifier
&& Present (Alignment_Clause (Entity (gnat_prefix))))
align_clause = true;
if (is_capped_double && !align_clause)
align = double_align;
else
align = TYPE_ALIGN (gnu_type) / BITS_PER_UNIT;
}
gnu_result = size_int (align);
}
break;
case Attr_First:
case Attr_Last:
case Attr_Range_Length:
prefix_unused = true;
if (INTEGRAL_TYPE_P (gnu_type) || TREE_CODE (gnu_type) == REAL_TYPE)
{
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (attribute == Attr_First)
gnu_result = TYPE_MIN_VALUE (gnu_type);
else if (attribute == Attr_Last)
gnu_result = TYPE_MAX_VALUE (gnu_type);
else
gnu_result
= build_binary_op
(MAX_EXPR, get_base_type (gnu_result_type),
build_binary_op
(PLUS_EXPR, get_base_type (gnu_result_type),
build_binary_op (MINUS_EXPR,
get_base_type (gnu_result_type),
convert (gnu_result_type,
TYPE_MAX_VALUE (gnu_type)),
convert (gnu_result_type,
TYPE_MIN_VALUE (gnu_type))),
convert (gnu_result_type, integer_one_node)),
convert (gnu_result_type, integer_zero_node));
break;
}
/* ... fall through ... */
case Attr_Length:
{
int Dimension = (Present (Expressions (gnat_node))
? UI_To_Int (Intval (First (Expressions (gnat_node))))
: 1), i;
struct parm_attr_d *pa = NULL;
Entity_Id gnat_param = Empty;
/* Make sure any implicit dereference gets done. */
gnu_prefix = <API key> (gnu_prefix);
gnu_prefix = <API key> (gnu_prefix);
/* We treat unconstrained array In parameters specially. */
if (Nkind (Prefix (gnat_node)) == N_Identifier
&& !Is_Constrained (Etype (Prefix (gnat_node)))
&& Ekind (Entity (Prefix (gnat_node))) == E_In_Parameter)
gnat_param = Entity (Prefix (gnat_node));
gnu_type = TREE_TYPE (gnu_prefix);
prefix_unused = true;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (<API key> (gnu_type))
{
int ndim;
tree gnu_type_temp;
for (ndim = 1, gnu_type_temp = gnu_type;
TREE_CODE (TREE_TYPE (gnu_type_temp)) == ARRAY_TYPE
&& TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type_temp));
ndim++, gnu_type_temp = TREE_TYPE (gnu_type_temp))
;
Dimension = ndim + 1 - Dimension;
}
for (i = 1; i < Dimension; i++)
gnu_type = TREE_TYPE (gnu_type);
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
/* When not optimizing, look up the slot associated with the parameter
and the dimension in the cache and create a new one on failure. */
if (!optimize && Present (gnat_param))
{
FOR_EACH_VEC_ELT (parm_attr, f_parm_attr_cache, i, pa)
if (pa->id == gnat_param && pa->dim == Dimension)
break;
if (!pa)
{
pa = <API key> ();
pa->id = gnat_param;
pa->dim = Dimension;
VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa);
}
}
/* Return the cached expression or build a new one. */
if (attribute == Attr_First)
{
if (pa && pa->first)
{
gnu_result = pa->first;
break;
}
gnu_result
= TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type)));
}
else if (attribute == Attr_Last)
{
if (pa && pa->last)
{
gnu_result = pa->last;
break;
}
gnu_result
= TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type)));
}
else /* attribute == Attr_Range_Length || attribute == Attr_Length */
{
if (pa && pa->length)
{
gnu_result = pa->length;
break;
}
else
{
/* We used to compute the length as max (hb - lb + 1, 0),
which could overflow for some cases of empty arrays, e.g.
when lb == index_type'first. We now compute the length as
(hb >= lb) ? hb - lb + 1 : 0, which would only overflow in
much rarer cases, for extremely large arrays we expect
never to encounter in practice. In addition, the former
computation required the use of potentially constraining
signed arithmetic while the latter doesn't. Note that
the comparison must be done in the original index type,
to avoid any overflow during the conversion. */
tree comp_type = get_base_type (gnu_result_type);
tree index_type = TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type));
tree lb = TYPE_MIN_VALUE (index_type);
tree hb = TYPE_MAX_VALUE (index_type);
gnu_result
= build_binary_op (PLUS_EXPR, comp_type,
build_binary_op (MINUS_EXPR,
comp_type,
convert (comp_type, hb),
convert (comp_type, lb)),
convert (comp_type, integer_one_node));
gnu_result
= build_cond_expr (comp_type,
build_binary_op (GE_EXPR,
boolean_type_node,
hb, lb),
gnu_result,
convert (comp_type, integer_zero_node));
}
}
/* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
handling. Note that these attributes could not have been used on
an unconstrained array type. */
gnu_result = <API key> (gnu_result, gnu_prefix);
/* Cache the expression we have just computed. Since we want to do it
at run time, we force the use of a SAVE_EXPR and let the gimplifier
create the temporary in the outermost binding level. We will make
sure in <API key> that it is evaluated on all possible
paths by forcing its evaluation on entry of the function. */
if (pa)
{
gnu_result
= build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result);
if (attribute == Attr_First)
pa->first = gnu_result;
else if (attribute == Attr_Last)
pa->last = gnu_result;
else
pa->length = gnu_result;
}
/* Set the source location onto the predicate of the condition in the
'Length case but do not do it if the expression is cached to avoid
messing up the debug info. */
else if ((attribute == Attr_Range_Length || attribute == Attr_Length)
&& TREE_CODE (gnu_result) == COND_EXPR
&& EXPR_P (TREE_OPERAND (gnu_result, 0)))
<API key> (TREE_OPERAND (gnu_result, 0),
gnat_node);
break;
}
case Attr_Bit_Position:
case Attr_Position:
case Attr_First_Bit:
case Attr_Last_Bit:
case Attr_Bit:
{
HOST_WIDE_INT bitsize;
HOST_WIDE_INT bitpos;
tree gnu_offset;
tree gnu_field_bitpos;
tree gnu_field_offset;
tree gnu_inner;
enum machine_mode mode;
int unsignedp, volatilep;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_prefix = remove_conversions (gnu_prefix, true);
prefix_unused = true;
/* We can have 'Bit on any object, but if it isn't a COMPONENT_REF,
the result is 0. Don't allow 'Bit on a bare component, though. */
if (attribute == Attr_Bit
&& TREE_CODE (gnu_prefix) != COMPONENT_REF
&& TREE_CODE (gnu_prefix) != FIELD_DECL)
{
gnu_result = integer_zero_node;
break;
}
else
gcc_assert (TREE_CODE (gnu_prefix) == COMPONENT_REF
|| (attribute == Attr_Bit_Position
&& TREE_CODE (gnu_prefix) == FIELD_DECL));
get_inner_reference (gnu_prefix, &bitsize, &bitpos, &gnu_offset,
&mode, &unsignedp, &volatilep, false);
if (TREE_CODE (gnu_prefix) == COMPONENT_REF)
{
gnu_field_bitpos = bit_position (TREE_OPERAND (gnu_prefix, 1));
gnu_field_offset = byte_position (TREE_OPERAND (gnu_prefix, 1));
for (gnu_inner = TREE_OPERAND (gnu_prefix, 0);
TREE_CODE (gnu_inner) == COMPONENT_REF
&& DECL_INTERNAL_P (TREE_OPERAND (gnu_inner, 1));
gnu_inner = TREE_OPERAND (gnu_inner, 0))
{
gnu_field_bitpos
= size_binop (PLUS_EXPR, gnu_field_bitpos,
bit_position (TREE_OPERAND (gnu_inner, 1)));
gnu_field_offset
= size_binop (PLUS_EXPR, gnu_field_offset,
byte_position (TREE_OPERAND (gnu_inner, 1)));
}
}
else if (TREE_CODE (gnu_prefix) == FIELD_DECL)
{
gnu_field_bitpos = bit_position (gnu_prefix);
gnu_field_offset = byte_position (gnu_prefix);
}
else
{
gnu_field_bitpos = bitsize_zero_node;
gnu_field_offset = size_zero_node;
}
switch (attribute)
{
case Attr_Position:
gnu_result = gnu_field_offset;
break;
case Attr_First_Bit:
case Attr_Bit:
gnu_result = size_int (bitpos % BITS_PER_UNIT);
break;
case Attr_Last_Bit:
gnu_result = bitsize_int (bitpos % BITS_PER_UNIT);
gnu_result = size_binop (PLUS_EXPR, gnu_result,
TYPE_SIZE (TREE_TYPE (gnu_prefix)));
gnu_result = size_binop (MINUS_EXPR, gnu_result,
bitsize_one_node);
break;
case Attr_Bit_Position:
gnu_result = gnu_field_bitpos;
break;
}
/* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
handling. */
gnu_result = <API key> (gnu_result, gnu_prefix);
break;
}
case Attr_Min:
case Attr_Max:
{
tree gnu_lhs = gnat_to_gnu (First (Expressions (gnat_node)));
tree gnu_rhs = gnat_to_gnu (Next (First (Expressions (gnat_node))));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = build_binary_op (attribute == Attr_Min
? MIN_EXPR : MAX_EXPR,
gnu_result_type, gnu_lhs, gnu_rhs);
}
break;
case <API key>:
gnu_result = size_int (default_pass_by_ref (gnu_type)
|| must_pass_by_ref (gnu_type));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case Attr_Component_Size:
if (TREE_CODE (gnu_prefix) == COMPONENT_REF
&& TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_prefix, 0))))
gnu_prefix = TREE_OPERAND (gnu_prefix, 0);
gnu_prefix = <API key> (gnu_prefix);
gnu_type = TREE_TYPE (gnu_prefix);
if (TREE_CODE (gnu_type) == <API key>)
gnu_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_type))));
while (TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE
&& TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type)))
gnu_type = TREE_TYPE (gnu_type);
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
/* Note this size cannot be self-referential. */
gnu_result = TYPE_SIZE (TREE_TYPE (gnu_type));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
prefix_unused = true;
break;
case Attr_Null_Parameter:
/* This is just a zero cast to the pointer type for our prefix and
dereferenced. */
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result
= build_unary_op (INDIRECT_REF, NULL_TREE,
convert (build_pointer_type (gnu_result_type),
integer_zero_node));
TREE_PRIVATE (gnu_result) = 1;
break;
case Attr_Mechanism_Code:
{
int code;
Entity_Id gnat_obj = Entity (Prefix (gnat_node));
prefix_unused = true;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (Present (Expressions (gnat_node)))
{
int i = UI_To_Int (Intval (First (Expressions (gnat_node))));
for (gnat_obj = First_Formal (gnat_obj); i > 1;
i--, gnat_obj = Next_Formal (gnat_obj))
;
}
code = Mechanism (gnat_obj);
if (code == Default)
code = ((present_gnu_tree (gnat_obj)
&& (DECL_BY_REF_P (get_gnu_tree (gnat_obj))
|| ((TREE_CODE (get_gnu_tree (gnat_obj))
== PARM_DECL)
&& (<API key>
(get_gnu_tree (gnat_obj))))))
? By_Reference : By_Copy);
gnu_result = convert (gnu_result_type, size_int (- code));
}
break;
default:
/* Say we have an unimplemented attribute. Then set the value to be
returned to be a zero and hope that's something we can convert to
the type of this attribute. */
post_error ("unimplemented attribute", gnat_node);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = integer_zero_node;
break;
}
/* If this is an attribute where the prefix was unused, force a use of it if
it has a side-effect. But don't do it if the prefix is just an entity
name. However, if an access check is needed, we must do it. See second
example in AARM 11.6(5.e). */
if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix)
&& !Is_Entity_Name (Prefix (gnat_node)))
gnu_result = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix,
gnu_result);
*gnu_result_type_p = gnu_result_type;
return gnu_result;
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Case_Statement,
to a GCC tree, which is returned. */
static tree
<API key> (Node_Id gnat_node)
{
tree gnu_result, gnu_expr, gnu_label;
Node_Id gnat_when;
location_t end_locus;
bool may_fallthru = false;
gnu_expr = gnat_to_gnu (Expression (gnat_node));
gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
/* The range of values in a case statement is determined by the rules in
RM 5.4(7-9). In almost all cases, this range is represented by the Etype
of the expression. One exception arises in the case of a simple name that
is parenthesized. This still has the Etype of the name, but since it is
not a name, para 7 does not apply, and we need to go to the base type.
This is the only case where parenthesization affects the dynamic
semantics (i.e. the range of possible values at run time that is covered
by the others alternative).
Another exception is if the subtype of the expression is non-static. In
that case, we also have to use the base type. */
if (Paren_Count (Expression (gnat_node)) != 0
|| !<API key> (Underlying_Type
(Etype (Expression (gnat_node)))))
gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
/* We build a SWITCH_EXPR that contains the code with interspersed
CASE_LABEL_EXPRs for each label. */
if (!Sloc_to_locus (Sloc (gnat_node) + UI_To_Int (End_Span (gnat_node)),
&end_locus))
end_locus = input_location;
gnu_label = <API key> (end_locus);
start_stmt_group ();
for (gnat_when = First_Non_Pragma (Alternatives (gnat_node));
Present (gnat_when);
gnat_when = Next_Non_Pragma (gnat_when))
{
bool choices_added_p = false;
Node_Id gnat_choice;
/* First compile all the different case choices for the current WHEN
alternative. */
for (gnat_choice = First (Discrete_Choices (gnat_when));
Present (gnat_choice); gnat_choice = Next (gnat_choice))
{
tree gnu_low = NULL_TREE, gnu_high = NULL_TREE;
switch (Nkind (gnat_choice))
{
case N_Range:
gnu_low = gnat_to_gnu (Low_Bound (gnat_choice));
gnu_high = gnat_to_gnu (High_Bound (gnat_choice));
break;
case <API key>:
gnu_low = gnat_to_gnu (Low_Bound (Range_Expression
(Constraint (gnat_choice))));
gnu_high = gnat_to_gnu (High_Bound (Range_Expression
(Constraint (gnat_choice))));
break;
case N_Identifier:
case N_Expanded_Name:
/* This represents either a subtype range or a static value of
some kind; Ekind says which. */
if (IN (Ekind (Entity (gnat_choice)), Type_Kind))
{
tree gnu_type = get_unpadded_type (Entity (gnat_choice));
gnu_low = fold (TYPE_MIN_VALUE (gnu_type));
gnu_high = fold (TYPE_MAX_VALUE (gnu_type));
break;
}
/* ... fall through ... */
case N_Character_Literal:
case N_Integer_Literal:
gnu_low = gnat_to_gnu (gnat_choice);
break;
case N_Others_Choice:
break;
default:
gcc_unreachable ();
}
/* If the case value is a subtype that raises Constraint_Error at
run time because of a wrong bound, then gnu_low or gnu_high is
not translated into an INTEGER_CST. In such a case, we need
to ensure that the when statement is not added in the tree,
otherwise it will crash the gimplifier. */
if ((!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST)
&& (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST))
{
add_stmt_with_node (build3
(CASE_LABEL_EXPR, void_type_node,
gnu_low, gnu_high,
<API key> (input_location)),
gnat_choice);
choices_added_p = true;
}
}
/* Push a binding level here in case variables are declared as we want
them to be local to this set of statements instead of to the block
containing the Case statement. */
if (choices_added_p)
{
tree group = build_stmt_group (Statements (gnat_when), true);
bool group_may_fallthru = block_may_fallthru (group);
add_stmt (group);
if (group_may_fallthru)
{
tree stmt = build1 (GOTO_EXPR, void_type_node, gnu_label);
SET_EXPR_LOCATION (stmt, end_locus);
add_stmt (stmt);
may_fallthru = true;
}
}
}
/* Now emit a definition of the label the cases branch to, if any. */
if (may_fallthru)
add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_label));
gnu_result = build3 (SWITCH_EXPR, TREE_TYPE (gnu_expr), gnu_expr,
end_stmt_group (), NULL_TREE);
return gnu_result;
}
/* Return true if VAL (of type TYPE) can equal the minimum value if MAX is
false, or the maximum value if MAX is true, of TYPE. */
static bool
<API key> (tree val, tree type, bool max)
{
tree min_or_max_val = (max ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type));
if (TREE_CODE (min_or_max_val) != INTEGER_CST)
return true;
if (TREE_CODE (val) == NOP_EXPR)
val = (max
? TYPE_MAX_VALUE (TREE_TYPE (TREE_OPERAND (val, 0)))
: TYPE_MIN_VALUE (TREE_TYPE (TREE_OPERAND (val, 0))));
if (TREE_CODE (val) != INTEGER_CST)
return true;
return tree_int_cst_equal (val, min_or_max_val) == 1;
}
/* Return true if VAL (of type TYPE) can equal the minimum value of TYPE.
If REVERSE is true, minimum value is taken as maximum value. */
static inline bool
can_equal_min_val_p (tree val, tree type, bool reverse)
{
return <API key> (val, type, reverse);
}
/* Return true if VAL (of type TYPE) can equal the maximum value of TYPE.
If REVERSE is true, maximum value is taken as minimum value. */
static inline bool
can_equal_max_val_p (tree val, tree type, bool reverse)
{
return <API key> (val, type, !reverse);
}
/* Return true if VAL1 can be lower than VAL2. */
static bool
can_be_lower_p (tree val1, tree val2)
{
if (TREE_CODE (val1) == NOP_EXPR)
val1 = TYPE_MIN_VALUE (TREE_TYPE (TREE_OPERAND (val1, 0)));
if (TREE_CODE (val1) != INTEGER_CST)
return true;
if (TREE_CODE (val2) == NOP_EXPR)
val2 = TYPE_MAX_VALUE (TREE_TYPE (TREE_OPERAND (val2, 0)));
if (TREE_CODE (val2) != INTEGER_CST)
return true;
return tree_int_cst_lt (val1, val2);
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Loop_Statement,
to a GCC tree, which is returned. */
static tree
<API key> (Node_Id gnat_node)
{
const Node_Id gnat_iter_scheme = Iteration_Scheme (gnat_node);
tree gnu_loop_stmt = build4 (LOOP_STMT, void_type_node, NULL_TREE,
NULL_TREE, NULL_TREE, NULL_TREE);
tree gnu_loop_label = <API key> (input_location);
tree gnu_loop_var = NULL_TREE, gnu_cond_expr = NULL_TREE;
tree gnu_result;
/* Set location information for statement and end label. */
<API key> (gnu_loop_stmt, gnat_node);
Sloc_to_locus (Sloc (End_Label (gnat_node)),
&<API key> (gnu_loop_label));
LOOP_STMT_LABEL (gnu_loop_stmt) = gnu_loop_label;
/* Save the end label of this LOOP_STMT in a stack so that a corresponding
N_Exit_Statement can find it. */
VEC_safe_push (tree, gc, <API key>, gnu_loop_label);
/* Set the condition under which the loop must keep going.
For the case "LOOP .... END LOOP;" the condition is always true. */
if (No (gnat_iter_scheme))
;
/* For the case "WHILE condition LOOP ..... END LOOP;" it's immediate. */
else if (Present (Condition (gnat_iter_scheme)))
LOOP_STMT_COND (gnu_loop_stmt)
= gnat_to_gnu (Condition (gnat_iter_scheme));
/* Otherwise we have an iteration scheme and the condition is given by the
bounds of the subtype of the iteration variable. */
else
{
Node_Id gnat_loop_spec = <API key> (gnat_iter_scheme);
Entity_Id gnat_loop_var = Defining_Entity (gnat_loop_spec);
Entity_Id gnat_type = Etype (gnat_loop_var);
tree gnu_type = get_unpadded_type (gnat_type);
tree gnu_low = TYPE_MIN_VALUE (gnu_type);
tree gnu_high = TYPE_MAX_VALUE (gnu_type);
tree gnu_base_type = get_base_type (gnu_type);
tree gnu_one_node = convert (gnu_base_type, integer_one_node);
tree gnu_first, gnu_last;
enum tree_code update_code, test_code, shift_code;
bool reverse = Reverse_Present (gnat_loop_spec), fallback = false;
/* We must disable modulo reduction for the iteration variable, if any,
in order for the loop comparison to be effective. */
if (reverse)
{
gnu_first = gnu_high;
gnu_last = gnu_low;
update_code = MINUS_NOMOD_EXPR;
test_code = GE_EXPR;
shift_code = PLUS_NOMOD_EXPR;
}
else
{
gnu_first = gnu_low;
gnu_last = gnu_high;
update_code = PLUS_NOMOD_EXPR;
test_code = LE_EXPR;
shift_code = MINUS_NOMOD_EXPR;
}
/* We use two different strategies to translate the loop, depending on
whether optimization is enabled.
If it is, we try to generate the canonical form of loop expected by
the loop optimizer, which is the do-while form:
ENTRY_COND
loop:
TOP_UPDATE
BODY
BOTTOM_COND
GOTO loop
This makes it possible to bypass loop header copying and to turn the
BOTTOM_COND into an inequality test. This should catch (almost) all
loops with constant starting point. If we cannot, we try to generate
the default form, which is:
loop:
TOP_COND
BODY
BOTTOM_UPDATE
GOTO loop
It will be rotated during loop header copying and an entry test added
to yield the do-while form. This should catch (almost) all loops with
constant ending point. If we cannot, we generate the fallback form:
ENTRY_COND
loop:
BODY
BOTTOM_COND
BOTTOM_UPDATE
GOTO loop
which works in all cases but for which loop header copying will copy
the BOTTOM_COND, thus adding a third conditional branch.
If optimization is disabled, loop header copying doesn't come into
play and we try to generate the loop forms with the less conditional
branches directly. First, the default form, it should catch (almost)
all loops with constant ending point. Then, if we cannot, we try to
generate the shifted form:
loop:
TOP_COND
TOP_UPDATE
BODY
GOTO loop
which should catch loops with constant starting point. Otherwise, if
we cannot, we generate the fallback form. */
if (optimize)
{
/* We can use the do-while form if GNU_FIRST-1 doesn't overflow. */
if (!can_equal_min_val_p (gnu_first, gnu_base_type, reverse))
{
gnu_first = build_binary_op (shift_code, gnu_base_type,
gnu_first, gnu_one_node);
<API key> (gnu_loop_stmt) = 1;
<API key> (gnu_loop_stmt) = 1;
}
/* Otherwise, we can use the default form if GNU_LAST+1 doesn't. */
else if (!can_equal_max_val_p (gnu_last, gnu_base_type, reverse))
;
/* Otherwise, use the fallback form. */
else
fallback = true;
}
else
{
/* We can use the default form if GNU_LAST+1 doesn't overflow. */
if (!can_equal_max_val_p (gnu_last, gnu_base_type, reverse))
;
/* Otherwise, we can use the shifted form if neither GNU_FIRST-1 nor
GNU_LAST-1 does. */
else if (!can_equal_min_val_p (gnu_first, gnu_base_type, reverse)
&& !can_equal_min_val_p (gnu_last, gnu_base_type, reverse))
{
gnu_first = build_binary_op (shift_code, gnu_base_type,
gnu_first, gnu_one_node);
gnu_last = build_binary_op (shift_code, gnu_base_type,
gnu_last, gnu_one_node);
<API key> (gnu_loop_stmt) = 1;
}
/* Otherwise, use the fallback form. */
else
fallback = true;
}
if (fallback)
<API key> (gnu_loop_stmt) = 1;
/* If we use the BOTTOM_COND, we can turn the test into an inequality
test but we may have to add ENTRY_COND to protect the empty loop. */
if (<API key> (gnu_loop_stmt))
{
test_code = NE_EXPR;
if (can_be_lower_p (gnu_high, gnu_low))
{
gnu_cond_expr
= build3 (COND_EXPR, void_type_node,
build_binary_op (LE_EXPR, boolean_type_node,
gnu_low, gnu_high),
NULL_TREE, alloc_stmt_list ());
<API key> (gnu_cond_expr, gnat_loop_spec);
}
}
/* Open a new nesting level that will surround the loop to declare the
iteration variable. */
start_stmt_group ();
gnat_pushlevel ();
/* Declare the iteration variable and set it to its initial value. */
gnu_loop_var = gnat_to_gnu_entity (gnat_loop_var, gnu_first, 1);
if (DECL_BY_REF_P (gnu_loop_var))
gnu_loop_var = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_loop_var);
/* Do all the arithmetics in the base type. */
gnu_loop_var = convert (gnu_base_type, gnu_loop_var);
/* Set either the top or bottom exit condition. */
LOOP_STMT_COND (gnu_loop_stmt)
= build_binary_op (test_code, boolean_type_node, gnu_loop_var,
gnu_last);
/* Set either the top or bottom update statement and give it the source
location of the iteration for better coverage info. */
LOOP_STMT_UPDATE (gnu_loop_stmt)
= build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_loop_var,
build_binary_op (update_code, gnu_base_type,
gnu_loop_var, gnu_one_node));
<API key> (LOOP_STMT_UPDATE (gnu_loop_stmt),
gnat_iter_scheme);
}
/* If the loop was named, have the name point to this loop. In this case,
the association is not a DECL node, but the end label of the loop. */
if (Present (Identifier (gnat_node)))
save_gnu_tree (Entity (Identifier (gnat_node)), gnu_loop_label, true);
/* Make the loop body into its own block, so any allocated storage will be
released every iteration. This is needed for stack allocation. */
LOOP_STMT_BODY (gnu_loop_stmt)
= build_stmt_group (Statements (gnat_node), true);
TREE_SIDE_EFFECTS (gnu_loop_stmt) = 1;
/* If we declared a variable, then we are in a statement group for that
declaration. Add the LOOP_STMT to it and make that the "loop". */
if (gnu_loop_var)
{
add_stmt (gnu_loop_stmt);
gnat_poplevel ();
gnu_loop_stmt = end_stmt_group ();
}
/* If we have an outer COND_EXPR, that's our result and this loop is its
"true" statement. Otherwise, the result is the LOOP_STMT. */
if (gnu_cond_expr)
{
COND_EXPR_THEN (gnu_cond_expr) = gnu_loop_stmt;
gnu_result = gnu_cond_expr;
<API key> (gnu_cond_expr);
}
else
gnu_result = gnu_loop_stmt;
VEC_pop (tree, <API key>);
return gnu_result;
}
/* Emit statements to establish <API key> as a VMS condition
handler for the current function. */
/* This is implemented by issuing a call to the appropriate VMS specific
builtin. To avoid having VMS specific sections in the global gigi decls
array, we maintain the decls of interest here. We can't declare them
inside the function because we must mark them never to be GC'd, which we
can only do at the global level. */
static GTY(()) tree <API key> = NULL_TREE;
static GTY(()) tree <API key> = NULL_TREE;
static void
<API key> (void)
{
tree establish_stmt;
/* Elaborate the required decls on the first call. Check on the decl for
the gnat condition handler to decide, as this is one we create so we are
sure that it will be non null on subsequent calls. The builtin decl is
looked up so remains null on targets where it is not implemented yet. */
if (<API key> == NULL_TREE)
{
<API key>
= builtin_decl_for
(get_identifier ("<API key>"));
<API key>
= create_subprog_decl (get_identifier ("<API key>"),
NULL_TREE,
<API key> (boolean_type_node,
ptr_void_type_node,
ptr_void_type_node,
NULL_TREE),
NULL_TREE, 0, 1, 1, 0, Empty);
/* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */
DECL_CONTEXT (<API key>) = NULL_TREE;
}
/* Do nothing if the establish builtin is not available, which might happen
on targets where the facility is not implemented. */
if (<API key> == NULL_TREE)
return;
establish_stmt
= build_call_1_expr (<API key>,
build_unary_op
(ADDR_EXPR, NULL_TREE,
<API key>));
add_stmt (establish_stmt);
}
/* Subroutine of gnat_to_gnu to process gnat_node, an N_Subprogram_Body. We
don't return anything. */
static void
<API key> (Node_Id gnat_node)
{
/* Defining identifier of a parameter to the subprogram. */
Entity_Id gnat_param;
/* The defining identifier for the subprogram body. Note that if a
specification has appeared before for this body, then the identifier
occurring in that specification will also be a defining identifier and all
the calls to this subprogram will point to that specification. */
Entity_Id gnat_subprog_id
= (Present (Corresponding_Spec (gnat_node))
? Corresponding_Spec (gnat_node) : Defining_Entity (gnat_node));
/* The FUNCTION_DECL node corresponding to the subprogram spec. */
tree gnu_subprog_decl;
/* Its RESULT_DECL node. */
tree gnu_result_decl;
/* Its FUNCTION_TYPE node. */
tree gnu_subprog_type;
/* The TYPE_CI_CO_LIST of its FUNCTION_TYPE node, if any. */
tree gnu_cico_list;
/* The entry in the CI_CO_LIST that represents a function return, if any. */
tree gnu_return_var_elmt = NULL_TREE;
tree gnu_result;
VEC(parm_attr,gc) *cache;
/* If this is a generic object or if it has been eliminated,
ignore it. */
if (Ekind (gnat_subprog_id) == E_Generic_Procedure
|| Ekind (gnat_subprog_id) == E_Generic_Function
|| Is_Eliminated (gnat_subprog_id))
return;
/* If this subprogram acts as its own spec, define it. Otherwise, just get
the already-elaborated tree node. However, if this subprogram had its
elaboration deferred, we will already have made a tree node for it. So
treat it as not being defined in that case. Such a subprogram cannot
have an address clause or a freeze node, so this test is safe, though it
does disable some otherwise-useful error checking. */
gnu_subprog_decl
= gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE,
Acts_As_Spec (gnat_node)
&& !present_gnu_tree (gnat_subprog_id));
gnu_result_decl = DECL_RESULT (gnu_subprog_decl);
gnu_subprog_type = TREE_TYPE (gnu_subprog_decl);
gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type);
if (gnu_cico_list)
gnu_return_var_elmt = value_member (void_type_node, gnu_cico_list);
/* If the function returns by invisible reference, make it explicit in the
function body. See gnat_to_gnu_entity, E_Subprogram_Type case.
Handle the explicit case here and the copy-in/copy-out case below. */
if (TREE_ADDRESSABLE (gnu_subprog_type) && !gnu_return_var_elmt)
{
TREE_TYPE (gnu_result_decl)
= <API key> (TREE_TYPE (gnu_result_decl));
relayout_decl (gnu_result_decl);
}
/* Propagate the debug mode. */
if (!Needs_Debug_Info (gnat_subprog_id))
DECL_IGNORED_P (gnu_subprog_decl) = 1;
/* Set the line number in the decl to correspond to that of the body so that
the line number notes are written correctly. */
Sloc_to_locus (Sloc (gnat_node), &<API key> (gnu_subprog_decl));
/* Initialize the information structure for the function. */
<API key> (gnu_subprog_decl, false);
<API key> (gnu_subprog_decl)->language
= <API key> ();
set_cfun (NULL);
begin_subprog_body (gnu_subprog_decl);
/* If there are In Out or Out parameters, we need to ensure that the return
statement properly copies them out. We do this by making a new block and
converting any return into a goto to a label at the end of the block. */
if (gnu_cico_list)
{
tree gnu_return_var = NULL_TREE;
VEC_safe_push (tree, gc, <API key>,
<API key> (input_location));
start_stmt_group ();
gnat_pushlevel ();
/* If this is a function with In Out or Out parameters, we also need a
variable for the return value to be placed. */
if (gnu_return_var_elmt)
{
tree gnu_return_type
= TREE_TYPE (TREE_PURPOSE (gnu_return_var_elmt));
/* If the function returns by invisible reference, make it
explicit in the function body. See gnat_to_gnu_entity,
E_Subprogram_Type case. */
if (TREE_ADDRESSABLE (gnu_subprog_type))
gnu_return_type = <API key> (gnu_return_type);
gnu_return_var
= create_var_decl (get_identifier ("RETVAL"), NULL_TREE,
gnu_return_type, NULL_TREE, false, false,
false, false, NULL, gnat_subprog_id);
TREE_VALUE (gnu_return_var_elmt) = gnu_return_var;
}
VEC_safe_push (tree, gc, <API key>, gnu_return_var);
/* See whether there are parameters for which we don't have a GCC tree
yet. These must be Out parameters. Make a VAR_DECL for them and
put it into TYPE_CI_CO_LIST, which must contain an empty entry too.
We can match up the entries because TYPE_CI_CO_LIST is in the order
of the parameters. */
for (gnat_param = <API key> (gnat_subprog_id);
Present (gnat_param);
gnat_param = <API key> (gnat_param))
if (!present_gnu_tree (gnat_param))
{
tree gnu_cico_entry = gnu_cico_list;
/* Skip any entries that have been already filled in; they must
correspond to In Out parameters. */
while (gnu_cico_entry && TREE_VALUE (gnu_cico_entry))
gnu_cico_entry = TREE_CHAIN (gnu_cico_entry);
/* Do any needed references for padded types. */
TREE_VALUE (gnu_cico_entry)
= convert (TREE_TYPE (TREE_PURPOSE (gnu_cico_entry)),
gnat_to_gnu_entity (gnat_param, NULL_TREE, 1));
}
}
else
VEC_safe_push (tree, gc, <API key>, NULL_TREE);
/* Get a tree corresponding to the code for the subprogram. */
start_stmt_group ();
gnat_pushlevel ();
/* On VMS, establish our condition handler to possibly turn a condition into
the corresponding exception if the subprogram has a foreign convention or
is exported.
To ensure proper execution of local finalizations on condition instances,
we must turn a condition into the corresponding exception even if there
is no applicable Ada handler, and need at least one condition handler per
possible call chain involving GNAT code. OTOH, establishing the handler
has a cost so we want to minimize the number of subprograms into which
this happens. The foreign or exported condition is expected to satisfy
all the constraints. */
if (TARGET_ABI_OPEN_VMS
&& (<API key> (gnat_subprog_id)
|| Is_Exported (gnat_subprog_id)))
<API key> ();
process_decls (Declarations (gnat_node), Empty, Empty, true, true);
/* Generate the code of the subprogram itself. A return statement will be
present and any Out parameters will be handled there. */
add_stmt (gnat_to_gnu (<API key> (gnat_node)));
gnat_poplevel ();
gnu_result = end_stmt_group ();
/* If we populated the parameter attributes cache, we need to make sure that
the cached expressions are evaluated on all the possible paths leading to
their uses. So we force their evaluation on entry of the function. */
cache = <API key> (gnu_subprog_decl)->language->parm_attr_cache;
if (cache)
{
struct parm_attr_d *pa;
int i;
start_stmt_group ();
FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
{
if (pa->first)
<API key> (pa->first, gnat_node);
if (pa->last)
<API key> (pa->last, gnat_node);
if (pa->length)
<API key> (pa->length, gnat_node);
}
add_stmt (gnu_result);
gnu_result = end_stmt_group ();
}
/* If we are dealing with a return from an Ada procedure with parameters
passed by copy-in/copy-out, we need to return a record containing the
final values of these parameters. If the list contains only one entry,
return just that entry though.
For a full description of the copy-in/copy-out parameter mechanism, see
the part of the gnat_to_gnu_entity routine dealing with the translation
of subprograms.
We need to make a block that contains the definition of that label and
the copying of the return value. It first contains the function, then
the label and copy statement. */
if (gnu_cico_list)
{
tree gnu_retval;
add_stmt (gnu_result);
add_stmt (build1 (LABEL_EXPR, void_type_node,
VEC_last (tree, <API key>)));
if (list_length (gnu_cico_list) == 1)
gnu_retval = TREE_VALUE (gnu_cico_list);
else
gnu_retval = <API key> (TREE_TYPE (gnu_subprog_type),
gnu_cico_list);
add_stmt_with_node (build_return_expr (gnu_result_decl, gnu_retval),
End_Label (<API key> (gnat_node)));
gnat_poplevel ();
gnu_result = end_stmt_group ();
}
VEC_pop (tree, <API key>);
end_subprog_body (gnu_result);
/* Attempt setting the end_locus of our GCC body tree, typically a
BIND_EXPR or STATEMENT_LIST, then the end_locus of our GCC subprogram
declaration tree. */
<API key> (gnu_result, gnat_node);
<API key> (gnu_subprog_decl, gnat_node);
/* Finally annotate the parameters and disconnect the trees for parameters
that we have turned into variables since they are now unusable. */
for (gnat_param = <API key> (gnat_subprog_id);
Present (gnat_param);
gnat_param = <API key> (gnat_param))
{
tree gnu_param = get_gnu_tree (gnat_param);
bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL);
annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE,
DECL_BY_REF_P (gnu_param),
!is_var_decl && <API key> (gnu_param));
if (is_var_decl)
save_gnu_tree (gnat_param, NULL_TREE, false);
}
if (DECL_FUNCTION_STUB (gnu_subprog_decl))
build_function_stub (gnu_subprog_decl, gnat_subprog_id);
if (gnu_return_var_elmt)
TREE_VALUE (gnu_return_var_elmt) = void_type_node;
mark_out_of_scope (Defining_Unit_Name (Specification (gnat_node)));
}
/* Create a temporary variable with PREFIX and initialize it with GNU_INIT.
Put the initialization statement into GNU_INIT_STMT and annotate it with
the SLOC of GNAT_NODE. Return the temporary variable. */
static tree
<API key> (const char *prefix, tree gnu_init, tree *gnu_init_stmt,
Node_Id gnat_node)
{
tree gnu_temp = create_var_decl (create_tmp_var_name (prefix), NULL_TREE,
TREE_TYPE (gnu_init), NULL_TREE, false,
false, false, false, NULL, Empty);
DECL_ARTIFICIAL (gnu_temp) = 1;
DECL_IGNORED_P (gnu_temp) = 1;
*gnu_init_stmt = build_binary_op (INIT_EXPR, NULL_TREE, gnu_temp, gnu_init);
<API key> (*gnu_init_stmt, gnat_node);
return gnu_temp;
}
/* Subroutine of gnat_to_gnu to translate gnat_node, either an N_Function_Call
or an <API key>, to a GCC tree, which is returned.
GNU_RESULT_TYPE_P is a pointer to where we should place the result type.
If GNU_TARGET is non-null, this must be a function call on the RHS of a
<API key> and the result is to be placed into that object. */
static tree
call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
{
/* The GCC node corresponding to the GNAT subprogram name. This can either
be a FUNCTION_DECL node if we are dealing with a standard subprogram call,
or an indirect reference expression (an INDIRECT_REF node) pointing to a
subprogram. */
tree gnu_subprog = gnat_to_gnu (Name (gnat_node));
/* The FUNCTION_TYPE node giving the GCC type of the subprogram. */
tree gnu_subprog_type = TREE_TYPE (gnu_subprog);
tree gnu_subprog_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_subprog);
Entity_Id gnat_formal;
Node_Id gnat_actual;
VEC(tree,gc) *gnu_actual_vec = NULL;
tree gnu_name_list = NULL_TREE;
tree gnu_before_list = NULL_TREE;
tree gnu_after_list = NULL_TREE;
tree gnu_call, gnu_result;
bool returning_value = (Nkind (gnat_node) == N_Function_Call && !gnu_target);
bool <API key> = false;
bool went_into_elab_proc = false;
gcc_assert (TREE_CODE (gnu_subprog_type) == FUNCTION_TYPE);
/* If we are calling a stubbed function, raise Program_Error, but Elaborate
all our args first. */
if (TREE_CODE (gnu_subprog) == FUNCTION_DECL && DECL_STUBBED_P (gnu_subprog))
{
tree call_expr = build_call_raise (<API key>,
gnat_node, <API key>);
for (gnat_actual = First_Actual (gnat_node);
Present (gnat_actual);
gnat_actual = Next_Actual (gnat_actual))
add_stmt (gnat_to_gnu (gnat_actual));
if (returning_value)
{
*gnu_result_type_p = TREE_TYPE (gnu_subprog_type);
return build1 (NULL_EXPR, TREE_TYPE (gnu_subprog_type), call_expr);
}
return call_expr;
}
/* The only way we can be making a call via an access type is if Name is an
explicit dereference. In that case, get the list of formal args from the
type the access type is pointing to. Otherwise, get the formals from the
entity being called. */
if (Nkind (Name (gnat_node)) == <API key>)
gnat_formal = <API key> (Etype (Name (gnat_node)));
else if (Nkind (Name (gnat_node)) == <API key>)
/* Assume here that this must be 'Elab_Body or 'Elab_Spec. */
gnat_formal = Empty;
else
gnat_formal = <API key> (Entity (Name (gnat_node)));
/* If we are translating a statement, push a new binding level that will
surround it to declare the temporaries created for the call. Likewise
if we'll be returning a value and also have copy-in/copy-out parameters,
as we need to create statements to fetch their value after the call.
??? We could do that unconditionally, but the middle-end doesn't seem
to be prepared to handle the construct in nested contexts. */
if (!returning_value || TYPE_CI_CO_LIST (gnu_subprog_type))
{
start_stmt_group ();
gnat_pushlevel ();
<API key> = true;
}
/* The lifetime of the temporaries created for the call ends with the call
so we can give them the scope of the elaboration routine at top level. */
if (!<API key>)
{
<API key> = <API key> ();
went_into_elab_proc = true;
}
/* Create the list of the actual parameters as GCC expects it, namely a
chain of TREE_LIST nodes in which the TREE_VALUE field of each node
is an expression and the TREE_PURPOSE field is null. But skip Out
parameters not passed by reference and that need not be copied in. */
for (gnat_actual = First_Actual (gnat_node);
Present (gnat_actual);
gnat_formal = <API key> (gnat_formal),
gnat_actual = Next_Actual (gnat_actual))
{
tree gnu_formal = present_gnu_tree (gnat_formal)
? get_gnu_tree (gnat_formal) : NULL_TREE;
tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal));
/* In the Out or In Out case, we must suppress conversions that yield
an lvalue but can nevertheless cause the creation of a temporary,
because we need the real object in this case, either to pass its
address if it's passed by reference or as target of the back copy
done after the call if it uses the copy-in copy-out mechanism.
We do it in the In case too, except for an unchecked conversion
because it alone can cause the actual to be misaligned and the
addressability test is applied to the real object. */
bool <API key>
= ((Nkind (gnat_actual) == <API key>
&& Ekind (gnat_formal) != E_In_Parameter)
|| (Nkind (gnat_actual) == N_Type_Conversion
&& Is_Composite_Type (Underlying_Type (Etype (gnat_formal)))));
Node_Id gnat_name = <API key>
? Expression (gnat_actual) : gnat_actual;
tree gnu_name = gnat_to_gnu (gnat_name), gnu_name_type;
tree gnu_actual;
/* If it's possible we may need to use this expression twice, make sure
that any side-effects are handled via SAVE_EXPRs; likewise if we need
to force side-effects before the call.
??? This is more conservative than we need since we don't need to do
this for pass-by-ref with no conversion. */
if (Ekind (gnat_formal) != E_In_Parameter)
gnu_name = <API key> (gnu_name, true, NULL);
/* If we are passing a non-addressable parameter by reference, pass the
address of a copy. In the Out or In Out case, set up to copy back
out after the call. */
if (gnu_formal
&& (DECL_BY_REF_P (gnu_formal)
|| (TREE_CODE (gnu_formal) == PARM_DECL
&& (<API key> (gnu_formal)
|| (<API key> (gnu_formal)))))
&& (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name)))
&& !addressable_p (gnu_name, gnu_name_type))
{
bool in_param = (Ekind (gnat_formal) == E_In_Parameter);
tree gnu_orig = gnu_name, gnu_temp, gnu_stmt;
/* Do not issue warnings for CONSTRUCTORs since this is not a copy
but sort of an instantiation for them. */
if (TREE_CODE (gnu_name) == CONSTRUCTOR)
;
/* If the type is passed by reference, a copy is not allowed. */
else if (TREE_ADDRESSABLE (gnu_formal_type))
post_error ("misaligned actual cannot be passed by reference",
gnat_actual);
/* For users of Starlet we issue a warning because the interface
apparently assumes that by-ref parameters outlive the procedure
invocation. The code still will not work as intended, but we
cannot do much better since low-level parts of the back-end
would allocate temporaries at will because of the misalignment
if we did not do so here. */
else if (Is_Valued_Procedure (Entity (Name (gnat_node))))
{
post_error
("?possible violation of implicit assumption", gnat_actual);
post_error_ne
("?made by pragma <API key> on &", gnat_actual,
Entity (Name (gnat_node)));
post_error_ne ("?because of misalignment of &", gnat_actual,
gnat_formal);
}
/* If the actual type of the object is already the nominal type,
we have nothing to do, except if the size is self-referential
in which case we'll remove the unpadding below. */
if (TREE_TYPE (gnu_name) == gnu_name_type
&& !<API key> (TYPE_SIZE (gnu_name_type)))
;
/* Otherwise remove the unpadding from all the objects. */
else if (TREE_CODE (gnu_name) == COMPONENT_REF
&& TYPE_IS_PADDING_P
(TREE_TYPE (TREE_OPERAND (gnu_name, 0))))
gnu_orig = gnu_name = TREE_OPERAND (gnu_name, 0);
/* Otherwise convert to the nominal type of the object if needed.
There are several cases in which we need to make the temporary
using this type instead of the actual type of the object when
they are distinct, because the expectations of the callee would
otherwise not be met:
- if it's a justified modular type,
- if the actual type is a smaller form of it,
- if it's a smaller form of the actual type. */
else if ((TREE_CODE (gnu_name_type) == RECORD_TYPE
&& (<API key> (gnu_name_type)
|| smaller_form_type_p (TREE_TYPE (gnu_name),
gnu_name_type)))
|| (INTEGRAL_TYPE_P (gnu_name_type)
&& smaller_form_type_p (gnu_name_type,
TREE_TYPE (gnu_name))))
gnu_name = convert (gnu_name_type, gnu_name);
/* If we haven't pushed a binding level and this is an In Out or Out
parameter, push a new one. This is needed to wrap the copy-back
statements we'll be making below. */
if (!<API key> && !in_param)
{
start_stmt_group ();
gnat_pushlevel ();
<API key> = true;
}
/* Create an explicit temporary holding the copy. This ensures that
its lifetime is as narrow as possible around a statement. */
gnu_temp
= <API key> ("A", gnu_name, &gnu_stmt, gnat_actual);
/* But initialize it on the fly like for an implicit temporary as
we aren't necessarily dealing with a statement. */
gnu_name = build_compound_expr (TREE_TYPE (gnu_name), gnu_stmt,
gnu_temp);
/* Set up to move the copy back to the original if needed. */
if (!in_param)
{
gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig,
gnu_temp);
<API key> (gnu_stmt, gnat_node);
<API key> (gnu_stmt, &gnu_after_list);
}
}
/* Start from the real object and build the actual. */
gnu_actual = gnu_name;
/* If this was a procedure call, we may not have removed any padding.
So do it here for the part we will use as an input, if any. */
if (Ekind (gnat_formal) != E_Out_Parameter
&& TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual)))
gnu_actual
= convert (get_unpadded_type (Etype (gnat_actual)), gnu_actual);
/* Put back the conversion we suppressed above in the computation of the
real object. And even if we didn't suppress any conversion there, we
may have suppressed a conversion to the Etype of the actual earlier,
since the parent is a procedure call, so put it back here. */
if (<API key>
&& Nkind (gnat_actual) == <API key>)
gnu_actual
= unchecked_convert (gnat_to_gnu_type (Etype (gnat_actual)),
gnu_actual, No_Truncation (gnat_actual));
else
gnu_actual
= convert (gnat_to_gnu_type (Etype (gnat_actual)), gnu_actual);
/* Make sure that the actual is in range of the formal's type. */
if (Ekind (gnat_formal) != E_Out_Parameter
&& Do_Range_Check (gnat_actual))
gnu_actual
= emit_range_check (gnu_actual, Etype (gnat_formal), gnat_actual);
/* Unless this is an In parameter, we must remove any justified modular
building from GNU_NAME to get an lvalue. */
if (Ekind (gnat_formal) != E_In_Parameter
&& TREE_CODE (gnu_name) == CONSTRUCTOR
&& TREE_CODE (TREE_TYPE (gnu_name)) == RECORD_TYPE
&& <API key> (TREE_TYPE (gnu_name)))
gnu_name
= convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_name))), gnu_name);
/* If we have not saved a GCC object for the formal, it means it is an
Out parameter not passed by reference and that need not be copied in.
Otherwise, first see if the parameter is passed by reference. */
if (gnu_formal
&& TREE_CODE (gnu_formal) == PARM_DECL
&& DECL_BY_REF_P (gnu_formal))
{
if (Ekind (gnat_formal) != E_In_Parameter)
{
/* In Out or Out parameters passed by reference don't use the
copy-in copy-out mechanism so the address of the real object
must be passed to the function. */
gnu_actual = gnu_name;
/* If we have a padded type, be sure we've removed padding. */
if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual)))
gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)),
gnu_actual);
/* If we have the constructed subtype of an aliased object
with an unconstrained nominal subtype, the type of the
actual includes the template, although it is formally
constrained. So we need to convert it back to the real
constructed subtype to retrieve the constrained part
and takes its address. */
if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE
&& <API key> (TREE_TYPE (gnu_actual))
&& <API key> (Etype (gnat_actual))
&& Is_Array_Type (Etype (gnat_actual)))
gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
gnu_actual);
}
/* There is no need to convert the actual to the formal's type before
taking its address. The only exception is for unconstrained array
types because of the way we build fat pointers. */
else if (TREE_CODE (gnu_formal_type) == <API key>)
gnu_actual = convert (gnu_formal_type, gnu_actual);
/* The symmetry of the paths to the type of an entity is broken here
since arguments don't know that they will be passed by ref. */
gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal));
if (<API key> (gnu_formal))
gnu_actual
= build_unary_op (ADDR_EXPR, TREE_TYPE (gnu_formal_type),
gnu_actual);
gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual);
}
else if (gnu_formal
&& TREE_CODE (gnu_formal) == PARM_DECL
&& <API key> (gnu_formal))
{
gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal));
gnu_actual = <API key> (gnu_actual);
gnu_actual = <API key> (gnu_actual);
if (TYPE_IS_PADDING_P (gnu_formal_type))
{
gnu_formal_type = TREE_TYPE (TYPE_FIELDS (gnu_formal_type));
gnu_actual = convert (gnu_formal_type, gnu_actual);
}
/* Take the address of the object and convert to the proper pointer
type. We'd like to actually compute the address of the beginning
of the array using an ADDR_EXPR of an ARRAY_REF, but there's a
possibility that the ARRAY_REF might return a constant and we'd be
getting the wrong address. Neither approach is exactly correct,
but this is the most likely to work in all cases. */
gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual);
}
else if (gnu_formal
&& TREE_CODE (gnu_formal) == PARM_DECL
&& <API key> (gnu_formal))
{
gnu_actual = convert (gnu_formal_type, gnu_actual);
/* If this is 'Null_Parameter, pass a zero descriptor. */
if ((TREE_CODE (gnu_actual) == INDIRECT_REF
|| TREE_CODE (gnu_actual) == <API key>)
&& TREE_PRIVATE (gnu_actual))
gnu_actual
= convert (DECL_ARG_TYPE (gnu_formal), integer_zero_node);
else
gnu_actual = build_unary_op (ADDR_EXPR, NULL_TREE,
fill_vms_descriptor
(TREE_TYPE (TREE_TYPE (gnu_formal)),
gnu_actual, gnat_actual));
}
else
{
tree gnu_size;
if (Ekind (gnat_formal) != E_In_Parameter)
gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list);
if (!(gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL))
{
/* Make sure side-effects are evaluated before the call. */
if (TREE_SIDE_EFFECTS (gnu_name))
<API key> (gnu_name, &gnu_before_list);
continue;
}
gnu_actual = convert (gnu_formal_type, gnu_actual);
/* If this is 'Null_Parameter, pass a zero even though we are
dereferencing it. */
if (TREE_CODE (gnu_actual) == INDIRECT_REF
&& TREE_PRIVATE (gnu_actual)
&& (gnu_size = TYPE_SIZE (TREE_TYPE (gnu_actual)))
&& TREE_CODE (gnu_size) == INTEGER_CST
&& compare_tree_int (gnu_size, BITS_PER_WORD) <= 0)
gnu_actual
= unchecked_convert (DECL_ARG_TYPE (gnu_formal),
convert (gnat_type_for_size
(TREE_INT_CST_LOW (gnu_size), 1),
integer_zero_node),
false);
else
gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual);
}
VEC_safe_push (tree, gc, gnu_actual_vec, gnu_actual);
}
gnu_call = build_call_vec (TREE_TYPE (gnu_subprog_type), gnu_subprog_addr,
gnu_actual_vec);
<API key> (gnu_call, gnat_node);
/* If this is a subprogram with copy-in/copy-out parameters, we need to
unpack the valued returned from the function into the In Out or Out
parameters. We deal with the function return (if this is an Ada
function) below. */
if (TYPE_CI_CO_LIST (gnu_subprog_type))
{
/* List of FIELD_DECLs associated with the PARM_DECLs of the copy-in/
copy-out parameters. */
tree gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type);
const int length = list_length (gnu_cico_list);
/* The call sequence must contain one and only one call, even though the
function is pure. Save the result into a temporary if needed. */
if (length > 1)
{
tree gnu_stmt;
gnu_call
= <API key> ("R", gnu_call, &gnu_stmt, gnat_node);
<API key> (gnu_stmt, &gnu_before_list);
gnu_name_list = nreverse (gnu_name_list);
}
/* The first entry is for the actual return value if this is a
function, so skip it. */
if (TREE_VALUE (gnu_cico_list) == void_type_node)
gnu_cico_list = TREE_CHAIN (gnu_cico_list);
if (Nkind (Name (gnat_node)) == <API key>)
gnat_formal = <API key> (Etype (Name (gnat_node)));
else
gnat_formal = <API key> (Entity (Name (gnat_node)));
for (gnat_actual = First_Actual (gnat_node);
Present (gnat_actual);
gnat_formal = <API key> (gnat_formal),
gnat_actual = Next_Actual (gnat_actual))
/* If we are dealing with a copy-in/copy-out parameter, we must
retrieve its value from the record returned in the call. */
if (!(present_gnu_tree (gnat_formal)
&& TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL
&& (DECL_BY_REF_P (get_gnu_tree (gnat_formal))
|| (TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL
&& ((<API key> (get_gnu_tree (gnat_formal))
|| (<API key>
(get_gnu_tree (gnat_formal))))))))
&& Ekind (gnat_formal) != E_In_Parameter)
{
/* Get the value to assign to this Out or In Out parameter. It is
either the result of the function if there is only a single such
parameter or the appropriate field from the record returned. */
tree gnu_result
= length == 1
? gnu_call
: build_component_ref (gnu_call, NULL_TREE,
TREE_PURPOSE (gnu_cico_list), false);
/* If the actual is a conversion, get the inner expression, which
will be the real destination, and convert the result to the
type of the actual parameter. */
tree gnu_actual
= <API key> (TREE_VALUE (gnu_name_list));
/* If the result is a padded type, remove the padding. */
if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)))
gnu_result
= convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
gnu_result);
/* If the actual is a type conversion, the real target object is
denoted by the inner Expression and we need to convert the
result to the associated type.
We also need to convert our gnu assignment target to this type
if the corresponding GNU_NAME was constructed from the GNAT
conversion node and not from the inner Expression. */
if (Nkind (gnat_actual) == N_Type_Conversion)
{
gnu_result
= convert_with_check
(Etype (Expression (gnat_actual)), gnu_result,
Do_Overflow_Check (gnat_actual),
Do_Range_Check (Expression (gnat_actual)),
Float_Truncate (gnat_actual), gnat_actual);
if (!Is_Composite_Type (Underlying_Type (Etype (gnat_formal))))
gnu_actual = convert (TREE_TYPE (gnu_result), gnu_actual);
}
/* Unchecked conversions as actuals for Out parameters are not
allowed in user code because they are not variables, but do
occur in front-end expansions. The associated GNU_NAME is
always obtained from the inner expression in such cases. */
else if (Nkind (gnat_actual) == <API key>)
gnu_result = unchecked_convert (TREE_TYPE (gnu_actual),
gnu_result,
No_Truncation (gnat_actual));
else
{
if (Do_Range_Check (gnat_actual))
gnu_result
= emit_range_check (gnu_result, Etype (gnat_actual),
gnat_actual);
if (!(!TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual)))
&& TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_result)))))
gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result);
}
gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE,
gnu_actual, gnu_result);
<API key> (gnu_result, gnat_node);
<API key> (gnu_result, &gnu_before_list);
gnu_cico_list = TREE_CHAIN (gnu_cico_list);
gnu_name_list = TREE_CHAIN (gnu_name_list);
}
}
/* If this is a function call, the result is the call expression unless a
target is specified, in which case we copy the result into the target
and return the assignment statement. */
if (Nkind (gnat_node) == N_Function_Call)
{
tree gnu_result_type = TREE_TYPE (gnu_subprog_type);
/* If this is a function with copy-in/copy-out parameters, extract the
return value from it and update the return type. */
if (TYPE_CI_CO_LIST (gnu_subprog_type))
{
tree gnu_elmt = value_member (void_type_node,
TYPE_CI_CO_LIST (gnu_subprog_type));
gnu_call = build_component_ref (gnu_call, NULL_TREE,
TREE_PURPOSE (gnu_elmt), false);
gnu_result_type = TREE_TYPE (gnu_call);
}
/* If the function returns an unconstrained array or by direct reference,
we have to dereference the pointer. */
if (<API key> (gnu_subprog_type)
|| <API key> (gnu_subprog_type))
gnu_call = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_call);
if (gnu_target)
{
Node_Id gnat_parent = Parent (gnat_node);
enum tree_code op_code;
/* If range check is needed, emit code to generate it. */
if (Do_Range_Check (gnat_node))
gnu_call
= emit_range_check (gnu_call, Etype (Name (gnat_parent)),
gnat_parent);
/* ??? If the return type has non-constant size, then force the
return slot optimization as we would not be able to generate
a temporary. Likewise if it was unconstrained as we would
copy too much data. That's what has been done historically. */
if (!TREE_CONSTANT (TYPE_SIZE (gnu_result_type))
|| (TYPE_IS_PADDING_P (gnu_result_type)
&& <API key>
(TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_result_type))))))
op_code = INIT_EXPR;
else
op_code = MODIFY_EXPR;
gnu_call
= build_binary_op (op_code, NULL_TREE, gnu_target, gnu_call);
<API key> (gnu_call, gnat_parent);
<API key> (gnu_call, &gnu_before_list);
}
else
*gnu_result_type_p = get_unpadded_type (Etype (gnat_node));
}
/* Otherwise, if this is a procedure call statement without copy-in/copy-out
parameters, the result is just the call statement. */
else if (!TYPE_CI_CO_LIST (gnu_subprog_type))
<API key> (gnu_call, &gnu_before_list);
if (went_into_elab_proc)
<API key> = NULL_TREE;
/* If we have pushed a binding level, the result is the statement group.
Otherwise it's just the call expression. */
if (<API key>)
{
/* If we need a value and haven't created the call statement, do so. */
if (returning_value && !TYPE_CI_CO_LIST (gnu_subprog_type))
{
tree gnu_stmt;
gnu_call
= <API key> ("R", gnu_call, &gnu_stmt, gnat_node);
<API key> (gnu_stmt, &gnu_before_list);
}
<API key> (gnu_after_list, &gnu_before_list);
add_stmt (gnu_before_list);
gnat_poplevel ();
gnu_result = end_stmt_group ();
}
else
return gnu_call;
/* If we need a value, make a COMPOUND_EXPR to return it; otherwise,
return the result. Deal specially with <API key>. */
if (returning_value)
gnu_result = build_compound_expr (TREE_TYPE (gnu_call), gnu_result,
gnu_call);
return gnu_result;
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an
<API key>, to a GCC tree, which is returned. */
static tree
<API key> (Node_Id gnat_node)
{
tree gnu_jmpsave_decl = NULL_TREE;
tree gnu_jmpbuf_decl = NULL_TREE;
/* If just annotating, ignore all EH and cleanups. */
bool gcc_zcx = (!type_annotate_only
&& Present (Exception_Handlers (gnat_node))
&& Exception_Mechanism == Back_End_Exceptions);
bool setjmp_longjmp
= (!type_annotate_only && Present (Exception_Handlers (gnat_node))
&& Exception_Mechanism == Setjmp_Longjmp);
bool at_end = !type_annotate_only && Present (At_End_Proc (gnat_node));
bool binding_for_block = (at_end || gcc_zcx || setjmp_longjmp);
tree gnu_inner_block; /* The statement(s) for the block itself. */
tree gnu_result;
tree gnu_expr;
Node_Id gnat_temp;
/* The GCC exception handling mechanism can handle both ZCX and SJLJ schemes
and we have our own SJLJ mechanism. To call the GCC mechanism, we call
add_cleanup, and when we leave the binding, end_stmt_group will create
the TRY_FINALLY_EXPR.
??? The region level calls down there have been specifically put in place
for a ZCX context and currently the order in which things are emitted
(region/handlers) is different from the SJLJ case. Instead of putting
other calls with different conditions at other places for the SJLJ case,
it seems cleaner to reorder things for the SJLJ case and generalize the
condition to make it not ZCX specific.
If there are any exceptions or cleanup processing involved, we need an
outer statement group (for Setjmp_Longjmp) and binding level. */
if (binding_for_block)
{
start_stmt_group ();
gnat_pushlevel ();
}
/* If using setjmp_longjmp, make the variables for the setjmp buffer and save
area for address of previous buffer. Do this first since we need to have
the setjmp buf known for any decls in this block. */
if (setjmp_longjmp)
{
gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"),
NULL_TREE, jmpbuf_ptr_type,
build_call_0_expr (get_jmpbuf_decl),
false, false, false, false,
NULL, gnat_node);
DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1;
/* The __builtin_setjmp receivers will immediately reinstall it. Now
because of the unstructured form of EH used by setjmp_longjmp, there
might be forward edges going to __builtin_setjmp receivers on which
it is uninitialized, although they will never be actually taken. */
TREE_NO_WARNING (gnu_jmpsave_decl) = 1;
gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"),
NULL_TREE, jmpbuf_type, NULL_TREE,
false, false, false, false,
NULL, gnat_node);
DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1;
<API key> (gnu_jmpbuf_decl);
/* When we exit this block, restore the saved value. */
add_cleanup (build_call_1_expr (set_jmpbuf_decl, gnu_jmpsave_decl),
End_Label (gnat_node));
}
/* If we are to call a function when exiting this block, add a cleanup
to the binding level we made above. Note that add_cleanup is FIFO
so we must register this cleanup after the EH cleanup just above. */
if (at_end)
add_cleanup (build_call_0_expr (gnat_to_gnu (At_End_Proc (gnat_node))),
End_Label (gnat_node));
/* Now build the tree for the declarations and statements inside this block.
If this is SJLJ, set our jmp_buf as the current buffer. */
start_stmt_group ();
if (setjmp_longjmp)
add_stmt (build_call_1_expr (set_jmpbuf_decl,
build_unary_op (ADDR_EXPR, NULL_TREE,
gnu_jmpbuf_decl)));
if (Present (<API key> (gnat_node)))
process_decls (Statements (gnat_node), Empty,
<API key> (gnat_node), true, true);
/* Generate code for each statement in the block. */
for (gnat_temp = (Present (<API key> (gnat_node))
? <API key> (gnat_node)
: First (Statements (gnat_node)));
Present (gnat_temp); gnat_temp = Next (gnat_temp))
add_stmt (gnat_to_gnu (gnat_temp));
gnu_inner_block = end_stmt_group ();
/* Now generate code for the two exception models, if either is relevant for
this block. */
if (setjmp_longjmp)
{
tree *gnu_else_ptr = 0;
tree gnu_handler;
/* Make a binding level for the exception handling declarations and code
and set up <API key> for the handlers to use. */
start_stmt_group ();
gnat_pushlevel ();
VEC_safe_push (tree, gc, <API key>,
create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE,
build_pointer_type (except_type_node),
build_call_0_expr (get_excptr_decl),
false, false, false, false,
NULL, gnat_node));
/* Generate code for each handler. The N_Exception_Handler case does the
real work and returns a COND_EXPR for each handler, which we chain
together here. */
for (gnat_temp = First_Non_Pragma (Exception_Handlers (gnat_node));
Present (gnat_temp); gnat_temp = Next_Non_Pragma (gnat_temp))
{
gnu_expr = gnat_to_gnu (gnat_temp);
/* If this is the first one, set it as the outer one. Otherwise,
point the "else" part of the previous handler to us. Then point
to our "else" part. */
if (!gnu_else_ptr)
add_stmt (gnu_expr);
else
*gnu_else_ptr = gnu_expr;
gnu_else_ptr = &COND_EXPR_ELSE (gnu_expr);
}
/* If none of the exception handlers did anything, re-raise but do not
defer abortion. */
gnu_expr = build_call_1_expr (raise_nodefer_decl,
VEC_last (tree, <API key>));
<API key>
(gnu_expr,
Present (End_Label (gnat_node)) ? End_Label (gnat_node) : gnat_node);
if (gnu_else_ptr)
*gnu_else_ptr = gnu_expr;
else
add_stmt (gnu_expr);
/* End the binding level dedicated to the exception handlers and get the
whole statement group. */
VEC_pop (tree, <API key>);
gnat_poplevel ();
gnu_handler = end_stmt_group ();
/* If the setjmp returns 1, we restore our incoming longjmp value and
then check the handlers. */
start_stmt_group ();
add_stmt_with_node (build_call_1_expr (set_jmpbuf_decl,
gnu_jmpsave_decl),
gnat_node);
add_stmt (gnu_handler);
gnu_handler = end_stmt_group ();
/* This block is now "if (setjmp) ... <handlers> else <block>". */
gnu_result = build3 (COND_EXPR, void_type_node,
(build_call_1_expr
(setjmp_decl,
build_unary_op (ADDR_EXPR, NULL_TREE,
gnu_jmpbuf_decl))),
gnu_handler, gnu_inner_block);
}
else if (gcc_zcx)
{
tree gnu_handlers;
/* First make a block containing the handlers. */
start_stmt_group ();
for (gnat_temp = First_Non_Pragma (Exception_Handlers (gnat_node));
Present (gnat_temp);
gnat_temp = Next_Non_Pragma (gnat_temp))
add_stmt (gnat_to_gnu (gnat_temp));
gnu_handlers = end_stmt_group ();
/* Now make the TRY_CATCH_EXPR for the block. */
gnu_result = build2 (TRY_CATCH_EXPR, void_type_node,
gnu_inner_block, gnu_handlers);
}
else
gnu_result = gnu_inner_block;
/* Now close our outer block, if we had to make one. */
if (binding_for_block)
{
add_stmt (gnu_result);
gnat_poplevel ();
gnu_result = end_stmt_group ();
}
return gnu_result;
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Exception_Handler,
to a GCC tree, which is returned. This is the variant for Setjmp_Longjmp
exception handling. */
static tree
<API key> (Node_Id gnat_node)
{
/* Unless this is "Others" or the special "Non-Ada" exception for Ada, make
an "if" statement to select the proper exceptions. For "Others", exclude
exceptions where Handled_By_Others is nonzero unless the All_Others flag
is set. For "Non-ada", accept an exception if "Lang" is 'V'. */
tree gnu_choice = integer_zero_node;
tree gnu_body = build_stmt_group (Statements (gnat_node), false);
Node_Id gnat_temp;
for (gnat_temp = First (Exception_Choices (gnat_node));
gnat_temp; gnat_temp = Next (gnat_temp))
{
tree this_choice;
if (Nkind (gnat_temp) == N_Others_Choice)
{
if (All_Others (gnat_temp))
this_choice = integer_one_node;
else
this_choice
= build_binary_op
(EQ_EXPR, boolean_type_node,
convert
(integer_type_node,
build_component_ref
(build_unary_op
(INDIRECT_REF, NULL_TREE,
VEC_last (tree, <API key>)),
get_identifier ("<API key>"), NULL_TREE,
false)),
integer_zero_node);
}
else if (Nkind (gnat_temp) == N_Identifier
|| Nkind (gnat_temp) == N_Expanded_Name)
{
Entity_Id gnat_ex_id = Entity (gnat_temp);
tree gnu_expr;
/* Exception may be a renaming. Recover original exception which is
the one elaborated and registered. */
if (Present (Renamed_Object (gnat_ex_id)))
gnat_ex_id = Renamed_Object (gnat_ex_id);
gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, 0);
this_choice
= build_binary_op
(EQ_EXPR, boolean_type_node,
VEC_last (tree, <API key>),
convert (TREE_TYPE (VEC_last (tree, <API key>)),
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr)));
/* If this is the distinguished exception "Non_Ada_Error" (and we are
in VMS mode), also allow a non-Ada exception (a VMS condition) t
match. */
if (Is_Non_Ada_Error (Entity (gnat_temp)))
{
tree gnu_comp
= build_component_ref
(build_unary_op (INDIRECT_REF, NULL_TREE,
VEC_last (tree, <API key>)),
get_identifier ("lang"), NULL_TREE, false);
this_choice
= build_binary_op
(TRUTH_ORIF_EXPR, boolean_type_node,
build_binary_op (EQ_EXPR, boolean_type_node, gnu_comp,
build_int_cst (TREE_TYPE (gnu_comp), 'V')),
this_choice);
}
}
else
gcc_unreachable ();
gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
gnu_choice, this_choice);
}
return build3 (COND_EXPR, void_type_node, gnu_choice, gnu_body, NULL_TREE);
}
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Exception_Handler,
to a GCC tree, which is returned. This is the variant for ZCX. */
static tree
<API key> (Node_Id gnat_node)
{
tree gnu_etypes_list = NULL_TREE;
tree gnu_expr;
tree gnu_etype;
tree gnu_current_exc_ptr;
tree <API key>;
Node_Id gnat_temp;
/* We build a TREE_LIST of nodes representing what exception types this
handler can catch, with special cases for others and all others cases.
Each exception type is actually identified by a pointer to the exception
id, or to a dummy object for "others" and "all others". */
for (gnat_temp = First (Exception_Choices (gnat_node));
gnat_temp; gnat_temp = Next (gnat_temp))
{
if (Nkind (gnat_temp) == N_Others_Choice)
{
tree gnu_expr
= All_Others (gnat_temp) ? all_others_decl : others_decl;
gnu_etype
= build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr);
}
else if (Nkind (gnat_temp) == N_Identifier
|| Nkind (gnat_temp) == N_Expanded_Name)
{
Entity_Id gnat_ex_id = Entity (gnat_temp);
/* Exception may be a renaming. Recover original exception which is
the one elaborated and registered. */
if (Present (Renamed_Object (gnat_ex_id)))
gnat_ex_id = Renamed_Object (gnat_ex_id);
gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, 0);
gnu_etype = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr);
/* The Non_Ada_Error case for VMS exceptions is handled
by the personality routine. */
}
else
gcc_unreachable ();
/* The GCC interface expects NULL to be passed for catch all handlers, so
it would be quite tempting to set gnu_etypes_list to NULL if gnu_etype
is integer_zero_node. It would not work, however, because GCC's
notion of "catch all" is stronger than our notion of "others". Until
we correctly use the cleanup interface as well, doing that would
prevent the "all others" handlers from being seen, because nothing
can be caught beyond a catch all from GCC's point of view. */
gnu_etypes_list = tree_cons (NULL_TREE, gnu_etype, gnu_etypes_list);
}
start_stmt_group ();
gnat_pushlevel ();
/* Expand a call to the begin_handler hook at the beginning of the handler,
and arrange for a call to the end_handler hook to occur on every possible
exit path.
The hooks expect a pointer to the low level occurrence. This is required
for our stack management scheme because a raise inside the handler pushes
a new occurrence on top of the stack, which means that this top does not
necessarily match the occurrence this handler was dealing with.
<API key> references the exception occurrence being
propagated. Upon handler entry, this is the exception for which the
handler is triggered. This might not be the case upon handler exit,
however, as we might have a new occurrence propagated by the handler's
body, and the end_handler hook called as a cleanup in this context.
We use a local variable to retrieve the incoming value at handler entry
time, and reuse it to feed the end_handler hook's argument at exit. */
gnu_current_exc_ptr
= build_call_expr (built_in_decls [BUILT_IN_EH_POINTER],
1, integer_zero_node);
<API key> = create_var_decl (get_identifier ("EXPTR"), NULL_TREE,
ptr_type_node, gnu_current_exc_ptr,
false, false, false, false,
NULL, gnat_node);
add_stmt_with_node (build_call_1_expr (begin_handler_decl,
<API key>),
gnat_node);
/* ??? We don't seem to have an End_Label at hand to set the location. */
add_cleanup (build_call_1_expr (end_handler_decl, <API key>),
Empty);
add_stmt_list (Statements (gnat_node));
gnat_poplevel ();
return build2 (CATCH_EXPR, void_type_node, gnu_etypes_list,
end_stmt_group ());
}
/* Subroutine of gnat_to_gnu to generate code for an N_Compilation unit. */
static void
<API key> (Node_Id gnat_node)
{
const Node_Id gnat_unit = Unit (gnat_node);
const bool body_p = (Nkind (gnat_unit) == N_Package_Body
|| Nkind (gnat_unit) == N_Subprogram_Body);
const Entity_Id gnat_unit_entity = Defining_Entity (gnat_unit);
/* Make the decl for the elaboration procedure. */
tree gnu_elab_proc_decl
= create_subprog_decl
(create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, gnat_unit);
struct elab_info *info;
VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl);
<API key> (gnu_elab_proc_decl) = 1;
/* Initialize the information structure for the function. */
<API key> (gnu_elab_proc_decl, false);
set_cfun (NULL);
<API key> = NULL_TREE;
start_stmt_group ();
gnat_pushlevel ();
/* For a body, first process the spec if there is one. */
if (Nkind (Unit (gnat_node)) == N_Package_Body
|| (Nkind (Unit (gnat_node)) == N_Subprogram_Body
&& !Acts_As_Spec (gnat_node)))
{
add_stmt (gnat_to_gnu (Library_Unit (gnat_node)));
<API key> ();
}
/* If we can inline, generate code for all the inlined subprograms. */
if (optimize)
{
Entity_Id gnat_entity;
for (gnat_entity = <API key> (gnat_node);
Present (gnat_entity);
gnat_entity = <API key> (gnat_entity))
{
Node_Id gnat_body = Parent (Declaration_Node (gnat_entity));
if (Nkind (gnat_body) != N_Subprogram_Body)
{
/* ??? This really should always be present. */
if (No (Corresponding_Body (gnat_body)))
continue;
gnat_body
= Parent (Declaration_Node (Corresponding_Body (gnat_body)));
}
if (Present (gnat_body))
{
/* Define the entity first so we set DECL_EXTERNAL. */
gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0);
add_stmt (gnat_to_gnu (gnat_body));
}
}
}
if (type_annotate_only && gnat_node == Cunit (Main_Unit))
{
<API key> (gnat_node);
if (Nkind (Unit (gnat_node)) == <API key>
|| Nkind (Unit (gnat_node)) == <API key>
|| Nkind (Unit (gnat_node)) == <API key>)
return;
}
process_decls (Declarations (Aux_Decls_Node (gnat_node)), Empty, Empty,
true, true);
add_stmt (gnat_to_gnu (Unit (gnat_node)));
/* Process any pragmas and actions following the unit. */
add_stmt_list (Pragmas_After (Aux_Decls_Node (gnat_node)));
add_stmt_list (Actions (Aux_Decls_Node (gnat_node)));
<API key> ();
/* Save away what we've made so far and record this potential elaboration
procedure. */
info = ggc_alloc_elab_info ();
<API key> (gnu_elab_proc_decl);
gnat_poplevel ();
DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group ();
<API key> (gnu_elab_proc_decl, gnat_unit);
info->next = elab_info_list;
info->elab_proc = gnu_elab_proc_decl;
info->gnat_node = gnat_node;
elab_info_list = info;
/* Generate elaboration code for this unit, if necessary, and say whether
we did or not. */
VEC_pop (tree, gnu_elab_proc_stack);
/* Invalidate the global renaming pointers. This is necessary because
stabilization of the renamed entities may create SAVE_EXPRs which
have been tied to a specific elaboration routine just above. */
<API key> ();
}
/* Return true if GNAT_NODE, an unchecked type conversion, is a no-op as far
as gigi is concerned. This is used to avoid conversions on the LHS. */
static bool
<API key> (Node_Id gnat_node)
{
Entity_Id from_type, to_type;
/* The conversion must be on the LHS of an assignment or an actual parameter
of a call. Otherwise, even if the conversion was essentially a no-op, it
could de facto ensure type consistency and this should be preserved. */
if (!(Nkind (Parent (gnat_node)) == <API key>
&& Name (Parent (gnat_node)) == gnat_node)
&& !((Nkind (Parent (gnat_node)) == <API key>
|| Nkind (Parent (gnat_node)) == N_Function_Call)
&& Name (Parent (gnat_node)) != gnat_node))
return false;
from_type = Etype (Expression (gnat_node));
/* We're interested in artificial conversions generated by the front-end
to make private types explicit, e.g. in Expand_Assign_Array. */
if (!Is_Private_Type (from_type))
return false;
from_type = Underlying_Type (from_type);
to_type = Etype (gnat_node);
/* The direct conversion to the underlying type is a no-op. */
if (to_type == from_type)
return true;
/* For an array subtype, the conversion to the PAT is a no-op. */
if (Ekind (from_type) == E_Array_Subtype
&& to_type == Packed_Array_Type (from_type))
return true;
/* For a record subtype, the conversion to the type is a no-op. */
if (Ekind (from_type) == E_Record_Subtype
&& to_type == Etype (from_type))
return true;
return false;
}
/* This function is the driver of the GNAT to GCC tree transformation process.
It is the entry point of the tree transformer. GNAT_NODE is the root of
some GNAT tree. Return the root of the corresponding GCC tree. If this
is an expression, return the GCC equivalent of the expression. If this
is a statement, return the statement or add it to the current statement
group, in which case anything returned is to be interpreted as occurring
after anything added. */
tree
gnat_to_gnu (Node_Id gnat_node)
{
const Node_Kind kind = Nkind (gnat_node);
bool went_into_elab_proc = false;
tree gnu_result = error_mark_node; /* Default to no value. */
tree gnu_result_type = void_type_node;
tree gnu_expr, gnu_lhs, gnu_rhs;
Node_Id gnat_temp;
/* Save node number for error message and set location information. */
error_gnat_node = gnat_node;
Sloc_to_locus (Sloc (gnat_node), &input_location);
/* If this node is a statement and we are only annotating types, return an
empty statement list. */
if (type_annotate_only && IN (kind, <API key>))
return alloc_stmt_list ();
/* If this node is a non-static subexpression and we are only annotating
types, make this into a NULL_EXPR. */
if (type_annotate_only
&& IN (kind, N_Subexpr)
&& kind != N_Identifier
&& !<API key> (gnat_node))
return build1 (NULL_EXPR, get_unpadded_type (Etype (gnat_node)),
build_call_raise (<API key>, gnat_node,
<API key>));
if ((IN (kind, <API key>)
&& kind != N_Null_Statement)
|| kind == <API key>
|| kind == N_Label
|| kind == <API key>
|| kind == <API key>
|| (IN (kind, N_Raise_xxx_Error) && Ekind (Etype (gnat_node)) == E_Void))
{
tree current_elab_proc = <API key> ();
/* If this is a statement and we are at top level, it must be part of
the elaboration procedure, so mark us as being in that procedure. */
if (!<API key>)
{
<API key> = current_elab_proc;
went_into_elab_proc = true;
}
if (<API key> == current_elab_proc
&& kind != <API key>)
<API key> (gnat_node);
}
switch (kind)
{
/* Chapter 2: Lexical Elements */
case N_Identifier:
case N_Expanded_Name:
case N_Operator_Symbol:
case <API key>:
gnu_result = Identifier_to_gnu (gnat_node, &gnu_result_type);
break;
case N_Integer_Literal:
{
tree gnu_type;
/* Get the type of the result, looking inside any padding and
justified modular types. Then get the value in that type. */
gnu_type = gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (TREE_CODE (gnu_type) == RECORD_TYPE
&& <API key> (gnu_type))
gnu_type = TREE_TYPE (TYPE_FIELDS (gnu_type));
gnu_result = UI_To_gnu (Intval (gnat_node), gnu_type);
/* If the result overflows (meaning it doesn't fit in its base type),
abort. We would like to check that the value is within the range
of the subtype, but that causes problems with subtypes whose usage
will raise Constraint_Error and with biased representation, so
we don't. */
gcc_assert (!TREE_OVERFLOW (gnu_result));
}
break;
case N_Character_Literal:
/* If a Entity is present, it means that this was one of the
literals in a user-defined character type. In that case,
just return the value in the CONST_DECL. Otherwise, use the
character code. In that case, the base type should be an
INTEGER_TYPE, but we won't bother checking for that. */
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (Present (Entity (gnat_node)))
gnu_result = DECL_INITIAL (get_gnu_tree (Entity (gnat_node)));
else
gnu_result
= build_int_cst_type
(gnu_result_type, UI_To_CC (Char_Literal_Value (gnat_node)));
break;
case N_Real_Literal:
/* If this is of a fixed-point type, the value we want is the
value of the corresponding integer. */
if (IN (Ekind (Underlying_Type (Etype (gnat_node))), Fixed_Point_Kind))
{
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = UI_To_gnu (<API key> (gnat_node),
gnu_result_type);
gcc_assert (!TREE_OVERFLOW (gnu_result));
}
/* We should never see a Vax_Float type literal, since the front end
is supposed to transform these using appropriate conversions. */
else if (Vax_Float (Underlying_Type (Etype (gnat_node))))
gcc_unreachable ();
else
{
Ureal ur_realval = Realval (gnat_node);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If the real value is zero, so is the result. Otherwise,
convert it to a machine number if it isn't already. That
forces BASE to 0 or 2 and simplifies the rest of our logic. */
if (UR_Is_Zero (ur_realval))
gnu_result = convert (gnu_result_type, integer_zero_node);
else
{
if (!Is_Machine_Number (gnat_node))
ur_realval
= Machine (Base_Type (Underlying_Type (Etype (gnat_node))),
ur_realval, Round_Even, gnat_node);
gnu_result
= UI_To_gnu (Numerator (ur_realval), gnu_result_type);
/* If we have a base of zero, divide by the denominator.
Otherwise, the base must be 2 and we scale the value, which
we know can fit in the mantissa of the type (hence the use
of that type above). */
if (No (Rbase (ur_realval)))
gnu_result
= build_binary_op (RDIV_EXPR,
get_base_type (gnu_result_type),
gnu_result,
UI_To_gnu (Denominator (ur_realval),
gnu_result_type));
else
{
REAL_VALUE_TYPE tmp;
gcc_assert (Rbase (ur_realval) == 2);
real_ldexp (&tmp, &TREE_REAL_CST (gnu_result),
- UI_To_Int (Denominator (ur_realval)));
gnu_result = build_real (gnu_result_type, tmp);
}
}
/* Now see if we need to negate the result. Do it this way to
properly handle -0. */
if (UR_Is_Negative (Realval (gnat_node)))
gnu_result
= build_unary_op (NEGATE_EXPR, get_base_type (gnu_result_type),
gnu_result);
}
break;
case N_String_Literal:
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (TYPE_PRECISION (TREE_TYPE (gnu_result_type)) == HOST_BITS_PER_CHAR)
{
String_Id gnat_string = Strval (gnat_node);
int length = String_Length (gnat_string);
int i;
char *string;
if (length >= ALLOCA_THRESHOLD)
string = XNEWVEC (char, length + 1);
else
string = (char *) alloca (length + 1);
/* Build the string with the characters in the literal. Note
that Ada strings are 1-origin. */
for (i = 0; i < length; i++)
string[i] = Get_String_Char (gnat_string, i + 1);
/* Put a null at the end of the string in case it's in a context
where GCC will want to treat it as a C string. */
string[i] = 0;
gnu_result = build_string (length, string);
/* Strings in GCC don't normally have types, but we want
this to not be converted to the array type. */
TREE_TYPE (gnu_result) = gnu_result_type;
if (length >= ALLOCA_THRESHOLD)
free (string);
}
else
{
/* Build a list consisting of each character, then make
the aggregate. */
String_Id gnat_string = Strval (gnat_node);
int length = String_Length (gnat_string);
int i;
tree gnu_idx = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type));
VEC(constructor_elt,gc) *gnu_vec
= VEC_alloc (constructor_elt, gc, length);
for (i = 0; i < length; i++)
{
tree t = build_int_cst (TREE_TYPE (gnu_result_type),
Get_String_Char (gnat_string, i + 1));
<API key> (gnu_vec, gnu_idx, t);
gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node,
0);
}
gnu_result = <API key> (gnu_result_type, gnu_vec);
}
break;
case N_Pragma:
gnu_result = Pragma_to_gnu (gnat_node);
break;
/* Chapter 3: Declarations and Types */
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
process_type (Defining_Entity (gnat_node));
gnu_result = alloc_stmt_list ();
break;
case <API key>:
case <API key>:
gnat_temp = Defining_Entity (gnat_node);
gnu_result = alloc_stmt_list ();
/* If we are just annotating types and this object has an unconstrained
or task type, don't elaborate it. */
if (type_annotate_only
&& (((Is_Array_Type (Etype (gnat_temp))
|| Is_Record_Type (Etype (gnat_temp)))
&& !Is_Constrained (Etype (gnat_temp)))
|| Is_Concurrent_Type (Etype (gnat_temp))))
break;
if (Present (Expression (gnat_node))
&& !(kind == <API key> && No_Initialization (gnat_node))
&& (!type_annotate_only
|| <API key> (Expression (gnat_node))))
{
gnu_expr = gnat_to_gnu (Expression (gnat_node));
if (Do_Range_Check (Expression (gnat_node)))
gnu_expr
= emit_range_check (gnu_expr, Etype (gnat_temp), gnat_node);
/* If this object has its elaboration delayed, we must force
evaluation of GNU_EXPR right now and save it for when the object
is frozen. */
if (Present (Freeze_Node (gnat_temp)))
{
if (TREE_CONSTANT (gnu_expr))
;
else if (global_bindings_p ())
gnu_expr
= create_var_decl (create_concat_name (gnat_temp, "init"),
NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr,
false, false, false, false,
NULL, gnat_temp);
else
gnu_expr = gnat_save_expr (gnu_expr);
save_gnu_tree (gnat_node, gnu_expr, true);
}
}
else
gnu_expr = NULL_TREE;
if (type_annotate_only && gnu_expr && TREE_CODE (gnu_expr) == ERROR_MARK)
gnu_expr = NULL_TREE;
/* If this is a deferred constant with an address clause, we ignore the
full view since the clause is on the partial view and we cannot have
2 different GCC trees for the object. The only bits of the full view
we will use is the initializer, but it will be directly fetched. */
if (Ekind(gnat_temp) == E_Constant
&& Present (Address_Clause (gnat_temp))
&& Present (Full_View (gnat_temp)))
save_gnu_tree (Full_View (gnat_temp), error_mark_node, true);
if (No (Freeze_Node (gnat_temp)))
gnat_to_gnu_entity (gnat_temp, gnu_expr, 1);
break;
case <API key>:
gnat_temp = Defining_Entity (gnat_node);
/* Don't do anything if this renaming is handled by the front end or if
we are just annotating types and this object has a composite or task
type, don't elaborate it. We return the result in case it has any
SAVE_EXPRs in it that need to be evaluated here. */
if (!<API key> (gnat_temp)
&& ! (type_annotate_only
&& (Is_Array_Type (Etype (gnat_temp))
|| Is_Record_Type (Etype (gnat_temp))
|| Is_Concurrent_Type (Etype (gnat_temp)))))
gnu_result
= gnat_to_gnu_entity (gnat_temp,
gnat_to_gnu (Renamed_Object (gnat_temp)), 1);
else
gnu_result = alloc_stmt_list ();
break;
case <API key>:
gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, 1);
gnu_result = alloc_stmt_list ();
break;
case <API key>:
case <API key>:
case <API key>:
case <API key>:
/* These are fully handled in the front end. */
gnu_result = alloc_stmt_list ();
break;
/* Chapter 4: Names and Expressions */
case <API key>:
gnu_result = gnat_to_gnu (Prefix (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
break;
case N_Indexed_Component:
{
tree gnu_array_object = gnat_to_gnu (Prefix (gnat_node));
tree gnu_type;
int ndim;
int i;
Node_Id *gnat_expr_array;
gnu_array_object = <API key> (gnu_array_object);
/* Convert vector inputs to their representative array type, to fit
what the code below expects. */
gnu_array_object = maybe_vector_array (gnu_array_object);
gnu_array_object = <API key> (gnu_array_object);
/* If we got a padded type, remove it too. */
if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_array_object)))
gnu_array_object
= convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_array_object))),
gnu_array_object);
gnu_result = gnu_array_object;
/* First compute the number of dimensions of the array, then
fill the expression array, the order depending on whether
this is a Convention_Fortran array or not. */
for (ndim = 1, gnu_type = TREE_TYPE (gnu_array_object);
TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE
&& TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type));
ndim++, gnu_type = TREE_TYPE (gnu_type))
;
gnat_expr_array = XALLOCAVEC (Node_Id, ndim);
if (<API key> (TREE_TYPE (gnu_array_object)))
for (i = ndim - 1, gnat_temp = First (Expressions (gnat_node));
i >= 0;
i--, gnat_temp = Next (gnat_temp))
gnat_expr_array[i] = gnat_temp;
else
for (i = 0, gnat_temp = First (Expressions (gnat_node));
i < ndim;
i++, gnat_temp = Next (gnat_temp))
gnat_expr_array[i] = gnat_temp;
for (i = 0, gnu_type = TREE_TYPE (gnu_array_object);
i < ndim; i++, gnu_type = TREE_TYPE (gnu_type))
{
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
gnat_temp = gnat_expr_array[i];
gnu_expr = gnat_to_gnu (gnat_temp);
if (Do_Range_Check (gnat_temp))
gnu_expr
= emit_index_check
(gnu_array_object, gnu_expr,
TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type))),
TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type))),
gnat_temp);
gnu_result = build_binary_op (ARRAY_REF, NULL_TREE,
gnu_result, gnu_expr);
}
}
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case N_Slice:
{
Node_Id gnat_range_node = Discrete_Range (gnat_node);
tree gnu_type;
gnu_result = gnat_to_gnu (Prefix (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* Do any implicit dereferences of the prefix and do any needed
range check. */
gnu_result = <API key> (gnu_result);
gnu_result = <API key> (gnu_result);
gnu_type = TREE_TYPE (gnu_result);
if (Do_Range_Check (gnat_range_node))
{
/* Get the bounds of the slice. */
tree gnu_index_type
= TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_result_type));
tree gnu_min_expr = TYPE_MIN_VALUE (gnu_index_type);
tree gnu_max_expr = TYPE_MAX_VALUE (gnu_index_type);
/* Get the permitted bounds. */
tree gnu_base_index_type
= TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type));
tree gnu_base_min_expr = <API key>
(TYPE_MIN_VALUE (gnu_base_index_type), gnu_result);
tree gnu_base_max_expr = <API key>
(TYPE_MAX_VALUE (gnu_base_index_type), gnu_result);
tree gnu_expr_l, gnu_expr_h, gnu_expr_type;
gnu_min_expr = gnat_protect_expr (gnu_min_expr);
gnu_max_expr = gnat_protect_expr (gnu_max_expr);
/* Derive a good type to convert everything to. */
gnu_expr_type = get_base_type (gnu_index_type);
/* Test whether the minimum slice value is too small. */
gnu_expr_l = build_binary_op (LT_EXPR, boolean_type_node,
convert (gnu_expr_type,
gnu_min_expr),
convert (gnu_expr_type,
gnu_base_min_expr));
/* Test whether the maximum slice value is too large. */
gnu_expr_h = build_binary_op (GT_EXPR, boolean_type_node,
convert (gnu_expr_type,
gnu_max_expr),
convert (gnu_expr_type,
gnu_base_max_expr));
/* Build a slice index check that returns the low bound,
assuming the slice is not empty. */
gnu_expr = emit_check
(build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
gnu_expr_l, gnu_expr_h),
gnu_min_expr, <API key>, gnat_node);
/* Build a conditional expression that does the index checks and
returns the low bound if the slice is not empty (max >= min),
and returns the naked low bound otherwise (max < min), unless
it is non-constant and the high bound is; this prevents VRP
from inferring bogus ranges on the unlikely path. */
gnu_expr = fold_build3 (COND_EXPR, gnu_expr_type,
build_binary_op (GE_EXPR, gnu_expr_type,
convert (gnu_expr_type,
gnu_max_expr),
convert (gnu_expr_type,
gnu_min_expr)),
gnu_expr,
TREE_CODE (gnu_min_expr) != INTEGER_CST
&& TREE_CODE (gnu_max_expr) == INTEGER_CST
? gnu_max_expr : gnu_min_expr);
}
else
/* Simply return the naked low bound. */
gnu_expr = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type));
/* If this is a slice with non-constant size of an array with constant
size, set the maximum size for the allocation of temporaries. */
if (!TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_result_type))
&& TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_type)))
TYPE_ARRAY_MAX_SIZE (gnu_result_type) = TYPE_SIZE_UNIT (gnu_type);
gnu_result = build_binary_op (ARRAY_RANGE_REF, gnu_result_type,
gnu_result, gnu_expr);
}
break;
case <API key>:
{
tree gnu_prefix = gnat_to_gnu (Prefix (gnat_node));
Entity_Id gnat_field = Entity (Selector_Name (gnat_node));
Entity_Id gnat_pref_type = Etype (Prefix (gnat_node));
tree gnu_field;
while (IN (Ekind (gnat_pref_type), <API key>)
|| IN (Ekind (gnat_pref_type), Access_Kind))
{
if (IN (Ekind (gnat_pref_type), <API key>))
gnat_pref_type = Underlying_Type (gnat_pref_type);
else if (IN (Ekind (gnat_pref_type), Access_Kind))
gnat_pref_type = Designated_Type (gnat_pref_type);
}
gnu_prefix = <API key> (gnu_prefix);
/* For discriminant references in tagged types always substitute the
corresponding discriminant as the actual selected component. */
if (Is_Tagged_Type (gnat_pref_type))
while (Present (<API key> (gnat_field)))
gnat_field = <API key> (gnat_field);
/* For discriminant references of untagged types always substitute the
corresponding stored discriminant. */
else if (Present (<API key> (gnat_field)))
gnat_field = <API key> (gnat_field);
/* Handle extracting the real or imaginary part of a complex.
The real part is the first field and the imaginary the last. */
if (TREE_CODE (TREE_TYPE (gnu_prefix)) == COMPLEX_TYPE)
gnu_result = build_unary_op (Present (Next_Entity (gnat_field))
? REALPART_EXPR : IMAGPART_EXPR,
NULL_TREE, gnu_prefix);
else
{
gnu_field = <API key> (gnat_field);
/* If there are discriminants, the prefix might be evaluated more
than once, which is a problem if it has side-effects. */
if (Has_Discriminants (Is_Access_Type (Etype (Prefix (gnat_node)))
? Designated_Type (Etype
(Prefix (gnat_node)))
: Etype (Prefix (gnat_node))))
gnu_prefix = <API key> (gnu_prefix, false, NULL);
gnu_result
= build_component_ref (gnu_prefix, NULL_TREE, gnu_field,
(Nkind (Parent (gnat_node))
== <API key>)
&& <API key>
(Parent (gnat_node)));
}
gcc_assert (gnu_result);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
}
break;
case <API key>:
{
/* The attribute designator. */
const int attr = Get_Attribute_Id (Attribute_Name (gnat_node));
/* The Elab_Spec and Elab_Body attributes are special in that Prefix
is a unit, not an object with a GCC equivalent. */
if (attr == Attr_Elab_Spec || attr == Attr_Elab_Body)
return
create_subprog_decl (create_concat_name
(Entity (Prefix (gnat_node)),
attr == Attr_Elab_Body ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, false,
true, true, NULL, gnat_node);
gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr);
}
break;
case N_Reference:
/* Like 'Access as far as we are concerned. */
gnu_result = gnat_to_gnu (Prefix (gnat_node));
gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_result);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case N_Aggregate:
case <API key>:
{
tree gnu_aggr_type;
/* ??? It is wrong to evaluate the type now, but there doesn't
seem to be any other practical way of doing it. */
gcc_assert (!Expansion_Delayed (gnat_node));
gnu_aggr_type = gnu_result_type
= get_unpadded_type (Etype (gnat_node));
if (TREE_CODE (gnu_result_type) == RECORD_TYPE
&& <API key> (gnu_result_type))
gnu_aggr_type
= TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_result_type)));
else if (TREE_CODE (gnu_result_type) == VECTOR_TYPE)
gnu_aggr_type = <API key> (gnu_result_type);
if (Null_Record_Present (gnat_node))
gnu_result = <API key> (gnu_aggr_type, NULL);
else if (TREE_CODE (gnu_aggr_type) == RECORD_TYPE
|| TREE_CODE (gnu_aggr_type) == UNION_TYPE)
gnu_result
= <API key> (Etype (gnat_node),
First (<API key> (gnat_node)),
gnu_aggr_type);
else if (TREE_CODE (gnu_aggr_type) == ARRAY_TYPE)
gnu_result = pos_to_constructor (First (Expressions (gnat_node)),
gnu_aggr_type,
Component_Type (Etype (gnat_node)));
else if (TREE_CODE (gnu_aggr_type) == COMPLEX_TYPE)
gnu_result
= build_binary_op
(COMPLEX_EXPR, gnu_aggr_type,
gnat_to_gnu (Expression (First
(<API key> (gnat_node)))),
gnat_to_gnu (Expression
(Next
(First (<API key> (gnat_node))))));
else
gcc_unreachable ();
gnu_result = convert (gnu_result_type, gnu_result);
}
break;
case N_Null:
if (<API key>
&& Ekind (Etype (gnat_node)) == <API key>
&& <API key> (Etype (gnat_node)))
gnu_result = null_fdesc_node;
else
gnu_result = null_pointer_node;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case N_Type_Conversion:
case <API key>:
/* Get the operand expression. */
gnu_result = gnat_to_gnu (Expression (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result
= convert_with_check (Etype (gnat_node), gnu_result,
Do_Overflow_Check (gnat_node),
Do_Range_Check (Expression (gnat_node)),
kind == N_Type_Conversion
&& Float_Truncate (gnat_node), gnat_node);
break;
case <API key>:
gnu_result = gnat_to_gnu (Expression (gnat_node));
/* Skip further processing if the conversion is deemed a no-op. */
if (<API key> (gnat_node))
{
gnu_result_type = TREE_TYPE (gnu_result);
break;
}
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If the result is a pointer type, see if we are improperly
converting to a stricter alignment. */
if (STRICT_ALIGNMENT && POINTER_TYPE_P (gnu_result_type)
&& IN (Ekind (Etype (gnat_node)), Access_Kind))
{
unsigned int align = known_alignment (gnu_result);
tree gnu_obj_type = TREE_TYPE (gnu_result_type);
unsigned int oalign = TYPE_ALIGN (gnu_obj_type);
if (align != 0 && align < oalign && !TYPE_ALIGN_OK (gnu_obj_type))
<API key>
("?source alignment (^) '< alignment of & (^)",
gnat_node, Designated_Type (Etype (gnat_node)),
size_int (align / BITS_PER_UNIT), oalign / BITS_PER_UNIT);
}
/* If we are converting a descriptor to a function pointer, first
build the pointer. */
if (<API key>
&& TREE_TYPE (gnu_result) == fdesc_type_node
&& POINTER_TYPE_P (gnu_result_type))
gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_result);
gnu_result = unchecked_convert (gnu_result_type, gnu_result,
No_Truncation (gnat_node));
break;
case N_In:
case N_Not_In:
{
tree gnu_obj = gnat_to_gnu (Left_Opnd (gnat_node));
Node_Id gnat_range = Right_Opnd (gnat_node);
tree gnu_low, gnu_high;
/* GNAT_RANGE is either an N_Range node or an identifier denoting a
subtype. */
if (Nkind (gnat_range) == N_Range)
{
gnu_low = gnat_to_gnu (Low_Bound (gnat_range));
gnu_high = gnat_to_gnu (High_Bound (gnat_range));
}
else if (Nkind (gnat_range) == N_Identifier
|| Nkind (gnat_range) == N_Expanded_Name)
{
tree gnu_range_type = get_unpadded_type (Entity (gnat_range));
gnu_low = TYPE_MIN_VALUE (gnu_range_type);
gnu_high = TYPE_MAX_VALUE (gnu_range_type);
}
else
gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If LOW and HIGH are identical, perform an equality test. Otherwise,
ensure that GNU_OBJ is evaluated only once and perform a full range
test. */
if (operand_equal_p (gnu_low, gnu_high, 0))
gnu_result
= build_binary_op (EQ_EXPR, gnu_result_type, gnu_obj, gnu_low);
else
{
tree t1, t2;
gnu_obj = gnat_protect_expr (gnu_obj);
t1 = build_binary_op (GE_EXPR, gnu_result_type, gnu_obj, gnu_low);
if (EXPR_P (t1))
<API key> (t1, gnat_node);
t2 = build_binary_op (LE_EXPR, gnu_result_type, gnu_obj, gnu_high);
if (EXPR_P (t2))
<API key> (t2, gnat_node);
gnu_result
= build_binary_op (TRUTH_ANDIF_EXPR, gnu_result_type, t1, t2);
}
if (kind == N_Not_In)
gnu_result
= <API key> (EXPR_LOCATION (gnu_result), gnu_result);
}
break;
case N_Op_Divide:
gnu_lhs = gnat_to_gnu (Left_Opnd (gnat_node));
gnu_rhs = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = build_binary_op (FLOAT_TYPE_P (gnu_result_type)
? RDIV_EXPR
: (Rounded_Result (gnat_node)
? ROUND_DIV_EXPR : TRUNC_DIV_EXPR),
gnu_result_type, gnu_lhs, gnu_rhs);
break;
case N_Op_Or: case N_Op_And: case N_Op_Xor:
/* These can either be operations on booleans or on modular types.
Fall through for boolean types since that's the way GNU_CODES is
set up. */
if (IN (Ekind (Underlying_Type (Etype (gnat_node))),
<API key>))
{
enum tree_code code
= (kind == N_Op_Or ? BIT_IOR_EXPR
: kind == N_Op_And ? BIT_AND_EXPR
: BIT_XOR_EXPR);
gnu_lhs = gnat_to_gnu (Left_Opnd (gnat_node));
gnu_rhs = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = build_binary_op (code, gnu_result_type,
gnu_lhs, gnu_rhs);
break;
}
/* ... fall through ... */
case N_Op_Eq: case N_Op_Ne: case N_Op_Lt:
case N_Op_Le: case N_Op_Gt: case N_Op_Ge:
case N_Op_Add: case N_Op_Subtract: case N_Op_Multiply:
case N_Op_Mod: case N_Op_Rem:
case N_Op_Rotate_Left:
case N_Op_Rotate_Right:
case N_Op_Shift_Left:
case N_Op_Shift_Right:
case <API key>:
case N_And_Then: case N_Or_Else:
{
enum tree_code code = gnu_codes[kind];
bool ignore_lhs_overflow = false;
location_t saved_location = input_location;
tree gnu_type;
gnu_lhs = gnat_to_gnu (Left_Opnd (gnat_node));
gnu_rhs = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_type = gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* Pending generic support for efficient vector logical operations in
GCC, convert vectors to their representative array type view and
fallthrough. */
gnu_lhs = maybe_vector_array (gnu_lhs);
gnu_rhs = maybe_vector_array (gnu_rhs);
/* If this is a comparison operator, convert any references to
an unconstrained array value into a reference to the
actual array. */
if (TREE_CODE_CLASS (code) == tcc_comparison)
{
gnu_lhs = <API key> (gnu_lhs);
gnu_rhs = <API key> (gnu_rhs);
}
/* If the result type is a private type, its full view may be a
numeric subtype. The representation we need is that of its base
type, given that it is the result of an arithmetic operation. */
else if (Is_Private_Type (Etype (gnat_node)))
gnu_type = gnu_result_type
= get_unpadded_type (Base_Type (Full_View (Etype (gnat_node))));
/* If this is a shift whose count is not guaranteed to be correct,
we need to adjust the shift count. */
if (IN (kind, N_Op_Shift) && !Shift_Count_OK (gnat_node))
{
tree gnu_count_type = get_base_type (TREE_TYPE (gnu_rhs));
tree gnu_max_shift
= convert (gnu_count_type, TYPE_SIZE (gnu_type));
if (kind == N_Op_Rotate_Left || kind == N_Op_Rotate_Right)
gnu_rhs = build_binary_op (TRUNC_MOD_EXPR, gnu_count_type,
gnu_rhs, gnu_max_shift);
else if (kind == <API key>)
gnu_rhs
= build_binary_op
(MIN_EXPR, gnu_count_type,
build_binary_op (MINUS_EXPR,
gnu_count_type,
gnu_max_shift,
convert (gnu_count_type,
integer_one_node)),
gnu_rhs);
}
/* For right shifts, the type says what kind of shift to do,
so we may need to choose a different type. In this case,
we have to ignore integer overflow lest it propagates all
the way down and causes a CE to be explicitly raised. */
if (kind == N_Op_Shift_Right && !TYPE_UNSIGNED (gnu_type))
{
gnu_type = gnat_unsigned_type (gnu_type);
ignore_lhs_overflow = true;
}
else if (kind == <API key>
&& TYPE_UNSIGNED (gnu_type))
{
gnu_type = gnat_signed_type (gnu_type);
ignore_lhs_overflow = true;
}
if (gnu_type != gnu_result_type)
{
tree gnu_old_lhs = gnu_lhs;
gnu_lhs = convert (gnu_type, gnu_lhs);
if (TREE_CODE (gnu_lhs) == INTEGER_CST && ignore_lhs_overflow)
TREE_OVERFLOW (gnu_lhs) = TREE_OVERFLOW (gnu_old_lhs);
gnu_rhs = convert (gnu_type, gnu_rhs);
}
/* Instead of expanding overflow checks for addition, subtraction
and multiplication itself, the front end will leave this to
the back end when <API key> is set.
As the GCC back end itself does not know yet how to properly
do overflow checking, do it here. The goal is to push
the expansions further into the back end over time. */
if (Do_Overflow_Check (gnat_node) && <API key>
&& (kind == N_Op_Add
|| kind == N_Op_Subtract
|| kind == N_Op_Multiply)
&& !TYPE_UNSIGNED (gnu_type)
&& !FLOAT_TYPE_P (gnu_type))
gnu_result = <API key> (code, gnu_type,
gnu_lhs, gnu_rhs, gnat_node);
else
{
/* Some operations, e.g. comparisons of arrays, generate complex
trees that need to be annotated while they are being built. */
input_location = saved_location;
gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs);
}
/* If this is a logical shift with the shift count not verified,
we must return zero if it is too large. We cannot compensate
above in this case. */
if ((kind == N_Op_Shift_Left || kind == N_Op_Shift_Right)
&& !Shift_Count_OK (gnat_node))
gnu_result
= build_cond_expr
(gnu_type,
build_binary_op (GE_EXPR, boolean_type_node,
gnu_rhs,
convert (TREE_TYPE (gnu_rhs),
TYPE_SIZE (gnu_type))),
convert (gnu_type, integer_zero_node),
gnu_result);
}
break;
case <API key>:
{
tree gnu_cond = gnat_to_gnu (First (Expressions (gnat_node)));
tree gnu_true = gnat_to_gnu (Next (First (Expressions (gnat_node))));
tree gnu_false
= gnat_to_gnu (Next (Next (First (Expressions (gnat_node)))));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result
= build_cond_expr (gnu_result_type, gnu_cond, gnu_true, gnu_false);
}
break;
case N_Op_Plus:
gnu_result = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
break;
case N_Op_Not:
/* This case can apply to a boolean or a modular type.
Fall through for a boolean operand since GNU_CODES is set
up to handle this. */
if (<API key> (Etype (gnat_node))
|| (Ekind (Etype (gnat_node)) == E_Private_Type
&& <API key> (Full_View (Etype (gnat_node)))))
{
gnu_expr = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = build_unary_op (BIT_NOT_EXPR, gnu_result_type,
gnu_expr);
break;
}
/* ... fall through ... */
case N_Op_Minus: case N_Op_Abs:
gnu_expr = gnat_to_gnu (Right_Opnd (gnat_node));
if (Ekind (Etype (gnat_node)) != E_Private_Type)
gnu_result_type = get_unpadded_type (Etype (gnat_node));
else
gnu_result_type = get_unpadded_type (Base_Type
(Full_View (Etype (gnat_node))));
if (Do_Overflow_Check (gnat_node)
&& !TYPE_UNSIGNED (gnu_result_type)
&& !FLOAT_TYPE_P (gnu_result_type))
gnu_result
= <API key> (gnu_codes[kind],
gnu_result_type, gnu_expr, gnat_node);
else
gnu_result = build_unary_op (gnu_codes[kind],
gnu_result_type, gnu_expr);
break;
case N_Allocator:
{
tree gnu_init = 0;
tree gnu_type;
bool ignore_init_type = false;
gnat_temp = Expression (gnat_node);
/* The Expression operand can either be an N_Identifier or
Expanded_Name, which must represent a type, or a
<API key>, which contains both the object type and an
initial value for the object. */
if (Nkind (gnat_temp) == N_Identifier
|| Nkind (gnat_temp) == N_Expanded_Name)
gnu_type = gnat_to_gnu_type (Entity (gnat_temp));
else if (Nkind (gnat_temp) == <API key>)
{
Entity_Id gnat_desig_type
= Designated_Type (Underlying_Type (Etype (gnat_node)));
ignore_init_type = <API key> (gnat_desig_type);
gnu_init = gnat_to_gnu (Expression (gnat_temp));
gnu_init = <API key> (gnu_init);
if (Do_Range_Check (Expression (gnat_temp)))
gnu_init
= emit_range_check (gnu_init, gnat_desig_type, gnat_temp);
if (Is_Elementary_Type (gnat_desig_type)
|| Is_Constrained (gnat_desig_type))
{
gnu_type = gnat_to_gnu_type (gnat_desig_type);
gnu_init = convert (gnu_type, gnu_init);
}
else
{
gnu_type = gnat_to_gnu_type (Etype (Expression (gnat_temp)));
if (TREE_CODE (gnu_type) == <API key>)
gnu_type = TREE_TYPE (gnu_init);
gnu_init = convert (gnu_type, gnu_init);
}
}
else
gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node));
return build_allocator (gnu_type, gnu_init, gnu_result_type,
Procedure_To_Call (gnat_node),
Storage_Pool (gnat_node), gnat_node,
ignore_init_type);
}
break;
/* Chapter 5: Statements */
case N_Label:
gnu_result = build1 (LABEL_EXPR, void_type_node,
gnat_to_gnu (Identifier (gnat_node)));
break;
case N_Null_Statement:
/* When not optimizing, turn null statements from source into gotos to
the next statement that the middle-end knows how to preserve. */
if (!optimize && Comes_From_Source (gnat_node))
{
tree stmt, label = create_label_decl (NULL_TREE);
start_stmt_group ();
stmt = build1 (GOTO_EXPR, void_type_node, label);
<API key> (stmt, gnat_node);
add_stmt (stmt);
stmt = build1 (LABEL_EXPR, void_type_node, label);
<API key> (stmt, gnat_node);
add_stmt (stmt);
gnu_result = end_stmt_group ();
}
else
gnu_result = alloc_stmt_list ();
break;
case <API key>:
/* Get the LHS and RHS of the statement and convert any reference to an
unconstrained array into a reference to the underlying array. */
gnu_lhs = <API key> (gnat_to_gnu (Name (gnat_node)));
/* If the type has a size that overflows, convert this into raise of
Storage_Error: execution shouldn't have gotten here anyway. */
if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs))) == INTEGER_CST
&& TREE_OVERFLOW (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs))))
gnu_result = build_call_raise (SE_Object_Too_Large, gnat_node,
<API key>);
else if (Nkind (Expression (gnat_node)) == N_Function_Call)
gnu_result
= call_to_gnu (Expression (gnat_node), &gnu_result_type, gnu_lhs);
else
{
gnu_rhs
= <API key> (gnat_to_gnu (Expression (gnat_node)));
/* If range check is needed, emit code to generate it. */
if (Do_Range_Check (Expression (gnat_node)))
gnu_rhs = emit_range_check (gnu_rhs, Etype (Name (gnat_node)),
gnat_node);
gnu_result
= build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_lhs, gnu_rhs);
/* If the type being assigned is an array type and the two sides are
not completely disjoint, play safe and use memmove. But don't do
it for a bit-packed array as it might not be byte-aligned. */
if (TREE_CODE (gnu_result) == MODIFY_EXPR
&& Is_Array_Type (Etype (Name (gnat_node)))
&& !Is_Bit_Packed_Array (Etype (Name (gnat_node)))
&& !(Forwards_OK (gnat_node) && Backwards_OK (gnat_node)))
{
tree to, from, size, to_ptr, from_ptr, t;
to = TREE_OPERAND (gnu_result, 0);
from = TREE_OPERAND (gnu_result, 1);
size = TYPE_SIZE_UNIT (TREE_TYPE (from));
size = <API key> (size, from);
to_ptr = <API key> (to);
from_ptr = <API key> (from);
t = <API key>[BUILT_IN_MEMMOVE];
gnu_result = build_call_expr (t, 3, to_ptr, from_ptr, size);
}
}
break;
case N_If_Statement:
{
tree *gnu_else_ptr; /* Point to put next "else if" or "else". */
/* Make the outer COND_EXPR. Avoid non-determinism. */
gnu_result = build3 (COND_EXPR, void_type_node,
gnat_to_gnu (Condition (gnat_node)),
NULL_TREE, NULL_TREE);
COND_EXPR_THEN (gnu_result)
= build_stmt_group (Then_Statements (gnat_node), false);
TREE_SIDE_EFFECTS (gnu_result) = 1;
gnu_else_ptr = &COND_EXPR_ELSE (gnu_result);
/* Now make a COND_EXPR for each of the "else if" parts. Put each
into the previous "else" part and point to where to put any
outer "else". Also avoid non-determinism. */
if (Present (Elsif_Parts (gnat_node)))
for (gnat_temp = First (Elsif_Parts (gnat_node));
Present (gnat_temp); gnat_temp = Next (gnat_temp))
{
gnu_expr = build3 (COND_EXPR, void_type_node,
gnat_to_gnu (Condition (gnat_temp)),
NULL_TREE, NULL_TREE);
COND_EXPR_THEN (gnu_expr)
= build_stmt_group (Then_Statements (gnat_temp), false);
TREE_SIDE_EFFECTS (gnu_expr) = 1;
<API key> (gnu_expr, gnat_temp);
*gnu_else_ptr = gnu_expr;
gnu_else_ptr = &COND_EXPR_ELSE (gnu_expr);
}
*gnu_else_ptr = build_stmt_group (Else_Statements (gnat_node), false);
}
break;
case N_Case_Statement:
gnu_result = <API key> (gnat_node);
break;
case N_Loop_Statement:
gnu_result = <API key> (gnat_node);
break;
case N_Block_Statement:
start_stmt_group ();
gnat_pushlevel ();
process_decls (Declarations (gnat_node), Empty, Empty, true, true);
add_stmt (gnat_to_gnu (<API key> (gnat_node)));
gnat_poplevel ();
gnu_result = end_stmt_group ();
if (Present (Identifier (gnat_node)))
mark_out_of_scope (Entity (Identifier (gnat_node)));
break;
case N_Exit_Statement:
gnu_result
= build2 (EXIT_STMT, void_type_node,
(Present (Condition (gnat_node))
? gnat_to_gnu (Condition (gnat_node)) : NULL_TREE),
(Present (Name (gnat_node))
? get_gnu_tree (Entity (Name (gnat_node)))
: VEC_last (tree, <API key>)));
break;
case N_Return_Statement:
{
tree gnu_ret_val, gnu_ret_obj;
/* If the subprogram is a function, we must return the expression. */
if (Present (Expression (gnat_node)))
{
tree gnu_subprog_type = TREE_TYPE (<API key>);
tree gnu_ret_type = TREE_TYPE (gnu_subprog_type);
tree gnu_result_decl = DECL_RESULT (<API key>);
gnu_ret_val = gnat_to_gnu (Expression (gnat_node));
/* If this function has copy-in/copy-out parameters, get the real
variable and type for the return. See Subprogram_to_gnu. */
if (TYPE_CI_CO_LIST (gnu_subprog_type))
{
gnu_result_decl = VEC_last (tree, <API key>);
gnu_ret_type = TREE_TYPE (gnu_result_decl);
}
/* Do not remove the padding from GNU_RET_VAL if the inner type is
self-referential since we want to allocate the fixed size. */
if (TREE_CODE (gnu_ret_val) == COMPONENT_REF
&& TYPE_IS_PADDING_P
(TREE_TYPE (TREE_OPERAND (gnu_ret_val, 0)))
&& <API key>
(TYPE_SIZE (TREE_TYPE (gnu_ret_val))))
gnu_ret_val = TREE_OPERAND (gnu_ret_val, 0);
/* If the subprogram returns by direct reference, return a pointer
to the return value. */
if (<API key> (gnu_subprog_type)
|| By_Ref (gnat_node))
gnu_ret_val = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_ret_val);
/* Otherwise, if it returns an unconstrained array, we have to
allocate a new version of the result and return it. */
else if (<API key> (gnu_subprog_type))
{
gnu_ret_val = <API key> (gnu_ret_val);
gnu_ret_val = build_allocator (TREE_TYPE (gnu_ret_val),
gnu_ret_val, gnu_ret_type,
Procedure_To_Call (gnat_node),
Storage_Pool (gnat_node),
gnat_node, false);
}
/* If the subprogram returns by invisible reference, dereference
the pointer it is passed using the type of the return value
and build the copy operation manually. This ensures that we
don't copy too much data, for example if the return type is
unconstrained with a maximum size. */
if (TREE_ADDRESSABLE (gnu_subprog_type))
{
gnu_ret_obj
= build_unary_op (INDIRECT_REF, TREE_TYPE (gnu_ret_val),
gnu_result_decl);
gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE,
gnu_ret_obj, gnu_ret_val);
add_stmt_with_node (gnu_result, gnat_node);
gnu_ret_val = NULL_TREE;
gnu_ret_obj = gnu_result_decl;
}
/* Otherwise, build a regular return. */
else
gnu_ret_obj = gnu_result_decl;
}
else
{
gnu_ret_val = NULL_TREE;
gnu_ret_obj = NULL_TREE;
}
/* If we have a return label defined, convert this into a branch to
that label. The return proper will be handled elsewhere. */
if (VEC_last (tree, <API key>))
{
if (gnu_ret_obj)
add_stmt (build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_ret_obj,
gnu_ret_val));
gnu_result = build1 (GOTO_EXPR, void_type_node,
VEC_last (tree, <API key>));
/* When not optimizing, make sure the return is preserved. */
if (!optimize && Comes_From_Source (gnat_node))
DECL_ARTIFICIAL (VEC_last (tree, <API key>)) = 0;
break;
}
gnu_result = build_return_expr (gnu_ret_obj, gnu_ret_val);
}
break;
case N_Goto_Statement:
gnu_result = build1 (GOTO_EXPR, void_type_node,
gnat_to_gnu (Name (gnat_node)));
break;
/* Chapter 6: Subprograms */
case <API key>:
/* Unless there is a freeze node, declare the subprogram. We consider
this a "definition" even though we're not generating code for
the subprogram because we will be making the corresponding GCC
node here. */
if (No (Freeze_Node (Defining_Entity (Specification (gnat_node)))))
gnat_to_gnu_entity (Defining_Entity (Specification (gnat_node)),
NULL_TREE, 1);
gnu_result = alloc_stmt_list ();
break;
case <API key>:
/* This subprogram doesn't exist for code generation purposes, but we
have to elaborate the types of any parameters and result, unless
they are imported types (nothing to generate in this case).
The parameter list may contain types with freeze nodes, e.g. not null
subtypes, so the subprogram itself may carry a freeze node, in which
case its elaboration must be deferred. */
/* Process the parameter types first. */
if (No (Freeze_Node (Defining_Entity (Specification (gnat_node)))))
for (gnat_temp
= <API key>
(Defining_Entity (Specification (gnat_node)));
Present (gnat_temp);
gnat_temp = <API key> (gnat_temp))
if (Is_Itype (Etype (gnat_temp))
&& !From_With_Type (Etype (gnat_temp)))
gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0);
/* Then the result type, set to Standard_Void_Type for procedures. */
{
Entity_Id gnat_temp_type
= Etype (Defining_Entity (Specification (gnat_node)));
if (Is_Itype (gnat_temp_type) && !From_With_Type (gnat_temp_type))
gnat_to_gnu_entity (Etype (gnat_temp_type), NULL_TREE, 0);
}
gnu_result = alloc_stmt_list ();
break;
case <API key>:
/* For a child unit identifier go up a level to get the specification.
We get this when we try to find the spec of a child unit package
that is the compilation unit being compiled. */
gnu_result = gnat_to_gnu (Parent (gnat_node));
break;
case N_Subprogram_Body:
<API key> (gnat_node);
gnu_result = alloc_stmt_list ();
break;
case N_Function_Call:
case <API key>:
gnu_result = call_to_gnu (gnat_node, &gnu_result_type, NULL_TREE);
break;
/* Chapter 7: Packages */
case <API key>:
gnu_result = gnat_to_gnu (Specification (gnat_node));
break;
case <API key>:
start_stmt_group ();
process_decls (<API key> (gnat_node),
<API key> (gnat_node), Empty, true, true);
gnu_result = end_stmt_group ();
break;
case N_Package_Body:
/* If this is the body of a generic package - do nothing. */
if (Ekind (Corresponding_Spec (gnat_node)) == E_Generic_Package)
{
gnu_result = alloc_stmt_list ();
break;
}
start_stmt_group ();
process_decls (Declarations (gnat_node), Empty, Empty, true, true);
if (Present (<API key> (gnat_node)))
add_stmt (gnat_to_gnu (<API key> (gnat_node)));
gnu_result = end_stmt_group ();
break;
/* Chapter 8: Visibility Rules */
case <API key>:
case N_Use_Type_Clause:
/* Nothing to do here - but these may appear in list of declarations. */
gnu_result = alloc_stmt_list ();
break;
/* Chapter 9: Tasks */
case <API key>:
gnu_result = alloc_stmt_list ();
break;
case <API key>:
gnat_to_gnu_entity (Defining_Entity (gnat_node), NULL_TREE, 1);
gnu_result = alloc_stmt_list ();
break;
/* Chapter 10: Program Structure and Compilation Issues */
case N_Compilation_Unit:
/* This is not called for the main unit on which gigi is invoked. */
<API key> (gnat_node);
gnu_result = alloc_stmt_list ();
break;
case <API key>:
case N_Package_Body_Stub:
case <API key>:
case N_Task_Body_Stub:
/* Simply process whatever unit is being inserted. */
gnu_result = gnat_to_gnu (Unit (Library_Unit (gnat_node)));
break;
case N_Subunit:
gnu_result = gnat_to_gnu (Proper_Body (gnat_node));
break;
/* Chapter 11: Exceptions */
case <API key>:
/* If there is an At_End procedure attached to this node, and the EH
mechanism is SJLJ, we must have at least a corresponding At_End
handler, unless the <API key> restriction is set. */
gcc_assert (type_annotate_only
|| Exception_Mechanism != Setjmp_Longjmp
|| No (At_End_Proc (gnat_node))
|| Present (Exception_Handlers (gnat_node))
|| <API key> ());
gnu_result = <API key> (gnat_node);
break;
case N_Exception_Handler:
if (Exception_Mechanism == Setjmp_Longjmp)
gnu_result = <API key> (gnat_node);
else if (Exception_Mechanism == Back_End_Exceptions)
gnu_result = <API key> (gnat_node);
else
gcc_unreachable ();
break;
case <API key>:
<API key> (&<API key>,
Exception_Label (gnat_node));
break;
case <API key>:
<API key> (&<API key>,
Exception_Label (gnat_node));
break;
case <API key>:
<API key> (&<API key>,
Exception_Label (gnat_node));
break;
case <API key>:
VEC_pop (tree, <API key>);
break;
case <API key>:
VEC_pop (tree, <API key>);
break;
case <API key>:
VEC_pop (tree, <API key>);
break;
/* Chapter 12: Generic Units */
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
case <API key>:
/* These nodes can appear on a declaration list but there is nothing to
to be done with them. */
gnu_result = alloc_stmt_list ();
break;
/* Chapter 13: Representation Clauses and */
/* <API key> Features */
case <API key>:
gnu_result = alloc_stmt_list ();
/* The only one we need to deal with is 'Address since, for the others,
the front-end puts the information elsewhere. */
if (Get_Attribute_Id (Chars (gnat_node)) != Attr_Address)
break;
/* And we only deal with 'Address if the object has a Freeze node. */
gnat_temp = Entity (Name (gnat_node));
if (No (Freeze_Node (gnat_temp)))
break;
/* Get the value to use as the address and save it as the equivalent
for the object. When it is frozen, gnat_to_gnu_entity will do the
right thing. */
save_gnu_tree (gnat_temp, gnat_to_gnu (Expression (gnat_node)), true);
break;
case <API key>:
case <API key>:
case N_At_Clause:
/* We do nothing with these. SEM puts the information elsewhere. */
gnu_result = alloc_stmt_list ();
break;
case N_Code_Statement:
if (!type_annotate_only)
{
tree gnu_template = gnat_to_gnu (Asm_Template (gnat_node));
tree gnu_inputs = NULL_TREE, gnu_outputs = NULL_TREE;
tree gnu_clobbers = NULL_TREE, tail;
bool allows_mem, allows_reg, fake;
int ninputs, noutputs, i;
const char **oconstraints;
const char *constraint;
char *clobber;
/* First retrieve the 3 operand lists built by the front-end. */
Setup_Asm_Outputs (gnat_node);
while (Present (gnat_temp = Asm_Output_Variable ()))
{
tree gnu_value = gnat_to_gnu (gnat_temp);
tree gnu_constr = build_tree_list (NULL_TREE, gnat_to_gnu
(<API key> ()));
gnu_outputs = tree_cons (gnu_constr, gnu_value, gnu_outputs);
Next_Asm_Output ();
}
Setup_Asm_Inputs (gnat_node);
while (Present (gnat_temp = Asm_Input_Value ()))
{
tree gnu_value = gnat_to_gnu (gnat_temp);
tree gnu_constr = build_tree_list (NULL_TREE, gnat_to_gnu
(<API key> ()));
gnu_inputs = tree_cons (gnu_constr, gnu_value, gnu_inputs);
Next_Asm_Input ();
}
Clobber_Setup (gnat_node);
while ((clobber = Clobber_Get_Next ()))
gnu_clobbers
= tree_cons (NULL_TREE,
build_string (strlen (clobber) + 1, clobber),
gnu_clobbers);
/* Then perform some standard checking and processing on the
operands. In particular, mark them addressable if needed. */
gnu_outputs = nreverse (gnu_outputs);
noutputs = list_length (gnu_outputs);
gnu_inputs = nreverse (gnu_inputs);
ninputs = list_length (gnu_inputs);
oconstraints = XALLOCAVEC (const char *, noutputs);
for (i = 0, tail = gnu_outputs; tail; ++i, tail = TREE_CHAIN (tail))
{
tree output = TREE_VALUE (tail);
constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail)));
oconstraints[i] = constraint;
if (<API key> (&constraint, i, ninputs, noutputs,
&allows_mem, &allows_reg, &fake))
{
/* If the operand is going to end up in memory,
mark it addressable. Note that we don't test
allows_mem like in the input case below; this
is modelled on the C front-end. */
if (!allows_reg
&& !<API key> (output))
output = error_mark_node;
}
else
output = error_mark_node;
TREE_VALUE (tail) = output;
}
for (i = 0, tail = gnu_inputs; tail; ++i, tail = TREE_CHAIN (tail))
{
tree input = TREE_VALUE (tail);
constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail)));
if (<API key> (&constraint, i, ninputs, noutputs,
0, oconstraints,
&allows_mem, &allows_reg))
{
/* If the operand is going to end up in memory,
mark it addressable. */
if (!allows_reg && allows_mem
&& !<API key> (input))
input = error_mark_node;
}
else
input = error_mark_node;
TREE_VALUE (tail) = input;
}
gnu_result = build5 (ASM_EXPR, void_type_node,
gnu_template, gnu_outputs,
gnu_inputs, gnu_clobbers, NULL_TREE);
ASM_VOLATILE_P (gnu_result) = Is_Asm_Volatile (gnat_node);
}
else
gnu_result = alloc_stmt_list ();
break;
/* Added Nodes */
case <API key>:
gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* This construct doesn't define a scope so we don't wrap the statement
list in a BIND_EXPR; however, we wrap it in a SAVE_EXPR to protect it
from unsharing. */
gnu_result = build_stmt_group (Actions (gnat_node), false);
gnu_result = build1 (SAVE_EXPR, void_type_node, gnu_result);
TREE_SIDE_EFFECTS (gnu_result) = 1;
gnu_expr = gnat_to_gnu (Expression (gnat_node));
gnu_result
= build_compound_expr (TREE_TYPE (gnu_expr), gnu_result, gnu_expr);
break;
case N_Freeze_Entity:
start_stmt_group ();
<API key> (gnat_node);
process_decls (Actions (gnat_node), Empty, Empty, true, true);
gnu_result = end_stmt_group ();
break;
case N_Itype_Reference:
if (!present_gnu_tree (Itype (gnat_node)))
process_type (Itype (gnat_node));
gnu_result = alloc_stmt_list ();
break;
case N_Free_Statement:
if (!type_annotate_only)
{
tree gnu_ptr = gnat_to_gnu (Expression (gnat_node));
tree gnu_ptr_type = TREE_TYPE (gnu_ptr);
tree gnu_obj_type;
tree gnu_actual_obj_type = 0;
tree gnu_obj_size;
/* If this is a thin pointer, we must dereference it to create
a fat pointer, then go back below to a thin pointer. The
reason for this is that we need a fat pointer someplace in
order to properly compute the size. */
if (<API key> (TREE_TYPE (gnu_ptr)))
gnu_ptr = build_unary_op (ADDR_EXPR, NULL_TREE,
build_unary_op (INDIRECT_REF, NULL_TREE,
gnu_ptr));
/* If this is an unconstrained array, we know the object must
have been allocated with the template in front of the object.
So pass the template address, but get the total size. Do this
by converting to a thin pointer. */
if (<API key> (TREE_TYPE (gnu_ptr)))
gnu_ptr
= convert (build_pointer_type
(<API key>
(<API key> (TREE_TYPE (gnu_ptr)))),
gnu_ptr);
gnu_obj_type = TREE_TYPE (TREE_TYPE (gnu_ptr));
if (Present (<API key> (gnat_node)))
{
gnu_actual_obj_type
= gnat_to_gnu_type (<API key> (gnat_node));
if (<API key> (gnu_ptr_type))
gnu_actual_obj_type
= <API key> (gnu_ptr_type,
gnu_actual_obj_type,
get_identifier ("DEALLOC"),
false);
}
else
gnu_actual_obj_type = gnu_obj_type;
gnu_obj_size = TYPE_SIZE_UNIT (gnu_actual_obj_type);
if (TREE_CODE (gnu_obj_type) == RECORD_TYPE
&& <API key> (gnu_obj_type))
{
tree gnu_char_ptr_type
= build_pointer_type (<API key>);
tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type,
gnu_ptr, gnu_pos);
}
gnu_result
= <API key> (gnu_ptr, gnu_obj_size, gnu_obj_type,
Procedure_To_Call (gnat_node),
Storage_Pool (gnat_node),
gnat_node);
}
break;
case <API key>:
case <API key>:
case <API key>:
{
const int reason = UI_To_Int (Reason (gnat_node));
const Node_Id cond = Condition (gnat_node);
bool handled = false;
if (type_annotate_only)
{
gnu_result = alloc_stmt_list ();
break;
}
gnu_result_type = get_unpadded_type (Etype (gnat_node));
if (<API key>
&& !<API key> ()
&& !get_exception_label (kind)
&& TREE_CODE (gnu_result_type) == VOID_TYPE
&& Present (cond))
{
if (reason == <API key>)
{
gnu_result = <API key> (reason, gnat_node);
handled = true;
}
else if ((reason == <API key>
|| reason == <API key>
|| reason == CE_Invalid_Data)
&& Nkind (cond) == N_Op_Not
&& Nkind (Right_Opnd (cond)) == N_In
&& Nkind (Right_Opnd (Right_Opnd (cond))) == N_Range)
{
Node_Id op = Right_Opnd (cond); /* N_In node */
Node_Id index = Left_Opnd (op);
Node_Id type = Etype (index);
if (Is_Type (type)
&& Known_Esize (type)
&& UI_To_Int (Esize (type)) <= 32)
{
Node_Id right_op = Right_Opnd (op);
gnu_result
= <API key>
(reason, gnat_node,
gnat_to_gnu (index), /* index */
gnat_to_gnu (Low_Bound (right_op)), /* first */
gnat_to_gnu (High_Bound (right_op))); /* last */
handled = true;
}
}
}
if (handled)
{
<API key> (gnu_result, gnat_node);
gnu_result = build3 (COND_EXPR, void_type_node,
gnat_to_gnu (cond),
gnu_result, alloc_stmt_list ());
}
else
{
gnu_result = build_call_raise (reason, gnat_node, kind);
/* If the type is VOID, this is a statement, so we need to generate
the code for the call. Handle a Condition, if there is one. */
if (TREE_CODE (gnu_result_type) == VOID_TYPE)
{
<API key> (gnu_result, gnat_node);
if (Present (cond))
gnu_result = build3 (COND_EXPR, void_type_node,
gnat_to_gnu (cond),
gnu_result, alloc_stmt_list ());
}
else
gnu_result = build1 (NULL_EXPR, gnu_result_type, gnu_result);
}
}
break;
case <API key>:
{
Entity_Id gnat_target_type = Target_Type (gnat_node);
tree gnu_source_type = gnat_to_gnu_type (Source_Type (gnat_node));
tree gnu_target_type = gnat_to_gnu_type (gnat_target_type);
/* No need for any warning in this case. */
if (!<API key>)
;
/* If the result is a pointer type, see if we are either converting
from a non-pointer or from a pointer to a type with a different
alias set and warn if so. If the result is defined in the same
unit as this unchecked conversion, we can allow this because we
can know to make the pointer type behave properly. */
else if (POINTER_TYPE_P (gnu_target_type)
&& !In_Same_Source_Unit (gnat_target_type, gnat_node)
&& !No_Strict_Aliasing (Underlying_Type (gnat_target_type)))
{
tree <API key> = POINTER_TYPE_P (gnu_source_type)
? TREE_TYPE (gnu_source_type)
: NULL_TREE;
tree <API key> = TREE_TYPE (gnu_target_type);
if ((TYPE_DUMMY_P (<API key>)
|| get_alias_set (<API key>) != 0)
&& (!POINTER_TYPE_P (gnu_source_type)
|| (TYPE_DUMMY_P (<API key>)
!= TYPE_DUMMY_P (<API key>))
|| (TYPE_DUMMY_P (<API key>)
&& <API key> != <API key>)
|| !<API key>
(get_alias_set (<API key>),
get_alias_set (<API key>))))
{
post_error_ne
("?possible aliasing problem for type&",
gnat_node, Target_Type (gnat_node));
post_error
("\\?use -fno-strict-aliasing switch for references",
gnat_node);
post_error_ne
("\\?or use `pragma No_Strict_Aliasing (&);`",
gnat_node, Target_Type (gnat_node));
}
}
/* But if the result is a fat pointer type, we have no mechanism to
do that, so we unconditionally warn in problematic cases. */
else if (<API key> (gnu_target_type))
{
tree <API key>
= <API key> (gnu_source_type)
? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_source_type)))
: NULL_TREE;
tree <API key>
= TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_target_type)));
if ((TYPE_DUMMY_P (<API key>)
|| get_alias_set (<API key>) != 0)
&& (!<API key> (gnu_source_type)
|| (TYPE_DUMMY_P (<API key>)
!= TYPE_DUMMY_P (<API key>))
|| (TYPE_DUMMY_P (<API key>)
&& <API key> != <API key>)
|| !<API key>
(get_alias_set (<API key>),
get_alias_set (<API key>))))
{
post_error_ne
("?possible aliasing problem for type&",
gnat_node, Target_Type (gnat_node));
post_error
("\\?use -fno-strict-aliasing switch for references",
gnat_node);
}
}
}
gnu_result = alloc_stmt_list ();
break;
default:
/* SCIL nodes require no processing for GCC. Other nodes should only
be present when annotating types. */
gcc_assert (IN (kind, N_SCIL_Node) || type_annotate_only);
gnu_result = alloc_stmt_list ();
}
/* If we pushed the processing of the elaboration routine, pop it back. */
if (went_into_elab_proc)
<API key> = NULL_TREE;
/* When not optimizing, turn boolean rvalues B into B != false tests
so that the code just below can put the location information of the
reference to B on the inequality operator for better debug info. */
if (!optimize
&& TREE_CODE (gnu_result) != INTEGER_CST
&& (kind == N_Identifier
|| kind == N_Expanded_Name
|| kind == <API key>
|| kind == N_Function_Call
|| kind == N_Indexed_Component
|| kind == <API key>)
&& TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE
&& !lvalue_required_p (gnat_node, gnu_result_type, false, false, false))
gnu_result = build_binary_op (NE_EXPR, gnu_result_type,
convert (gnu_result_type, gnu_result),
convert (gnu_result_type,
boolean_false_node));
/* Set the location information on the result. Note that we may have
no result if we tried to build a CALL_EXPR node to a procedure with
no side-effects and optimization is enabled. */
if (gnu_result && EXPR_P (gnu_result))
<API key> (gnu_result, gnat_node);
/* If we're supposed to return something of void_type, it means we have
something we're elaborating for effect, so just return. */
if (TREE_CODE (gnu_result_type) == VOID_TYPE)
return gnu_result;
/* If the result is a constant that overflowed, raise Constraint_Error. */
if (TREE_CODE (gnu_result) == INTEGER_CST && TREE_OVERFLOW (gnu_result))
{
post_error ("?`Constraint_Error` will be raised at run time", gnat_node);
gnu_result
= build1 (NULL_EXPR, gnu_result_type,
build_call_raise (<API key>, gnat_node,
<API key>));
}
/* If our result has side-effects and is of an unconstrained type,
make a SAVE_EXPR so that we can be sure it will only be referenced
once. Note we must do this before any conversions. */
if (TREE_SIDE_EFFECTS (gnu_result)
&& (TREE_CODE (gnu_result_type) == <API key>
|| <API key> (TYPE_SIZE (gnu_result_type))))
gnu_result = <API key> (gnu_result, false, NULL);
/* Now convert the result to the result type, unless we are in one of the
following cases:
1. If this is the Name of an assignment statement or a parameter of
a procedure call, return the result almost unmodified since the
RHS will have to be converted to our type in that case, unless
the result type has a simpler size. Likewise if there is just
a no-op unchecked conversion in-between. Similarly, don't convert
integral types that are the operands of an unchecked conversion
since we need to ignore those conversions (for 'Valid).
2. If we have a label (which doesn't have any well-defined type), a
field or an error, return the result almost unmodified. Also don't
do the conversion if the result type involves a PLACEHOLDER_EXPR in
its size since those are the cases where the front end may have the
type wrong due to "instantiating" the unconstrained record with
discriminant values. Similarly, if the two types are record types
with the same name don't convert. This will be the case when we are
converting from a packable version of a type to its original type and
we need those conversions to be NOPs in order for assignments into
these types to work properly.
3. If the type is void or if we have no result, return error_mark_node
to show we have no result.
4. Finally, if the type of the result is already correct. */
if (Present (Parent (gnat_node))
&& ((Nkind (Parent (gnat_node)) == <API key>
&& Name (Parent (gnat_node)) == gnat_node)
|| (Nkind (Parent (gnat_node)) == <API key>
&& <API key> (Parent (gnat_node)))
|| (Nkind (Parent (gnat_node)) == <API key>
&& Name (Parent (gnat_node)) != gnat_node)
|| Nkind (Parent (gnat_node)) == <API key>
|| (Nkind (Parent (gnat_node)) == <API key>
&& !AGGREGATE_TYPE_P (gnu_result_type)
&& !AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))))
&& !(TYPE_SIZE (gnu_result_type)
&& TYPE_SIZE (TREE_TYPE (gnu_result))
&& (AGGREGATE_TYPE_P (gnu_result_type)
== AGGREGATE_TYPE_P (TREE_TYPE (gnu_result)))
&& ((TREE_CODE (TYPE_SIZE (gnu_result_type)) == INTEGER_CST
&& (TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_result)))
!= INTEGER_CST))
|| (TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST
&& !<API key> (TYPE_SIZE (gnu_result_type))
&& (<API key>
(TYPE_SIZE (TREE_TYPE (gnu_result))))))
&& !(TREE_CODE (gnu_result_type) == RECORD_TYPE
&& <API key> (gnu_result_type))))
{
/* Remove padding only if the inner object is of self-referential
size: in that case it must be an object of unconstrained type
with a default discriminant and we want to avoid copying too
much data. */
if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_result))
&& <API key> (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS
(TREE_TYPE (gnu_result))))))
gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
gnu_result);
}
else if (TREE_CODE (gnu_result) == LABEL_DECL
|| TREE_CODE (gnu_result) == FIELD_DECL
|| TREE_CODE (gnu_result) == ERROR_MARK
|| (TYPE_SIZE (gnu_result_type)
&& TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST
&& TREE_CODE (gnu_result) != INDIRECT_REF
&& <API key> (TYPE_SIZE (gnu_result_type)))
|| ((TYPE_NAME (gnu_result_type)
== TYPE_NAME (TREE_TYPE (gnu_result)))
&& TREE_CODE (gnu_result_type) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE))
{
/* Remove any padding. */
if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)))
gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
gnu_result);
}
else if (gnu_result == error_mark_node || gnu_result_type == void_type_node)
gnu_result = error_mark_node;
else if (gnu_result_type != TREE_TYPE (gnu_result))
gnu_result = convert (gnu_result_type, gnu_result);
/* We don't need any NOP_EXPR or NON_LVALUE_EXPR on the result. */
while ((TREE_CODE (gnu_result) == NOP_EXPR
|| TREE_CODE (gnu_result) == NON_LVALUE_EXPR)
&& TREE_TYPE (TREE_OPERAND (gnu_result, 0)) == TREE_TYPE (gnu_result))
gnu_result = TREE_OPERAND (gnu_result, 0);
return gnu_result;
}
/* Subroutine of above to push the exception label stack. GNU_STACK is
a pointer to the stack to update and GNAT_LABEL, if present, is the
label to push onto the stack. */
static void
<API key> (VEC(tree,gc) **gnu_stack, Entity_Id gnat_label)
{
tree gnu_label = (Present (gnat_label)
? gnat_to_gnu_entity (gnat_label, NULL_TREE, 0)
: NULL_TREE);
VEC_safe_push (tree, gc, *gnu_stack, gnu_label);
}
/* Record the current code position in GNAT_NODE. */
static void
<API key> (Node_Id gnat_node)
{
tree stmt_stmt = build1 (STMT_STMT, void_type_node, NULL_TREE);
add_stmt_with_node (stmt_stmt, gnat_node);
save_gnu_tree (gnat_node, stmt_stmt, true);
}
/* Insert the code for GNAT_NODE at the position saved for that node. */
static void
insert_code_for (Node_Id gnat_node)
{
STMT_STMT_STMT (get_gnu_tree (gnat_node)) = gnat_to_gnu (gnat_node);
save_gnu_tree (gnat_node, NULL_TREE, true);
}
/* Start a new statement group chained to the previous group. */
void
start_stmt_group (void)
{
struct stmt_group *group = <API key>;
/* First see if we can get one from the free list. */
if (group)
<API key> = group->previous;
else
group = <API key> ();
group->previous = current_stmt_group;
group->stmt_list = group->block = group->cleanups = NULL_TREE;
current_stmt_group = group;
}
/* Add GNU_STMT to the current statement group. If it is an expression with
no effects, it is ignored. */
void
add_stmt (tree gnu_stmt)
{
<API key> (gnu_stmt, ¤t_stmt_group->stmt_list);
}
/* Similar, but the statement is always added, regardless of side-effects. */
void
add_stmt_force (tree gnu_stmt)
{
<API key> (gnu_stmt, ¤t_stmt_group->stmt_list);
}
/* Like add_stmt, but set the location of GNU_STMT to that of GNAT_NODE. */
void
add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node)
{
if (Present (gnat_node))
<API key> (gnu_stmt, gnat_node);
add_stmt (gnu_stmt);
}
/* Similar, but the statement is always added, regardless of side-effects. */
void
<API key> (tree gnu_stmt, Node_Id gnat_node)
{
if (Present (gnat_node))
<API key> (gnu_stmt, gnat_node);
add_stmt_force (gnu_stmt);
}
/* Add a declaration statement for GNU_DECL to the current statement group.
Get SLOC from Entity_Id. */
void
add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
{
tree type = TREE_TYPE (gnu_decl);
tree gnu_stmt, gnu_init, t;
/* If this is a variable that Gigi is to ignore, we may have been given
an ERROR_MARK. So test for it. We also might have been given a
reference for a renaming. So only do something for a decl. Also
ignore a TYPE_DECL for an <API key>. */
if (!DECL_P (gnu_decl)
|| (TREE_CODE (gnu_decl) == TYPE_DECL
&& TREE_CODE (type) == <API key>))
return;
gnu_stmt = build1 (DECL_EXPR, void_type_node, gnu_decl);
/* If we are global, we don't want to actually output the DECL_EXPR for
this decl since we already have evaluated the expressions in the
sizes and positions as globals and doing it again would be wrong. */
if (global_bindings_p ())
{
/* Mark everything as used to prevent node sharing with subprograms.
Note that walk_tree knows how to deal with TYPE_DECL, but neither
VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */
MARK_VISITED (gnu_stmt);
if (TREE_CODE (gnu_decl) == VAR_DECL
|| TREE_CODE (gnu_decl) == CONST_DECL)
{
MARK_VISITED (DECL_SIZE (gnu_decl));
MARK_VISITED (DECL_SIZE_UNIT (gnu_decl));
MARK_VISITED (DECL_INITIAL (gnu_decl));
}
/* In any case, we have to deal with our own TYPE_ADA_SIZE field. */
else if (TREE_CODE (gnu_decl) == TYPE_DECL
&& ((TREE_CODE (type) == RECORD_TYPE
&& !TYPE_FAT_POINTER_P (type))
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE))
MARK_VISITED (TYPE_ADA_SIZE (type));
}
else if (!DECL_EXTERNAL (gnu_decl))
add_stmt_with_node (gnu_stmt, gnat_entity);
/* If this is a variable and an initializer is attached to it, it must be
valid for the context. Similar to init_const in create_var_decl_1. */
if (TREE_CODE (gnu_decl) == VAR_DECL
&& (gnu_init = DECL_INITIAL (gnu_decl)) != NULL_TREE
&& (!<API key> (type, TREE_TYPE (gnu_init))
|| (TREE_STATIC (gnu_decl)
&& !<API key> (gnu_init,
TREE_TYPE (gnu_init)))))
{
/* If GNU_DECL has a padded type, convert it to the unpadded
type so the assignment is done properly. */
if (TYPE_IS_PADDING_P (type))
t = convert (TREE_TYPE (TYPE_FIELDS (type)), gnu_decl);
else
t = gnu_decl;
gnu_stmt = build_binary_op (INIT_EXPR, NULL_TREE, t, gnu_init);
DECL_INITIAL (gnu_decl) = NULL_TREE;
if (TREE_READONLY (gnu_decl))
{
TREE_READONLY (gnu_decl) = 0;
<API key> (gnu_decl) = 1;
}
add_stmt_with_node (gnu_stmt, gnat_entity);
}
}
/* Callback for walk_tree to mark the visited trees rooted at *TP. */
static tree
mark_visited_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
if (TREE_VISITED (t))
*walk_subtrees = 0;
/* Don't mark a dummy type as visited because we want to mark its sizes
and fields once it's filled in. */
else if (!TYPE_IS_DUMMY_P (t))
TREE_VISITED (t) = 1;
if (TYPE_P (t))
<API key> (t) = 1;
return NULL_TREE;
}
/* Mark nodes rooted at T with TREE_VISITED and types as having their
sized gimplified. We use this to indicate all variable sizes and
positions in global types may not be shared by any subprogram. */
void
mark_visited (tree t)
{
walk_tree (&t, mark_visited_r, NULL, NULL);
}
/* Add GNU_CLEANUP, a cleanup action, to the current code group and
set its location to that of GNAT_NODE if present. */
static void
add_cleanup (tree gnu_cleanup, Node_Id gnat_node)
{
if (Present (gnat_node))
<API key> (gnu_cleanup, gnat_node);
<API key> (gnu_cleanup, ¤t_stmt_group->cleanups);
}
/* Set the BLOCK node corresponding to the current code group to GNU_BLOCK. */
void
set_block_for_group (tree gnu_block)
{
gcc_assert (!current_stmt_group->block);
current_stmt_group->block = gnu_block;
}
/* Return code corresponding to the current code group. It is normally
a STATEMENT_LIST, but may also be a BIND_EXPR or TRY_FINALLY_EXPR if
BLOCK or cleanups were set. */
tree
end_stmt_group (void)
{
struct stmt_group *group = current_stmt_group;
tree gnu_retval = group->stmt_list;
/* If this is a null list, allocate a new STATEMENT_LIST. Then, if there
are cleanups, make a TRY_FINALLY_EXPR. Last, if there is a BLOCK,
make a BIND_EXPR. Note that we nest in that because the cleanup may
reference variables in the block. */
if (gnu_retval == NULL_TREE)
gnu_retval = alloc_stmt_list ();
if (group->cleanups)
gnu_retval = build2 (TRY_FINALLY_EXPR, void_type_node, gnu_retval,
group->cleanups);
if (current_stmt_group->block)
gnu_retval = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (group->block),
gnu_retval, group->block);
/* Remove this group from the stack and add it to the free list. */
current_stmt_group = group->previous;
group->previous = <API key>;
<API key> = group;
return gnu_retval;
}
/* Add a list of statements from GNAT_LIST, a possibly-empty list of
statements.*/
static void
add_stmt_list (List_Id gnat_list)
{
Node_Id gnat_node;
if (Present (gnat_list))
for (gnat_node = First (gnat_list); Present (gnat_node);
gnat_node = Next (gnat_node))
add_stmt (gnat_to_gnu (gnat_node));
}
/* Build a tree from GNAT_LIST, a possibly-empty list of statements.
If BINDING_P is true, push and pop a binding level around the list. */
static tree
build_stmt_group (List_Id gnat_list, bool binding_p)
{
start_stmt_group ();
if (binding_p)
gnat_pushlevel ();
add_stmt_list (gnat_list);
if (binding_p)
gnat_poplevel ();
return end_stmt_group ();
}
/* Generate GIMPLE in place for the expression at *EXPR_P. */
int
gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p ATTRIBUTE_UNUSED)
{
tree expr = *expr_p;
tree op;
if (IS_ADA_STMT (expr))
return gnat_gimplify_stmt (expr_p);
switch (TREE_CODE (expr))
{
case NULL_EXPR:
/* If this is for a scalar, just make a VAR_DECL for it. If for
an aggregate, get a null pointer of the appropriate type and
dereference it. */
if (AGGREGATE_TYPE_P (TREE_TYPE (expr)))
*expr_p = build1 (INDIRECT_REF, TREE_TYPE (expr),
convert (build_pointer_type (TREE_TYPE (expr)),
integer_zero_node));
else
{
*expr_p = create_tmp_var (TREE_TYPE (expr), NULL);
TREE_NO_WARNING (*expr_p) = 1;
}
gimplify_and_add (TREE_OPERAND (expr, 0), pre_p);
return GS_OK;
case <API key>:
/* We should only do this if we are just elaborating for side-effects,
but we can't know that yet. */
*expr_p = TREE_OPERAND (*expr_p, 0);
return GS_OK;
case ADDR_EXPR:
op = TREE_OPERAND (expr, 0);
/* If we are taking the address of a constant CONSTRUCTOR, make sure it
is put into static memory. We know that it's going to be read-only
given the semantics we have and it must be in static memory when the
reference is in an elaboration procedure. */
if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op))
{
tree addr = <API key> (<API key> (op));
*expr_p = fold_convert (TREE_TYPE (expr), addr);
return GS_ALL_DONE;
}
/* Otherwise, if we are taking the address of a non-constant CONSTRUCTOR
or of a call, explicitly create the local temporary. That's required
if the type is passed by reference. */
if (TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR)
{
tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C");
TREE_ADDRESSABLE (new_var) = 1;
gimple_add_tmp_var (new_var);
mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op);
gimplify_and_add (mod, pre_p);
TREE_OPERAND (expr, 0) = new_var;
<API key> (expr);
return GS_ALL_DONE;
}
return GS_UNHANDLED;
case VIEW_CONVERT_EXPR:
op = TREE_OPERAND (expr, 0);
/* If we are view-converting a CONSTRUCTOR or a call from an aggregate
type to a scalar one, explicitly create the local temporary. That's
required if the type is passed by reference. */
if ((TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR)
&& AGGREGATE_TYPE_P (TREE_TYPE (op))
&& !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
{
tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C");
gimple_add_tmp_var (new_var);
mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op);
gimplify_and_add (mod, pre_p);
TREE_OPERAND (expr, 0) = new_var;
return GS_OK;
}
return GS_UNHANDLED;
case DECL_EXPR:
op = DECL_EXPR_DECL (expr);
/* The expressions for the RM bounds must be gimplified to ensure that
they are properly elaborated. See gimplify_decl_expr. */
if ((TREE_CODE (op) == TYPE_DECL || TREE_CODE (op) == VAR_DECL)
&& !<API key> (TREE_TYPE (op)))
switch (TREE_CODE (TREE_TYPE (op)))
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
{
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (op)), t, val;
val = TYPE_RM_MIN_VALUE (type);
if (val)
{
<API key> (&val, pre_p);
for (t = type; t; t = TYPE_NEXT_VARIANT (t))
<API key> (t, val);
}
val = TYPE_RM_MAX_VALUE (type);
if (val)
{
<API key> (&val, pre_p);
for (t = type; t; t = TYPE_NEXT_VARIANT (t))
<API key> (t, val);
}
}
break;
default:
break;
}
/* ... fall through ... */
default:
return GS_UNHANDLED;
}
}
/* Generate GIMPLE in place for the statement at *STMT_P. */
static enum gimplify_status
gnat_gimplify_stmt (tree *stmt_p)
{
tree stmt = *stmt_p;
switch (TREE_CODE (stmt))
{
case STMT_STMT:
*stmt_p = STMT_STMT_STMT (stmt);
return GS_OK;
case LOOP_STMT:
{
tree gnu_start_label = <API key> (input_location);
tree gnu_cond = LOOP_STMT_COND (stmt);
tree gnu_update = LOOP_STMT_UPDATE (stmt);
tree gnu_end_label = LOOP_STMT_LABEL (stmt);
tree t;
/* Build the condition expression from the test, if any. */
if (gnu_cond)
gnu_cond
= build3 (COND_EXPR, void_type_node, gnu_cond, alloc_stmt_list (),
build1 (GOTO_EXPR, void_type_node, gnu_end_label));
/* Set to emit the statements of the loop. */
*stmt_p = NULL_TREE;
/* We first emit the start label and then a conditional jump to the
end label if there's a top condition, then the update if it's at
the top, then the body of the loop, then a conditional jump to
the end label if there's a bottom condition, then the update if
it's at the bottom, and finally a jump to the start label and the
definition of the end label. */
<API key> (build1 (LABEL_EXPR, void_type_node,
gnu_start_label),
stmt_p);
if (gnu_cond && !<API key> (stmt))
<API key> (gnu_cond, stmt_p);
if (gnu_update && <API key> (stmt))
<API key> (gnu_update, stmt_p);
<API key> (LOOP_STMT_BODY (stmt), stmt_p);
if (gnu_cond && <API key> (stmt))
<API key> (gnu_cond, stmt_p);
if (gnu_update && !<API key> (stmt))
<API key> (gnu_update, stmt_p);
t = build1 (GOTO_EXPR, void_type_node, gnu_start_label);
SET_EXPR_LOCATION (t, <API key> (gnu_end_label));
<API key> (t, stmt_p);
<API key> (build1 (LABEL_EXPR, void_type_node,
gnu_end_label),
stmt_p);
return GS_OK;
}
case EXIT_STMT:
/* Build a statement to jump to the corresponding end label, then
see if it needs to be conditional. */
*stmt_p = build1 (GOTO_EXPR, void_type_node, EXIT_STMT_LABEL (stmt));
if (EXIT_STMT_COND (stmt))
*stmt_p = build3 (COND_EXPR, void_type_node,
EXIT_STMT_COND (stmt), *stmt_p, alloc_stmt_list ());
return GS_OK;
default:
gcc_unreachable ();
}
}
/* Force references to each of the entities in packages withed by GNAT_NODE.
Operate recursively but check that we aren't elaborating something more
than once.
This routine is exclusively called in type_annotate mode, to compute DDA
information for types in withed units, for ASIS use. */
static void
<API key> (Node_Id gnat_node)
{
Entity_Id gnat_with_clause, gnat_entity;
/* Process each unit only once. As we trace the context of all relevant
units transitively, including generic bodies, we may encounter the
same generic unit repeatedly. */
if (!present_gnu_tree (gnat_node))
save_gnu_tree (gnat_node, integer_zero_node, true);
/* Save entities in all context units. A body may have an implicit_with
on its own spec, if the context includes a child unit, so don't save
the spec twice. */
for (gnat_with_clause = First (Context_Items (gnat_node));
Present (gnat_with_clause);
gnat_with_clause = Next (gnat_with_clause))
if (Nkind (gnat_with_clause) == N_With_Clause
&& !present_gnu_tree (Library_Unit (gnat_with_clause))
&& Library_Unit (gnat_with_clause) != Library_Unit (Cunit (Main_Unit)))
{
<API key> (Library_Unit (gnat_with_clause));
if (Ekind (Entity (Name (gnat_with_clause))) == E_Package)
{
for (gnat_entity = First_Entity (Entity (Name (gnat_with_clause)));
Present (gnat_entity);
gnat_entity = Next_Entity (gnat_entity))
if (Is_Public (gnat_entity)
&& Convention (gnat_entity) != <API key>
&& Ekind (gnat_entity) != E_Package
&& Ekind (gnat_entity) != E_Package_Body
&& Ekind (gnat_entity) != E_Operator
&& !(IN (Ekind (gnat_entity), Type_Kind)
&& !Is_Frozen (gnat_entity))
&& !((Ekind (gnat_entity) == E_Procedure
|| Ekind (gnat_entity) == E_Function)
&& <API key> (gnat_entity))
&& !IN (Ekind (gnat_entity), Named_Kind)
&& !IN (Ekind (gnat_entity), Generic_Unit_Kind))
gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0);
}
else if (Ekind (Entity (Name (gnat_with_clause))) == E_Generic_Package)
{
Node_Id gnat_body
= Corresponding_Body (Unit (Library_Unit (gnat_with_clause)));
/* Retrieve compilation unit node of generic body. */
while (Present (gnat_body)
&& Nkind (gnat_body) != N_Compilation_Unit)
gnat_body = Parent (gnat_body);
/* If body is available, elaborate its context. */
if (Present (gnat_body))
<API key> (gnat_body);
}
}
if (Nkind (Unit (gnat_node)) == N_Package_Body)
<API key> (Library_Unit (gnat_node));
}
/* Do the processing of GNAT_NODE, an N_Freeze_Entity. */
static void
<API key> (Node_Id gnat_node)
{
const Entity_Id gnat_entity = Entity (gnat_node);
const Entity_Kind kind = Ekind (gnat_entity);
tree gnu_old, gnu_new;
/* If this is a package, we need to generate code for the package. */
if (kind == E_Package)
{
insert_code_for
(Parent (Corresponding_Body
(Parent (Declaration_Node (gnat_entity)))));
return;
}
/* Don't do anything for class-wide types as they are always transformed
into their root type. */
if (kind == E_Class_Wide_Type)
return;
/* Check for an old definition. This freeze node might be for an Itype. */
gnu_old
= present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity) : NULL_TREE;
/* If this entity has an address representation clause, GNU_OLD is the
address, so discard it here. */
if (Present (Address_Clause (gnat_entity)))
gnu_old = NULL_TREE;
/* Don't do anything for subprograms that may have been elaborated before
their freeze nodes. This can happen, for example, because of an inner
call in an instance body or because of previous compilation of a spec
for inlining purposes. */
if (gnu_old
&& ((TREE_CODE (gnu_old) == FUNCTION_DECL
&& (kind == E_Function || kind == E_Procedure))
|| (TREE_CODE (TREE_TYPE (gnu_old)) == FUNCTION_TYPE
&& kind == E_Subprogram_Type)))
return;
/* If we have a non-dummy type old tree, we have nothing to do, except
aborting if this is the public view of a private type whose full view was
not delayed, as this node was never delayed as it should have been. We
let this happen for concurrent types and their <API key>,
however, because each might legitimately be elaborated before its own
freeze node, e.g. while processing the other. */
if (gnu_old
&& !(TREE_CODE (gnu_old) == TYPE_DECL
&& TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old))))
{
gcc_assert ((IN (kind, <API key>)
&& Present (Full_View (gnat_entity))
&& No (Freeze_Node (Full_View (gnat_entity))))
|| Is_Concurrent_Type (gnat_entity)
|| (IN (kind, Record_Kind)
&& <API key> (gnat_entity)));
return;
}
/* Reset the saved tree, if any, and elaborate the object or type for real.
If there is a full view, elaborate it and use the result. And, if this
is the root type of a class-wide type, reuse it for the latter. */
if (gnu_old)
{
save_gnu_tree (gnat_entity, NULL_TREE, false);
if (IN (kind, <API key>)
&& Present (Full_View (gnat_entity))
&& present_gnu_tree (Full_View (gnat_entity)))
save_gnu_tree (Full_View (gnat_entity), NULL_TREE, false);
if (IN (kind, Type_Kind)
&& Present (Class_Wide_Type (gnat_entity))
&& Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity)
save_gnu_tree (Class_Wide_Type (gnat_entity), NULL_TREE, false);
}
if (IN (kind, <API key>)
&& Present (Full_View (gnat_entity)))
{
gnu_new = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 1);
/* Propagate back-annotations from full view to partial view. */
if (Unknown_Alignment (gnat_entity))
Set_Alignment (gnat_entity, Alignment (Full_View (gnat_entity)));
if (Unknown_Esize (gnat_entity))
Set_Esize (gnat_entity, Esize (Full_View (gnat_entity)));
if (Unknown_RM_Size (gnat_entity))
Set_RM_Size (gnat_entity, RM_Size (Full_View (gnat_entity)));
/* The above call may have defined this entity (the simplest example
of this is when we have a private enumeral type since the bounds
will have the public view). */
if (!present_gnu_tree (gnat_entity))
save_gnu_tree (gnat_entity, gnu_new, false);
}
else
{
tree gnu_init
= (Nkind (Declaration_Node (gnat_entity)) == <API key>
&& present_gnu_tree (Declaration_Node (gnat_entity)))
? get_gnu_tree (Declaration_Node (gnat_entity)) : NULL_TREE;
gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, 1);
}
if (IN (kind, Type_Kind)
&& Present (Class_Wide_Type (gnat_entity))
&& Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity)
save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false);
/* If we've made any pointers to the old version of this type, we
have to update them. */
if (gnu_old)
update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
TREE_TYPE (gnu_new));
}
/* Elaborate decls in the lists GNAT_DECLS and GNAT_DECLS2, if present.
We make two passes, one to elaborate anything other than bodies (but
we declare a function if there was no spec). The second pass
elaborates the bodies.
GNAT_END_LIST gives the element in the list past the end. Normally,
this is Empty, but can be <API key> for a
<API key>.
We make a complete pass through both lists if PASS1P is true, then make
the second pass over both lists if PASS2P is true. The lists usually
correspond to the public and private parts of a package. */
static void
process_decls (List_Id gnat_decls, List_Id gnat_decls2,
Node_Id gnat_end_list, bool pass1p, bool pass2p)
{
List_Id gnat_decl_array[2];
Node_Id gnat_decl;
int i;
gnat_decl_array[0] = gnat_decls, gnat_decl_array[1] = gnat_decls2;
if (pass1p)
for (i = 0; i <= 1; i++)
if (Present (gnat_decl_array[i]))
for (gnat_decl = First (gnat_decl_array[i]);
gnat_decl != gnat_end_list; gnat_decl = Next (gnat_decl))
{
/* For package specs, we recurse inside the declarations,
thus taking the two pass approach inside the boundary. */
if (Nkind (gnat_decl) == <API key>
&& (Nkind (Specification (gnat_decl)
== <API key>)))
process_decls (<API key> (Specification (gnat_decl)),
<API key> (Specification (gnat_decl)),
Empty, true, false);
/* Similarly for any declarations in the actions of a
freeze node. */
else if (Nkind (gnat_decl) == N_Freeze_Entity)
{
<API key> (gnat_decl);
process_decls (Actions (gnat_decl), Empty, Empty, true, false);
}
/* Package bodies with freeze nodes get their elaboration deferred
until the freeze node, but the code must be placed in the right
place, so record the code position now. */
else if (Nkind (gnat_decl) == N_Package_Body
&& Present (Freeze_Node (Corresponding_Spec (gnat_decl))))
<API key> (gnat_decl);
else if (Nkind (gnat_decl) == N_Package_Body_Stub
&& Present (Library_Unit (gnat_decl))
&& Present (Freeze_Node
(Corresponding_Spec
(Proper_Body (Unit
(Library_Unit (gnat_decl)))))))
<API key>
(Proper_Body (Unit (Library_Unit (gnat_decl))));
/* We defer most subprogram bodies to the second pass. */
else if (Nkind (gnat_decl) == N_Subprogram_Body)
{
if (Acts_As_Spec (gnat_decl))
{
Node_Id gnat_subprog_id = Defining_Entity (gnat_decl);
if (Ekind (gnat_subprog_id) != E_Generic_Procedure
&& Ekind (gnat_subprog_id) != E_Generic_Function)
gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, 1);
}
}
/* For bodies and stubs that act as their own specs, the entity
itself must be elaborated in the first pass, because it may
be used in other declarations. */
else if (Nkind (gnat_decl) == <API key>)
{
Node_Id gnat_subprog_id
= Defining_Entity (Specification (gnat_decl));
if (Ekind (gnat_subprog_id) != E_Subprogram_Body
&& Ekind (gnat_subprog_id) != E_Generic_Procedure
&& Ekind (gnat_subprog_id) != E_Generic_Function)
gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, 1);
}
/* Concurrent stubs stand for the corresponding subprogram bodies,
which are deferred like other bodies. */
else if (Nkind (gnat_decl) == N_Task_Body_Stub
|| Nkind (gnat_decl) == <API key>)
;
else
add_stmt (gnat_to_gnu (gnat_decl));
}
/* Here we elaborate everything we deferred above except for package bodies,
which are elaborated at their freeze nodes. Note that we must also
go inside things (package specs and freeze nodes) the first pass did. */
if (pass2p)
for (i = 0; i <= 1; i++)
if (Present (gnat_decl_array[i]))
for (gnat_decl = First (gnat_decl_array[i]);
gnat_decl != gnat_end_list; gnat_decl = Next (gnat_decl))
{
if (Nkind (gnat_decl) == N_Subprogram_Body
|| Nkind (gnat_decl) == <API key>
|| Nkind (gnat_decl) == N_Task_Body_Stub
|| Nkind (gnat_decl) == <API key>)
add_stmt (gnat_to_gnu (gnat_decl));
else if (Nkind (gnat_decl) == <API key>
&& (Nkind (Specification (gnat_decl)
== <API key>)))
process_decls (<API key> (Specification (gnat_decl)),
<API key> (Specification (gnat_decl)),
Empty, false, true);
else if (Nkind (gnat_decl) == N_Freeze_Entity)
process_decls (Actions (gnat_decl), Empty, Empty, false, true);
}
}
/* Make a unary operation of kind CODE using build_unary_op, but guard
the operation by an overflow check. CODE can be one of NEGATE_EXPR
or ABS_EXPR. GNU_TYPE is the type desired for the result. Usually
the operation is to be performed in that type. GNAT_NODE is the gnat
node conveying the source location for which the error should be
signaled. */
static tree
<API key> (enum tree_code code, tree gnu_type, tree operand,
Node_Id gnat_node)
{
gcc_assert (code == NEGATE_EXPR || code == ABS_EXPR);
operand = gnat_protect_expr (operand);
return emit_check (build_binary_op (EQ_EXPR, boolean_type_node,
operand, TYPE_MIN_VALUE (gnu_type)),
build_unary_op (code, gnu_type, operand),
<API key>, gnat_node);
}
/* Make a binary operation of kind CODE using build_binary_op, but guard
the operation by an overflow check. CODE can be one of PLUS_EXPR,
MINUS_EXPR or MULT_EXPR. GNU_TYPE is the type desired for the result.
Usually the operation is to be performed in that type. GNAT_NODE is
the GNAT node conveying the source location for which the error should
be signaled. */
static tree
<API key> (enum tree_code code, tree gnu_type, tree left,
tree right, Node_Id gnat_node)
{
tree lhs = gnat_protect_expr (left);
tree rhs = gnat_protect_expr (right);
tree type_max = TYPE_MAX_VALUE (gnu_type);
tree type_min = TYPE_MIN_VALUE (gnu_type);
tree gnu_expr;
tree tmp1, tmp2;
tree zero = convert (gnu_type, integer_zero_node);
tree rhs_lt_zero;
tree check_pos;
tree check_neg;
tree check;
int precision = TYPE_PRECISION (gnu_type);
gcc_assert (!(precision & (precision - 1))); /* ensure power of 2 */
/* Prefer a constant or known-positive rhs to simplify checks. */
if (!TREE_CONSTANT (rhs)
&& <API key> (code)
&& (TREE_CONSTANT (lhs) || (!<API key> (rhs)
&& <API key> (lhs))))
{
tree tmp = lhs;
lhs = rhs;
rhs = tmp;
}
rhs_lt_zero = <API key> (rhs)
? boolean_false_node
: build_binary_op (LT_EXPR, boolean_type_node, rhs, zero);
/* ??? Should use more efficient check for operand_equal_p (lhs, rhs, 0) */
/* Try a few strategies that may be cheaper than the general
code at the end of the function, if the rhs is not known.
The strategies are:
- Call library function for 64-bit multiplication (complex)
- Widen, if input arguments are sufficiently small
- Determine overflow using wrapped result for addition/subtraction. */
if (!TREE_CONSTANT (rhs))
{
/* Even for add/subtract double size to get another base type. */
int needed_precision = precision * 2;
if (code == MULT_EXPR && precision == 64)
{
tree int_64 = gnat_type_for_size (64, 0);
return convert (gnu_type, build_call_2_expr (mulv64_decl,
convert (int_64, lhs),
convert (int_64, rhs)));
}
else if (needed_precision <= BITS_PER_WORD
|| (code == MULT_EXPR
&& needed_precision <= LONG_LONG_TYPE_SIZE))
{
tree wide_type = gnat_type_for_size (needed_precision, 0);
tree wide_result = build_binary_op (code, wide_type,
convert (wide_type, lhs),
convert (wide_type, rhs));
tree check = build_binary_op
(TRUTH_ORIF_EXPR, boolean_type_node,
build_binary_op (LT_EXPR, boolean_type_node, wide_result,
convert (wide_type, type_min)),
build_binary_op (GT_EXPR, boolean_type_node, wide_result,
convert (wide_type, type_max)));
tree result = convert (gnu_type, wide_result);
return
emit_check (check, result, <API key>, gnat_node);
}
else if (code == PLUS_EXPR || code == MINUS_EXPR)
{
tree unsigned_type = gnat_type_for_size (precision, 1);
tree wrapped_expr = convert
(gnu_type, build_binary_op (code, unsigned_type,
convert (unsigned_type, lhs),
convert (unsigned_type, rhs)));
tree result = convert
(gnu_type, build_binary_op (code, gnu_type, lhs, rhs));
/* Overflow when (rhs < 0) ^ (wrapped_expr < lhs)), for addition
or when (rhs < 0) ^ (wrapped_expr > lhs) for subtraction. */
tree check = build_binary_op
(TRUTH_XOR_EXPR, boolean_type_node, rhs_lt_zero,
build_binary_op (code == PLUS_EXPR ? LT_EXPR : GT_EXPR,
boolean_type_node, wrapped_expr, lhs));
return
emit_check (check, result, <API key>, gnat_node);
}
}
switch (code)
{
case PLUS_EXPR:
/* When rhs >= 0, overflow when lhs > type_max - rhs. */
check_pos = build_binary_op (GT_EXPR, boolean_type_node, lhs,
build_binary_op (MINUS_EXPR, gnu_type,
type_max, rhs)),
/* When rhs < 0, overflow when lhs < type_min - rhs. */
check_neg = build_binary_op (LT_EXPR, boolean_type_node, lhs,
build_binary_op (MINUS_EXPR, gnu_type,
type_min, rhs));
break;
case MINUS_EXPR:
/* When rhs >= 0, overflow when lhs < type_min + rhs. */
check_pos = build_binary_op (LT_EXPR, boolean_type_node, lhs,
build_binary_op (PLUS_EXPR, gnu_type,
type_min, rhs)),
/* When rhs < 0, overflow when lhs > type_max + rhs. */
check_neg = build_binary_op (GT_EXPR, boolean_type_node, lhs,
build_binary_op (PLUS_EXPR, gnu_type,
type_max, rhs));
break;
case MULT_EXPR:
/* The check here is designed to be efficient if the rhs is constant,
but it will work for any rhs by using integer division.
Four different check expressions determine whether X * C overflows,
depending on C.
C == 0 => false
C > 0 => X > type_max / C || X < type_min / C
C == -1 => X == type_min
C < -1 => X > type_min / C || X < type_max / C */
tmp1 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_max, rhs);
tmp2 = build_binary_op (TRUNC_DIV_EXPR, gnu_type, type_min, rhs);
check_pos
= build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node,
build_binary_op (NE_EXPR, boolean_type_node, zero,
rhs),
build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
build_binary_op (GT_EXPR,
boolean_type_node,
lhs, tmp1),
build_binary_op (LT_EXPR,
boolean_type_node,
lhs, tmp2)));
check_neg
= fold_build3 (COND_EXPR, boolean_type_node,
build_binary_op (EQ_EXPR, boolean_type_node, rhs,
build_int_cst (gnu_type, -1)),
build_binary_op (EQ_EXPR, boolean_type_node, lhs,
type_min),
build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
build_binary_op (GT_EXPR,
boolean_type_node,
lhs, tmp2),
build_binary_op (LT_EXPR,
boolean_type_node,
lhs, tmp1)));
break;
default:
gcc_unreachable();
}
gnu_expr = build_binary_op (code, gnu_type, lhs, rhs);
/* If we can fold the expression to a constant, just return it.
The caller will deal with overflow, no need to generate a check. */
if (TREE_CONSTANT (gnu_expr))
return gnu_expr;
check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg,
check_pos);
return emit_check (check, gnu_expr, <API key>, gnat_node);
}
/* Emit code for a range check. GNU_EXPR is the expression to be checked,
GNAT_RANGE_TYPE the gnat type or subtype containing the bounds against
which we have to check. GNAT_NODE is the GNAT node conveying the source
location for which the error should be signaled. */
static tree
emit_range_check (tree gnu_expr, Entity_Id gnat_range_type, Node_Id gnat_node)
{
tree gnu_range_type = get_unpadded_type (gnat_range_type);
tree gnu_low = TYPE_MIN_VALUE (gnu_range_type);
tree gnu_high = TYPE_MAX_VALUE (gnu_range_type);
tree gnu_compare_type = get_base_type (TREE_TYPE (gnu_expr));
/* If GNU_EXPR has GNAT_RANGE_TYPE as its base type, no check is needed.
This can for example happen when translating 'Val or 'Value. */
if (gnu_compare_type == gnu_range_type)
return gnu_expr;
/* If GNU_EXPR has an integral type that is narrower than GNU_RANGE_TYPE,
we can't do anything since we might be truncating the bounds. No
check is needed in this case. */
if (INTEGRAL_TYPE_P (TREE_TYPE (gnu_expr))
&& (TYPE_PRECISION (gnu_compare_type)
< TYPE_PRECISION (get_base_type (gnu_range_type))))
return gnu_expr;
/* Checked expressions must be evaluated only once. */
gnu_expr = gnat_protect_expr (gnu_expr);
/* Note that the form of the check is
(not (expr >= lo)) or (not (expr <= hi))
the reason for this slightly convoluted form is that NaNs
are not considered to be in range in the float case. */
return emit_check
(build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
invert_truthvalue
(build_binary_op (GE_EXPR, boolean_type_node,
convert (gnu_compare_type, gnu_expr),
convert (gnu_compare_type, gnu_low))),
invert_truthvalue
(build_binary_op (LE_EXPR, boolean_type_node,
convert (gnu_compare_type, gnu_expr),
convert (gnu_compare_type,
gnu_high)))),
gnu_expr, <API key>, gnat_node);
}
/* Emit code for an index check. GNU_ARRAY_OBJECT is the array object which
we are about to index, GNU_EXPR is the index expression to be checked,
GNU_LOW and GNU_HIGH are the lower and upper bounds against which GNU_EXPR
has to be checked. Note that for index checking we cannot simply use the
emit_range_check function (although very similar code needs to be generated
in both cases) since for index checking the array type against which we are
checking the indices may be unconstrained and consequently we need to get
the actual index bounds from the array object itself (GNU_ARRAY_OBJECT).
The place where we need to do that is in subprograms having unconstrained
array formal parameters. GNAT_NODE is the GNAT node conveying the source
location for which the error should be signaled. */
static tree
emit_index_check (tree gnu_array_object, tree gnu_expr, tree gnu_low,
tree gnu_high, Node_Id gnat_node)
{
tree gnu_expr_check;
/* Checked expressions must be evaluated only once. */
gnu_expr = gnat_protect_expr (gnu_expr);
/* Must do this computation in the base type in case the expression's
type is an unsigned subtypes. */
gnu_expr_check = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
/* If GNU_LOW or GNU_HIGH are a PLACEHOLDER_EXPR, qualify them by
the object we are handling. */
gnu_low = <API key> (gnu_low, gnu_array_object);
gnu_high = <API key> (gnu_high, gnu_array_object);
return emit_check
(build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node,
build_binary_op (LT_EXPR, boolean_type_node,
gnu_expr_check,
convert (TREE_TYPE (gnu_expr_check),
gnu_low)),
build_binary_op (GT_EXPR, boolean_type_node,
gnu_expr_check,
convert (TREE_TYPE (gnu_expr_check),
gnu_high))),
gnu_expr, <API key>, gnat_node);
}
/* GNU_COND contains the condition corresponding to an access, discriminant or
range check of value GNU_EXPR. Build a COND_EXPR that returns GNU_EXPR if
GNU_COND is false and raises a CONSTRAINT_ERROR if GNU_COND is true.
REASON is the code that says why the exception was raised. GNAT_NODE is
the GNAT node conveying the source location for which the error should be
signaled. */
static tree
emit_check (tree gnu_cond, tree gnu_expr, int reason, Node_Id gnat_node)
{
tree gnu_call
= build_call_raise (reason, gnat_node, <API key>);
tree gnu_result
= fold_build3 (COND_EXPR, TREE_TYPE (gnu_expr), gnu_cond,
build2 (COMPOUND_EXPR, TREE_TYPE (gnu_expr), gnu_call,
convert (TREE_TYPE (gnu_expr), integer_zero_node)),
gnu_expr);
/* GNU_RESULT has side effects if and only if GNU_EXPR has:
we don't need to evaluate it just for the check. */
TREE_SIDE_EFFECTS (gnu_result) = TREE_SIDE_EFFECTS (gnu_expr);
return gnu_result;
}
/* Return an expression that converts GNU_EXPR to GNAT_TYPE, doing overflow
checks if OVERFLOW_P is true and range checks if RANGE_P is true.
GNAT_TYPE is known to be an integral type. If TRUNCATE_P true, do a
float to integer conversion with truncation; otherwise round.
GNAT_NODE is the GNAT node conveying the source location for which the
error should be signaled. */
static tree
convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp,
bool rangep, bool truncatep, Node_Id gnat_node)
{
tree gnu_type = get_unpadded_type (gnat_type);
tree gnu_in_type = TREE_TYPE (gnu_expr);
tree gnu_in_basetype = get_base_type (gnu_in_type);
tree gnu_base_type = get_base_type (gnu_type);
tree gnu_result = gnu_expr;
/* If we are not doing any checks, the output is an integral type, and
the input is not a floating type, just do the conversion. This
shortcut is required to avoid problems with packed array types
and simplifies code in all cases anyway. */
if (!rangep && !overflowp && INTEGRAL_TYPE_P (gnu_base_type)
&& !FLOAT_TYPE_P (gnu_in_type))
return convert (gnu_type, gnu_expr);
/* First convert the expression to its base type. This
will never generate code, but makes the tests below much simpler.
But don't do this if converting from an integer type to an unconstrained
array type since then we need to get the bounds from the original
(unpacked) type. */
if (TREE_CODE (gnu_type) != <API key>)
gnu_result = convert (gnu_in_basetype, gnu_result);
/* If overflow checks are requested, we need to be sure the result will
fit in the output base type. But don't do this if the input
is integer and the output floating-point. */
if (overflowp
&& !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype)))
{
/* Ensure GNU_EXPR only gets evaluated once. */
tree gnu_input = gnat_protect_expr (gnu_result);
tree gnu_cond = integer_zero_node;
tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);
tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);
tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);
tree gnu_out_ub = TYPE_MAX_VALUE (gnu_base_type);
/* Convert the lower bounds to signed types, so we're sure we're
comparing them properly. Likewise, convert the upper bounds
to unsigned types. */
if (INTEGRAL_TYPE_P (gnu_in_basetype) && TYPE_UNSIGNED (gnu_in_basetype))
gnu_in_lb = convert (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
if (INTEGRAL_TYPE_P (gnu_in_basetype)
&& !TYPE_UNSIGNED (gnu_in_basetype))
gnu_in_ub = convert (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
if (INTEGRAL_TYPE_P (gnu_base_type) && TYPE_UNSIGNED (gnu_base_type))
gnu_out_lb = convert (gnat_signed_type (gnu_base_type), gnu_out_lb);
if (INTEGRAL_TYPE_P (gnu_base_type) && !TYPE_UNSIGNED (gnu_base_type))
gnu_out_ub = convert (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
/* Check each bound separately and only if the result bound
is tighter than the bound on the input type. Note that all the
types are base types, so the bounds must be constant. Also,
the comparison is done in the base type of the input, which
always has the proper signedness. First check for input
integer (which means output integer), output float (which means
both float), or mixed, in which case we always compare.
Note that we have to do the comparison which would *fail* in the
case of an error since if it's an FP comparison and one of the
values is a NaN or Inf, the comparison will fail. */
if (INTEGRAL_TYPE_P (gnu_in_basetype)
? tree_int_cst_lt (gnu_in_lb, gnu_out_lb)
: (FLOAT_TYPE_P (gnu_base_type)
? REAL_VALUES_LESS (TREE_REAL_CST (gnu_in_lb),
TREE_REAL_CST (gnu_out_lb))
: 1))
gnu_cond
= invert_truthvalue
(build_binary_op (GE_EXPR, boolean_type_node,
gnu_input, convert (gnu_in_basetype,
gnu_out_lb)));
if (INTEGRAL_TYPE_P (gnu_in_basetype)
? tree_int_cst_lt (gnu_out_ub, gnu_in_ub)
: (FLOAT_TYPE_P (gnu_base_type)
? REAL_VALUES_LESS (TREE_REAL_CST (gnu_out_ub),
TREE_REAL_CST (gnu_in_lb))
: 1))
gnu_cond
= build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_cond,
invert_truthvalue
(build_binary_op (LE_EXPR, boolean_type_node,
gnu_input,
convert (gnu_in_basetype,
gnu_out_ub))));
if (!integer_zerop (gnu_cond))
gnu_result = emit_check (gnu_cond, gnu_input,
<API key>, gnat_node);
}
/* Now convert to the result base type. If this is a non-truncating
float-to-integer conversion, round. */
if (INTEGRAL_TYPE_P (gnu_base_type) && FLOAT_TYPE_P (gnu_in_basetype)
&& !truncatep)
{
REAL_VALUE_TYPE <API key>, pred_half;
tree gnu_conv, gnu_zero, gnu_comp, calc_type;
tree gnu_pred_half, gnu_add_pred_half, <API key>;
const struct real_format *fmt;
/* The following calculations depend on proper rounding to even
of each arithmetic operation. In order to prevent excess
precision from spoiling this property, use the widest hardware
floating-point type if FP_ARITH_MAY_WIDEN is true. */
calc_type
= FP_ARITH_MAY_WIDEN ? <API key> : gnu_in_basetype;
/* FIXME: Should not have padding in the first place. */
if (TYPE_IS_PADDING_P (calc_type))
calc_type = TREE_TYPE (TYPE_FIELDS (calc_type));
/* Compute the exact value calc_type'Pred (0.5) at compile time. */
fmt = REAL_MODE_FORMAT (TYPE_MODE (calc_type));
real_2expN (&<API key>, -(fmt->p) - 1, TYPE_MODE (calc_type));
REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf,
<API key>);
gnu_pred_half = build_real (calc_type, pred_half);
/* If the input is strictly negative, subtract this value
and otherwise add it from the input. For 0.5, the result
is exactly between 1.0 and the machine number preceding 1.0
(for calc_type). Since the last bit of 1.0 is even, this 0.5
will round to 1.0, while all other number with an absolute
value less than 0.5 round to 0.0. For larger numbers exactly
halfway between integers, rounding will always be correct as
the true mathematical result will be closer to the higher
integer compared to the lower one. So, this constant works
for all floating-point numbers.
The reason to use the same constant with subtract/add instead
of a positive and negative constant is to allow the comparison
to be scheduled in parallel with retrieval of the constant and
conversion of the input to the calc_type (if necessary). */
gnu_zero = convert (gnu_in_basetype, integer_zero_node);
gnu_result = gnat_protect_expr (gnu_result);
gnu_conv = convert (calc_type, gnu_result);
gnu_comp
= fold_build2 (GE_EXPR, boolean_type_node, gnu_result, gnu_zero);
gnu_add_pred_half
= fold_build2 (PLUS_EXPR, calc_type, gnu_conv, gnu_pred_half);
<API key>
= fold_build2 (MINUS_EXPR, calc_type, gnu_conv, gnu_pred_half);
gnu_result = fold_build3 (COND_EXPR, calc_type, gnu_comp,
gnu_add_pred_half, <API key>);
}
if (TREE_CODE (gnu_base_type) == INTEGER_TYPE
&& <API key> (gnu_base_type)
&& TREE_CODE (gnu_result) == <API key>)
gnu_result = unchecked_convert (gnu_base_type, gnu_result, false);
else
gnu_result = convert (gnu_base_type, gnu_result);
/* Finally, do the range check if requested. Note that if the result type
is a modular type, the range check is actually an overflow check. */
if (rangep
|| (TREE_CODE (gnu_base_type) == INTEGER_TYPE
&& TYPE_MODULAR_P (gnu_base_type) && overflowp))
gnu_result = emit_range_check (gnu_result, gnat_type, gnat_node);
return convert (gnu_type, gnu_result);
}
/* Return true if TYPE is a smaller form of ORIG_TYPE. */
static bool
smaller_form_type_p (tree type, tree orig_type)
{
tree size, osize;
/* We're not interested in variants here. */
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig_type))
return false;
/* Like a variant, a packable version keeps the original TYPE_NAME. */
if (TYPE_NAME (type) != TYPE_NAME (orig_type))
return false;
size = TYPE_SIZE (type);
osize = TYPE_SIZE (orig_type);
if (!(TREE_CODE (size) == INTEGER_CST && TREE_CODE (osize) == INTEGER_CST))
return false;
return tree_int_cst_lt (size, osize) != 0;
}
static bool
addressable_p (tree gnu_expr, tree gnu_type)
{
/* For an integral type, the size of the actual type of the object may not
be greater than that of the expected type, otherwise an indirect access
in the latter type wouldn't correctly set all the bits of the object. */
if (gnu_type
&& INTEGRAL_TYPE_P (gnu_type)
&& smaller_form_type_p (gnu_type, TREE_TYPE (gnu_expr)))
return false;
/* The size of the actual type of the object may not be smaller than that
of the expected type, otherwise an indirect access in the latter type
would be larger than the object. But only record types need to be
considered in practice for this case. */
if (gnu_type
&& TREE_CODE (gnu_type) == RECORD_TYPE
&& smaller_form_type_p (TREE_TYPE (gnu_expr), gnu_type))
return false;
switch (TREE_CODE (gnu_expr))
{
case VAR_DECL:
case PARM_DECL:
case FUNCTION_DECL:
case RESULT_DECL:
/* All DECLs are addressable: if they are in a register, we can force
them to memory. */
return true;
case <API key>:
case INDIRECT_REF:
/* Taking the address of a dereference yields the original pointer. */
return true;
case STRING_CST:
case INTEGER_CST:
/* Taking the address yields a pointer to the constant pool. */
return true;
case CONSTRUCTOR:
/* Taking the address of a static constructor yields a pointer to the
tree constant pool. */
return TREE_STATIC (gnu_expr) ? true : false;
case NULL_EXPR:
case SAVE_EXPR:
case CALL_EXPR:
case PLUS_EXPR:
case MINUS_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case BIT_AND_EXPR:
case BIT_NOT_EXPR:
return true;
case COMPOUND_EXPR:
/* The address of a compound expression is that of its 2nd operand. */
return addressable_p (TREE_OPERAND (gnu_expr, 1), gnu_type);
case COND_EXPR:
/* We accept &COND_EXPR as soon as both operands are addressable and
expect the outcome to be the address of the selected operand. */
return (addressable_p (TREE_OPERAND (gnu_expr, 1), NULL_TREE)
&& addressable_p (TREE_OPERAND (gnu_expr, 2), NULL_TREE));
case COMPONENT_REF:
return (((!DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1))
/* Even with DECL_BIT_FIELD cleared, we have to ensure that
the field is sufficiently aligned, in case it is subject
to a pragma Component_Alignment. But we don't need to
check the alignment of the containing record, as it is
guaranteed to be not smaller than that of its most
aligned field that is not a bit-field. */
&& (!STRICT_ALIGNMENT
|| DECL_ALIGN (TREE_OPERAND (gnu_expr, 1))
>= TYPE_ALIGN (TREE_TYPE (gnu_expr))))
/* The field of a padding record is always addressable. */
|| TYPE_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))))
&& addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE));
case ARRAY_REF: case ARRAY_RANGE_REF:
case REALPART_EXPR: case IMAGPART_EXPR:
case NOP_EXPR:
return addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE);
case CONVERT_EXPR:
return (AGGREGATE_TYPE_P (TREE_TYPE (gnu_expr))
&& addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE));
case VIEW_CONVERT_EXPR:
{
/* This is addressable if we can avoid a copy. */
tree type = TREE_TYPE (gnu_expr);
tree inner_type = TREE_TYPE (TREE_OPERAND (gnu_expr, 0));
return (((TYPE_MODE (type) == TYPE_MODE (inner_type)
&& (!STRICT_ALIGNMENT
|| TYPE_ALIGN (type) <= TYPE_ALIGN (inner_type)
|| TYPE_ALIGN (inner_type) >= BIGGEST_ALIGNMENT))
|| ((TYPE_MODE (type) == BLKmode
|| TYPE_MODE (inner_type) == BLKmode)
&& (!STRICT_ALIGNMENT
|| TYPE_ALIGN (type) <= TYPE_ALIGN (inner_type)
|| TYPE_ALIGN (inner_type) >= BIGGEST_ALIGNMENT
|| TYPE_ALIGN_OK (type)
|| TYPE_ALIGN_OK (inner_type))))
&& addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE));
}
default:
return false;
}
}
/* Do the processing for the declaration of a GNAT_ENTITY, a type. If
a separate Freeze node exists, delay the bulk of the processing. Otherwise
make a GCC type for GNAT_ENTITY and set up the correspondence. */
void
process_type (Entity_Id gnat_entity)
{
tree gnu_old
= present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity) : 0;
tree gnu_new;
/* If we are to delay elaboration of this type, just do any
elaborations needed for expressions within the declaration and
make a dummy type entry for this node and its Full_View (if
any) in case something points to it. Don't do this if it
has already been done (the only way that can happen is if
the private completion is also delayed). */
if (Present (Freeze_Node (gnat_entity))
|| (IN (Ekind (gnat_entity), <API key>)
&& Present (Full_View (gnat_entity))
&& Freeze_Node (Full_View (gnat_entity))
&& !present_gnu_tree (Full_View (gnat_entity))))
{
elaborate_entity (gnat_entity);
if (!gnu_old)
{
tree gnu_decl = TYPE_STUB_DECL (make_dummy_type (gnat_entity));
save_gnu_tree (gnat_entity, gnu_decl, false);
if (IN (Ekind (gnat_entity), <API key>)
&& Present (Full_View (gnat_entity)))
save_gnu_tree (Full_View (gnat_entity), gnu_decl, false);
}
return;
}
/* If we saved away a dummy type for this node it means that this
made the type that corresponds to the full type of an incomplete
type. Clear that type for now and then update the type in the
pointers. */
if (gnu_old)
{
gcc_assert (TREE_CODE (gnu_old) == TYPE_DECL
&& TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)));
save_gnu_tree (gnat_entity, NULL_TREE, false);
}
/* Now fully elaborate the type. */
gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1);
gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL);
/* If we have an old type and we've made pointers to this type,
update those pointers. */
if (gnu_old)
update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)),
TREE_TYPE (gnu_new));
/* If this is a record type corresponding to a task or protected type
that is a completion of an incomplete type, perform a similar update
on the type. ??? Including protected types here is a guess. */
if (IN (Ekind (gnat_entity), Record_Kind)
&& <API key> (gnat_entity)
&& present_gnu_tree (<API key> (gnat_entity)))
{
tree gnu_task_old
= get_gnu_tree (<API key> (gnat_entity));
save_gnu_tree (<API key> (gnat_entity),
NULL_TREE, false);
save_gnu_tree (<API key> (gnat_entity),
gnu_new, false);
update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_task_old)),
TREE_TYPE (gnu_new));
}
}
/* GNAT_ENTITY is the type of the resulting constructors,
GNAT_ASSOC is the front of the <API key> of an N_Aggregate,
and GNU_TYPE is the GCC type of the corresponding record.
Return a CONSTRUCTOR to build the record. */
static tree
<API key> (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type)
{
tree gnu_list, gnu_result;
/* We test for GNU_FIELD being empty in the case where a variant
was the last thing since we don't take things off GNAT_ASSOC in
that case. We check GNAT_ASSOC in case we have a variant, but it
has no fields. */
for (gnu_list = NULL_TREE; Present (gnat_assoc);
gnat_assoc = Next (gnat_assoc))
{
Node_Id gnat_field = First (Choices (gnat_assoc));
tree gnu_field = <API key> (Entity (gnat_field));
tree gnu_expr = gnat_to_gnu (Expression (gnat_assoc));
/* The expander is supposed to put a single component selector name
in every record component association. */
gcc_assert (No (Next (gnat_field)));
/* Ignore fields that have <API key> since we'll
be setting that field in the parent. */
if (Present (<API key> (Entity (gnat_field)))
&& Is_Tagged_Type (Scope (Entity (gnat_field))))
continue;
/* Also ignore discriminants of Unchecked_Unions. */
else if (Is_Unchecked_Union (gnat_entity)
&& Ekind (Entity (gnat_field)) == E_Discriminant)
continue;
/* Before assigning a value in an aggregate make sure range checks
are done if required. Then convert to the type of the field. */
if (Do_Range_Check (Expression (gnat_assoc)))
gnu_expr = emit_range_check (gnu_expr, Etype (gnat_field), Empty);
gnu_expr = convert (TREE_TYPE (gnu_field), gnu_expr);
/* Add the field and expression to the list. */
gnu_list = tree_cons (gnu_field, gnu_expr, gnu_list);
}
gnu_result = extract_values (gnu_list, gnu_type);
#ifdef ENABLE_CHECKING
{
tree gnu_field;
/* Verify every entry in GNU_LIST was used. */
for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field))
gcc_assert (TREE_ADDRESSABLE (gnu_field));
}
#endif
return gnu_result;
}
/* Build a possibly nested constructor for array aggregates. GNAT_EXPR is
the first element of an array aggregate. It may itself be an aggregate.
GNU_ARRAY_TYPE is the GCC type corresponding to the array aggregate.
GNAT_COMPONENT_TYPE is the type of the array component; it is needed
for range checking. */
static tree
pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
Entity_Id gnat_component_type)
{
tree gnu_index = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_array_type));
tree gnu_expr;
VEC(constructor_elt,gc) *gnu_expr_vec = NULL;
for ( ; Present (gnat_expr); gnat_expr = Next (gnat_expr))
{
/* If the expression is itself an array aggregate then first build the
innermost constructor if it is part of our array (multi-dimensional
case). */
if (Nkind (gnat_expr) == N_Aggregate
&& TREE_CODE (TREE_TYPE (gnu_array_type)) == ARRAY_TYPE
&& TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_array_type)))
gnu_expr = pos_to_constructor (First (Expressions (gnat_expr)),
TREE_TYPE (gnu_array_type),
gnat_component_type);
else
{
gnu_expr = gnat_to_gnu (gnat_expr);
/* Before assigning the element to the array, make sure it is
in range. */
if (Do_Range_Check (gnat_expr))
gnu_expr = emit_range_check (gnu_expr, gnat_component_type, Empty);
}
<API key> (gnu_expr_vec, gnu_index,
convert (TREE_TYPE (gnu_array_type), gnu_expr));
gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node, 0);
}
return <API key> (gnu_array_type, gnu_expr_vec);
}
/* Subroutine of <API key>: VALUES is a list of field associations,
some of which are from RECORD_TYPE. Return a CONSTRUCTOR consisting
of the associations that are from RECORD_TYPE. If we see an internal
record, make a recursive call to fill it in as well. */
static tree
extract_values (tree values, tree record_type)
{
tree field, tem;
VEC(constructor_elt,gc) *v = NULL;
for (field = TYPE_FIELDS (record_type); field; field = DECL_CHAIN (field))
{
tree value = 0;
/* _Parent is an internal field, but may have values in the aggregate,
so check for values first. */
if ((tem = purpose_member (field, values)))
{
value = TREE_VALUE (tem);
TREE_ADDRESSABLE (tem) = 1;
}
else if (DECL_INTERNAL_P (field))
{
value = extract_values (values, TREE_TYPE (field));
if (TREE_CODE (value) == CONSTRUCTOR
&& VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (value)))
value = 0;
}
else
/* If we have a record subtype, the names will match, but not the
actual FIELD_DECLs. */
for (tem = values; tem; tem = TREE_CHAIN (tem))
if (DECL_NAME (TREE_PURPOSE (tem)) == DECL_NAME (field))
{
value = convert (TREE_TYPE (field), TREE_VALUE (tem));
TREE_ADDRESSABLE (tem) = 1;
}
if (!value)
continue;
<API key> (v, field, value);
}
return <API key> (record_type, v);
}
/* EXP is to be treated as an array or record. Handle the cases when it is
an access object and perform the required dereferences. */
static tree
<API key> (tree exp)
{
/* If the type is a pointer, dereference it. */
if (POINTER_TYPE_P (TREE_TYPE (exp))
|| <API key> (TREE_TYPE (exp)))
exp = build_unary_op (INDIRECT_REF, NULL_TREE, exp);
/* If we got a padded type, remove it too. */
if (TYPE_IS_PADDING_P (TREE_TYPE (exp)))
exp = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
return exp;
}
/* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code
location and false if it doesn't. In the former case, set the Gigi global
variable REF_FILENAME to the simple debug file name as given by sinput. */
bool
Sloc_to_locus (Source_Ptr Sloc, location_t *locus)
{
if (Sloc == No_Location)
return false;
if (Sloc <= Standard_Location)
{
*locus = BUILTINS_LOCATION;
return false;
}
else
{
Source_File_Index file = <API key> (Sloc);
Logical_Line_Number line = <API key> (Sloc);
Column_Number column = Get_Column_Number (Sloc);
struct line_map *map = &line_table->maps[file - 1];
/* Translate the location according to the line-map.h formula. */
*locus = map->start_location
+ ((line - map->to_line) << map->column_bits)
+ (column & ((1 << map->column_bits) - 1));
}
ref_filename
= IDENTIFIER_POINTER
(get_identifier
(Get_Name_String (Debug_Source_Name (<API key> (Sloc)))));;
return true;
}
/* Similar to set_expr_location, but start with the Sloc of GNAT_NODE and
don't do anything if it doesn't correspond to a source location. */
static void
<API key> (tree node, Node_Id gnat_node)
{
location_t locus;
if (!Sloc_to_locus (Sloc (gnat_node), &locus))
return;
SET_EXPR_LOCATION (node, locus);
}
/* More elaborate version of <API key> to be used in more
general contexts, for example the result of the translation of a generic
GNAT node. */
static void
<API key> (tree node, Node_Id gnat_node)
{
/* Set the location information on the node if it is a real expression.
References can be reused for multiple GNAT nodes and they would get
the location information of their last use. Also make sure not to
overwrite an existing location as it is probably more precise. */
switch (TREE_CODE (node))
{
CASE_CONVERT:
case NON_LVALUE_EXPR:
break;
case COMPOUND_EXPR:
if (EXPR_P (TREE_OPERAND (node, 1)))
<API key> (TREE_OPERAND (node, 1), gnat_node);
/* ... fall through ... */
default:
if (!REFERENCE_CLASS_P (node) && !EXPR_HAS_LOCATION (node))
{
<API key> (node, gnat_node);
<API key> (node, gnat_node);
}
break;
}
}
/* Return a colon-separated list of encodings contained in encoded Ada
name. */
static const char *
extract_encoding (const char *name)
{
char *encoding = (char *) ggc_alloc_atomic (strlen (name));
get_encoding (name, encoding);
return encoding;
}
/* Extract the Ada name from an encoded name. */
static const char *
decode_name (const char *name)
{
char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60);
__gnat_decode (name, decoded, 0);
return decoded;
}
/* Post an error message. MSG is the error message, properly annotated.
NODE is the node at which to post the error and the node to use for the
'&' substitution. */
void
post_error (const char *msg, Node_Id node)
{
String_Template temp;
Fat_Pointer fp;
temp.Low_Bound = 1, temp.High_Bound = strlen (msg);
fp.Array = msg, fp.Bounds = &temp;
if (Present (node))
Error_Msg_N (fp, node);
}
/* Similar to post_error, but NODE is the node at which to post the error and
ENT is the node to use for the '&' substitution. */
void
post_error_ne (const char *msg, Node_Id node, Entity_Id ent)
{
String_Template temp;
Fat_Pointer fp;
temp.Low_Bound = 1, temp.High_Bound = strlen (msg);
fp.Array = msg, fp.Bounds = &temp;
if (Present (node))
Error_Msg_NE (fp, node, ent);
}
/* Similar to post_error_ne, but NUM is the number to use for the '^'. */
void
post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, int num)
{
Error_Msg_Uint_1 = UI_From_Int (num);
post_error_ne (msg, node, ent);
}
/* Set the end_locus information for GNU_NODE, if any, from an explicit end
location associated with GNAT_NODE or GNAT_NODE itself, whichever makes
most sense. Return true if a sensible assignment was performed. */
static bool
<API key> (tree gnu_node, Node_Id gnat_node)
{
Node_Id gnat_end_label = Empty;
location_t end_locus;
/* Pick the GNAT node of which we'll take the sloc to assign to the GCC node
end_locus when there is one. We consider only GNAT nodes with a possible
End_Label attached. If the End_Label actually was unassigned, fallback
on the orginal node. We'd better assign an explicit sloc associated with
the outer construct in any case. */
switch (Nkind (gnat_node))
{
case N_Package_Body:
case N_Subprogram_Body:
case N_Block_Statement:
gnat_end_label = End_Label (<API key> (gnat_node));
break;
case <API key>:
gnat_end_label = End_Label (Specification (gnat_node));
break;
default:
return false;
}
gnat_node = Present (gnat_end_label) ? gnat_end_label : gnat_node;
/* Some expanded subprograms have neither an End_Label nor a Sloc
attached. Notify that to callers. */
if (!Sloc_to_locus (Sloc (gnat_node), &end_locus))
return false;
switch (TREE_CODE (gnu_node))
{
case BIND_EXPR:
<API key> (BIND_EXPR_BLOCK (gnu_node)) = end_locus;
return true;
case FUNCTION_DECL:
<API key> (gnu_node)->function_end_locus = end_locus;
return true;
default:
return false;
}
}
/* Similar to post_error_ne, but T is a GCC tree representing the number to
write. If T represents a constant, the text inside curly brackets in
MSG will be output (presumably including a '^'). Otherwise it will not
be output and the text inside square brackets will be output instead. */
void
post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t)
{
char *new_msg = XALLOCAVEC (char, strlen (msg) + 1);
char start_yes, end_yes, start_no, end_no;
const char *p;
char *q;
if (TREE_CODE (t) == INTEGER_CST)
{
Error_Msg_Uint_1 = UI_From_gnu (t);
start_yes = '{', end_yes = '}', start_no = '[', end_no = ']';
}
else
start_yes = '[', end_yes = ']', start_no = '{', end_no = '}';
for (p = msg, q = new_msg; *p; p++)
{
if (*p == start_yes)
for (p++; *p != end_yes; p++)
*q++ = *p;
else if (*p == start_no)
for (p++; *p != end_no; p++)
;
else
*q++ = *p;
}
*q = 0;
post_error_ne (new_msg, node, ent);
}
/* Similar to post_error_ne_tree, but NUM is a second integer to write. */
void
<API key> (const char *msg, Node_Id node, Entity_Id ent, tree t,
int num)
{
Error_Msg_Uint_2 = UI_From_Int (num);
post_error_ne_tree (msg, node, ent, t);
}
/* Initialize the table that maps GNAT codes to GCC codes for simple
binary and unary operations. */
static void
init_code_table (void)
{
gnu_codes[N_And_Then] = TRUTH_ANDIF_EXPR;
gnu_codes[N_Or_Else] = TRUTH_ORIF_EXPR;
gnu_codes[N_Op_And] = TRUTH_AND_EXPR;
gnu_codes[N_Op_Or] = TRUTH_OR_EXPR;
gnu_codes[N_Op_Xor] = TRUTH_XOR_EXPR;
gnu_codes[N_Op_Eq] = EQ_EXPR;
gnu_codes[N_Op_Ne] = NE_EXPR;
gnu_codes[N_Op_Lt] = LT_EXPR;
gnu_codes[N_Op_Le] = LE_EXPR;
gnu_codes[N_Op_Gt] = GT_EXPR;
gnu_codes[N_Op_Ge] = GE_EXPR;
gnu_codes[N_Op_Add] = PLUS_EXPR;
gnu_codes[N_Op_Subtract] = MINUS_EXPR;
gnu_codes[N_Op_Multiply] = MULT_EXPR;
gnu_codes[N_Op_Mod] = FLOOR_MOD_EXPR;
gnu_codes[N_Op_Rem] = TRUNC_MOD_EXPR;
gnu_codes[N_Op_Minus] = NEGATE_EXPR;
gnu_codes[N_Op_Abs] = ABS_EXPR;
gnu_codes[N_Op_Not] = TRUTH_NOT_EXPR;
gnu_codes[N_Op_Rotate_Left] = LROTATE_EXPR;
gnu_codes[N_Op_Rotate_Right] = RROTATE_EXPR;
gnu_codes[N_Op_Shift_Left] = LSHIFT_EXPR;
gnu_codes[N_Op_Shift_Right] = RSHIFT_EXPR;
gnu_codes[<API key>] = RSHIFT_EXPR;
}
/* Return a label to branch to for the exception type in KIND or NULL_TREE
if none. */
tree
get_exception_label (char kind)
{
if (kind == <API key>)
return VEC_last (tree, <API key>);
else if (kind == <API key>)
return VEC_last (tree, <API key>);
else if (kind == <API key>)
return VEC_last (tree, <API key>);
else
return NULL_TREE;
}
/* Return the decl for the current elaboration procedure. */
tree
<API key> (void)
{
return VEC_last (tree, gnu_elab_proc_stack);
}
#include "gt-ada-trans.h" |
<?php namespace Laravel\Cashier;
use Config;
use Exception;
use Stripe\Event as StripeEvent;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\<API key>;
class WebhookController extends Controller
{
/**
* Handle a Stripe webhook call.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handleWebhook()
{
$payload = $this->getJsonPayload();
if (! $this->eventExistsOnStripe($payload['id'])) {
return;
}
$method = 'handle'.studly_case(str_replace('.', '_', $payload['type']));
if (method_exists($this, $method)) {
return $this->{$method}($payload);
} else {
return $this->missingMethod();
}
}
/**
* Verify with Stripe that the event is genuine.
*
* @param string $id
* @return bool
*/
protected function eventExistsOnStripe($id)
{
try {
return ! is_null(StripeEvent::retrieve($id, Config::get('services.stripe.secret')));
} catch (Exception $e) {
return false;
}
}
/**
* Handle a cancelled customer from a Stripe subscription.
*
* @param array $payload
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function <API key>(array $payload)
{
$billable = $this->getBillable($payload['data']['object']['customer']);
if ($billable && $billable->subscribed()) {
$billable->subscription()->cancel();
}
return new Response('Webhook Handled', 200);
}
/**
* Determine if the invoice has too many failed attempts.
*
* @deprecated Use Stripe webhook 'customer.subscription.deleted' instead.
*
* @param array $payload
* @return bool
*/
protected function <API key>(array $payload)
{
return $payload['data']['object']['attempt_count'] > 3;
}
/**
* Get the billable entity instance by Stripe ID.
*
* @param string $stripeId
* @return \Laravel\Cashier\Contracts\Billable
*/
protected function getBillable($stripeId)
{
return App::make('Laravel\Cashier\<API key>')->find($stripeId);
}
/**
* Get the JSON payload for the request.
*
* @return array
*/
protected function getJsonPayload()
{
return (array) json_decode(Request::getContent(), true);
}
/**
* Handle calls to missing methods on the controller.
*
* @param array $parameters
* @return mixed
*/
public function missingMethod($parameters = array())
{
return new Response;
}
} |
#define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt
#include <linux/init.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/irq.h>
#include <mach/hardware.h>
static unsigned char gpio_int_unmasked[3];
static unsigned char gpio_int_enabled[3];
static unsigned char gpio_int_type1[3];
static unsigned char gpio_int_type2[3];
static unsigned char gpio_int_debounce[3];
/* Port ordering is: A B F */
static const u8 <API key>[3] = { 0x90, 0xac, 0x4c };
static const u8 <API key>[3] = { 0x94, 0xb0, 0x50 };
static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 };
static const u8 <API key>[3] = { 0x9c, 0xb8, 0x58 };
static const u8 <API key>[3] = { 0xa8, 0xc4, 0x64 };
static void <API key>(unsigned port)
{
BUG_ON(port > 2);
__raw_writeb(0, EP93XX_GPIO_REG(<API key>[port]));
__raw_writeb(gpio_int_type2[port],
EP93XX_GPIO_REG(<API key>[port]));
__raw_writeb(gpio_int_type1[port],
EP93XX_GPIO_REG(<API key>[port]));
__raw_writeb(gpio_int_unmasked[port] & gpio_int_enabled[port],
EP93XX_GPIO_REG(<API key>[port]));
}
static inline void <API key>(unsigned line)
{
gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7));
}
static void <API key>(unsigned int irq, bool enable)
{
int line = irq_to_gpio(irq);
int port = line >> 3;
int port_mask = 1 << (line & 7);
if (enable)
gpio_int_debounce[port] |= port_mask;
else
gpio_int_debounce[port] &= ~port_mask;
__raw_writeb(gpio_int_debounce[port],
EP93XX_GPIO_REG(<API key>[port]));
}
static void <API key>(unsigned int irq, struct irq_desc *desc)
{
unsigned char status;
int i;
status = __raw_readb(<API key>);
for (i = 0; i < 8; i++) {
if (status & (1 << i)) {
int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_A(0)) + i;
generic_handle_irq(gpio_irq);
}
}
status = __raw_readb(<API key>);
for (i = 0; i < 8; i++) {
if (status & (1 << i)) {
int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i;
generic_handle_irq(gpio_irq);
}
}
}
static void <API key>(unsigned int irq, struct irq_desc *desc)
{
/*
* map discontiguous hw irq range to continous sw irq range:
*
* IRQ_EP93XX_GPIO{0..7}MUX -> gpio_to_irq(EP93XX_GPIO_LINE_F({0..7})
*/
int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */
int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_F(0)) + port_f_idx;
generic_handle_irq(gpio_irq);
}
static void ep93xx_gpio_irq_ack(struct irq_data *d)
{
int line = irq_to_gpio(d->irq);
int port = line >> 3;
int port_mask = 1 << (line & 7);
if (<API key>(d) == IRQ_TYPE_EDGE_BOTH) {
gpio_int_type2[port] ^= port_mask; /* switch edge direction */
<API key>(port);
}
__raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
}
static void <API key>(struct irq_data *d)
{
int line = irq_to_gpio(d->irq);
int port = line >> 3;
int port_mask = 1 << (line & 7);
if (<API key>(d) == IRQ_TYPE_EDGE_BOTH)
gpio_int_type2[port] ^= port_mask; /* switch edge direction */
gpio_int_unmasked[port] &= ~port_mask;
<API key>(port);
__raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
}
static void <API key>(struct irq_data *d)
{
int line = irq_to_gpio(d->irq);
int port = line >> 3;
gpio_int_unmasked[port] &= ~(1 << (line & 7));
<API key>(port);
}
static void <API key>(struct irq_data *d)
{
int line = irq_to_gpio(d->irq);
int port = line >> 3;
gpio_int_unmasked[port] |= 1 << (line & 7);
<API key>(port);
}
/*
* gpio_int_type1 controls whether the interrupt is level (0) or
* edge (1) triggered, while gpio_int_type2 controls whether it
* triggers on low/falling (0) or high/rising (1).
*/
static int <API key>(struct irq_data *d, unsigned int type)
{
const int gpio = irq_to_gpio(d->irq);
const int port = gpio >> 3;
const int port_mask = 1 << (gpio & 7);
irq_flow_handler_t handler;
<API key>(gpio);
switch (type) {
case <API key>:
gpio_int_type1[port] |= port_mask;
gpio_int_type2[port] |= port_mask;
handler = handle_edge_irq;
break;
case <API key>:
gpio_int_type1[port] |= port_mask;
gpio_int_type2[port] &= ~port_mask;
handler = handle_edge_irq;
break;
case IRQ_TYPE_LEVEL_HIGH:
gpio_int_type1[port] &= ~port_mask;
gpio_int_type2[port] |= port_mask;
handler = handle_level_irq;
break;
case IRQ_TYPE_LEVEL_LOW:
gpio_int_type1[port] &= ~port_mask;
gpio_int_type2[port] &= ~port_mask;
handler = handle_level_irq;
break;
case IRQ_TYPE_EDGE_BOTH:
gpio_int_type1[port] |= port_mask;
/* set initial polarity based on current input level */
if (gpio_get_value(gpio))
gpio_int_type2[port] &= ~port_mask; /* falling */
else
gpio_int_type2[port] |= port_mask; /* rising */
handler = handle_edge_irq;
break;
default:
pr_err("failed to set irq type %d for gpio %d\n", type, gpio);
return -EINVAL;
}
<API key>(d->irq, handler);
gpio_int_enabled[port] |= port_mask;
<API key>(port);
return 0;
}
static struct irq_chip <API key> = {
.name = "GPIO",
.irq_ack = ep93xx_gpio_irq_ack,
.irq_mask_ack = <API key>,
.irq_mask = <API key>,
.irq_unmask = <API key>,
.irq_set_type = <API key>,
};
void __init <API key>(void)
{
int gpio_irq;
for (gpio_irq = gpio_to_irq(0);
gpio_irq <= gpio_to_irq(<API key>); ++gpio_irq) {
<API key>(gpio_irq, &<API key>,
handle_level_irq);
set_irq_flags(gpio_irq, IRQF_VALID);
}
<API key>(IRQ_EP93XX_GPIO_AB,
<API key>);
<API key>(IRQ_EP93XX_GPIO0MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO1MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO2MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO3MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO4MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO5MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO6MUX,
<API key>);
<API key>(IRQ_EP93XX_GPIO7MUX,
<API key>);
}
struct ep93xx_gpio_chip {
struct gpio_chip chip;
void __iomem *data_reg;
void __iomem *data_dir_reg;
};
#define to_ep93xx_gpio_chip(c) container_of(c, struct ep93xx_gpio_chip, chip)
static int <API key>(struct gpio_chip *chip, unsigned offset)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
unsigned long flags;
u8 v;
local_irq_save(flags);
v = __raw_readb(ep93xx_chip->data_dir_reg);
v &= ~(1 << offset);
__raw_writeb(v, ep93xx_chip->data_dir_reg);
local_irq_restore(flags);
return 0;
}
static int <API key>(struct gpio_chip *chip,
unsigned offset, int val)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
unsigned long flags;
int line;
u8 v;
local_irq_save(flags);
/* Set the value */
v = __raw_readb(ep93xx_chip->data_reg);
if (val)
v |= (1 << offset);
else
v &= ~(1 << offset);
__raw_writeb(v, ep93xx_chip->data_reg);
/* Drive as an output */
line = chip->base + offset;
if (line <= <API key>) {
/* Ports A/B/F */
<API key>(line);
<API key>(line >> 3);
}
v = __raw_readb(ep93xx_chip->data_dir_reg);
v |= (1 << offset);
__raw_writeb(v, ep93xx_chip->data_dir_reg);
local_irq_restore(flags);
return 0;
}
static int ep93xx_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
return !!(__raw_readb(ep93xx_chip->data_reg) & (1 << offset));
}
static void ep93xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
unsigned long flags;
u8 v;
local_irq_save(flags);
v = __raw_readb(ep93xx_chip->data_reg);
if (val)
v |= (1 << offset);
else
v &= ~(1 << offset);
__raw_writeb(v, ep93xx_chip->data_reg);
local_irq_restore(flags);
}
static int <API key>(struct gpio_chip *chip,
unsigned offset, unsigned debounce)
{
int gpio = chip->base + offset;
int irq = gpio_to_irq(gpio);
if (irq < 0)
return -EINVAL;
<API key>(irq, debounce ? true : false);
return 0;
}
static void <API key>(struct seq_file *s, struct gpio_chip *chip)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
u8 data_reg, data_dir_reg;
int gpio, i;
data_reg = __raw_readb(ep93xx_chip->data_reg);
data_dir_reg = __raw_readb(ep93xx_chip->data_dir_reg);
gpio = ep93xx_chip->chip.base;
for (i = 0; i < chip->ngpio; i++, gpio++) {
int is_out = data_dir_reg & (1 << i);
int irq = gpio_to_irq(gpio);
seq_printf(s, " %s%d gpio-%-3d (%-12s) %s %s %s\n",
chip->label, i, gpio,
<API key>(chip, i) ? : "",
is_out ? "out" : "in ",
(data_reg & (1<< i)) ? "hi" : "lo",
(!is_out && irq>= 0) ? "(interrupt)" : "");
}
}
#define EP93XX_GPIO_BANK(name, dr, ddr, base_gpio) \
{ \
.chip = { \
.label = name, \
.direction_input = <API key>, \
.direction_output = <API key>, \
.get = ep93xx_gpio_get, \
.set = ep93xx_gpio_set, \
.dbg_show = <API key>, \
.base = base_gpio, \
.ngpio = 8, \
}, \
.data_reg = EP93XX_GPIO_REG(dr), \
.data_dir_reg = EP93XX_GPIO_REG(ddr), \
}
static struct ep93xx_gpio_chip ep93xx_gpio_banks[] = {
EP93XX_GPIO_BANK("A", 0x00, 0x10, 0),
EP93XX_GPIO_BANK("B", 0x04, 0x14, 8),
EP93XX_GPIO_BANK("C", 0x08, 0x18, 40),
EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 24),
EP93XX_GPIO_BANK("E", 0x20, 0x24, 32),
EP93XX_GPIO_BANK("F", 0x30, 0x34, 16),
EP93XX_GPIO_BANK("G", 0x38, 0x3c, 48),
EP93XX_GPIO_BANK("H", 0x40, 0x44, 56),
};
void __init ep93xx_gpio_init(void)
{
int i;
/* Set Ports C, D, E, G, and H for GPIO use */
<API key>(<API key> |
<API key> |
<API key> |
<API key> |
<API key>);
for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) {
struct gpio_chip *chip = &ep93xx_gpio_banks[i].chip;
/*
* Ports A, B, and F support input debouncing when
* used as interrupts.
*/
if (!strcmp(chip->label, "A") ||
!strcmp(chip->label, "B") ||
!strcmp(chip->label, "F"))
chip->set_debounce = <API key>;
gpiochip_add(chip);
}
} |
#include "config.h"
#include "CSSFontFaceSource.h"
#include "CSSFontFace.h"
#include "CSSFontSelector.h"
#include "CachedFont.h"
#include "<API key>.h"
#include "Document.h"
#include "ElementIterator.h"
#include "Font.h"
#include "FontCache.h"
#include "<API key>.h"
#include "FontDescription.h"
#include "<API key>.h"
#if ENABLE(SVG_FONTS)
#include "CachedSVGFont.h"
#include "<API key>.h"
#include "SVGFontElement.h"
#include "SVGFontFaceElement.h"
#include "SVGURIReference.h"
#endif
#if USE(DIRECT2D)
#include <dwrite.h>
#endif
namespace WebCore {
inline void CSSFontFaceSource::setStatus(Status newStatus)
{
switch (newStatus) {
case Status::Pending:
ASSERT_NOT_REACHED();
break;
case Status::Loading:
ASSERT(status() == Status::Pending);
break;
case Status::Success:
ASSERT(status() == Status::Loading);
break;
case Status::Failure:
ASSERT(status() == Status::Loading);
break;
}
m_status = newStatus;
}
CSSFontFaceSource::CSSFontFaceSource(CSSFontFace& owner, const String& familyNameOrURI, CachedFont* font, SVGFontFaceElement* fontFace, RefPtr<JSC::ArrayBufferView>&& arrayBufferView)
: m_familyNameOrURI(familyNameOrURI)
, m_font(font)
, m_face(owner)
, m_immediateSource(WTFMove(arrayBufferView))
#if ENABLE(SVG_FONTS)
, <API key>(fontFace)
#endif
{
#if !ENABLE(SVG_FONTS)
UNUSED_PARAM(fontFace);
#endif
// This may synchronously call fontLoaded().
if (m_font)
m_font->addClient(*this);
if (status() == Status::Pending && (!m_font || m_font->isLoaded())) {
setStatus(Status::Loading);
if (m_font && m_font->errorOccurred())
setStatus(Status::Failure);
else
setStatus(Status::Success);
}
}
CSSFontFaceSource::~CSSFontFaceSource()
{
if (m_font)
m_font->removeClient(*this);
}
void CSSFontFaceSource::fontLoaded(CachedFont& loadedFont)
{
ASSERT_UNUSED(loadedFont, &loadedFont == m_font.get());
// If the font is in the cache, this will be synchronously called from CachedFont::addClient().
if (m_status == Status::Pending)
setStatus(Status::Loading);
else if (m_status == Status::Failure) {
// This function may be called twice if loading was cancelled.
ASSERT(m_font->errorOccurred());
return;
}
if (m_face.<API key>())
return;
if (m_font->errorOccurred())
setStatus(Status::Failure);
else
setStatus(Status::Success);
m_face.fontLoaded(*this);
}
void CSSFontFaceSource::load(CSSFontSelector& fontSelector)
{
setStatus(Status::Loading);
ASSERT(m_font);
fontSelector.<API key>(*m_font);
}
RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& <API key>)
{
ASSERT(status() == Status::Success);
SVGFontFaceElement* fontFaceElement = nullptr;
#if ENABLE(SVG_FONTS)
fontFaceElement = <API key>.get();
#endif
if (!m_font && !fontFaceElement) {
if (m_immediateSource) {
if (!<API key>) {
bool wrapping;
RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<const char*>(m_immediateSource->baseAddress()), m_immediateSource->byteLength());
ASSERT(buffer);
<API key> = CachedFont::<API key>(*buffer, wrapping);
} if (!<API key>)
return nullptr;
return Font::create(CachedFont::<API key>(*<API key>, fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, <API key>), true);
}
// We're local. Just return a Font from the normal cache.
// We don't want to check alternate font family names here, so pass true as the <API key> parameter.
return FontCache::singleton().fontForFamily(fontDescription, m_familyNameOrURI, &fontFaceFeatures, &<API key>, true);
}
if (m_font) {
if (!m_font-><API key>(m_familyNameOrURI))
return nullptr;
return m_font->createFont(fontDescription, m_familyNameOrURI, syntheticBold, syntheticItalic, fontFaceFeatures, <API key>);
}
// In-Document SVG Fonts
if (!fontFaceElement)
return nullptr;
#if ENABLE(SVG_FONTS)
if (!is<SVGFontElement>(<API key>->parentNode()))
return nullptr;
if (!<API key>) {
SVGFontElement& fontElement = downcast<SVGFontElement>(*<API key>->parentNode());
if (auto otfFont = convertSVGToOTFFont(fontElement))
<API key> = SharedBuffer::adoptVector(otfFont.value());
if (!<API key>)
return nullptr;
<API key> = <API key>(*<API key>);
}
if (!<API key>)
return nullptr;
#if PLATFORM(COCOA)
return Font::create(<API key>->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, <API key>), true, false);
#else
return Font::create(<API key>->fontPlatformData(fontDescription, syntheticBold, syntheticItalic), true, false);
#endif
#endif
ASSERT_NOT_REACHED();
return nullptr;
}
#if ENABLE(SVG_FONTS)
bool CSSFontFaceSource::isSVGFontFaceSource() const
{
return <API key> || is<CachedSVGFont>(m_font.get());
}
#endif
} |
<? $reg_user = '111'; $reg_pass = '111'; ?> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.